February 09, 2010
February 08, 2010
Running the ‘ history ‘ command only gives you line numbers. Sometimes it’s useful to have a time stamp attached to each command to build a clearer picture.
Simply set the ” HISTTIMEFORMAT ” env variable to enable time stamps in ‘ history ‘.
Run the command below.
export HISTTIMEFORMAT=' %F %T '
Before:

After:

- Running previous commands in Linux
- Linux Tip #8: grep with color
- Linux Tip #4: Simple sort with the sort command
- Bash Completion on CentOS 5
- Bash and command line keyboard shortcuts
Step 1: Login as admin and install MCRYPT
yum install mcrypt
Step 2: Install epel
http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm
rpm -Uvh epel-release*.rpm
Step 3: Install the module
yum install php-mcrypt.i386
Step 4: Restart Apache
service httpd restart
Confirmation of the installed module can be found from the phpinfo() page. The module I had included cipher for
cast-128
gost
rijndael-128
twofish
arcfour
cast-256
loki97
rijndael-192
saferplus
wake
blowfish-compat
des
rijndael-256
serpent
xtea
blowfish
enigma
rc2
tripledes
February 07, 2010
Had a very good sleep (the meds the doctor prescribed me knocked me out for a good 12 hours, twice). Fever is gone, headache’s gone. I woke up fresh and relaxed. Thanks Dr., I like your clinic btw.
In the light of recent event, I admit that I’ve wronged my housemates. For that there’s nothing I can say except I’m sorry. For the curious, sorry dear friends, I’d like to keep this to myself please. I have been selfish and inconsiderate, that I only realized recently. I will keep my self invisible as much as possible around the house for the time being. That’s the only thing that I can think of at the moment that I can do to say I’m sorry.
Let me tell you about my housemates. I’ve never blogged about them, haven’t I? Not once. Well I’ve been staying with them for 2 years now. Kak Yatie messaged me on the phone on the availability of the room. I quickly came over to have a look at the house. Physically she’s tall, fair skinned, and she always has smiles on her face whenever she’s talking to me. She’s a neat and organized person, and such a gentle human being. The way she rearranges stuff in the fridge always made me smile. She come across as a very quiet person at first but after a while, I found out that heyyy… she’s quite a talker. Sometimes, I overheard her talking on the phone in her northern accents, just remineds me of home. There’s a high chance she’s good with the kids too since I often saw she brought her nieces over for a visit. Siti came and joined us right after I settled in. As opposed to Kak Yatie, Siti has a strong character. Fair skinned and is of chinese descendant, she’s one emotional person, and opiniated one at that too. She cracks jokes most of the time, sometimes even without her realizing it. She’s honest and she can be the light of a party. Both of them like to have a good laugh, make fun of tv shows, share the same interests. That’s how I’d describe them. We’re not that close but yes they are good people.
Anyway, while I’m sad at the way things have happened, I can’t help myself getting upset too. You know when people get angry and the say all this hurtful things to you? It is bound to happen no matter what and in my case there’s no exception. That’s why I prefer a more calmer, diplomatic way of approaching issues. I know that if I break out I’ll say all those things I’ll regret later. People are going to get hurt.
As wrong as I may be to you, it doesn’t give you the right to judge me, who I am or who I am going to be. More importantly, it certainly doesn’t give you the right to insult my friends. You have no idea to what length these people has gone for me. Insulting them is like insulting me.
A private person that I am, I only share minor details randomly with people. Somehow, people manage to connect the dots. While it may be true, it also may be wrong. When it’s wrong it hurts.
Did I deserve to be yelled and shouted at? Yes, because I made a mistake. Talking bad about my friends? No.
I understand all is said while in anger, but I’m a human nevertheless. After all is done, I only believe in a more calmer approach to all of world problems. It may not solve the problem, but it won’t create new ones unnecessarily.
I have been thinking to sit with them and talk this through. But I’m having second thought. After weighing the options, maybe not.
I recently asked on Twitter:
For a college/university student, would you get ‘em a laptop or a netbook? Need opinions ASAP. Thanks!
The Twitterverse was quick to respond. Thank you all for responding! A little summary:
- @sniffit suggested that netbooks are underpowered, but might change with Linux being on them.
- @redsheep went for a laptop, unless I planned on being a mean uncle that didn’t want them to play games/do graphics/etc. Why, I can’t be a mean uncle ;-)
- @spinzer said go with a laptop because students have diverse working nature, and a netbook wouldn’t cut it.
- Both @alphaque and @brianritchie suggested to watch for the coursework: Computer Science, Graphics, Statistics deserve a laptop, otherwise, go for a netbook.
- @saimatkong suggested a 12″ notebook, but those tend to be quite expensive, to the best of my knowledge.
- @sureshdr, @tjunkie, @thechannelc, @liewcf, @bleongcw, @r0kawa all suggested a laptop would be better. In fact, @liewcf suggested a MacBook.
- @jerng brought up a good point: it should depend on the preferences of the user as speed tends to be a secondary issue.
- @biatch0r was the only one that outright said go for a netbook, lugging around a 10KG laptop is so 20th century :) I tend to agree.
So a bit from where I’m coming from, which I didn’t say in the original tweet. This laptop/netbook is for a complete stranger, whom I’ve never met. We do however, know her father. His daughter had just been accepted into a university somewhere up north in Malaysia, and she clearly needs a laptop/netbook for her coursework.
Anyway, all that aside, and with much thanks to the Twitterverse, I set out to pick up a machine quickly (think, 0.5hr). I had to be near MidValley for another reason, so hopped in. Checked out the Asus, and Acer stores, and found laptops and netbooks to exist, and you’d average around RM2,100 or so. Dell had a laptop for RM1,999, but it was a 14″ clunker, and it seemed really heavy. This seemed to be the large problem with a laptop: they came with everything (including a DVD-RW drive), but would come with a 13″ or 14″ screen – and they were all mighty heavy. Acer seemed to offer OS-less laptops, but I didn’t want to spend more time than need be, so wanted an operating system.
| I went over to the HP store, my last stop, thinking in my head, I’d pick up the Dell. But I was taken aback when I saw the HP Mini 311. The specifications were amazing: 1.66GHz N280 Atom processor, 2GB RAM, 250GB hard disk, an external 8x DVD-RW drive (!), 11.6″ screen boasting a resolution of 1366×768, 10/100 Ethernet, 802.11b/g WLAN, 92% full-size keyboard (with great tactile feedback – I spent a lot of time in the store trying it). But that’s not all, it comes with 3 USB ports, HDMI output (why?), VGA output (and no need for any silly cable like their previous items), a multimedia card slot (for SD’s, etc.) and a built-in webcam. |
The exact model is the HP Mini 311-1002TU. It seems like its an edition only available in Asia, and it comes with Windows 7 Starter Edition. Did I mention that it cost a mere RM1,799?
More goodness about it. It doesn’t come with an Intel graphics chipset, but an nVidia ION. Video performance is pretty darned good, in comparison to what Intel doles out, even on the netbook that I own (an Asus 1000HE). In my quick experiments, I was getting a good 5 hours of battery life running Windows 7.
First thing I did was install: Mozilla Firefox (and set it to be the default web browser), avast! anti-virus (to protect the PC), and OpenOffice.org with the JRE. It comes with a 60 day trial version of Microsoft Office, but who needs that when OpenOffice.org is free and should suffice. The system is quite snappy, and while the guy at the store told me that Windows 7 Starter Edition will not allow me to run more than 3 applications at a time, it works fine for me. In fact, the only thing that seems annoying is that you can’t change the desktop background – Microsoft is intentionally crippling their software for netbooks. From what I understand, a dual monitor setup will not work either (useful to have an external monitor on a netbook), but I did not try this.
I can confirm that Ubuntu works pretty well on this machine – I tested it when I got home, using the LiveCD and it seemed to “just work”. More information available at the laptop testing team HP Mini 311 on the Ubuntu wiki. A forum post to help with suspend/resume magic.
In conclusion, I didn’t get a laptop, but a netbook. But a netbook with an amazing screen size, a resolution that exceeds my expectations, a good graphics card, and an external DVD writer. Windows 7 Starter does not come with Aero, and I wrote a little README file informing the new owner that it might be better to just install Linux and she’ll be better for it at the end of her three year university course :-)
Related posts:
Recently, I'm interested to look deeper into the i915 driver to understand how some of the mode setting code works, as explained in the good Intel® 965 Express Chipset Family and Intel® G35 Express Chipset Graphics Controller PRM Programmer’s Reference Manual (PRM) Volume 3: Display Registers
in www.intellinuxgraphics.org.
I start my journey with linux/drivers/gpu/drm/i915/intel_display.c.
First of all, I see:
linux/drivers/gpu/drm/i915/intel_display.c:
static const struct drm_crtc_helper_funcs intel_helper_funcs = {
.dpms = intel_crtc_dpms,
.mode_fixup = intel_crtc_mode_fixup,
.mode_set = intel_crtc_mode_set,
.mode_set_base = intel_pipe_set_base,
.prepare = intel_crtc_prepare,
.commit = intel_crtc_commit,
.load_lut = intel_crtc_load_lut,
};
At a first glance, intel_crtc_mode_set() looks like a promising place to look for mode setting code. However, since it is register as a hook of drm_crtc_helper_funcs, I presume some high level code must be calling it. To understand more about the calling sequence, I decided to look for the caller first.
linux/drivers/gpu/drm/drm_crtc_helper.c:
bool drm_crtc_helper_set_mode(...)
{
...
crtc_funcs->prepare(crtc);
/* Set up the DPLL and any encoders state that needs to adjust or depend
* on the DPLL.
*/
ret = !crtc_funcs->mode_set(crtc, mode, adjusted_mode, x, y, old_fb);
...
}
So, it is apparent that the caller will perform some preparation with intel_crtc_prepare() before calling intel_crtc_mode_set().
Some of the mode switching sequence is actually documented in the PRM's section 2.2.2 Mode Switch Programming Sequences.
When we look at intel_crtc_prepare(), looks like it is using some DPMS related code to turn of the display before setting the mode.
linux/drivers/gpu/drm/i915/intel_display.c:
static void intel_crtc_prepare (struct drm_crtc *crtc)
{
struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private;
crtc_funcs->dpms(crtc, DRM_MODE_DPMS_OFF);
}
But crtc_funcs->dpms() is actually intel_crtc_dpms().
So,
linux/drivers/gpu/drm/i915/intel_display.c:
static void intel_crtc_dpms(struct drm_crtc *crtc, int mode)
{
...
struct drm_i915_private *dev_priv = dev->dev_private;
...
dev_priv->display.dpms(crtc, mode);
...
}
where...
linux/drivers/gpu/drm/i915/i915_drv.h:
typedef struct drm_i915_private {
...
/* Display functions */
struct drm_i915_display_funcs display;
...
} drm_i915_private_t;
Note that this hook is initialized in:
linux/drivers/gpu/drm/i915/intel_display.c:
static void intel_init_display(struct drm_device *dev)
{
...
/* We always want a DPMS function */
if (IS_IRONLAKE(dev))
dev_priv->display.dpms = ironlake_crtc_dpms;
else
dev_priv->display.dpms = i9xx_crtc_dpms;
...
}
So, in other words, intel_crtc_dpms() indirectly calls either ironlake_crtc_dpms() or i9xx_crtc_dpms(), to disable the display pipeline, depending on the GMCH type. For this discussion, lets take i9xx_crtc_dpms() as example.
linux/drivers/gpu/drm/i915/intel_display.c:
static void i9xx_crtc_dpms(struct drm_crtc *crtc, int mode)
{
...
int dpll_reg = (pipe == 0) ? DPLL_A : DPLL_B;
int dspcntr_reg = (plane == 0) ? DSPACNTR : DSPBCNTR;
int dspbase_reg = (plane == 0) ? DSPAADDR : DSPBADDR;
int pipeconf_reg = (pipe == 0) ? PIPEACONF : PIPEBCONF;
...
case DRM_MODE_DPMS_OFF:
...
/* Disable display plane */
temp = I915_READ(dspcntr_reg);
if ((temp & DISPLAY_PLANE_ENABLE) != 0) {
I915_WRITE(dspcntr_reg, temp & ~DISPLAY_PLANE_ENABLE);
/* Flush the plane changes */
I915_WRITE(dspbase_reg, I915_READ(dspbase_reg));
I915_READ(dspbase_reg);
}
if (!IS_I9XX(dev)) {
/* Wait for vblank for the disable to take effect */
intel_wait_for_vblank(dev);
}
/* Next, disable display pipes */
temp = I915_READ(pipeconf_reg);
if ((temp & PIPEACONF_ENABLE) != 0) {
I915_WRITE(pipeconf_reg, temp & ~PIPEACONF_ENABLE);
I915_READ(pipeconf_reg);
}
/* Wait for vblank for the disable to take effect. */
intel_wait_for_vblank(dev);
temp = I915_READ(dpll_reg);
if ((temp & DPLL_VCO_ENABLE) != 0) {
I915_WRITE(dpll_reg, temp & ~DPLL_VCO_ENABLE);
I915_READ(dpll_reg);
}
/* Wait for the clocks to turn off. */
udelay(150);
}
The mode switching disabling sequence is explained in the PRM as follow:
2.2.2 Mode Switch Programming Sequences
...
• Planes must be disabled before pipe is disabled or pipe timings changed.
...
Table 2-1. Mode Switch Sequences
...
Disable sequence
...
Disable ports
Disable planes (VGA or hires)
Disable pipe
Disable VGA display in 0x71400 bit 31
(Disable VGA display done after disable pipe to allow pipe to turn off when no vblank is available in native VGA mode)
If Gen4 { Wait for pipe off status }
(Wait ensures planes and pipe have completely turned off prior to disabling panelfitter then
DPLL)
Disable panelfitter
Disable DPLL
...
After the disabling sequence comes the enabling sequence, where drm_crtc_helper_set_mode() will indirectly call intel_crtc_mode_set() via the crtc_funcs hooks.
Firstly, the reference clock frequency is determined.
linux/drivers/gpu/drm/i915/intel_display.c:
static int intel_crtc_mode_set(...)
{
...
} else if (IS_I9XX(dev)) {
refclk = 96000;
...
}
The information about reference clock can be seen in the PRM:
2.5 Display Clock Control Registers (06000h–06FFFh)
Reference Frequency:
96MHz for SDVO CRT, HDMI,
96MHz or 100MHz for LVDS.
After performing some DPLL magic (magic because my shallow knowledge doesn't fully comprehend the PRM yet :-), intel_crtc_set_mode() proceed to set the new "mode":
linux/drivers/gpu/drm/i915/intel_display.c:
static int intel_crtc_mode_set(...)
{
...
/* setup pipeconf */
pipeconf = I915_READ(pipeconf_reg);
/* Set up the display plane register */
dspcntr = DISPPLANE_GAMMA_ENABLE;
...
dspcntr |= DISPLAY_PLANE_ENABLE;
pipeconf |= PIPEACONF_ENABLE;
dpll |= DPLL_VCO_ENABLE;
...
I915_WRITE(htot_reg, (adjusted_mode->crtc_hdisplay - 1) |
((adjusted_mode->crtc_htotal - 1) 16));
I915_WRITE(hblank_reg, (adjusted_mode->crtc_hblank_start - 1) |
((adjusted_mode->crtc_hblank_end - 1) 16));
I915_WRITE(hsync_reg, (adjusted_mode->crtc_hsync_start - 1) |
((adjusted_mode->crtc_hsync_end - 1) 16));
I915_WRITE(vtot_reg, (adjusted_mode->crtc_vdisplay - 1) |
((adjusted_mode->crtc_vtotal - 1) 16));
I915_WRITE(vblank_reg, (adjusted_mode->crtc_vblank_start - 1) |
((adjusted_mode->crtc_vblank_end - 1) 16));
I915_WRITE(vsync_reg, (adjusted_mode->crtc_vsync_start - 1) |
((adjusted_mode->crtc_vsync_end - 1) 16));
...
I915_WRITE(pipesrc_reg, ((mode->hdisplay - 1) 16) | (mode->vdisplay - 1));
...
I915_WRITE(pipeconf_reg, pipeconf);
I915_READ(pipeconf_reg);
intel_wait_for_vblank(dev);
...
I915_WRITE(dspcntr_reg, dspcntr);
...
}
Much of the information about mode adjustment code can be found in the PRM section 2.7 Display Pipeline / Port Registers (60000h–6FFFFh), 2.10.1.3 PIPEACONF—Pipe A Configuration Register and also Enable sequence in 2.2.2 Mode Switch Programming Sequences.
I guess that is the overall flow of what happen during a KMS mode setting like when we use xrandr to select another resolution.
Having said that, this is just the beginning of my investigation and nothing here is authoritative. If any of you understand better, please do enlighten me. Any advise is welcome.
February 05, 2010
1. Install bind, bind-chroot and caching-nameserver (bind is the nameserver, bind-chroot is to make bind operate in chroot environment and caching-nameserver is the BIND default setting for caching nameserver)
# yum install bind bind-chroot caching-nameserver
2. All bind configuration files will be stored in /var/named/chroot because of the bind-chroot package. A file named "named.caching-nameserver.conf" will be created in /var/named/chroot/etc. Rename the file to "named.conf"
# cd /var/named/chroot/etc
# mv named.caching-nameserver.conf named.conf
3. Edit named.conf until it become like below and save:
options {
listen-on port 53 { any; };
directory "/var/named";
dump-file "/var/named/data/cache_dump.db";
statistics-file "/var/named/data/named_stats.txt";
memstatistics-file "/var/named/data/named_mem_stats.txt";
allow-query { any; };
allow-query-cache { any; };
};
logging {
channel default_debug {
file "data/named.run";
severity dynamic;
};
};
view localhost_resolver {
match-clients { any; };
match-destinations { any; };
recursion yes;
include "/etc/named.rfc1912.zones";
};
4. Set /etc/resolv.conf to point to localhost
# echo "nameserver 127.0.0.1" > /etc/resolv.conf
5. Restart your nameserver
# /etc/init.d/named restart
Done :)
Since my upgrade to OpenOffice.org 3.1.1, I have not explored Calc much. When I tried to print a spreadsheet that ran across 40 pages. I tried to have the first 2 rows repeat as headers in every page, an error appeared "Invalid Sheet Range".
Solution:
- Open the Calc spreahsheet.
- In the menu choose Tools ->Option ->OpenOffice.org Calc ->Formula
- In Formula Syntax, it shows "Calc A1". Click on the dropdown box and choose "Calc A1".
- Click "Ok".

