Sunday, January 21, 2007

hacking sierra wireless aircard 555 on suse 10

Since there's a lot of changes from pcmcia-cs to pcmciautils, pcmcia operation suppose to be easier because it now work with hotplug.
That mean when the card got inserted to the laptop, linux will just recognize it in a zap.

But that's just doesn't work for sierra aircard 555 while you using suse 10.
To make your aircard 555 work on suse 10, you need to fiddle around a bit with linux kernel.
Owww and you will need you kernel source because we need to recompile the serial_cs module!
First, make sure when you insert the card to pcmcia slot and the pcmciautils recognize your card
type "pccardctl info" then you should get following output on your shell

ong@saintlucifer:~> pccardctl status
Socket 0:
command 'status' not yet handled by pccardctl
o3ng@saintlucifer:~> pccardctl info
PRODID_1="Sierra Wireless"
PRODID_2="AirCard 555"
PRODID_3="A555"
PRODID_4="Rev 1"
MANFID=0192,a555
FUNCID=6

Then you need to get Aircard cis file from http://www.sierrawireless.com/resources/faq/PC_Card/AirCard555/Aircard_Linux.tar
then run following command

tar xvf Aircard_Linux.tar
cd Aircard_Linux/
cp SW_555_SER.cis /lib/firmware

Then go to your kernel source and find serial_cs.c
Search for following line,

PCMCIA_DEVICE_CIS_MANF_CARD(0x0192, 0xa555, "SW_555_SER.cis"), /* Sierra Aircard 555 CDMA 1xrtt Modem -- pre update */

then we recompile the kernel, after the kernel compilation is finish copy serial_cs.ko that is in drivers/serial and copy it to kernel/drivers/serial (replace the serial_cs.ko if exist) in your kernel module directory than reboot your computer
(if the line above exist on your serial_cs.c on your kernel source, you won't need to recompile the module you can just reboot your computer)
before you reboot your computer do "pccardctl eject" and unplug the aircard from pcmcia slot

After reboot, probe the serial_cs module then the device should be in /dev/ttyS0
Use the minicom to verify it, this what i got on my minicom

at!status
Current band: Cellular Sleep
Current channel: 384
Pilot acquired
Modem has registered

OK


Hope that help, happy hacking ;)

Tuesday, October 10, 2006

failed create midcom

I try to create midcom site, when I run following command

php /usr/local/lib/php/midcom/lib/midgard/admin/sitegroup/bin/create-host.php -u admin -p password --sitegroup_id 0 --topic_midcom midgard.admin.sitewizard --hostname localhost --host_prefix /sitewizard --extend_style template_Midgard --topic_name "Midgard Site Wizard"

I got the following error

PHP Warning: main(/usr/local/lib/php/midcom/lib/midgard/admin/sitegroup/bin/../../../../midcom/helper/hostconfig.php): failed to open stream: No such file or directory in /usr/local/lib/php/midcom/lib/midgard/admin/sitegroup/bin/create-host.php on line 19

Warning: main(/usr/local/lib/php/midcom/lib/midgard/admin/sitegroup/bin/../../../../midcom/helper/hostconfig.php): failed to open stream: No such file or directory in /usr/local/lib/php/midcom/lib/midgard/admin/sitegroup/bin/create-host.php on line 19
PHP Fatal error: main(): Failed opening required '/usr/local/lib/php/midcom/lib/midgard/admin/sitegroup/bin/../../../../midcom/helper/hostconfig.php' (include_path='..:.:/usr/local/lib/php') in /usr/local/lib/php/midcom/lib/midgard/admin/sitegroup/bin/create-host.php on line 19

Fatal error: main(): Failed opening required '/usr/local/lib/php/midcom/lib/midgard/admin/sitegroup/bin/../../../../midcom/helper/hostconfig.php' (include_path='..:.:/usr/local/lib/php') in /usr/local/lib/php/midcom/lib/midgard/admin/sitegroup/bin/create-host.php on line 19


