Types supported by Rails Active Record

I’m always looking for those somewhere on web when I need them. Now I’m posting them here so I will always have them handy. If you need them then you can use this as a reference. Below is a list of supported types with its MySQL representation.

  • :primary_key – int(11) DEFAULT NULL auto_increment PRIMARY KEY
  • :stringvarchar(255)
  • :text – text
  • :integer – int limit 4
  • :float – float
  • :decimal – decimal
  • :datetime – datetime
  • :timestamp – datetime
  • :time – time
  • :date – date
  • :binary – blob
  • :boolean – tinyint(1)

It can also be found in this constant in ActiveRecord ConnectionAdapters MysqlAdapter

ActiveRecord::ConnectionAdapters::MysqlAdapter.NATIVE_DATABASE_TYPES

I think that all the other type mappings could be found in appropriate ActiveRecord Connection adapters.

Cheers, Gregster

WordPress page load time tweaks ended in … failure

Why was I trying to speed it up on a first place. Well, some of you might be aware of the fact that me and my Family moved to Sydney. We will be here until May. My blog and my hosting is in UK. Broadband in Oz is far below random average back in UK. I was never bothered to check my own blog for response time as it was always good. Trying to load my blog main page I was shocked waiting for few minutes for it to appear on a screen.

The beginning and general enthusiasm

What I did is a little analysis on a page with Firefox and YSlow. It turned out that a lot of time takes for JavaScript files to load. About 8 files that are not too big but for some bizarre reason takes ages. YSlow suggested to combine them into one file and compress.

That’s fine. Sounds like a plan. Grab all the JS files combine them into one and then compress. Turned out more complicated than one would think.

There was no JavaScript that comes with bare WordPress to compress and combine with other files. The JavaScript that I got on my blog was the one from additional plugins I have installed.

After a quick googling I found out that there is a WordPress plugin for JavaScript compression. It is called WP_JS. It works quite sweet, whenever you got a JS file and you need to add it to your post all you do you put this line:

<script src="<?php wp_js('path/to/js/file.js'); ?>"type="text/javascript"></script>

The problem with this one is that it will only work for a files from within your current theme folder.

JS files I would like to compress into one file are those inside plugins. Seems like WP JS doesn’t have access to that. Oh well, first hack then. Copy all the files to one folder that would be accessible to JavaScript compression plugin.

imageWhen I finished I had to go trough all the plugins and comment out the JavaScript imports. Finished with this task I moved to getting all the JS files in a header as one compressed file. So in other hands all the plugin JavaScripts would be compressed and loaded in one file.

When I done that it turned out that there are JavaScript errors on a page. Some plugins are spitting more to a HTML then just a JavaScript imports and they depend on a stuff inside those imports. In other words, one big mess. Impossible to decouple and extract as one file.

Good idea

It would be absolutely awesome if I could apply some sort of a filter for a HTML content before it is being spit out to a browser, grab all the JS imports, create one big JS on a flight, compress it and then send to a browser.

With a knowledge I got about WordPress it seems impossible at the moment.

Failure and what I ended up with

So I ended with disabling plugins. There is only few enabled with very little JavaScript.

Last final solution is to redo the plugins so the JavaScript they are using will be suitable for a single file compression.

I don’t have time for that, so … no plugins instead 🙂

Take care, Gregster

Ps. I’m not going to try to achieve anything similar with CSS :-

Difficult art of software design

image When I’m drawing a picture or just taking it with digital camera all I think is how good the picture will look like, how to compose it. If people I show it to will like it or not. When I design software it is a little bit different. It’s even more difficult when client needs something for his special purpose, customized etc. and also would like it to be flexible enough to resell it as a product.

When I take the approach of sticking to all the special needs that client has towards the product it could make it to complicated to customize for anyone else, even impossible to do so. If I take the road of making everything so flexible to accommodate everything client needs and also being ready to resell in a future, design could go crazy and I’m not event saying how long could development take (as I don’t know, but it would be much more then simple way).

So, compromise, meet somewhere in the middle. But how? Design flexible but don’t go crazy. Get ready for a lots of changes and client conversations. Communications is absolutely must have. Iterative development, testing and customer feedback. Don’t come up with 1000 pages design in front. Create some prototype and show it to the client.

If you are religious, pray, if you are not, learn how to be more patient. If this still doesn’t work for you and you end up being stressed like never before, make a career adjustment and switch to work in a library 🙂

Greg

How Google can help you kick start your project

greg If you are starting a project or a business and you don’t have too much money, this could be a good read for you 🙂

