Archive for the ‘Education’ Category

Tutorial: How to store UTF8 (indian language) data in mysql?

Well, let me put it straight this tutorial also applies to any other native languages like latin, spanish etc. But, since I have tried for Indian languages I am writing exclusive for it.

Okay, so before we say code I must tell you this tutorial intends, a thought provoking stuff :)

Lately, we have seen enough number of Indic-translators, and you must have got your hands on with typing in ur mail/blog. Now, just think for a while, when u sent a mail, and try to read it back from “Sent Mail”, u still see the indian language or even in that case blog articles. For that case, even in Orkut.

How are they stored inside database? Was what I was trying.

Again, I am not sure for any other DB, I have tried with MySQL. But, I guess should be same.

Quick Explanation:

We assume we have a DB with table articles, and a column named posts, which will save the article written in your blog. Best part, we know that all major DB’s support UTF8. And we shall explore that feature.

Now we write a article in hindi, हेल्लो वर्ल्ड

If the UTF8 is not specified, you should see something like ?????? in ur DB else u shud see the hindi data. Clear? Koool lets see the code

Quick Code:

First check for UTF8 compatibility with this query. If it supports you should see the output as “Character_set_system”| “UTF8″

SHOW VARIABLES LIKE ‘character_set_system’;

Now that being checked, alter the table and just modify the column, Posts in our above example and specify it as UTF8

ALTER TABLE articles MODIFY Posts VARCHAR(20) CHARACTER SET UTF8;

Now, try to insert the hindi value and save it. Query it and u shud see the hindi text :)

We have go ahead and use many other options as well, like Collate etc. But this tutorial intends to keep it simple.

I hope you find this useful and interesting. If you have tried any hacks similar to this, pls drop in comments and share with us.

Cheerz
Sridhar

If you are reading article, you might also be interested in the PHP and Scriptaculous Book I have authored.

The book gives you insights about effects, drag-n-drop, slideshows, applications, auto-completion, in-place editing and more. Complete code snippets and explanations.

CHECK out and BUY the PHP and Script.aculo.us book at Packt official site

PHP and Script.aculo.us Book

PHP and Script.aculo.us Book

http://www.packtpub.com/php-and-script-aculo-us-web-2-0-application-interface/book

How to learn Programming????

Most of the time, I hear people saying I am NOT good at programming but at “XYZ”, yes this is completely okay, but if you have some inclination towards learning programming or be a good programmer, here are few simple tips, I follow them so I thought I would share with you pals.

1. Join some Developer Network.

With lot of developer network platforms, half-of the work of the developer is already done and distributed in the form of “Packages”.

Im hooked to Yahoo Developer Network, for many reasons. One, it supports all the languages be it .Net, Java, PHP, Python etc etc.

More reasons for using any Developer Network, I can feel are

1. Cross Browser compatibility, one doesnt have to worry about the small issues of browsers

2. Loads of tutorials, code and examples

3. Forums and discussion boards

You can even learn a lot by looking at the code, examples and tutorials.

Some of the developer networks available are

1. Yahoo Developer Network

2. Google Code

3. Facebook Developer Network

4. Script.aculo.us Network

If you have used or know of any other developer network, drop in comments.

Cheerz

Web Design Tip #3: Epicentric Design!!!

I admit its been sometime I have been out of blogging. Almost a week. I was out coz of some hectic deadlines, personal work and above all I didnt try anything new last week. But I am back!!!

Epicentric Design is a must to read and follow for all the web designers. It is not a new technology or something, but a simple way to make great applications.

Let me just start by giving a simple example.

Consider this blog you are reading. What do u feel is the most important feature?

Yes, you are right. The article.  And then follows the sidebar features, footers and headers.

What does that mean?

It means for this particular page, the epicenter is “the article”. Just that article. Forget rest all.

Now, when you get to really start designing or building an application, consider only the epicenter. Most of the web apps I come across fail to do so, which leads in lot of messy stuff on page and creates confusion.

Rediff.com, I dont have any personal problem with them, but yes when u see the home page, what do u feel? U feel its for Logging in? or Shaadi.com Ads? or wht?

Now, simillarly consider the login page, Its functionality is to implement login system, no need for junk there. Best examples Yahoo Mail, Gmail. Their foucs is only on “Login” rest all are not focussed.

So what should be the best possible approach to build the app?

1. Sketch the raw UI, this is imp as we get an idea of what it shud look like.