Some trigger must have failed to detect the values as "Calc A1". Thank you Arnel for giving the solution in Oct 2009.
Dear MariaDB users,
MariaDB 5.1.42, a new branch of the MySQL database which includes all major open source storage engines, myriad bug fixes, and many community patches, has been released. We are very proud to have made our first final release, and we encourage you to test it out and use it on your systems.
For an overview of what’s new in MariaDB 5.1.42, please check out the release notes.
For information on installing MariaDB 5.1.42 on new servers or upgrading to MariaDB 5.1.42 from previous releases, please check out the installation guide.
MariaDB is available in source and binary form for a variety of platforms and is available from the download pages.
It is also our pleasure to announce that we have a partnership with Webyog to offer their tools for trial and at a discounted rate if purchased within 30 days. Find out more at: Download – SQLyog MySQL Fronted, MONyog MySQL Monitoring Tool or via the software partner downloads.
We welcome and appreciate your feedback, bug reports, bug fixes, patches, and participation on our mailing list. Find out more about working with the community.
Enjoy!
Related posts:
- MySQL on Leopard OS X 10.5 PrefPane fixed!
- MySQL with yaSSL vulnerability
- MySQL Connector/PHP for MySQL 5.0.24 and PHP 5.1.5 released
February 04, 2010
/proc/net/dev is somehow seems interesting to me. Now, let's do some python code for fun before going out to lunch.Here is my code to get the same result as my previous python code to list the network interfaces:
#!/usr/bin/python
# read the file /proc/net/dev
f = open('/proc/net/dev','r')
# put the content to list
ifacelist = f.read().split('\n')
# close the file
f.close()
# remove 2 lines header
ifacelist.pop(0)
ifacelist.pop(0)
# loop to check each line
for line in ifacelist:
ifacedata = line.replace(' ','').split(':')
# check the data have 2 elements
if len(ifacedata) == 2:
# check the interface is up (Transmit/Receive data)
if int(ifacedata[1]) > 0:
# print the interface
print ifacedata[0]
Seems like it is working on my ubuntu linux (in the office
). I believe it should possibly work on other linux without any issue with that SIOCGIFCONF and ioctl. And the code is even simpler. That's all for now... I'm going out for lunch. Happy python coding!