We are starting a new project. We have created a team of few guys. Each of us is  located in different city/country/continent. As with many projects and with kick starts not having to much money means that we can’t really rent an office where anyone can come to or spend a lot on cool software.

The obvious decision is to do all the stuff remotely. We still need software for knowledge sharing, meetings, etc. Skype can help us with conferences calls. What about email, calendar, documents and so on.

The obvious answer was, go for some free open source tools. But, for email, calendar, wiki, etc. we will need to host it somewhere. It also needs to be globally accessible and reliable. Seems like Google has some answers to all of that 🙂

 

image 

GMail

Possibly the best web based mail in the world. Quick and with huge storage. I don’t think I would have to delete my emails ever 🙂 It also has Google search integrated. I don’t have to organize it to much, I can always search for what I’m looking for. It also comes with integrated chat.

Google Talk

Integrated with GMail or works as a standalone client. Quick and simple chat, great for office communication.

Google Documents

This is absolutely awesome idea. Create, view and share documents with whoever you would like to. It reads and creates MS Office Word documents, Excel Spreadsheets and Power Point presentations. You can also view Adobe PDF files. There is also a facility to organize them in folders.

Google Calendar

Organize meetings, put dates of all the important events, etc. and then share them with all your fellows team mates. Calendar sends a reminders to your GMail account.

Google Sites

WIKI like service. You can define and invite its administrators and contributors. It integrates with Calendar so you can put some events on it. It integrates with other Google services like Images and YouTube videos.

Google Code

Useful for Software projects but only available with one of the Open Source licence.

Other stuff

There are also other services potentially useful for the start. Blogger, Reader, Maps, Groups, Picasa, Translate.

All the services might be useful for sharing and searching through a huge amount of information that Internet contains.

So, we are starting something. Not having to much money but having Internet access we can use Google. Its there and it always will. Reliable, simple and fun to use. Go ahead and give it a try if you haven’t yet 😉

Greg

Multiple versions of IE on Windows

image Being dev makes me fixing bugs that I have introduced while writing the code. Because current project is web app it is obviously tested in multiple browsers (CSS and JavaScript). It is also tested in the worst browser (according to my humble opinion) ever created in history of a human kind by Microsoft itself, Internet Explorer 6.

Working on updated version of Windows XP means that your IE version is updated to at least version 7. A huge chunk of the world is still using IE 6. Question then: How do you get IE 6 after upgrading to IE 7. Or even better, how do you get both of them? I couldn’t believe answer is that simple 🙂

http://tredosoft.com/Multiple_IE

Nice little installer that installs all the versions of IE on your or your fiends Windows. All the versions down to IE 3.

Have fun with your development and testing.

Gregster

Sketch it Up

I was always a big fun of 3D. I never liked 3d studio or AutoCad. It was too much. To complex and simply not worth spending time learning to use it just for fun. So I never got to grips with any 3D creation software.

… and I would live my life in this state if not for (yet another) 3d tool. This time it is from Google (starts good). It’s called Sketch Up and it’s free. After few minutes I was amazed.

As you might imagine main feature of this product is its simplicity. It is as simple as drawing a rectangle, grabbing its surface and then dragging it for 10cm to create 3D figure. Fantastic. Add different shapes, intersections, transformations, ruler and few other tools and your able to draw yourself a nice model. I tried to draw ground floor of my house and it wasn’t too complex.

As Google use to do you got a nice comprehensive video tutorial that even people with huge learning disabilities could follow.

Anyway, try it yourself if you like to Sketch things up 🙂

Cheerios, Greg

Napoleon of technical leaders

There is no I or Me in a team. There is only the team. But team needs a leader. It’s a well known fact, human psychology, we need leaders. It is something we might not admit to or not even know about it. We will look up at a guide or a inspiration that will lead our work, correct our mistakes or give advice.

Sometimes team leaders are developing during the process of team formatting (beginning of the team) as a natural process, sometimes they are being assigned to do the job.

Us developers need a technical lead, someone who will guide us while we are doing our job. After few years of IT experience, I can say that I have worked with few good and few bad team leaders.

What makes a good team/technical leader then? Whatever makes a good leader plus strong technical capabilities.
Good Listener
Good listening skills.
It means that you will be listened and your opinion will be taken seriously. I have worked on few occasions with people who just couldn’t listen to any proposition and everything had to be done their way. It ended up usually in waste of time and slide in project delivery. I do have to admit that some of them took all the blame and did extra hours to work out the problem.

Extreme Flexibility

