Tuesday, June 14, 2011

SSH + SOCKS Proxy

The easiest way to circumvent a filtering gateway is to send all your data encrypted. If you have access to an openssh server, you can easily create a SOCKS proxy by using -D flag in the openssh client and send your data through it:

ssh -D 8080 username@your-server

This command creates a tunnel between your machine and your-server on port 8080. To be able to use this tunnel to send your data, you should also configure the proxy setting in your browser. To do this in Firefox, for example, go to Edit -> Preferences -> Advanced -> Network -> Connection setting, select Manual proxy configuration, and in the SOCKS Host text box, enter your local address, e.g., 127.0.0.1, and in the Port text box, enter the port number you had used in the ssh command, e.g., 8080 in our example.

Saturday, May 7, 2011

Fullscreen flash crash in Ubuntu

Recently I've had this problem that my flash player in firefox/chrome crashes when I change it to full-screen mode. After searching for a while, I found that it has something to do with the libGL library. To solve this problem, you should reload this library before running firefox or chrome as shown in the following command:

# LD_PRELOAD=/usr/lib/mesa/libGL.so.1 firefox

However, in the older versions of Ubuntu, e.g., 8.04, you should run the following command instead:

# LD_PRELOAD=/usr/lib/libGL.so.1 firefox

Friday, May 6, 2011

How to embed fonts in a pdf file

Usually one of the reasons that your camera-ready paper can not pass the format check through the sites like IEEE PDF eXpress, is that any of the fonts Times-Italic, Times-Roman, Times-BoldItalic, Times-Bold, Helvetica, or Courier are not embedded. To examine the fonts actually used in a PDF file, and check if they are embedded correctly you can use the following command: pdffonts file.pdf
Here is the solution to embed the fonts into a PDF file:

latex file.tex
bibtex file
latex file.tex
latex file.tex
dvips -Ppdf -G0 -tletter file.dvi
ps2pdf -dCompatibilityLevel=1.4 -dPDFSETTINGS=/prepress file.ps file.pdf

Source: here

Saturday, March 17, 2007

Installing TTF Fonts in GNOME

1. Open a nautilus window. Type "fonts:///".

2. Open another nautilus window. Browse to the directory where your ttf fonts are.

3.
Drag and drop ttf fonts from your font window (Step 2) to main font window (Step 1).
Notice: You wont see the dropped files immediately in nautilus.

4.
Now you should see the fonts in .fonts directory in your home directory.

5.
Logout.

Sunday, March 11, 2007

Axis, SOAP and Stateful Session

Axis supports two ways of managing sessions: SOAP header and HTTP cookie. Here we explain how to manage session with SOAP header.
Axis comes a handler called org.apache.axis.handlers.SimpleSessionHandler that provides SOAP header based session management. To use the simple session handler with the Web service, you have to tell the Axis framework to add the handler into the handler chain. To do this you can define a WSDD file that contains the extra configuration that your Web service will use and then deploy the configuration by using the Axis deployment tool.
The WSDD file should be like this (e.g. deploy.wsdd):

<deployment xmlns="http://xml.apache.org/axis/wsdd/" xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">

<handler name="session" type="java:org.apache.axis.handlers.SimpleSessionHandler"/>
<service name="Sessions" provider="java:RPC" style="wrapped">
<namespace>your name space</namespace>
<requestFlow>
<handler type="session"/>
</requestFlow>
<responseFlow>
<handler type="session"/>
</responseFlow>
<parameter name="className" value="your class file to be stateful"/>
<parameter name="allowedMethods" value="*"/>
</service>

</deployment>
"your name space" is the name of namespace which you like to use for your service. It can be something like: http://localhost:8080/axis/services/flight, and "your class file to be stateful" is the name of class which you like to be stateful. This also can be something like: ticket.Flight.
After creating the WSDD file, first you should copy the .class file of your serive into Axis subdirectory under Tomcat installation path (e.g. <tomcap path>/webapps/axis/WEB-INF). You can do this task in two ways: copy the class file directly to classes subdirectory of Axis, or create a jar file of your class and then copy it to lib subdirectory of Axis.
After copying the class file or jar file into Axis, you can deploy your WSDD as follow:

java org.apache.axis.client.AdminClient deploy.wsdd

Notice before calling this command, add Axis libs to your CLASSPATH and also start your Tomcat.
Then if you write a test client to call your service, the reply from service should have a SOAP header similar to:

<soapenv:Header>
<ns1:sessionID soapenv:actor="" soapenv:mustUnderstand="0" xsi:type="xsd:long"
xmlns:ns1="http://xml.apache.org/axis/session">
-1919645576528915916
</ns1:sessionID>
</soapenv:Header>

Source: JavaPro

Saturday, February 17, 2007

How to setup JUDDI and MySql

1. Copy MySql driver to correct path, for example mysql-connector-java-5.0.4-bin.jar to <tomcat-path>/common/lib

2. Create context.xml file and copy to
<tomcat-path>/webapps/juddi/META-INF
<Context path="juddi" docBase="juddi" debug="5" reloadable="true" crossContext="true">
<Resource name="jdbc/juddiDB" auth="Container" type="javax.sql.DataSource"
username="<your-db-user>" password="<your-passwd>" driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/juddi?autoReconnect=true"
validationQuery="select count(*) from PUBLISHER" />
</Context>

3. Execute crearte_database.sql (a given file in JUDDI package at sql/mysql subdirectory).

4. Change insert_publisher.sql (the path is the same as step 3):
INSERT INTO PUBLISHER (PUBLISHER_ID, PUBLISHER_NAME, EMAIL_ADDRESS, IS_ENABLED, IS_ADMIN)
VALUES ('<your-db-user>', '<your name>', '<your email>', 'true', 'true');

5. Adding your-db-user in MySql:
GRANT ALL PRIVILEGES ON *.* TO '<your-db-user>'@'localhost' IDENTIFIED BY '<your-passwd>' WITH GRANT OPTION;