Windows is Bad, Stop Using it.

Out of the six (6) running PC’s within my household, 5 run either Cent OS or Ubuntu, and of course the sixth (my Powerbook) runs a purchased copy of Leopard.  I decided after a few beers that it would be nice to geek it up and relax - play some games on my laptop.  So I dig through my “100% SHIT” pile to locate my pirated Windows XP (with a bunch of stupid pre/post-fixes like : sp3 cracked, no wga, super awesome version — CORPORATE!) and begin a dual boot installation (with Ubuntu) on my Toshiba A200 Laptop.  Unfortunately the cards weren’t in my favor as Toshiba decided that the piece of shit speakers on my notebook required high definition audio… from M$.

It makes a lot of sense to me, adding high def audio support on 3/4″ *tin sounding* speakers, so I searched for the drivers everywhere - no support.  Then I remembered that the last time I got the audio working was from Windows Update.  Now this Super Awesome CORPORATE mother-of-all-xp-installation discs just happened to check on line for the audio driver and to my surprise I get a WGA validation fault, and even better - it can’t find the god damn driver.

I got pissed - I don’t need a hassle to be hassled with bad software, I just want to play Diablo II & Final Fantasy 9 in peace.  So I picked up the phone and with my handy dandy Asterisk server recorded a call (*1) with Windows Genuine Advantage to see what the problem was.

Listen to Windows Genuine Advantage Call

I have realized that every single time I use Windows I run into some kind of hassle.. So I have officially made the decision to boycott all Windows products and as many non-mandatory protocols as possible to eliminate the additional stress from my life.

I am not trying to start an OS flame war here, I just can not stand this garbage and thought the world should know….. again.

Share/Save/Bookmark

Notes on Acoomplishing Something New

I am writing with my recent development accomplishments in mind, I never thought I would be able to do the things I can do now.

I will admit at one point I was very intimidated with the whole Ajax wave and it seemed that no matter what I did, after rolling out an Ajax-enabled app - I would always feel like I did something wrong or there was a major security vulnerability in my software… somewhere.

So I have compiled a list that I can relate my entire development learning experience to ( though this also applies to more than just computer related challenges ;) )

Rule 1. Get Over Your Fear of Failure

You will fail, I guarantee it - no matter what, something will not go your way. Remember that no one is an expert at everything. I have found that “learning the hard way” means you will never forget your mistakes.

Rule 2. Someone Will ALWAYS Be Better Than You

Sorry, You may be good, but you are not the best and somehow someone will always outperform you.  Just remind yourself that competition is not why you are doing what you are doing, it is for YOU (unless you are sick & twisted).

Rule 3. You Will Want to Give Up

Do not, no matter what!  I have spent so much time thinking about how bad I suck at what I am trying to do instead of pushing that energy towards actually doing the work.  If I was to give up on what I was trying to accomplish I would be in a worse place than I was while actually attempting to learn it, at least during failure I was trying.

Rule 4. Know You Can Do It, But Understand That It Will Not Be Easy

Prep yourself for a major challenge, do not think you can pull it off in a day - you will be dissapointed.  Understand that nothing is ever complete and everything can be improved, that’s life.  Comfort yourself in the thought that you are capable, just remain focused.

Rule 5. Make Fun of Yourself

Embarrassments will be a plenty, however self depracating humor is one of the hugest marketing strategies to date.  Remeber when DreamHost goofed up and billed everyone for an entire year?  They owe their writers huge due to the fact that they were honest and still made us smile though we were just reamed by their billing department, very admirable.

In Conclusion

There is nothing new here, these ideas have been talked about forever however everyone needs some motivation every now and then.  These notes were written for my own reference for future challenges and I know they will be of use, hopefully you will find them useful as well.

Share/Save/Bookmark

Product Review : Canon SD1100 IS

Yesterday I went shopping for a Point and Shoot Camera as a gift for a very talented amateur photographer.  We already own an older model Canon S1 IS DSLR that kicks ass however a pocket sized P+S was the ideal birthday gift. So I spent about three hours on line reading reviews before I committed to a specific model and to no surprise, I chose another Canon.

We took the camera out today to break it in properly at Bronte Harbor, vigorously testing the different DSP settings and zoom capabilities.  After about 45 minutes and about 100 photos, we couldn’t wait to bring it home and compare to our older model DSLR.

Once again. I was not surprised - the new SD 1100 iS was ridiculously awesome and here’s why :

  • This camera is ready to take another photo milliseconds after a photo is taken (Thanks to Digic III + HD SD Card - 8GB).
  • Image stabilization works like a dream, I can now snap a great shot even after a few beers.
  • The color accent DSP is incredible and so easy to use (Great effect!).
  • Video quality is incomparable to my older S1 IS.
  • Robust manual settings, though not really necessary with the great automatic configuration.

