Ryan Rampersad
Thoughts, opinions, ideas and now links
  • About
  • Podcast
  • Links

Monthly Archives

Google Redesign

A user on TalkPHP posted, by the name of TerrorRonin, their new Google Design.

Google Redesigned Preview

Google Redesigned Preview

As Google’s sensitivity to regular users declines, the changes that are made every so often push the fans of google out the door slowly but surely. They know we’ll walk back in at some point, but this design looks elegant, clean and uncluttered. It is easy on the eyes, very smooth  and truly fitting with the current trends of design on the web.

A letter from chasehutchins.com, appears on the google page when you first load it, but won’t appear on subsequent loads once it is closed.

By the way, the I’m feeling Lucky and Google Search buttons are switched!

A letter to Google

A letter to Google

Stop firebug console.log errors

Often during development you use firebug to figure things out. You might have wanted to test your code in another browser and you discover a bug! But it isn’t, it’s just because you forgot to take out that firebug debug line. You know all about these types of errors caused by console.log.

console.log(window);

The line above could cause the error message below

Line: 13
Character: 5
Code: 0
Error Message: Expected identifier, string or number

The error above is from IE Debug Bar, which is generally better than IE’s normal debugging window. In anycase, it gets annoying to be forced to removed the firebug lines of debugging code. I offer a solution from the firebug team to kill them in other browsers!

noconsole.js is a little javascript file I threw together to help out. I was looking for a good way to get those errors to go away and I’ve seen it done elsewhere, like CNet. The script is inside of an anonymous function as well, as I don’t like messing with global variables.

Anyway, here are the files, one uncompressed and one compressed although the differences are negligible anyway.

  • Uncompressed noconsole.js
  • Compressed (Packer set to shrink) noconsole.js

Have a good time debugging Internet Explorer everyone! (Just kidding.)

No Mediabox or Multibox yet for Mootools 1.2

There are no new versions of Mediabox or Multibox for Mootools 1.2 yet. Media and Multi-box mootools scripts are really great scripts for showing media. They offer more than a standards Lightbox-look-a-like. These scripts play flv, mov, mp3 and much more. Development has more or less, stopped on these very handy plugins. I honestly understand that people have lives and are busy, but to say that you’re going to wait for mootools 1.2 on 2007-7-7 and then more than a year later, not have made anything, is a bit misleading. According to wikipedia, it’s been 224 days since the release of Mootools 1.2!

1.2.0 / January 16, 2008 (2008-01-16); 224 days ago

It is somewhat sad actually. The mootools 1.2 release has been out for sometime now and I thought they would have been more proactive about releasing the bugfix version of 1.2.1, but clearly that is a ways off.

I spent at least an hour today searching the old mootools forum and google for some hope of finding a solution to my woes. The reason I was looking for these little scripts was because it one of them was going to be a core piece of the puzzle in designing the Central News System (CNS, a biology joke). One these was going to be on the front page and you’d click on then you’d just see the news for the day. Really easy and really cool.

If anyone out there knows of a plugin for mootools that is similar to media or multi-box, let me know. I might end up having to hack one of the current versions but as you might have guessed, I’m not the greatest javascript programmer.

Update

Commenter Jako found a multibox version that functions properly with Mootools 1.2 in the phatfusion’s google code. However the only problem appears to be that the overlay.js isn’t quite ready yet. Rev16 (the link above) was just added on January 7th.

Update 2009-2-8

Recently, at the end of January, MediaBox Advanced was released to the public by John Einselen. It has loads of features and is what you’ve been waiting for. Further, it’s Mootools 1.2.1 ready but I imagine without much trouble, if you had to use it with 1.2.0, it could work. I haven’t tested it at all yet, but it looks great from the examples.

Virgin Radio’s Name Change

For the last couple of days, I have heard ads on Virgin Radio about some big new changes coming up soon on the station. The ads say you should sign up to be a vip (which is a free offer by giving them your email address) and then they would notify you at some point. (Sounds like Obama’s VP pick promise: texts and emails.)

