December 2014
M T W T F S S
« Oct    
1234567
891011121314
15161718192021
22232425262728
293031  

Categories

Meta

Snack

Query SQLite database from unrooted Android device

Wednesday, October 22nd, 2014

To quickly test your SQLite database while developing an Android app, it can be useful to use the sqlite3 command line command to query the database. However, it is not easy to get to the SQLite file: you cannot just download it from your device, nor can you mount the right directory to your development […]

Python Snack: How to log only error to stdout in CherryPy

Thursday, April 24th, 2014

Started working with Python, which is extremely easy and a joy to work in. It also has great libraries and tools you can use. So, also started using CherryPy to power the XML API I am working on. While debugging it throws out a lot of messages on stdout, of which the access messages I […]

C#.NET snack: sign data with RSA

Tuesday, July 10th, 2012

Create keys: var csp = new RSACryptoServiceProvider(keyStrength); var privateKey = csp.ExportCspBlob(true); var publicKey = csp.ExportCspBlob(false); Sign data: var csp = new RSACryptoServiceProvider(); csp.Clear(); csp.ImportCspBlob(File.ReadAllBytes(privateKeyFile)); var sig = csp.SignData(data, new SHA1CryptoServiceProvider()); Verify data: csp.Clear(); csp.ImportCspBlob(File.ReadAllBytes(publicKeyFile)); if (csp.VerifyData(data, new SHA1CryptoServiceProvider(), sig)) {     Console.WriteLine(“Data is OK”); } else {     Console.WriteLine(“Data is not OK”); }

Adobe Flex snack: Error #2048: Security sandbox violation

Tuesday, May 22nd, 2012

If you are building a Adobe Flex application that uses sockets, you have to send the policy-file-request, or crossdomain.xml. A lot of info available on it, except that you need to send a null character at the end of it.

Javascript snack: enable both click and doubleclick events on one element

Thursday, May 10th, 2012

HTML defines onClick and onDblClick event handlers on all elements. However, if you want to enable both on the same element, something goes wrong. the onClick event gets fired twice! And that is not what we want, so here’s a little Javascript to fix that: // use these functions to enable *both* onclick and // […]

Javascript snack: new Date() with time zone

Thursday, February 9th, 2012

To set a time, use the (very convenient) Dat eobject: var now = new Date(); If you want to set a certain date, use: var someDate = new Date(“yyyy-mm-ddThh:mm:ss+hh:mm”); e.g.: var someDate = new Date(“2012-05-17T00:00:00+02:00″); For May 17th, 2012 00:00:00, CEST. Notice (and I just found that out), not all browsers take the same timezone […]

Android-dev-snack: what if R.id. doesn’t seem to be right anymore?

Tuesday, November 1st, 2011

In Eclipse, with the ADT plugin for Android development, what to do if your widget-IDs seem to be all over the place? What if that TextEdit suddenly seems to have jumped over two TextView widgets? Simply running a “Clean project” fixes it. It seems to be triggered by a lot of dragging, dropping and cutting […]

Websnack: dijit.form.Select vs dijit.form.ComboBox

Friday, September 16th, 2011

If you create a dijit.form.Select with a lot of items, it will become slow and render through the end of the page (no scrollbars). Instead, use a dijit.form.ComboBox; it is fast and renders correctly. It doesn’t necessarily need a itemstore, a HTML <select> list works perfectly fine. Just add dojoType=’dijit.form.ComboBox’ and you’re done. Note: this […]