Flexibility and openness.
This one is a brother to good listening skills. I have worked with a tech lead whose openness and flexibility lead to many great technical discussion with entire team and brilliant ideas.

Decision MakerAbility to make a decisions in difficult moments and change any decision if necessary.
As much as flexible and opened team leader can be, she/he always needs to make a decisions when it’s necessary. All the discussion we had as a team about technical and non technical issues on a project will never end if someone did not put his feet down at some point.

Point out mistakes and appreciate good job in person.
When talking to a bigger forum or entire team should not discuss individual success or mistakes. Taping someone in a back in front of the entire team will only tell others that they have not worked hard enough to deserve it. Same with criticising anyone, will make everybody else on a team feel better then the one poor geek that got earfuls. All that destroys team spirit and integrity.Motivator

Be good motivator.
People need motivation. I do. If there is no other driver in the team at least team leader should inspire and motivate.

VisionHave vision and approach things with passion.
Passion works like a motivation sling. It gives extra boost to entire team if there is at least one person that is so passionate about the tasks that team is facing. I’m damn convinced that at least team lead should be that person.

Presence and appearance.

Technical skills.
Last on this list but equally important. I was working with team leaders that were making bad decisions because they lacked technical skills. They were also to proud to listen to the team and take suggestions on a board. It ended in a massive disaster.

I’m sure this is not the complete set. It contains some of the important factors I could think of and I’m looking for in a leaders. You are more then welcome to complete this set in comments.

The list is not in any specific order. I believe all the points are very important and you can’t have great team leader without all the skills. I am also aware that in real life this will be far away from true. Even great leaders in the world history had their flaws. After all we’re all humans 🙂

Cheers, Greg

My own, personal OS rant

This is not another “Linux is better then Windows” posts. It is just a history of few wasted hours of my life.

I got two operating systems on my laptop. Ubuntu Gutsy and Windows XP. As a choice I use Ubunty everyday for my usual email reading, internet browsing and my home development projects in either Ruby or Java. I switch to Windows if I do .Net.

Windows vs Ubuntu

About a week ago I got my usual Ubuntu system updates. This time they came with new release of Linux kernel.  When I restarted my PC, the X server didn’t come back to life. All I got was console. Not to useful when you need to do all the usuals.

As I wasn’t to keen on fixing it, looking in log files and reading Google results for I switched to Windows. After few minutes of working on Windows I was prompted to restart my system by Automatic Windows updates. When it came back my Wireless said NO. It was working for few minutes then stopped. I whacked in wired connection, downloaded latest drivers restarted and …. even worse.  No wireless at all. So, one laptop, two operating systems and no use at all.

I’ve done all possible stuff to bring back my Wireless on Windows. Tried new drivers, old drivers and even tried to dance at the midnight but no use. I guess that Microsoft decided that I don’t need to use a gift of wire free Internet connection and cut me off.

If there’s one thing that I can’t stand is not properly working network. Linux has never failed on that, Got back to Ubuntu. Downloaded NVidia drivers. I went through process of installation and … I’m back in business.

Now, why did I have to go through all that pain. Because I have a PC that is made up of all different parts and none of the operating system can support all of that out of the box. The only solution is to get MAC 🙂

All I need to do now is find some money as those guys are not cheap 🙂

Cheerios, Gregos

PicLens, new web experiance

I don’t like to install to much plugins in my Firefox for some reasons. But there is one plugin that absolutely blow me away. Plugin is called PicLens, and it enables entire new media experience within a web browser.

It enables 3D browsing experience of rich media content like pictures, videos and audio files.

I have enabled my blog to work with it. You can check it out by installing plugin yourself or by looking at the pictures I post in here 🙂

piclens2

piclens1

piclens3

piclens4

Imagine this without any additional plugins in your web browser. That would be very tasty 🙂 Thanks for the link Cleve 🙂

Cheers, Greg

Real hours of development work

How many hours of real development work do we do during the week?

So, we claim to work 40 hour week. I will put some average time that we spend on project activities and other personal things wee do so we can estimate how much time we loose.

Each working day has 8 hours of work. During this 8 hours we spend an hour on lunch that I’m not including in here. Then:

  • Iteration planning meeting: 1 hour
  • Morning stand-up: 5 times 10 minutes (average)
  • Dev huddle: 5 times 5 minutes
  • Story signup: depends on number of stories but let’s give it 20 minutes in entire week.

If we say we have meetings or discussions with clients on requirements etc. spending 30 minutes on it during whole week is optimistic average.

Continue reading “Real hours of development work”