Virgin Radio Logo as of 2008-8-27

Virgin Radio Logo as of 2008-8-27

I don’t line in the United Kingdom but I sure do love that station. I’ve been listening for years, I started not too long after I started programming.

I didn’t find very much information on these big changes while searching for it, but I did look at wikipedia’s article on Virgin Radio (UK) and it says there is going to be a name change in August.

The station announced it will be changing its name in August 2008, but the new name has not been announced.

Of course, it makes you wonder: what name could Virgin Radio take up?  Star Radio? OC Radio? (just kidding) Honestly though, I wish they weren’t so secretive. It is the twenty-seventh, so there isn’t much more time before they can introduce their big change in August.

Google Auto-Suggest is here

Google’s Autocompleter has been in the Google Labs beta for a long time but apparently they released it recently to the world.

I am not really autosuggestion but I’ll get used to it. I’ll live with it as long as it does not make my google page any slower. I’ve noticed it already present in the default firefox home page, google firefox branded.

I was bored and I thought it’d be nice to have some fun with the new auto-completer, so I came up with five keyword searches to try out. I list the word and then the number of key presses needed to get me to the actual search listed in the first position and the letter if found it on it.

  1. ryan rampersad – 13 (did not even give my name as a choice!)
  2. cakephp – 5 p
  3. cheap but not easy – 12 (it listed the word blog at the end, but that’s correct anyway) o
  4. birthday of bill gates – 14 i
  5. first computer invented 13 i

The autosuggestion feature will more than likely improve over time as their algorithm for it improves or the world actually starts working and stops searching for gardening tips and celebrities. I thought of something while getting ready to write this too. What about spelling mistake auto-suggestions? Clever thought?

At this time, iGoogle does not have the feature yet.

CakePHP Model->find conditions

While working on the Central News site, I had to make some more complex queries to my database to pull only the news that should be shown today. Each news post has two date fields, start_showing and end_showing. This way we can allow a particular entry to be in the news for more than a single day without resubmission.

One would think that with CakePHP, it’d be a piece of cake, but it isn’t so straight forward.
My initial, raw sql query looked something like this.

SELECT * FROM `news_posts` WHERE NOW() BETWEEN start_showing AND DATE_ADD(end_showing, INTERVAL 1 DAY) AND 1 = 1;

That did get the date range right, but it pretty much left me high and dry for my NewsRevision/NewsState tables. Thus I had to go down a more Cake-y route.

I found Model->find() syntax to catering to my needs. It’s still a messy ordeal though, because it’s a bunch of nested arrays. My first attempt at this was to mimic my original raw query and hope I would get somewhere.

			$finder = array( " BETWEEN " => array('NOW()' => array("NewsPost.start_showing", "NewsPost.end_showing") ) );

Even though the CakePHP documentation for complex queries, claims you can use comparison words like between you cannot do that. CakePHP puts the comparison word inside of quotes so then mysql thinks it is a column name! That’s not good. That isn’t right so, we need the next plan.

So I had to actually do some logic in my brain, which isn’t easy, to get the between word out of the statement. Doing that added some more greater than/less than comparisons. Here is the new CakePHP array for find.

			$finder2 = array( "and" => array(
				"NewsPost.start_showing <=" => date("Y-m-d"),
				"NewsPost.end_showing >=" => date("Y-m-d", strtotime("+1 day"))
			));

Looks pretty nice, once you figure it all out, doesn’t it? My requirements are that start showing is smaller than today and today is smaller than end showing plus one day. Those conditions were met with this. Give special notice to the array with the key of and. However, another problem appeared! There was only a single entry at any one time.

The solution came crashing down from CakePHP documentation for findAll which just happens to be deperated. No luck there. Then, if you pause long enough to figure out the Model->find() syntax, you’ll notice you can specify it to find all and use your own conditions. Clever. Here is one I came up with after all of that.

			$finder2 = array( "and" => array(
				"NewsPost.start_showing <=" => date("Y-m-d"),
				"NewsPost.end_showing >=" => date("Y-m-d", strtotime("+1 day"))
			));
			$results = $this->NewsPost->find("all", array("conditions"=>$finder2));

