Saturday, April 24, 2010

Javascript/PHP Library

After coding a few websites, I have learned jQuery is amazing, and that PHP rules.  But have also not been able to find any librarys that inherently integrate both JavaScript and PHP, or any that just provide simple functionality that is common on websites.

Personally, I don't care that much about all the other fun stuff that jQuery does, such as all of the awesome selectors, animations, and everything else. But what I am in love with is the .post(), method, which makes things so simple.  What I do care about is AJAXing everything... the login, commenting form, rating systems... anything that can be AJAX should be IMO.

Another JavaScript plugin I love to use is Google Analytics.  They track everything for you, and yes, I do mean everything...  If it can be recorded using JavaScript, Google saves it for you.   But the problem with this library, as well as jQuery and all the other libraries is that they take TIME, which is sooo important in web development.  Not only do they take time because of their huge footprints, but they also take time because of all the DNS queries, jQuery hosted somewhere (hopefully on your server), Analytics on Google's server... all of these take time to load, and it adds up.

As evident in the writing above, I think that there needs to be a JavaScript library that focuses mainly on load time for the website, and also has great tools to help developers do simple tasks such as user authentication and event logging.  I'm not gonna just sit here and say what this library should have and pass it off to another developer, so I am announcing here the launch of my JavaScript/PHP library currently entitled "vi".  This should be in an beta release in about a month hopefully.  Keep in mind that this will be written in PHP and JavaScript to optimize load times and such.

Another focus of this library will be to make it as customizable as possible, and also to make it easy to extend with plugins. I have had horrible times trying integrate forum software into an existing user authentication system, and editing its code to change the features for the specified use of that forum.   So one of the initial plugins that I will write will be a extremely easy customizable forum that will integrate with what you already have in place.

Monday, April 19, 2010

I May Just Be Kuler Then You

I say so because I just learned about an awesome website that is an awesome tool for designers (such as myself).  Kuler is a service run by Adobe where users can upload color swatches in groups of 5 that they think work well together.  Then, people can go online to Kuler take a look at the most popular, and highest rated color combinations.  Earlier today I went online to look for a color group for a website I was designing.  The site deals with the Green movement, so I was looking for earthy colors that I could use.  I looked around and one of the most popular ones was called "Park Avenue Shift"  I took a screenshot, opened up GIMP loaded the 5 colors into the saved color spots in the color picker, and went to work.  After 5 or so hours I came up with a nice looking design.  After looking at the design, I think I may need to change the colors up a bit, but that will be as easy as going back to Kuler and looking for another green-centric swatch.  

Hopefully you find good use out of this website, and if you find a particularly good looking color combo, go ahead and upload it for the good of other designers!

For those who want to see the rough design, here it is:

                              (Click to enlarge)

 I still have to play around and find a font that I like, and have to make the logo look better.  Lemme know what you think if you have comments.

Friday, April 16, 2010

A Bit About SSH

So yesterday I made a very detailed post about using SSH to get around networks and use torrents anywhere you want.   I thought about it more last night, and realized I should elaborate a bit more on WHY it works.  Basically, when you torrent stuff, you connect to a tracker, just a regular website, and say 'Hey, I wanna download THIS file, who has it?' and the tracker says 'Here is the list of everyone who does, and everyone who has some of it' (aka seed/peer counts).   Then your torrent client does some stuff to pick out the best seeds for you, and connects to them.  Then you start to download the file.

When IT people look at their traffic, they will suddenly see some traffic popping up on some random port, 61324 lets say.  They can then look at the stream of data, and they can see very easily that you're downloading music or movies or games.  

What we do to fix this is run all of our traffic through SSH.  You might be wondering why they can look at the torrent traffic, but not the SSH traffic... good question.  The answer is that all SSH communication is encrypted.  Yes the IT people could unencrypt it with a lot of work, but they wont.  I will personally guarantee this. SSH traffic is usually expected to be used for remote systems or any other application where you want data to be encrypted.

You may have realized this by now, but SSH is just a tunnel that the IT people can't look into.  It has nothing special to do with torrents.  So you can apply the same settings explained in my last post to ANY application that supports a Socks4 or Socks5 proxy.  

If you have any more specific questions about SSH, Google first, then ask me in the comments if Google fails. haha.

Torrent Without Being Caught

Alright, so there are a few things to discuss here.  First, you have to know  what torrents are.  If not, use Google!  Now that thats out of the way, lets get into the topic. 

Motivations:
So why would we want to hide our torrent traffic??  Well there are a few reasons.
  • Nosey ISPs
  • Nosey School Networks
  • Nosey Bosses
You can see where this trend is going.  So basically we are going to be able to circumvent these problems.
For people who don't quite understand, 99% of all torrent traffic is illegal (which I do not condone), and many universities, companies, and ISPs have built in methods to detect torrent traffic on their network.   

