Friday, November 12, 2010

Neglecting upgrade

As I neglected the blog, I neglected my OS upgrades, too. Most of my machines are running Fedora Core 12. Two versions behind. As long as kernel is up-to-date, I probably won't upgrade FC12. At least for a while. I realized that only thing I need is up-to-date version of gcc w/ libc, python(2/3), emacs.

Friday, August 6, 2010

Drupal menu disappeared.

I am not an expert of Drupal. Actually, I am new to Drupal. Somehow, someway, our team selected Drupal for our interactive method to collaborate with entire company. Make sense because we don't want to spend whole lot of time just for method. We want the result.

While I was enabling "Views" module in drupal, it acted up. Views did not show up. So, I disabled Views and tried to re-install. But, right after disabling Views, menu is screwed up. Like this.





I couldn't administer menu, modules, and theme any more! That is a disaster for admin user. I was so tempted to re-install drupal, but then, migrating old database to new one is another challenge. Old one was in dev, but we already collected some data. And, old site were configured too.
So, only option is "FIX". But, fixing a software that I never deal with was a quite discouraging moment. I prepared fresh install of drupal, and diff'd the files. Files looked similar. Then, all modification must be in the database.
So, I wrote a database diff tool.

Successfully, I found it is because menu_router table is corrupted. I restored.
Here is the sample code that I used:


#!/usr/bin/env python

import MySQLdb
import os
import sys

def main():
try:
cn1 = MySQLdb.connect(host="172.16.136.114", db="drupal_prod")
cn2 = MySQLdb.connect(host="172.16.136.114", db="drupal_dev")
except:
print >>sys.stderr, "ERROR: connection"
sys.exit(1)

while 1:
table = raw_input("Table name: ")
sql = "select count(*) from %s" % table

cur1 = cn1.cursor()
cur1.execute(sql)
cur2 = cn2.cursor()
cur2.execute(sql)

r1 = cur1.fetchone()
r2 = cur2.fetchone()
if r1[0] == r2[0] == 0:
print "SAME!"
continue

if r1[0] == r2[0]:
print "Same COUNT! "
else:
print "DIFF Found! "

inp = raw_input("specific sql? ")
if inp.strip() == '':
sql = "select * from %s" % table
else:
sql = inp
print "SQL used: %s; " % sql
cur1.execute(sql)
cur2.execute(sql)

try:
while 1:
r1 = cur1.fetchone()
r2 = cur2.fetchone()

if r1 is None and r2 is None:
break

if r1.__str__() != r2.__str__():
print "* ", r1, "\n", "# ", r2
except:
pass

print "Repeat- SQL Used:\n%s;" % sql


if __name__ == '__main__':
main()

Wednesday, May 5, 2010

PostgreSQL 9.0 beta released

Finally, they supported the first version of built-in replication. Very exciting feature.

http://www.postgresql.org/docs/9.0/static/high-availability.html

Tuesday, April 27, 2010

Begin to learn tcl

tcl is a very interesting language. I don't want to spend time to learn through it, but I need to learn to go through my work. It looks useful tool. However, although inefficient in python about what tcl does, I am producing code faster in python.

Friday, February 5, 2010

firefox only?

Before Firefox was popular, we saw many websites only for internet explorer. Many linux users complained IE only features such as (evil) active X technology. Yesterday, I ran into one of our internal tools using google chrome. Page did not redirect as it should. Firefox, however, worked smoothly. Because it is not in my domain, I just tolerated.
Later, I had conversation with the developer, and he said that it doesn't work with Internet Explorer either! That website only works with Firefox.

I am not good at web stuff. But, that sounds so funny. This time, no complaint from me. IE in the past was not cross platform, but Firefox is. Although chrome is my main, Firefox runs on my desktop. So, I'm okay.

Saturday, January 23, 2010

I love Fedora Core groupinstall

I just installed FC12 on my laptop. As usual, I used group install to set up my dev environment. This one shot command did save my keystrokes a lot. Just today, I feel so grateful to FC.

$ sudo yum groupinstall "Development Libraries" "Development Tools"

I love Fedora Core.