2. Figure out the Epicenter for the page. Stick to it.

3.  Design a simple html page before coding. It is a MUST, afterwards it may be of no use but it adds to a clear picture of what it should like and contain.

4. Code it. If u fail to do the above 3 steps, chances are you will loose an eye from epicenter.

A personal note from my side, DONT start coding first. It is a serious time waste. If u cant have a design or layout or epicenter dont proceed to coding.

Which methods do u follow to build your app? Do share with us.

Cheerz
Sridhar

PS: extract from 37signals

If you are reading article, you might also be interested in the PHP and Scriptaculous Book I have authored.

The book gives you insights about effects, drag-n-drop, slideshows, applications, auto-completion, in-place editing and more. Complete code snippets and explanations.

CHECK out and BUY the PHP and Script.aculo.us book {My Book} at Packt official site
http://www.packtpub.com/php-and-script-aculo-us-web-2-0-application-interface/book

Web Design Tips #2: Alternate Row Colors in Resultset!!!!

Web Design Tips #2: Alternate Row Colors

In my recent post of Web design tip, I have shown how to use Yellow Fade Technique. If you have missed it. Read it Here.

Okay, What is alternate row coloring?

Imagine you have a set of records in database, you fetched them and just “echoed” them as a bulk in form of table. How appealing right?

So we solve this problem. I know, I understand not everyone just echo’s the result directly. But then, how you show is, what your user sees!!!

Now, imagine this, we fetch the rows from database and then while placing them, we modify them in a way it looks more clear, decent and ofcourse appealing as well.

How do we do it then?

Simple. let us suppose we have got 17 rows as result of some fetch operation. Now using a while loop{for can also work}, use n/2 formula and get the even and odd results.

For every even result set we use a specific color, and for odd result set we use different color. This helps in making it in a readable and appealing form.

Wasnt it simple? Most of us, programmers make this mistake of choosing wrong colors for display { red/blue, yaak }, which is often called as Programmers Design!!!! No wonder why they call it :D

Accept the fact that design is not programmers cup of taste!!!!

Anyways, I am working on some script for my project, so soon I will post the result and code of this as well.

If you know/happen to work, or anything related to Design techniques, pls feel free to contact me, and you can be our guest author.

Cheerz
Sridhar 

If you are reading article, you might also be interested in the PHP and Scriptaculous Book I have authored.

The book gives you insights about effects, drag-n-drop, slideshows, applications, auto-completion, in-place editing and more. Complete code snippets and explanations.

CHECK out and BUY the PHP and Script.aculo.us book {My Book} at Packt official site
http://www.packtpub.com/php-and-script-aculo-us-web-2-0-application-interface/book

Getting Real : Book from 37signals

37signls needs no introduction.

Yes, the same guys from Basecamp, Campfire, Highrise, backpack, ta-da list!!!! Never heard of these? Okay, Heard of Ruby On Rails framework? Yes, the same guys.

I must tell you, they are awesome.

“Undo your competition”. They focus a lot on design, technology and only essential features and dropping everything else.

If one wants to develop and deploy a successful web application, this book “Getting Real” is a must to read and follow.

Every aspect of project is covered, technology, hiring, users, customers.

Nothing great or something, but I would say these are essentails which we all must have come across but we fail to implement them.

Go ahead. Did I tell u that its free? Read on….

Cheerz
Sridhar

Myers Briggs Personality Type: Whts ur Type???

Heard of Myers Briggs Personality Type? If not, dont panic, even I heard and came to know about it today morning after Winslie’s mail.

I was surprised that such tests can really help you understand your self better and so does others can also.

It deals with ones psychological ability to think. Everyone has there own unique way to think and approach but when your planning for team work, everyones Personality Type comes into picture.

I also felt that, these TYPEs can also change with age, work, environment and other factors. Its about how you see things in different conditions and situtations. Though some people may resist this change.

I must admit that in India, this practice is yet to mature. Yes, some companies take Psychological tests but then it’s about the same meaning in different contexts.

My Personality type : ESTJ

You can read more about it Here. You can even take a free Personality Test.

www.personalitypathways.com/type_inventory.html

 Check your type and drop in comments.

Cheerz
Sridhar

For Open Source Lovers!!!!

I must admit, I love Open Source products and applications. I first got introduced to it during my days in Indictrans.

Since then I have always prefered Open Source!!!

