This Month Video: The marshmallow Challenge

lool interesting observations about team building and project management..
…or simply about spaghetti and marshmallow :D

Marshmallow Challenge

..

Read More

sql Tip 3: getting DB schema in MYSQL

long time since my last post here, well i was bit busy , hopefully i will not stop bloging for long times again.

for this blog the title actually shouldn’t be SQL tip 3 , it should be MYSQL tip 3, since it is talking about something specific to MYSQL, but since i had two (very old) posts about sql tips SQL tip1 SQL tip2 ,well they were geniral but were demonistrated in MYSQL too.

back to the topic. i needed to know how to get the database schema for a MYSQL DB in one of my projects and knowing the how was not stright forward so thats why i think it will be good and usefull tip.

A very usefull information in this topic is that information on database tables is stored in a system table called “information_schema.tables “.However a better information is writting the query “select * FROM information_schema.tables ” will get you some of the tables that you never had created (system tables) + your tables. to exclude system tables you have to add a where condition

select * FROM information_schema.tables where version=’10′ this will show only the tables you have created. version is not related to the version of your MYSQL, but older versions of MYSQL you have to write “select * FROM information_schema.tables where version=’9′“.Another simpller way you can know the table information without taking care of table version is to query based on the database name “select * FROM information_schema.tables where table_schema =’DB_Name’

ok we have the table information but still we will need column information of these tables. These information could be extracted from another system table called information_schema.`COLUMNS`

a very simple query could give the most important information of your table’s columns is
SELECT column_name,data_type,column_key FROM information_schema.`COLUMNS` WHERE table_schema=’DB_Name‘ and table_name = ‘your_table_name’;

hope this very simple tip will be helpful to the readers as an extra knowledge or for those who come to this page searching through google hope this information will aid you

Read More

How-to get a job (for graduates)?

In this (my first post) non-IT (sorry Ali) post I note what I think is the main things I used to get my IT job. I was actually surprise with the number of job opportunities I come across here in Oman. So, here it is…

Since I have graduated I have been doing interviews all over the place (9 until today): ministries, government agencies, government companies, to-be companies, dream-to-be companies, actual companies ..ext..ext .. For me it was interesting journey. Each interview (or test) was unique experience: a mix of meeting new people, testing my skills and Learning about myself! It is great opportunity to find what you are really after (if u haven’t decided yet). So what is it really employers are looking for? Well, first let us list the facts about them:

  • They are humans with basic needs just like us. They need to feel love, security, excitement and joy! They want to be acknowledged and appreciated.

Dose any of this have anything to do with get them to hire me? Aren’t they looking for skills?

Explanation: This crab has nothing to do with neither you nor your skills. It is about them and their needs. They need to like you and be able to work with you.

  • They need assurances that you will do the job.

! I have the bachelor degree aint that enough?

Explanation: We all have the degree, so what? What information they can get from it other than you spent X # of years in the Y collage. What really determine your capabilities is the projects you did, activities you involved in and the way you represent those!

  • The presentation(interview) is important.

! I have skills; I have experience they should take me. But i was sick that day.

Explanation: they wouldn’t care if you ware sick that day! May be you are a nice guy but they actually don’t know that! It is very important to be in your optimal condition and do a flawless interview. That’s because employer have limited time and many candidates to choose from.

Hmmm,, ok that all I can remember right now. So, how to be ready for all this? How to drive them to give you interview anyway?!

  • The Perfect CV.

Having very well written CV is a key element in job hunting process. CV is direct marketing tool for your skills and character. It contains everything that maters to employers: basic info about you, skills, experience and glimpse of your character. Make sure your CV contain skills match job requirements and contain the keywords employer is looking for. Writing a universally ‘perfect’ CV is impossible so, you have to adapt it for each job opportunity. (Change the structure and the words used for example.)

  • Calling everyone!

Make sure that you: call employers for more information about jobs, do follow-up calls. Make sure that almost everyone you know (colleagues, friends, family, employers) knows that you in “job-hunt”. Sometimes opportunities come from unexpected people/organizations. For this, you have to keep in touch with everyone!

  • Keep your eyes open!

Make sure that you watch for newspapers, job-search sites and major companies sites for new opportunities. For obvious reasons!

  • Know what is going on!

Knowing what is going on around you is important. Make sure you know about major market events (even non IT) and new IT projects. Of course, you need to know what is going on in the IT field: new products, technologies and upcoming events. This can assist you to anticipate opportunities and be ready for them (by acquiring skills for example). Also, it improves your standing in interviews.

That’s all I can think of for now. So what do you think? :)

Read More

SQLTip1: search database faster without like

SQL tip 2, SQL tip 3
well all of us need to deal with databases and sql query and most of the time we need to provide searching abilities to users.

well the easiest way is using like i.e to search articles containing the word “database” this query is goo enough “Select title from articles where body like ‘%database%’”.

but what if we have the articles table so huge and contains lots of rows and each row has a huge article !!!!, well simply the database work will be slowed down and will effect the work of other functions of the applications.

if this is the situation indexing the body column of the table and searching the index would be much faster (( well yeah i know this is a basic knowledge for database experts but most of the developers dont use it that why i am mentioning it))

so lets see how this is done in MYSQL:

to create the index you have to do this

ALTER TABLE articles ADD FULLTEXT(body);

then while searching the query will be something like

“select title , MATCH (body) AGAINST (‘database’) as rank from articles ORDER BY rank desc;”

this will return some thing like
|title | rank |
—————–
|sqltip | 1.3 |
| eclipse| 0 |
|.NET | 0 |
____________

where rank is 0 where it didnt found the searching keyword
and it is bigger where-ever it finds the searching keyword more (more relivent)

so to get only the good results the query will be

“select title from articles where MATCH (body) AGAINST (‘database’) > 0 ;”

Read More