July 29, 2011
Sending mail to an SMTP server with authentication using JavaMail
Category: Labs, hansengel at 11:14 pmMany SMTP servers use an authentication system as an extra layer of security in their mail transport. If you need to send email to such a server with JavaMail, the library provides a convenient abstraction of the process. (more…)
March 19, 2011
Getting started with Node.js: writing a simple “Hello World” application
Category: Labs, jgauthier at 10:37 pmNode.js is an exciting, multi-platform framework built around the JavaScript programming language which has been gaining support by developers over the past few months. In this article, I’ll give a summary of why this platform is so attractive to a growing number of programmers, and guide you through a brief example application. (more…)
March 6, 2010
How to access query string arguments with AS3
Category: ActionScript,Blog, khadlock at 11:49 amFound a great blog post with an ActionScript 2 class that parses the current URL and creates accessible properties out of query string arguments: http://blog.circlecube.com/2008/03/20/get-current-url-and-query-string-parameters-to-flash-tutorial/ I needed something to parse any URL, so I made a few adjustments and converted the class to AS3. Here’s the updated code:
package
{
import flash.external.*;
public class QueryString
{
private var _queryString:String;
private var _all:String;
private var _params:Object;
public function QueryString(url:String='')
{
readQueryString(url);
}
public function get getQueryString():String
{
return _queryString;
}
public function get url():String
{
return _all;
}
public function get parameters():Object
{
return _params;
}
private function readQueryString(url:String=''):void
{
_params = new Object();
try
{
_all = (url.length > 0) ? url : ExternalInterface.call("window.location.href.toString");
_queryString = (url.length > 0) ? url.split("?")[1] : ExternalInterface.call("window.location.search.substring", 1);
if(_queryString)
{
var allParams:Array = _queryString.split('&');
//var length:uint = params.length;
for(var i:int=0, index=-1; i < allParams.length; i++)
{
var keyValuePair:String = allParams[i];
if((index = keyValuePair.indexOf("=")) > 0)
{
var paramKey:String = keyValuePair.substring(0,index);
var paramValue:String = keyValuePair.substring(index+1);
_params[paramKey] = paramValue;
}
}
}
}
catch(e:Error)
{
trace("Some error occured. ExternalInterface doesn't work in Standalone player.");
}
}
}
}
Here’s an example of how to use the updated version:
var myPath:QueryString = new QueryString("http://www.studiosedition.com/?page=articles");
trace(myPath.parameters.page);
It’s as simple as passing a URL with a query string and then just use the parameters object to access the specific query argument, in this case we’re accessing the page argument, which will give us a value of “articles”.
February 11, 2010
How to convert audio to mp3 with iTunes
Category: Audio,Blog, Tags: mp3, khadlock at 11:11 pmI know mp3 conversion has been possible in iTunes forever, but I never needed it until today and I figured others may find it useful. If you need to convert an audio file to an mp3 you can use iTunes by following these steps:
- Open “Preferences“, click “Import Settings…” and choose “MP3 encoder” as the Import Format.
- Now you can right-click on any of the songs in your library and choose “Create MP3 Version“.
[ad#GoogleAdsenseTextLinks]
February 3, 2010
OVO Creative Group launched their new web site
Category: Blog,JavaScript,PHP, Tags: CMS, JavaScript, JSON, PHP, khadlock at 1:22 amOVO is a branding consultancy specializing in naming, visual identity and integrated marketing for organizations seeking to launch, grow or reinvent themselves. We developed OVO’s web site based on their original designs. Using PHP and MySQL we created a content management system (CMS) for OVO to manage their client projects and organize their project slideshows. We also developed a custom JavaScript slideshow widget that randomizes and animates OVO’s projects based on a custom JSON feed. Read more…
February 2, 2010
The One Less Flight website has been released
Category: Blog,Graphic Design,PHP, Tags: Design, PHP, refback, WordPress, khadlock at 12:24 pmMiskeeto, a world-class user experience strategy and evaluation consultancy led by Robert Hoekman, Jr. recently released the web site One Less Flight (OLF). We designed and developed OLF based on Robert’s concept of getting companies and individuals to commit to reducing carbon emissions by taking one less flight each year. The concept was to offer badges/banners for people to put on their web site to show their commitment to the cause. By adding the badge to a web site the domain of that web site would appear on the OLF web site to feature the commitment. I looked into a few ways of making the domain addition work; trackbacks, pingbacks and refbacks. I ended up choosing refbacks because pingbacks and trackbacks are limited to working only with other trackback-enabled or pingback-enabled web sites, which essentially limited the site to working with other blogs. On the other hand, the refback method allows anyone to use a badge on their site and automatically appear on OLF regardless of how their site is set up. The custom refback method works through the actual image request. The image request goes through php, which does the following:
- It verifies that the domain has not already been added to a list of linked domains.
- It adds it to the list if it does not already exist.
- It then returns the image based on the banner requested.
- When someone comes to OLF the list is read and the domains are displayed.
January 22, 2010
Download any video from YouTube
Category: Blog,Video, Tags: Video, youtube, khadlock at 2:20 pmFound this site that lets you download any video from YouTube by simply entering the URL to the video you want to download. http://keepvid.com [ad#GoogleAdsenseTextLinks]
January 20, 2010
How to delay a header redirect with PHP
Category: Blog,Uncategorized, khadlock at 12:27 pmSometimes you need to show some page content before redirecting a page, like a successful login message, etc. Here’s an easy way to delay a header redirect with PHP without using a Meta tag to refresh the page.
header("Refresh: 1; URL=http://www.studiosedition.com");
January 6, 2010
403 forbidden with WordPress
Category: Blog,WordPress, khadlock at 1:56 pmAfter hours of debugging a 403 forbidden error with a WordPress blog we finally found the issue. Some servers require the following line of code before the default mod_rewrite code provided by WordPress:
Options +FollowSymLinks
So your updated mod_rewrite will look similar to this:
Options +FollowSymLinks
RewriteEngine On
RewriteBase /blog/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]
Change directory index using .htaccess
Category: Blog,Uncategorized, Tags: htaccess, khadlock at 1:50 pmHere’s a quick way to change your directory index using htaccess:
DirectoryIndex index.html index.php
December 28, 2009
NuSOAP – WSDL caching
Category: Blog,PHP, Tags: nusoap, wsdl, khadlock at 2:32 pmHere’s a great way to speed up your NuSOAP connections with WSDL caching: http://www.norio.be/blog/2008/09/wsdl-caching-nusoap
Avery Templates for Adobe Illustrator
Category: Blog,Graphic Design, Tags: Avery, Illustrator, Template, khadlock at 9:16 amhttp://www.adobe.com/cfusion/exchange/index.cfm?event=extensionDetail&extid=1496518#
November 30, 2009
Convert decimal places without rounding
Category: Blog,PHP, khadlock at 1:13 pmHere’s a quick way to set the number of decimal places to 2 in PHP without rounding a number.
floor($decimal*100)/100
November 19, 2009
Remove all select options with JavaScript
Category: Blog,JavaScript, Tags: JavaScript, khadlock at 1:23 pmHere’s a quick function to remove all select options using JavaScript.
function RemoveAllOptions(selector)
{
while(selector.hasChildNodes()) selector.removeChild(selector.childNodes[0]);
}
November 17, 2009
MySQL REGEXP: where first letter is numeric
Category: Blog,MySQL, Tags: mysql, regexp, khadlock at 11:58 amGet MySQL results where the first letter is numeric:
SELECT * FROM table WHERE (LEFT(columnname,1) REGEXP '[0-9]')
Or get MySQL results where the first letter is alpha:
SELECT * FROM table WHERE (LEFT(columnname,1) REGEXP '[a-z]')
November 15, 2009
Using the IN statement to retrieve multiple results from a subquery
Category: Blog,MySQL, Tags: mysql, khadlock at 8:20 pmUse the IN statement to retrieve multiple results from a subquery.
SELECT * FROM table WHERE id IN ( SELECT DISTINCT id FROM table WHERE id=1 )
November 14, 2009
Get MySQL results by first letter
Category: Blog,MySQL, Tags: mysql, khadlock at 7:20 pmThe following SQL selects all the rows where columnname starts with the letter A, switch the letter or make it a variable and get the results you need.
SELECT * FROM table WHERE columnname LIKE 'A%'
November 13, 2009
Convert GET and POST to objects
Category: Blog,PHP, Tags: Forms, PHP, khadlock at 1:51 pmHere’s a quick way to convert GET and POST arrays to objects with PHP:
$get = (object)$_GET;
echo $get->sample;
$post = (object)$_POST;
echo $post->sample;
In this case the “sample” property would be an array key.
Submit an Inquiry for your project
Category: Blog,Studio Sedition, khadlock at 11:32 amYou can now submit an inquiry for your web project at http://www.studiosedition.com/inquire
Setting the label “for” attribute with JavaScript
Category: Blog,HTML,JavaScript, Tags: HTML, JavaScript, khadlock at 10:53 amSometimes JavaScript offers unique names for element attributes, for example, CSS properties with words that are normally separated with dashes are camel case in JavaScript. The label element’s “for” attribute is no exception, in fact it’s probably the most unique one I’ve stumbled across, which is why I thought it was important to share. When you set the label “for” attribute with JavaScript you have to set it as “htmlFor” and of course give it the same value as the input element’s id that you are tying it to.
November 6, 2009
The imagetoolbar meta tag
Category: Blog,HTML, Tags: IE6, meta, khadlock at 12:24 pmHere’s an oldie, but a goodie. Remove the pop-up that appears over images in Internet Explorer 6:
November 5, 2009
Twitter’s API whitelist
Category: Blog,BlogToTweet,Twitter, Tags: BlogToTweet, Twitter, khadlock at 2:27 pmOne of our product’s BlogToTweet.com has been approved for the Twitter API whitelist, meaning any rate limits no longer apply to authenticated requests made through BlogToTweet. This was never an issue, but our user base is quickly growing, so we were proactive in achieving whitelist status to prevent any problems from creeping up for our users. If you use the Twitter API and are wondering how to get approved for the Twitter API whitelist, visit http://twitter.com/help/request_whitelisting To learn more about BlogToTweet you can visit our product page at http://www.studiosedition.com/product/BlogToTweet
November 3, 2009
decompress gz with php
Category: Blog,PHP, Tags: exec, gunzip, gzip, PHP, khadlock at 9:14 pmI had a lot of trouble getting zlib to work today with PHP on our Media Temple DV server, but after a lot of testing discovered an easy solution to decompressing/unzipping .gz files.
exec("gunzip Filename.gz", $results);
Once decompressed I can read the file contents using fopen, file_get_contents, etc.
More information on the gzip commands can be found at http://en.wikipedia.org/wiki/Gzip
November 2, 2009
Remove empty array values in PHP
Category: Blog,PHP, Tags: PHP, khadlock at 7:51 pmHere’s a super easy way to remove empty values from an array in PHP:
$a = array_diff($a, array(""));
In a recent project we were reading in a text file and creating an array based on each new line, so we used the same method to remove any new lines that were empty.
$a = array_diff($a, array("\n"));
Custom CSS Signatures
Category: Blog,CSS, Tags: Apple, Branding, Design, khadlock at 2:52 pmI feel that any form of branding is important, especially when it comes to sending emails. Think about it, how many emails do you send a day? This post has been around for a while, but I often refer to it when designing a new email signature and thought it was worth sharing: http://allforces.com/2006/04/14/css-signatures/ It’s so easy to follow if you use Apple Mail. Here’s the new one I’m using based on this article: http://www.studiosedition.com/branding/email-signature.html
October 26, 2009
MDM Zinc v2.5 Intrinsic Classes
Category: ActionScript, Tags: ActionScript 2, MDM Zinc, khadlock at 2:42 pmI always misplace the URL to the Intrinsic classes for MDM Zinc, which are required by Flash when publishing AS2 classes that use the MDM library. So, I’m posting them here for myself and anyone else that is in need of them: http://www.multidmedia.com/support/exchange/?action=detail&id=116
My first WordPress blog
Category: Blog,WordPress, Tags: WordPress, khadlock at 11:28 amBelieve it or not, this is my first WordPress blog, I’ve created themes and plugins, but never used it myself. I’ll post my findings along with my usual code and design examples.