Seem the hostconfig.php is missing. I'll figure out this later on :(

java MessageDigest

If you use MessageDigest in java to encrypt string, you wont get hash like other language does.
So you need to convert the result so that you can compare the hash result with other output that produce by diff language.
Found the function on the java net forum

private static String baToHexString(byte byteValues[]) {
byte singleChar = 0;

if (byteValues == null || byteValues.length <= 0) return null;
String entries[] = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f" };
StringBuffer out = new StringBuffer(byteValues.length * 2);
for (int i = 0; i < byteValues.length; i++) {
singleChar = (byte) (byteValues[i] & 0xF0);
singleChar = (byte) (singleChar >>> 4);
// shift the bits down
singleChar = (byte) (singleChar & 0x0F);
out.append(entries[(int) singleChar]);
singleChar = (byte) (byteValues[i] & 0x0F);
out.append(entries[(int) singleChar]);
}

String rslt = new String(out);

return rslt;

}

table corrupt in mysql

My server just ran out of space recently, so I do some cleanup.
Then my friend complain about several web app act abnormaly, turn out several db on mysql got table corrupt.
The error sound like "Can't open file: 'TableName.MYD'. (errno: 145)"
So to fix it, logon to mysql console, and type "REPAIR TABLE TableName"
And don't forget to select the db first ;)

Tuesday, August 08, 2006

CapitalizeWords.java

I need to make my string sentence to be capitalize on each first character of word, So far haven't find such function that I can use. So made this simple class, incase someone need it. It's GPL so free to use it and modify it.

import java.util.Scanner;
import java.util.ArrayList;
import java.util.Iterator;
import java.lang.StringBuilder;

/**
*
* @author avenpace
* I'm using singleton here so, hope you know what that means ;)
* license under the GPL so free to use, modify and hack whatever you want
* lemme know if this programme benefit you if you had the time
*/

public class CapitalizeWords {
private static CapitalizeWords capinstance;
private CapitalizeWords() {
}

/**
* The method will capitalizing every first character on each word on the String sentence
* This method take two parameter,
* @param source source sentence string that you want to capitalize on the first character if each word.
* @param allword this argument is boolean type, if you give it a true value. Then it will capitalize on first character on eeah word, if you give it with false value, then it would only capitalize the first character on the sentence
*/
public synchronized String capitalize(String source, boolean allword) {
StringBuilder firstletter = new StringBuilder(); StringBuilder reminding = new StringBuilder();
StringBuilder elsource = new StringBuilder(); StringBuilder capword = new StringBuilder();
StringBuilder result = new StringBuilder();
Scanner delimiter = new Scanner(source);
ArrayList explode = new ArrayList();
delimiter.useDelimiter(" ");
while(delimiter.hasNext()){
explode.add(delimiter.next());
}
Iterator itersource = explode.iterator();
if (allword == true) {
while(itersource.hasNext()){
elsource.append(itersource.next().toString());
firstletter.append(elsource.substring(0,1));
reminding.append(elsource.substring(1));
if (itersource.hasNext()) {
capword.append(firstletter.toString().toUpperCase() + reminding.toString().toLowerCase()).append(" ");
} else {
capword.append(firstletter.toString().toUpperCase() + reminding.toString().toLowerCase().trim());
}
result.append(capword);
//reset this buzz objects of stringbuffer
capword.setLength(0);
firstletter.setLength(0);
reminding.setLength(0);
elsource.setLength(0);
}
} else if (allword == false) {
int i = 1;
while(itersource.hasNext()){
elsource.append(itersource.next().toString());
firstletter.append(elsource.substring(0,1));
reminding.append(elsource.substring(1));
if ((i == 1) && itersource.hasNext()) {
capword.append(firstletter.toString().toUpperCase() + reminding.toString().toLowerCase()).append(" ");
} else if(itersource.hasNext()) {
capword.append(elsource.toString().toLowerCase()).append(" ");
} else {
capword.append(elsource.toString().toLowerCase().trim());
}
i++;
result.append(capword);
//reset this buzz objects of stringbuffer
capword.setLength(0);
firstletter.setLength(0);
reminding.setLength(0);
elsource.setLength(0);
}
}
return result.toString();
}

/**
* will give you the singleton instance of this class
*/
public static synchronized CapitalizeWords getInstance() {
if (capinstance == null) {
capinstance = new CapitalizeWords();
return capinstance;
} else {
return capinstance;
}
}
}

