Sunday, June 21, 2009

Chuon Nat - Khmer Dictionary 2.0 with Unicode font


Let's try to distribute Khmer Dictionary to help all Khmer or people get to know Khmer language enjoy using our right dictionary than some dictionary that wrote wrong Khmer word...

Here, it is Chuon Nat Khmer Dictionary (Khmer to Khmer) 2.0 to download.
The dictionary using Khmer Unicode so please download Khmer Unicode 2.0.
The dictionary contains also the short explanation about Khmer Language Grammar.

Thanks to Buddhist Institute of Cambodia.

You can find other related page for Khmer Dictionary:
1. http://code.google.com/p/khmer-dictionary-tools/
2. http://www.budinst.gov.kh/?q=node/314

Thursday, June 11, 2009

Optimizing the firefox 3.0.x for saving memories

Hum, I got so headache when using a slow computer so I have to find the issue... I know I have many programs installed on my system so these can be the problem but I use mostly the firefox for internet surfing...

I start finding that anytime I open many firefox or tabs at the same it crashes me for a while to use other applications. Check in the process, yes firefox using much memory than others:

Here is the process screen for firefox opens around 25 tabs

Here the way I optimize the firefox configuration:
I. Type about:config on firefox address box
II. Session cofingure:
  1. search "session" in filter box
  2. Edit browser.sessionhistory.max_entries – this is the number of pages stored in the history of your browsing session. Basically these are pages that can be reached using your Back and Forward buttons. The default is 50, I reduced it to 20.
  3. Edit browser.sessionhistory.max_total_viewers – this is the number of pages that are stored in RAM so that they aren’t re-processed by Firefox’s rendering engine. This is what allows you to go Back to a page in Firefox and have it load almost instantaneously. The number of pages stored actually depends on the amount of RAM on your machine. I reduced this to 4 (I have 2GB RAM).
  4. Edit browser.sessionstore.max_tabs_undo – the number of tabs you can restore after closing them (you can do this with Ctrl/Cmd-Shift-T). The default of 10 is more than I really need, so I reduced it to 5 tabs.
  5. Edit browser.sessionstore.interval – Firefox saves your session after every 10 seconds by default. I changed this to a more conservative 30000 milliseconds.

III. Network configuration: enable these to get faster network speed
  1. network.http.pipelining => true
  2. network.http.pipelining.ssl => true
  3. network.http.proxy.pipelining => true

IV. Release Memory When Firefox Minimized
  1. Right click at the content (anywhere) and choose New->Boolean.
  2. In the textbox, type config.trim_on_minimize and press OK.
  3. Set the value to true, and press OK
V. Restart firefox to take affection.

Here is the result of the process after optimize:

So seem it helps, so much different, isn't it? :)
Thanks to following posts also:
  1. http://support.mozilla.com/en-US/kb/high+memory+usage
  2. http://blog.codefront.net/2008/09/10/optimize-firefoxs-memory-usage-by-tweaking-session-preferences/
  3. http://www.go4expert.com/forums/showthread.php?t=8568

Enjoy!

Sunday, June 7, 2009

Welcome to Bing, live search engine


Recently, Microsoft has released a new live search engine called Bing (www.bing.com) (formerly Live Search, Windows Live Search and MSN Search), the question for us is will Bing become a popular search engine as or over Google (www.google.com)?

So this question will see during the long way, I think most people when they meet any issue or require some information, they always remember google than other search engine as yahoo etc. but now as bing become a good one of live search engine so the competition should be starting now.

Bing released online on June 3, 2009 according to the Wiki Pedia record and it has now 16% of statistics counting since it's online till now, it's still a small percentage if compare to google of 60% but see, how fast they are popular now.

Any way, welcome to the new competition of search engine!

Tuesday, January 13, 2009

[NEWS] THE TOP 25 MOST DANGEROUS PROGRAMMING ERRORS