Yes, now you will argue that my compaq notebook is running MSFT XP???? Now, everyone has their own stand, so my way to look at it is, something which does not cost you, can modify, distribute even build commercial apps on it.

If one loves Open Source, that does not mean you “MUST” hate MSFT products!!!!

Anyways, its a debateable topic, and we dont want to get into that.

Okay, so I write this post to introduce you, http://openproducts.blogspot.com

Yes, Its a new blog :D , dedicated to Open Source products. Most of the time, people get confused at what to use/ Is there any better alternative?

Thats not problem with users, coz everyday so many products are getting released and proposed. You cant keep track of everything. But, yes we shall try to keep in our blog.

What will this blog have?

1. Product Features
2. Applications Features
3. Plug-Ins
4. Categories
5. Scripts
And Lots more

Why the heck again Blog?? Anyhow, Web is full of Open Source.

It sure is full of open source, in this blog, I will try to organize things I come across and write about them as I use.

If you happen to work on Open Source products/plug-ins/apps drop me a line. Will put it up with full credits.

Cheerz
Sridhar

Technology Threats???

Have you even imagined that the benefits we are taking of Technology even the terrorist can take?

Imagine how dangerous it can be?

Cyber police says, it can trace the emails sent, scan them and then identify the anti-social elements.

Anti-Social #1[Place 1]: Writes the message in the email/blog and saves it without sending.

Anti-Social #2[Place 2]: Opens with same userID and Password, reads the same saved message and logs Off. 

What can the police do in such a situation?

This sure may sound, simple but trust me it can prove very costly and deadly as well.

Any thoughts??? views??? suggestions???

Cheerz
Sridhar

Embedding of PDF inside HTML using frames

Some days back, I wrote a article regarding which PDF library to choose and work with, either PDFLib or FPDF. I decided to go with FPDF, since its free :D

So now, what is the problem that almost everyone of us have faced using PDF documents?

Think again. No, not that one. Take another shot. Okay, let me tell you.

When we open up PDF file, it opens in “Full-Mode”, that means, we cannnot see the html links, page etc and it just ocupies whole web page. Now, this is a serious issue. Since, the only way is to hit the “Back” button.

What can be done to make this experience better?

Embed the PDF document inside a html frame. Consider the pdf file as a widget and we can load it inside the frames of html.

If you are wondering, if I am speaking arabic or something. Have a look at this.

http://www.jewishpress.com/TESTPDF1.CFM

But, there are serious flaws in implementing this way. Coz you cannot navigate through the pages in the PDF. I am trying to hack and fix the issues.

If you have tried anything similar to this. Please drop a comment.

Cheerz
Sridhar

PS: Please spare the commercial/licenses one. Yes, I am aware of Macromedia Flash Paper. But something free is more tasty :)

If you are reading article, you might also be interested in the PHP and Scriptaculous Book I have authored.

The book gives you insights about effects, drag-n-drop, slideshows, applications, auto-completion, in-place editing and more. Complete code snippets and explanations.

CHECK out and BUY the PHP and Script.aculo.us book at Packt official site

PHP and Script.aculo.us Book

PHP and Script.aculo.us Book

http://www.packtpub.com/php-and-script-aculo-us-web-2-0-application-interface/book

Book Review : AJAX In Action

 Ajax    

I have recently finished reading this book “Ajax In Action” By Dave Crane, Eric Pascarello and Darren James.

I thought I would share some key points from the book with everyone.

I recommend this book to everyone, who wants to learn Ajax or for those who have already fallen in love with it :)

The book talks about the basics as introduction and example code are given to explain various ajax libraries covered, which includes Prototype, Rico, Dojo, Sajax etc.

It is also written keeping in mind only about the client-side programs and not heavily on server-side, which helps individuals to use it with any of these PHP/Asp/JSP etc.

This 680 pages book is what you need to master the concepts and start using ajax in your web apps.

Cumon, u still waiting for more reviews??? Go and buy here

Its a weekend, I have some plans too.

Happy Weekend!!!!
Cheerz
Sridhar

PodWorks : My Experience!!!!

Podworks, India’s biggest podcasting unconference was held on 9th-10th June 2007 in Tidel Park, Chennai.

I must admit, it was a great learning experience for me as I was a newbie to Audio/video podcasting. Got to meet people, share ideas and fun as well.

I started on Friday 8th june in Shatabdi Express, along with Himanshu, Vibhash, Anil, Yousuf and Alok. Reached around 10pm to Chennai, Damn it was fcuking hot there. After finding them a nice hotel to stay, I went to IIT-Madras.