However, most of the scripting skill I have learned tend to deal with text files and text terminal.
Lately, I am interested to learn how to apply similar scripting automation to modern GUI application after noticing a few of my friends have trouble with spreadsheet formula verifications.
After browsing around the web and some useful advice from friend forum users, I started to out to try some ad hoc script on OpenOffice.org 3.1 using Python.
Here is my ad hoc script that populate two simple column with data and generate a chart from there:
from com.sun.star.awt import Rectangle
def populateSheet1():
ctx = XSCRIPTCONTEXT.getComponentContext()
doc = XSCRIPTCONTEXT.getDocument()
shs = doc.getSheets()
sht = shs.getByName("Sheet1")
crg = sht.getCellRangeByName("A1:B1")
crg.setPropertyValue("CellBackColor", 0xF000F0)
cel = sht.getCellByPosition(0,0)
cel.setFormula("value")
sht.getCellByPosition(1,0).setFormula("value x 2")
crg = sht.getCellRangeByName("A2:A11")
crg.setPropertyValue("CellBackColor", 0x00F0F0)
for r in range(1,11):
cel = sht.getCellByPosition(0,r)
cel.setValue(r)
cel = sht.getCellByPosition(1,r)
fml = "=A" + str(r+1) + "*2"
cel.setFormula(fml)
adr = sht.getCellRangeByName("A2:A11").getRangeAddress()
a = (adr,)
# Properties can be access directly or using getPropertyValue()
siz = sht.getCellByPosition(2,0).Size
pos = sht.getCellByPosition(2,0).getPropertyValue("Position")
rect = Rectangle()
rect.X = pos.X
rect.Y = pos.Y
rect.Width = siz.Width * 3
rect.Height = siz.Height * 11
chs = sht.getCharts()
chs.addNewByName("Chart1", rect, a, True, False)
The result is...