The How-To:
Alright, so we will be using a:
  • Torrent client (I will write this speciffically for uTorrent) 
  • SSH client (PuTTY)
  • SSH server 
This should work for any torrent client, and any SSH client, and any SSH server.  But I'll be writing this with uTorrent and PuTTy in mind.  First we have to aquire a SSH server account.  If you want to use this a lot, I would urge you to purchase an account on a server.  Mine is $5 a month (as low as $4.41 if you commit for more time), and has worked perfectly for the past few months.  http://b2shells.com/   Basically sign up for the Personal Shell.  When you're adding it to you're shopping cart, it will look like this

At the bottom when you where it asks for your Username and Password, that will be your username and password to access the Shell account. Make sure that you write that information down somewhere because we'll have to use that later.  

You don't necessarily have to get a payed account, instead you can look here and get an account on one of these.   If you choose to do this, some of them have a quota, which is how much data you're allowed to transfer over their network.  Usually a very small amount.  Remember that a full CD ranges from 80-120MB usually. 

Once you have your account set up, we need to download PuTTY.  If you're running Windows, I would suggest downloading the installer, but it really doesn't make a difference.  Once you have it on your computer, run putty.  Its just one simple...amazing... window.   

In the "Host Name" type in the host name,  you will be given this if you register for an account somewhere.  Also, be sure to put in the correct "Port" number, sometimes this is different, but it is usually 22.   Then, below, in the "Saved Sessions" type in a name, this is so we can save our session to re-use later.  I usually just type "Torrent" or something like that.  Dont click the Save button yet though... if you did, its okay.  Next, on the left navigation bar, navigate to  Connection > SSH > Tunnels.    In the "Source Port" you choose a number.  I have used 6633 Always, IDK why, but it has worked.  Now there are limitations to the number you can choose, but if you don't want to use 6633 just try to pick something in the 5000 or 6000 range for the sake of making sure it works.  Remember this number, because we'll have to use it later.   Dont type anything into "Destination" and on the radio buttons below Destination, choose "Dynamic" and "Auto"  Then click the Add button.  In the Box  "D6633" should have popped up.  Now go back to the Session tab in the left navigation bar. Now we want to click the Save button. Now you see the session you just saved in the list below.  You can double click on it to open up your session automatically.  Or, you can click on your session, click Load, and then click the Open button at the bottom.   

As a note, you can actually make using this a bit easier if you want to.  In PuTTY, load your session, and in the Host Name box, in front of the web address, type in your username and then @.    So,  if your username is "qwerty", and you are connecting to "shell.sshost.com"  then you would have this in the Host Name box  "qwerty@shell.sshost.com".   Then, instead of having to type in your username every time, you'll just have to type your password.  

Okay, now our shell opens up, it looks like a command prompt window, and you will be asked to log in, so type in your username (if you didn't do the step above) and your password.  Then you will see that you have logged in correctly. To test, type in "pwd"  that should print out what folder you are currently in.    Another not about loggin in... when typing your password, it may look like no characters are showing up.  This is supposed to happen.  Just carefully type in your password, and hit enter.  

If you want to, play around here and use the storage that you get.  Make some folders "mkdir FOLDER_NAME".  Navigate through folders   "cd FOLDER_NAME".  "cd .." gets you to go up one directory.  "vim" brings up the text editor... it is confusing and i will not cover it here.  Maybe in a future post if people want to learn about its amazingness. 

Now we are done setting up SSH, and just have to prepare the torrent client.   Install uTorrent, and open it.  Make sure not torrents are running now, as they will be using the regular network until we change the settings, which could get you in trouble.  

In uTorrent, click Options > Preferences.    In the left navigation bar, click on "Connection"  in the "Proxy Server" box, for "Type" choose "Socks5", for "Proxy"  type in "localhost" ...  "127.0.0.1" will also work. its your choice. For "Port"   we need to put the port we chose to use in PuTTY... I choose 6633 so I would type in 6633.  Pretty simple.  Uncheck "Authenticaton",  and check "Resolve hostnames through proxy" and "User proxy server for peer-to-peer connections".   Now hit "Apply" and then "OK".  

Now download a torrent and open it inside uTorrent and see if it downloads.  If it does, then you have set up correctly... if not, you're out of luck.

Finishing Remarks:
Hopefully this was an easy to follow guide, and everything is up and running correctly.   Sometimes if you let your SSH session run for a very long time it will dissconnect because of a software error or something.  In this case, just click "OK",  then on the PuTTY window, right click, and select "Restart Session" and it will try to reconnect you.  Usually you'll have to log in again.  

If you have any questions or want more pictures, lemme know in the comments.