Archive for the 'Java' Category

executing pl/pgsql function in postgre and java

Thursday, September 20th, 2007

CREATE OR REPLACE FUNCTION squre_root(integer)
RETURNS double precision AS
$BODY$
BEGIN
return SQRT($1);
END; $BODY$
LANGUAGE ‘plpgsql’ VOLATILE;
ALTER FUNCTION squre_root(integer) OWNER TO hede;

to execute this procedure in pgadmin  : select squre_root( 9 );

import java.sql.*;

public class PlSqlTest {
public static void main(String args[]) {
CallableStatement stmt = null;

int a=9;

System.out.println(”\nArray Parameter Test\n”);
try {
Class.forName(”org.postgresql.Driver”);

Connection conn = DriverManager.getConnection(”jdbc:postgresql://localhost/hede”, “hede”,”hede”);

conn.setAutoCommit(false);
stmt = conn.prepareCall(”{?= call squre_root(?)}”);
stmt.registerOutParameter(1, java.sql.Types.DOUBLE);
stmt.setInt(2, a );
stmt.execute();
double result = stmt.getDouble(1);

System.out.println(”\nThe result is ” + result);

conn.close();
}
catch (SQLException se) {
System.out.println(”\nA SQL exception occurred.”);
System.out.println(”\nError code: ” + se.getErrorCode());
System.out.println(”\nSQL state: ” + se.getSQLState());
se.printStackTrace();
}
catch (Exception e) {
System.out.println(”\nSome other exception occurred.\n”);
e.printStackTrace();
}
}
}

openCDS device Management

Thursday, September 6th, 2007

Open cds can dedect device type and automaticaly generates,imports configuration file on opencds Device Creation if a new device is detected, and autoCreate is false the subscriber will be given a “Device Not Supported” message. If autoCreate is true, we’ll gather as much info as possible from the UAProf and populate the device repository. New devices may be quarantined -meaning they can’t be used by subscribers until an administrator processes them in the Catalog Server.A notification email can be sent when a new device is created. If left blank, no emails will be sent.

autoCreate.newDevice=true

quarantine.newDevice=false

newDevice.notification.emailAddress=email@dns

Note:This autoCreate process doesn’t work properly.like Nokia N80 or N73 ,we expect to see openCDS 5.1 version (may be released in September 2007 ).

If you create your application using XMLRPC This can not include create method.

we solve this problem add a jsp file to subscriberportal to compile this jsp use subscriberportalapi.jar.

<%@page import=”com.sun.content.server.subscriberapi.ISystemService”%>
<%@page import=”com.sun.content.server.subscriberapi.ApiServiceFactory”%>
<%@page import=”com.sun.content.server.subscriberapi.IModel”%>
<%@page import=”com.sun.content.server.subscriberapi.ApiUtil”%>
<%@page import=”com.sun.content.server.server.webapps.common.UIHelper”%>
<%@page import=”com.sun.content.server.subscriberapi.IApiContext”%>

<%
String userAgent = request.getHeader(”user-agent”);
System.out.println(”Model Created info:Starting!!!”);

//while using webbrowser it creates more than more mozilla device types

if (!userAgent.startsWith(”Mozilla”)){
try{
ApiUtil.initTransaction();
UIHelper.configureAPI(request);
IApiContext apiContext = UIHelper.getApiContext(request);
UIHelper.configureAPIRequest(apiContext);
ISystemService ss = ApiServiceFactory.getSystemService(null);
IModel newModel = ss.createModel(request);
System.out.println(”Model Created info:Stopping !!!”);
}
catch(Exception e){
e.printStackTrace();
}
finally{
ApiUtil.commitTransaction();
}
}%>

Use redirection turn back to your aplication. this is a nail ( Turkish called ” çakma “) solution.

Java Manyakları Org

Thursday, July 19th, 2007

Bizim cellenityden Hakan İlterin ve manyakları olarak Bir grup kurmuşlar java.manyaklari.org Java ile ilgili vede her türlü manyaklığa açık bir bilgi paylaşım ortamı.

Zapciyiz.biz-m10tv.com yayında

Friday, May 4th, 2007

3-4 ay gibi kısa süre yazdığımız Youtube’un mms ve Uydu televizyonuyla bezenmiş hali yayında. Sonunda !!!

www.zapciyiz.biz