Rooturaj's Blog

The words of a Techie who loved Nature.

Archive for February, 2010

Happy Holi EveryOne

Posted by rooturaj On February - 26 - 2010

Wish You all a very happy HOLI, 2010.

May this festival fill your life with colors and sweetness.

holi-greetings

And yeah some tips for those who are going to office tomorrow. Watch out for those water balloons. One missed me by inches today and last year I escaped one big polypack aimed at me from a 4th floor balcony. I am in stealth mode this year. Play safe and dont use harmful colors if your are coming to my place for a color bash.

Sorry to be rude but you are not welcome inside my house and office space. All the coloring has to stay on the streets. I don’t want my furniture and computers colored.

Accessing PHP Cookies from different directories or domain path

Posted by rooturaj On February - 25 - 2010

It is pretty easy to work with cookies. They are really tasty. I am talking about PHP cookies and yeah we programmers can taste them. I will be highlighting some ‘not so common’ points about cookies today. Ready?? Lets Go.

What are Cookies?

These are little bits of information stored on your computer by a website. The specialty of these bits is that they can only be opened by the site that stores it in first place. So Google’s Cookies are invisible to Yahoo’s and same the other way round. Cookies can be set for a particular time span and deleted by the site that created it. The user can also clear cookies whenever he wants to from his browser or manually from the personal folders of his system.

Now we know that Cookies are store houses for secure information that we webmasters use to dish out customized content to our visitors. They are widely used for storing user login information and shopping cart contents so that even if the user closes the browser and comes back the site allows access and restores his shopping cart. We could even use it to store your theme choice for sites or to tell you when you visited last time.

How to set a cookie Using PHP?

Its pretty easy. Use this  code.

<?php 

// set a cookie named 'pingu' with a value of 'Penguin'
setcookie('pingu', 'Penguin');

?>

Recalling and using the set Cookie

We use the super global variable $_COOKIE  to  call the stored value of cookie the same way we do with $_GET and $_POST.

<?php 

// We  will  use ‘pingu’ cookie  in a sentence.
echo "Pingu is a ".$_COOKIE['pingu']."."; 

?>

Output: Pingu is a Penguin

Setting  a  time span for your cookie.

For security purposes we need to set some cookie expiry time. Some sites even ask the user how long to store his cookie. Others have a default expiry period. After this time your cookies is dead and you need to log in again to use the site. (or any other similar functionality)

<?php
$time = 7*24*3600 + time() ; //no of secs to store the cookie

// set a cookie named 'pingu' with a value of 'Penguin' for  2  days
setcookie('pingu', 'Penguin', $time);

?>

Accessing a Cookies from a different directory of domain.

Now when using the previous methods to set cookie will restrict the access to the directory where it was originally set. Eg. If you set the cookie on file domain.com/user/setcookie.php you cannot retrieve the cookie  on domain.com/member/getcookie.php. To get around this we need to set an accecibility parameter as well. See below.

<?php

// set a cookie named 'pingu' with a value of 'Penguin' for 2 days  through out the domain.
setcookie('pingu', 'Penguin', $time, “/”);

?>

Now you cookie can be called from any part of the domain.  But it’s a not much recommended. Similarly you can specify particular directories/folders to access the cookie. Like “/user/” or “/member/” instead of “/”.

Overall Syntax format – setcookie (‘[string]’,’[string]’,[integer],’string’);

Oasis troops statistics | three kingdoms MMORPG game

Posted by rooturaj On February - 16 - 2010

I have been engrossed with this online browser based game for some time now.  Actually it is taking up a huge part of my time but its an addiction I cant get over soon. LOL.

Till then if you are one like me and would like to conquer one of  those oasis next to you then you would  find this troop strength statistics very useful. They are not like those travian oasis defenders. These are lot harder to beat. The attack and defense parameters are shocking.

Take a look at this graphical chart of nature troops in oasis. This should help you calculate how large an army you would need to clear the oasis. Notice the 5th column. When you see a particular unit in your oasis you need N times troops than those of the kind. Col 5 gives you that  N value.

src : forum.koramgame.com

src : forum.koramgame.com

I have been an expert at oasis raiding in Travian. But this is a lot more difficult in The Three Kingdoms. This game is a chine version of  travian and ebony rolled into one. Pretty kool  I feel except for the Chinese names. They all sound so similar that I loose track of who is who and what is where in the factions.

How to conquer an Oasis in Three Kingdom?

You need these following things to qualify as an oasis conqueror.
1.  At least one Hero
2. Career Center at level 10
3. A target oasis within your 7×7 squares area.
So using the chart above calculate how many troops will be needed to clear the oasis successfully. I recommend at least 1:3 troops ratio for a successful raid. Where your troops are a mixed force of infantry, cavalry and archers.

Once you have the troops ready plunder the oasis with along with your hero. Messengers wont work. Once the defenders are cleared the oasis will fall into your hands. In case you are attacking an oasis already owned by another player then you will need to attack with hero in Destroy mode.

Using Google Buzz | Features Explained

Posted by rooturaj On February - 11 - 2010

Hey Friends,

