2017年12月20日 星期三

mysql setup

  • shell> mysql --user=root -p  an
  • 輸入密碼
  • mysql> use mysql  
  • mysql> GRANT SELECT,INSERT,UPDATE,DELETE ON [db_name].* TO [username]@[remoteIP] identified by '[password]';   
  • mysql> FLUSH PRIVILEGES;
其中幾項參數名稱的說明如下:
  • db_name:想要從遠端連接的資料庫名稱
  • username:就是 username 嘛,若你是遇上這個問題,這個通常就是 root 囉!
  • remoteIP:用戶或程式所在的遠端 IP,這邊可以使用 % 來開放某個網段,如:'192.168.%.%',注意兩個單引號是一定要加的喔!
  • password:就密碼啦,最好也加上兩邊的單引號。
  • 最後的最後記得加上 ; 因為這是SQL語法。
https://www.psce.com/blog/2012/04/01/how-to-find-mysql-configuration-file/


2017年12月11日 星期一

dd

 Public Shared Function getattachment(ByVal no As String) As Integer
        Dim conString As String = "Server=192.168.0.208;Port=5432; Userid=confluence_user;Password=confluence_user; Protocol=3;SSL=false;Pooling=true;Mi" &
      "nPoolSize=1; MaxPoolSize=20;Encoding=UNICODE; Timeout=15;SslMode=Disable;Database=confluence2"
        Dim ourDataTable1 As DataTable = Nothing
        Dim connection As Npgsql.NpgsqlConnection = New Npgsql.NpgsqlConnection(conString)
        Try
            'MsgBox(no)
            ourDataTable1 = New DataTable
            Dim ourAdapter1 As Npgsql.NpgsqlDataAdapter = New NpgsqlDataAdapter("select sdata1-sdata2 as rlt " &
    "from " &
    "( " &
        "select id3, sum(data1) as sdata1, sum(data2) as sdata2 " &
        "from " &
        " ( " &
            "select b.spacekey as id3,count(1) as data1, 0 as data2 " &
            "from content a,spaces b " &
            "where a.spaceid = b.spaceid  " &
               " and a.contenttype = 'PAGE' " &
                "and a.content_status = 'current' " &
                "and a.prevver is null and b.spacekey='" & no & "'" &
            " group by b.spacekey " &
            "union all " &
            "select id3, 0 as data1, id6 as data2 " &
            "from log2 where id2='7' and id3='" & no & "'" &
        ") v1 " &
       " group by id3 " &
    ") v2 ", connection)


            'CAST (id3 AS INTEGER)
            ' MsgBox("SELECT (t2.data - t1.data) AS data FROM log2 AS t1 INNER JOIN content AS t2 ON t1.id = t2.id WHERE t1.CAST (id3 AS INTEGER) =" & no & "")
            ourAdapter1.SelectCommand.Parameters.AddWithValue("@no", no)
            ' ourAdapter.SelectCommand.CommandType = CommandType.StoredProcedure
            ourAdapter1.Fill(ourDataTable1)
            If IsDBNull(no) Then
                Return ""
            Else
                If ourDataTable1.Rows.Count <> 0 Then
                    Return ourDataTable1.Rows(0)("rlt").ToString
                Else
                    Return ""
                End If
            End If

        Catch ex As Exception

        End Try


    End Function

2017年12月6日 星期三

2017年11月28日 星期二

gliffy

https://marketplace.atlassian.com/plugins/com.gliffy.integration.confluence/versions

2017年11月20日 星期一

mp4

Hi Anderson,
I wrote that article a long time ago! If I understand correctly, you want it to autoplay? It plays OK if you use the play button?
The problem may be that you need the `playsinline` attribute—Apple made some changes in iOS10 to how video autoplays. It’s all explained here: https://webkit.org/blog/6784/new-video-policies-for-ios/
So the code you should need would be:

<video  width="880" height="350" autoplay loop muted playsinline>
  <source src="index.mp4">
  Your browser does not support the video tag.
