Thursday, December 19, 2013

How to List All Installed Applications From the Command Line

One simple command to list all installed application :
wmic product

We can also save them into the .csv file with this comamnd :
wmic product get /format:csv > Software_%Computername%.csv

If this command failed with this error : Invalid XSL format (or) file name.
You should change the Regional and Language to English (US) and re-run the command it should be generated file like : Software_COMPUTERNAME.csv

Reference : http://www.sepago.de/e/helge/2010/01/14/how-to-list-all-installed-applications-from-the-command-line

Friday, October 25, 2013

Grails GORM mapping id column using sequence

I work with grails 2.2.4 and legacy database. The legacy database is using postgreSQL. The primary key filed is hdsj_id (bigserial).


class TableHeaderSuratJalan {

 // a lot of field
 ...

 static mapping = {
  id column: "hdsj_id", generator: "sequence", params: [sequence:"table_header_surat_jalan_hdsj_id_seq"]
  version false
 }

}



We need to specify the sequence name, in this example my sequence's name is table_header_surat_jalan_hdsj_id_seq. By default grails will use hibernate_sequence

Tuesday, October 15, 2013

Setting max limit java heap/memory

In windows 7 create environment variable like this : 


My environment :

  • OS : Windows 7
  • JDK : JDK 7 from oracle

Thursday, September 26, 2013

How to change Grails default port

If we run : grails run-app
By default the grails will listen at port : 8080

We can change by default port by run this command :
grails run-app -Dserver.port=9000
This command will make the grails listen to the port 9000

Another way is by editing the BuildConfig.groovy
Add the following line :
grails.server.port.http = 9000

NB: I use grails 2.2.4

Monday, September 2, 2013

Friday, August 30, 2013

Enable .NET 4 on IIS 6

After installing .NET Framework 4, IIS 6 is not directly enable the .NET 4. Run this command to check : 

cd \windows\system32\
iisext.vbs /ListFile


I got a problem when enable .NET 2 and .NET 4 simultaneously. So, I disable the .NET 2 and enable the .NET 4, by run this command :

C:\WINDOWS\system32>iisext.vbs /disfile C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll



C:\WINDOWS\system32>iisext.vbs /EnFile C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll

Restart IIS and the .NET 4 should be work.

Tuesday, August 20, 2013

Thursday, August 1, 2013

How to enter WebBIOS on IBM server

My machine : IBM X3850 (maybe same with X3650, etc)

On first time use we can enter to WebBIOS by pressing <ctrl><h>, like this :


But if we already configure the RAID Controller, we can not see this screen again, we only will see this screen :

So, if we want to reconfigure the RAID Controller (accessing WebBIOS), we can press F1 to enter to the setup menu, like this :










Monday, June 17, 2013

Converting date in PostgreSQL

Get current date, month, and year (return type is DOUBLE PRECISION) :
                     
select EXTRACT(DAY FROM now());

select EXTRACT(MONTH FROM now());

select EXTRACT(YEAR FROM now());


Get current date, month, and year (return type is TEXT) :
select to_char(now(), 'YYYY'); -- year (4 and more digits)

select to_char(now(), 'MM');  -- month number (01-12) with leading zero

select to_char(now(), 'DD');  -- day of month (01-31) with leading zero


For complete complete documentation : to_char

Create a loading image in Java desktop application

This code are equals with
Application.ProcessMessages
in Delphi or
Application.DoEvents
in VB

                     lblLoading.setVisible(true);  
                     new Thread(new Runnable() {  
                          private boolean done = false;  
                          @Override  
                          public void run() {  
                               // time consuming algorithm.  

                               done = true;  
                               if (done) {  
                                    SwingUtilities.invokeLater(new Runnable() {  
                                         @Override  
                                         public void run() {  
                                              lblLoading.setVisible(false);  
                                         }  
                                    });  
                               }  
                          }  
                     }).start();