Date: Wed, 3 Feb 2010 23:48:10 +0800
Message-ID: <52d26d931002030748pd2c6321p1290b1eeee703...@mail.gmail.com>
Subject: showing interfaces
From: Umarzuki Mochlis <umarz...@gmail.com>
To: pythonmy@googlegroups.com
Hi all,
I wonder how I can output network interfaces with python the same
way I can with these commands on linux
sudo ifconfig | cut -d " " -f 1 > ifconfig.txt
sed '/ *#/d; /^ *$/d' < ifconfig.txt
--
Regards,
Umarzuki Mochlis
For those who couldn't imagine the output of those two lines command in the question, here is the explanation:
- The first command write to 'ifconfig.txt' the name of up interfaces which comes from ifconfig output and remove other unwanted informations.
- the second line read the 'ifconfig.txt' file, remove empty lines and print the list on the screen.
Answer:
Here is how you can create network interfaces list with python:
import array
import struct
import socket
import fcntl
SIOCGIFCONF = 0x8912 #define SIOCGIFCONF
BYTES = 4096 # Simply define the byte size
# get_iface_list function definition
# this function will return array of all 'up' interfaces
def get_iface_list():
# create the socket object to get the interface list
sck = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
# prepare the struct variable
names = array.array('B', '\0' * BYTES)
# the trick is to get the list from ioctl
bytelen = struct.unpack('iL', fcntl.ioctl(sck.fileno(), SIOCGIFCONF, struct.pack('iL', BYTES, names.buffer_info()[0])))[0]
# convert it to string
namestr = names.tostring()
# return the interfaces as array
return [namestr[i:i+32].split('\0', 1)[0] for i in range(0, bytelen, 32)]
# now, use the function to get the 'up' interfaces array
ifaces = get_iface_list()
# well, what to do? print it out maybe...
for iface in ifaces:
print iface
This code is tested to be working in my ubuntu linux. Since I made SIOCGIFCONF ioctl number (0x8912) hardcoded, it may seems broken on other UNIX like system. However, you may modified the code to be compatible with your system when you understand it. I hope this snippet can help others too. Enjoy coding!