The solution came slowly but surely. I wish the CakePHP documentation would show some more real world examples. Example cases are so important when learning a new foundation; example cases can’t be neglected for any reason.

Update

Since publishing this post in August of 2008, I’ve cleaned it up just a little bit. I read it over for spelling and also changed a problem with how the sql was being presented (thanks goes out to commenter Colin for pointing that out).

KS95 has no iTunes support

KS95 is a local radio station in the Twin Cities, Minnesota, United States. It’s a top-40 station and also has some interesting personality hosts set in block of four or six hours.

I have a few online radio stations that I listen to depending on the time of day and my mood/mind set. Today, I wanted to listen to KS95 online, which I don’t normally do because there is no obvious button for listening to the stream via iTunes.

I was determined to listen to it but not use the web-player which is plain stupid and is made for people who have no knowledge of the internet/computers/programs/etc. Because I cannot stand stupidification of decent things, I set out on a long journey to figure out where the stream came from and a way to make it play for iTunes.

I dug through their encoded javascript, bounced through at least four different domains and came up with this url. That didn’t help me because that apparently only plays with Windows Media Player.

So then I looked for ways to convert .asf files to some type of format that could allow iTunes to play it. Of course, there is not a reasonable free method anywhere. You have to understand, KS95 is the variety station, there is no excuse to not support iTunes streams.

For now, I’ll use Windows Media Player for this station until I can no longer stand it.

Delimiter must not be alphanumeric or backslash [CORE\cake\libs\model\model.php, line 2202]

You might considering reading the comments. They explain a proper way to fix this error. Doing it my way may cause your data to be unsaved as it is a hack!

September 2011: This post was originally written for an early version of CakePHP 1.2.

While working on some validation required in CakePHP, I came across this annoying error.

Warning (2): preg_match() [function.preg-match]: Delimiter must not be alphanumeric or backslash [CORE\cake\libs\model\model.php, line 2202]

That error has come up before in the CakePHP trac tickets, but it was for a different part of validation. Here’s what it means and how to fix it.

The error means that you need to wrap your regular expression in delimiters, which are backslashes. Here is an example. The following is your regex: (Pirate|Ninja|Alien). You need to make it into the following, regex: /(Pirate|Ninja|Alien)/.

However, if you’re like me and you found this error while using CakePHP validation, the solution is different and involves, more than likely, some array, somewhere.

Here is my CakePHP validation variable for one of my models.

	public $validate = array(
		"poster_name" > array(
			"required" > true
		),
		"poster_email" > array(
			"rule" > "email",
			"message" > "Enter a valid email address."
		),
		"start_showing" > array(
			"rule" > "date",
			"message" > "Enter a valid inital showing date."
		),
		"end_showing" > array(
			"rule" > "date",
			"message" > "Enter a valid end show date."
		)
	);

It looks right, doesn’t it? However, take a look at the poster_name field requirements. It’s only required, nothing too complicated that should mess with regular expressions, rright? Clearly not!
The following code works without any error messages.

	public $validate = array(
		"poster_name" > array(
			"required" > array(true)
		),
		"poster_email" > array(
			"rule" > "email",
			"message" > "Enter a valid email address."
		),
		"start_showing" > array(
			"rule" > "date",
			"message" > "Enter a valid inital showing date."
		),
		"end_showing" > array(
			"rule" > "date",
			"message" > "Enter a valid end show date."
		)
	);

Notice the array around the true value for required? That’s the solution to the problem!

Better than mIRC: TurboIRC 7

I read on Lifehacker, Obscure Google Tricks, which taught me the search query, better than [thing here]. Since then, I’ve used it many times. Today I needed to get some help on an IRC channel for CakePHP. I used to use mIRC but of course, isn’t free and I only had it for a few days at which point I’d force myself to use mozillia’s irc client.