Here is the list of the top 25 most dangerous programming errors to be notified by all programmers:
  1. CWE-20:Improper Input Validation
  2. CWE-116:Improper Encoding or Escaping of Output
  3. CWE-89:Failure to Preserve SQL Query Structure
  4. CWE-79:Failure to Preserve Web Page Structure
  5. CWE-78:Failure to Preserve OS Command Structure
  6. CWE-319:Cleartext Transmission of Sensitive Information
  7. CWE-352:Cross-Site Request Forgery
  8. CWE-362:Race Condition
  9. CWE-209:Error Message Information Leak
  10. CWE-119:Failure to Constrain Operations within the Bounds of a Memory Buffer
  11. CWE-642:External Control of Critical State Data
  12. CWE-73:External Control of File Name or Path
  13. CWE-426:Untrusted Search Path
  14. CWE-94:Failure to Control Generation of Code
  15. CWE-494:Download of Code Without Integrity Check
  16. CWE-404:Improper Resource Shutdown or Release
  17. CWE-665:Improper Initialization
  18. CWE-682:Incorrect Calculation
  19. CWE-285:Improper Access Control
  20. CWE-327:Use of a Broken or Risky Cryptographic Algorithm
  21. CWE-259:Hard-Coded Password
  22. CWE-732:Insecure Permission Assignment for Critical Resource
  23. CWE-330:Use of Insufficiently Random Values
  24. CWE-250:Execution with Unnecessary Privileges
  25. CWE-602:Client-Side Enforcement of Server-Side Security
Source: SANS Institute
News Source: Dangerous coding errors revealed

Sunday, January 4, 2009

How to kill virus: MS-DOS.com, Global.exe, system.exe, svchost.exe manually

The virus: MS-DOS.com which in the process we can see it as Global.exe, system.exe and svchost.exe (which confused to the system process) which are the main process of the virus.











I used to met them with my friends' PC but I could not do anything other than format their PC as most of the antivirus seem can't heal it after the PC affected but now it's with my PC and I don't want to format it again, I tried to kill it myself without any information of it for almost 2 days but I got nothing.

After research, I got some solutions that possible to try, thanks to:
With lecuong.info solution seem more closely to solve the issue:
B1: Use IceSword simultaneously kill 3 Process: system.exe, Global.exe, svchost.exe
B2: Find and delete all the files have been analyzed at above
B3: Using Autoruns to check & remove all key viruses created in the registry
B4: Reboot computer.
B5: Download antivirus program (such bkav) to scan again! (If the computer has antivirus program is removed and then installed again!)
B6: Open Run -> CMD: type in sfc /scannow or sfc /scanonce and XP disk to correct the file failed.
B7: Reboot computer. (If necessary)

With solution B2/ B3/ please use batch file to do it: (kill-msdos.zip)
But I recommend you to use another batch file below...

As for sure, everyone will difficult for point B1/ so I, myself tried to enhance on lecuong.info batch to add following command to try ending all processes of the virus:

taskkill /F /IM system.exe /IM Global.exe /IM svchost.exe /T

But we will face delete also svchost.exe which is the windows system one so that in 1 minute the PC will shutdown but don't worry, we can proceed the rest before 1 minute.

Please press any key and accept YES by press Y to confirm delete all virus files and regedit entries as in the batch.

As I face the virus, seem the batch needs to enhance for more file paths to delete such as:
c:\windows\system32\regedit.exe and its regedit entries so here what I added more:

ATTRIB -R -H -S -A c:\windows\system32\regedit.exe

DEL /f c:\windows\system32\regedit.exe

REG DELETE "HKEY_CURRENT_USER\Software\Microsoft\Search Assistant\ACMru\5603" /v "001" /F
REG DELETE "HKEY_CLASSES_ROOT\MSCFile\Shell\Open\Command" /f

Now I don't see any process of this virus on my task manager any more.

(DOWNLOAD)
Here is the full batch file:
kill-msdos-full (computerexperience.co.cc).zip


