-
Recent Posts
Recent Comments
Archives
Categories
Tags
Meta
Author Archives: admin
Compile Java File to Separate Directory
Move into the directory where the .java file resides. Type javac FileName.java -d ..\path\to\directory The .class file will be generated in the directory specified. Move to that directory to run the program.
Java Command Line Commands and Flags
List of commands for Java running from command line instead of Eclipse: Compile: javac MyProgram.java Run: java MyProgram List of flags: Enable assertions: java -ea MyProgram Show compiler trace: javac MyProgram.java -verbose
WordPress Plugin Skeleton
Here’s a foundation for writing a WordPress plugin, based on version 3.2. This would go in the main my-plugin-name.php file.
Escaping shortcodes in WordPress Posts
If you want to display the shortcode literally in a post (like so: [shortcode]), just use double brackets like this: “[[shortcode]]”. You can also use the html entities [ for “[" and ] for "]” (which you’ll need to use … Continue reading
Setting Up a Virtual Host on WAMP
One of the biggest pains about developing on a local server setup like WAMP is that the root filepaths are different when you go live. To get around this I always set up a virtual host so that my development … Continue reading
Temporary Tables in Zend Framework
Use temporary tables when your sql queries are starting to do gymnastics. The following would go in your model:
Javascript Function Skeleton
(function(){ var functionName = function(){ this.init(); }; functionName.prototype = { init : function() { this.setFunction(); }, setFunction : function() { // do stuff here } }; new functionName(); })();
Focus First Input Field
Here’s a handy little snippet to automatically put the cursor in the first input field on the page. You can override it by adding a class of “nofocus” to any element and/or list the elements in the array. Nice for … Continue reading
Generate Excerpt
Here’s a little snippet for generating an excerpt without breaking up a word: function excerpt($string=”, $maxChar=50, $uri=’#') { $length = strlen($string); if ($length < $maxChar) { return $string; } $trimmedString = substr($string, 0, $maxChar); $choppedString = substr($trimmedString, 0, strrpos($trimmedString, strrchr($trimmedString, … Continue reading