Posts

Showing posts from 2008

Javascript catching mouse click event and know what DOM element is being clicked

Asking some great encoders in irc.freenode at #javascript channel, people are having an extensive help to me. I got this code working, but here I use the mootools JS Library but still the same as native javascript syntax. $(document).addEvent('click', function(e){ console.info(e.target.get('id')); }); // This works in IE $(document).attachEvent('onclick', function(e){ alert(e.srcElement.id) // gives the id of the element being clicked }); Through it, it does prints or gives me the id of the element being clicked. It's really cool knowing this technique.

Counting the tables in MySQL Database

Finding ou how cool MySQL is, I gathered this statement that might be useful when doing a CLI tasks. select count(*) as number_of_tables from information_schema.tables WHERE table_schema='schema_name'; OR select count(*) as number_of_tables from information_schema.tables WHERE table_schema='schema_name' and table_type = 'BASE TABLE' ; The latter one does only selects those base tables, BASE TABLE is actually a MySQL valid value of a table_type. This link can give some information about schema -> http://dev.mysql.com/doc/refman/5.0/en/information-schema.html

Inline-download problem with IE browsers

IE's problem again faces some criticism to my part. I came up of this snippet that does an inline download of a file. Adding of header("Cache-Control: maxage=1"); //In seconds header("Pragma: public"); heals the problem when a file is in buffer at the client's browser. Problem occurs here is when a user attempts to open a file, it does tells that the file sort of not found or whatever Microsoft tells. " filename = unique_string(8); $fp = fopen("/tmp/{$filename}", 'w'); fwrite($fp, $contents); fclose($fp); header("Cache-Control: maxage=1"); //In seconds header("Pragma: public"); header( 'Content-Type: ' . 'application/pdf' ); header( 'Content-Disposition: inline; filename="' . basename("/tmp/{$filename}") . '.pdf' . '"'); // Add the rest of the headers header( 'Cache-Control: public' ); header( 'Co...

Detecting plugins for pdf

I just found this site that can detect acrobat reader in browser plugins. Here's the link: http://gemal.dk/browserspy/acrobat.html Viewing the source code of that page, i found these lines in the script which does the detection of pdf plugin. <object id="ocx_pdf" classid="clsid:{CA8A9780-280D-11CF-A24D-444553540000}" style="display:none"></object> <script type="text/javascript"><!-- var i_acrobatreader; var v_acrobatreader; var a_acrobatreader; if (obj(navigator.plugins)) { for (var i=0; i < navigator.plugins.length; i++) { if (navigator.plugins[i].name.toLowerCase().indexOf("adobe acrobat") >= 0) { i_acrobatreader = true; v_acrobatreader = navigator.plugins[i].description.substring(navigator.plugins[i].description.toLowerCase().lastIndexOf("version ") + 8, navigator.plugins[i].description.toLowerCase().lastIndexOf(" for")); break; } } } // --></script> <script type="te...

CSS Hide Background

I just found this css snippet to somewhat like disabling the elements behind if a dialog box appears. /* Enables to disable elements behind */ .somethingDialogUnderlayWrapper { position: absolute; left: 0px; top: 0px; z-index: 998; display: none; background: transparent; } /* colors to a disabled-color */ .somethingDialogUnderlay { background: #eeeeee; opacity: 0.5; }

WebFaction.com details on their tools and customer service

This morning, I was spending my time looking for web hosting and I got this WebFaction.com. Previously, it was recommended also to me by Wilson Miner (one of Django Framework's developer). Well definitely, as a programmer, you would be glad to know others suggestions or recommendations whom you might have to think as a guru or expert in some other fields that you would like to be. I did send a message to WebFaction.com, and I say wow to their fast reply. They have a good customer service and good technical staff, if you might be getting some of the topics on their forum. Here's what I've got from them... " Hi Paul, > Hi WebFaction, > > I would like to know the versions of tools you have in the server for a shared hosting plan. > > - PHP (if it's php 5 or lower, and what version is it 5.2? 5.3?) v5.2.4 > - Apache v2.2.3 > - Python v2.5.1, v2.4.3 > - Mysql v5.0.22 > - Ruby v1.8.6 > > I wanted also to know if WebFaction runs the PHP ...