</video>

2017年11月19日 星期日

adobe

http://prodesigntools.com/adobe-cc-2018-direct-download-links.html


adobe cc offline update

created by kglad in Adobe Creative Cloud - View the full discussion

Single user licensee downloadable installation files available:

Updates

  • Download and installation help for Prodesigntools links are listed on most linked pages.  They are critical; especially steps 1, 2 and 3.  If you click a link that does not have those steps listed, open a second window using the Lightroom 3 link to see those 'Important Instructions'.

And a big thank you to Jim @ Prodesigntools for helping me with these links!

2017年11月12日 星期日

saml

https://marketplace.atlassian.com/plugins/com.bitium.confluence.SAML2Plugin/server/overview
https://moodle.org/plugins/pluginversions.php?plugin=auth_saml2
https://marketplace.atlassian.com/plugins/com.atlassian.labs.rest-api-browser/versions
https://marketplace.atlassian.com/plugins/org.echocat.adam/server/overview

2017年11月5日 星期日

fff

https://developer.atlassian.com/jiradev/jira-platform/jira-architecture/database-schema/database-user-and-group-tables

https://getsupport.atlassian.com/servicedesk/customer/portal/14/CSP-157507

https://getsupport.atlassian.com/servicedesk/customer/portal/14/CSP-175138

https://getsupport.atlassian.com/servicedesk/customer/portal/14/CSP-166980

https://marketplace.atlassian.com/plugins/com.change_vision.astah.astah-confluence-macro/server/overview

https://getsupport.atlassian.com/servicedesk/customer/portal/14/CSP-183262

https://getsupport.atlassian.com/servicedesk/customer/portal/14/CSP-179500

https://moodle.org/plugins/pluginversions.php?plugin=mod_helixmedia

2017年10月26日 星期四

blueprint

https://api.autopilothq.com/anywhere/m?s=statuspage&m=s_41fd3447-41a5-4293-975f-cde286d8ce7a&u=e1jq4wvfdtfkcc9m84rk0d9j5mvk4h1m5mu3cc9t5mwm8hj15mw3cghq6cvkachn6ww48&r2=d1u78w3k78qjyxvqewq64v3ncnn6arbeecq66vvd5wu32c1p74r3gchn&n=2

