Workaround for Ubuntu Wifi Hidden Networks

I am a happy linux ubuntu user (actually I starded many years ago with a wonderul slackware distro!) but….sometimes connecting ti hidden wpa networks seems to be a nightmare! Despite several distribution updates this issue still seems to be a bug. On launchpad there are many duplicated bugs on such issue on several Ubuntu distributions (kernel updates and Network Manager interaction?).

I am trying to build a workaround using python and Qt library, the idea is to force essid injection into Gnome Network Manager. I am a newbie on Qt development so the Gui is very simple and needs to be optimized but here on my Ubunto 10.10 64bit works fine: I am able to connect to my hidden wpa2 office network! Here is a screenshot of this simple Python application:

Needs root password in order to run iwconfig, select first your network interface and on SSID selection the application will run the connection.

On connection established you can close the application and start using your hidden wifi connection. Sources are on sourceforge just in case someone would like to improve the code!

Onlinerel Facebook Twitter Myspace Friendfeed Technorati del.icio.us Digg Google Yahoo Buzz StumbleUpon

Posted in Codice binario | Tagged , | Leave a comment

Send a request to Servlets without using a browser

Sending requests to a servlets sometimes equals to produce a very high overhead on networks….”should i use rmi or a soap architecture?”. Soap is an elegant solution with some complexity while rmi introduces overhead. Why not use a simple http bus to send your request (without using any httpclient library)? This library opens an http channel towards a remote servlet. Request are sent using post http. You can send almost everything because the constructor accepts a Map containing all parameters you would like to send to servlet (key-value but the value can be also a json!). Parameters are url encoded using utf-8. For example:

1
2
3
4
5
6
7
Map<String,String> paramsHttp = new HashMap<String,String>();
String jsonString ="A very logn json you create using whatever library you prefer!"
paramsHttp.put("jsonString", jsonString);
Interface message = new buildMessage4Servlet(parametriHttp);
String serviceURL="http://localhost:8080/ServletJsonReq/GetJsonParameters";
InterfaceBus bus  = new HttpServletBus( serviceURL );
response = message.send(bus); // try catch here!

Code is available here on sourceforge released under GNU General Public License (GPL) , netbeans project checkout here:

svn co https://httpservletbus.svn.sourceforge.net/svnroot/httpservletbus httpservletbus
Onlinerel Facebook Twitter Myspace Friendfeed Technorati del.icio.us Digg Google Yahoo Buzz StumbleUpon

Posted in Codice binario | Leave a comment

Outlook webmail and Linux: owamailcheck

Sometimes someone strange decide to switch from simple, light smtp mail server to Exchange…unfortunately the last one which is not recognized by your Evolution plugin :( !

It happened to me at work…again the power of python and a good python developer helped me! Owamailcheck is a python application written by a review of weboutlook code.

The most important thing I needed was just a check for new e-mails from my company mailbox, so owamailcheck connects to your webmail and parses the html page for “new mail” tag. In case of a positive match sends you a mail (obviously using a simple local smtp server).

Onlinerel Facebook Twitter Myspace Friendfeed Technorati del.icio.us Digg Google Yahoo Buzz StumbleUpon

Posted in Codice binario | Tagged , , , | Leave a comment

Food for Numbers: happycapretta project

Python programming is growing…and a fresh happy capretta was born just for give you some lucky numbers!
Happycapretta is a python web service written using Google App Engine a very useful service offered by Google! I am not working for Google but let me say this is a good start of point for improve your programming skills! My Capretta (which is happy if you give some good digital food!) takes any kind of file with size less or equal than 1 Mb and eat it: digestion means it opens the file in binary mode, it reads the bit (foodbit ;) stream and generate a pseudo-casual sequence of numbers between 1 and 90. What can you do with this number? I don’t know…guess! Here is the link

Onlinerel Facebook Twitter Myspace Friendfeed Technorati del.icio.us Digg Google Yahoo Buzz StumbleUpon

Posted in Codice binario, Codice culinario | Tagged , , | Leave a comment

SED Tips!

Let me introduce Mr. Sed, powerful, easy and funny !

Delete line 8 of file myfile.txt

sed '8 d' myfile.txt > myfile_new.txt

Or would you like to remove first 10 characters of each line if followed by a space ?

sed 's/^... //g' myfile.txt

Let’s delete first 8 characters of each line :

sed 's/^.\{8\}//g' myfile.txt

Need to remove first 8 characters from a file :

sed -s 's/^[a-zA-Z]\{8\}//g' myfile.txt

Note upper and lower case in the regex and ^ character to select the first character of a line.

Onlinerel Facebook Twitter Myspace Friendfeed Technorati del.icio.us Digg Google Yahoo Buzz StumbleUpon

Posted in Codice binario | Tagged , | Leave a comment

Rapidly access to Oracle DB with Java !

Sometimes you need to investigate for a problem on your application, here a very simple standalone java application to access an oracle DB.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class accesso_db_fonia {
  //  An example for accessing to an Oracle DB
 
  public static void main(String[] args) {
 
    try {
            // Step 1
          //  Class.forName("oracle.jdbc.driver.OracleDriver");
          DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());  
            // Step 2
            Connection conn = DriverManager.getConnection
                ("jdbc:oracle:thin:@xxx.yyy.zzz.ttt:port_number:DB_NAME", 
                 "user", "password");
 
            // Step 3
            Statement stmt = conn.createStatement();
 
            // Step 4
            String SQL_stmt = "select columna,columnb from table where condition;
            ResultSet rs = stmt.executeQuery(SQL_stmt);
 
            // Step 5
            while (rs.next()) {
                System.out.println("COLUMN_A      = " + rs.getInt("column_a"));
                System.out.println("COLUMN_B    = " + rs.getString("column_b"));            
            }
 
            // Step 6
            rs.close();
            stmt.close();
            conn.close();
        } catch (SQLException ex) {
            System.out.println(ex.getMessage());
        } catch (java.lang.Exception exl) {
            System.out.println(exl.getMessage());
        }
        System.out.println("Oh, well it worked !");
  }
}
Onlinerel Facebook Twitter Myspace Friendfeed Technorati del.icio.us Digg Google Yahoo Buzz StumbleUpon