Don't forget to continue point B5/ and B6/ also.

Please report any issue/success related to this solution.

Friday, December 26, 2008

Khmer Unicode with Crystal Report in C# Application

I use VS2008 to test Khmer Unicode rendering in Crystal Report.

I. Prepare Crystal Report Render well in report design
First you have to make the crystal report in design time possible to write or view Khmer Unicode

1.1. Copy usp10.dll (version1.465.4001.0) to C:\Program Files\Business Objects\Common\2.8\bin


















1.2. Change fonts setting
in Crystal Report, at VS2008, create a crystal report and go to Crystal Reports --> Design --> Default Setting --> Go to Fonts Tab, change all element to Kh System

II. View Crystal Report with VS Crystal Report Viewer,
Khmer Unicode is not rendering well.
(Under research)

III. View Crystal Report with Crystal Report View
It's working very well for me to view Crystal Report with Khmer Unicode characters on form.
Here is the process...

3.1. On design time, add COM control of Crystal Report ActiveX Report Viewer Control of Business Objects; from my pc, it's a dll at: C:\Program Files\Business Objects\Common\2.8\bin\ crviewer.dll












3.2. Add Reference in the project of craxddrt.dll



















3.3. Create Crystal Report
and write some code in Khmer Unicode and save it to some where, my example in folder bin/Debug

3.4. Coding to call the report to view in the control:


CRAXDDRT.Application crxApp = new CRAXDDRT.Application();
CRAXDDRT.Report crxReport = new CRAXDDRT.Report();
crxReport = crxApp.OpenReport(Application.StartupPath
+ "/KhmerUnicodeTest.rpt", null);
this.axCrystalActiveXReportViewer1.ReportSource=crxReport;
this.axCrystalActiveXReportViewer1.ViewReport();

3.5. Here is the result display












DOWNLOAD: Sample Project: TestCrystalReportViewer

IV. View Crystal Report by export directly to PDF
It works very well, just have issue with font size.
We just call Crystal Report Object and then export it to disk, here is the coding:


private void btnPrintCrystal_Click(object sender, EventArgs e)
{
CrystalKhmerUnicode rptCrystal = new CrystalKhmerUnicode();
rptCrystal.SetParameterValue("txtReportTitle","Hello World");
rptCrystal.SetParameterValue("txtTitle", txtTitle.Text);
rptCrystal.SetParameterValue("txtArticle", txtArticle.Text);
rptCrystal.ExportToDisk(ExportFormatType.PortableDocFormat, "./KhmerUnicode.pdf");
MessageBox.Show("Now report exported to current folder: KhmerUnicode.pdf");
// Direct open pdf report
System.Diagnostics.Process.Start("./KhmerUnicode.pdf");
}

Enjoy,
Happy New Year 2009!
Metrey,

Thursday, December 25, 2008

Wanna to write Khmer Unicode on coding in VS2005 or VS2008?

In fact, I know many people should already know it but I suppose to post here that maybe help others to search for.

I want to write Khmer Unicode text in coding in Visual Studio 2005 or 2008, maybe need to assign value or declare parameter in Khmer etc. So we need to make the editor know Khmer Unicode first.

After your PC running well with Khmer Unicode, please follow this instruction to make it possible to write Khmer on your code:

In Visual Studio option: Tools --> Options --> at Environment, Fonts and Colors set font to: Kh System, then it works.

See screens:













Here, after change, what I can write:

Tuesday, December 23, 2008

Khmer Unicode works now with Adobe CS3

Very good news for us, Khmer, that we have now the fonts that work with Adobe CS3.
It's easy to configure as in fact, we just install new fonts from Khmer OS (I'm not sure yet where is the source of this font), but you can download here: Khmer Unicode Supported CS3.

