Showing posts with label Tech Tips. Show all posts
Showing posts with label Tech Tips. Show all posts

Monday, September 22, 2014

Manage Files Older than certain days

Today, I found a quite useful trick to list, delete or manage file that is older than certain days
This trick is simple to housekeep and simply check if archiving process is running well day on day basis.

The basic is

find /path/to/files* -mtime +5 -exec command {} \;

You may easily change the command to :

ls -- to list files
rm -- delete
tar -czf -- to create a tar.gz archive

or anything you may try, and let me know the result.

Change the /path/to/files* to exact path you want to check
+5 means older than 5 days. Simply change to let say +30 for files older than 30 days

This should work on any linux. Tested on Ubuntu, CentOS, and RedHat.
Hope this small trick could save your precious working time, and let more time for having fun :)

Cheers

Thursday, September 15, 2011

Instant Messaging of future


As technology becomes main agent for human interaction nowadays, more and more people connecting to each other indirectly, could via voice, text and video. The  way is texting via instant messaging (IM).



When SMS and voice communication is so yesterday, im offer more attractive and add value to the communication. The killer features is group messaging and ability to attach rich media file into the chat. Other high demanded feature such as share location, virtual activity also available depend on protocol and device.


There are so many IM protocol currently available. From the legendaries ICQ, IRC from the first dot-com booming during new millennia. Then internet giant enters the competition for their users such as Yahoo with Y!msgr, Google with Gtalk, Microsoft/Hotmail with Live (recently acquired Skype), Facebook Chat, AOL and many more that has no significant user. The most recent is smartphone/service vendor to push their own protocol. There are RIM with Blackberry Messenger, Nokia with Ovi chat,  Whatsapp, some local brand like Nexian Messenger and Esia Messenger. 


Remember old day where we can only send SMS within same operator/network, operator never thought the SMS could be one of their revenue machine. But when SMS inter-operator is available, instantly SMS become ultimate revenue generator.  Imagine internet with no inter-networking capability, telephone with no inter-operator switching,  email can only send to same domain user, closed group IM has no future, unless it can communicate thru all protocols/provider.


So IM service provider should start collaborate the chatting inter-operates across protocol. Some already started with limited partners, like Ovi can talk to Gtalk, Y!msgr to MSN (maybe with Skype too?), but still not as one global inter-protocol IM. Only by all-connected protocol, IM will be considered important way to socialize at least for years to come. No more one ID for every protocol if we want to chat with people in the group.

Wednesday, August 26, 2009

PHP Multithreading for beginner

This entry is inspired by Iman "Sapi". Thank you sapi.

PHP has become not just web scripting language. Now PHP also widely use for simple server side shell scripting. PHP is proven a strong platform do perform database and www operation, such as querying, CURL-ing, http tunnelling and API's function.


The differences is at output and how long the script allowed to runs. Output of web-based PHP mostly markup languages bounded with fancy images and media files. But shell scripting only output only-God-knows log messages, and has no time limit.


Supported by enormous of active developer, PHP server scripting are very easy to those actively build applications under web. PHP also powerful to build heavy-duty task, such as file backup, backend server-to-server processes. Like Java, PHP5 now has the capability for multithreading, to increase processing speed. The only limit is memory and processor. But I found for doing certain task (my case) it's much lighter than using Java.

To enable, first make sure you've installed pcntl extension. On Ubuntu machine, install the extension files :
$ sudo apt-get install php5-dev
$ cd ~
$ mkdir php-temp
$ cd php-temp
$ sudo apt-get source php5
$ cd php5-xx.xx/ext/pcntl (xx.xx is your PHP5 subversion, pressing tab would reveal it)
$ sudo phpize
$ sudo ./configure
$ sudo make