You would have noticed the new feature on your Gmail page. Yeah the Buzz. Mostly when if you are signing in for the first time after buzz was rolled out then you would see a welcome screen prompting you to activate and use Buzz.

Now that you are there you might ask what exactly is this Buzz about. Wasn’t Wave enough? Well wave was a whole new world where you could share and work in a collaborative environment. You could share and work on documents, applications updates and much more. This one is a simpler thing much like our Twitter and Facebook status updates.

Buzzing on your Gmail

Buzzing on your Gmail

You have followers and you can follow people like you do in Twitter. To find more people to follow you may use the follow more people option. Feel free to use the search profiles option to find people or use the contacts options to follow people who are already in your Gmail contacts. Very simple and lightning fast.

find and connect to more people

find and connect to more people

Once you have followed some people you can see the updates like the following. It is in a similar fashion as we see in Facebook. Checkout the red box for some really kool options. Comment and like as we normally have on Facebook. Google tops it up with their email this feature. Plus you may chat with the original poster right from the update regarding the update. Nice eh?

Interacting with the updates

Interacting with the updates

Now notice the green box. These are cascaded updated from the same person. To see more of what a person has been doing lately click the cascaded area. E.g doing clicking the same area on my updates will give you an expanded update list exclusively by me.

Expanding collapsed Buzzes

Expanding collapsed Buzzes

I will put in some more stuff once I fill myself up (lunch time). Damn those cooks in downstairs restaurants. The smell is invading our workplace and aggravating our hunger.

5 reasons why you should not be using Yahoo Small Business

Posted by rooturaj On February - 8 - 2010

Is any one looking for a bullshit/horseshit domain hosting service? Consider Yahoo domain or smallbusiness.yahoo.com.

While listing the 5 reasons why you should not be using Yahoo Small Business I am highlighting some of their shitty business logic as well.

1. Total Confusion: My invoice is raised. I process the payment. The registration for a particular domain is renewed for two years. For some god damned reason the invoice payment fails. I am a Yahoo user with the domain registered with yahoo mail id but yahoo prefers to send the notifications to the alternate email id. Wow.

2. Failed Technology: They cancel my account. My domain keeps working even though the payment fails.  Their mails go to an account that I am not checking. I plan to change my hosting and when I look around where is the domain I don’t find it any more. I look up WHOIS and find my account registered with melbourneIT. What the hell is going on and who are these people. I look up the domain on their site and the say “could be a reseller”. I call them and I am shocked to find that Yahoo is their reseller. At least they are pretty smart and professional people and help me out with even Yahoo customer care number for domains.

3. Shitty Customer Care: I call up Yahoo and their shitty system says I have to wait for 20 mins. Imagine calling on ISD and being asked to hold for 20 mins. 3-4 calls like this and my one year Domain registration fee is wasted on customer care.  (Thanks to the IP phones we have got here) Finally after getting the account validated after two calls (20 – 24 mins of hold each) I pay and get the account reactivated.

4. Shitty Commitment: My initial requirement was to rename the name servers. After validation they put my domain on pending status saying it might take upto 72 hours for the DNS change. After 4 complete days I am still waiting for the pending status to lift. I don’t know how many days more I will have to wait after I change the NS to my desired location.

5: Shitty Pricing: First year they charge $10 for .com domains. Next year you are supposed to pay $35. Can any one tell me why? I can dare to call myself a techie and I am pissed up with this shit. I wonder what common have to face. Other top domain registration companies like GoDaddy etc charge around the $10 for every renewal.

This review is a totally personal opinion of mine. It is not motivated by any individual or company. I just wish to share my bad experience with the aforementioned company. I know many of you might disagree with me. Feel free to comment.

This post is to address an every day issue that you face when working with spread sheets (MS Excel – OpenOffice Spreadsheets etc). We normally cannot print spreadsheets with a background. I mean when you print the document it does not show the background graphic.

When confronted with this problem I googled it up. (Sorry can’t help. it’s a habit) Now Microsoft, as we all know, are charming people who love it when you have trouble using their product. They said “This issue occurs because background graphics cannot be printed in Excel.” How smart and what a useful answer. Guess what they even ask “Did this information solve your problem?” I felt like kicking that bloke who wrote this in the ‘you know which’ place.

Ok enough.. Now here is the solution.

Setting a background for your Microsoft Excel Spreadsheet

backgorund-excel

I hope the screen-shot would suffice. All you need to do is go to the main menu. Then Choose Format >> Sheet >> Background.

Browse the image file and select it.

The back ground will get tiled all over the work area. There is no overriding this I guess. So choose a proper sized graphic to fit your printable area.
Tip: Use white space around the image (photoshop or other graphic tool) to fit it wherever you want on the printable area. See this example.

Seriously I do

Seriously I do

Now if you want to print the same you would never get the background. Try and check the print preview.

So How to Print the Spreadsheet along with the Background?

Save the file as webpage. (.html or .htm)

Then open the file in your browser and print as you like. Remember to do the print set up properly. On my Firefox I do this.

print-setup

Hope that helped.

VIDEO

TAG CLOUD

Sponsors