Cons :

  • 3X Optical Zoom (though I already have a great 10X optical DSLR).

That’s it for cons.  There is really nothing bad about this camera. In total I spent roughly 400 dollars however that includes an 8GB HD SD card and an additional Battery + case.  The camera before tax at Best buy sold for 329 and Staples (Canada) was 279.  In my opinion, this is probably the best digital investment for anyone interested in taking beautiful pictures on an easy to use device - at a very competitive price.

I took a picture with both cameras and put this image together using Photoshop however I did not modify the image whatsoever (except a crop)

Comparison

Share/Save/Bookmark

Code Igniter User Permissions - A Simple Solution

Recently a client requested a massive user permission based application supporting thousands of articles and updateable permissions for their users.  This was tough considering AFAIK - CI does not have a native model for this type of application, so I had to figure it out myself.

The application needed a way to determine a users permitted actions based on a session containing the users “permission level” pulled from the database - if the user is created as an administrator the “permission” row value is “admin”. If it is an authenticated paying customer, the “permission” value is set to “private” and if it is empty then the user session would be created as “public”.

Some users are subscribed to only a limited number of “courses” so this required another table.  I created a table called course_permissions and added three rows - “id”, “course_id” and “user_id” - this allowed me to inner join all of the required tables (”courses”, “users”, “course_permissions”) to determine which user was subscribed to which course (thanks Craig).

So I got all of the permission level stuff sorted out but I needed a nice way for the computer r-tard to update permissions for individual users, if need be.  I downloaded jQuery and UI to complete this task.

Using jQuery UI I was able to create two list boxes - the Left contained a pool of all available courses, and the Right contained the users. This was actually quite easy to implement and now the administrator has a very simple drag and drop course selector module.  I will explain it if someone asks and even post some of the source.

The administrative interface grew and became very polished because I was dreading having to drop an “if” in the first line of every privatized action to make sure only the right people were getting in, so this is what I did.

Step 1.

First I autoloaded a model I created called init.php, this model basically automatically creates site titles, grabs the description and keywords from the admin settings etc.  I plopped a simple switch to inspect the uri segments, compare them againnst static set of arrays containing possible user actions and then redirect or die accordingly.

Example :

switch ($user_permissions) {

case “public”:

$segmentOne = array(”view”, “courses”, “user”);

$segmentTwo = array(”page”, “login”, “article”);

break;

}

if (!in_array($action, $segmentOne)) {

return “You do not have permission to access this page”;

die();

}

This is a VERY basic example however it demonstrates how to jail users into certain actions without having to code it directly into each function.

Now a problem I faced with this solution is that POST variables can still be sent and inserted so I needed a way to completely lock down a function : here’s what I did.

Created another method in init.php called function lockdown($level)

This function takes one parameter ($level) and compares it against the current session - now to completely lock down any function for administrative use only,  I just put $this->init->lockDown(”admin”); for private users I can put $this->init->lockDown(”private”);  Ithen went over all of my functions and passed an array of which user level can access that specific function.

I initially wanted to avoid having to put an if in front of every function but with this method I can safely put it in the first line of every function and trust access is being granted to only the users it should be.

I will have a video showcasing this application within the next few days, I will definitely add it to this post.

Mr. Confusious say : leave a comment if you’re stumped.

Share/Save/Bookmark

Why Is Everything a “Hack” With Javascript?

As I have stated in the past, I hate JavaScript.  It looks messy and feels very sloppy to code.  After relentlessly studying JQuery for the past several weeks I have come to the conclusion that everything in JavaScript is a Hack.

For example :

If you have ever used Wordpress, you are farmilliar with adding “Tags” to posts to help categorize them.  Sometimes while writing a post you have a great idea for a tag, so you scroll down and add it, then continue to write your post without having to wait for the page to reload (delimiting the chance of losing your content).

This is made possible with a methodology of client side scripting called “AJAX”.  Basically it allows you to send information to the server (Asynchronously) so no data is lost - great.

Now with all of the tools available to us developers today such as Scriptaculous and JQuery - this process is still a nightmare.  I am currently working on an shopping cart application for a client and tags must be added to products for indexing and other cool stuff.

Time For a Hack

I create the form and successfully send the post data via ajax, a yellow bar flashes and the new data is appended to the shiny new div. Fortunately this only took me three hours to hack together.

Now the user wants to remove a tag? What if he accidentally misspelled the tag or just doesn’t like it any more.

Time For a Hack

Make a button or link and send the post values once again.  So everything is working great but all of a sudden I can not delete a newly added tag, when I click it - it does nothing.