Enter TurboIRC from Turboirc. A free and useful alternative to mIRC. I have to admit, at first, it isn’t nearly as pretty, but you get used to it very quickly. Since I’m actually doing some learning for once, I can’t take a lot of time and think about what features I like best plus I’ve only used it for about a day, but nevertheless, you can use this fancy feature list from their website. They also offer tons of other software, which, I believe is free too. A lot of good stuff there.

  • Available in x86 and in x64.
  • Complete rewrite in C++. More flexible code.
  • Encoding UTF-8 , ANSI , or custom per channel.
  • Rewritten and new MDI interface.
  • Per user data configuration.
  • XML configuration.
  • AES/SSL encryption.
  • External file transfers with Turbo Transfer.
  • CTCP AWAKE.
  • New system of toolbars/menus – less menu confusion.
  • Both Installed-Based and Portable Version – Installer stores data in Windows folders, portable version stores data in the folder you unrar.
  • XML – based tree configuration box.
  • Aliases, Events, Special events and alarms are mixed to one category.
  • 64-bit file transfer with Turbo Transfer DCC.
  • Scripts also support external PHP.
  • UTF-8 logging.
  • ActiveX support is enhanced.
  • Protected logging with AES.
  • Auto updates are enhanced with the Turbo Update library.
  • New chat enhancements: Insert unicode characters and tables.
  • More efficient Indirect File Transfers.
  • User information now contains custom levels and it has an unlimited size
  • Scrolling row bar to get notifications.
  • Script enhancements
    • Static variables are now unlimited
    • Custom definitions are now unlimited
    • Script size is now unlimited
    • Script supports scalar variables
    • Variable name and value is unlimited
    • Script supports external PHP (along with Javascript and VBScript)
  • Multilingual
  • Auto updates
  • Installer / Uninstaller
  • Most IRC effects (bold,italic,colors,sizes,fonts,symbols,windings, beeps,emoticons,flash,ActiveX,Voice,Clipboard).
  • SSL support in both servers and DCC chats
  • User lists (Notify,Talk notify,Ignore,Black list,Auto Op,Auto voice)
  • Custom nick prefixes
  • Scripts (Native,PHP,Javascript,VBScript)
  • Plugins
  • Skins
  • IPv6 (both tunneled and native IPv6 supported)
  • Proxies
  • Inline midi
  • Notebook
  • DCC / TDCC chats and file transfers
  • Inverse Transfers
  • UPnP support
  • Emoticons
  • Flash and multimedia messages
  • IRC tables
  • ActiveX controls

I found it on CNet/Download.com, but their copy was of poor TurboIRC 6! Don’t let anyone fool you, always get the latest version of free software.
Get TurboIRC 7.

Updates

After having used it for a couple of months, I can easily say it’s a very solid IRC Client for casual users. 9.8/10. My only minor gripe about it is that on Vista (which I have), it requires Admin privilages in order to make it have some features. I could blame it on Vista but I’ve learned that it’s not always Vista’s fault.

iGoogle Sandbox Sign Up

Sometime in June I was reading an article somewhere, it might have been Lifehacker and it mentioned Google’s new iGoogle.

It’s currently running in a sandbox, which means if you use it, nothing bad can happen to your stuff. If you know anything about facebook applications, just think iGoogle with them. Basically, there are some APIs that will give developers the ability to make canvases (like an application on facebook) and build it into the iGoogle page without distributing anyone else’s canvas. This gives a lot of flexibility, you don’t bother anyone too. I’m not really sure on any of the specifics yet, although it could be a good way to spread the (fluff)Grabber, potentially.

The Google Code Blog introduces the new iGoogle sandbox and also links you to the new iGoogle Sandbox Blog.

To get the iGoogle sandbox page for yourself, you simply follow the instructions on the iGoogle Sandbox Signup page (they don’t stop you from doing more than once either) and to get out of the sandbox once you have had enough, simply go to the same place.

