Nov 5

This first function will create a urlencoded version of the string it is given. Unlike the regular escape() function, this doesn't just escape special characters, but alphanumeric ones as well. The unescape() part of this is optional, but useful for eval() statements.

function escape(str){
	tmp = "unescape('";
	for(var i=0;i<str.length;i++) tmp += "%" + str.charCodeAt(i).toString(16);
	return tmp + "')";
}

The second function is for creating a list of char numbers to replace a string. This is useful if you are unable to use quotation marks (for whatever reason). The String.fromCharCode is used for returning the characters back to a string, but it is optional.

function toChars(str){
	var ret = "String.fromCharCode(";
	for(var i=0;i<str.length;i++) ret += str.charCodeAt(i) + ",";
	return ret.slice(0,ret.length-1) + ")";
}

Hopefully you can find a use for one or both of these functions.

  • Digg
  • StumbleUpon
  • del.icio.us
  • Reddit
Nov 4

One of the largest security challenges many organizations face come from the most basic aspect of security: user passwords. Humans simply have a limited capacity to remember otherwise insignificant streams of letters and digits; as a result, they often choose passwords that are easier to remember. Those memorable passwords, however, can fail in the face of dictionary attacks or guesses based on information such as birth dates or the names of family members. This week's meeting of the Computer and Communications Security interest group of the Association for Computing Machinery saw the description of the latest attempt to balance security and obscurity: an improved form of the "Draw a Secret" method.

Read the rest here.

It seems like every week that I read something about making passwords easier to remember or something similar. The majority of these are woefully insecure and promote a hands-off security policy. However, I think this could seriously be a plausible alternative to traditional text passwords for a number of reasons. Read the rest of this entry »

  • Digg
  • StumbleUpon
  • del.icio.us
  • Reddit
Nov 4

Have you ever wanted to get the key name AND the value of an array for use in a loop? You might have done something like this (I know I have):

$keys = array_flip($array);
foreach($array as $a){
	echo($keys[$a] . "-" . $a . "\\n");
}

Why is this bad? It uses almost twice as much memory as this next method. The following will produce the same output as the above with less code and less memory:

foreach($array as $k=>$v){
	echo($k . "-" . $v . "\\n");
}

Essentially, this second method just takes the key and the value and assigns them through each iteration through the loop, rather than having to go through each index in two separate arrays. Hope this is useful to someone (it was to me) :)

  • Digg
  • StumbleUpon
  • del.icio.us
  • Reddit
Nov 1

Every programmer knows that, when coding, fixed-width fonts are a must. They make braces line up better, they make bugs easier to spot, and they just simply look better than regular fonts. However, many operating systems don't come with very many good fixed-width fonts. So, I present to you a large collection of these fonts. They were obtained from various sources and are not my own individual work. Enjoy :)

Download here.

  • Digg
  • StumbleUpon
  • del.icio.us
  • Reddit
Oct 31

In my search for an online mindmapping tool, I found this site to be the best of the best. Whether you're coding a big project or planning an event, mindmapping is the shit. If you're into collaborating with other people, you can do that too. Overall, the concept is good, interface is sexy and it's easy to share your designs with others.

Generate your own mindmap today.

  • Digg
  • StumbleUpon
  • del.icio.us
  • Reddit

« Previous Entries Next Entries »