Weblog Home Web site's Home Clip art Search Clker.com – Available downloads RSS

Recent Posts:

arrow image github a valuable opensource too...
arrow image Easy chrome extension to convert...
arrow image Updated svg edit - much better p...
arrow image Professional graphics designers:...
arrow image Refresh when drawing
arrow image That's impressive
arrow image Another quick feature added
arrow image Image editor now works on Intern...
arrow image Manually tracing cliparts out of...
arrow image Draw edit the SVG images online
arrow image Where to find good old public do...
arrow image Developing clip arts using old p...
arrow image Expected downtime tonight
arrow image Automatic vectorization is up an...
arrow image Ubuntu lucid lynx is extremely s...
arrow image Integrating the tracer
arrow image Automatic vectorization, coming ...
arrow image Updated clker interface
arrow image using ubuntu as my main desktop ...
arrow image Full time on clker
arrow image Clker will be down tonight
arrow image Tracing local and lineart images
arrow image Bad HD - clker will be down on S...
arrow image Updates to profiles
arrow image Crayon video - Marathon runner
arrow image A detailed tutorial on Crayon
arrow image Crayon image resources & tutoria...
arrow image Example tracing president obama
arrow image More on Crayon
arrow image First version of the online trac...
arrow image Now you can edit your uploads
arrow image Clipart tracer: New feature comi...
arrow image Apache hanging once in a while -...
arrow image Injuries from working on compute...
arrow image Restarting the server once in a ...
arrow image Writing my own webserver
arrow image Flex - Zooming in on large bitma...
arrow image Linux average load
arrow image Caching SQL with PHP
arrow image Wordpress plugin version 1.2 rel...
arrow image Fixing vote up/vote down icons
arrow image Google native client
arrow image New wordpress, looks great
arrow image Bug reports and feature requests...
arrow image Further flex testing
arrow image Some flex ideas
arrow image actionscript mode for emacs
arrow image Linux spirits crawling in chrome
arrow image Wordpress clip art plugin
arrow image Adding Clker.com to opera search...

Sites I like:
Arabic movie database

Posts Tagged ‘online’

Some flex ideas

Sunday, November 23rd, 2008

I think adobe made a perfect recipe by throwing the flex sdk as open source. Morever, it is platform independent as the compiler is in java. The last couple of weekends I put some time to see what’s there. I was able to make a simple dev environment with emacs both on windows and on Linux.

Coding flex on linux seemed to be easier than on windows (at least for me). One big thing is the results of the trace command, which appear on the console on linux but are piped to some hidden file in windows that I have to keep refreshing to know what’s going on inside my code!

I’ve testing flex to see how far can it go in image processing and in image undersanding. I think that flex has lots of opportunities, at least better than java when it comes to online apps. The reason that I personally don’t like java for applets is the big memory footprint of its runtime environment, and that strange big delay when it loads, which makes it a very discouraging solution when compared to adobe’s flash.

Since I was fiddeling with bitmaps and bitmapdata, and after some tests – nothing was working. It turns out that the Flex’s help it written assuming that your developing flash – they like copied it from their old docs, without changing the examples. See here & my comment at the bottom:


So if it happens that you want to display flex objects using the addChild function, make sure you call the addChild on a UIComponent & not any other flex object, as they won’t recognize bitmaps or other dynamically created objects. I just added one in the mxml file:

<mx:UIComponent id="myUIComponent" />

Also read here:


Creating a tar gz on the fly using PHP

Thursday, March 27th, 2008

A while ago, I thought about creating a tar.gz file for every download, so that if someone runs a search, he/she then can download all the images in the results. After a little bit of research, I found that PHP has a function for gzip. I also knew that the tar format just sticks files after one another, so if I can implement the tar format in PHP then I can gzip all images in the results.

