mercoledì 12 agosto 2015

Portable JDK 8

I'm back... I need to keep track of my IT adventures!

Now: what about a portable Java SE 8 that does not bungle your client paths, uh?

Step 1) Download the desired Java version:

Step 2.1)  install 7zip

Step 2.2) open the JDK ".exe" file with 7-Zip. It contains a single file "", which contains all the files we need.
                Extract the to the desired JDK directory (in my case, on win, “C:\eclipse\jdk\”).

Step 3) unpack the "pack2000" files in order to obtain a collection of useful JAR files, using the following statement form command line in the new portable jdk home:

for /R %f in (.\*.pack) do @"D:\JavaJDK\bin\unpack200" -r -v -l "" "%f" "%~pf%~nf.jar"

C:\eclipse\jdk>for /R %f in (.\*.pack) do @"C:\eclipse\jdk\bin\unpack200" -r -v -l "" "%f" "%~pf%~nf.jar"
Unpacking from C:\eclipse\jdk\jre\lib\.\charsets.pack to \eclipse\jdk\jre\lib\charsets.jar
unpack.deflate.hint=(not set) set)
[ . . . ]

A total of 4974 files (of which 4670 are classes) were written to output.

C:\eclipse\jdk>cd bin

C:\eclipse\jdk\bin>java -version
java version "1.8.0_51"
Java(TM) SE Runtime Environment (build 1.8.0_51-b16)
Java HotSpot(TM) Client VM (build 25.51-b03, mixed mode)


The trick is done.

giovedì 4 agosto 2011

SQL: date datatypes & milliseconds (aka how to use timestamps instead of sequences)

This morning I was playing with dates while executing an anonymous plslq block from a java class. My goal was to trace the execution time of a class... including milliseconds.

The well known SYSDATE use the "DATE" datatype but from oracle 9i we can use SYSTIMESTAMP (using "TIMESTAMP" datatype):

to_char(sysdate, 'YYYY:MM:DD:HH24:MI:SS')
,to_char(systimestamp, 'YYYY:MM:DD:HH24:MI:SS.FF6')
FROM dual

when using TIMESTAMP the comparison can be made through TO_TIMESTAMP (or TO_TIMESTAMP_TZ if having more than one zone field, TZ_OFFSET for getting the region time delay)

so... why we still have to use sysdate?
Because we can configure what is returned from the SYSDATE function modifing the "fixed_date" init parameter; I found it very usefull when testing application that are date-related.

ALTER SYSTEM SET FIXED_DATE = '2011-01-01-00:00:01';
System altered.

select sysdate from dual;



select systimestamp from dual;


08-JUL-2011 AM

Another userful feature of the DATE type is the easy language conversion done by the TO_CHAR function:

or in a more fashionable way:
WITH     target_languages     AS
 SELECT     'German' AS language FROM dual  UNION ALL
 SELECT     'French'             FROM dual  UNION ALL
 SELECT     'Italian'            FROM dual 
SELECT language
      ,TO_CHAR ( SYSDATE,'FMDD Month YYYY','NLS_DATE_LANGUAGE=' || language) AS t_c
  FROM target_languages

Nice tricks Mack, nice tricks. but... why have you used TIMESTAMP?

In my case i needed to track down the user insert/updates and i chose to add a column that simulated an oracle sequence without using a sequence:

as the default value of the new column. try it yourself.
It can be used instead of a sequence, you can order the column and you can find out date and time of the insert.

mercoledì 15 giugno 2011

Adobe LiveCycle vs. Chrome

While developing a new UCM service showing an in-line view of some loaded PDF documents, I discovered that Chrome uses the "Chrome PDF Viewer" proprietary plugin.

My goal was to force the official Adobe plugin for viewing my LiveCycle encrypted PDF.
Here's what I've done:
- open chrome;
- in the Chrome address bar, type "chrome://plugins";
- click "Disable" on the "Chrome PDF Viewer" plugin;
- close chrome;
- install Acrobat reader 10.1 (the only version i found fully functional with Chrome and LiveCycle);
- open chrome;
- enable the "Adobe Acrobat - Version: 10.1.X.X" plugin ("chrome://plugins");


lunedì 21 marzo 2011

venerdì 25 febbraio 2011

UCM: default datepicker with idoc

If you need to include a datepicker in a page template or in an hcsp and you won't use jquery, you can use the default UCM calendar with datepicker.
Check the following code as an example:

FROM:<input type="text" id="calendarFrom" />
<img onClick="javascript: pucToggleCalendar('calendarFrom');" border="0" style="cursor: pointer; cursor:hand; vertical-align: middle;" src="images/PopUpCalendar/calendar.png"/>

TO:<input type="text" id="calendarTo">
<img onClick="javascript: pucToggleCalendar('calendarTo');" border="0" style="cursor: pointer; cursor:hand; vertical-align: middle;" src="images/PopUpCalendar/calendar.png"/>

<script type="text/javascript">
pucCreateCalendar({ id: "calendarFrom",caption: "From date"}, "calendarFrom");
pucCreateCalendar({ id: "calendarTo",caption: "To date"}, "calendarTo");

Pay attention to include "std_checkin_html_head_declarations" in your template ; the static javascript code (with the "pucToggleCalendar" function) used to create the popup is included in that resource:

<$include std_checkin_html_head_declarations$>

Linux: boot with terminal

I've just finished installing "stuff" on a VM with Oracle Enterprise Linux and I need to configure the machine without the resource consuming X11 automatically loaded at startup.

The Linux boot process has six states of operation of which "0" is the shutdown state and "3" and above are fully operational with all essential processes running for user interaction. The init process is the last step of the boot procedure and it is identified by process with id=1; Init is responsible for starting system processes as defined in the "/etc/inittab" file.

Editing the inittab file, I changed the default line:


with the following:


Here there are the available states:

0 halt system (loaded the /etc/rc.d/rc0.d/ library)
1 single user (/etc/rc.d/rc1.d/)
2 multiuser with no network (...2.d)
3 terminal
4 reserved for local use
5 X11 GUI mode
6 reboot

After startup type "starx" or "init 5" to enter X11.

domenica 6 febbraio 2011

WLS: embedded LDAP client access

To view the entries of the embedded LDAP server through an LDAP client browser, first of all you have to change the embedded LDAP credentials:

1. Access WLS admin console
2. Expand the Domain node.
3. Select the Security-->Embedded LDAP tab.
4. Change the Credential attribute from its generated value to a new password
5. Click SAVE.
6. At last, reboot WebLogic Server.

Now configure a new connection in the LDAP browser (as a suggestion, I use Apache Directory Studio based on Eclipse).

Use the http server port 7001 (7002 if SSL is being used), "dc=[UCM_DOMAIN_NAME]" as the base dn, cn=Admin as the ldap administration user with the newly created password.