There are fonts:
  • Kh-Battambang
  • Kh-Bokor
  • Kh-Content
  • Kh-Fasthand
  • Kh-Freehand
  • Kh-Kangrey
  • Kh-Koulen
  • Kh-KoulenL
  • Kh-Metal-Chrieng
  • Kh-Muol
  • Kh-Muol-Pali
  • Kh-Siemreap
  • Kh-System

The right font view as:
















See how to do it:

1. Install fonts: Start -> Control Panel -> Fonts -> Install New Fonts -> Select Kh fonts to install















2. On Adobe Photoshop CS3, select a Kh font (Ex: Kh System)
Here Example:












Note: any font name in group of Kh font will be Ok with CS3, these fonts also can use well with embedded for website without needed usp10.dll, I'll test it first.

Monday, December 22, 2008

Write a string to the specific line or position in the written file in java

I got doubt on this point almost 2 hours to seek how can I write a string to a file at the position, I want.

Let me try to explain my issue that would help others who will have the same:
I extracted the data from database and write it to a file, I have so many queries for one group of lines, the layout of the file is:


1 line header
many lines detail


On the header, it's the summary of all lines in detail, it's in one query and I need to write first line of the header and a group of lines for detail to prevent OutOfMemory Exception at run time (As my file can have data around 1000 MB or much more than this).
One day, I got a request on my dev to modify a rule at the header that i need to count all lines of detail and put in in the header line in one position (position 27),
1. I don't want to execute count all queries of detail to find the record as we can count it when each query extract data so that we can reduce some cost of performance issue.
2. And we should not keep all lines of detail in StringBuffer or String or in list or map and after finish iterate them to write into file from header and then the details (this way we can count the record lines till queries of detail finished and then add it to header as normal), this solution for sure, we will meet OutOfMemory Exception for hug amount of data.
3. So the only solution to write the lines of header and details as normal but try to integrate the record count value to the header line in written file which should not rewrite the new file by read from the written file (performance issue!)..

With solution 3/ above, I got the way with RandomAccessFile functionality: Seeking the byte position of records and after the position integrate the value we prefer.
As my file is fixed length file, and the field to add is at position 27 so the end position of it is 26, here is example:

file.txt: 1 line header and 12 lines of detail:
000000000005400000221020080 98136
...

I need to add value: 12 to the position 27, here is the code:


/**
* @param args
* @throws IOException
*/
public static void main(String[] args) throws IOException {
RandomAccessFile reReadWriteFile = null;
try {
reReadWriteFile =
new RandomAccessFile("file.txt", "rw");
} catch (FileNotFoundException e) {
System.out.println("Error: " + e.getMessage());
throw e;
}

try {
// To search on 26 bytes of field total detail lines
// at header line
reReadWriteFile.seek(26);
reReadWriteFile.writeBytes("12");
reReadWriteFile.close();
} catch (IOException e) {
System.out.println("Error: " + e.getMessage());
throw e;
}
}


After execute, file.txt: will be

0000000000054000002210200812 98136
...

Hope it helps you!
Metrey,

Learning Tip: API of RandomAccessFile

Thursday, December 18, 2008

Flex build 3.0.194161 not working with Eclipse 3.4 solution

First I install flex (build: 3.0.194161) to use with Eclipse 3.2.1, it’s working fine.

I wan to use my existing flex plugin with Eclipse 3.4, I got problem as describe in this post.

I wanna to try to use both eclipse with the same flex plugin, with Eclipse 3.4 I try to install Flex plugin by Software Updates but I could not.

I found the solution on the net, thanks to Tekool.net

I have removed the Flex plugin and then re-install the flex plugin, point to Eclipse 3.4 and Proceed it with Caution










After done, download the patch provided in Tekool.net (Direct download here)
Replace the plug-in of the patch into Eclipse plug-in of Flex Plug-in









And at Eclipse start up add parameter -clean: eclipse.exe -clean
Or from the Flex launcher add this parameter too:
eclipse.exe -clean -showlocation -vm ...

It's working for me now.