Copy the compiled extension into modules library.
$ cp modules/* /usr/lib/php5/xxxxxx/ (xxxxx is php library date)

Restart apache
$ sudo /etc/init.d/apache2 restart


Next is, try copy and paste this simple script simulate the multithreading.
Further reading, please visit PHP official manual page. Happy multi-threading.



$children = 5;

for ($i=1; $i<=$children; $i++) {
$pid = pcntl_fork();
if ($pid == -1) {
SaveLog("THREADING","could not fork thread $i");
die("could not fork\n");
}
else if ($pid) {
# If we are the parent, we did our job of giving birth,
# now lets finish our job and die!
SaveLog("THREADING","Parent thread exiting..");
exit(0);
}
else {
# Since we are the child, fork so that init will become our parent. Init
# is good at wait()ing on children - ie: reaping.
$cpid = pcntl_fork();
if ($cpid == -1) {
SaveLog("THREADING","could not fork in child process $i");
die("could not fork in child process\n");
}
if (!$cpid) {
# Put your real task here, dont forget they're run as separate process, make sure no dependency each thread
SaveLog("THREADING","Thread $i started");
$result = StupidTask(10000000);
SaveLog("TASK","Result on thread $i : $result");
SaveLog("THREADING","Thread $i finished");
# Don't forget to exit after the child processing is done. Certainly
# change this exit code if you need to however.
exit(0);
}
}
}

function StupidTask($count) {
for ($i=1;$i<$count;$i++) {
}
return "I'm done doing stupid thing for $count times";
}

function SaveLog($type,$msg) {
global $logfile;
file_put_contents($logfile,date('Y-m-d H:i:s') . ' ' . $type . ' ' . $msg . "\n",FILE_APPEND);
return true;
}

Wednesday, May 6, 2009

Manage MySQL datadir folder

Mysql no-doubtly is the most popular database server among web user for it available on most hosting and SMEs. It's distribution also available on most linux distro, including the popular Ubuntu.

Mysql data file is the base of mysql database storage. Relocating folder usually for harddrive partition storage management issue. Managing MySQL data file is kinda tricky, because since Ubuntu 8.04, MySQL data file is protected by apparmor by default. Meaning, we cant simply move around files related to MySQL, as all location need to be registered.

Basic step is to edit mysql config file, in /etc/mysql/my.cnf.
Make sure the service is stopped.


$ sudo /etc/init.d/mysql stop
$ sudo vi /etc/mysql/my.cnf

Look for datadir directive, change it to your new location. Datadir location has to be actual location, not a symbolic link. Save and quit the editor. Dont forget to move old database location into the new folder, most importantly "mysql", as the folder contains user authentication info. Otherwise you'll find unable to log in to the database.

Apparmor Part

Apparmor is a security software for Linux. Apparmor protects unauthorised changes to system critical files. To open apparmor protection for MySQL, open a shell terminal, and type :

$ sudo vi /etc/apparmor.d/usr.sbin.mysqld

Add the new location:


/var/www/mysql_datadir/ r,

/var/www/mysql_datadir/** rwk,


Restart apparmor by :


$ sudo /etc/init.d/apparmor restart

If everything went right, mysql start status should showing [ok], otherwise, consulting syslog somehow could help. Type this before restarting mysql service

$ tail -f /var/log/syslog


In other terminal,

$ sudo /etc/init.d/mysql start

Now your database is located in folder you prefer to.

Wednesday, March 11, 2009

Setting up gammu with smsd

Gammu is the most popular program to build customized sms  server. It can connect to various of handset, from the oldest model until recently launched model.  Also it support populars os(es) such as Microsoft Windows and Linux Ubuntu. 


To setup gammu under windows simply download win32 binary from gammu site. For Ubuntu, even easier.

$ sudo apt-install gammu

That's all.

Once installed try edit gammurc (gammu config files). Windows version, config file will be in same folder as gammu.exe. For Ubuntu version, the config file is in /etc. Edit where needed.
My working setting is :


[gammu]

port = /dev/ttyS1
;model = 6110
connection = at19200
;synchronizetime = yes
logfile = /home/says/gammulog
logformat = textall
;use_locking = yes
;gammuloc = locfile
;startinfo = yes
;gammucoding = utf8
;rsslevel = teststable
;usephonedb = yes


To test out :

$ gammu --identify


On success connection it should display our gsm modem properties.

Manufacturer : Nokia
Model : 6150 (NSM-1)
Firmware : 4.12 E (02-12-98)
Hardware : 2320
IMEI : 493002107068660
Original IMEI : 493002107068660
Manufactured : 1298
Product code : 0502690
Simlock 1 : MCC+MNC 00101, opened, factory, counter 0
Simlock 2 : GID1 0000, opened, factory, counter 0
Simlock 3 : GID2 0000, opened, factory, counter 0
Simlock 4 : MSIN 0000000001, opened, factory, counter 0
MSID : 823c21bb67cc5d6aab0f3caae6
MCU checksum : 4057
DSP ROM : 4


Next is configure smsd engine. Create a smsd config file. Ussually named smsdrc. Edit where needed. Put the file in same folder as we running Gammu. I strongly recommend using files style, as you can easily to customize the system.

[smsd]
PIN = 327426
logfile = /home/says/sms/logs/smsdlog
commtimeout = 10
sendtimeout = 20
#receivefrequency = 0
#resetfrequency = 0
deliveryreport = log
phoneid = mdsms

inboxpath = /home/says/sms/inbox/
outboxpath = /home/says/sms/outbox/
sentsmspath = /home/says/sms/sent/
errorsmspath = /home/says/sms/error/
inboxformat = standard
transmitformat = auto

The main part of the system just to read incoming sms save it to /inbox, send any message that we put in /outbox. Next gammu smsd able to do the rest.

Next, create an agent just to read message source to be send out, and retrieve incoming msg in inbox to store in your database. last thing is create nice fancy interface, of course dont forget the user authentication. Then hola, your own sms server is ready to serve.


Download : php agent to read & delete files

Wednesday, March 4, 2009

Looks profesional, write profesional email too

Email is must have communication for today business activity. Some people may not aware of that email have ethics code, so your email looks profesional and not just email. I write this because I've seen a lot of people just doesn't know (or doesn't care) about this.

I just encourage people to pay more attention on good email manner

1. Use company domain for business purposes. This rule is very simple, never join a mass mail mailing list using your company email, simply signup a free mail service. And oppositely, never response to a company project using free mail.

2. Dont forget to include nice signature in every mail you sent.
It could be your contact detail, such as full name, position, company address, company phone, and company website. It's a very simple, as so many people might forget to set it. For me, receiving email without signature like the person trying to hide these detail, that not good.

3. Do not reply when you're not in the mood..
We seen one-word, one-liner reply like 'ok', 'me too','i agree'. For me it represent the sender not in mood to response. delete unused thread below.

4. Write what you mean, mean what you write
Don't compose an email in hurry, especially that's a weekly report. We can easily knows if an email is composed to catch up the target or it really composed from getting data from lot of sources.
In slank Jakarta word, "gak niat". No, never sent that kind of weekly report, better wait until you really have enough useful data and information.


Happy email-ing !

Friday, January 9, 2009

Download KOMPAS Daily to your own server

Kompas starts today 2 July 2009, implements Microsoft's Silver Light framework, this download script temporary unable to fetch any edition




As most popular daily newspaper in indonesia, KOMPAS's content always been a compass most people to look to, from marketing to adv publisher, formal and informmal worker. As the biggest newspaper in country, everything in it counts, the news and advertorial. Some people may need it to be archived at their own for future reference.

As now, KOMPAS has their edition published online, you read it via internet browser. It uses djvu format, small image as thumbnail, combination of png (for text layer) and jpeg (for color photos layer). To download it, kind of hassle, because you might need to combine these two layers to get complete paper layout. Also, they just implement a sign up system to gather user information. Though it's free for now, but sure will consider a paid-scheme in the future.

If you want to keep ones as your archive, you install this script to your server, or you can try the working demo version. The interface isn't beautiful tough, but it's functional. Enjoy.

Demo version
Facebook version of KOMPAS
KOMPAS Script

Tuesday, December 16, 2008

Sharing USB files on Ubuntu

USB flash disk is no doubt industry standard for portable storage. Everybody carrying one or more, even that's a "pure" USB flash disk or any portable device with storage, since most these modern gadget has USB Mass Storage profile.

To share these files on Ubuntu for other users, you may use Samba file sharing. Samba is file sharing server act just like Windows share, for sharing files and printer. To install samba on ubuntu as simple as installing other program.

> sudo apt-get install samba

Once installed, start sharing folder by right-click on a folder name opened using Nautilus (the de-facto file manager) -> Sharing. Make sure the file you going to share has appropriate permission. To be able to read, at least has read privileges on "other". Chmod them to 644.

To be able to share USB files, you need to change default privileges of USB flash disk files. As it auto-mounted when you insert it, USB flash disk get file permission setting from gnome setting editor. Change them with :

> gconf-editor


Go to system>storage>default_options>vfat, double click "mount_options" on the right, click "add", enter the text "fmask=000", click ok. Also double click on umask need to change to "000" (that's triple zero). Remember that's masking code not the mode itself. So umask = 000 equal to 777 filemode. Save it then remount the volume.

Tuesday, October 28, 2008

Create Profesional Chart using PHP

As it function spread, PHP also can be develop into reporting agent. But creating chart graphic report using php never been this easy before i found ChartDirector. ChartDirector is a programming module that enable creation of chart based on given numeric data.

To install ChartDirector, simply go to its download section. Choose your platform, then extract into web-browsable folder. For Windows installation supposed no issue to highlight here. On Ubuntu, after several attempt, finally I got the installation works.

For Linux (Ubuntu) version, extract the package tar.gz into a web browseable folder. Then copy all co
ntent of lib into PHP shared object (so) folder, including all dll and font files. Remember to copy not move as the original file is needed for web browsable folder as well. To find out correct folder where the so lies, create a phpinfo() script.


Next is create an include entry in INI file. For Ubuntu, you may create a new file name it : chartdir.ini, put in /etc/php5/apache2/conf.d/ along with existing modules. For other system, put in php.ini :

#configuration for php chart director module
extension=phpchartdir520.dll

Remember, eventhough the loaded extention is dll, but it is a Linux extention. Do not load the so file as it will reported non-valid PHP module error. Restart your apache server. To make sure your installation is runs well, rerun the phpinfo, you should get this of your info page

This software is shareware, and lots of platform and programming language are available not just PHP. Even its cracks are easily to find on the net, please support by purchasing full version licences.

Wednesday, October 15, 2008

Enrich your browsing experience under Ubuntu

Ubuntu now is not just geek box. Web developer also can be more convenient using it by installing various browser in it.
Not less than 4 browsers you can install:

1. Firefox
no doubt, this is de facto browser, most widely used among Ubuntu user, as it installed by default.

2. Opera

Eventhough Opera market share is not as big as Firefox, this browser has certain fanatic fans. Deliver a unique render style, browsing using Opera give a different feel.
To install, go to www.opera.com linux download section. Select Ubuntu deb package. Double click downloaded deb file, follow the installation instruction. Otherwise, you may follow instruction by ubuntu forum

3. Internet Explorer

IE is the most widely used, as it come preinstalled with the OS that ruled PC user for years.
To install, follow instruction from my previous post.

4. Safari
Mac fans is unable to accept other browser, but safari. Run on wine, with some display issue, Safari can still shows its beauty. As it run on Wine emulator, simply download safari installation file, then run it.

All browsers above, only Firefox and Opera is running natively, while two others are emulated from Windows version. Meaning you have Wine installed properly before proceed to install them.
Overall, all browsers does have own characteristic and render style that a web developer should have installed them all.

Tuesday, September 2, 2008

Enable Google Analytics without javascript


Site counter tracker has been a very important component for us to trace popularity of a web portal. Luckily, a lot of web site counter we can use freely. All these time I count on two site counter to track my pages. StatCounter.com offer a easy to manage and weekly reporting statistic tracker. Simply sign up and add new project to the account, and paste snippet to your HTML template. StatCounter free edition has limitation of storing last 500 records only for analysis.

Google analytics (GA) offer a more complete service, and advanced reporting tools. But so far I searched across the net, found nothing we can do to implement GA in pages (rss or widget) that not support JavaScript. With such limitation, we can't track images loadings, email reads, pdf files, and the most important to me : WML pages.

Got inspired from LinkLove, which is run smoothly on my server but lack of User Agent info, I try to alter some point. Instead of using fopen remote file, I use CUrl function. With CUrl function, we can send set HTTP header to GA to simulate the actual hit by handset to the GA Server. To know more, simply download and try it on your web server. This script is totally standalone, no external 3rd function needed.

On WML/RSS pages, instead of copying GA Urchin JS snippet, simply add a
<img src="http://yourserver.com/ga.php" alt="" /> tag like this :

<img src="http://yourserver.com/ga.php?t=UrchinCode&amp;d=your-original-domain" alt="GA" />

Friday, August 1, 2008

DIY : Contact-lens style laptop screen protector

Laptop screen is the most visible part of a laptop. It's fragile also sensitive. Some said it's so fragile that we may not touch the screen directly or it will cause permanent because of static-electric conducted by fingertip.

After few experiment, I found a best way to protect laptop screen as well as other LCD-screen. Just need a sheet transparency paper, no glue needed. It use technique similar to contact-lens where the lens is fit to the eye so even we can notice if it has a protector layer.



For transparency paper, please use Laser-Jet compliance plastic, as it's hard enough to slip into screen's dip, also clear enough to make sure it didn't block the screen's original brightness. For a 13' screen, need a A4 (letter) size paper. Cut it follow to your screen size, but need to add approx 5 mm (0,2 inch) each side.

Slip it carefully in to screen edge, until it firmly locked on every edge. Now adjust it across to have the best position on the screen. Now, your screen has a protector from dust, static electric, or pen tip. And best thing is you can replace it whenever you want it and you get a brand new screen instantly.
Photo taken using Nokia 3230 (yang paling keren, milik Rina. Sorry guys, this is Bahasa Indonesia)

Tuesday, June 24, 2008

Repair Grub Entry after a Ubuntu Hardy Updates

Just few months after its official launch, Ubuntu Hardy Heron has release some kernel updates. Every kernel updates suggest us to create a new Grub menu. But unfortunately, if you choose wrong option, it might overwrite original grub menu entries, including non-ubuntu entries. I accidentally chosen let aptititute update whole list.

If this happen to you, no worry. No need reinstallation of OS. First is recover your lost non-Linux entries. Mostly user mixed with Microsoft OS, like Windows XP or Vista. Insert Windows XP or Vista installation CD. Upon setup option, instead of setup, select "Repair A Windows Installation". Choose command line repair. After a command line windows shows, type :
$ fixboot
$ fixmbr

For more command, your can type :
$ help

Close repair session, remove Windows CD, and then reboot. Now your box should be able to boot Windows. Next is repair grub entries. Insert Ubuntu Live CD, then reboot. Open a terminal session from Start Menu -> Accessories -> Terminal. Type :

$ sudo grub
grub >find /boot/grub/stage1

From given information, setup grub root and entries

grub> root (hd0,1)
grub> setup (hd0)
grub> quit


More reading about dual boot tips and emergency tips your may read Ubuntu official tutorial

Wednesday, May 28, 2008

Integrate PHPBB login to your website

PHPBB is one of most widely used forum board system. Build on strength platform of PHP, PHPBB free yet stable and easy to configure. We can aware if a system using PHPBB as its forum board system, by its unique layout and themes.

For some website that doesn't have own member management system can use PHPBB for their user / login based system. PHPBB provide a solid member management system, sign up interface, also nice member profile interface.

For sign up, easiest way is using existing PHPBB signup form. More customization is required to match your website theme. Simply edit profile_add_body.tpl template under your phpbb/template/templatename/ folder. It's all in html + smarty code.

Next is to link a login form (on your main website) to phpbb login verification system. You need to create a form contain 3 main object : user name, password, and Login button


<form name="frmPhpBBLogin" action="your_phpbb_login.php" method="post">

User name : <input name="username" type="text">

Password : <input name="'password'" type="password">

<input value="'Login'" type="'submit'">

</form>




To get login info which stored in PHPBB session, simply get it from COOKIE data by
PHP Code snippet
-----------
$session_data = isset($_COOKIE['phpbb2_data'])?unserialize(stripslashes($_COOKIE['phpbb2_data'])) : array();
if (isset($session_data['userid'])) GetPHPBBMemberDetail($session_data['userid'])
function GetPHPBBMemberDetail($id) {
$myQR = "SELECT * FROM `phpbbdb`.`phpbbprefix_users` WHERE `user_id`='$id'";
$myRE = mysql_query($myQR);
return mysql_fetch_assoc($myRE);
}

------------
Note :
- Actual cookie variable name may vary, you can do a var_dump($_COOKIE) to find out.
- Change `phpbbdb` to your actual PHPBB database name
- Chnage `phpbbprefix_` to actual PHPBB table naming prefix
You must have mysql access to get all the data.

To log out simply hit PHPBB's logout url, normally at login.php?logout=true

Saturday, May 10, 2008

Firefox 2 on Ubuntu Hardy Heron

Ubuntu 8.04 Hardy Heron just rolled out from it's beta stage. For those ubuntu-lover, we just can't wait what are new features on this new release, especially that can be seen directly from its fancy desktop.

Firefox is one of among list. Even Firefox 3 offer lot of new browsing features, but unfortunately, I don't like beta softwares. Even it proved stable, but one thing is sure, it slow down my laptop, compare to previous version. Maybe you have same opinion with me.
Also, lot of my favorite plugin does not work with Firefox 3, including Foxmarks.

To roll back using Firefox 2 as Ubuntu Hardy default browser, simply uninstall firefox 3, get firefox 2 and change some shortcut links. Open a terminal session

$ sudo aptitute remove firefox
$ sudo aptitute remove firefox-3
$ sudo apt-get install firefox-2

Next is change default command firefox shell script to firefox-2, by type :
$ cd /usr/bin
$ sudo ln -s firefox-2 firefox

As bonus here is an article for you who love Internet Explorer, and wish to run it on your Ubuntu. Installing Wine, Internet Explorer and Visio 2003

Just like Asus tagline, now you can enjoy rock-solid heart-touching Firefox 2 :) and alternative IE on your Ubuntu.

Sunday, May 4, 2008

Use firefox to open wap site


Firefox is now about to take over the position of most popular browser. Due to lack of customization and security reason, now more and more user are turning using Firefox rather than other browser.

For wap developer like me, everyday involve with hundreds of trial-and-fail page load using all available browser, I found it's very useful for you all to have this plugin. WMLBrowser is essential for firefox to determine the content type text/vnd.wap.wml file.

To install, simply go to Tools -> Add Ons. On extensions tab, click "Get Extensions". Your firefox will open a new tab. Just type wml in the search box. Or you can go to WMLBrowser direct link. Once installed now you can open any WML site as it display on phone browser. All plugins above work for Firefox 1.5, Firefox 2 and Firefox 3 both on Windows or Linux.

Another utility that complementary to this plugin is User Agent Switcher, to let you pretend that you really a mobile handset to wap server. This trick very useful to mask yahoo and gmail site to serve us as mobile user, as well as to download contents that should serve mobile user only.

Sunday, March 9, 2008

Flashing ATI Radeon 9550 Bios


As a techno lover, we always expect more from gadget & peripheral we have. From performance increase, new feature and sometime just expecting the not-so-important version number increase.

But this time, my first motivation is to enable desktop effect in Ubuntu Gutsy on my PC. I searched across the net found that the culprit was ATI Radeon 9550. ATI Radeon 9550 is just a tiger in cage. The chip has potential power but caged. You need to unlock it by flashing 9550 become a ATI Radeon 9600.

First, check your ATI 9550 card's detail. I use Asus A9550 series with 256 MB SGRAM. You can get your card detail using ATI Tool . Download a flash utility for ATI card. You can use FlashRom which proven success on my case.

Next you need to find a suitable bios image. My success tips is look for same memory size and brand. Forget the card brand itself. They are just OEM. If found mine on techPowerUp.com. It's recommended you can start searching your compatible bios there. Dont forget to download more than one so you can try flash with various bios image.

To begin flashing, you need a real MS DOS environment. Where most computer now doesnt have 1.44 MB floppy drive, you can create a boot disc by download the boot image then burn to CD. Use any ISO disc burner to burn the image.

Before restarting your PC, dont forget to save all supporting files (Flashrom, BIOS images) in a FAT32 partition drive, where you can still access the file while on real DOS mode. Next useful tips is rename all the BIOS file name into a easy to type name, e.g. 1.bin, 2.bin.

Now you're ready to reboot your PC. Once rebooted, make sure your PC bias has set to boot from CD-ROM as first priority. Insert the boot disc. Wait for boot completion. Now on MS DOS screen type :

A:\> C: (your FAT 32 drive, where you save the flash files, try from C until H)
C:\> CD ATIFLASH (change to dir where you stored flashrom.exe)
C:\ATIFLASH> FLASHROM -s 0 backup.bin (make backup current bios)
C:\ATIFLASH> FLASHROM -f -p 0 ..\9550\1.bin (the new bios file)

After finished, you will hear 3 beep. Then press CTRL+ALT+DEL. If new bios is compatible then you should see normal BIOS screen and can proceed normal OS boot up. If fails, simply retry step above. You really need to type in blind, especially when you updated with an incompatible BIOS resulted your screen scrambled.

Last word, do it on your own risk. And remember, steps above will void your card's warranty. Good luck !

Saturday, March 8, 2008

Running MS Visio 2003 On Ubuntu

Ubuntu is now become main stream OS that used by desktop user, not just alternate to those already in the stream like Macintosh MacOS and Microsoft Windows family. By this time, latest Ubuntu version is Gutsy Gibbon 7.10.

Most task that require Windows now can be run on Linux as well thanks to Wine, a Windows emulation program. But to make a Windows based software install and runs smoothly on Linux, need some quite tricks. These knowledge is shared among internet user which is sometime not a comprehensive how-to guide. There are some tips that helped me so much on running MS Visio 2003 on linux.

First of all make sure you have latest Wine version installed. Run
$ sudo gedit /etc/apt/sources.list
Add following repository to your apt-get repo list :
deb http://wine.budgetdedicated.com/apt feisty main

It's recommended to completely uninstall existing Wine installation and rename folder /home/your_user/.wine into something else.
Now install Wine and supporting components :

$ sudo apt-get update
$ sudo apt-get install wine
$ sudo apt-get install cabextract

Install IE4Linux. IE4Linux needed by certain part of the Visio installation and runtime.

$ wget ttp://www.tatanka.com.br/ies4linux/downloads/ies4linux-2.0.tar.gz -O - | tar xvzf -

or this alternate link :

$ wget http://modzer0.cs.uaf.edu/~hardwarehank/files/ies4linux-2.0.tar.gz -O - | tar xvzf -

When completed, run :

$ cd ies4linux/
$ ./ies4linux

Follow the installation by choosing some simple installation option. Now you have IE installed in your Ubuntu box.

Next proceed with Ms Visio 2003 installation. Insert the CD into CD-ROM or mount appropriate file. In terminal, change to source folder then run :

$ wine setup.exe
A installation wizard will show up, follow the wizard as you install on Windows.
Once completed, try to run it.
Application -> Wine ->Programs->Microsoft Office ->Microsoft Office Visio 2003

If you get error message "IOPL not enabled", run
$ winecfg

On application tab, change Windows version to Windows XP. On libraries tab, add new library
gdiplus.dll (native)
Save and close config window. And now your Visio should be run perfectly. Any other issue, please check out the community testing result.

My Environment :
Linux Ubuntu Gutsy Gibbon 7.10, 32 bit version
Wine 0.9.57
Microsoft Visio 2003 (11.3216.5606)

Tuesday, February 5, 2008

Moving SVN repository to another machine

SVN is a great tool for collaborated programmer to keep every copy files up to date and track changes made by everyone. In my case, I use SVN for synchronize my working file between my workstation and portable one. If you haven't get the SVN installed, follow the instruction given from the SVN site. For Ubuntu user (like me) there's a useful instalation guide here.
Since it's a collaboration tool across the internet, SVN repository supposed can be move from one server to another. Even the server are using different OS. First, you need to dump current repository to a dump file (assummed you have existing repo at /opt/svn/svnrepo/) :

$svnadmin dump /opt/svn/svnrepo > svnrepo.dump

Make the file smaller by compressing it :

$tar -cvzf svnrepo.tar.gz svnrepo.dump

Then transfer the file to new server using SCP (assummed your SSH using different port number 222) :

$scp -P 222 svnrepo.tar.gz username@server2:/home/username/

Once transferred, login to server2 :

$ssh username@server2 -p 222


Extract the dump file and copy to new location (assummed at /opt/svn/svnrepo/)

$tar -xvzf svnrepo.tar.gz
$mkdir /opt/svn/
$mv svnrepo.dump /opt/svn/

Import dump file into running SVN server :

$svnadmin create svnrepo
$svnadmin load svnrepo < face="verdana">Once you complete the step, you can delete the .dump file and the tar.gz file as well.
When running the SVN server make sure it loads repo from the location we just imported by

$svnserve -d -r /opt/svn/svnrepo/

Dont forget on SVN client side, make sure to relocate repo to new location as well

Sunday, January 20, 2008

Using ssh, scp, sftp without password

SSH is a remote access protocol that designed for security purpose, replacing non-secured Telnet. As it main strong point is its security, there's both side signature and authentication to establish a connection. And also, if you notice, most SSH clients didnt offer a "remember password" option and always been asked for password each time you want to connect.

But on linux you can set the connection establish itself without prompting for password. This quite useful if you very often connect to a server. I assuming connecting from LOCAL to SERVER.

1. Log on to LOCAL computer. Run following command :
$ ssh-keygen -t dsa
Left the field empty (press enter to accept the value)
As this step complete, there are 2 file created in your home ~/.ssh/ folder
id_dsa.pub --> this is your public key
id_dsa --> this is your private key

2. Merge the public key into SERVER's authorized key. First we need to transfer the file first using SCP. Add -P option if your SERVER user other port than default SSH port 22.
$ scp ~/.ssh/id_dsa.pub user@SERVER:/tmp
Then, log on to SERVER for further step by
$ ssh user@SERVER -p port_number
Change the port number to a value of your SSH port. If you dont know you may try 22.

3. As we logged on SERVER, merge the public key into authorized_key2 :
$ cat /tmp/id_dsa.pub >> ~/.ssh/authorized_key2
Now you can delete the public key :
$ rm /tmp/id_dsa.pub

4. Now you can SSH, SFTP or SCP to SERVER from LOCAL computer without get prompted by password.

For security reason, please apply this for trusted computer only.