Timestamps arent necessary

Whenever we create models in rails, we get a migration where timestamps are added to it. I accepted it as a rle of thumb till a day I was required to wrap my classes around a database in which the tab;es dd not have time stamp fields created_at and updated_at

Well then I tried the following piece of code rails g model tweet content:text and modified its migration so that it looks as floows

Look at it, it has no timestamps in it. I ran the migration and tried this code on the rails console

And it worked, proving Timestamps aren’t necessary. But its better to have them

, ,

1 Comment

Parallel assignment in ruby

Saw this code posted by my friend. Thought it was worthy to tell many

Leave a comment

Free ad space if you donate to RVM

Hello People,

I am very much fond of rvm http://rvm.io/ . All the apps I have deployed runs on it. RVM needs funding so that it can be developed further. I want to hasten the process of funding.

I have written a ruby programming book named ‘I Love Ruby’ thats totally free, you can get it here http://goo.gl/FW6slH (this book will be released on jan 2014 or earlier)

If you donate $2000 to RVM I will grant full page advertisement, half page for $1000 and quarter page ad for $500. If you have donated these amounts you can contact me on mindaslab at gmail dot com so that I can put your ad in it.

The advertisement will stay till Jan 31 2014. It must be designed by you.

Please donate to RVM by going to https://www.bountysource.com/fundraisers/489-rvm-2-0

, , , ,

Leave a comment

This name calling thing

Well, I am a web developer for some long long time and web has changed a lot. A good change is Microsoft is almost out of web. No servers that are known to me run Windows and Internet explorer is dead for good (except few bloody large corporations). This blog is not about that it about another stuff.

There is this name calling thing in web technology which these marketing guys used / use to get more money from client. Long long ago we used a technique where the entire page need not get refreshed, but only part of it does. For this we need to write about 300 lines of code (which fortunately can be reused). Then people started calling it Ajax, and webpages having ajax costs a lot. Now Ajax can be written in 5 lines of code if you wish, thanks to jQuery and all other blah blah Javascript stuff.

Long before the term called “smart phones” was coined, we developers designed pages that can be seen even in mobile devices. This thing is now called responsive design and is promoted as a big thing. I really don’t understand what the fuss is about. When it was difficult to do, none promoted it, when it becomes easy, people give it a name and if they can do the most difficult stuff they project themselves as a big thing.

And there is another thing now called the cloud. Which essentially is cheating. Since we have a computer that have tetrabytes of memory, but memory on our handhelds is only gigabytes, but we are now in a age where tons of data can be streamed to us and we need real time stuff (thats the socio illusionary status society has created). If we have one data or update in one device we need that to be updated in another device too, this called for centralized server to sync things, and thats its. With virtualization we can have banks of computers say in USA, Europe, Australia and configure it in such a way that even if one fails other will take over. This thing too has been done for a long time. Now they call it the Cloud.

What the  &^#!@$$#@$#

, , , , , , , , ,

Leave a comment

Mozilla Persona must catch up

Mozilla Logo

Mozilla is one company that really respects the freedom of internet users. While its browser rival Google Chrome ttys to track users and recommend advertisements and search results that suits them, Mozilla’s firefox tries to respect ones privacy if one wishes to be so.

For long we have this single sin on, that is each website needs to authenticate  user, and it has to make user under go painful task of creating an login account. This process is eased by stuff like openId, Google, Facebook and Twitter’s sine  sign on process. But Google and Facebook track a lot of ones behavior since their business is based on advertisement revenues, which depend on these websites knowing what exactly the user wants, and hence tracking is inevitable and your privacy i compromised.

Mozilla is a non profit company that runs on ones donations and it has put up  a single sign on framework called persona https://developer.mozilla.org/en-US/docs/Mozilla/Persona . Persona does not track a person, compromise ones security  and possibly won’t collaborate with NSA.

So try using it in your website. Any gem for it anyone? It would be nice to to have a compact gem to us it in ones web applications. hopefully it catches up and leads.

, , , ,

Leave a comment

Very Simple Search for Active Records

Okay, you might encounter a need to put very simple search for active record / model in your Rails app and here is it. Put this code in your active record model:

Note this line

columns = [:name, :address, :city, :pin, :ph]

in the code snippet, give your own column names in that array.  This array can contain columns that are string and text type. Lets say you have put these stuff in a class called Person , to search it you need to issue a command like this

Person.search "Karthik chennai"

This stuff works well with Sqlite, Postgre and MySQL. If you have tried this out with other DB, please add it in comments. Bye.

, , ,

Leave a comment

Javascript File API

Javascript File API

Learn how to read and upload files the HTML 5 way

, , ,

Leave a comment

Follow

Get every new post delivered to your Inbox.

Join 1,825 other followers

%d bloggers like this: