Posts

Showing posts from 2012

Filtering a list of MySql Stored procedures

I used to work with SQL server a lot and got a lot of value out of using queries on the system catalogs to show lists of stored procedures, tables etc. I mainly use MySql now and had not really managed to get this power user feature going. This line pretty much does what I want in mysql: show procedure status where name like '%image%' Sort of like a query, but with weird initial syntax. Does what I need it to do anyway.

Keeping your hits out of your Google Analytics reports

There is a bunch of stuff written about how to do this. Easy if you have a static IP (what work at home developer does?), doable with a cookie if you are on the old synchronous code snippet for GA, but if you are on the new asynch stuff (recommended) v tricky. After spending(wasting) 3 hours on this I finally just clicked the AVG do not track icon in chrome and unchecked GA. This is a bit of a sledgehammer approach as it switches off GA for all your browsing. Not quite what I was after, but it is more important to me to avoid treading on my GA reports than it is to keep other site owners - and indeed Google -  happy.

Great front end dev tools slides

These  slides are from Paul Irish. I thought I knew quite a few front end tools (maybe too many), but this  uncovered a heap more. It took me about 2 hours to watch the associated video and take a brief look at each some of the technologies mentioned. The vid is just over 30 minutes long, so info rich.

Zen Coding speeds up your workaday typing

If you find yourself typing a lot of angle brackets in a text editor as you manually create html, then Zen Coding is a big help. All the details are here . I have the plugin working on eclipse now and it really speeds things up. Type div#content and hit tab and the text is replaced with <div id="content"></div> Obviously a trivial example, but there are many more speedups made possible with this. There is a handy cheat sheet (well 7 sheets) of hints here . Looking forward to getting proficient at this so that I can speed up my normal daily editing. There are plugins for a load of editors besides eclipse. A note for eclipse users: the stated shortcut of ctrl+E does not work out of the box. This is because tab is in its place (handier it is too). I discovered this even after unbinding switch editor (which is also ctrl+E). Zen coding is just one of the handy hints I got from watching this video from Paul Irish. http://paulirish.com/2012/talk-tooling-the-we

Very handy extension of unique function in JQuery

This is a good post by Paul Irish on how to take existing functionality and amend it. Bit like overloading. I like the way he has extended the unique function in JQuery - which only works for DOM elements and made it work for any type - strings for example.

Pitching tips

I watched this short video of tips for pitching your idea on youtube today. I took the key points and elaborated on them for my product PhysioTrack. Pitching notes: Start with the problem - patients don't do their exercises as prescribed by their physiotherapist Explain your solution - timed reminders from their phone controlled by the physio from the web Introduce the 'team' - 14 years IT experience, worked in a wide variety of private and public businesses

A tool to help you tidy up your JavaScript

More predeployment JS help here. This tool  http://jslint.com/  is a great help. It is very fussy - in the way Java is, not sloppy the way JS allows. I have not managed to iron out all of the issues it came up with, but knowing they are there is a big help and will make my next project that bit neater.

Optimising JavaScript before deployment

This is a great tool:  http://closure-compiler.appspot.com/home Shrinks and optimises your JS before you drop it onto production. Used by JQuery to produce their minified versions, so it has to be good.

Sending date and time information from Android to MySQL

Dates always seem to trip me up. The app that I am currently working on needs to send records from Android to a MySQL back end. The records contain date and time information. The records initially go into a SQLite db on the phone. From there they are read and sent to the back end one at a time and cancelled off the list when sending has been successful. So the problem comes down to putting a date and time into sqlite. Taking that date and time out and sending it across the network to be inserted into MySQL. Here is a synopsis of what I did to get this to work: Create a table on sqlite (column types are largely irrelevant here, so just leave them out). Create a table on mysql (the target) and specify a column type of timestamp for the date and time info. Create a java.util.Date object to get the current time. Using a SimpleDateFormatter format this for insertion into the sqlite db. Next read this row back. Send this value across the network. At the Mysql end use a prepared stateme

CTRL-C does not work on updated Cygwin

I updated my cygwin (specifically my bash shell) to a 4.something version. CTRL-C did not work anymore. This was a pain as I kept having to kill the cygwin window with the close window x. Was not able to effectively use history and stuff. I 'updated' by cygwin by installing setup.exe again. I filtered the install down to bash so I could find the shell and then clicked on it a few times until is showed version 3.something. This now supports ctrl-c and has retained all my nice history stuff from before. The font is a bit small, but I am sure I can remedy that. Less important than ctrl-c to me.

