martedì 29 dicembre 2009

Android - Mobile Phone Software SDK Tools

Java Open Source SDK Tools provided for Android Mobile OS.

in riferimento a: Android Developers (visualizza su Google Sidewiki)

domenica 27 dicembre 2009

Play Framework - Build java web application faster

New java framework available for web development

in riferimento a: Play framework ★ Home (visualizza su Google Sidewiki)

Blender 3d suite

Is a good SDK for 3d animation.

in riferimento a: blender.org - Features & Gallery (visualizza su Google Sidewiki)

mercoledì 16 dicembre 2009

Eseguire codice Javascript in java

Esiste un package java il javax.script inserito nella versione JDK 6.0 che permette ad un programma java di eseguire del codice javascript.
Esattamente lo stesso codice esguito all'interno di browser ad esempio.
Su HTML.it trovate un articolo molto interessante in questo senso.

in riferimento a: Java Scripting, interoperabilità tra Java e Javascript | Articoli Java | Java.HTML.it (visualizza su Google Sidewiki)

venerdì 11 dicembre 2009

Java Idiomatic Patterns

ckjm & JavaNCSS are two opensource tools used for object-oriented metrics and java cyclimatic complexity.
Goood Article on IBM Developerworks

in riferimento a: Evolutionary architecture and emergent design: Harvesting idiomatic patterns (visualizza su Google Sidewiki)

venerdì 4 dicembre 2009

Oracle JDBC Connection string SID vs SERVICE_NAME

For sid use this :

jdbc:oracle:thin:@server:1521:SID


For service name this :

jdbc:oracle:thin:@//server:1521/SERVICE_NAME

in riferimento a:

"jdbc:oracle:thin:@//server:1521/SERVICE_NAME"
- Oracle SID != SERVICE_NAME - Rob@Rojotek (visualizza su Google Sidewiki)

sabato 28 novembre 2009

Good Article on Struts 2 on Google Appengine

Google Latitude

Permette ai tuoi amici di sapere dove sei in tempo reale.

in riferimento a: Google Latitude (visualizza su Google Sidewiki)

venerdì 27 novembre 2009

Generate Random Numbers in a range using Java


public final class RandomInteger {

public static final void main(String... aArgs){
log("Generating 10 random integers in range 0..99.");

//note a single Random object is reused here
Random randomGenerator = new Random();
for (int idx = 1; idx <= 10; ++idx){
int randomInt = randomGenerator.nextInt(100);
log("Generated : " + randomInt);
}

log("Done.");
}

private static void log(String aMessage){
System.out.println(aMessage);
}
}

in riferimento a:

"public final class RandomInteger { public static final void main(String... aArgs){ log("Generating 10 random integers in range 0..99."); //note a single Random object is reused here Random randomGenerator = new Random(); for (int idx = 1; idx <= 10; ++idx){ int randomInt = randomGenerator.nextInt(100); log("Generated : " + randomInt); } log("Done."); } private static void log(String aMessage){ System.out.println(aMessage); } }"
- Java Practices -> Generate random numbers (visualizza su Google Sidewiki)

martedì 24 novembre 2009

JSP Redirecting Page based on client device

By user agent you can determine
client type.

<pre name=code class=java>
<%!
public String[] mobileTags = { "cellphone",
"iemobile",
"midp",
"mini",
"mmp",
"mobile",
"nokia",
"pda",
"phone",
"pocket",
"ppc",
"psp",
"symbian",
"up.browser",
"up.link",
"wap",
"windows ce" };

public Boolean isMobile( String browserInfo )
{
for ( int n=0; n<mobileTags.length; n++ )
{
if ( browserInfo.toLowerCase().contains(
mobileTags[n].toLowerCase() ) )
{
return true;
}
}
return false;
}
%>
<%
String bInfo = (String)request.getHeader( "User-Agent" );

if ( isMobile( bInfo ) )
{
response.sendRedirect( "mobile.jsp" );
}
else
{
response.sendRedirect( "home.jsp" );
}
%>
</pre>

mercoledì 18 novembre 2009

Tutorial no Appengine in Eclipse

Embedded OC4J Process Detected

you should try to kill by task manager all java.exe o javaw.exe proccesses.

