/etc/sudoers file with your favorite editor or just use
visudo command, and then edit the line containing your username from something like
your_username ALL=(ALL) ALL
your_username ALL=NOPASSWD: ALL
That is it! Next time you use sudo, you should not be prompted for a password.Read more...
Sometimes it comes handy for an application developer to see which ports are being listened to in his/her machine. To me it came handy when my GWT hosted mode was crashing and leaving ports to be still listened by some processes, so other GWT hosted mode could not start complaining that port is still in use. So here it is:
sudo netstat --tcp --listening --programs --numeric
sudo netstat -tlpn
--numeric flag comes handy in order to not resolve host names and port number, and --programs flag makes netstat show which program exactly is listening to a given port and what PID does it have. Certain processes run in privileged mode, so this in order to see them you need to call this with
To do less typing, I made an alias for it, and put it into my
alias lports='sudo netstat --tcp --listening --programs --numeric'
mysqldump is a utility that allows us to dump mysql databases to sql files. While invoking it with default parameters, it dumps both table definitions and the content of the tables, thus data inside them. However sometime we do not with to have either of those, so here are few parameters you can pass to
mysqldump in order to tell it to not dump either table definitions, or data inside them:
mysqldump --no-create-info db_name < only_data.sql
mysqldump -t db_name < only_data.sql
The command above will dump only the content of database db_name to the file only_data.sql without table definitions. This is useful when we already have a table definitions somewhere, and we only want to insert data later. New table definitions may also include changes like additions to columns, which will not break the procedure of importing old data.
mysqldump --no-data db_name < only_data.sql or
mysqldump -d db_name < only_data.sql
The command above will dump only the table definitions, without data inside them.Read more...
MySQL has following data types for dates and times, with their short description as defined in mysql manual
DATE - contains an information about a date in YYYY-MM-DD format, ranging from 1000-01-01 to 9999-12-31
TIME - represents time of the day or elapsed time. It can be in HH:MM:SS or HHH:MM:SS format.
DATETIME - represents both date and time in YYYY-MM-DD HH:MM:SS format. It ranges from '1000-01-01 00:00:00' to '9999-12-31 23:59:59'.
TIMESTAMP - is same as DATETIME, but ranges from '1970-01-01 00:00:01' UTC to '2038-01-19 03:14:07' UTC
On contrary, Java library for MySQL has only following classes for these datatypes: java.sql.Date, java.sql.Time and java.sql.Timestamp, and as we can see from conversion table of Java connector, both DATETIME and TIMESTAMP types are converted to java.sql.Timestamp, so
java.sql.ResultSet interface has
I also noticed that if you try to retrieve or set year, month or day from
java.sql.Time, or hours and minute from
java.sql.Time, you will get an
IllegalArgumentException. Here are bits from Java source code:
Good use of OO concepts from Sun developers I think.
java.sql.Timestamp on contrary has all these methods legal, and has nanoseconds field defined in addition.
If you want to retrieve both date and time from
DATETIME data type, and it is not in the range of
java.sql.Timestamp, you will have to separately retrieve
java.sql.Date fields, and use them separately:
Searching through internet, I found many webpages pointing out the simple way of calculating an MD5 hash in a following way :
The problem with the following code is that sometimes (when hash starts with 0) it does not output the 32 character sequence, but omits leading zeros, which can be a problem in certain applications. As an example of such has, I found a string "tintiri" (without quotes).
Looking around a bit more, I found the following snippet which seems to work correct:Read more...
I will not go through set-up procedure of Blogger blog or Google Apps domain, because there is a lot of information about it around, and Help systems of both got plenty of resources. What I would like to go through it the procedure of linking your blog to a subdomain in your Google Apps administered domain. In order to accomplish our objective, we need make changes on both sides, so we will first configure Blogger, and then we will configure Google Apps.
After entering you blog from Blogger dashboard, click the "Settings" tab, and then "Publishing". There you can see a domain name you can enter for your blog. Enter your full domain name there, and optionally click the "Redirect YOURDOMAIN to blog YOURBLOG". For me the blog name was blog.asgarli.net and I did not choose asgarli.net to be directed to my blog, so I left the checkbox unchecked.
Configuring Google Apps
Log in into Google
https://www.google.com/a/YOUR_DOMAIN_NAME, and then go to Domain Settings menu from the menu bar above. Switch to Domain Names tab, in order to be able to log on into Godaddy's DNS console. Note that this procedure is different if you did not buy the domain name from Google itself, so this step may vary for you.
After following link "Advanced DNS Setting", we will get the necessary credentials and an address to be able to log in to DNS configuration panel. Then we follow the "Sign in to DNS console" link, and then use the credentials from previous page in order to log in. After a successful log in, we will get the list of domains we control.
Then we click on the domain name, we will get into control panel for that domain. From there we need to go into Total DNS control in order to be able to add a CNAME record.
After we click "Add CNAME Record", we write our alias name in "Enter an Alias Name" field ("blog" in my case) and
ghs.google.com in "Points to Host Name" field. We leave the default value of 1 hour to TTL.
That is it! It could be possible that it will take up to 24 hours for DNS record to be saved, and website to start working, but in practice it may take only minutes.
Here you can find additional info about DNS from Google: http://www.google.com/support/a/bin/answer.py?hl=en&answer=48090Read more...
I recently installed Ubuntu 9.10 an and as a Java developers had a necessity to install JVM and Eclipse on my system. I also have a need to run Google Web Toolkit (GWT) in hosted mode, so I need a 32 bit runtime, because there is no 64 bit version of GWT.
First step would be installing 32 bit JRE, which can be done via command
After that I had the problem that 64 bit Java applications, including 64 bit Eclipse did not run. By writing a small java program which would display system properties, I figured out that when 32 bit JRE is being installed, it is set as default JRE. After a bit of research I found a way to set default programs in Ubuntu, just like in Windows:
We need to set the default Java VM, so we will use command
After choosing 64 bit virtual machine by default, Eclipse successfully runs. Another way would be writing an eclipse launch script, if you want to have 32 bit JVM as default, but have Eclipse running 64 bit JVM. Script would be something like this:
You will need to change the path to Eclipse and then
chmod +x the script file, and after that you should be able to run it.
Note that process can also be done in reverse order, means if we want to run 32 bit version of Eclipse and want to have 64 bit VM by default.Read more...
subscribe via RSS