Hello!!! Wake up computer!!

Tags

, , , , , , ,

Recently, I was looking for some possibility on whether I can put my computer to sleep and wake it up when I want it to..

While doing so, found this URL: In short, you can put it to suspend or hibernate and wake it up after some time:

rtcwake -m disk -s 60

There are different options to make it to suspend/hibernate/standby… and can specify the time to wake up.. Refer “man rtcwake” for more.

Its cool when you want your computer to wake up before you and have everything setup when you look at your computer for the first time in the day :)

Samba – Allow writes but not modify/delete

Tags

, , , ,

Recently, I was configuring samba on my machine.. I wanted people to copy files to my machine but don’t want them to delete/modify the existing ones. Searched for a bit and found that adding:

create mode = 555

to the /etc/samba/smb.conf file and restarting the samba services makes the files to be created in read and execute mode. (Thus preventing anybody from modifying the files). So, others can copy files to my machine but will not be able to modify/delete them.

Formatting XML in GEdit

Tags

, , , , , ,

Have you ever got an XML that is in a messed up format and had a hard time in trying to figure out what is there? And felt that, what if there is a tool that you can use to format it…

If you are using GEdit as your editor, here is a solution for you:

  • Install python-lxml (Or look for lxml)
  • Create a new external tool configuration (Tools -> Manage External Tools…) and add a new command. Like : (Format XML)
  • This is the script you need to execute:

 #! /usr/bin/env python
 
import sys
import lxml.etree as etree
import traceback
 
result = ”
for line in sys.stdin:
  result += line
try:
  x = etree.fromstring(result)
  result = etree.tostring(x, pretty_print=True)
except:
  etype, evalue, etraceback = sys.exc_info()
  traceback.print_exception(etype, evalue, etraceback, file=sys.stderr)
print result

  • Set Input to Current document
  • Set Output to Replace current document

Once done, you will have a menu option under Tools -> External Tools -> Format XML. Once you click on it, you can enjoy understanding XML easily :) Obviously, being a software engineer, I reused the above given code from somewhere else :D

Unlocking levels in Candy Crush

Tags

, , , , , ,

How many of us are playing candy crush regularly? And, loose all the lives and have to wait for long time to regain all the lives?

Once we reach a certain level, to proceed to the next level, it asks us to play 3 quests and we can plan only one per day.. And as we are addicted, how can we wait for so long… huh??

Solution: This worked for me (Read from somewhere though)

1) In your mobile, close the candy crush app. (Not exit. Terminate the application)

2) Change the date/time on your mobile (Add 2:30 hrs to the current time if you ran out of lives and 1 day if you want to play the next quest. to unlock the next level.)

3) Start candy crush. Open the game. But, don’t start playing yet.

4) Exit candy crush. (As mentioned in step 1)

5) Revert your change to date/time on your mobile

6) Start enjoying candy crush.

If you didn’t exit candy crush app or change the time properly , you will be in a big trouble either to play candy crush or with the date/time on your mobile.. So follow the steps as mentioned.

Beware!! Candy crush is not a game. It is an ADDICTION :)

First week in the USA

Tags

, , ,

First week went fast… :)

The best thing was, (Believe Me!!), I didn’t have jet lag :)  I didn’t know how.  I started at night from my place.. On the first flight, slept well. Once I reached the place where I have the connecting flight, I roamed inside the airport for a while. Then came the flight to US. I didn’t sleep during that travel. Tried watching movies.. May be that was the reason for not having jet lag.. Reached USA that evening. One of my friend had prepared some good food for me.. Had it and slept. The next day, I was up and running :)

My observations so far.. People seem to be polite. They greet whenever they meet others. That is good. The roads are clean. People follow traffic rules strictly. I have heard honking in cars only when the car gets locked. Not on the roads. Being an Indian, Im missing honking :D One thing for sure is, Any Indian can drive in the USA.. But, I dont think any American can manage to drive in India :D Common India, lets do something about it :)

One more observations about the TV commercials: In the USA, I can find that the TV contains commercials for medicines, alcohols.. But, that is not that much in India. I like India in that perspective.

Another observation about the programs in TV: Around night, the programs seems to become a bit violent. Lots of horror stuff, killing stuff.. But that is not the case in India. Again, I like this in India.

Being Indian, Im used to do the conversions when I buy things. Hope I stop doing that soon :) (Yes.. Some things seems to be more expensive).

