Monday, December 31, 2012

WinJS Binding

Windows 8 Application tile update


Ref:
http://msdn.microsoft.com/en-us/library/windows/apps/hh761490.aspx

Updating notification tile:

//1. Choose a tile contents template:
var tmpl = Windows.UI.Notifications.TileTemplateType.tileWideImageAndText01;

//2. Get tile xml dom:
var xml = Windows.UI.Notifications.TileUpdateManager.getTemplateContent( tmpl )

//3. Update text:
var txt = xml.getElementsByTagName("text");
txt[0].appendChild( xml.createTextNode("Hello World") );

//4. UpdateImage:
var img = xml.getElementsByTagName("img");
img[0].setAttribute("src", "ms-appx:///images/logo.png");

//5. Create a notification via the new xml and set it to expire in 10 minutes:
var notification = new Windows.UI.Notifications.TileNotification( xml );
notification.expirationTime = new Date( (new Date()).getTime() + 600 * 1000 );

//6. Send the tile update
Windows.UI.Notifications.TileUpdateManager.createTileUpdateForApplication().update(notification);

Wednesday, November 28, 2012

What is HTML5 ARIA? - Stack Overflow

What is HTML5 ARIA? - Stack Overflow: "ARIA stands for Accessible Rich Internet Applications"

Wednesday, November 21, 2012

CSS: box-sizing

Don't Overthink It Grids | CSS-Tricks: "Gutters
The hardest part about grids is gutters. So far we've made our grid flexible by using percentages for widths. We could make the math all complicated and use percentages for gutters as well, but personally I don't like percentage gutters anyway, I like fixed pixel size gutters. Plus, we're trying to keep too much thinking out of this.

The first step toward this is using box-sizing: border-box;. I like using it on absolutely everything.

*, *:after, *:before {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
Now when we set a width, that element stays that width, despite padding or borders being applied."

'via Blog this'

Thursday, August 16, 2012

mysql list server users


select user,host from mysql.user;

mysql grant access syntax

Sample:
grant all on *.* to 'root'@'123.233.423.34' identified by 'passw'

Monday, July 30, 2012

HTML select elements by css selectors

var arr = element.querySelectorAll( css_selector );
var first_elm = element.querySelector( css_selector );

https://developer.mozilla.org/en/DOM/Document.querySelectorAll

Wednesday, July 25, 2012

Linux: Calculate directories size

# du -h
# du -h --max-depth=1
# du -h | tail -n 1

Saturday, July 7, 2012

Linux: Mount USB drive

- Plug the USB drive
- fdisk -l
- create a mounting folder. i.e. /media
- mount -t vfat /dev/sdb1 /media

To unmount
- umount /media

Tuesday, July 3, 2012

Compress and split large files


# create archives
$ tar cz my_large_file_1 my_large_file_2 | split -d -b 1024MiB - myfiles_split.tgz_
# uncompress
$ cat myfiles_split.tgz_* | tar xz
This solution avoids the need to use an intermediate large file when (de)compressing. Use the tar -C option to use a different directory for the resulting files. btw if the archive consists from only a single file, tar could be avoided and only gzip used:
# create archives
$ gzip -c my_large_file | split -d -b 1024MiB - myfile_split.gz_
# uncompress
$ cat myfile_split.gz_* | gunzip -c > my_large_file

Wednesday, June 27, 2012

Apache Performance Tuning


http://httpd.apache.org/docs/2.0/misc/perf-tuning.html

Performance Related settings:

EnableMMAP Off // default is ON

MySQL repair all tables


mysqlcheck -u root -p --auto-repair --check --optimize <dbname>

Monday, June 25, 2012

Mysql replication: purging binary logs

It is recommended to purge or recycle the master/slave db binary logs on a daily or weekly basis

Here is the command:

purge binary logs before '2012-05-01';

http://dev.mysql.com/doc/refman/5.0/en/purge-binary-logs.html

Bandwidth Monitor Linux tools

Good command line tools:
bwm
bwm-ng
iftop

Useful links:
http://www.ubuntugeek.com/bandwidth-monitoring-tools-for-linux.html

Tuesday, May 8, 2012

SendMail Testing tool

Use the following tools to test your SendMail server:
http://www.mxtoolbox.com
https://www.wormly.com/test_smtp_server


Default SendMail configuration allows listening only to 127.0.0.0
That causes SendMail to accept emails from internal accounts only.
To receive emails from the whole world, Edit Network ports and change 127.0.0.0 to the server external IP address or set it to All.

Thursday, April 5, 2012

Building and install PerlMagick on windows

Please follow the following steps
- It requires downloading the source code package of ImageMagick.
- Goto VisualMagick folder
- Build the solution via Visual Studio
- Add VisualMagick\bin to environment PATH
- Goto PerlMagick directory
- Copy MakeFile.nt to MakeFile.PL
- perl MakeFile.PL
- nmake
- nmake install
- restart windows
- nmake test