Monday, April 17, 2006

Fucked up chaintech and ecs

My pc at home was suddenly broke like 3 month ago before I went to Zagreb. So after doing some hardware test, turn out my 7aivl chaintech without a clear reason got bios corrupt and it onboard vga died. Damn cheap mobo!!!!!
So I went to computer store looking for socket A mobo and finally found it at this computer store named edicom at Harco Mangga dua. So I bought that ECS k7s5a pro. So I install it after got home, and walaaahhh.... that FUCKING brand new mobo not showing any sign of life what so ever, fuck me!!!!!!
So I go back the next day to the store where I bought that damn thing, and the store technician check it and said to me that my Duron proc dead for sure.... WTF!!!!!!
So I went home again, curious with that dumb technicision and check the proc my self using other mobo, and viola..... the proc running just fine, but not in ECS k7s5a pro. I leave it untouch for like 3 month coz I was in Zagreb for the whole time and ECS k7s5a pro still can't run my Duron. When I got home, like one week later, I took it back again to the store, but this time I proove to the technician that my ECS k7s5a pro is fuck. So they service that mobo, again!!!! after a week later I pick it up and ask the technision to test the mobo, it still wont run my Duron but can run other Duron. So I took it back to my house, at least this time the mobo working just fine using other proc.
After carefully looking my Duron carefully, I notice that it had some pencil mark.... just remember that I was unlock the proc multiplier using pencil trick and forgot to erase it. So that stupid ECS got confuse to recognize my Duron correctly. So i erase the pencil mark and finally my Duron got recognize by the mobo.... yeah silly me :D
But I still thing that ECS is bad mobo coz that brand new mobo was broken when I first brought it

Tuesday, March 14, 2006

It's now 21.38 GMT+1.
Tomorrow morning I'm gonna leave Zagreb and going back to Jakarta and now kinda bit snowy outside.
It was really fun here and like it so far.
The city is not so crowded like Jakarta not mention the geek scene here, I'm definetly gonna miss this place.
Hopefully will had the change to come again and doing other FLOSS hack.
Hvala Zagreb!
Hvala Croatia!
Hvala Mama!

Friday, March 10, 2006

Don't really bother with syntax coloring on vim 'till now
So to make syntax coloring on vim, edit "/etc/vimrc" and add
"syntax on
set backspace=indent,eol,start"

Friday, March 03, 2006

Another notes for me, in mysql version 4, at least the one that on my SuSE 10. If I create user and give permision to do all things and assign host anything beside localhost. I wont be able to login to mysql console. And now my mysql_connect() on my php script wont work unless I use 127.0.0.1 for the db host.
Dunno why, I'll figure out this later
Been while since I post my last blog and playing with php.
So to remind my self about getting value from POST and GET in php.
When you have url like http://lame.com/script.php?duh=ownotagain
You can just straight echoing inside the script like

echo $duh;

Just notice that the newer php, that thing doesn't work anymore.
For the url that I've mention above, that mean it use the GET method, if you want assign the duh variable to you php script, you gotto do like this

$duh = $_GET['duh'];
echo $duh;

It then will give you ownotagain on your browser.
Yeah I know.... I'm totally moron just figure that out :D
Ummmm, 1,5 week again before I return home, so still have to deal with this damn cold winter
Guess, I'll miss Zagreb coz this is really nice town to be around

Friday, September 23, 2005