in riferimento a: OTN Discussion Forums : Orphan Embedded OC4J Process Detected ?? ... (visualizza su Google Sidewiki)

lunedì 16 novembre 2009

Il Nuovo sito personale

Informazioni utili su "Vincenzo Amoruso .........................................................................................software, java, JAVA, J2SE, J2ME, J2EE, JSP, Servlet, UMTS, iSeries, ibm, gestionale, sviluppo, consulenza privacy, nuovo codice privacy Dlgs 196/2003, s".

Per scrivere una voce relativa a una parte specifica della pagina, evidenzia le parole di tale parte nella pagina.

in riferimento a: Vincenzo Amoruso .........................................................................................software, java, JAVA, J2SE, J2ME, J2EE, JSP, Servlet, UMTS, iSeries, ibm, gestionale, sviluppo, consulenza privacy, nuovo codice privacy Dlgs 196/2003, s (visualizza su Google Sidewiki)

Java Other way to split string and add it to Vector


public void decompattaBufferAggiungiCausali(String buffer,Vector listaCausali){
for (int j=0;j<98;j++) {
String causale=buffer.substring(j*3,(j+1)*3);
if (causale.trim().length()>0) listaCausali.add(causale);
}

}

in riferimento a: Split a string using String.split() - Real's Java How-to (visualizza su Google Sidewiki)

String split to specified length


public static String[] slice(String str, int maxLength)
{
Pattern p = Pattern.compile(".{1," + maxLength + "}");
Matcher m = p.matcher(str);
List result = new ArrayList();
while (m.find())
{
result.add(m.group());
}
return result.toArray(new String[result.size()]);
}

in riferimento a: Java Programming - How do I split a string into chunks of a specified length? (visualizza su Google Sidewiki)

domenica 15 novembre 2009

Con side Sidewiki condividi il web

Con Sidewiki condividi le cose migliori del web con gli amici.
Ottimo strumento.

in riferimento a: Google Sidewiki (visualizza su Google Sidewiki)

sabato 14 novembre 2009

Nuovo CMS powered by Joomla

Informazioni utili su "Benvenuto in Joomla".

Per scrivere una voce relativa a una parte specifica della pagina, evidenzia le parole di tale parte nella pagina.

in riferimento a: Benvenuto in Joomla (visualizza su Google Sidewiki)

Nuovo Sito per corsi on line

Tutti i corsi on line

in riferimento a: Vincenzo Amoruso - Online Training (visualizza su Google Sidewiki)

venerdì 13 novembre 2009

Spreadsheet Dojo Widget

Emulate excel by dojo Widget

in riferimento a: Spreadsheet dojo widget (visualizza su Google Sidewiki)

mercoledì 11 novembre 2009

Sort HahMap by TreeMap


HashMap listaPianificazione = new HashMap();
....
....
public AbstractList accodaPianificazioneFerieTemporanea(AbstractList gl) {
if (listaPianificazione!=null)) {
TreeMap m=new TreeMap(listaPianificazione);
Iterator iterator = m.values().iterator();
ArrayList l,l1;
while( iterator. hasNext() ){

l=(ArrayList)iterator.next();
if (l!=null) {
gl.add(l);
}
}
}
return gl;
}

in riferimento a: TreeMap (Java 2 Platform SE v1.4.2) (visualizza su Google Sidewiki)

martedì 10 novembre 2009

Sorted HashMap