I met friends there, Jitendra, Venu, Sagar and prem. Then we spent around 3 hrs just gossiping around with jitendra and venu. {they are my close buddies}

Next morning, I got geared to attend Podworks. Day one.

When I reached I saw other folks have already reached, and kiruba was making an opening speech, basics of podcasting, professional podcasters etc.

Then some topics came out on which people were willing to learn. I along with Himanshu, Vibhash took a topic “Basics of Blogging for WordPress & Blogger”. It was mainly about how to add widgets to blogs.

Guess, it was good and informative. If not, mind-blowing, atleast svenks got benefitted out of it, as he learnt to make a blog and how to add widgets :)

Then was time for some “Vitamin M”. A talk by Sunil Nair, CEO of Nautanki.tv on how to make money!!!! Hmmmmmm

Followed by talk by Karthik Kannan about how to create a Audio Podcast. It was very useful, as I did some hands-on as well :)

Then, time for lunch, their did some networking with folks from findnearyou.com, Mr.Krishna Prasad of Churumuri.com, Preethi, Mr.Suresh Bhagavatula, Vijay Anand, Syed  and a lot of other interesting people.

Noon, session went with some more talks and finally in the evening we went to Beach House. Mr.Seshadrinathan of findnearyou.com arranged a Band, named “Hang-over”, trust me they were awesome!!!

I even made a small instant theme their for podworks.

Check the video here

Then after that, kept talking with John and Venkatesh. Some real serious talks. Went to beach near by. Slept at 6am :(

Next morning, got quickly ready and then left to Tidel Park. Had breakfast first :)

Attented some talks, met some people and same stuff. Did some photo-sessions too.

In the evening, I came back to IIT, then me, venu and jitu went to a near-by hotel. Had nice dinner, then both of them came to drop me.{I insisted not to, who listens to me}

Then, got a volvo to Bangalore and next morning when eyes opened, I was back to my Den.

It was my second unconference and like previous one, this too was good in terms of learning and making new friends.

Cheerz
Sridhar

Web tutorials *Yawn Yawn*: Webonic

Do u also Yawn thinking of tutorials available on web? Be it Php, Mysql, CSS etc, Its all same stuff, again and again in new fonts!!!!

Its time for some real new useful stuff and not same yawning.

I have started a new blog, which I call it as my technology playground.

Its important to write code, and Its even more important to build some useful code and share it with community.

Since, this blog is more personal. I will write and collect all the tutorials which I will be working/learning for buliding my own web product.

http://webonic.blogspot.com/

Webonic will contain tutorials, code, demos related to PHP, MySQL, AJAX & CSS. Its not user-generated/collected, all will be stuff I am working on. You are free to add if you want to.

Happy Hacking
Sridhar

Bloggers, Come Let’s Fight Cyber Crime!!!!

Is Internet safe for girls???

A guy and a gal meets on cyberspace, they become friends, write testimonials, talk on phone, then they meet and finally the Girl Is Found Dead.  

Its not the first time in India, that such kind of accident has happened, but the question that everyone would ask is when will it be the last one???

I read in last week’s Times of India Sunday Edition, that a guy from Hyd was caught as he took some personal information from a girl from mysore and started blackmailing her or else he will post the information across porn sites. Girls need to be more careful[1]

What can we do to restirct net crimes [2]??? Is Internet a crime zone medium? 

Read one such story and please spread awarness among your peers to make Net a better place to live.

http://www.indianexpress.com/story/31150.html

Its shame to see such things as it hampers the wanna-be Web-Entrepreneurs.

Imagine you start a web service/product and things like these happen, and one-fine day Govt says close all these sites or even worst if parents restrict children to come to Internet.

huh? Any comments??

Cheerz
Sridhar

PS: 1] A personal advice to all the girls out there on Net, please dont share any personal information on web to strangers. Remove all the phone numbers, photos, videos, address etc from your profile. You can have a Net identity, fake name!!!!

2] If you happen to have a blog, write about it, dicuss such matters, spread the word of awarness. If you cant, atleast ping back this post.

How-To create Rounded Corners using RICO Library!!!

How-To create Rounded Corners using RICO Library!!!

In my previous two posts I have covered some tutorials using Script.aculo.us to enhance the User Experience. But, Script.aculo.us doesnt have the beauty of adding Rounded Corners, which RICO is rich in!!!!