Michael Simmons, Product Advocate at Statuspage, is currently online at https://bluejeans.com/812643623 until 11:30am Pacific Time.
Feel free to pop into the room, ask him questions and chat about anything Statuspage. No video or microphone needed (there's a chat feature) but you may need to go through some bluejeans setup.
If you're free you should do it!

http://www.adobe-gcevent.com/tw/edm/edm171018AcrobatDCTW/edm171018AcrobatDCTW-171010-Adobe.html

vc

http://online.ithome.com.tw/001/20100430/index4.html

We are going to install the dual operating system as a single operating system, and you need to confirm the need to re-apply lincense

2017年10月24日 星期二

confluence

https://jira.atlassian.com/browse/CONFSERVER-36018

https://confluence.atlassian.com/confkb/how-to-rename-the-user-unknown-user-as-the-content-creator-caused-by-user-deletion-740001947.html

https://confluence.atlassian.com/confkb/how-to-get-a-list-of-all-unknown-user-in-confluence-867362827.html

2017年10月23日 星期一

moodle

https://moodle.org/mod/forum/discuss.php?d=330150#p1328560

https://moodle.org/mod/forum/discuss.php?d=326788#p1313442

https://moodle.org/mod/forum/discuss.php?d=327358#p1316231

activity3

https://www.ithome.com.tw/news/117641
https://dotblogs.com.tw/aspnetshare/2017/10/21/170024
https://confluence.atlassian.com/confkb/user-cannot-login-to-confluence-with-ldap-synchronization-enabled-687014865.html
https://community.atlassian.com/t5/Questions/Jira-and-Confluence-Authentication-problems/qaq-p/324770

https://www.accupass.com/event/1708250301346464572170

2017年10月17日 星期二

vc

https://www.clarybusinessmachines.com/Tandberg-TelePresence-System-Edge-95-MXP_11041.htm

2017年9月26日 星期二

ost

http://www.ost2.com/ost-to-pst.aspx?gclid=Cj0KCQjw9afOBRDWARIsAJW4nvw1cEyT0KZLE99O4rSRFfK-EN64L8BvGOUQkOjN9FK63fSqFz5_EiYaAvvmEALw_wcB

xmind

http://www.xmind.net/blog/en/2013/01/freemind-and-mindmanager/

2017年9月24日 星期日

confluence process

0. 申請production confluence 4.2.1資料庫備份檔
1. install blank confluence 4.2.1 版本 ( ap * 1 , db * 1 )
2. attachments folder 同步至 預定要升級的confluence( previous setting first )
3. db data restore
4. index folder copy to new confluence server
5. reindex action in new confluence server 4.2.1
6. uninstall plugin which included sql plugin, reporting plugin,archive plugin
7. update confluence from 4.2.1 to 5.8.2
8. reindex action in new confluence server 5.8.2
9. change port from 8090 to 80 port
10. restart confluence to test normal or not
11. adjust confluence setting

xmind

https://drive.google.com/file/d/0BxriXuT0xeaFWmFsdVg2OGg4aVk/view?usp=sharing

https://drive.google.com/file/d/0BxriXuT0xeaFX18xcDRJNjlKUWs/view?usp=sharing

2017年9月18日 星期一

outlook index

https://answers.microsoft.com/zh-hant/msoffice/forum/msoffice_outlook-mso_winother/outlook-2013/5e9e6e17-bd10-4100-b62c-347295970faa?auth=1

2017年9月17日 星期日

rsync +ssh

http://download.ithome.com.tw/article/index/id/1722

http://www.davidpai.tw/ubuntu/2011/rsync_backup/#comment-23526

http://ithelp.ithome.com.tw/questions/10184135

https://www.digitalocean.com/community/tutorials/how-to-copy-files-with-rsync-over-ssh

modify permission setting for establish: http://wallyjue.blogspot.tw/2008/08/ssh-unprotected-private-key-file.html

2017年9月13日 星期三

outlook search can not work

https://social.technet.microsoft.com/Forums/zh-TW/2e0613dd-d994-4c91-b85a-58956108a28c/outlook-20071010-?forum=officezhcht

apple

致電 Apple 支援:
(886) 0800-095-988
上午 9 點至晚上 9 點(週一至週日)
當您準備就緒時,請於上班時間撥打上面的電話號碼並提供您的案件 ID,以便獲得更快速的支援服務。

案件 ID:100288562623



https://www.apple.com/tw/contact/

2017年9月12日 星期二

windows search

https://support.microsoft.com/zh-tw/help/2769651/outlook-search-returns-no-matches-found

https://support.office.com/zh-tw/article/%E4%BD%BF%E7%94%A8%E7%AB%8B%E5%8D%B3%E6%90%9C%E5%B0%8B%E5%B0%8B%E6%89%BE%E9%83%B5%E4%BB%B6%E6%88%96%E9%A0%85%E7%9B%AE-69748862-5976-47b9-98e8-ed179f1b9e4d

https://support.office.com/zh-tw/article/%E4%BA%86%E8%A7%A3%E5%A6%82%E4%BD%95%E5%9C%A8-Outlook-%E4%B8%AD%E7%B8%AE%E5%B0%8F%E6%90%9C%E5%B0%8B%E6%BA%96%E5%89%87%E4%BB%A5%E7%8D%B2%E5%BE%97%E6%9B%B4%E4%BD%B3%E7%9A%84%E6%90%9C%E5%B0%8B%E7%B5%90%E6%9E%9C-d824d1e9-a255-4c8a-8553-276fb895a8da


https://support.office.com/zh-tw/article/%E4%BD%BF%E7%94%A8%E7%AB%8B%E5%8D%B3%E6%90%9C%E5%B0%8B%E5%B0%8B%E6%89%BE%E9%83%B5%E4%BB%B6%E6%88%96%E9%A0%85%E7%9B%AE-69748862-5976-47b9-98e8-ed179f1b9e4d

eat

石頭火鍋 2.好樂迪 3.還在想  (我發現大家應該都喜歡吃粗飽的那一種 不喜歡吃氣氛的 因此會以那一類的地點為主)

第3家: 福道田日式料理
雲林縣斗六市永安路68號

symantec

https://www.symantec.com/connect/forums/device-id-detected-question

2017年9月11日 星期一

mp4 -website

https://confluence.atlassian.com/confkb/unable-to-play-embedded-mp4-videos-on-ipad-or-iphone-in-confluence-305037325.html

2017年9月10日 星期日

confluence delete option

https://confluence.atlassian.com/conf54/confluence-user-s-guide/organising-content/working-with-pages/deleting-a-page

https://confluence.atlassian.com/conf54/confluence-user-s-guide/giving-people-access-to-content/space-administrators-and-their-permissions


https://confluence.atlassian.com/conf56/deleting-a-page-658736993.html

2017年9月5日 星期二

ff

https://moodle.org/plugins/report_coursesize
https://moodle.org/plugins/enrol_signup

2017年9月3日 星期日

pdf sam

http://www.pdfsam.org/download-pdfsam-basic/

moodle assignment3

https://moodle.une.edu.au/mod/book/view.php?id=1134601&chapterid=286267

https://moodle.org/mod/forum/discuss.php?d=100237

2017年8月27日 星期日

postgresql import csv




COPY log
FROM '/root/5.csv'
DELIMITER ','
CSV HEADER;

GRANT SELECT ON log TO PUBLIC;

COPY log FROM '/tab/6.csv' CSV HEADER;

exo

https://community.exoplatform.com/portal/intranet/forum/topic/topic50443d707f00000100f10a7c909d19f9

http://docs.jboss.org/exojcr/1.12.6-GA/developer/en-US/html_single/#Core.LDAPConfiguration


opends directory server

gatein 3.0.0 final tomcat


https://docs.exoplatform.org/public/index.jsp?topic=%2FPLF40%2FPLFUserGuide.GettingStarted.TrialEdition.html

2017年8月23日 星期三

2017年8月20日 星期日

Learner report by Learner with grades

Which Learners in which course and what are the grades

SELECT u.firstname AS 'Name' , u.lastname AS 'Surname', c.fullname AS 'Course', cc.name AS 'Category',
CASE WHEN gi.itemtype = 'Course'   
THEN c.fullname + ' Course Total' 
ELSE gi.itemname
END AS 'Item Name', ROUND(gg.finalgrade,2) AS Score,ROUND(gg.rawgrademax,2) AS MAX, ROUND(gg.finalgrade / gg.rawgrademax * 100 ,2) AS Percentage,
IF (ROUND(gg.finalgrade / gg.rawgrademax * 100 ,2) > 79,'Yes' , 'No') AS Pass
FROM mdl_course AS c
JOIN mdl_context AS ctx ON c.id = ctx.instanceid
JOIN mdl_role_assignments AS ra ON ra.contextid = ctx.id
JOIN mdl_user AS u ON u.id = ra.userid
JOIN mdl_grade_grades AS gg ON gg.userid = u.id
JOIN mdl_grade_items AS gi ON gi.id = gg.itemid
JOIN mdl_course_categories AS cc ON cc.id = c.category
WHERE  gi.courseid = c.id AND gi.itemname != 'Attendance'
ORDER BY `Name` ASC

Grade and Course Completion Reports

Site-Wide Grade Report with All Items

Shows grades for all course items along with course totals for each student. Works with ad-hoc reports or Configurable Reports



SELECT u.firstname AS 'First' , u.lastname AS 'Last', u.firstname + ' ' + u.lastname AS 'Display Name',
c.fullname AS 'Course',
cc.name AS 'Category',
CASE
  WHEN gi.itemtype = 'course'
   THEN c.fullname + ' Course Total'
  ELSE gi.itemname
END AS 'Item Name',
ROUND(gg.finalgrade,2) AS Grade,DATE_ADD('1970-01-01', INTERVAL gi.timemodified SECOND) AS Time
FROM mdl_course AS c
JOIN mdl_context AS ctx ON c.id = ctx.instanceid
JOIN mdl_role_assignments AS ra ON ra.contextid = ctx.id
JOIN mdl_user AS u ON u.id = ra.userid
JOIN mdl_grade_grades AS gg ON gg.userid = u.id
JOIN mdl_grade_items AS gi ON gi.id = gg.itemid
JOIN mdl_course_categories AS cc ON cc.id = c.category
WHERE  gi.courseid = c.id
ORDER BY lastname

2017年8月18日 星期五

2017年8月15日 星期二

moodle - plugin

https://moodle.org/plugins/pluginversions.php?plugin=auth_uniquelogin

https://moodle.org/plugins/qformat_wordtable

https://moodle.org/plugins/mod_offlinequiz

2017年8月13日 星期日

mdl & time

select * from mdl_log,mdl_block_timestat where mdl_log.id = mdl_block_timestat.log_id

2017年8月10日 星期四

id

SELECT course, FROM_UNIXTIME( timemodified ) FROM mdl_assign

SELECT id, FROM_UNIXTIME( timemodified ) FROM mdl_course

select course,FROM_UNIXTIME( timemodified ) FROM  mdl_feedback

select course,FROM_UNIXTIME( timemodified ) FROM  mdl_folder

SELECT courseid, FROM_UNIXTIME( timemodified ) FROM  `mdl_event`

select course,,FROM_UNIXTIME( timemodified ) from mdl_quiz


SELECT course, FROM_UNIXTIME( TIME )
FROM mdl_log
WHERE ACTION =  'update'
AND module =  'course'


select course,,FROM_UNIXTIME( timemodified ) from mdl_quiz

SELECT *,FROM_UNIXTIME(timemodified) FROM `mdl_event`

2017年8月9日 星期三

score of assignment

SELECT u.id,u.picture,u.firstname,u.lastname,u.firstnamephonetic,u.lastnamephonetic,u.middlename,u.alternatename,u.imagealt,u.email, u.id as userid, s.status as status, s.id as submissionid, s.timecreated as firstsubmission, s.timemodified as timesubmitted, s.attemptnumber as attemptnumber, g.id as gradeid, g.grade as grade, g.timemodified as timemarked, g.timecreated as firstmarked, uf.mailed as mailed, uf.locked as locked, uf.extensionduedate as extensionduedate, uf.workflowstate as workflowstate, uf.allocatedmarker as allocatedmarker FROM mdl_user u LEFT JOIN mdl_assign_submission s ON u.id = s.userid AND  s.latest = 1 LEFT JOIN mdl_assign_grades g ON u.id = g.userid AND g.attemptnumber = s.attemptnumber LEFT JOIN mdl_assign_user_flags uf ON u.id = uf.userid

SELECT c.id, c.shortname, g.assignment, a.name, u.username, g.grade
FROM prefix_assign_grades AS g
JOIN prefix_user AS u ON g.userid = u.id
JOIN prefix_assign AS a ON g.assignment = a.id
JOIN prefix_course AS c ON a.course = c.id
WHERE c.id = ## AND u.id = ##
Showing rows 0 - 29 ( 16,818 total, Query took 0.0011 sec)
SELECT u.id, u.picture, u.firstname, u.lastname, u.firstnamephonetic, u.lastnamephonetic, u.middlename, u.alternatename, u.imagealt, u.email, u.id AS userid, s.status AS
STATUS , s.id AS submissionid, s.timecreated AS firstsubmission, s.timemodified AS timesubmitted, s.attemptnumber AS attemptnumber, g.id AS gradeid, g.grade ASgrade, g.timemodified AS timemarked, g.timecreated AS firstmarked, uf.mailed AS mailed, uf.locked AS locked, uf.extensionduedate AS extensionduedate,uf.workflowstate AS workflowstate, uf.allocatedmarker AS allocatedmarker
FROM mdl_user u
LEFT JOIN mdl_assign_submission s ON u.id = s.userid
AND s.latest =1
LEFT JOIN mdl_assign_grades g ON u.id = g.userid
AND g.attemptnumber = s.attemptnumber
LEFT JOIN mdl_assign_user_flags uf ON u.id = uf.userid
LIMIT 0 , 30

2017年7月3日 星期一

can not install postgresql

https://ubuntuforums.org/showthread.php?t=2277582

https://askubuntu.com/questions/888098/ubuntuunable-to-correct-problems-you-have-held-broken-packages

2017年6月6日 星期二

4432

https://drive.google.com/file/d/0BxriXuT0xeaFZldxTlZRNUk3blU/view?usp=sharing

https://drive.google.com/file/d/0BxriXuT0xeaFa3g4V3BGcGl4b00/view?usp=sharing

2017年6月4日 星期日

love2

https://drive.google.com/file/d/0BxriXuT0xeaFYUo4cXJnZWRHMm8/view?usp=sharing

2017年5月9日 星期二

as

   <asp:GridView ID="GridView1" runat="server" AllowPaging="True"
            AutoGenerateColumns="False" CellPadding="4" EnableModelValidation="True"
            ForeColor="#333333" GridLines="None">
            <AlternatingRowStyle BackColor="White" />
            <Columns>
                <asp:TemplateField HeaderText="xtitle">
                    <EditItemTemplate>
                        <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("xtitle") %>'></asp:TextBox>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label1" runat="server" Text='<%# Bind("xtitle") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="xsubtitle">
                    <EditItemTemplate>
                        <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("xsubtitle") %>'></asp:TextBox>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label2" runat="server" Text='<%# Bind("xsubtitle") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
            <EditRowStyle BackColor="#2461BF" />
            <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
            <RowStyle BackColor="#EFF3FB" />
            <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
        </asp:GridView>


 Protected Sub GridView1_PageIndexChanging(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewPageEventArgs) Handles GridView1.PageIndexChanging
        GridView1.PageIndex = e.NewPageIndex
        bindGridView()
    End Sub
    Sub bindGridView()
        Dim strDbCon As String = "Data Source=(local);Initial Catalog=DB14017;Persist Security Info=True;User ID=sa;Password=5342601water"
        Dim con As New SqlConnection(strDbCon)
        Dim ad As New SqlDataAdapter("select * from tw_job_tb where xpublish='yes' order by xcredate desc", con)
        Dim dt As New DataTable
        ad.Fill(dt)
        With GridView1
            .DataSource = dt
            .DataBind()

        End With
    End Subㄎ

2017年5月4日 星期四

view count of confluence

https://www.appfusions.com/display/CONFENGAGE/Documentation

https://community.atlassian.com/t5/Confluence-questions/I-d-like-to-know-the-page-view-numbers/qaq-p/164636


https://confluence.atlassian.com/adminjiraserver073/logging-and-profiling-861253813.html?_ga=2.240729667.1995661888.1493898694-1060574096.1486998398

https://community.atlassian.com/t5/Confluence-questions/Page-Hit-count-for-confluence/qaq-p/390350


http://linoxide.com/ubuntu-how-to/awstats/

2017年4月17日 星期一

dd

link

txt

postgresql

http://snowdaily.pixnet.net/blog/post/61677905-%E4%BD%BF%E7%94%A8asp.net-c%23%E9%80%A3%E6%8E%A5postgresql-server

https://forums.asp.net/t/402746.aspx?How+can+i+connect+to+Postgres+

https://www.codeproject.com/Articles/30989/Using-PostgreSQL-in-your-C-NET-application-An-intr

2017年4月16日 星期日

moodle quiz & final grade sql

quiz score
SELECT
     mdl_grade_items.itemname,
     mdl_grade_items.grademax,
     ROUND(mdl_grade_grades.finalgrade, 0) AS finalgrade,
     mdl_user.firstname,
     mdl_user.lastname,
     mdl_user.username
FROM
     mdl_grade_grades
     INNER JOIN mdl_user ON mdl_grade_grades.userid = mdl_user.id
     INNER JOIN mdl_grade_items ON mdl_grade_grades.itemid = mdl_grade_items.id
WHERE (mdl_grade_items.itemname IS NOT NULL)
AND (mdl_grade_items.itemtype = 'mod' OR mdl_grade_items.itemtype = 'manual')
AND (mdl_grade_items.itemmodule = 'quiz' OR mdl_grade_items.itemmodule IS NULL)
AND (mdl_grade_grades.timemodified IS NOT NULL)
AND (mdl_grade_grades.finalgrade > 0)
AND (mdl_user.deleted = 0)




SELECT MONTH( from_unixtime( `mdl_stats_user_monthly`.`timeend` ) ) AS calendar_month, YEAR( from_unixtime( `mdl_stats_user_monthly`.`timeend` ) ) AS calendar_year, mdl_role.name AS user_role, COUNT( DISTINCT mdl_stats_user_monthly.userid ) AS total_users
FROM mdl_stats_user_monthly
INNER JOIN mdl_role_assignments ON mdl_stats_user_monthly.userid = mdl_role_assignments.userid
INNER JOIN mdl_context ON mdl_role_assignments.contextid = mdl_context.id
INNER JOIN mdl_role ON mdl_role_assignments.roleid = mdl_role.id
WHERE mdl_context.contextlevel =50
AND `mdl_stats_user_monthly`.`stattype` = 'activity'
AND mdl_stats_user_monthly.courseid <>1
GROUP BY MONTH( from_unixtime( `mdl_stats_user_monthly`.`timeend` ) ) , YEAR( from_unixtime( `mdl_stats_user_monthly`.`timeend` ) ) , mdl_stats_user_monthly.stattype, mdl_role.name
ORDER BY YEAR( from_unixtime( `mdl_stats_user_monthly`.`timeend` ) ) , MONTH( from_unixtime( `mdl_stats_user_monthly`.`timeend` ) ) , mdl_role.name
LIMIT 0 , 30



SELECT
(SELECT COUNT(id) FROM mdl_course) - 1 AS courses,
(SELECT COUNT(id) FROM mdl_user WHERE deleted = 0 AND confirmed = 1) AS users,
(SELECT COUNT(DISTINCT ra.userid)
 FROM mdl_role_capabilities rc
 JOIN mdl_role_assignments ra ON ra.roleid = rc.roleid
 WHERE rc.capability IN ('moodle/course:upd' || 'ate', 'moodle/site:doanything')) AS teachers,
(SELECT COUNT(id) FROM mdl_role_assignments) AS enrolments,
(SELECT COUNT(id) FROM mdl_forum_posts) AS forum_posts,
(SELECT COUNT(id) FROM mdl_resource) AS resources,
(SELECT COUNT(id) FROM mdl_question) AS questions



list all grades
SELECT * FROM
(SELECT
gg.timemodified,
u.username,
u.firstname,
u.lastname,
u.email,
gg.finalgrade,
gi.courseid
FROM mdl_grade_grades_history gg
JOIN mdl_grade_items gi ON gi.id = gg.itemid
JOIN mdl_user u ON u.id = gg.userid
JOIN mdl_course c ON c.id=gi.courseid
WHERE
gi.itemtype = 'course' AND
gg.finalgrade IS NOT NULL AND
(gg.timemodified > 1 AND gg.timemodified < 99999999999) AND c.category=76
ORDER BY gg.timemodified DESC) AS temp
GROUP BY username
ORDER BY username