Finally manage to put some dhtml drop down menu onto WALHI website, though till i write this it still kinda buggy when using M$ IE and work great on Firefox.
I create style element script_dhtml for storing javascript and css file that used by dhtml dropdown menu. For top navbar I modify banner_menu and put javascript function inside html link tag and for left horizontal kampanye I modify the variable in subtopics_menu and change fetch section to
<a class="subtopic2"
href="<?=$site->uri.$topics_array[$subtopic->id];?>/"
onMouseover="ddropdownmenu(this, event, <?=$subtopic->name;?>,
'150px')"
onMouseout="ddelayhidemenu()">&(subtopic.extra);</a>

Add several new global variable on code-global so that the dhtml
can get array for the subtopic.

And to give subtopic array on the javascript dhtml dropdown from
midgard subtopic function,
I came up with following lines of code


<?
$campaigns_topic = mgd_list_topics(169);
?>
var campaign=new Array()
var c = 0
<?
while ($campaigns_topic_menu && $campaigns_topic_menu->fetch())
{ ?>
campaign[c] ='
<a href="<?=$site->uri.$topics_array[$campaigns_topic_menu->id];
?>/">&(campaigns_topic_menu.extra);</a>'
c++
<?}?>

Thursday, September 22, 2005

Bergie just gave me account to midgard project website and listed me in developer community section with other midgarders. Really cool coz I had a change to try out some MidCOM there.
Here is link for midgard developer community :
http://www.midgard-project.org/community/whoswho/

Wednesday, September 21, 2005

WALHI need to make sub website for sahabat WALHI (WALHI's volunter community).
We want to use our separate Midgard based system for that. There's a lot facilities that we've think that we want to put to there like forum, chatroom, pooling stuff and membership.
I'm still thinking how can I put all that stuff to our Midgard System.

Friday, September 16, 2005

Wrote port scanner in java named Jawascan back in 2003. It only use simple handshaking concept between one port to another. Jawascan use standard networking JDK API. So it is very simple port scanner, it wont be powerfull utility like nmap or anything like it.
Made it just for fun.
You can download it at http://vc-digital.com/Jawascan.zip

Sunday, September 11, 2005

One by one they're getting marriage.... uuhhhhh..... well I hope they'll have a happy live and ever lasting love....
hehehehhhh

Thursday, July 14, 2005

Made database connection class for my project that using mysql jdbc. I'm putting the code here incase anyone may find it usefull. Or you can download it from http://vc-digital.com/ConnectionDB.java

/*
* Created on March 25, 2005
*
*/
package sim;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.sql.*;
import java.util.Scanner;
import java.lang.String;

/**
* This source code is license under GPL
* Still working on password encryption
* You may use it, hack it and do what ever you want but please put my name as a credit if you

* are using this code for your application...
* If you find this code usefull for you please donate to the poor and homeless in your
* hood... giving to others will make you a better person. Trust me...
* Author o3ng. Contact me for any suggestion or question at avenpace@gmail.com
*
*/
class ConnectionDB {
private String [] cfg, cfgx;
private String read;
private Connection connection, connect;
private ResultSet rs;


public ConnectionDB() {
driverReg();
}
private String readConf() {
File fl = new File("db.conf");
try {
BufferedReader in = new BufferedReader(new FileReader(fl));
//String read;
read = in.readLine();

} catch (FileNotFoundException ee){
System.err.println("Can't find config file db.conf");
} catch (IOException oi){

}
return (read);
}
public ResultSet xecuteQuery(String query) {
String conRead = readConf();
System.out.println(conRead);
String delim = ":";
Scanner cfgFullx = new Scanner(conRead);
cfgFullx.useDelimiter(delim);
cfgx = new String[4];
int i = 0;
while (cfgFullx.hasNext()){
cfgx[i] = cfgFullx.next();
i++;
}
try {
Connection connection = DriverManager.getConnection("jdbc:mysql://" + cfgx[0] +"/" + cfgx[1] + "?user=" + cfgx[2] + "&password=" + cfgx[3]);
Statement statemen = connection.createStatement();
ResultSet rst = statemen.executeQuery(query);
setResult(rst);
//statemen.close();
//connection.close();

} catch (SQLException e) {
System.out.println("Connection error to the database");
}
getResult();
return this.rs;

}

public void updateQuery(String query) {
String conRead = readConf();
System.out.println(conRead);
String delim = ":";
Scanner cfgFull = new Scanner(conRead);
cfgFull.useDelimiter(delim);
cfg = new String[4];
int i = 0;
while (cfgFull.hasNext()){
cfg[i] = cfgFull.next();
//System.out.println(cfg[i]);
i++;
}
try {
Connection connect = DriverManager.getConnection("jdbc:mysql://" + cfg[0] +"/" + cfg[1] + "?user=" + cfg[2] + "&password=" + cfg[3]);
System.out.println(query);
Statement statement = connect.createStatement();
statement.executeUpdate(query);
statement.close();
connect.close();

} catch (SQLException e) {
System.out.println("Connection error to the database");
}
}


public void setResult(ResultSet frs){
this.rs = frs;
}

public ResultSet getResult(){
return this.rs;
}

public void driverReg(){
try {
Class.forName("org.gjt.mm.mysql.Driver").newInstance();
System.out.println("Register driver");
} catch (Exception e){
System.err.println("Can't find jdbc driver");
System.exit(1);
}
}

}

The db hostname, db name, user and password store in external file called db.conf
The content of the db.conf file is "dbhostname:dbname:dbuser:dbpassword"
You can use this class by construct an ConnectionDB class object, for example

ConnectionDB conn = new ConnectionDB();
queryUp = "INSERT INTO simtable SET sesi='test'";
conn.updateQuery(queryUp);

Thursday, June 16, 2005

Dual core processor, how do you thing the sound of it, prety cool huh... just imagine cpu that can simultaniously doing two different task in the same time. Dying to have those kinda system for my machine at home.... ;)
too bad AMD charge their's more expensive then Intel coz I've been huge fan of AMD for quite long time....
soon, no more slow arithmetic processing on your machine... hehehehhhh...

