Tumblelog by Soup.io
Newer posts are loading.
You are at the newest post.
Click here to check if anything new just came in.

September 12 2011

Running node.exe windows

Finally node.js is available as a windows binary without requiring Cygwin to be installed.

As of writing this post you can download the node.js binary 0.5.6. Currently npm does not work with node.js on windows. You need to download and use ryppi.py instead of npm. It works similar to npm but requires python. To setup node.js first set the PATH and NODE_PATH to the where you have copied node.exe.

             set PATH=%PATH%;c:\node
             set NODE_PATH=c:\node


It is better to set these environment variables in the System Properties so that you don't have to set these variables every time. Follow the following steps to do that.
  1. Right-click Computer, and then click Properties.
  2. Click the Advanced system settings in the left side bar.
  3. Click the Advanced tab.
  4. Click Environment variables.
  5. Append the node path to the PATH variable
  6. Create a new variable NODE_PATH and set it to the path where node is installed
Once you are done with it need to install Python as ryppi.py is a python script which works like npm. Once you are done with it you can install any of the libraries by using the following command.

             python ryppi.py install socket.io express

Am assuming here that python is setup using the installer which also will also setup the path of python in the environment variables. 


April 07 2011

Speed up your JavaScript

This post is just for my own reference. Here are the slides and the video of the presentation by Nicholas Zakas. Goes into great detail in ways to improve the speed of your javascript code.





The article summarizes most of the points in the slides and video http://james.padolsey.com/javascript/zakas-javascript-performance-tips/


December 30 2010

The best mobile development platform for hobbyist programmer - IV

The best mobile development platform for hobbyist programmer - I
The best mobile development platform for hobbyist programmer - II
The best mobile development platform for hobbyist programmer - III

Over the last few years the whole mobile landscape has completely changed. Now the contenders have also changed. When I last wrote about the topic there was no SDK for the iPhone and Android had not launched. Since then the whole landscape has changed. iPhone is the king amongst the platforms. Android is a close second. J2ME is a platform which still goes unnoticed since its just not part of most new smartphones. The process to develop Windows Mobile apps has gone a complete transformation with a completely brand new way of developing apps. Symbian is in its last leg, Nokia will be moving to MeeGo soon enough. Palm development also changed completely with the launch of Web OS. If you plan to develop today here is how you can go about it.

1) iOS Development - SDK for iDevices
2) Android
3) Palm Web OS
4) Windows Mobile
5) Symbian
6) RIM - Developing for the BlackBerry
7) MeeGo - Upcoming mobile platform
8) Java ME - If you plan to develop for most feature phones.


July 09 2010

Getting song information from a shoutcast server

This is a very simple way to get the currently playing song information from the server. Append /7.html to the music stream. This will give out a HTML file with the following details. There is CSV information inside the body. Based on the position you can find the following information.

1. Current Listeners:
2. Status:
3. Peak Listeners:
4. Max Listeners:
5. Reported Listeners:
6. Bitrate:
7. Song Title:

To see whats currently playing on Radio TeenTaal you can try http://91.121.155.39/7.html.


May 10 2010

Force shoutcast server to send audio stream

This is something I had read about some 7 years back but had completely forgotten about it. Basically I was trying to get the audio stream from the shoutcast server in the browser.

If you open the shoutcast url in the browser you will get a html page and not the audio stream. To force the audio stream use http://example.com:8032/;stream.mp3 the ;stream.mp3 in the end forces the server to send the audio stream. You don't even have to write ;stream.mp3 you just need to add a ; (semicolon) in the end.

Hopefully next time around I am looking for it. I can read it here. I was looking for this info an year back but wasted quite a bit of time but could not figure it out.


April 29 2010

COMET for Chirp User Streams - II

After almost giving up I finally figured out a way to use the Chirp User Streams. Not the best way to use it but I guess it just might work. Create a XHR request and abort it ever other minute. It will complete the request and make a new request. Try and keep the connection alive. This is something that facebook does in its chat. Thought there the connection is aborted by the server.

In this case make sure that you abort and make the connection the very next second. It should be possible to use the same connection to reconnect to the server. But I have not tested it extensively to see how it will work in a real world situation.

For now it works and hopefully when I again get to work on it I will write something more about how I use the ChirpUserStreams.


COMET for Chirp User Streams


First there was AJAX and to give it company there was COMET. Incidentally both names of popular disinfectants in North America. In JavaScript AJAX allows the client to PULL information from the server and COMET is the technology where the server PUSHES down information to the client.

I got interested in COMET after going through Chirp User Streams. Thinking it would be a trivial task to call a XHR and keep listening to it. In my mind I kept thinking that it would be stuck on readyState 3 and it will never get to 4. Since it would be stuck at 3 I could use a timer and after every few seconds keep checking for the change in length of xhr.responseText.length. Technically it should work like that.. BUT.. the way IE has implemented XHR it is not possible to check the responseText till it reaches 4. Which means that the request has timed out or ended. That somehow makes no sense at all.

I figured out it was time to investigate and see how Facebook and GTalk were able to work on IE if it does not allow you to read text till it reaches readyState 4. Facebook makes a XHR and keeps waiting, after a minute if there is no data it sends some data and the connection is closed and a new connection is made. Incase there was some event in between that minute the XHR reaches readyState 4 and a new connection is made. In a way facebook makes a new connection for every new event. Here a bunch of events can also be merged together to make it more efficient.

While looking into it I also figured out the other way to use COMET. But in that case you need to make changes on the server side. You basically use an IFRAME and send out information in chunks. Every time the server wants to PUSH some data or call an event it makes a new SCRIPT element with the data. Since the script is executed instantly the client can listen to events that way.

In all this confusion I realized that there is no easy way to use Chirp User Streams using XHR in IE. Might have to look into WININET to get the work done.


April 22 2010

Moving from Basic Auth -> OAuth -> xAuth

Twitter will remove the option to use Basic Auth from June onwards and the only option left is OAuth. But the problem with OAuth is that its a UX nightmare to implement in a Desktop application. After trying to figure out how to use OAuth all day long I finally figured out that I was looking for xAuth all along.

Cutting a long story short I found a blogpost which helped me get a hang of it. Using xAuth, an alternate OAuth from Twitter. Also found a little bit of help on the twitter wiki on using xAuth. Its quite simple to use once you get a hang of it. But since it mentions headers in most of the places I assumed HTTP headers but you need to provide all the parameters when you POST it to twitter.

I have sent out a mail to enable xAuth on my account lets see how long that takes and I can finally start using xAuth instead of the cumbersome OAuth to log into twitter.


April 16 2010

Dynamic GUI and console windows application

Running the same executable as a GUI as well as console application. This is one problem I had come across a few years back. But I soon realized that its decided while linking if an executable will be GUI or console application.

But given the amount of time its been I thought of searching online and I came across this article "How do I write a program that can be run either as a console or a GUI application?". It kinda had a solution but in the end its still better to have two separate executables. One for GUI apps and the other for console apps. After all these years Java also has two executables. java.exe for console apps and javaw.exe for GUI apps.

There are two bytes in the executable file which tell the OS if the file is Console or GUI app. Change those bytes and you can run it as a console or GUI application. For more information about the PE format visit http://wotsit.org.

Hopefully this is the first in the series and hopefully I will be writing more about it soon.


Older posts are this way If this message doesn't go away, click anywhere on the page to continue loading posts.
Could not load more posts
Maybe Soup is currently being updated? I'll try again automatically in a few seconds...
Just a second, loading more posts...
You've reached the end.

Don't be the product, buy the product!

Schweinderl