- Visit http://www.skmm.gov.my/ for Radio Amateur Examination (RAE) notice.
- Download the application form.
- Fill the application form.
- Your application form must be include with 1 copy of your identification card and MYR50.00 bank draft or money order to "SURUHANJAYA KOMUNIKASI DAN MULTIMEDIA MALAYSIA"
- Dont forget to write the examination serial number to the up left corner of your envelope.
- Send it to the nearest SKMM's office.
P/s: Please read the notification for extra information.
February 03, 2010
Update in Crontab
/pathto/awstats.pl -config=mirror.oscc.org.my -update
Build static html page
perl /pathto/awstats_buildstaticpages.pl -awstatsprog=/pathto/awstats.pl -update -config=mirror.oscc.org.my -dir=/pathto/awstats/webroot/
Build report in pdf
perl /pathto/awstats_buildstaticpages.pl -awstatsprog=/pathto/awstats.pl -update -config=mirror.oscc.org.my -dir=/pathto/awstats/webroot/ -buildpdf[=/pathto/htmldoc] -month=11 -year=2009
*p/s: before u build report in pdf, your system need to have "htmldoc"
February 02, 2010
An error occurred: The requested layer (1.0.0) does not exist. Available layers are:
To fix it, only add one line as below:
helmi@gandalf:~/Packages/tilecache-2.10/TileCache/Services$ diff -C3 TMS.py TMS_fix.py
*** TMS.py 2010-02-02 16:12:32.000000000 +0800
--- TMS_fix.py 2010-02-02 16:13:06.000000000 +0800
***************
*** 13,18 ****
--- 13,19 ----
elif len(parts) 2:
return self.serviceCapabilities(host, self.service.layers)
else:
+ parts = parts[-5:]
layer = self.getLayer(parts[1])
if len(parts) 3:
return self.layerCapabilities(host, layer)
http://twitter.com/helmi03/status/8534440936As the Adventure Continue
One of the nice thing about django, it have all sort of application. Haystack is such a application. Not just haystack support solr, it also support a few other backends. This include whoosh, and xapian.
The fun part about this, it is quite pleasant to work with. So we redo all of out previous code to work with this.
Let The Game Begin
Again the tutorial is helpful, it pretty much describe what i am have done anyway. And the documentation covers a lot!! So I will skip the setup, and index.
After following the tutorial to setup.And modify the search_indexes.py for each models that we need to find. And generate the solr index, and copy to the solr/conf.
We basically have a django application ready to do search. To test, is a matter of going to shell.
from haystack.query import SearchQuerySet
q = SearchQuerySet().all()
of course, you can also, do
q = SearchQuerySet().filter(fieldname='value')
for i in q:
print i.object.value
It is similar to django queryset api. Except it is for search. You can do a lot more, like faceted search, chain the filter, etc.
Are we There Yet.
Not quite, there yet. Because haystack also have a search page, which you can enable, also covered in the tutorial. You can inherit from the search view, and forms to fit your need.
An example is for a form that I need(it is generic anyway)
So you don''t even need to create your own form, and views.
Just import the views, and change the parameter
haystack is pretty comprehensive, have many stuff done for us, from views, forms that is functional. Doing indexing, generating index for solr, etc. I think this is a nice project to use in django for providing search in your web app