He Kexin Age Documents Mirror

This is interesting. Stryde Hax found some documents from the Chinese Government about the true age of He Kexin. Because we don’t anyone to say, “We have no idea what you’re talking about, that page said she was born in 1992, so ha!” I’m doing as Stryde Hax: Hack the Olympics says, making a mirror!

Here I mirror three things. A screen shot of both documents and both document’s from Baidu. a chinese search engine. These documents were cached, originally an excel spreadsheet although now plain boring html with some highlighting for viewing pleasure.

He-kexin-age-documents zip file

screen shot of he kexin age documentshe-kexin-age-documents

screen shot of he kexin age documents

Stop selling Multi-touch on Windows 7

Please, I beg you. Stop selling multi-touch when talking about Windows 7. Don’t even mention it, never ever again. Here is my reasoning.

When the iPhone came out, it made a splash in a pretty big market of the same stuff. Phones. Why was it any different? You could touch it and when they said you could, not with a stylus, but with your fingers, it won the big bucks. Since then, the touch market has become pretty prevalent in the phone market. When you combine phones and touch, it just happens to work out. It’s cheap and it’s pretty easy.

Let’s picture a world where Apple didn’t make their own hardware. Let’s just say the released their iPhone OS into the world for, for laughs and giggles, $100, what would have happened? As you know, their iPhone OS is based on touch. There are more phones in the market with no touch capabilities. It would have been a very limited release and very small market. Now, let’s apply the same logic to Windows 7 and multi-touch.

One day in 2009, windows 7 ships and I buy a copy at best buy for $299. Sounds like a fair price, it’s touting the latest and greatest touch technology after all. And for seconds, I revel about how fun it’ll be. Moments later, reality comes crashing down. My monitor cannot support touch! My monitor is a fancy 22 inch flat screen from 2007. I suddenly go back to best buy and get a new monitor with touch capability for some around $499. That’s great, $800 for what, a greasy screen?

What I’m trying to say is this: it’ll be another Vista hardware issue. When Vista came out, nobody had the hardware for it. It’ll be the same way with Windows 7′s touch. I think about ten percent of all PC users would actually brand new hardware for just a new multi-touch. I bet it’s even less than that. Until touch-capability gets integrated with monitors without being significantly higher than a non-touch monitar, it won’t happen.

So please! Stop selling touch every chance you get. Touch is a feature, but not a main feature, of an OS.

(I’m ashamed to say this, but honestly, I think we should leave all touchy-stuff to the big Apple.)

Aurora browser concept by Adaptive Path

On ajaxian a few weeks ago there was a video posted from Adaptive Path about their new concept browser series. It’s an interesting concept browser, where the browser can be used for collaboration, data can be seamlessly manipulated, desktop and mobile spaces are unified, information is based visually by time and relevancy (can you say firefox bookmarks), physical interaction and data ownership.

There are four videos in the series and they are all pretty short, about fifteen minutes total.

  1. Collaberation and Seemless data manipluation – part 1
  2. Mobile and Location Awareness – part 2
  3. Physical data and physical reconigtion – part 3
  4. Data access, use and ownership – part 4

All of the videos show the interesting system for laying out the files that the characters interact with. I think that part is probably the most futuristic but also the most unusable. One of the things I will never get used to: touching my screen to do things. I am also scared by part 4, because being under eighteen myself, I don’t anyone but me to own my data.

(A joke I thought of, when my parents were kids, they didn’t have mice. When I was a kid, I had mice. When I have kids, they won’t have mice.)

30 Days of Mootools 1.2 Tutorials from consideropen.com

I found 30 Days of Mootools 1.2 Tutorials from consideropen.com, a company specializing in SEO, web design and other web marketing goodies. The thirty days of mootools 1.2 tutorials looks pretty promising.

