Sunday, July 26, 2009

[A Solution Game] A man bought a house

Can anyone write the procedure how to solve this below problem?
It seems we will have two answers according to the way of resolvers thinking can be thinking with Maths or with Business, please write down and share in the comment:

Problem:
======
"A person bought a house for $60,000. Soon thereafter they sold it for $70,000, upon moving out of town.
A few month later, they were transftered back to town and purchased the same house for $80,000, then the person grew tired of the house and resold it for $90,000."

Question: How much money did the person gain/lose (or break even) on the exchange? How you calculate this?

Monday, July 13, 2009

SQL Server with Unicode / Khmer Unicode characters

To be notice MS SQL supports only UCS-2 encoding so do not have encoding with UTF-8 as we expected as MySQL or some other database server as well. This means that you can't use UTF-8 character encoding with Microsoft SQL Server:

Here after I type Khmer Unicode and execute the query, I got question marks instead of characters:

So if you need to store national characters in Microsoft SQL Server - please consider using a national character encoding (U+1780 to U+17FF in Unicode/ISO10646 for Khmer Unicode characters, for example). Change data types:
  • varchar to nvarchar
  • text to ntext
  • char to nchar
Here is the example since I created a table and insert data:
1. Create database (mtr_db) as normally (default setting)

2. Create table (tblunicode) with two fields (id/name) but
name - data type nvarchar(MAX)


3. Insert Khmer Unicode and execute we got it as we typed!
Good luck!

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.