More Hacking! The new tag was appended to the tags div and I can delete any other pre-existing tags but this new tag just will not go away.

Unfortunately this type of issue is difficult to find any help for considering the fact that you can’t type “appended button will not delete” in Google and expect any decent results.

I am going to smash my face against my keyboard for a couple more hours …or just start drinking.

Oh heres the code that took me 7 hours to write, it still doesn’t work properly…

$(function() {

	$("#tagForm").submit(function(){
		var product_id;
		var tag;
		product_id = $("input[@name=product_id]").val();
		tag = $("input[@name=tag]").val();

		$.post("/products/addtag",{
			product_id: product_id,
			tag: tag,
		},
		function(post) {
			$('#tags').highlightFade('lightyellow');
			$('#tags').append(" Delete ”+tag+” ”);
		});
		return false;
	});

	$(’#tags > a’).click(function() {
		$(this).fadeOut(’slow’);
		$.post(”/products/deletetag”,{
			tag_id: (this.id),
		});
		return false;
	});

})

Share/Save/Bookmark

I Steal Bad Software

When I got my Powerbook, I was so excited I immediately went out to Best Buy and bought ($230) a 5 user license of Leopard so I can get full functionality out of the wonderful operating system without worrying about any licensing issues — and share it with my friends.  When I can afford Text Mate, I will gladly spend $50 on such an awesome product, I may even send the developer a case of premium beer.

Unfortunately, a time will come in all of our lives where we will be forced to use software we just do not feel like paying for.  It really is difficult paying for something you don’t want - it is like buying Salad at a restaurant because your girlfriend wants to share, you don’t want to but you have to.

Now I have a bit of a problem. I love the broadcasting software I use for Radio Free Geekhut, unfortunately it is Windows Only - so I was forced to find alternative means :

Step 1. Open Browser -> thepiratebay.org

Step 2. Search : windows xp

Step 3. alt + f2-> transmission -> download torrent

Step 4. $ cdrecord -v -pad speed=1 dev=0,0,0Windows_Xp_SP2.iso

Step 5. Haul a piece of shit p3 out of the closet to install this rubbish on.

Something I have learned is that stealing software can become a chain reaction - propreitary depends on propreitary hence repeat steps 1-5 however replace Step 2’s search query with many other “apps”, if that’s what they are called in Windows.

Just a thought - If I am forced to use Microsoft’s bad software because they are the “industry standard”,  Why in the fuck don’t they follow other standards such as those set by the W3C???

I will continue to steal their software until they create something that is worth paying for.

Fuck You Microsoft - Especially IE6

Share/Save/Bookmark

Run Your Own Web Server with VMWare

After spending years playing with Linux Servers and VMWare I have decided to give a little bit back to the community.  I have created a minimal VMWare web server image with everything you need to get started hosting your own web pages and applications.

This is a CentOS 4.6 minimal installation with all the updates / upgrades (to date) and a full LAMP stack to get you started.

It ships with :

  • PHP 5.1
  • Most common PHP Libraries (GD, Mcrypt…)
  • Mysql 5
  • Apache 2
  • Cent OS 4.6 Minimal - Up to date

What starts on boot :

  • SSH (remote management)
  • HTTPD (Apache 2 Web Server)
  • MySQL (Database Server)

Getting Started - Windows User Beware, No Mouse Available!

If you are a linux user you probaly don’t need any help - just a quick and easy LAMP stack.

If you are a Windows user, I am guessing you a complete moron and will need a lot of help setting this up.

In Windows there is an annoying application or “exe” called putty you can use to configure this system remotely.  All you have to do is know the servers IP, you will have to either check your gateway for new DHCP leases or log into the virtual machine to find this out.

Default Administrative Username : root

Default Administrative Password : password

Change your password IMMEDIATELY using the following command - I know Mr. NT,  its scary not using the mouse.

# passwd
and follow the on screen instructions - if you are having problems already - give up, you suck.

Now that you have changed your password lets set our database password, use the following command :

# mysql -u root -p

// It will then ask you for a password - it is “password” - without the quotes

Password : password
mysql> set password = password(”your new password”);

I facepalm when I see people set their password to that of “your new password” - if you are confued, give up.

Now if you want to use DHCP (bad idea for servers unless you set static routes in your gateway) then just run :
#ifconfig
and write down the IP address it spits out.

Otherwise you want to set a static IP, one that doesn’t ever change - type :

#netconfig
And specify the IP, Subnet, Gateway and DNS info - if you don’t know what this means then you may as well give up.

Great, we have set our IP, admin password and mysql database password - lets use ssh now - press ctrl + d to logout.

Now open your shitty windows “putty” program and all you have to type in is the IP you wrote down earlier, or the staic IP you configured using netconfig.