I found this LGPL code that implemented the tar format. I used it (and modified it a little bit) to produce the online tar.gz functions:

  1. // Computes the unsigned Checksum of a file’s header
  2. // to try to ensure valid file
  4. function __computeUnsignedChecksum($bytestring)
  5. {
  6.   for($i=0; $i<512; $i++)
  7.     $unsigned_chksum += ord($bytestring[$i]);
  8.   for($i=0; $i<8; $i++)
  9.     $unsigned_chksum -= ord($bytestring[148 + $i]);
  10.   $unsigned_chksum += ord(" ") * 8;
  12.   return $unsigned_chksum;
  13. }
  15. // Generates a TAR file from the processed data
  17. function tarSection($Name, $Data, $information=NULL)
  18. {
  19.   // Generate the TAR header for this file
  21.   $header .= str_pad($Name,100,chr(0));
  22.   $header .= str_pad("777",7,"0",STR_PAD_LEFT) . chr(0);
  23.   $header .= str_pad(decoct($information["user_id"]),7,"0",STR_PAD_LEFT) . chr(0);
  24.   $header .= str_pad(decoct($information["group_id"]),7,"0",STR_PAD_LEFT) . chr(0);
  25.   $header .= str_pad(decoct(strlen($Data)),11,"0",STR_PAD_LEFT) . chr(0);
  26.   $header .= str_pad(decoct(time(0)),11,"0",STR_PAD_LEFT) . chr(0);
  27.   $header .= str_repeat(" ",8);
  28.   $header .= "0";
  29.   $header .= str_repeat(chr(0),100);
  30.   $header .= str_pad("ustar",6,chr(32));
  31.   $header .= chr(32) . chr(0);
  32.   $header .= str_pad($information["user_name"],32,chr(0));
  33.   $header .= str_pad($information["group_name"],32,chr(0));
  34.   $header .= str_repeat(chr(0),8);
  35.   $header .= str_repeat(chr(0),8);
  36.   $header .= str_repeat(chr(0),155);
  37.   $header .= str_repeat(chr(0),12);
  39.   // Compute header checksum
  40.   $checksum = str_pad(decoct(__computeUnsignedChecksum($header)),6,"0",STR_PAD_LEFT);
  41.   for($i=0; $i<6; $i++) {
  42.     $header[(148 + $i)] = substr($checksum,$i,1);
  43.   }
  44.   $header[154] = chr(0);
  45.   $header[155] = chr(32);
  47.   // Pad file contents to byte count divisible by 512
  48.   $file_contents = str_pad($Data,(ceil(strlen($Data) / 512) * 512),chr(0));
  50.   // Add new tar formatted data to tar file contents
  51.   $tar_file = $header . $file_contents;
  53.   return $tar_file;
  54. }
  56. function targz($Name, $Data)
  57. {
  58.   return gzencode(tarSection($Name,$Data),9);
  59. }

To use those functions all you have to do is send a header with the mime type for the tar gz ( application/x-gzip ) using the php header function. To add a tar/gz section for a file, read the file in an array using filegetcontents and pass the filename and data to the targz function. Echo what is returned. That’s it!

So why is it not active on clker.com website? I actually tried it and found that compression consumes a lot of CPU. In the first 20 minute I had more than one hundred connections for different users downloading their results and the CPU was saturated. This basically left no CPU for searching. So use it carefully, and only if you really need that functionality.

Technorati Tags: , , , ,

v0.1 Beta release of openoffice.org addon

Friday, November 30th, 2007

Finally, there’s a light at the end of the tunnel. It’s 4:21 AM and I’m very happy to reach this stage with the openoffice addon.

You can download it Openoffice.org addon for clker.com integration . Installation is very easy, from the tools menu in openoffice, select Extension Manager. Click add, and point to the file. You will need to restart openoffice for it to work.

openoffice.org addon screenshot

This extension will show you the contents of your basket stored on clker, and will allow you to place any clipart image in the clipboard, then you can paste it in the correct place in your document.

Still there are some minor issues:

  1. The addon parent is currently null, so an extra window will appear in the task bar
  2. The way we place the picture in the clipboard is by loading it in draw, select all and copy then closing draw. There are better ways for doing this. You will notice that the screen will flicker especially if your using the ODG or the SVG formats since draw takes some time to render the vectors.

In case you wanted to play with the source, the addon source is here.

Technorati Tags: , , , , , ,

Fatal error: Call to undefined function akismet_counter() in /home/webs/www.clker.com/blog/wp-content/themes/mibrahim/footer.php on line 27