I’ll be staying here for a while.. So, I’ll try to write more :)

Alcoholism in movies

Tags

, ,

Drinking is not an Indian culture. I don’t say that nobody drinks.. But, people will have a guilty feeling when they do.

In olden movies, the actors will drink only when they are sad or bad (villains). If the good guy drinks, either he will die because of drinking or he will quit drinking.. That kind of made sense. But, nowadays, the hero or his friend drinks. Whether they are happy or sad doesn’t matter. As if it is part of daily life.. There are very very very very few movies that doesn’t have alcohol in it in the past 5-6 years.. This sends a wrong message to the next generation.

I read that, the government makes a lot of profit from wine shops. Somehow this makes me think whether the government is indirectly forcing the media industry to have atleast one scene where somebody drinks…

If the directors say that the story needs it, how did the (g)older movie directors made movies for ages without any drinking scenes.. Can anybody show/name me a movie where MGR had alcohol?? Didn’t those stories had the so called “situations”? If he wanted, do you think he couldn’t have included such scenes? Because, he wanted to send ONLY the RIGHT messages to people. And HE STOOD BY IT.

Don’t BS me saying that this is the culture now. Still, there are millions who are afraid to go home after taking drinks and don’t drink for that reason alone.

Showing “Drinking is injurious to health” at the beginning of the movie alone is not enough.. If you really mean it, why the *** do you need those scenes in your movies??

Film industry, Movies have a greater reach. It is a powerful media.. Do not misuse it and Please DO NOT SPOIL THE UPCOMING GENERATION.. By watching the movies, we can build an opinion about those olden days.. This is also like recording the culture in history.. DO NOT DEFAME OUR CULTURE…

Recursively list files (with space in their names)

Tags

, , , , , ,

Today, I had to do a long list of files inside a folder recursively. I tried using

find <folder> | xargs ls -l

This failed miserably when the folders/files inside the search location had space character in it. Searched for sometime and came across:

find <folder> -print0 | xargs -0 ls -l

Its kool..

-print0 prints null character as line delimiter and -0 (for xargs) takes null character as line delimiter and passes that input to ls.. Nice one :)

Security issue on linux??

Tags

, , , ,

Recently, I was playing around with creating users and groups on my machine and observed a weird behaviour.

Created a user first and made that user to be the owner of a folder.  And, deleted that user and created another user. Now, this new user became owner to the folder.

How could this happen?

I think the ownership is assigned to the User’s ID and not the name.

How is the ID determined?

It gets the highest ID of the existing users and adds one to it and assigns it to the new user. ie. Lets say I have users with IDs 1000, 1001 and when I delete the user with ID 1001, and create a new user, that user gets 1001 as ID. If 1000 is deleted instead of 1001, the new user will get an ID of 1002.

I tried this on Ubuntu and SuSE so far and observed this on both. I agree that the system admin has to take care of restricting access to users so that they will know what all folders the user has access to. So, when the user is deleted, the admin can take care of resetting/revoking permissions. But still, Im thinking, isn’t this is a serious security issue? Coz, this newly created user got rights to folder that was not intended. Shouldn’t the system itself should take care of allocating unique IDs to users??  Any thoughts from anybody?

Future of Software Developers

Recently, I attended a Java training. We have done all of the exercises in our college days itself. But, we used loooots of new stuff. We write abstractions over our code. They have some abstractions.. There are more abstractions over the previous ones.. For example: We have SQL/JDBC (Low level). We have hibernate and that is an abstraction over this. And JPA is another API that can provide an abstraction over hibernate..

On looking at things, I get a feeling that: After 5 years, there will be only two kinds of software developers. One who create abstractions, and the other, consumes abstractions. The consumer’s fate will be:

* After 5 years, No Java developer will know what is “new” operator

* After 5 years, Nobody will know how to write SQLs..

* After 5 years, Nobody will know how things actually work.. What happens behind the scenes…

* After 5 years, Companies will hire people with more memory power rather than their abilities.

And after 10 years, they’ll be just like some electricians who doesn’t know how things work. Only, knows how to assemble things.. If something goes wrong, the response will be, replace this with a working one…

After 20 years, people will not know what is going on.. how to debug issues.. why things are happening the way it is happening.. All these due to these levels of abstractions.. Finally, one fine day, they will say, Lets start writing our own SQLs and our own code…

Follow

Get every new post delivered to your Inbox.