Wednesday, December 19, 2007
Apache Camel Vs Biztalk
1. Best mmg best.
2. Murah .. rm 0.00
3. Risiko takde...
4. powerful ramai yg kata powerful..
5. Java based Domain Specific Language (or Fluent API) o
6. ada byk plug-in ( free pulak tuh)
7.small library which has minimal dependencies for easy embedding in any Java application.
8. mmg best la dia nih walaupun hanya seekor unta..
Biztalk
1. Mahal kut (Reasonable kut)
2. tak tau sgt.. then tak boleh komen byk
3. plug-in byk giler... (free kut) tak tau aku..
Mana pilihan middleware anda?
Wow... IT Mil Toolkit 5 is very cool
Is it a Desktop App?
nope.
Is it a simple web framework ?
nope...
Is it RIA Framework for java developers?
Yes.. It is.. It is very cool RIA for Java developer... The size of rendered pages is small compare to Other techonologies.
Wow... I was enjoyed IT Mill demos...
then, u should try once
http://www.itmill.com/itmill-toolkit/demos.htm
Antara Tanggungjawab, Kerjaya Dan Duit...
Yang manakah anda rasa penting di dalam pekerjaan anda?
1. Duit
Company 'A' membayar gaji sebanyak RM xxx, anda pun berkerja di company 'A'.. Kemudian, Company 'B' telah menawarkan gaji yang lebih tinggi dari company 'A'. Adakah anda akan berpindah ke company 'B', walaupun company 'A' masih memerlukan anda?
2. Kerjaya
Anda rasa anda boleh mendapat lebih pengalaman di dalam company 'B'. Dengan pengalaman di Company 'B', anda rasa kerjaya anda mungkin akan maju lebih setapak ke hadapan. Adakah anda akan berpindah ke Company'B' ?
3. Tanggungjawab
Anda rasa anda dapat membantu company 'A' utk menambah hasil pendapatan tetapi company 'A' tidak dapat merasai aura bantuan anda... Perlukah anda berpindah ke Company 'B' ?
4. Suasana persekitaran kerja / rakan²
Kebanyakan dari Kumpulan anda telah berhijrah keluar dari company 'A'. Lalu anda pun mengambil keputusan untuk keluar dari company 'A' tanpa mengetahui sebab sebenar untuk berhijrah ke company lain ( kes ikut org)...
Apa² pun jawapan anda, Anda seharusnya kerja seikhlas mungkin..
Sbb sumber rezeki datang dari yang ESA...
Semoga perkerjaan anda diberkati olehNya.
Siapakah ahmad di dalam cerita ini??? hehehehe..
Tuesday, December 4, 2007
apply struts 1 taglib on struts 2
<-s:iterator value=results /->
<-fmt:formatNumber value="<-s:property value="score' />" />
<-/s:iterator->
Then,
the below codes was running
<-s:iterator value=results /->
<-bean:write name="score" pattern="##.00" />
<-bean:write name="date" pattern="dd/MM/yyyy" />
<-/s:iterator->
we need to do the below steps first:
1. put this tags "<%@ taglib prefix="bean" uri="/tags/bean" %>" on the top of ur codes.
2. append the below code in ur web.xml
3. u should hv the struts1 library and put in ur webapp lib..
4. good luck.. hehehe
This case was solved and closed...
:D
Saturday, December 1, 2007
Webwork /Struts 2 does not expose objects to JSTL by default
Finally i stuck on webwork / struts 2.. it is because of the Ognl expression..
my codes cannot run becoz of that
The codes are below
<-s:iterator value=results /->
<-fmt:formatNumber value="<-s:property value="score' />" />
<-/s:iterator->
is there any option in webwork?
for more explaination, go to the below links
http://tersesystems.com/post/8500058.jhtml
Saturday, November 3, 2007
Monday, October 29, 2007
.NET Day 1/ Hari Pertama .NET utk aku
buat ajax calendar pulak tu..
pastu belajar la apa yg dipanggil script manager.. update panel..
bawah ni gambarnya..
sila focus kat url & page size.... besar gile file yg dirender... kat tempat aku nih mesti page tak kuar langsung...
.
Friday, September 21, 2007
Tip-tip hibernate
- Gunakan version yang terkini walaupun beta and banyak feature² baru menarik dan berguna.. senang cerita gunakan Hibernate 3.
- Buat semua associations lazy(Hibernate 3 telah setkannya secara default) dan pilih utk join atau fetch secara eager utk spesifik use-case.
- Definasikan strategi pengurusan session terlebih dahulu. Mungkin, kita akan menggunakan
- satu session per request,
- session per request with detached objects,
- session per application transaksi acros multiple request, dll.
- Definisikan startegi flush terlebih dahulu.
- Hibernate auto-flush
- definisikan sendiri synchronization points di mana flush ke db diperlukan
- Definisikan strategi caching terlebih dahulu utk
- data transaksi
- data yg dillookup tetapi berubah² utk dlm short period.. gunakan open source product spt OSCache.
- Cachekan entiti-entiti anda dan pastikan ia turut diaplikasikan kepada association mapping spt(set,map,bag,list)
- Pilih join yg betul utk entiti one-to-many, many-to-many associations, set nilai saiz batch
utk koleksi sekiranya anda mendapatkan data secara eagerly. - Gunakan optimistic concurreny melalui kolum version sekiranya boleh. Timestamp pun boleh juga. tetapi tidak dijamin. selebihnya translate lah sendiri..
- Understand the lifecycle of identifier creation. If you are using sequences or other database-generated identifiers, your identifiers won't be set until the new entity has been saved to the database. If you use the identifier as part of your equals() and hashCode() implementation, this means that if you add the entity to a Set before you save it, you won't be able to find it again after it's saved. I've gone to UUIDs assigned in the constructor of the entity instances for this reason, and it makes life much easier. I've heard that some people, faced with this, have made their hashCode() implementation always return the same number for every instance of an entity. While this technically fulfills the contract of hashCode() it's hardly optimal.
- Set your IDE up with a reference to the Hibernate source code of the distribution you are using so you can trace into it. Not only will it help you understand what's causing the behavior you're seeing, but it will help you understand how Hibernate works.
- Understand the 2nd level cache (and understand that the Session is your 1st level cache). Understand how it caches your entity data (as a Map of identifier to Array of field values) and collections (it just saves the identifiers and re-constitutes the objects from the entity cache).
- Go buy Hibernate in Action. It covers Hibernate 2.1 but the ideas are the same, there are just some new features in 3.0.
- Speaking of new features, look at Filters. I haven't had a chance to use them yet, but the mere fact that they make the effective date problem so easy makes them a huge win. They can also let you find the number of records in a collection, etc. without having to load the whole thing, very nice.
- Baseline your first working setup with memory and CPU profilers and also with a SQL profiler like IronTrack SQL, then re-run your test cases with the profilers for every configuration tweak to see what the effects are.
Tuesday, September 11, 2007
Looking for Smart Client Container for java
finally i found the smart client container for java, it also for me..
http://smartcc.sourceforge.net/
but... :(
then, i found another demo of smart client container for java
http://www.vlsolutions.com/en/products/docking/demos.php
I hope i can implement Smart Client + SOA in the future project :D
Who is the Follower, Who is the Leader
But.. when i was on the way to my home, my brains was thinking about the moving of another new world but.. The key is... who is the leader.. who is the follower... of these concepts. So... it made me to stay in the current line and will not plan to moving into the another world...
Morale of the story..
next time, I will only impress when i see the successful real-world scenario project which is brought a lot of complexity into the system.. actually, the simple demo always not covers the difficult or complex parts.
Wednesday, September 5, 2007
Blinq.. for ASP .NET Fan club
Actually, Blinq is a tool for generating ASP.NET websites for displaying, creating, and manipulating data based on database schema.
More details on the below link
http://www.asp.net/downloads/sandbox/blinq/
erm... My Code gen can do same workloads.
Tuesday, September 4, 2007
Misi Projek Rahsia Terbongkar...
Nama Misi:
Code Generator
Nama Kod :
Tanpa Nama (Boleh beri cadangan)
Objektif :
Menyelesaikan semua permasalahan CRUD (Create, Read, Update, Delete ) dengan mudah.
Kod-Kod tersebut boleh diguna semula di dalam komponen yang lain. senang dipakai.
Bahan² :
1.5 kg Hibernate
1 kg Spring
3kg Webwork
0.5 kg CSS
0.5 kg js
1 kg ajax framework( akan datang)
1.5 kg velocity
*kg adalah pemberat pengetahuan yg diperlukan di sini...
Tarikh Mula:
07/07/2007 (agak² jer, tp sebelum bos pergi)
Tarikh Tamat:
dah bosan, mungkin tamat kut..
Pencapaian:
Fasa 1 sudah selesai. Fasa 1 merangkumi simple CRUD utk Simple Domain. Fasa 1 dah berjaya didemokan kepada guru yahaya
Fasa 2 akan cover utk domain yg lebih kompleks yang melibatkan One-to-Many. Many-to-One.
Komitment:
Insyallah, satu bulan satu kejayaan.. berbulan² byk la kejayaan yg dicapai.. setahun.. kejayaan yg besar akan di capai...
Cadangan utk diri saya:
Akan saya ceritakan dari A-Z ttg perkembagan misi ini.
Perlu dinaikan taraf open source ke projek ini..
Cadangan pada masa depan
Akan menyokong MVP/ MVC (.NET Framework)
Monday, September 3, 2007
Sudah Satu Tahun Di Sini.. Tahun Depan Ke mana pulak?
Biasa la, bila rasa sekejap tu .. mungkin sebab keje byk sangat sampai tak ingat hari bulan...
Sudah satu tahun di Sini.. Apa yg saya dapat yer.. erm.. actually, banyak juga yg saya belajar di sini antaranya... ( muhasabah diri sket)
1. Hibernate
dulu mmg tercari² gak sifoo utk belajar benda ini
2. web framework
webwork la.. dulu buat struts mcm tak best jer.. sbb byk sgt configuration
3. Spring
sama kes mcm no 1. .. saya pakai utk ioc + sket lg aop kut
4. Junit
nak lengkapkan cycle development mesti ada testing.. so, tools ini mmg bagus la.
5. Agile Development... pergh.. ni mmg best la.. kita akan belajar mcmana nak perbnykkan produktiviti kita di dlm s/w industry.
6. Jasper Report.. ini lagi best... dulu pakai poi tak best sgt..
7. Uml Notation - Di Sini, semua document diimplementkan di dlm bentuk UML ...
8. Design Pattern.. best owww.. Antaranya Configuration Over Convention ada byk lagi nih..
9. Akhir sekali, Code Generator la.. hehehehe Sifoo punya dasyat gak.. dulu tak mampu nak buat sendiri sbb tak cukup ilmu, masa & pengalaman..Seblm sifoo saya pergi, sempat la gak minta jasa baik sifoo beri tunjuk ajar sedikit ttg code generator nih... Akhirnya hari ini saya sudah berjaya membuat code generator utk simple domain + crud.. Code generator saya berasaskan Webwork + Hibernate + Spring.. akan datang saya akan cuba utk complex domain..
10. Subjek.. Berterima Kasih.. Saya Berterima kasih kepada kawan² yg membantu saya...
So inilah yg saya dapat di sini selama 1 tahun.. so tahun depan ke mana la yer????
Monday, August 27, 2007
Java Programming Samples Link
Table Locking Issue.. on Mysql....
Hope this link will help me to understand what the table locking issue in any enterprise database.
Plus, i have to understand this issue on hibernate side... becoz i`m totally depending on ORM..
Hate SQL.. Hate SQL... Like ORM.. Like ORM...
Friday, August 24, 2007
Memahami apa itu Acegi Security..
http://acegisecurity.org/
secara pendeknya, saya akan menggunakan acegi utk buat authentication la... mmg power.. dan superb lagi tu...
Hohohoho.. byk link kat sebelah tu.. kena ada masa yang banyak la utk baca semua link kat sebelah tu.....
Apabila Mimpi Buruk OAL Menjadi Kenyataan..
Bila sampai ke opis... satu perkara lagi menyebabkan otak aku sakit.. aku cari parkir kat basement.. Tp tiada... bukan bererti tiada ruangan kosong .. Tp parkir tiada servis utk membuka gate.. lalu memyebabkan otak aku sakit tahap ke-8 dari 10 dalam ilmu matematik...
Lalu aku menginformkan rakan aku bahawa "aku tunggu saje kamu sekalian di depan bsn" dengan tanpa sengaja melupakan perihal OAL yg sedang kehabisan Ruangan Kosong.
Lalu setelah Server² tersebut dimuat-turun (pakai lift tu) ke dalam kereta aku.. Aku pun pulang.. Setelah selesai memuat-naikan server² tu ke rumah aku dari kereta.. dan aku baru je nak berehat dari sakit otak.. tetiba otak aku kembali berfikir secara waras dan cuba mengingat kembali apa yg terlupa.. sekali.. Jingggggg. baru aku teringat ttg Ruangan Kosong utk oal tadi.. Lalu aku mencapai kunci kereta dan terus memecut spt dlm cerita italian jobs... dengan mengunakan authority yg ada aku memasang lampu high-beam yg bermaksud.. "Saya di dalam keadaan kecemasan" :D... hanya beberapa minit sahaja sudah sampai ke opis.. dan naik ke atas lalu mencapai keyboard dan hanya menekan button delete shj (walaupun byk step lg, utk menjadikan cerita ini menarik aku pendekkan la)... oal kemudian telah mendapat kembali ruangan kosong sebanyak 20 G selepas proses delete tsbt. kemudian tamat la mimpi buruk oal dari menjadi kenyataan.... ... Moral dari cerita ini, sekiranya ada keje kosong ditempat anda, boleh anda emelkan kepada saya sekian terima kasih.....
quran translator via IM (YM, GTalk, Etc)
That`s the quran translator via IM...
visit the link below
http://quran.noble.googlepages.com/
keep up the good work.. good job.. well done..
Thursday, August 23, 2007
Grails... Anda Berani ker????
Bunyinya mcm takut jer... Grails... Adakah anda berani menggunakan grails pada production environment.. hahaha.. itulah persoalannya... saya masih belum berani lagi..
kerana mungkin versionnya belum cukup one-point-ohh (tiru macam rakan saya)..
Tapi bagi saya, grails ini amat mengkagumkan saya... walaupun belum mencapai one-point-ohh.
Ia sudah ada byk plug-in. Ok.. untuk tidak menghampakan kawan² saya akan tambah satu lagi link untuk grails plug-in disebelah...
http://grails.codehaus.org/Plugins
Cerita Tentang Ajax Framework
kalau tgh lapang, tp malas giler. sama la gak.. harap² boleh siap sebelum raya.. :D
Oppp lupa pulak ttg ajax-framework ni... ok.. saya tambah link lg kat sebelah ini utk ajax-framework..
http://ajaxexperience.techtarget.com/east/html/frameworks.html
Wednesday, August 22, 2007
Wahh... I will get Grails on my Eclipse
http://docs.codehaus.org/display/GRAILS/Eclipse+IDE+Integration
Tambah links PatternLayout utk Log4j
Monday, August 20, 2007
mari belajar Regular Expression
It`s cool to do validations or masking input for forms.
These links are very helpful
http://www.regular-expressions.info/javascript.html
http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Guide:Regular_Expressions
http://www.websina.com/bugzero/kb/regexp.html
Tuesday, August 14, 2007
Play with a cool toy... Xdoclet...
Sunday, August 5, 2007
Monday, July 9, 2007
Apakah yg diperlukan oleh sorg J2EE Developer
- Bersabar utk belajar dan bina Java/J2EE System yg berkualiti.
- Berkemampuan utk berfikir bukan sekadar dari perspektif teknikal malah dari segi perspektif business
- Berkemampuan utk menganalisa "What if" senario cthnya
- apakah sistem yg dibina boleh menyokong produk baru dia masa akan datang
- apakah sistem yg dibina boleh menyokong utk pelayan web.
- Berkemampuan utk melihat sesuatu sistem secara "big picture" spt konsep design, isu-isu transaksi, concurrency, performance, memory dan
drill down to details bila diperlukan. - Attitude yg bagus.. Attitude "saya tahu semua" perlu dielakkan....
- Peribadi yg baik dan Skill komunikasi yg bagus.
- Berusaha utk belajar dan keep up dgn emerging tech dan framework mcm Spring,Hiberanate,Struts.. dll
- Berkemampuan utk menguasai dan memodelkan OO mengikut design masing² ..
- cth konsep design yg pernah sy dgr
- Domain Design Driven
- Design Pattern
- Test Driven Pattern
- dll yg saya tak tahu...
- Hensem bergaya?? perlu ker? Kemas mungkin kut..
- Memahami boundaries dan skop utk setiap sistem mahupun component di dalam sistem.. kalau boleh jgn overlap.. supaya code yg common pada components yg berbeza di dalam sesuatu sistem boleh digunakan semula...(Reusable )
- Memahami kelemahan / kekurangan pada sistem
- Mempunyai sikap incompleteness di dalam software.... ini penting supaya kita boleh mencapai objektif sistem pada masa yg ditentukan... kita tidak semestinya perlu membaiki kelemahan yg tidak seberapa penting atau selagi kelemahan tersebut tidak memberi impak kepada objektif sistem...(yang ini baru dpt cahaya dari sifu)...
Tuesday, June 26, 2007
Shell comparison
Operation | Windows | Unix csh-based (csh, tcsh) | |
---|---|---|---|
initialisation | NT: set to the values in "System Properties/Environment", DOS: set in autoexec.bat | set in /usr/local/env/.cshrc (sometimes /etc/.cshrc), followd by ~user/.login if login shell. | |
I/O redirection | cmd cmd >>out-file-append stderr cannot be redirected, always goes to screen. | dito. | |
filename expansion | ? single char, * any number of any (including the dot at the beginning of filenames). eg dir test*.doc will find all files starting with test and the extention doc. dir test* and dir test*.* are the same. | dito, but * doesn't match a dot when it's the first char in a filename (as such files are used as system ressources.). Mask meta-chars with \. | |
whitespace protection | cmd "with blank" | cmd 'with blank' | |
Process piping | with cmd1 | cmd2 | dito | |
Version | winver | showrev | |
environment setting | set [var=[string]] sets env vars. Note: no space behind =. Without var, all vars are shown on stdout. set vars locally for a skript between setlocal and endlocal . each setlocal must be freed by the endlocal before skript end. | set var = text with mandatory spaces. setenv name text sets and exports variable. set ! (bangs) in text are replaced by incremental numbers. array vars are defined as set var = ( foo bar baz ) | |
path | path=newpath;%path% | set path = ( /bin /usr/bin /usr/local/bin ) path is defined as an arry. | |
directory listing | dir | ls | |
help option | command /h | man command or command --help | |
file identity check | comp | cmp | |
file difference comparison | comp f1 f2 for same sized file (default binary) fc f1 f2for text files. | cmp | |
file length | |||
grepping | find findstr with regexen | grep | |
timing | |||
size check | |||
view users | who -al, whoami, groups | ||
view host | hostname | hostname, showrev | |
view user on remote host | finger usrname@hostname | dito | |
processes | ps -elf | ||
jobs | jobs | ||
rights | chown, chgrp | ||
file attribs | chmod | ||
scheduled execution | at | cron | |
Sortieren | sort | sort | |
Output paging | more use pipeing to page output from other programs, file redir and name expansion to page contents of files. | more | |
html downloading | wget | wget | |
free memory | mem | ||
show text file contents | type f1 [f2 ..] | cat | |
route tracing | tracert | traceroute | |
internet IP-name lookup | nslookup | nslookup | |
show net connections | netstat | ||
ping if computer is on network | ping | ping | |
printing | lpr | lp | |
prompt style | prompt $p$g$p = pfad, $g = > | # superuser, % normal, set prompt = "`hostname`:` pwd`>" | |
variables | args for batches are stored in %1 to %9. environment var contents are accessed like this: %VARNAME% Expansion works here too, i.e %* means a list of all %1 to %9. | $var for normal vars or full arrays, $array[2-4] for array slices, $#array number of elements, $?var if var is defined 1, else 0. | |
executable search path | path without param shows path. entries separated by ;(semicolon). append old path with path newdir;%path% |
Monday, June 25, 2007
Mari belajar window batch programs
filename | Batch files end with .BAT there is no magical string like in Un*x batch file commands are case insensitive |
comments | rem at line start is a comment line |
in/output redirection | cmd cmd >>out-file-append stderr cannot be redirected, always goes to screen. |
parameters | %1 to %9 arguments number 1 to 9 given to the batch file %* all arguments given to the batch file (max. 9) |
environment variables | %varname% |
conditions | if [not] "string1" == "string2" command Enclose vars and strings in "". Idiom for empty check: if "%var%" == "" command ("" needed for empty string). if [not] exist filename command if errorlevel 1 would test for any abnormal exit. errorlevel is the number the last program executed returned. The condition is true if the number is >= the errorlevel. Normal exit returns 0. |
logical operators | &&execute only when last prog returned ok ||execute only when last prog returned error |
skript loops | for %% var in ( group ) do command [params] var wird zu jedem in group angegebenen dateinamen, eg for %%f in (*.*) do type %%f |
skript jumps | goto mark The target mark itself has to be prepended with : so NT can skip it during execution. :mark |
skript chaining | call blah.bat calls another batch like a subroutine, i.e. the current batch's execution is resumed after the other one ends. Recursion possible. |
skript messages | echo [on|off][message] @ at line start suppress showing of any single line @echo off showing of any line (including this). Echo with message prints message. |
getting user input for skripts | pause[message] halts until any key pressed. |
... | shift shifts the params in a batch one down, e.g. %9 to %8. %0 is lost and if there were more than 10 params, the current number 11 becomes %9. Example loop with shift :next |
Monday, June 4, 2007
Forgot Windows Administrator password??
http://home.eunet.no/~pnordahl/ntpasswd/
Monday, May 28, 2007
Looking for a new job....Jump Out.. Jump In.. First In.. First Out
Actually, i am not looking for a new job but i am looking for new sifu or guru in s/w dev who will lead me to become the most powerful software solution/artichect... My current sifu will jump out from our places... so, may be i will stay here for a while and later on, i will follow same way but might be not the same place in order to upgrading my self into the higher level of the s/w development knowledges.
By the way, i will try to fit and struggle my self in netweaver tech.. meaning.. i will upgrade my self as SAP Compliance. hahahaha.. sound like hardware compliance/compatible... It will offer me more opportunity to looking new tech in SAP...
Hopefully, everything will be ok...
Saturday, May 26, 2007
Have fun with Open Solaris and fedora
Aku binggung.. Kemana kah hala tuju seterusnya...
umpama seperti kehilangan sesuatu yang amat berharga....
ke mana kah hala tuju selepas ini...
Bermulalah era baru... era yang lebih ngeri dan ganas....
stay... or move out... hahahhahahah...
just wait n see...
Tapestry: A centralized user management system
http://www.javaworld.com/javaworld/jw-06-2001/jw-0615-tapestry.html?page=1
cerita pendek.....
Mengisahkan ttg kehebatan pengurusan pengguna secara berpusat...
just one app yg handle user mgt...
a good framework for the future project.... hehehehe....
Friday, May 25, 2007
Memahami perbezaan innodb & MyIsam
http://www.mysqlperformanceblog.com/2007/01/08/innodb-vs-myisam-vs-falcon-benchmarks-part-1/
cerita pendek...
baca cerita panjang..
Memahami KunciMati pengkalan data (DB Deadlock)
http://db.apache.org/derby/manuals/develop/develop75.html
dipendekan cerita kejadian selalu berlaku apabila 2 atau lebih lelaki merebut seorg perempuan,
So perempuan tu jadi deadlock atau buntu..
ye ker?
Thursday, May 24, 2007
Thread Yield mengatasi masalah Deadlock Thread
Forces the current thread to yield control to the part of the implementation responsible for scheduling threads. Doing so may have the effect of allowing other threads to run, and may be essential to avoid deadlock in a co-operative scheduling environment.
Mari Mengelak Mengesan Table ( How to Avoid Table Scans in Mysql)
7.2.16. How to Avoid Table Scans
The output from EXPLAIN
shows ALL
in the type
column when MySQL uses a table scan to resolve a query. This usually happens under the following conditions:
The table is so small that it is faster to perform a table scan than to bother with a key lookup. This is common for tables with fewer than 10 rows and a short row length.
There are no usable restrictions in the
ON
orWHERE
clause for indexed columns.You are comparing indexed columns with constant values and MySQL has calculated (based on the index tree) that the constants cover too large a part of the table and that a table scan would be faster. See Section 7.2.4, “
WHERE
Clause Optimization”.You are using a key with low cardinality (many rows match the key value) through another column. In this case, MySQL assumes that by using the key it probably will do many key lookups and that a table scan would be faster.
MySQL Enterprise. For expert advice on avoiding excessive table scans subscribe to the MySQL Network Monitoring and Advisory Service. For more information see http://www.mysql.com/products/enterprise/advisors.html.
For small tables, a table scan often is appropriate and the performance impact is negligible. For large tables, try the following techniques to avoid having the optimizer incorrectly choose a table scan:
Use
ANALYZE TABLE
to update the key distributions for the scanned table. See Section 13.5.2.1, “tbl_name
ANALYZE TABLE
Syntax”.-
Use
FORCE INDEX
for the scanned table to tell MySQL that table scans are very expensive compared to using the given index:SELECT * FROM t1, t2 FORCE INDEX (
index_for_column
)
WHERE t1.col_name
=t2.col_name
; Start mysqld with the
--max-seeks-for-key=1000
option or useSET max_seeks_for_key=1000
to tell the optimizer to assume that no key scan causes more than 1,000 key seeks. See Section 5.2.3, “System Variables”.
Thursday, May 10, 2007
How to Identify and Delete Duplicate SQL Server Records
by Randy Dyess
Recently, I was asked to help someone clean up their database after they had double loaded an import file. The problem they were having in identifying and deleting the duplicate information was the fact that a timestamp is applied to each row of data as it is inserted into the table. While the rest of the row of data was duplicated, the timestamp made the row unique. It was this uniqueness that caused the simple methods of determining and deleting duplicate data to fail. They needed a way to delete data from a table in which they determine the criteria of what made the data duplicate.
After helping them out with their problem, I decided to write a short article to show the simple solution I came up with to delete the duplicate data from a table, even if that data is considered unique by SQL Server. I know there are many ways to delete duplicate data, but bear with me as I explain my way. As always, if you have another way, great write it up and let us know about it. If not, look over these scripts and see if you can use them to create your own method.
Before I get into the example that actually deals with the described problem, I am going to start by showing a method to delete simple duplicate data for those who may be new to SQL Server and do not know how to clean up duplicate data from a table.
/**********************************************
Example of a simple duplicate data delete script.
**********************************************/
/**********************************************
Set up test environment
**********************************************/
SET NOCOUNT ON
--Create test table
IF OBJECT_ID('tDupData') IS NOT NULL
DROP TABLE tDupData
GO
CREATE TABLE tDupData
(
lngCompanyID INTEGER
,strCompanyName VARCHAR(20)
,strAddress VARCHAR(10)
,dtmModified DATETIME
)
--Create test data
INSERT INTO tDupData VALUES (1,'CompanyOne','Address1','01/15/2003')
INSERT INTO tDupData VALUES (2,'CompanyTwo','Address2','01/15/2003')
INSERT INTO tDupData VALUES (3,'CompanyThree','Address3','01/15/2003')
INSERT INTO tDupData VALUES (2,'CompanyTwo','Address','01/16/2003')
INSERT INTO tDupData VALUES (3,'CompanyThree','Address','01/16/2003')
-- Dup Data
INSERT INTO tDupData VALUES (1,'CompanyOne','Address1','01/15/2003')
GO
/**********************************************
Finish set up
**********************************************/
/**********************************************
Simple duplicate data
**********************************************/
--Create temp table to hold duplicate data
CREATE TABLE #tempduplicatedata
(
lngCompanyID INTEGER
,strCompanyName VARCHAR(20)
,strAddress VARCHAR(10)
,dtmModified DATETIME
)
--Identify and save dup data into temp table
INSERT INTO #tempduplicatedata
SELECT * FROM tDupData
GROUP BY lngCompanyID,strCompanyName,strAddress, dtmModified
HAVING COUNT(*) > 1
--Confirm number of dup rows
SELECT @@ROWCOUNT AS 'Number of Duplicate Rows'
--Delete dup from original table
DELETE FROM tDupData
FROM tDupData
INNER JOIN #tempduplicatedata
ON tDupData.lngCompanyID = #tempduplicatedata.lngCompanyID
AND tDupData.strCompanyName = #tempduplicatedata.strCompanyName
AND tDupData.strAddress = #tempduplicatedata.strAddress
AND tDupData.dtmModified = #tempduplicatedata.dtmModified
--Insert the delete data back
INSERT INTO tDupData
SELECT * FROM #tempduplicatedata
--Check for dup data.
SELECT * FROM tDupData
GROUP BY lngCompanyID,strCompanyName,strAddress,dtmModified
HAVING COUNT(*) > 1
--Check table
SELECT * FROM tDupData
--Drop temp table
DROP TABLE #tempduplicatedata
--drop test table
IF OBJECT_ID('tDupData') IS NOT NULL
DROP TABLE tDupData
GO
As you can see, it is not hard to delete data that is duplicated across all columns of a table. What is harder to do is to delete data that you consider duplicate based on your business rules while SQL Server considers it unique data. This usually happens when one or more columns contain different data, but your business rules have determined that because the main columns of the table are the same, you have duplicate data. This usually happens when you have a problem during a data load and data is loaded multiple times generating new timestamps or identity values for each row. The identify value or the data field will cause uniqueness in the data and the simple delete method will fail.
/**********************************************
Example of a complex duplicate data delete script.
**********************************************/
/**********************************************
Set up test environment
**********************************************/
SET NOCOUNT ON
--Create test table
IF OBJECT_ID('tDupData') IS NOT NULL
DROP TABLE tDupData
GO
CREATE TABLE tDupData
(
lngCompanyID INTEGER
,strCompanyName VARCHAR(20)
,strAddress VARCHAR(10)
,dtmModified DATETIME
)
--Create test data
INSERT INTO tDupData VALUES (1,'CompanyOne','Address1','01/15/2003')
INSERT INTO tDupData VALUES (2,'CompanyTwo','Address2','01/15/2003')
INSERT INTO tDupData VALUES (3,'CompanyThree','Address3','01/15/2003')
INSERT INTO tDupData VALUES (1,'CompanyOne','Address1','01/15/2003')
-- Simple Dup Data and complex dup data
INSERT INTO tDupData VALUES (2,'CompanyTwo','Address','01/16/2003')
-- complex dup data
INSERT INTO tDupData VALUES (3,'CompanyThree','Address','01/16/2003')
-- complex dup data
GO
/**********************************************
Finish set up
**********************************************/
/**********************************************
Complex duplicate data
**********************************************/
--Clean table out to include only one row per company
--Create temp table to hold duplicate data
CREATE TABLE #tempduplicatedata
(
lngCompanyID INTEGER
,strCompanyName VARCHAR(20)
,strAddress VARCHAR(10)
,dtmModified DATETIME
)
--Clean out simple duplicate data first
--Identify and save dup data into temp table
INSERT INTO #tempduplicatedata
SELECT * FROM tDupData
GROUP BY lngCompanyID,strCompanyName,strAddress, dtmModified
HAVING COUNT(*) > 1
--Confirm number of dup rows
SELECT @@ROWCOUNT AS 'Number of Duplicate Rows'
--Delete dup from original table
DELETE FROM tDupData
FROM tDupData
INNER JOIN #tempduplicatedata
ON tDupData.lngCompanyID = #tempduplicatedata.lngCompanyID
AND tDupData.strCompanyName = #tempduplicatedata.strCompanyName
AND tDupData.strAddress = #tempduplicatedata.strAddress
AND tDupData.dtmModified = #tempduplicatedata.dtmModified
--Insert the delete data back
INSERT INTO tDupData
SELECT * FROM #tempduplicatedata
--Check for dup data.
SELECT * FROM tDupData
GROUP BY lngCompanyID,strCompanyName,strAddress,dtmModified
HAVING COUNT(*) > 1
--Clean out temp table
TRUNCATE TABLE #tempduplicatedata
--Identify and save dup data into temp table
INSERT INTO #tempduplicatedata (lngCompanyID,strCompanyName)
SELECT lngCompanyID,strCompanyName FROM tDupData
GROUP BY lngCompanyID,strCompanyName
HAVING COUNT(*) > 1
--Confirm number of dup rows
SELECT @@ROWCOUNT AS 'Number of Duplicate Rows'
--Update temp table to add strAddress and dtmModified
UPDATE #tempduplicatedata
SET strAddress = tDupData.strAddress
,dtmModified = tDupData.dtmModified
FROM #tempduplicatedata
INNER JOIN tDupData
ON #tempduplicatedata.lngCompanyID = tDupData.lngCompanyID
AND #tempduplicatedata.strCompanyName = tDupData.strCompanyName
--Delete dup from original table
DELETE FROM tDupData
FROM tDupData
INNER JOIN #tempduplicatedata
ON tDupData.lngCompanyID = #tempduplicatedata.lngCompanyID
AND tDupData.strCompanyName = #tempduplicatedata.strCompanyName
AND tDupData.strAddress = #tempduplicatedata.strAddress
AND tDupData.dtmModified = #tempduplicatedata.dtmModified
--Verify original table only has three rows of data
SELECT * FROM tDupData
--Drop temp table
DROP TABLE #tempduplicatedata
--drop test table
IF OBJECT_ID('tDupData') IS NOT NULL
DROP TABLE tDupData
GO
This is a little more complicated than the simple duplicate data delete script, but easy to figure out once you see it. A word of caution here, you should investigate any child tables before you delete data from a table in order to prevent creating orphan rows. You can ether delete the data from the child tables first or update them to reflect the identity key value of the data row in the main table you are going to keep. The choice will be determined by your situation and any operating standards you may have.
While having to clean up duplicate data is not something you should have to do every day, the processes you learn from playing with these two scripts should give you a starting point the next time you find duplicate information in your database.
Copyright 2003 by Randy Dyess, All Rights Reserved
Make sure you purchase your copy of Transact-SQL Language Reference Guide from my website www.TransactSQL.Comtoday to learn more about Transact-SQL by reviewing the more than 1200 examples contained within the book.
Saturday, April 21, 2007
Mapping obj to relational db strategies
2. Table per class hierarchy- wujudkan poly dengan cara meng normalkan hubungan model dan gunakan jenis diskriminasi column utk hold type info
3. table per subclass - represent "is a" (inherintance) r/ships as "has a" (foreign key) relationships
Wednesday, April 4, 2007
Configuring Tomcat with IIS Web Server
Thursday, March 29, 2007
Installation of SAP NetWeaver 2004s Java and ABAP Trial Version
I'm going to try the latest trial version of SAP NetWeaver 2004s Java and ABAP on a virtual machine based on VMware Server. First of all, I have to download all packages from SDN.
If you planned to install these products on separate host, the installation order is not important. If you have only one machine to try, it is recommended to install ABAP edition prior to the Java edition (read more).
One more thing, the Java edition does not support JDK 1.5.0 so you have to install JDK 1.4.2 instead.
Install SAP NetWeaver 04s Full ABAP Trial Version
Installing ABAP Trial Version is quite easy. I just answered 2 questions.
- Install location:
E:\SAP
- Master password:
********
It took about 2 hours to finish the installation (8.6 GB). Then I started to install Java edition.
Install SAP NetWeaver 04s SP9 Java Trial Version
- JDK location:
C:\j2sdk1.4.2_13
- JCE location:
E:\jce_policy-1.4.2.zip
- Instace ID:
J2E
- Install location:
E:
- Master password:
********
- User domain:
Local installation
- Administrator password:
********
- Service user password:
********
- Database ID:
J2E
- Host:
xxxx
- MaxDB installation drives:
E:
- Database administrator password:
********
- Database manager operator password:
********
- Java database schema password:
********
- Secure store settings:
********
- Database statistics: Create statistics after the import ends
- SCS instance number: 01
- SDM password:
********
Consequences
It turned out that these trial products must not be installed on the same machine in any orders. I tried both and got unexpected error during installation.
ABAP -> Java - It went very close to success but eventually, Java version didn't detect the existing ABAP instance correctly.
Java -> ABAP - There is no option to choose instance number in ABAP version. Furthermore, the install wizard in ABAP didn't even try to add new database but remove all existing database and install new ones.
Finally, I managed to have Java version in virtual machine with 384 MB main memory. It took about 3 hours to successfully start Java engine. Anyway, it is possible to freeze the machine so I don't have to shutdown and start it again.
Java vs NetWeaver Expert ....To be Or Not Tobe
Will i become Netweaver Expert??????
To Be or Not To Be???
See Me later....
Morale Of Story...
Time`s to change....
Tuesday, March 27, 2007
C3PO , jtds , and dbcp fighting
we got the result.....
C3PO won that game.... jtds & dbcp failed to maintain the connection pooling after the tcp connection reset. then, the conn pooling state was not handled properly. Maybe the connection pooling was exhauted and no active connection for our application on that time. This situation made our application need to restart for every hour.
after a quite busy time to do research abt that problem, my sifu got the C3PO setting. Then, it resolved our mystery problem.. fuh...
now.. our application is running peacefully.... hehehe.. peace in mind...
Saturday, March 24, 2007
Citer Favourite peysal Sewaktu Kecil Dahulu
http://www.youtube.com/watch?v=B6w6zHEu_wk
Friday, March 16, 2007
10 Tips utk Belajar Hibernate (Kelas Permulaan)
- Create a new class, implementing the Serializable interface.
- Add class variables id and version, which are both of type Long. These variables are the primary key and the version number for optimistic locking respectively.
- Add any properties you need.
- Write a default constructor. All variables of type Collection, List, Set, ... should be initialized here.
- Generate getters and setters for all properties:
- id should have a public getter, and no setter
- version should have a protected getter, no setter
- variables of type Collection, List, Set, ... have a public getter and no setter. The public getter preferably return an unmodifiable list.
- Add annotations to the class variables rather than to the getters or setters.
- class-level: @Entity and maybe @Table(name=xxx). When using inheritance you will also need to specify the inheritance type.
- id: @Id and @GeneratedValue(strategy = GenerationType.AUTO)
- version: @Version
- variables: Hibernate Validator annotations such as @NotNull, @Length, @Range, ...
- variables: @Column(name=xxx), but only when the column name is not the same as the variable name
- variables: @OneToOne, @OneToMany, @ManyToOne or @ManyToMany in the case of relations.
- When using relations, make sure that the relation is bidirectional. For the sake of simplicity, I create utility methods that handle this on 1 side of the relation: properties of type Collection have utility methodes addXXX and removeXXX. The corresponding setter on the other side of the relation is protected, and called from the utility methods.
- Implement equals and hashcode methods.
- Always compare values using the getters of the properties, not the class variables directly.
- Do not compare id and version
- Do not compare Collections
- Add a mapping element to the hibernate.cfg.xml file
- You're done!
Wednesday, March 14, 2007
C3PO vs DBCP Connection Pool
pernah pakai sebelum ni , dah lama pakai.... mcm bagus jer....
C3PO
tak pernah pakai... tgh pakai... tunggu dan lihat..
so far, mcm DBCP lg bagus... apa2 pun tunggu result dulu....
Tuesday, March 13, 2007
Cari Buku... Jumpa Buku...Object Modeling in color by peter coad
tp tak de masa nak baca... Tp Simpan Dulu.. nanti ada masa baru baca....
Sifu saya tak rekomen sgt ttg buku ini.. Sifu kat " Buku Analysis Pattern lg Bagus Dari Buku ni,
Sbb cth & explaination dlm buku ni terlalu general"..
Komen Saya Ttg Buku ni...??? Belum Baca lg daaa..
Kalau dah baca baru boleh komen...
Harap Buku ni dpt memberikan satu yg positif pada saya..
Amin....
Cari Buku Yg Susah Nak Jumpa, Tp Terserempak Jua Dipertengahan jalan.
Buku ni dapat dari Sifu saya, tp saya jumpa kat dept lain...
Kalau ikutkan dah lengkap la 4 buku yg dicari..
Biar Masa yg Beri Saya Peluang utk baca buku ni..
Tuesday, February 27, 2007
Konsep Yang Perlu Saya Fahami Terlebih Dahulu
Saya curi tajuk2 berkenaan dari sifu saya then paste di sini..
1. Object Modeling in color by peter coad
2. Analysis Patterns by Martin Fowler
3. Design Patterns by GoF
4. OOA in plain english
Citarasa Tajuk yg menarik....
Tapi mana nak cari yer semua2 nih... Apa kata kita tanya en.google
Belajar Menggunakan Blog
Belajar.. Belajar.. Belajar dan Belajar menggunakan blog ini..
Lepas Belajar.. Buat Sedikit Latihan.. Pastu Baru Dapat Pengalaman..
Lepas Dah Dapat.. Buat yg susah Sket pulak
Monday, February 26, 2007
Satu Permulaan yang baik...
yalah... satu permulaan yang baik untuk mendokumen segala2 usaha menaiktaraf kefahaman saya
tentang software development espesially di dalam java world..
Diharapkan dengan adanya blog ini, saya dapat berkongsi ilmu saya bersama2 kawan2 jawa yg masih berusaha ke tahap yg lebih dasat spt dewa arimasen. Dewa java yg amat terkenal pada abad yg lepas. kah kah kah ( ada ke dewa arimasen)..
Apa2 pun harap dengan adanya blog ini. ilmu saya bertambah berkembang jauh..
Amin....