1. Making a simple SlideShow using Script.aculo.us
2. How to Use Script.aculo.us Effects to add beauty

In this tutorial, we will explore yet another AJAX library. RICO Library

RICO is a powerful, creative ajax library which gives you control over UI designing as well as functionality.

In this tutorial, we will see how to create Rounded Edge Corners.
I assume these steps are already done before you see the naked code.

1. You have downloaded RICO library. If not, you can do it here
2. You have downloaded the Prototype Library. If not, you can do it here
3. Enable javascript in your system.

OKay, so lets see the code:

Include all the files{Rico & Prototype} inside the html code.

<head>
<script type=”text/javascript” src=”../src/rico.js” mce_src=”../src/rico.js”>  {SRC should be ur rico.js path}
<script type=”text/javascript” src=”../src/prototype.js” mce_src=”../src/prototype.js”>  {SRC should be ur prototype.js path}
</head>

so once, we are done with including the libraries to your html file.

Now, time to add some content to the Body of the html file.

<body>
<div id=”roundMe” style=”position:absolute;top:240px;left:35px;width:250px;background:’lightblue’;color:’red’;”>
<div id=”Content” style=”height:200px;width:250px;padding:8px;”>

Hello This is me, a Rounded Corner hell.

</div>
</div>
</body>

Understanding this particular code is very important, from the compatibility point of view. Coz if you skip some of the style parameters, this code wont work properly in IE.

U know IE sucks!!! {Keep an eye on Padding, it stinks in IE}

Okay, so no big deal here in code. Just two DIV tags and inside the child DIV the content is placed.

Simple, Isnt it? kooool. Lets go and add a simple line and see the magic.

Now, that we have decided the structure and included the libraries, what are we waiting for? Oh, yeah we still need to call the functions of RICO.

<script type=”text/javascript”>
Rico.Corner.round(’roundMe’);  // The parameter is the id of the outer DIV tag
</script>

What else? Not much. Just save it and see the magic.

If you still want to keep on hacking other options, you are always welcome!!!

Just add these parameters to the same line.

Rico.Corner.round(’roundMe’,{color:’transparent’,compact:true,blend:true;});

What all other options one can add to Corners?

1. Color
2. Blend
3. Compact
4. Color
5. BgColor
6. Specify which corners to be rounded
7. border.

For more information. Visit Demos @officially site of RICO.

Yes, some folks out there can argue that we can do it with CSS also. I agree with you. But can you do it in just one line of code?

Sorry dude!!!

Anyways I have attached a simple code for the same at the bottom if you can want. Take it, use it, try it and please let me know as well, if I missed any.

Cheerz
Sridhar

Download COde: ROunded Corner Using RICO Library

If you are reading article, you might also be interested in the PHP and Scriptaculous Book I have authored.

The book gives you insights about effects, drag-n-drop, slideshows, applications, auto-completion, in-place editing and more. Complete code snippets and explanations.

CHECK out and BUY the PHP and Script.aculo.us book at Packt official site

mybook

http://www.packtpub.com/php-and-script-aculo-us-web-2-0-application-interface/book

Why do I blog?

Why do I blog?

Most of the blogs I surf, are mostly about How-To blog or “Earn through your Blog” or more or less same pitch!!!!

Blogs have become a prominent way of expressing self/marketing etc. We can see millions of blogs around us in the virtual universe called “Web”.

Himanshu: Blogging Breeds Entrepreneurship, has a good write up on the same lines, which says Blogging gives you a Entrepreneurial edge!!!

Now, coming back to my question, I blog because whatever I am trying/doing/re-searching etc I find it very easy to write down for later purpose or even better if someone is also looking/working on the same lines can find the tips/tutorials useful.

I mostly write about AJAX{my love} and some tutorials on CSS, MySQL & PHP.

A simple example, I would like to give you how this works for me and others.

Try to google, “script.aculo.us based slideshow”.

What you find as first link is my tutorial “Script.aculo.us based Slideshow”. I wrote this particular piece of code, coz I was frustated of not finding the same. Now, if someone else is also looking for the same, just feel free to use it. Why to re-invent the wheel?

And, lastly I write whatever I am trying to build, which is getting added to my application. In this way, I am keeping track of building my own product/features as well helping others.

My two cents in helping web community and making web more fun place to live & learn.

Now, your turn: Why do you blog? tell everyone through comments.

Cheerz
Sridhar

Next Page »