Monday, June 06, 2005

Hemm... pake boso indo ye. Kmaren gw lagi bingung nyari distro yang enak buat warnet. Pilihan gw antara pake gentoo dan ubuntu sama suse. Akhirnya pas di rumah nyobain gentoo. Ternyata itu distro lebih complex dan custumable dari slackware. Installasinya bener2 manual dan elo akan punya kebebasan absolute terhadap system linux yang elo pengenin. Gentoo bener2 oldschool banget, nyobain gentoo berasa jadi hacker linux deh.
Karena masih manual (bener2 ngompile dari source) akhirnya gw ngambil keputusan kalo gentoo enakan buat server aja karena menurut gw lebih stabil dan robust. Jadi nanti server akan gw install kalo ngga gentoo yah woody. Mau install sarge masih bugy.
Malam mingu akhirnya gw ngoprek itu komputer2 tua di kantor dan gw isiin kubuntu, dan ternyata lambat banget karena pake kde 3.4 dan openofficenya bener2 lama bnget bahkan di komputer yang 128 mb. Skarang gw lagi mempertimbangkan apakah gw akan trus install kubuntu ato pake suse atau mandrake aja walo sebenernya gw males banget pake distro yang turunan redhat karena udah kebiasaan pake debian. Tapi paling2 ntar kalo udah mentok itu komputer2 bangkotan gw thin clientnin aja deh.

Tuesday, May 03, 2005

Back to the root, I'm back to do java coding and study for sjp exam coz I've bought the exam voucher couple a months ago

Sunday, April 17, 2005

Just try installing midgard 1.7 on cecil at home. arrgghhh.... apache always gave me segmentation fault, man I'm so lame, dunno is it because the sarge or the midgard it self.
Henry told me on the Irc that 1.7 run well on woody