Tuesday, February 7, 2012

Upgrading and downgrading your rubygems

http://www.docgecko.com/rails/rubygems/sunspot/2011/04/10/upgrading-and-downgrading-your-rubygems.html

Upgraded to rubygems version 1.8.1, which generates a large number of depreciation errors. This is not a major problem as all still continues to work fine, expect for a couple of my gems: the sunspot (1.2.1) and sunspot_rails (1.2.1) gem. Currently, under gem 1.8.1, I was unable to start or reindex solr.

As such, for now I decided to revert back to version 1.7.2 of rubygems. In order to downgrade your rubygems version, you have to do the following:

gem uninstall rubygems-update -v 1.8.1 gem install rubygems-update -v 1.7.2 update_rubygems _1.7.2_

And, going the other way, if you wish to update to the latest version, simply run:

gem update --system

Tuesday, December 13, 2011

ubunut failed to boot - Grub2 recordfail FAIL

http://jwalanta.blogspot.com/2011/05/grub2-recordfail-fail.html

I have this headless, keyboardless server running on Ubuntu 10.04. Runs fine, but once in a while while there's power cut off the server still remains dead when the power is back. I connected monitor and keyboard and found that the problem is with Grub2.

Turns out there's a variable named recordfail which is set to 1 during next boot whenever there's some problem with the computer (like due to power failure).

Now if you see /boot/grub/grub.cfg file, it has the following lines:

if [ ${recordfail} = 1 ]; then
set timeout=-1
else
set timeout=10
fi
Which means, the timeout counter is disabled whenever the recordfail variable is set. This is nice for desktop environment, which has a monitor, so I can see the Grub countdown is disabled so I can proceed with Repair option if I have to, but for headless servers the computer just sits idle at Grub screen, puzzling the poor sysadmin.

Fix? I changed the timeout=-1 to timeout=10.

Sunday, December 11, 2011

Installing ubuntu 11.04 server via USBstick

The installer halts at "[!!] Detect and mount CD-ROM" - "Your installation CD-ROM couldn't be mounted. Try again to mount the CD-ROM? (Yes/No)"

1. When you get the error, Alt-F2 to a second console.
2. Find out which device your USB stick is (tail -n 100 /var/log/syslog)
3. Then mount it to /cdrom (mount -t vfat /dev/sd[abcd] /cdrom
4. Alt-F1 to get back to the install console, and try detecting again

***Make the startup USB disk writable when create it, it will be no such error after restart

Wednesday, June 29, 2011

How To Fix MySQL Error ‘Could not parse relay log event entry’

How To Fix MySQL Error ‘Could not parse relay log event entry’

1. STOP SLAVE

2. SHOW SLAVE STATUS

3. Note down ‘Relay_Master_Log_File’ and ‘Exec_Master_Log_Pos’ entries.

{
4. RESET SLAVE //Connection information stored in the master.info file is immediately reset using any values specified in the corresponding startup options. This information includes values such as master host, master port, master user, and master password

5. CHANGE MASTER TO ….. (use MASTER_LOG_FILE=relay_master_log_file and MASTER_LOG_POS=exec_master_log_pos from Step 3)
}
OR // without reset ??
{
CHANGE MASTER TO master_log_file=”mysql-bin.000020″, master_log_pos=5382560;
}

6. START SLAVE

Tuesday, May 31, 2011

How to post blackberry OTA files on your website!

When posting files on your website for OTA downloads, you will need to either modify the .htaccess file (for Linux servers) or MIME Types (for Windows servers.)

Linux & modifying the .htaccess file:
Place the following information into a notepad file named ".htaccess"

AddType text/vnd.sun.j2me.app-descriptor jad
AddType application/java-archive jar
AddType application/vnd.rim.cod cod


Windows & adding MIME Types:
Add the following information to the MIME Types on your host site

Extension: jad
MIME type: text/vnd.sun.j2me.app-descriptor

Extension: cod
MIME type: application/vnd.rim.cod

http://forums.crackberry.com/f3/how-post-ota-files-your-website-177967/

Wednesday, May 25, 2011

Mac sleep mode and freeze issue

From http://forums.macrumors.com/showthread.php?t=290091

I had the same freezing problems after closing the lid and going to sleep mode in my maxed up MacBook Pro (17" 2.93GHz Intel Core 2 Duo, 8GB 1067 MHz DDR3 RAM, 250GB OCZ Vertex SSD). Very annoying! Nonetheless, after googling a lot, I apparently solved this proble by changing the sleeping mode modality from "3" (default in the newest machines) to "0" (older modality).

Here is a more detailed explanation:

After you launch Terminal, the first step is to determine which sleep mode your Mac is currently using (in case you wish to go back to it). You can both view and change the sleep mode using the Unix program pmset. To see your current settings, type pmset -g | grep hibernatemode. You should see something like this:

pmset -g | grep hibernatemode hibernatemode 3

Great, so your machine is using mode 3, whatever that might be. Well, thanks to the documentation for the handy Deep Sleep Dashboard widget, which puts your machine immediately into hibernation mode (so you don’t have to yank all the power sources to invoke it), we can tell exactly which mode is which:

0 - Old style sleep mode, with RAM powered on while sleeping, safe sleep disabled, and super-fast wake.
1 - Hibernation mode, with RAM contents written to disk, system totally shut down while “sleeping,” and slower wake up, due to reading the contents of RAM off the hard drive.
3 - The default mode on machines introduced since about fall 2005. RAM is powered on while sleeping, but RAM contents are also written to disk before sleeping. In the event of total power loss, the system enters hibernation mode automatically.

To change your sleep mode, you use pmset again, providing the variable and value you wish to assign. So to return to the old style sleep mode (which is mode 0 from the above list), enter this command:

sudo pmset -a hibernatemode 0

Press Return, and you’ll be asked for your password. Provide it, and your sleep mode has been changed. Note that restarting is not required for these changes to take effect.

Recover some drive space
If your machine was previously set to mode 3 (or 7 ) and you’ve reverted to the old style sleep mode, you’ve got one more step to take: recover the drive space used up by the copy of your system’s RAM, which was created the last time you slept the machine prior to making the switch. In Terminal, enter these two commands, pressing Return after each and providing your password when asked (in my case it didn't ask for my password again after changing the sleep mode)

cd /var/vm
sudo rm sleepimage

In my case it released almost 8GB of disc space. I guess it will closely amount the amount of RAM your system has. Ironically, by trying to make a "super system" by paying $2,000 for 8GB RAM plus the SSD drive, it might have been to much RAM to copy and recover to the SSD every time the system goes to sleep and wakes up...as they say "the best is sometimes enemy of the good".

Good luck!

JR Mora

Tuesday, April 19, 2011

Ajax long connect using server heart beat to check client connect if it is closed

Using a trick HTTP response header

HTTP/1.1 200 OK
Server: xxx
Beat: Waiting.................................... // trick
Connection:Close
Content-length:255
Content-type:text/xml
Date:Wed Apr 20 12:01:17 EST 2011
Expires:Sun, 24 Apr 1981 01:29:32 GMT