Handling FTP usernames with @ in them

During my recent FTP adventures, I also found that some shared hosting sites give you an FTP username with the ‘@’ symbol in them. It is fine as long as you are going to use a GUI client to connect to FTP. But if you try using the commandline or Finder in Mac, you will have issues since the ‘@’ symbol is also used to separate the username from the host.

After some research I found that the ‘@’ symbol in the username can be replaced with ‘+’ while specifying it in the command line. I tested it with both wput and the Finder in Mac and it worked perfectly in both.

So remember, the next time you try to connect to FTP server from command line and you have a ‘@’ symbol in the username, then replace it with the ‘+’ symbol. Happy FTP’ing 😉

Posted in Unix/Server Stuff | Tagged , , | 4 Comments

Excluding .svn folders while transferring entire folder by FTP

Recently I had to transfer an entire folder, with lot of sub-folders to an FTP server. I know that there are lot of FTP GUI tools available that can do it, but I wanted to do it in command line so that I can script it.

I searched for the solution and came across an excellent tool called wput, which does exactly that very easily. It is very similar to wget, but instead of downloading the content, it allows you to upload it.

I installed it using apt-get and was trying to upload the entire directory. It was at this point I realized that I want to exclude all the .svn folders.

I again started searching for an answer. I even posted about it in stackoverflow, but couldn’t find a solution. I then went over the man page of wput and hidden inside was this gem, which allowed you decide on which files to include/exclude from the directory.

I thought of posting it here, so that it is useful for others and also I know where to find it when I need it next time.

So all you need is just one line. If you have not installed wput before, the install it using one of the following commands based on your operating system.

Posted in Unix/Server Stuff | Tagged , , | 3 Comments

Hacking 101 at IIT Bombay for HackU

Yahoo is currently conducting HackU (Hackday for university) at IIT – Bombay and I was part of the Technical crew that is conducting the event, similar to the previous HackU.

During the event, I gave a talk titled Hacking 101, basically explaining what is a Hack, how to participate etc.

Continue reading »

Posted in Events/Conferences | Tagged , , , | 4 Comments

Writing efficient JavaScript for V8

Daniel Clifford from the V8 team, gave a presentation in Google I/O 2012 about optimizing JavaScript for V8 to make it run faster. I am posting notes which I took while watching the video, so that I can refer to them at a later point of time (It is easier to search when it is not on paper 🙂 ). Also it might help someone to get the outline of the talk before actually watching the video. The original video runs for about 45 minutes.

Also be warned that the following is my own interpretation of the video and I might have missed or could have interpreted some point differently 🙂

Breaking the JavaScript speed limit for V8

The talk was basically built on the premises that if you understand how V8 compiles and optimizes your JavaScript code then you can write efficient JavaScript code (at least for V8). Daniel explained a few optimization techniques that V8 uses and also gave suggestions for writing JavaScript code that will make use of these optimization techniques employed by V8.

I am not going to get into the details of these optimization techniques, but just going to give the list the suggestions.

Classes

V8 internally creates hidden classes for each JavaScript object at runtime. Objects with the same hidden class can use the same optimized generated code. So the suggestions are

  • Initialize all object members in the constructor functions
  • Initialize all object members in the same order.
  • Avoid adding new properties at runtime

Code sample

Numbers

V8 internally uses 31 bit signed integers (refer to the video for the full explanation). So the suggestion is

  • Prefer numeric values that can be represented as 31 bit signed integers

Arrays

V8 uses two types of objects to represent arrays

  • Fast Elements – linear storage for compact key sets
  • Dict Elements – hash table storage.

Out of these two, Fast Elements are generally preferred. So the suggestions are

  • Use contiguous keys starting at 0 for arrays
  • Don’t pre-allocate large arrays, instead grow them
  • Don’t delete elements in an array if possible
  • Don’t load uninitialized or deleted elements
  • Use array literals instead for small fixed arrays
  • Preallocate small arrays to correct size before using them
  • Don’t store non-numeric values (objects) in numeric arrays

Code sample

Other suggestions

  • Prefer monomorphic operations over polymorphic operations
  • Don’t have performance sensitive code inside a try..catch block. Instead use a separate function and then enclose the function inside try..catch block.

Some V8 logging commands

Video

And finally here is the full video.

So my dear readers what you think about my notes. Also let me know if you like notes for videos in this format. If there is a demand, then I can post some of my notes on other videos which I have already viewed.

Links

Posted in WordPress | Tagged | 2 Comments

Board Hackthon

Last weekend, a couple of us from computer club (read hardware enthusiasts) met together to discuss about the different development boards available and also to learn from each other.

Boards

The following are the list of development boards that we discussed during the hackthon.

Continue reading »

Posted in Arduino, Events/Conferences | Tagged , , , , | 2 Comments

Introduction to Node.js at Yahoo Girl Geek Dinner

Last Thursday, I conducted a workshop about web development and node.js in Girl Geek Dinner event sponsored by Yahoo in Bangalore.

Girl Geek Dinner

Girl Geek Dinner was organized by Yahoo!’s Women in Tech (WIT) group, a grassroots volunteer-led employee organization at Yahoo!. The event is conducted to inspire and support the next generation of technical women.