Using a local MySQL instance for developing on Google Cloud SQL

This keeps giving me trouble, but I think I have it figured out now. Most of the cloud sql docs assume that you will be running your development on a cloud instance along with your production/test. This does not work for me due to the latency associated with the remote dbs, so I go for the local dev option. However in order to get this to work you have to put a copy of the mysql jdbc driver into this folder in your sdk: eclipse\plugins\com.google.appengine.eclipse.sdkbundle_1.6.4.v201203300216r37\appengine-java-sdk-1.6.4\lib\impl (obviously your exact folder will vary depending on your sdk bundle version) Whenever you upgrade your SDK you will need to copy the mysql connector jar to the new impl directory. The latest upgrade to the SDK (1.65) appears to have been a bit panicked. It was released on the evening of the 1.64 release. Oops. There was no eclipse plugin for 1.65. I made the mistake of upgrading the standalone version of the SDK (which I don't in fact use) and copy

Running emulator and phone simultaneously

When I am developing I often have the need to run something on the phone and the emulator. Due to the long startup time on the emulator I don't want to shut this down whenever I connect the phone. My preferred way to view logs is using a bash shell with the adb logcat command. This however will not produce the desired output when the 2 platforms are running together. Instead the -s for serial number switch must be provided. The format is adb -s emulator-5554 logcat I had previously tried adb logcat -s emulator-5554 which does not work. The adb program gets the logcat param before it sees the switch and you just get a normal log tail. This is a trivial post, but is very handy now that I have figured this out :) To get the list of devices (ie. your phone and emulator serial numbers in this case) enter adb devices at the command prompt.

Dealing with the Same Origin Policy when developing AJAX based JQueryMobile apps

The title of this post is quite a mouthful, but this was a tricky problem to fix and I wanted to share it here. Basically I am developing a mobile app using html, css and JavaScript. The app uses ajax to retrieve its data from the backend server (Google Cloud SQL). This does not present a problem when I am running the app as a packaged apk (which just contains web technologies and a single Activity to bootstrap the whole thing). However when I am in development mode on my desktop I get all the advantages that a decent browser has to offer a developer - inspection, view the DOM etc. Can't reasonably develop without this stuff. The difficulty arises when I try to run the phone app on Chrome. The JavaScript security in the shape of the Same Origin Policy prevents the ajax from running. To get around this you need to set a response header on your backend server - the one that runs your servlet. This looks like this: res.setHeader("Access-Control-Allow-Origin", "*"

Shiny pencil with Inkscape

Image
Here is another nice screencast from Heathenx. I think it gives a very realistic effect. I was particularly with the technique for copying metal shine into a multi stop gradient. Instead of using the photoshop image like Heathenx I got a photo of a real steel cylinder from Google. Very handy technique going forward. Here is my effort: Not quite as elegant as the tutor, but not a bad first effort I don't reckon.

Rusty sign in Inkscape

Image
Here is a good screencast showing a rust effect in Inkscape. A little help from Gimp is required to make some clouds for masking. There were not too many steps in this one. This is my effort. I am quite pleased with this. Bit blingy perhaps, but that could be toned down with less spotlights (if any). A couple of good graphics sources on the web were pointed out during the cast. The first is for nice open source type faces. These are available here . The second is for a good source of textures . This is not something I have worked with before, but I reckon it could be a very powerful way to get realistic effects with less effort. Drawing rust from scratch would be hard to impossible to pull off.

Inkscape icepop tutorial

Image
Here is a very good tutorial by Heathenx on drawing an icepop with Inkscape. Its a bit long, but it shows how to make very nice hilights on an object very simply. Here is my effort. Not quite up to his standard, but not too bad I don't think. Well the shadow is a bit sinister, but I was running out of time :)

Some good Gimp video tutorials

I have been spending some time learning Inkscape so that I can create images for my Android apps. There's often a need to modify photographs - buildings, people, products, so that they can be used in an app. To this end I am going to try get to grips with the Gimp . I have fiddled with this before, but never put the time in to get comfortable with it. My Inkscape learning is far from over, but I am going to do the 2 of these in parallel for the next while. This is the first one I tried out. Just a basic look around setting up your environment. There is a good bit of info at the start about upcoming versions of Gimp. As a newbie this is not relevant to me, so I just skipped on until I saw the freshly started Gimp UI.