Posted in Codice binario | Tagged , | Leave a comment

Multiple file renames Linux Shell

Have you ever been asked to rename a huge list of files ?
Oh well, someone asked to me…unix shell helps you !
Here is how I solved the annoying request…

ls -1rt huge_list_files*.log|while read myfile;do renfile=$(echo $myfile|sed -e s/oldpart_to_change/newpart_to_be_changed/); mv $myfile $renfile;done

It would be better to copy, files you need to rename, in a separate directory !
Hope it helps you !

Onlinerel Facebook Twitter Myspace Friendfeed Technorati del.icio.us Digg Google Yahoo Buzz StumbleUpon

Posted in Codice binario | Tagged , , | Leave a comment

PHP and Oracle alter nls_date_format

Sometimes it is needed to change nls_date_format in Oracle DB, for example you connect to Oracle DB trhow OCI8 in PHP,
it could be difficult to set right nls_date_format during PHP call. Here is how I solved the problem :

Create an Oracle Trigger that sets nls_date_format according to your wishes..

1
2
3
4
5
6
7
CREATE OR REPLACE TRIGGER logon_trigger
AFTER LOGON
ON DATABASE
 
BEGIN
dbms_session.set_nls('nls_date_format','''MM/DD/YYYY HH24:MI:SS''');
END logon_trigger;

you can modify the code for a specific user logon !

Onlinerel Facebook Twitter Myspace Friendfeed Technorati del.icio.us Digg Google Yahoo Buzz StumbleUpon

Posted in Codice binario | Tagged , | Leave a comment

Modify all Oracle tables in a schema

How to delete all Oracle tables in a schema, for example when you need to recreate tables :

1
2
3
select 'drop table '||table_name||' cascade constraints;'
from all_tables
where owner = '<USER NAME>'

or if you need to simply add a column on all tables of a schema :

1
2
3
select 'alter table '||table_name||' add (<column name> <data_type>;'
from all_tables
where owner = '<USER NAME>'

Copy and paste the output of that query and execute as a script, that’s all !

Onlinerel Facebook Twitter Myspace Friendfeed Technorati del.icio.us Digg Google Yahoo Buzz StumbleUpon

Posted in Codice binario | Tagged , , | Leave a comment

Euterpe3 GUI!!

First steps with Python…the first step was an old applescript I developed for sending my listen music on  Last.fm to Skype. The initial idea was to develop an application for both Linux and MacBook using a multithread python app. Murphy’s law is a nice fellow and unfortunately  Euterpe3 only works on Linux  (I sold my MacBook months ago…can’t try to fix!). Working old Mac script was: Continue reading “Euterpe3 GUI!!” »

Onlinerel Facebook Twitter Myspace Friendfeed Technorati del.icio.us Digg Google Yahoo Buzz StumbleUpon

Posted in Codice binario | Tagged , , , | 3 Comments