public HashMap getSortedMap(HashMap hmap)
{
HashMap map = new LinkedHashMap();
List mapKeys = new ArrayList(hmap.keySet());
List mapValues = new ArrayList(hmap.values());
hmap.clear();
TreeSet sortedSet = new TreeSet(mapValues);
Object[] sortedArray = sortedSet.toArray();
int size = sortedArray.length;
// a) Ascending sort

for (int i=0; i

in riferimento a: Collections: Lists, Sets, and Maps - how to sort a hashmap using its key? [Locked] (visualizza su Google Sidewiki)

venerdì 6 novembre 2009

Array Search Text


Arrays.sort(array);
printArray("array ordinato", array);
int index = Arrays.binarySearch(array, 2);
System.out.println("Trovato 2 alla posizione :" + index);

in riferimento a:

"int index = Arrays.binarySearch(array, 2); System.out.println("Found 2 @ " + index);"
- Array Search Test : Arrays « Collections Data Structure « Java (visualizza su Google Sidewiki)

giovedì 5 novembre 2009

mercoledì 4 novembre 2009

Create java email Template

// Grab the email template. 
InputStream template = 
getServlet() 
.getServletConfig() 
.getServletContext() 
.getResourceAsStream( 
"/WEB-INF/email/registrationNotification.xml"); 

EmailTemplate notification = EmailTemplate.getEmailTemplate(template); 

// Create the section of the email containing the actual user data. 
String[] args = { "Rafe" }; 

EmailSender.sendEmail("mail@mail.com", notification, args);
in riferimento a:
"// Grab the email template. InputStream template = getServlet() .getServletConfig() .getServletContext() .getResourceAsStream( "/WEB-INF/email/registrationNotification.xml"); EmailTemplate notification = EmailTemplate.getEmailTemplate(template); // Create the section of the email containing the actual user data. String[] args = { "Rafe" }; EmailSender.sendEmail("rafe@rafe.us", notification, args);"
- Creating Email Templates with XML - O'Reilly Media (visualizza su Google Sidewiki)

martedì 3 novembre 2009

Java HashMap sorting

You can ure TreeMap for sorting your HashMap :

Map miaTreeMap = new TreeMap(miaHashMap);

in riferimento a: HashMap sorting (Java in General forum at JavaRanch) (visualizza su Google Sidewiki)

Conditional Insert if exist

INSERT INTO sometable
SELECT "code","description"
FROM DUAL
WHERE NOT EXISTS 
(
SELECT 1
FROM sometable
WHERE column1 = "code"
AND column2 = "description"
);

in riferimento a: ORACLE DECODE CASE SQL PL/SQL (visualizza su Google Sidewiki)

Servizio Notifica vincite via mail ,chat etc..etc..

Java HashMap reading using Iterator


Example :

HashMap hm = new HashMap();
ArrayList l;
Iterator iterator = hm.values().iterator();
while( iterator. hasNext() ){

l=(ArrayList)iterator.next();
......
.....
}

in riferimento a: g - Cerca con Google (visualizza su Google Sidewiki)

lunedì 2 novembre 2009

Intercept IE browser closing by Javascript

<--head>

<--/head>
<--body>
..
<--/body>











From original post from Microsoft:
http://msdn.microsoft.com/en-us/library/ms536907(VS.85,classic).aspx

in riferimento a: http://wincheck123.appspot.com/wincheck/winforlife (visualizza su Google Sidewiki)

venerdì 30 ottobre 2009

vbscript : Automated Email sending

Const cdoSendUsingPickup = 1 'Send message using the local SMTP service pickup directory. 
Const cdoSendUsingPort = 2 'Send the message using the network (SMTP over the network). 

Const cdoAnonymous = 0 'Do not authenticate
Const cdoBasic = 1 'basic (clear-text) authentication
Const cdoNTLM = 2 'NTLM

Set objMessage = CreateObject("CDO.Message") 
objMessage.Subject = "Example CDO Message" 
objMessage.From = "blabla@gmail.com" 
objMessage.To = "blabla@gmail.com" 
objMessage.TextBody = "This is some sample message text." 

'==This section provides the configuration information for the remote SMTP server.
'==Normally you will only change the server name or IP.
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 

'Name or IP of Remote SMTP Server
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"


'Type of authentication, NONE, Basic (Base64 encoded), NTLM
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 3

'Server port (typically 25)
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 587 

'Your UserID on the SMTP server
'objMessage.Configuration.Fields.Item _
'("http://schemas.microsoft.com/cdo/configuration/sendusername") = "blabla"

'Your password on the SMTP server
'objMessage.Configuration.Fields.Item _
'("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "mypass"

'Use SSL for the connection (False or True)
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True

'Connection Timeout in seconds (the maximum time CDO will try to establish a connection to the SMTP server)
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60


objMessage.Configuration.Fields.Update

'==End remote SMTP server configuration section==


objMessage.Send

in riferimento a: g - Cerca con Google (visualizza su Google Sidewiki)

vbscript That list pc network connections

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & _
"\root\microsoft\homenet")

Set colItems = objWMIService.ExecQuery("Select * from HNet_Connection")

For Each objItem in colItems
Wscript.Echo "GUID: " & objItem.GUID
Wscript.Echo "Is LAN Connection: " & objItem.IsLANConnection
Wscript.Echo "Name: " & objItem.Name
Wscript.Echo "Phone Book Path: " & objItem.PhoneBookPath
Next

in riferimento a: g - Cerca con Google (visualizza su Google Sidewiki)

Google XMPP gTalk Notifier

Example :
package com.vincenzoamoruso.notifier;

import java.util.logging.Logger;

import com.google.appengine.api.xmpp.JID;
import com.google.appengine.api.xmpp.Message;
import com.google.appengine.api.xmpp.MessageBuilder;
import com.google.appengine.api.xmpp.SendResponse;
import com.google.appengine.api.xmpp.XMPPService;
import com.google.appengine.api.xmpp.XMPPServiceFactory;


public class XMPPNotifier {
private static final Logger log = Logger.getLogger(XMPPNotifier.class.getName());

public boolean sendXMPP(String toID,String Message,boolean tryByMail){
JID jid = new JID(toID);
String msgBody = Message;
Message msg = new MessageBuilder()
.withRecipientJids(jid)
.withBody(msgBody)
.build();
boolean messageSent = false;
XMPPService xmpp = XMPPServiceFactory.getXMPPService();
if (xmpp.getPresence(jid).isAvailable()) {
SendResponse status = xmpp.sendMessage(msg);
messageSent = (status.getStatusMap().get(jid) == SendResponse.Status.SUCCESS);
}
if (!messageSent) {
System.out.println("Non Inviato");
log.warning("Non Inviato");
}
return messageSent;
}
}

in riferimento a: g - Cerca con Google (visualizza su Google Sidewiki)

Formatting Date in JSP

1) Import classes in JSP Page
<%@ page import="java.text.DateFormat" %>
<%@ page import="java.text.SimpleDateFormat" %>