The first tutorial explains about the library and basics on what each part of it does. It claims it does not need any prior expierence with mootools, javascript libraries or even real javascript knowledge. Let me give you some advice if you’re working with mootools, or any other javascript framework/library for that matter.

You need to know Javascript. If you don’t know what a function, event, or array is, you don’t know javascript.

I’m looking forward to seeing those tutorials!

Updates

Since posting this, the original 30 days have passed. I’m not sure consideropen actually posted 30 articles but I know they got to 21. I lost interest at probably  number 8. I did because it’s not the way I would’ve written a tutorial series. (Why, I remember doing something like that vaguely.) Anyway, you can enjoy the posts they did put up. I personally, from experience, think it’s very hard to attempt what they did. So, great job consideropen!

ASP.NET gets no Respect

I was reading “ASP.NET gets no Respect“, this morning and I have some things to say. First, a bit of history. My first experiences as a web developer were with ASP.net. It was really elegant for me as kid (3 years ago, now!). (Note: I added all of the bolds in the quoted text.)

In reality ‘not-free’ is a weak argument given that the Window Server Web Edition is pretty inexpensive at around $300. The Web Editon is fully loaded with everything to get an ASP.NET app up and running although the database needs to be added separately.

Pretty inexpensive? Oh, suppose I’m just getting into web technology. Do you actually believe $300 can be cheap? I don’t even pay $30 for games, let alone server software when xampp can get me a fully work ftp/smtp/http/mysql server for nothing.

ASP.NET from the outside is seen as a big and bulky solution. Huge framework, huge runtime requiring large servers, lots of memory etc. This criticism is really leveled against Windows as the platform rather than ASP.NET since the bulk of those requirements are for the operating system.

When I first came to web development three years ago, not just html and css, but server side development, I never knew that there were other things. I made a website with a login system with ASP.net using built in tools. I only recently did that with PHP and my implementation is a huge mess.

I find this argument very common, but it’s also pretty weak given that high end hardware and memory are becoming so very cheap in recent years.

I doubt that many people setup their own servers. You go for shared hosting, or VPS or dedicated.

Compared to other solutions like PHP, Python or maybe even more drastically ASP Classic ASP.NET is a monstrous beast that can be a blessing for those that feel comfortable with the framework and know how to leverage the rich functionality, or a curse for those just starting out to become proficient and become overwhelmed and confused by the myriad of choices.

This was covered above, but let’s go over it again. Once, I wanted to compress my html code which was generated from ASP.net. You can do this with something called, iHTTP or something strange and totally ambiguous. In PHP, you can do it with a str_replace and ob_start. ASP.net is really easy to get started in. However it’s really hard to take seriously when doing something another thing can do in four seconds takes four months.

ASP.NET – at least using the Web Forms engine – uses a different approach to Web development that is based on abstraction and effectively hiding many of the HTTP semantics from developers. In some ways this can be very efficient and produce very rapid results if you know what you’re doing and you flow with this concept, but if you are coming from a raw HTML and CSS background or even as a developer from other tools that are based on raw HTML/CSS principles it’s actually difficult to get your head around the abstraction that Web Forms provides.

I honestly love the web forms in ASP.net. I wish PHP had something like them too. Really. It saves so much time. My computer teacher in 7th grade brought some security expert down to the room (he was a friend of his, not sure who he was exactly) and I was showing the interesting little no-change-address-redirect. That’s cool. You can’t do it in PHP. I’ve looked. You can’t do postbacks very easily in PHP. You can’t have such an elegant code container. By the way, IDE tools win for .net and fail for PHP (most of the time.)

ASP.NET has gone Stale

This is the last one. I can’t believe this either. I started .net before Vista was named as the next Windows OS. I was excitied for ASP.net 3 but then, I come out of the Vista experience disapointed. I might not have been doing any ASP.net work, but I was still a fan. I still don’t even know the state of the framework. They totally messed up the numbering. What is it now? 3.5 with LINQ?

That’s my ASP.net rant.

Next>

© 2013 Ryan Rampersad.