Skip to main content

Posts

Language conversion with Google API and Ajax

Introduction The "Hello, World" of the Google AJAX Language API The easiest way to start learning about this API is to see a simple example. The following example will detect the language of the given text and then translate it to English. html > head > script type = "text/javascript" src = "http://www.google.com/jsapi" > script > script type = "text/javascript" > google . load ( "language" , "1" ); function initialize () { var text = document . getElementById ( "text" ). innerHTML ; google . language . detect ( text , function ( result ) { if (! result . error && result . language ) { google . language . translate ( text , result . language , "en" , function ( result ) { var translated = document . getElementById ( "translation" ); if ( result . translation ) { translat...

Andreessen: PHP succeeding where Java isn't

The simplicity of scripting language PHP means it will be more popular than Java for building Web-based applications, Internet browser pioneer Marc Andreessen predicted Wednesday in a speech here at the Zend/PHP Conference. Java enjoyed great success when its inventor, Sun Microsystems, released it in 1995, largely because it was optimized better for programmers than for machines, making software development significantly easier, Andreessen said. Unfortunately, Java has acquired many of the unfavorable characteristics of its predecessors, he added. "Java is much more programmer-friendly than C or C++, or was for a few years there until they made just as complicated. It's become arguably even harder to learn than C++," Andreessen said. And the mantle of simplicity is being passed on: "PHP is such is an easier environment to develop in than Java." That opinion might not sit well with Java loyalists--and there are plenty of them among the millions of Ja...

MySQL and SQL Column Truncation Vulnerabilities

While SQL-Injection is one of the most discussed security problems in web applications other possible problems for SQL queries like overlong input are usually ignored although they can lead to all kinds of security problems. This might be caused by the fact that security problems that are the result of overlong input are often buffer overflows and buffer overflows are something many web application security experts know nothing about and choose to ignore. There are however several security problems for SQL queries that are caused by overlong input and no one talks about. max_packet_size In MySQL there exists a configuration option called max_packet_size which is set to one megabyte by default and controls the maximum size of a packet sent between the SQL client and server. When queries or result rows do not fit into a single packet a error is raised. This means an overlong SQL query is never sent to the server and therefore never executed. This can lead to security problems when a...

Image Crop with Javascript

MooCrop About MooCrop is an Image Cropping utility using the amazingly powerful mootools javascript framework. Alone it serves no practical purpose but used in conjuction with a server side script becomes a powerful image manipulation tool. Why Looking for a mootools solution, I searched and came up with a few existing implementations. Everything I came across were only partial implementations. Those that were more polished seemed to be sluggish and effecting the DOM needlessly in some places. I wanted a class that had a very intuitive interface and played nicely with the existing DOM and more importantly I wanted it to be fast. I came to the conclusion that developing my own would give me a better understanding of mootools and broaden my understanding of drag and drop inside the DOM. Initially I tried using the Drag.Base class found within mootools but found this to be clumbsy for this highly specialized form of dragging. With default options a single drag is mov...

Why PHP ?

If you want to use PHP in your company and your manager favours another solution, or if you are trying to convince a potential client that PHP really is a superior choice for the web, you are going to need to have a clear-cut set of reasons why you believe PHP is the superior language. This short list should help you get started: PHP is cross-platform. It can be run on Windows, Linux, BSD, Mac OS X, and Solaris, as well as a variety of other platforms. PHP is free. You can download the source code, use it, and even make changes to it without ever having to pay any licensing costs. You can even give away your own modified version of PHP. Note to critics: just because PHP is free, it does not mean you need to give your scripts away for free. PHP is fast. In the majority of scripts beyond basic benchmarks, PHP will easily compete with both Perl and Python, and usually pull ahead of Microsoft's ASP.NET by about 10-15%. Add to that the fact that PHP code can be cached for execution,...

Ultimate htaccess Examples

Heres the actual code that I use when I'm developing sites for clients This lets google crawl the page, lets me access the whole site (24.205.23.222) without a password, and lets my client access the page WITH a password. It also allows for XHTML and CSS validation! (w3.org) # ELITE HTACCESS FOR WEBDEVELOPERS ############################################## AuthName "SiteName Administration" AuthUserFile /home/sitename.com/.htpasswd AuthType basic Require valid-user Order deny,allow Deny from all Allow from 24\.205\.23\.222 Allow from w3.org htmlhelp.com Allow from googlebot.com Satisfy Any Each code snippet has been copied from htaccesselite. Additional and detailed info on each htaccess code snippet can be found at askapache.com NOTE: Most of these snippets can be used with a Files or Filesmatch directive to only apply to certain files. NOTE: Any htaccess rewrite examples should always begin with: Options +FollowSymLinks RewriteEngine On RewriteBase / ...

PHP IDE

NuSphere PhpED 5.0 Commercial Windows Linux 5/5 PHP Edit 2.10 Commercial Windows 5/5 PHP Designer 2005 3.0.6 Commercial Other Windows 5/5 ActiveState Komodo 3.5 Commercial Other Windows Unix Linux Other 5/5 Maguma Workbench 2.6 Commercial Windows Linux Mac 5/5 Bluefish 1.0 Other Unix Linux Mac 5/5 emacs 21 Freeware Windows Unix Linux Mac Other 5/5 NuSphere Nu-Coder 1.4 Commercial Other Windows 5/5 Dreamweaver 8 Commercial Windows Mac Other 5/5 TSW WebCoder 2005 2005 Commercial Other Windows 5/5 Maguma Studio Pro 1.3.X Commercial Windows 4/5 Maguma Studio Free 1.1.0 Freeware Windows 4/5 PHP Editor by EngInSite 3 Shareware Commercial Windows 4/5 PHP Eclipse 1.06a Freeware Unix Linux 4/5 Xored:: WebStudio 0.3.4 Freeware Windows Unix Linux Other 4/5 SciTE 1.53 Freeware Windows Unix Linux Other 4/5 VS.Php Beta 3 Commercial Other Windows 4/5 Macromedia HomeSite 5.5 Commercial Windows 4/5 Kate 2.2 Freeware Linux 4/5 TextPad 4.7.2 Freeware Commercial Windows 4/5 Dav...