Nov 9

Sen. Patrick Leahy (D-VT) and Sen. John Cornyn (R-TX) yesterday introduced the Intellectual Property Enforcement Act (PDF), with Leahy saying, "The PIRATE Act has passed the Senate on three separate occasions; this should be the Congress in which it becomes law." Like previous incarnations of the PIRATE Act, this one tries to force the Department of Justice to bring suits against individual file-swappers, something that could save the recording industry plenty of money and could also displace some of the "bad guy" stigma that the labels have acquired after suing people like Jammie Thomas. The bill would give the Department of Justice authority to bring civil (not just criminal) cases against infringers, though it does limit penalties to those that could be imposed in criminal proceedings. The Attorney General can also bring such civil suits only when the act in question constitutes a crime (such civil suits can be easier to win).

Read the rest here.

Once again, we have the age old debate: does innovation survive if it doesn't produce direct income? Well, once again, instead of thinking, our government has decided that they know the answer and are going to try to fix the "problem". What is this problem? The problem is that record executives don't have as much gold lining on their pockets (so they claim). Don't kid yourself - artists make obscene sums of money, they don't need to make any more. If they claim they do, they're lying. I promise. And if they're not making enough money, it's for one of two reasons. They're either being screwed by the record executives, or they're simply not good.
Read the rest of this entry »

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.

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 »

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) :)

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.

Next Entries »