I once wrote something on Informix's logical log file issue. After some research online and reading the manual, I can conclude that, for an Informix DBA, most importantly is to frequently monitor the database's logical log file.
As we do an "onstat -l", you might notice something like this:
8cd23475 U------ 1234 1:12345 1000 1000 100.00
8cd23476 U------ 1235 1:23423 1000 1000 100.00
8cd23477 U---C-L 1236 1:65434 1000 750 75.00
8cd23478 U-B---- 1237 1:15543 1000 1000 100.00
8cd23479 U-B---- 1238 1:12553 1000 1000 100.00
Some of the most important thing you might want to see is the "B", "C" and the last number column.
Remember this, the database will stop functioning when the next logical file is not backup. It does not concern whether the next is fill up or not, instead, backed up or not is more important. The last number column will stat the percentage of the logical file being used. So when it reaches 100%, it will move over to the subsequent file.
So, how to determine which logical log file is in use now? Noticed the "C"? It means the current logical log file is being written. For this case, it will continue to write the current, the next, and the next to the next's logical log file. When it reaches back to the 1st logical log file, the database will stop functioning. So, it is better to alway to backup the logical log file, "ontape -a", as often as possible. Maybe once a week?
"B" stands for backup-ed. So meaning that after a backup is being done, you will notice that all the logical log file will have a "B", except for the current logical logfile.
This is what I have understand after reading. I cannot assure that I am 100% correct, but then, hopefully it helps. Happy exploring!
Sunday, June 01, 2008
Dev : Java Development Platform Environment
Java is considered as an platform independent development and application, or better known as WORA, which stand for Write Once, Run Anywhere. You can always develope your application on Windows, but run it on Linux, or maybe Solaris, or maybe AIX. As long as you have the correct version of JDK or JRE for that particular platform, any java application will run.
But yet, 1 basic rule for java development, never ever deploy to a platform that you never test your application on. In other words, if your production server is running on Linux, please test your application on Linux environment before moving into the production.
Why did I say so? Because, there are many different mechanism in different platform. For example, if you use your application to execute a Windows command, most probably you won't find that command in Linux. But the worse case is that you might not aware of that when writting the codes. Another fine example is the real path that you might use. You may use "\" in writting real path codes in Windows, but then, unix environment does not recognise this character as a path.
So, remember to test fully on the actual, or more to actual environment before planning moving into production.
But yet, 1 basic rule for java development, never ever deploy to a platform that you never test your application on. In other words, if your production server is running on Linux, please test your application on Linux environment before moving into the production.
Why did I say so? Because, there are many different mechanism in different platform. For example, if you use your application to execute a Windows command, most probably you won't find that command in Linux. But the worse case is that you might not aware of that when writting the codes. Another fine example is the real path that you might use. You may use "\" in writting real path codes in Windows, but then, unix environment does not recognise this character as a path.
So, remember to test fully on the actual, or more to actual environment before planning moving into production.
Tuesday, May 06, 2008
Dev : Informix's Logical Log Files are Full -- Backup is Needed
Due to certain condition, such as a big chunk of data is trying to roll back, Informix database server tend to use up all the logical spaces that are assigned to it.
If one day you found that your informix server is not functioning properly, why not check at the logical log file first? I've spend my whole day standing in the server room learning this lesson. This is how I manage to resolve it:
1. If logical file is full, You'll see this error in informix's log file : Logical Log Files are Full -- Backup is Needed. You will not be able to search certain tables and you may also encounter table lock often.
2. type onstat -l to list the list of logical file that you have. If it is due to this error, you will see most, if not all, logical space is 100%.
3. type onmode -l to clear logical log file.
4. If the logical space is fully utilised, onmode -l cannot be use. It will not succeed. You need to goto %informix%/etc/onconfig.std (%ONCONFIG file), change the LTAPEDEV value to /dev/null.
5. Run ontape -a to run backup. Follow instruction.
6. Then run onmode -l again to clear logical file one by one.
7. Change back LTAPEDEV to its original value (/dev/tapedev).
8. Restart DB.
*p/s: I've updated the steps as previously I have missed out step number 5.
If one day you found that your informix server is not functioning properly, why not check at the logical log file first? I've spend my whole day standing in the server room learning this lesson. This is how I manage to resolve it:
1. If logical file is full, You'll see this error in informix's log file : Logical Log Files are Full -- Backup is Needed. You will not be able to search certain tables and you may also encounter table lock often.
2. type onstat -l to list the list of logical file that you have. If it is due to this error, you will see most, if not all, logical space is 100%.
3. type onmode -l to clear logical log file.
4. If the logical space is fully utilised, onmode -l cannot be use. It will not succeed. You need to goto %informix%/etc/onconfig.std (%ONCONFIG file), change the LTAPEDEV value to /dev/null.
5. Run ontape -a to run backup. Follow instruction.
6. Then run onmode -l again to clear logical file one by one.
7. Change back LTAPEDEV to its original value (/dev/tapedev).
8. Restart DB.
*p/s: I've updated the steps as previously I have missed out step number 5.
Wednesday, March 26, 2008
Dev : CVS History
I know everyone of us used to have the problem of finding what file we have updated to CVS recently and our current tortoise CVS doesn't allow to view history by project (I think so), so normally we will manually find the file and check the history 1 by 1. gosh... that's tiring...
I've found a cool software that might help us to do the job and cut down the time we wasted on checking files, and yes, it is free. Please goto
http://www.download.com/CVS-Logger/3000-2383_4-10411357.html?tag=lst-1
or goto download.com to find a software called "CVSLogger", download and unzip the application into your pc.
Steps To Open A Project (or specific folder, or specific file) History
1. Upon running the application, goto View --> Options.
2. Change the CVS executable path to your tortoise CVS home. Eg: C:\Program Files\TortoiseCVS
3. Click OK to save the changes.
4. Click File --> Open.
5. Locate the Project/Folder/file that you want to view the history.
6. Click OK to load the history.
7. Wait... It might take a long time to load all the history.
And there you are. With this, you can even filter the history by user basis. Enjoy with the new toy. Thanks alot to Sergey Zozulya for the cool application!
I've found a cool software that might help us to do the job and cut down the time we wasted on checking files, and yes, it is free. Please goto
http://www.download.com/CVS-Logger/3000-2383_4-10411357.html?tag=lst-1
or goto download.com to find a software called "CVSLogger", download and unzip the application into your pc.
Steps To Open A Project (or specific folder, or specific file) History
1. Upon running the application, goto View --> Options.
2. Change the CVS executable path to your tortoise CVS home. Eg: C:\Program Files\TortoiseCVS
3. Click OK to save the changes.
4. Click File --> Open.
5. Locate the Project/Folder/file that you want to view the history.
6. Click OK to load the history.
7. Wait... It might take a long time to load all the history.
And there you are. With this, you can even filter the history by user basis. Enjoy with the new toy. Thanks alot to Sergey Zozulya for the cool application!
Tuesday, March 11, 2008
Dev : Skipping CVS Folder In WinMerge
WinMerge is quite a powerful tool to compare text document and folders, and I am currently using WinMerge 2.4 for quite some time. Comparing folders content couldn't be easier.
But when it comes to comparing development folders with CVS, it could mean just one thing, a hell lot of files. If you have 100 subfolders, then you will see 200 CVS folders, and 200x6=1200 CVS config files. Add on with your original files, you could end up with 2000-3000 files at least.
So what other alternatives do I have to reduce the file compared and viewed? Yes you do. Firstly, use the WinMerge to compare 2 simple folder. After doing that, clickView. Uncheck "Show Identical Files" and "Show Skipped Files". Other than this, I have no idea how to show this menu without comparing anything, it wont even show if just comparing a file.
Unchecking the "Show Skipped Files" need you to actually do this second step. Else, it will not take effect on anything. The second step is to create a filter. Click Open and a small window will appear as below.
Click Select beside the filter dropdown, and another window will appear to let you create your own filter. Click New. It will prompt you to choose whether the new filter will be used personally or share. Anyone will do. It doesn't matter. Create a new filter file name called "CVS Filter", and inside the filter file, edit it to look something like this (most importantly is the bolded part) :
## This is a directory/file filter template for WinMerge
name: CVS Filter
desc: CVS Filter
## Select if filter is inclusive or exclusive
## Inclusive (loose) filter lets through all items not matching rules
## Exclusive filter lets through only items that match to rule
## include or exclude
def: include
## Filters for filenames begin with f:
## Filters for directories begin with d:
## (Inline comments begin with " ##" and extend to the end of the line)
d: \\CVS$ ## CVS
Save it and there you go. Your new CVS filter is ready to be used with the unchecked of "Show Skipped Files".
Now, you will only see those files you really wish to see.
Monday, March 10, 2008
Dev : Java Code Exception, Getting Error Details
In java coding, we used to have try-catch statement mainly for capturing unforeseen code errors such as SQL query error, parsing a non number to number and as such.
Normally within the catch, we will either throw it back to the method that calls it, or print it out using printStackTrace(). If we were to print it to a string or a log file, we will use toString(). But then, printing to a log file using toString() method might not be sufficient for a developer.
[12:34:56] java.lang.NullPointerException
What does this means? I know the application is hitting some variables which had not been assigned to any value, but where is it? I had a thousand lines of code, which is hitting the error? My current catch is as such:
catch (Exception e) {
log.error(e.toString());
throw e;
}
Well, to get a better description on the log file, I would recommend to use these code instead of just e.toString():
catch (Exception e) {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
e.printStackTrace(pw);
pw.close();
log.error(sw.toString());
throw e;
}
These code will actually write the more descriptive printStackTrace() to a buffer, and we print the buffer out instead of writing it somewhere else. With these code, I am able to get better description, including which line and what class as such:
[12:34:56] java.lang.NullPointerException
at a.class.package.anotherMethod(NewClass2.java:87)
at a.class.package.newMethod(NewClass.java:890)
at a.class.package.main(NewClass.java:60)
Exception in thread "main"
Isn't it better than a single line printout?
Normally within the catch, we will either throw it back to the method that calls it, or print it out using printStackTrace(). If we were to print it to a string or a log file, we will use toString(). But then, printing to a log file using toString() method might not be sufficient for a developer.
[12:34:56] java.lang.NullPointerException
What does this means? I know the application is hitting some variables which had not been assigned to any value, but where is it? I had a thousand lines of code, which is hitting the error? My current catch is as such:
catch (Exception e) {
log.error(e.toString());
throw e;
}
Well, to get a better description on the log file, I would recommend to use these code instead of just e.toString():
catch (Exception e) {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
e.printStackTrace(pw);
pw.close();
log.error(sw.toString());
throw e;
}
These code will actually write the more descriptive printStackTrace() to a buffer, and we print the buffer out instead of writing it somewhere else. With these code, I am able to get better description, including which line and what class as such:
[12:34:56] java.lang.NullPointerException
at a.class.package.anotherMethod(NewClass2.java:87)
at a.class.package.newMethod(NewClass.java:890)
at a.class.package.main(NewClass.java:60)
Exception in thread "main"
Isn't it better than a single line printout?
Saturday, March 01, 2008
Dev : Replace CVS Files, All Files
Windows file REPLACE command is something very useful that every person should know, esspecially for developers. Let me try elaborate using a scenario.
Using Tortoise CVS in windows to backup as well as managing source code versioning is a life saving attemped. It can help you to know who commited what and most of all, it is free.
But then, what if one day, your source code administrator sends all developers an email :
"Hi,
From today onwards, all CVS source code in SUN server will be moved to MOON server due to disk space issue. Please change your workstation's settings accordingly.
Thanks.
From,
Admin."
For the time being, I wouldn't know if there is any other ways to make life easier on this matter. All my source code are pointing towards SUN and now you say MOON? Yeah right, easy for you to say... But first of all, how?
By knowing the behaviour of Tortoise CVS, like every developer knows, there will be a hidden folder called "CVS" in each folder that is using CVS for versioning control in your workstation. But what you should really know is that is what's in it. For the time being, lets get straight to the point.
In each hidden CVS folder, there will be a file called Root. The content of Root might appear differently depending on what CVS authentication you use. As example, ":sspi:mydomain\cksgary@sun:/cvs". Notice that the word "sun" behind "@"? This is the keyword. Just replace the sun with moon. But yet, that is not enough. Because there are more than 2 thousand subfolders that contain this Root file. It is not possible for me to change one by one even if I sacrifice my whole day doing this.
And here comes the real life saver. Using windows REPLACE command really helped out. Just follow the steps below :
1. Ok, lets say your working folder is "D:\work". Make a copy of this Root file in "D:\". Please make sure that it is renamed exactly the same as in the working one. Change the content accordingly.
2. Go to "START --> RUN --> type CMD". This will open a command prompt console for you.
3. Type "REPLACE D:\Root D:\work /s". This will then start replacing all files with the name of Root in all folders and subfolders in "D:\work" with the "d:\Root" file.
3 steps, and you're done. This could be used in any other scenarios if there is a need to replace all files with the same name.
Using Tortoise CVS in windows to backup as well as managing source code versioning is a life saving attemped. It can help you to know who commited what and most of all, it is free.
But then, what if one day, your source code administrator sends all developers an email :
"Hi,
From today onwards, all CVS source code in SUN server will be moved to MOON server due to disk space issue. Please change your workstation's settings accordingly.
Thanks.
From,
Admin."
For the time being, I wouldn't know if there is any other ways to make life easier on this matter. All my source code are pointing towards SUN and now you say MOON? Yeah right, easy for you to say... But first of all, how?
By knowing the behaviour of Tortoise CVS, like every developer knows, there will be a hidden folder called "CVS" in each folder that is using CVS for versioning control in your workstation. But what you should really know is that is what's in it. For the time being, lets get straight to the point.
In each hidden CVS folder, there will be a file called Root. The content of Root might appear differently depending on what CVS authentication you use. As example, ":sspi:mydomain\cksgary@sun:/cvs". Notice that the word "sun" behind "@"? This is the keyword. Just replace the sun with moon. But yet, that is not enough. Because there are more than 2 thousand subfolders that contain this Root file. It is not possible for me to change one by one even if I sacrifice my whole day doing this.
And here comes the real life saver. Using windows REPLACE command really helped out. Just follow the steps below :
1. Ok, lets say your working folder is "D:\work". Make a copy of this Root file in "D:\". Please make sure that it is renamed exactly the same as in the working one. Change the content accordingly.
2. Go to "START --> RUN --> type CMD". This will open a command prompt console for you.
3. Type "REPLACE D:\Root D:\work /s". This will then start replacing all files with the name of Root in all folders and subfolders in "D:\work" with the "d:\Root" file.
3 steps, and you're done. This could be used in any other scenarios if there is a need to replace all files with the same name.
Thursday, December 27, 2007
Car Ownership Transfer
They say that it would take all day for the procedures to be done. Well, not so accurate. I would say "almost a full working day", that should be it. I've been through the hustle because I just did a car ownership transfer without bank loan recently.
Simple say, there are only 3 steps to get your transfer done. But yet, 2 among the 3 steps will kill your time. Ok, nothing is free and each steps require you to pay, pay and pay. Here is my experience.
Firstly, get your car to Puspakom. Bring your car registration card and RM30. Be sure that you be there early, else you would need to wait in the queue and it took me 2 1/2 hours to get through 5-7 cars queuing in front of me. They will inspect your windscreen (where your front windscreen transparency level must not be less than 70%, and 50% for the side windows and rear windscreen), car chassis number, car engine number and kereta-potong (which simply means 'cut-and-joint' cars in Malay).
After the long wait has been settle in Puspakom, you need to get your car insurance ready. Either you buy a new policy or get an insurance policy transfer from the previous owner. Transfer price will vary according to the available NCD/NCB. Get your insurance agent for the fee.
Lastly, the 2nd waiting session. Bring your car registration card, RM100, insurance policy/transfer letter of proof, Puspakom inspection result, K3 form, the owner and the new owner to JPJ to have your name printed on the car registration card. You can print your own K3 form at home and fill it up before going there. Well, I did called JPJ Putrajaya regarding this and they told me that neither the owner nor the new owner need to be there, Just get your photostated Identification Card verified by commissioner of oath. But it seems like JPJ Melaka is different. From their look (most are quite friendly, only one at the counter 29 seems scary and snobbish), they seem looking for both person. And I too heard that JPJ Melaka really do require both of them to be there from a friend. How true is that, I dare not challenge. I would not want my time wasted for nothing.
Wallah... Done... The formula on how to waste 1 full working day! Sigh... Driving from one place to another, which is certainly not near really waste much of the time.
But somethings I cannot understand why must we send our car to Puspakom for checkup before ownership transfer. It is really a waste of time. By the way, Puspakom is a member of DRB-HICOM, which is a private company. I guess it is just a way to make more money to team up with the government?
Simple say, there are only 3 steps to get your transfer done. But yet, 2 among the 3 steps will kill your time. Ok, nothing is free and each steps require you to pay, pay and pay. Here is my experience.
Firstly, get your car to Puspakom. Bring your car registration card and RM30. Be sure that you be there early, else you would need to wait in the queue and it took me 2 1/2 hours to get through 5-7 cars queuing in front of me. They will inspect your windscreen (where your front windscreen transparency level must not be less than 70%, and 50% for the side windows and rear windscreen), car chassis number, car engine number and kereta-potong (which simply means 'cut-and-joint' cars in Malay).
After the long wait has been settle in Puspakom, you need to get your car insurance ready. Either you buy a new policy or get an insurance policy transfer from the previous owner. Transfer price will vary according to the available NCD/NCB. Get your insurance agent for the fee.
Lastly, the 2nd waiting session. Bring your car registration card, RM100, insurance policy/transfer letter of proof, Puspakom inspection result, K3 form, the owner and the new owner to JPJ to have your name printed on the car registration card. You can print your own K3 form at home and fill it up before going there. Well, I did called JPJ Putrajaya regarding this and they told me that neither the owner nor the new owner need to be there, Just get your photostated Identification Card verified by commissioner of oath. But it seems like JPJ Melaka is different. From their look (most are quite friendly, only one at the counter 29 seems scary and snobbish), they seem looking for both person. And I too heard that JPJ Melaka really do require both of them to be there from a friend. How true is that, I dare not challenge. I would not want my time wasted for nothing.
Wallah... Done... The formula on how to waste 1 full working day! Sigh... Driving from one place to another, which is certainly not near really waste much of the time.
But somethings I cannot understand why must we send our car to Puspakom for checkup before ownership transfer. It is really a waste of time. By the way, Puspakom is a member of DRB-HICOM, which is a private company. I guess it is just a way to make more money to team up with the government?
Wednesday, December 05, 2007
Dev : Telnet-ing
A simple tips to share to everyone. As we know, each program that dwells through the network will be communicating through a certain specific port. For example, MSSQL2000 is using port 1433, SMTP is using port 25 and ssh is using port 22.
If we fail to connect, lets say, the mail server of the company, we can actually do a quick check on the problem. Using windows telnet to connect to the network port would be a great start. It will just take a couple of steps to check on the SMTP port of the mail server. Although telnet is defaulted to connect to port 23, but with an additional parameter, we can also telnet to any desire port.
Steps (Make sure your firewall is off and network is up for clearer picture)
1. Open your Command Prompt (Start --> Run --> cmd).
2. Type telnet mailserver 25.
3. If you receive such message Connecting To mailserver...Could not open connection to the host, on port 25: Connect failed, this means most probably the mail server itself is down or maybe the mailserver daemon is not running. Daemon is a small program running in the background either waiting for command or run on its own on a specific port.
4. If you success, you will be brought to a new blank page (normally). This means the mailserver and port is running fine. You will need to check your mail browser instead. Press keyboard ctrl+] to disconnect the telnet.
5. Type quit to exit the windows telnet.
This is very useful, esspecially if you are trying to set up a program such as Apache webserver but you are not sure whether it is running fine or not. You can try connect Apache webserver on the local machine by using telnet localhost 80.
*Keep in mind that normal telnet is telnet ip_or_hostname_of_machine. Telnet checking should be telnet ip_or_hostname_of_machine port_used.
If we fail to connect, lets say, the mail server of the company, we can actually do a quick check on the problem. Using windows telnet to connect to the network port would be a great start. It will just take a couple of steps to check on the SMTP port of the mail server. Although telnet is defaulted to connect to port 23, but with an additional parameter, we can also telnet to any desire port.
Steps (Make sure your firewall is off and network is up for clearer picture)
1. Open your Command Prompt (Start --> Run --> cmd).
2. Type telnet mailserver 25.
3. If you receive such message Connecting To mailserver...Could not open connection to the host, on port 25: Connect failed, this means most probably the mail server itself is down or maybe the mailserver daemon is not running. Daemon is a small program running in the background either waiting for command or run on its own on a specific port.
4. If you success, you will be brought to a new blank page (normally). This means the mailserver and port is running fine. You will need to check your mail browser instead. Press keyboard ctrl+] to disconnect the telnet.
5. Type quit to exit the windows telnet.
This is very useful, esspecially if you are trying to set up a program such as Apache webserver but you are not sure whether it is running fine or not. You can try connect Apache webserver on the local machine by using telnet localhost 80.
*Keep in mind that normal telnet is telnet ip_or_hostname_of_machine. Telnet checking should be telnet ip_or_hostname_of_machine port_used.
Wednesday, November 28, 2007
Dev : Getting HTML Dropdown/Combobox Label, Not Value
Something quite interesting on combobox my colleague had just asked me. Using javascript, how do we get the label value, instead of the real value of a combobox. well, umm... har.... how har? :-) I am not an expert in HTML and javascript, so scratching my head is the only thing I can do.
But after some research on the Net, I've found some resources that helped to solve the problem. You don't need to hide the label value somewhere or in the html option tag, just create your dropdown/combobox as normal, using this three tiny line of code in your javascript, and you're done!
var comboList = document.myform.combolist;
var comboValue = comboList.value;
var comboLabel = comboList.options[comboList.options.selectedIndex].text;
But after some research on the Net, I've found some resources that helped to solve the problem. You don't need to hide the label value somewhere or in the html option tag, just create your dropdown/combobox as normal, using this three tiny line of code in your javascript, and you're done!
var comboList = document.myform.combolist;
var comboValue = comboList.value;
var comboLabel = comboList.options[comboList.options.selectedIndex].text;
Subscribe to:
Posts (Atom)