Friday, December 2, 2016
Angularjs filter number to scientific number
Tags:
angularjs,
fiddle,
filter,
formula,
javascript,
scientific number
How to fetch local db in android apps?
Steps to get local db in android apps:
:: For copy database file to desktop and get permission adb shell run-as com.utryfirst.student chmod 666 databases/pencil_local_db.db exit cp /data/data/com.utryfirst.student/databases/pencil_local_db.db /sdcard/ run-as com.utryfirst.student chmod 600 databases/pencil_local_db.db exit exit adb pull /sdcard/pencil_local_db.db
Thursday, December 1, 2016
PHP function to calculate standard deviation
// Function to calculate square of value - mean
function sd_square($x, $mean) { return pow($x - $mean,2); }
// Function to calculate standard deviation (uses sd_square)
function sd($array)
{
if(count($array)> 0):
return sqrt(
array_sum(array_map("sd_square",
$array,
array_fill
(
0,
count($array),
(array_sum($array) / count($array))
)
)
) / (count($array)-1) );
endif;
}
SyntaxHighlighter 3.0.83
How to use? E.g:
<pre class="bursh:php"> </pre>
SyntaxHighlighter uses separate syntax files called brushes to define its highlighting functionality.
| Brush name | Brush aliases | File name |
|---|---|---|
| ActionScript3 | as3, actionscript3 | shBrushAS3.js |
| Bash/shell | bash, shell | shBrushBash.js |
| ColdFusion | cf, coldfusion | shBrushColdFusion.js |
| C# | c-sharp, csharp | shBrushCSharp.js |
| C++ | cpp, c | shBrushCpp.js |
| CSS | css | shBrushCss.js |
| Delphi | delphi, pas, pascal | shBrushDelphi.js |
| Diff | diff, patch | shBrushDiff.js |
| Erlang | erl, erlang | shBrushErlang.js |
| Groovy | groovy | shBrushGroovy.js |
| JavaScript | js, jscript, javascript | shBrushJScript.js |
| Java | java | shBrushJava.js |
| JavaFX | jfx, javafx | shBrushJavaFX.js |
| Perl | perl, pl | shBrushPerl.js |
| PHP | php | shBrushPhp.js |
| Plain Text | plain, text | shBrushPlain.js |
| PowerShell | ps, powershell | shBrushPowerShell.js |
| Python | py, python | shBrushPython.js |
| Ruby | rails, ror, ruby | shBrushRuby.js |
| Scala | scala | shBrushScala.js |
| SQL | sql | shBrushSql.js |
| Visual Basic | vb, vbnet | shBrushVb.js |
| XML | xml, xhtml, xslt, html, xhtml | shBrushXml.js |
Monday, November 21, 2016
Dummy data for pfm_student_subject
(student_id, subject_code_id, dt_update, short_name, overall_accuracy, overall_coverage, last_three_months_coverage, last_three_months_accuracy) SELECT * FROM ( SELECT 85, e.subject_code_id, (NOW() - INTERVAL ROUND((RAND() * (90-0))+0) DAY) as dt_update, ec.short_name, ROUND(AVG((RAND() * (100-0))+0)) as overall_accuracy, ROUND(AVG((RAND() * (100-0))+0)) as overall_coverage, ROUND(AVG((RAND() * (100-0))+0)) as last_three_months_coverage, ROUND(AVG((RAND() * (100-0))+0)) as last_three_months_accuracy FROM edu_student_subject e LEFT JOIN edu_subject_code ec ON ec.subject_code_id = e.subject_code_id WHERE e.student_id=85 GROUP BY e.subject_code_id) as tbl1 ON DUPLICATE KEY UPDATE dt_update = tbl1.dt_update, short_name = tbl1.short_name, overall_accuracy = tbl1.overall_accuracy, overall_coverage = tbl1.overall_coverage, last_three_months_coverage = tbl1.last_three_months_coverage, last_three_months_accuracy = tbl1.last_three_months_accuracy;