Posts

Showing posts from March, 2016

Global SQL Procedure, System Objects and sp_ms_marksystemobject

You may come across a need to have a database of utils full of generic procedures which work on indvidual databases (say client databases). You can't pass the database name into the procedure as a parameter and say "use @dbname" in the procedure and dynamic sql sucks. One workaround is to create the procedure in the master database and then mark it as a system object. eg use [master] create procedure sp_doThis // note the sp_ prefix is required begin // etc etc end go exec sp_ms_marksystemobject 'sp_doThis' // second note, this procedure is undocumented, so I wouldn't be relying on this for life or death. use [myotherdb] exec sp_doThis go All done!

Design best practice for an image library

If the library holds data in a raw format (ie a big sized image), then can then make all sorts of algorithms out of that to produce images. Generate different sizes, eg 100x100, 200x400 or what ever is required from the original Generate different types of images, either by conversion (png etc) or type, maybe base 64 for CSS and separate style sheet images for non base64 supporting CSS (like IE8 etc) Overlay another graphic on top (like a sash or otherwise) to generate only 1 image that needs to be retrieved All of this requires the smarts that you allow the original image to have coordinates stored against it as to where the center is or maybe use something like  https://github.com/tapmodo/Jcrop to create and store these coordinates of the box sizes. I've found it quite useful when uploading images through custom application to write the files as (for example) full_raw.png (usually stored in a database somewhere) full100x100.png (resized, re scaled depending how ...

Nice Table sorter (Jquery)

Ok so there are quite a few out there, but I've never seen one which I've had to do absolutely no customization at all; well done https://editor.datatables.net/ . Very nice exporting to CSV, great sorting, great custom display and filtering (allowing tables to be summed up depending on what you filtered on). Honorable mention http://tablesorter.com/docs/ I used this for quite a while, but the datatables has the exports and filtering which I had to write an extension of for tablesorter.