Login as root and type in the password you just set (not the damn mysql password!)

It is time to set up an Apache Virtual Host

Since you love M$ use nano, it’s the easiest editor for n00bs :

# nano /etc/httpd/conf/httpd.conf

at the very bottom of the file paste :

NameVirtualHost *:80

<VirtualHost *:80>
DocumentRoot “/var/www/yourdomain.com
ServerName yourdomain.com
<Directory “/var/www/yourdomain.com“>
AllowOverride All
Allow from All
</Directory>
ServerAlias www.yourdomain.com
</VirtualHost>

Where 80 is the port the web server listens on and yourfomain.com is your FQDN (fully qualified domain name)

Make a directory to host your files using this command :

# mkdir /var/www/yourdomain.com

Where yourdomain.com is the same you specified in your httpd.conf.

How to restart applications

Apache Web Server : # service httpd restart

Mysql Database : # service mysqld restart

To stop a service replace the above restart with “stop”.

Awesome - now you are ready to get started on your DNS info. Login to wherever you registered your domain and change your name servers to ns1.everydns.net, ns2.everydns.net and ns3.everydns.net.  Create an account at everydns.net (its free) and add a Dynamic domain which will automatically point to your server IP as long as you are at the same IP when you create the Dynamic Entry.

You want to set an A record to your IP - MX is not necesarry if you are not hosting an email server.

Last thing you need to do is open your router / gateway management page and Forward port 80 (or whatever port you put in your httpd.conf) to the IP of the your VMWare Image.

Once that is all done and the DNS has propogated (could take overnight) - you should be able to visit yourdomain.com and see a “Welcome to Cent OS” page.  You can change this by adding files to /var/www/yourdomain.com specifically an index.php or index.html file.

I hope this wasn’t too painful to read - download the image here. If the file is not 686 MB, it means it’s not done uploading and wont work - be patient!

If you are an r-tard Windows user and can’t unzip this tar.gz archive, download winrar, google it if you are stupid.

I will write a tut in the future re: connecting to VMWare without a GUI

Share/Save/Bookmark

DD-WRT Static Internal DNS

All I can say is WOW!

I just did a firmware upgrade on my Linksys WRT54GS v4 to the latest stable DD-WRT bin, and I must say their are two massive benefits to upgrading your firmware if you haven’t already.

 

Part 1. Static Internal DNS / DHCP Leases

We can now organize all of our clients nodes the way WE want whilst still using DHCP to handle leases!  Simply paste your MAC, think up a clever hostname, and pop in a static IP and you are ready to rock with Static DNS.  Run dhclient and watch your machine grab the IP you set and the hostname you want.

 

Part 2. DNSMasq - Additional DNS Options

Ever want to attempt a PXE Boot or NFS Root installation of your favourite Linux distro - but you don’t want to go through the hassle or creating a private network with DHCPD and the whole IPTables nightmare? Don’t forget having to buy a switch - because not many people have these laying around any more (I only have 4).

 

You are in luck!  DD-WRT allows you to specify additional DNSMasq parameters to specify your tftpd server and the name of your pxe file, just add ” dhcp-boot=pxelinux.0,,<IP of TFTP Server> “into your :Additional DNS Options” under Administration -> Services.

It could not get much simpler than that - now go play!

Share/Save/Bookmark

When I Close a Door, I Always Open a Window

No I don’t mean XP, I hate that shit.

I am talking about my power supply debokkle. I found one on Kijiji in Hamilton for only $40 plus the same seller has 512 MB Ram baby!  Even better - she is selling it for only $25!  So I meet her tomorrow with $65 and I have a super fast Powerbook with a brand spanking new power supply for much less than I could find it anywhere else!

Just thought I’d mention that for all of you who were worried I was going through Leopard withdrawals, I was.

Anyway, I am going to read Craig’s blog.

Share/Save/Bookmark

Re-Encoding m4a to mp3 in Ubuntu

I just downloaded a bunch of older Moneen torrents and wanted to put them up on Radio Free Geekhut, unfortunately my crappy Windows Encoding box doesn’t support m4a playback.  After a quick google search I found a link as to how to convert these puppies in Ubuntu / Debian since soundconverter wont do it for me.

Quick and dirty -
$ sudo apt-get install -f -y faad lame

Open a terminal and switch to your directory with the m4a files in it.

Run this :

for i in *.m4a
do
faad -o - “$i” | lame -h -b 192 - “${i%m4a}mp3″
done

Took me a couple minutes per song but was worth it being able to play Moneen on RFG.
You can also make a script in /usr/local/bin (or wherever) called “m4a2mp3″ or something like that.
Don’t forget to make it executable using $ chmod +x <file name>

Share/Save/Bookmark

Next Page »