2) Inizialize object and define date format
DateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");

3) Format date value
"<%=formatter.format(new Date()) %>"

in riferimento a: g - Cerca con Google (visualizza su Google Sidewiki)

Formatting Date JSP

1) Import classes in JSP Page
<%@ page import="java.text.DateFormat" %>
<%@ page import="java.text.SimpleDateFormat" %>

2) Inizialize object and define date format
DateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");

3) Format date value
"<%=formatter.format(new Date()) %>"

in riferimento a: g - Cerca con Google (visualizza su Google Sidewiki)

Wincheck Online on Google AppEngine

sabato 24 ottobre 2009

Available memory from Vbs

Available memory from Vbs
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer &
"\root\CIMV2")
Set colCSItems = objWMIService.ExecQuery("SELECT * FROM
Win32_ComputerSystem")
For Each objCSItem In colCSItems 
WScript.Echo "Total Physical Memory: " &
objCSItem.TotalPhysicalMemory
Next
Set colOSItems = objWMIService.ExecQuery("SELECT * FROM
Win32_OperatingSystem")
For Each objOSItem In colOSItems 
WScript.Echo "Free Physical Memory: " &
objOSItem.FreePhysicalMemory 
WScript.Echo "Total Virtual Memory: " &
objOSItem.TotalVirtualMemorySize 
WScript.Echo "Free Virtual Memory: " &
objOSItem.FreeVirtualMemory 
WScript.Echo "Total Visible Memory Size: " &
objOSItem.TotalVisibleMemorySizeNext

Vbs starts Windows Services

This script start windows Service :

set myServices = GetObject("winmgmts:")
set myObject = myServices.Get("Win32_Service.Name='MSSQLSERVER'")
myObject.StartService()

IE vbs robot Browser - reading key in text file

Read text file named "Cerca.txt

On Error Resume Next
DO
Set fso = WScript.CreateObject("Scripting.FileSystemObject")
Set file = fso.OpenTextFile( "Cerca.txt", 1, False, 0)
Do While file.AtEndOfStream <> True
set objExplorer=WScript.CreateObject("InternetExplorer.Application","objExplorer_")
objExplorer.navigate2("http://www.google.it")
objExplorer.ToolBar = 0
objExplorer.StatusBar = 0
objExplorer.Left = 0
objExplorer.Top = 0
objExplorer.Visible = 1
Do Until
objExplorer.ReadyState=4
WScript.Sleep inti*100*Rnd()
Loop
objExplorer.Document.All.Item("q").Value = file.ReadLine
objExplorer.Document.All.Item("sa").Click
Do Until
objExplorer.ReadyState=4
WScript.Sleep inti*100*Rnd()
Loop
WScript.Sleep
inti*100*Rnd()
Loop
objExplorer.Quit
file.Close()
Set file=Nothing
Set fso=Nothing
inti = inti + 1
Loop Until inti = 1300
Wscript.Quit
 

Massive string in file sustitution by vbs script

Massive string in file sustitution by vbs script :


' Script per Sostituzione di massa stringhe in file

' Massive text in file substution

Set oFSO = CreateObject("Scripting.FileSystemObject")Set
objShell = WScript.CreateObject( "WScript.Shell" )
Set fOut = oFSO.CreateTextFile("StringInFileSubstitution.txt", True)
Dim FileName, Find,
ReplaceWith, FileContents, dFileContents, PathDir

Dim NomeP

Dim OutPut


'Modifica file nella cartella
Find = Inputbox ("Inserisci la stringa da cercare nei file","The Patcher","pippo")
ReplaceWith = Inputbox ("Inserisci la stringa da sostituire a " + Find ,"The Patcher","pippa")
PathDir = Inputbox ("Inserisci il path da cui partire","The
Patcher","C:\Test1")
DoStuff oFSO.GetFolder(PathDir).Path,Find,ReplaceWith

'Read text file

function Fix(FileName, Find, ReplaceWith)
'Read source text
fileFileContents = GetFile(FileName)
'replace all string In the source
filedFileContents = replace(FileContents, Find, ReplaceWith, 1, -1, 1)
'Compare source And result

if dFileContents <> FileContents
Then

'write result If different

WriteFile FileName, dFileContents
If Len(ReplaceWith) <> Len(Find) Then 'Can we
count n of replacements? fOut.WriteLine "DB " & FileName & "
file Fixed." fOut.WriteLine _ (
(Len(dFileContents) - Len(FileContents)) / (Len(ReplaceWith)-Len(Find)) ) &
_ " fixes Applied."

End

IfElse ' fOut.WriteLine "No
Fixes Applied to source file " & FileNameEnd If
End Function

'Read text file

function GetFile(FileName)

If FileName<>""
Then Dim FS, FileStream Set FS =
CreateObject("Scripting.FileSystemObject")

on error resume Next

Set FileStream = FS.OpenTextFile(FileName)

GetFile = FileStream.ReadAll End IfEnd Function
'Write string As a text file.

function WriteFile(FileName, Contents)

Dim OutStream, FS
on error resume Next

Set FS = CreateObject("Scripting.FileSystemObject")

Set OutStream = FS.OpenTextFile(FileName, 2, True)

OutStream.Write Contents

End

Function Sub DoStuff(sDir,Find,ReplaceWith)

fOut.WriteLine sDirSet

oDir = oFSO.GetFolder(sDir)
For Each i In oDir.Filesf=Fix(i.Path, Find, ReplaceWith)

Next
For Each i In oDir.SubFolders

DoStuff i.Path,Find,ReplaceWithNext
fOut.WriteLine ""'

For Each i In oDir.SubFolders'DoStuff i.Path'

Next

End Sub


domenica 4 ottobre 2009

RDP command Connect to Console session

mstsc 1 -v:server /F -console /admin

sabato 16 maggio 2009

Oracle PL/SQL dual Table

Create update script of TABLEA based on fields of TABLEB.

Oracle PL/Sql Script :

set heading off
set pagesize 50000
set echo off
set trims on
set verify off
set feed off
set linesize 2000 

Spool &&FILE_NAME; select '-- Dati creati il 'to_char(sysdate,'dd/mm/yyyy hh24:mi') from dual; select '-- Inzio Scarico Tabella -- ' from dual; select 'update TABLEA set FIELDA=' FIELDB ' WHERE KEYA=''CHIAVE"; ' FROM TABLEB &&WHERE_CLAUSEB. ; select '-- Fine Scarico Tabella -- ' from dual;   select 'exit;' from dual; Spool off;