I have searched for azan ogg files to run on my minbar program on ubuntu but i didn’t find any azan on ogg format. I have converted some mp3s azan to ogg files. you can find it here:
November 14, 2009
Minbar , Athan ogg, azan ogg , mecca azan ogg
Posted by Mostafa under Islam, personalLeave a Comment
July 26, 2009
Spring JAX-WS integration: Invocation of init method failed Error
Posted by Mostafa under Development, JAX-WS, Java, Spring | Tags: Java, JAX-WS, Spring |Leave a Comment
when i tried to manage DI JAX-WS web services by configuring them as beans in Spring application context xml file like this:
<bean class=”org.springframework.remoting.jaxws.SimpleJaxWsServiceExporter” />
<bean id=”partyService” class=”com.nilesys.ocean.services.party.PartyServiceImpl” >
<property name=”partyDAO” ref=”partyDAO”/>
</bean>
I got this exception:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘org.springframework.remoting.jaxws.SimpleJaxWsServiceExporter#0′ defined in ServletContext resource [/WEB-INF/spring-conf/services.xml]: Invocation of init method failed; nested exception is java.lang.UnsupportedOperationException: NOT SUPPORTED
after 4 hours of googing and searching i figured out that adding lazy-init=”true” to the SimpleJaxWsServiceExporter bean will solve the problem like this:
<bean class=”org.springframework.remoting.jaxws.SimpleJaxWsServiceExporter” lazy-init=”true” />
<bean id=”partyService” class=”com.nilesys.ocean.services.party.PartyServiceImpl” >
<property name=”partyDAO” ref=”partyDAO”/>
</bean>
i wish this could help you as i didn’t found a solution for this exact problem by googling it.
April 4, 2009
Linux remote copy using scp command
Posted by Mostafa under Linux | Tags: Linux, remote copy, scp, secure copy |Leave a Comment
some times you need to copy a file or directory from your machine to another machine using command line, if so you can use the scp command :
suppose that the file needed to be copied /home/mostafa/file.txt, and you have access to the other machine mostafa@nile-sys.com
$ scp /home/mostafa/file.txt mostafa@nile-sys.com:/home/mostafa/
this command will copy the file.txt to the the path /home/mostafa/file.txt in the remote machine nile-sys.com
also you can copy files between 2 remote machine with the same command as follows:
$ scp mostafa@www.nile-sys.com :/home/mostafa/file2.sh mostafa@ns1.nile-sys.com:/home/mostafa
February 2, 2009
Log4j roll log file daily
Posted by Mostafa under Development, Java | Tags: daily, Java, log, log4j, logging, rolling |[2] Comments
sometimes you need to configure the log4j to daily roll the log file, this will help when you trace an error happened in a specific day.
in your log4j.properties file create an appender of type DailyRollingFileAppender:
log4j.appender.R=org.apache.log4j.DailyRollingFileAppender
define the date pattern which will be used in naming the log files:
log4j.appender.R.DatePattern=’-'yyyy-MM-dd’.log’
define the path of your log files:
log4j.appender.R.File=log/application
and configure how logs should appear inside the file:
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L – %m%n
### direct log messages to stdout ###
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L – %m%n
log4j.rootLogger=debug, stdout, R
now you will have a separate log file for every day and will be in path
log/application-yyyy-MM-dd.log
January 29, 2009
setting HTTP header for SOAP message
Posted by Mostafa under Development, Java | Tags: http header, Java, soap |Leave a Comment
To set HTTP header in a SOAP message :
SOAPConnectionFactory factory = SOAPConnectionFactory.newInstance();
SOAPConnection soapConnection =factory.createConnection();
SOAPMessage message = MessageFactory.newInstance().createMessage(null,yourInputStream);
message.getMimeHeaders().addHeader("header name", "header value");
soapConnection.call(message, "server url");
December 24, 2008
Java CORBA Server with sample code
Posted by Mostafa under Development, Java | Tags: corba, corba server, iiop, Java, java corba server, java iiop |1 Comment
In this post will explain how to create a CORBA Java server using the Java sdk.
here a pref. description of what needed to be done:
1- create an idl (Interface Description Language) file that will be the contract between the Server and client regarding the object that needed to be referenced from the client and implemented on the server.
2- generate java skeleton from the idl by using idltojava compiler or idlj.
3- create the concrete class that will be instantiated by the server and its objects referenced by the client.
4- instantiate an ORB object to handle all Marshalling and un-Marshalling for the object calls and all IIOP stuff.
5- create naming context object.
6- create naming component for the object that will be exposed by CORBA.
7- bind the object with the name component in the name context.
the following the a sample code for the above steps:
1- create an IDL file: create a file and name it helloWorld.idl and add the following lines into it:
——————————————————-
module helloWorld {
interface Greetings {
string sayHello();
};
};
———————————————————————
in this idl we define one interface called Greetings that interface has one method or operation called sayHello and will return a String.
2- generate server skeleton from the idl by idlj:
in your terminal go to the directory contains the idl file and run the following command
$ idlj -fserver -oldImplBase helloWorld.idl
the idlj will create the following:
- Greetings interface.
- GreetingsOperations class.
- _GreetingsImplBase class.
3- create a concrete class contains your business:
you need now to create the concrete class which you need its objects to be exposed through CORBA. To do so you need to create GreetingsServer class that extend the _GreetingsImplBase class.
by extending _GreetingsImplBase class you need to implement the sayHello method, here is code sample:
——————————————————————————————–
public class GreetingsServer extends _GreetingsImplBase {
public String sayHello () {
return ” Hello CORBA”;
}
}
———————————————————————————————–
save this class and create a new class the will run as the server for IIOP calls name the new class CorbaServer
————————————————————————————————–
package Corba;
import org.omg.CORBA.ORB;
import org.omg.CORBA.Object;
import org.omg.CORBA.ORBPackage.InvalidName;
import org.omg.CosNaming.NameComponent;
import org.omg.CosNaming.NamingContext;
import org.omg.CosNaming.NamingContextHelper;
import org.omg.CosNaming.NamingContextPackage.AlreadyBound;
import org.omg.CosNaming.NamingContextPackage.CannotProceed;
import org.omg.CosNaming.NamingContextPackage.NotFound;
public class CorbaServer {
/**
* @param args
*/
public static void main(String[] args) {
// 4- create ORB object
ORB orb = ORB.init(args, null);
// create an instance of the GreetingsServer , this instance will be exposed by the ORB
GreetingsServer greetings = new GreetingsServer();
// register the instance to ORB object
orb.connect(greetings);
try {
// create naming context root, the NameService is the root NameService for any ORB
Object initNameService = orb.resolve_initial_references(“NameService”);
// narrowing the naming service object
NamingContext ncRef = NamingContextHelper.narrow(initNameService);
// create a name component for the GreetingsServer object
NameComponent nc = new NameComponent(“Greetings”,”");
// create name component array that will hold the greeting name component
NameComponent[] path = {nc};
// bind the greetings object with name component
ncRef.rebind(path, greetings);
// to keep the application waiting for calls
Thread.currentThread().join();
} catch (InvalidName e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (NotFound e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (CannotProceed e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (org.omg.CosNaming.NamingContextPackage.InvalidName e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
————————————————————————————-
now you have the CORBA server we need to run the naming service that will be used by the CORBA server
$ tnameserv
this will start the naming service
at last you can start your CORBA server name and wait for calls from corba clients that used your idl.
references:
http://members.tripod.com/gsraj/corba/chapter/javaidl_1.html — this was very helpful to me.
http://java.sun.com/j2se/1.4.2/docs/guide/corba/index.html
August 25, 2008
Set tomcat memory heap size
Posted by Mostafa under Development, Java, Linux | Tags: java heap size, tomcat |[39] Comments
when you are using tomcat as you application server for not small application you can easy get (out of memory exception). this is because the default heap size tomcat use is small and suitable only for small web applications.
to set the start and maximum heap size run the following command before starting your tomcat:
export CATALINA_OPTS=”-Xms256m -Xmx512m”
or
export JAVA_OPTS=”-Xms256m -Xmx512m”
this will create environment variable called CATALINA_OPTS or JAVA_OPTS contains the required options to make tomcat start heap size 256M and maximum heap size 512M.
August 24, 2008
Struts, Tomcat connection pooling
Posted by Mostafa under Development, Java, Linux | Tags: connection pooling, struts, tomcat |[6] Comments
In this post I’ll talk about how to use connection pooling in struts running on tomcat server:
you will need to edit in the following places:
- META-INF/context.xml
- WEB-INF/web.xml
first you need to add a context.xml file to your application to be used by tomcat application server when defining and creating your application context.
To do that create a folder called META-INF beside your WEB-INF.
in this folder create file and name it context.xml
open this file and add the following code:
<Context path=”/yourAppPath” docBase=”yourAppDocBase“
debug=”5″ reloadable=”true” crossContext=”true”>
<Resource name=”jdbc/resourceName” auth=”Container” type=”javax.sql.DataSource”
maxActive=”100″ maxIdle=”10″ maxWait=”10″
username=”userName” password=”Password” driverClassName=”com.mysql.jdbc.Driver”
url=”jdbc:mysql://localhost:3306/DatabaseName?autoReconnect=true”/>
</Context>
replace names in Bold with your application parameters resourceName is the name of the datasource that you will use. the previous code creates a new database resource on your application context.
now you need to create a reference to the created resource. edit your web.xml and add the following code:
<resource-ref>
<description>DB Connection</description>
<res-ref-name>jdbc/resourceName</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
replace names in Bold with your application parameters.
now you only need to know how to get the datasource from your code:
Context ctx = new InitialContext();
DataSource ds = (DataSource) ctx.lookup(“java:comp/env/jdbc/resourceName“);
Connection connection = ds.getConnection();
and you can enjoy using the new connection
I wish that I made this topic clear and I’ll be happy to receive your comments and questions.
August 16, 2008
finally e-archive (earth project) version 1 has been finished and implemented on synergy egypt. it is very nice to have your own product.
e-archive is document repository system and information strutcured repository system.