Continue reading »

Posted in Events/Conferences, JavaScript/jQuery | Tagged , , , | 1 Comment

10 more open source Android apps which every developer must look into

Sometime back, I listed top 10 Open source Android apps, which every developer must look into. It’s been quite sometime since I wrote it and now I am adding a few more to the list.

Ubuntu One

Ubuntu One is a cloud storage service by Ubuntu. They have released an Android app which allows you to upload files to the cloud from your mobile and also manage your Ubuntu One account from your phone.

You can learn how to upload files, make Rest API calls, store auth tokens, detect WIFI activation etc by browsing the source code.

Source code Url: https://code.launchpad.net/ubuntuone-android-files

Mixare

Mixare is an open source Augmented Reality Engine for Android. It is pretty well build and complete.

You will learn how to draw custom shapes on top of the live video feed captures by the camera by browsing the source code. You can also learn about creating Plugin models in Android apps.

Source code Url: http://code.google.com/p/mixare/

Desksms

DeskSMS is an android app that forwards all your text messages and call history to your GTalk, GMail, or a convenient website and browser extension. It written by koushikdutta.com, the author of Rom Manager

You can learn how to read, send and forward sms and call log by browsing the source code. In addition to the android app source code, checkout the other browser extension source code as well.

Source code Url: https://github.com/ClockworkMod/DeskSMS

Call Meter NG

Call Meter NG/3G is an Android application summing up your call and text logs.

You can learn how to read call logs, SMS logs, MMS logs and data logs by browsing the source code. In addition to it, you can also learn how to create variable length widgets, which is one of the cool things about the app.

Source code Url: http://code.google.com/p/callmeter/

Scrobble Droid

Scrobble Droid is an Android app, that keeps track of music you listen and sends the details to Last.fm

You can learn how to track music that is currently playing in Android by browsing the source code. In addition to it, you can also learn how to consume Last.fm API from ndroid.

Source code Url: http://code.google.com/p/scrobbledroid/

Gmote

Gmote is an Android app that turns your Android phone into a remote control for a computer, allowing users to run movies and music at a distance.

You can learn how to transfer touch and other gestures from phone to computer and also about music streaming between phone and computer by browsing the source code.

Source code Url: http://code.google.com/p/gmote/

Ema Personal Wiki

Ema Personal Wiki is a notebook with linkable pages for tracking your ideas, todo lists, tasks, bookmarks, brainstorms etc. The notes are stored in markdown format and can be synchronized using Dropbox account.

You can learn about using markdown and syncing files using Dropbox Api by browsing the source code.

Source code Url: https://github.com/janwillemb/Ema-Personal-Wiki

Chrome to Phone

Google Chrome to Phone Extension is a project consisting of a Chrome Extension, Android App, and supporting AppEngine server that enables users to send links from their Chrome desktop browser to their Android device using Android’s Cloud to Device Messaging service.

You will learn about using C2DM and sharing url from browser by browsing the source code.

Source code Url: http://code.google.com/p/chrometophone/

Android Tetris

It is a Tetris clone for Android.

You will learn about drawing on the canvas by browsing the source code.

Source code Url: http://code.google.com/p/androidtetris/

NFC Tic Tac Toe

This is a sample Tic Tac Toe game implemented using NFC.

You will learn about transfering data using NFC by browsing the source code.

Source code Url: https://github.com/iBadrinath/NFC-TicTacToe

Posted in Android/Java | Tagged , , , | 19 Comments

Building Robots using Android and Arduino in Google Devfestx

I just came back from Google Devfestx which happened in Bangalore today. The event was very well organized and I gave a talk on building robots using Android and Arduino. This is a slightly modified version of the talk which I gave at Droidcon. I have added some additional information, especially about NFC and communicating Audio Jacket.

Continue reading »

Posted in Android/Java, Arduino, Events/Conferences | Tagged , , , , | 7 Comments

Introduction to Hardware hacking and Arduino

I just came from Ayana 2012 where I gave a talk about hardware hacking using Arduino.

About Ayana 2012

Ayana is a two day event conducted by PES IT. It starts with tech talks on the first day followed by 24 hour hackthon, similar to Yahoo Open hackdays.

Introduction to hardware hacking using Arduino

In my talk, I first talked about why a software hacker should look into hardware hacking. I then followed it by a brief introduction to Arduino, using the famous Blink program.

After that I was talking about different ways by which you can make Arduino talk to Internet and mobile phones like Android.

In the end I also gave out some hack ideas for the participants.

Continue reading »

Posted in Arduino, Events/Conferences | Tagged , , , | 4 Comments

Dart Hackthon

If you have noticed, the last couple of my posts are around Dart, the new programming language which allows you to create web applications. It is because, last weekend, the Bangalore GTUG group organized a one day hackthon on Dart and I was part of the judging panel for the event 🙂

I started playing around with Dart for a couple of weeks now and so far, I kind of like the language, even though there are couple of bugs and some major features missing. That’s understandable since the language is still a technical preview.

Continue reading »

Posted in Events/Conferences, JavaScript/jQuery | Tagged , , | 2 Comments