Wednesday, December 15, 2010

Firebird and Visual Basic .Net example code

If you are using Visual Studio or Visual Basic to develop program connect to firebird database server, this might be a good example.

Imports FirebirdSql.Data.FirebirdClient
__________________________________________________________________
Public Class Principale



Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim Fdataa As New FbDataAdapter("select*from New_table1", "servertype=1;username=sysdba;password=masterkey;database=" & My.Application.Info.DirectoryPath & "\Giorgio.gdb")

DataSet1.Tables.Add("New_table1")
Me.DataGridView1.DataSource = DataSet1
Me.DataGridView1.DataMember = "New_table1"

Fdataa.Fill(DataSet1, "New_table1")

End Sub


Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Nuovo.Show()
End Sub
'To begin the change
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

'I used the trim function because would be problems with positioning of the cursor if you will pass from varcahr type to char type and vice versa.
Modifica.TextBox1.Text =

Microsoft.VisualBasic.Trim(DataGridView1.CurrentRow.Cells(0).Value)

Modifica.TextBox2.Text = DataGridView1.CurrentRow.Cells(1).Value


Modifica.Show()
End Sub

'To delete a record

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim mResult
Dim ObjConnection As New FbConnection()
mResult = MsgBox("Si desidera eliminare questo cliente?", _
vbYesNo + vbQuestion, "Conferma eliminazione")
If mResult = vbNo Then
Exit Sub
End If
ObjConnection.ConnectionString = "servertype=1;username=sysdba;password=masterkey;database=" & My.Application.Info.DirectoryPath & "\miodb.gdb"
ObjConnection.Open()
Try
Dim ObjCommand As New FbCommand()
ObjCommand.Connection = ObjConnection

ObjCommand.CommandText = "delete from New_table1 where Clienti='" & Me.DataGridView1.CurrentRow.Cells(0).Value & "'"
ObjCommand.ExecuteNonQuery()
Finally
ObjConnection.Close()
End Try

Me.DataGridView1.Rows.Remove(Me.DataGridView1.CurrentRow)

End Sub
End Class

'To update a record

Imports FirebirdSql.Data.FirebirdClient
______________________________________________________________
Public Class Modifica



Private Sub btnAggiorna_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAggiorna.Click
Dim customerRow() = Principale.DataSet1.Tables("New_table1").Select("Clienti ='" & Principale.DataGridView1.CurrentRow.Cells(0).Value & "'")


Dim ObjConnection As New FbConnection()

ObjConnection.ConnectionString = "servertype=1;username=sysdba;password=masterkey;database=" & My.Application.Info.DirectoryPath & "\miodb.gdb"
ObjConnection.Open()
Try
Dim ObjCommand As New FbCommand()
ObjCommand.Connection = ObjConnection

ObjCommand.CommandText = "update New_table1 set Clienti='" & Me.TextBox1.Text & "', Spesa='" & Me.TextBox2.Text & "' where Clienti='" & Principale.DataGridView1.CurrentRow.Cells(0).Value & "'"
ObjCommand.ExecuteNonQuery()
Finally
ObjConnection.Close()
End Try

customerRow(0)("Clienti") = Me.TextBox1.Text
customerRow(0)("Spesa") = Me.TextBox2.Text

Me.Close()
Principale.Show()
End Sub
End Class

'To insert e new record

Imports FirebirdSql.Data.FirebirdClient
____________________________________________________________
Public Class Nuovo


Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim ObjConnection As New FbConnection()

ObjConnection.ConnectionString = "servertype=1;username=sysdba;password=masterkey;database=" & My.Application.Info.DirectoryPath & "\miodb.gdb"
ObjConnection.Open()
Try
Dim ObjCommand As New FbCommand()
ObjCommand.Connection = ObjConnection
ObjCommand.CommandText = "insert into New_table1 (Clienti, Spesa) values ('" & TextBox1.Text "','" & TextBox2.Text & "')"
ObjCommand.ExecuteNonQuery()
Finally
ObjConnection.Close()
End Try



Dim newCustomersRow As DataRow = Principale.DataSet1.Tables("New_table1").NewRow()
newCustomersRow("Clienti") = TextBox1.Text
newCustomersRow("Spesa") = TextBox2.Text
Principale.DataSet1.Tables("New_table1").Rows.Add(newCustomersRow)



Me.Close()
Principale.Show()
End Sub

End Class

Example from : http://firebird-vbnet.blogspot.com/2006/12/esempi-di-codice.html

Monday, November 29, 2010

You don’t currently have permission to access this folder.

Problem : Whenever trying to access files or folders which current login account don't have permission but belong to administrator group, the system will prompt :

You don’t currently have permission to access this folder.


If you click continue button , the system will add the current login account into the ACL which you might want it to happen because this will mess up your ACL.

Solution : Run Explorer.exe as administrator.

You might see some solution suggest to run explorer.exe as administrator. If you create a shortcut at desktop to launch the explorer.exe and right click select Run As Administrator. But soon or later you will notice the problem still remain.

After searching around , I found the trick which a lot of them didn't mention in their answer.

The trick : Modify the registry.

Changing the registry setting “RunAs” to “_RunAs” in HKEY_CLASSES_ROOT\AppID\{CDCBCFCA-3CDC-436f-A4E2-0E02075250C2}.

Tested on my machine , this trick is working.

Solution found from here : http://www.theexperienceblog.com/2010/09/18/case-of-the-mysterious-issues-in-windows-7-and-windows-server-2008-r2/



---

Thursday, November 18, 2010

Convert HTML to Plain Text

If you having the same problem like me wanted to display HTML tag in post body, you can refer to this page:

http://www.blogspottutorial.com/2008/12/html-code-appears-in-posting.html



---

Very Silly Method to strip off html to get url

I know this is a very silly method on stripping off html tag from the html source code in order to retrieve the jpg url but it work , so I record down for my own use.


1. Prepare a file with all the html code and save it as txt.txt.

< onblur=" try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="">http://2.bp.blogspot.com/_YF1tNfQVN8w/TN66Xjc_9VI/AAAAAAABjUw/y_ImZpICYEE/s1600/53.jpg" > < style=" float: left; margin: 0pt 10px 10px 0pt; cursor: pointer; width: 266px; height: 400px;" src=" http://2.bp.blogspot.com/_YF1tNfQVN8w/TN66Xjc_9VI/AAAAAAABjUw/y_ImZpICYEE/s400/53.jpg" alt=" " id=" BLOGGER_PHOTO_ID_5539069505528919378" border=" 0"> < /a>

2. awk 'BEGIN { RS="href=\"" } { print $1}' txt.txt >txt2.txt

http://1.bp.blogspot.com/_YF1tNfQVN8w/TN64I5jNF3I/AAAAAAABjOQ/Ykc2T_qJ3k4/s1600/1.jpg" > < style=" float: left; margin: 0pt 10px 10px 0pt; cursor: pointer; width: 400px; height: 266px;" src=" http://1.bp.blogspot.com/_YF1tNfQVN8w/TN64I5jNF3I/AAAAAAABjOQ/Ykc2T_qJ3k4/s400/1.jpg" alt=" " id=" BLOGGER_PHOTO_ID_5539067054739232626" border=" 0">


3. awk '{ FS="\""; print $1}' txt2.txt >txt3.txt

http://1.bp.blogspot.com/_YF1tNfQVN8w/TN64I5jNF3I/AAAAAAABjOQ/Ykc2T_qJ3k4/s1600/1.jpg

4. Then use the script to generate the picture link that I want.

#!/bin/bash
while read inputline
do
echo '<> < title=" title" rel=" lightbox" href=""> > txt4.txt
echo ${inputline} > > txt4.txt
echo '" > < src=""> > txt4.txt
echo ${inputline} > > txt4.txt
echo '" alt=" alt text" title=" title" width=" 600" /> < /a> < /p> ' > > txt4.txt
# echo ${inputline}
done < txt3.txt
exit 0

That it . I know it can be shorter , but my skill level only up to this. Welcome expert to teach me better way of doing . Thank you.



---

Wednesday, October 20, 2010

Some open source/free application

Here is a list of open source application that I found.

http://www.steema.com/teechart/php

TeeChart for PHP is an Object-Oriented Charting component library for PHP. The library is completely written in PHP and ready to be used in any PHP scripts. TeeChart for PHP is offered via two formats, the Free Open Source version and the Licensed Pro version. Both include the full source code meaning that no loaders have to be used in order to create a Graph on your servers. Most of the features are identical between versions; the significant exceptions being that only the licensed Pro version of the TeeChart for PHP library may be used in a commercial context (please check the Licensing info for details) and that standard support is only available for the licensed Pro version.

http://www.fusioncharts.com/free/

FusionCharts Free is a completely free and open-source Flash charting component. It empowers you to create animated and interactive Flash charts for your web applications, desktop applications and presentations.

http://www.achievo.org/

Achievo is a flexible web-based resource management tool for business environments. Achievo's resource management capabilities will enable organisations to support their business processes in a simple, but effective manner.

http://nevron.com/Products.DiagramDesigner.Overview.aspx

Nevron Diagram Designer is a freeware diagram editor powered by Nevron Diagram for .NET controls. It is suitable for creating various kinds of diagrams and performing different layout algorithms on them. The Diagram Designer also can make you familiar with the features provided by Nevron Diagram for .NET

http://www.epiware.com/products_epiware.php

Epiware is the open source alternative for Enterprise Document Management. It contains all of the cutting edge features and functionality. Enable your employees to collaborate on projects, share documents, create schedules, and manage tasks.



---

Wednesday, September 15, 2010

Trick and Tips when bash script dealing date

This is some tricks and tips I found when I searching around google.

Getting Yesterdays or Tomorrows day with shell date command.

When invoked without arguments, the date command displays the current date and time. Depending on the options specified, date will set the date and time or print it in a user defined way. I’ve seen many people writing a perl script for calculating yesterday or tomorrow. Computer loves numbers but we love relative terms like 2 days ago. Luckily GNU date command is designed to handle relative date calculation.

Why use relative date formats?

* Ease of use
* To write your own scripts
* Automate task using cron (example run a job on last day of the month or Nth day of the month or 3rd Friday and so on)

First, print today's date:
$ date
Sun Jun 17 12:17:24 CDT 2007

Now display Yesterday's date:
$ date --date="1 days ago"
OR try:
$ date --date="yesterday"
Sat Jun 16 12:17:20 CDT 2007

Now display Tomorrow's date:
$ date --date="-1 days ago"
Or better try:
$ date --date="next day"
Sat Jun 16 12:17:20 CDT 2007
Getting date in the future

To get tomorrow and day after tomorrow (tomorrow+N) use day word to get date in the future.
Getting date in the past

To get yesterday and earlier day in the past use string day ago:
Moving by whole years or months

You can add year and months keywords to get more accurate date:
$ date --date='2 year ago' # past
$ date --date='3 years' # go into future
$ date --date='2 days' # future
$ date --date='1 month ago' # past
$ date --date='2 months' # future
Moving date using more precise units

* You can use fortnight for 14 day
* Week for 7 days
* hour for 60 minutes
* minute for 60 seconds
* second for one second
* You can also use this / now / today keywords to stress the meaning

To print the date of this Friday:
$ date --date='this Friday'
To print the date of the day six months and 15 day
$ date --date='6 months 15 day'
To print the date of the day two months and 5 days ago:
$ date --date='2 months 5 day ago'

You can also use relative format to setup date and time. For example to set the system clock forward by 30 minutes, enter:
# date --set='+30 minutes'

To display date in epoch time:
$ date --date='1970-01-01 00:00:01 UTC +5 hours' +%s

Source : http://www.cyberciti.biz/tips/linux-unix-get-yesterdays-tomorrows-date.html

Friday, August 6, 2010

Repair Openldap database

If you come across this problem like me , this might be able to help you.

When ever I restart the openldap daemon at my CentOS server , I received this error :
Checking configuration files for slapd: bdb_db_open: unclean shutdown detected; attempting recovery.
bdb_db_open: Recovery skipped in read-only mode. Run manual recovery if errors are encountered.

If you issue command slapcat , you might be able to start the openldap without any error. But after you stop the openldap daemon , you start the openldap daemon again , you will receive the same error again.

Then you might think of this command : slapd_db_recover . If you use this command , you might face the same scenario.

How I solve the issue about this openldap error is issue the following command in sequence .

slapcat
slapd_db_recover -h /var/lib/ldap


Then try to start your openldap daemon again , you might find it working.



---

Tuesday, July 20, 2010

vmware server 2.0.2 and fedora 13

I am trying to install Vmware server 2.0.2 build-203138 into my Fedora 13 with kernel 2.6.33.6-147.

Luckily I manage to found this page , otherwise I wouldn't know how to solve all the problem that I am facing while trying to install the Vmware server into the fedora.

The detail is in this page.

This article describes the process we went through recently to get VMWare Server 2.0.2 to run on the latest kernel in Fedora 13.

http://www.bhcblog.com/2010/06/28/howto-vmware-2-0-2-on-2-6-33-5-124-fc13-x86_64-fedora-13/

When you are editing the vmware-config.pl file , make sure there is no dot in front of the word generated for the first line.



---

Wednesday, July 14, 2010

Reverse Proxy with squid and multiple virtual host

This post is to document down the detail that I did to configure a squid as reverse proxy and also enable LDAP authentication . Not only that , I need the squid reverse proxy able to handle virtual host as well. I did a search at google and didn't find any exact match for my requirement so I did one for my self.

I have 3 physical web server but I only have one public ip.

Here is my requirement.

1. All three web server have to listen at port 80 and must be able to access from internet.
2. Some web site need authentication and some web site don't need authentication.
3. One of the web server has two virtual host and these two virtual host must be accessible from internet.

After combine knowledge from multiple page , these are the lines that I added into the squid.conf .

auth_param basic program /usr/lib64/squid/squid_ldap_auth -b "dc=example,dc=com" -f "uid=%s" -h ldap.example.com
auth_param basic children 30
auth_param basic realm Please authenticate yourself
auth_param basic credentialsttl 1 hours

acl sites1 dstdomain site1.example.com site2.example.com
acl sites2 dstdomain site3.example.com
acl sites3 dstdomain site4.example.com
acl ldapauth proxy_auth REQUIRED

http_access allow sites1 ldapauth
http_access allow sites2
http_access allow sites3

http_port 80 accel defaultsite=www.example.com vhost

cache_peer 10.1.1.1 parent 80 0 no-query originserver name=server1
cache_peer_domain server1 site1.example.com site2.example.com
cache_peer 10.1.1.2 parent 8080 0 no-query originserver name=server2
cache_peer_domain server2 site3.example.com
cache_peer 10.1.1.3 parent 80 0 no-query originserver name=server3
cache_peer_domain server3 site4.example.com

cache_peer_access server1 allow site1
cache_peer_access server1 deny all
cache_peer_access server2 allow site2
cache_peer_access server2 deny all
cache_peer_access server3 allow site3
cache_peer_access server3 deny all

Troubleshooting:

Ldap authentication not working or not success or fail to authenticate.

This line might be different , replace the squid_ldap_auth binary path with the correct one.

auth_param basic program /usr/lib64/squid/squid_ldap_auth -b "dc=example,dc=com" -f "uid=%s" -h ldap.example.com

if the binary path is correct, execute the following command at the server console

/usr/lib64/squid/squid_ldap_auth -b "dc=example,dc=com" -f "uid=%s" -h ldap.example.com

after execute , you will get a blank line , type your user name then a space follow by the password and press enter.

If you received a OK mean the authentication success , if not , you have to play around with the base dn , filter and even might consider add in parameter to bind first before perform search.

Execute squid_ldap_auth binary without any parameter will show available option.

For your information, I did this at a CentOS machine, if this is not working for your distribution, you might need to find another article.

Sorry for didn't explain the detail , if you need to know each line in detail , please refer to the following sites:

Reverse Proxy with Domain Based Virtual Host Support:

http://wiki.squid-cache.org/ConfigExamples/Reverse/VirtualHosting

Reverse Proxy with Multiple Backend Web Servers:

http://wiki.squid-cache.org/ConfigExamples/Reverse/MultipleWebservers

Squid with Ldap authentication – Centos :

http://alouche.net/blog/2009/02/20/squid-with-ldap-authentication-centos-52/



---

Wednesday, May 19, 2010

vtiger crm uitype

Official uitype , you can find it here:

http://wiki.vtiger.com/index.php/Ui_types

But if you are newbie like me , you might need more description about the UI type, then may be you can have a look at this:

http://vtigersql.com/weblog.php?w=36

I am looking for text area UI.
(* notate required version of uitype)

Number 19,20* = Text Area (70x8) Spans 70 chars wide (i.e. across both columns)
Number 21,24* = Text Area (30x2) (single column)



---

Thursday, March 25, 2010

Microsoft excel macro to compare two column for each row and highlight cell with condition

This Macro was tested with Microsoft Excel 2007.
Sub compare()
' Select first line of data.
Range("B2").Select
' Set Do loop to stop at empty cell.
Do Until IsEmpty(ActiveCell)
' Check active cell for search value.
If ActiveCell.Value = Cells(ActiveCell.Row, ActiveCell.Column - 1).Value Then
ActiveCell.Interior.ColorIndex = 3
ElseIf ActiveCell.Value > Cells(ActiveCell.Row, ActiveCell.Column - 1).Value Then
ActiveCell.Interior.ColorIndex = 4
ElseIf ActiveCell.Value < Cells(ActiveCell.Row, ActiveCell.Column - 1).Value Then
ActiveCell.Interior.ColorIndex = 5
Else
ActiveCell.Interior.ColorIndex = 6
End If
' Step down 1 row from present location.
ActiveCell.Offset(1, 0).Select
Loop
End Sub

Every time you change a value in the cell , you have to run the macro manually. In order to run it automatically, put the script into the Worksheet_Change function. (This code was not tested , just for reference.)
Private Sub Worksheet_Change(ByVal Target As Range)
' Select first line of data.
Range("B2").Select
' Set Do loop to stop at empty cell.
Do Until IsEmpty(ActiveCell)
' Check active cell for search value.
If ActiveCell.Value = Cells(ActiveCell.Row, ActiveCell.Column - 1).Value Then
ActiveCell.Interior.ColorIndex = 3
ElseIf ActiveCell.Value > Cells(ActiveCell.Row, ActiveCell.Column - 1).Value Then
ActiveCell.Interior.ColorIndex = 4
ElseIf ActiveCell.Value < Cells(ActiveCell.Row, ActiveCell.Column - 1).Value Then
ActiveCell.Interior.ColorIndex = 5
Else
ActiveCell.Interior.ColorIndex = 6
End If
' Step down 1 row from present location.
ActiveCell.Offset(1, 0).Select
Loop
End Sub


A good page as reference guide is at here - http://www.ozgrid.com/VBA/run-macros-change.htm .



---

Tuesday, March 23, 2010

Looking for live chat icon

If you are looking for live chat icon or operator pictures or even Header images for your live chat pop up windows, you can come to this URL :

http://www.providesupport.com/product/chat-icons-en.html

Here got some nice live chat icon , operator pictures and Header images, it might suite your help.



---

Wednesday, March 10, 2010

Download and install Cisco SDM

This is the link where you can download the SDM without need to register an account at CISCO. Although registering the account doesn't cost any money , but still feel annoying while try to get the SDM fast and immediately. So here is the link , which you can click and download without any question.

ftp://ftp.cisco.com/pub/web/sdm/

If you need a guide on how to install SDM , here is a good guide.

http://www.ciscobible.net/archives/754

Hope this two page will help you to setup the Cisco SDM at your desktop.

Another tips before I forget , if you connect to the device using ssh tunnel, most of the time you will access localhost , remember to use localhost instead of 127.0.0.1 , using ip address will cause the SDM failed to launch.



---

Friday, March 5, 2010

A list of mobile device emulators

If you like me plan to develop a series of application for all kind of mobile device, may be you will need some emulators to test out your application.

I found this web site from SUN, it contain a list of mobile emulator. Although it is not so up to date , but still worth to have a look.

http://developers.sun.com/mobility/midp/articles/emulators/

And also this web site , it contain newer mobile device emulator.

http://mobiforge.com/emulators/page/mobile-emulators

If you would like to see how the opera mini work , you can try your web site at these two Opera mini online demo.

http://www.opera.com/mini/demo/
http://www.opera.com/mini/demo/?ver=4



---

Wednesday, March 3, 2010

If you need a regular expression generator ...

If you are a programmer newbie like me , sometime you might need a regular expression generator to help you generate the regexp.

I tried a few site and found that this is the most suitable for me , so it might suit you as well -

http://www.txt2re.com/index-csharp.php3



---

Monday, March 1, 2010

List of Browser ID (User-Agent) Strings

One of my previous post said that you can always check your Browser ID (User-Agent) Strings by visit this web site - http://macfaq.org/hacks/useragent.html and also if you need to find out more Browser ID (User-Agent) Strings , you can visit http://www.user-agents.org/index.shtml.

Now I found another list of browser agent at http://www.zytrax.com/tech/web/browser_ids.htm . Not only a list , they also explain the meaning of the string, if you need to figure our more User agent string, feel free to have a look.



---

Thursday, February 25, 2010

run tiger (mac os x 10.4.1) in vmware or virtualbox

I found this article and found it useful, so write it down before I forget.

http://www.aegisryan.com/2005/09/11/simplest-installation-of-mac-osx86-in-vmware/

The guide above is very simple , use p2p to download the vmware image , extract it and launch with vmware , then you will get a running tiger (mac os x 10.4.1). But I try it with vmware player 3.0, the performance is very bad. And also the network card is not working.

Then after google around , I found that virtualbox had better support , so I try it with Virtualbox 3.1.4 Open source edition, the performance much more better and consider usable. Without much more modification , I can start browsing. One trick is you have to press F8 during boot menu and enter : platform=x86pc , otherwise the boot process will hang at acpi detection.

Now have another problem is wanted to update it from version 10.4.1 to 10.4.11 seem no possible , because tiger support intel chip only start from 10.4.4 , so officially there is no updater which can update from 10.4.1 to 10.4.11. Still looking around , hope can find the solution.

The following is the URL to download the update tool from apple.

http://support.apple.com/kb/TA23880?viewlocale=en_US
http://support.apple.com/kb/TA24901



---

Monday, February 22, 2010

Postfix restricting users to send mails to certain domains or their own domain

Follow the steps suggested in postfix wiki will be able to restrict a list of users for sending emails to limited domains.
http://postfix.wiki.xs4all.nl/index.php?title=Client_sender_recipient_restrictions

To add on on the wiki , we can replace the ip address with the user email address. For example :

Instead of

#/etc/postfix/restricted_clients
#Add the list of IP addresses which cannot send emails outside
192.168.0.11 local_only
192.168.0.12 local_only

change it to

#/etc/postfix/restricted_clients
user@yourdomain.com local_only
user2@yourdomain.com local_only

The rest is the same , just try to restrict by user account instead of ip address.

Zimbra is using postfix as it smtp daemon , so these two guides might help us to have better understanding :

http://wiki.zimbra.com/index.php?title=Restrict_users_to_certain_domain
http://wiki.zimbra.com/index.php?title=Restrict_sending_to_certain_domains



---

Tuesday, February 9, 2010

Checking root LVM partition

If one day you are facing the problem that I am having now , the following information might be very useful.

I am using Fedora 12 and I suspect the root partition some how corrupted or facing bad sector issue power failure.

Here is my solution:

1. Boot from Fedora 12 installation CD or DVD , select rescue installed system option.
2. Skip the mount volume step. You can't check file system when a volume is mounted.
3. When you are at the shell prompt, issue the following command. It will activate the LVM volume.

lvm vgchange --ignorelockingfailure -P -a y

4. If you don't know the volume name , you can use the following command to list all the LVM volume.

lvm lvs

5. then you can issue the following command to check for bad sector. I assume you are using ext4 file system for root partition.

fsck.ext4 -c /dev/VolGroup/logVol00

Hope this will help.



---

Thursday, January 28, 2010

Flash Aztech dsl600ew firmware with Router Tech

I just successfully flash my Aztech DSL600EW router's firmware with Router Tech Firmware.

First upgrade firmware to official firmware 66.53.2-002 , if you need to download one , you might be able to find it at modem help web site.

Then download the Router Tech firmware - routertech-ar7wrd-adam2-firmware-4ports-20100105.zip , I tested with this version and it is working.

Using the web interface to upgrade the gateway reboot and run.

The LED configuration might not correct by default , so telnet into the router , issue command : setenv led_conf led.sar600 && /sbin/reboot , the led colour should be back to normal.

In case if you flash the firmware wrongly, you can refer to this URL : http://www.techarp.com/showarticle.aspx?artno=374&pgno=2 to restore the router back to official firmware.



---

Wednesday, January 27, 2010

How to convert avi to flv in Linux.

I did a couple of tests and these are the results that I've come up with.
Needless to say that I am no expert,
they are personal opinions,
see them as a starting point.

In the examples we will convert ".avi" to ".flv",
and simply copy the sound.
avi properties:
codec: mpeg4 (lavc) DX50
bitrate: I think its VBR (variable bit rate)
resolution: 640x480
frames per second: 30fps
video size: 5.4MB
sound: mp3
sound size: 1MB
total SIZE: 6.4MB


The tool we will be using is called ffmpeg.
It's a command line application, but very simple to use.
Probably already installed in your computer

We use the cd command to guide the terminal
to the folder where the "input.avi" file is.
example:

cd /home/username/Video



A typical command, then, would be:

explanation:
ffmpeg the program
-i input.avi the input file
-b 1024k the output bitrate
-s 320x240 the output resolution
-r 25 the output frames per second
-acodec copy the output audio codec
movie_1024_320_25_.flv the output file

A) For minimum decent results (updated 19-01-2008)
(poor quality, but not disturbing)
(resulted file size: less than 6.9MB)

ffmpeg -i input.avi -b 600k -s 320x240 -r 25 -acodec copy movie_600_320_25_.flv



B) For medium results (NOTE: this is temporary)
(resulted file size: 8MB)

ffmpeg -i input.avi -b 1024k -s 352x264 -r 25 -acodec copy movie_1024_352_25_.flv



C) For best results (file too big, maybe?)
(resulted file size: 22MB)

ffmpeg -i input.avi -b 2028k -s 640x480 -r 30 -acodec copy movie_2028_640_30_.flv



Further reading:
http://ffmpeg.mplayerhq.hu/ffmpeg-doc.html
http://flowplayer.org/documentation/encoding

I found these steps from : http://forums.liveleak.com/showthread.php?t=1716 .



---

Wednesday, January 20, 2010

VMware Player 3 crash on Fedora 12

If you have the same issue like me , VMware Player 3 crash upon launching in Fedora 12, all you need is execute the following command with root privilege :

cd /usr/lib/vmware/lib
mv libcurl.so.4 libcurl.so.4.old

Found the solution from :

http://blog.adl.pl/fixing-vmware-player-crash-upon-start-in-fedora-12/455
http://communities.vmware.com/message/1444574#1444574



---

Friday, January 15, 2010

Manually compile php at centos with default installation

If you plan to manually compile php at cents with the default installation , you might need to use the following command to install additional packages before you start the compilation .

yum install gcc httpd-devel libxml2-devel openssl-devel bzip2-devel curl-devel libpng-devel gmp-devel libc-client-devel mysql-devel aspell-devel

Here is the list of error that you might get when you try to compile php yourself at the Cent OS 5.4 server.

1. Configure: error: xml2-config not found. Please check your libxml2 installation.
# yum install libxml2-devel

2. Checking for pkg-config... /usr/bin/pkg-config
configure: error: Cannot find OpenSSL's
# yum install openssl-devel

3. Configure: error: Please reinstall the BZip2 distribution
# yum install bzip2-devel

4. Configure: error: Please reinstall the libcurl distribution -
easy.h should be in /include/curl/
# yum install curl-devel

5. Configure: error: libjpeg.(a|so) not found.
# yum install libjpeg-devel

6. Configure: error: libpng.(a|so) not found.
# yum install libpng-devel

7. Configure: error: freetype.h not found.
# yum install freetype-devel

8. Configure: error: Unable to locate gmp.h
# yum install gmp-devel

9. Configure: error: Cannot find MySQL header files under /usr.
Note that the MySQL client library is not bundled anymore!
# yum install mysql-devel

10. Configure: error: Please reinstall the ncurses distribution
# yum install ncurses-devel

11. Checking for unixODBC support... configure: error: ODBC header file '/usr/include/sqlext.h' not found!
# yum install unixODBC-devel

12. Configure: error: Cannot find pspell
# yum install pspell-devel

13. Configure: error: snmp.h not found. Check your SNMP installation.
# yum install net-snmp-devel

14. Configure: error: utf8_mime2text() has new signature, but U8T_CANONICAL is missing. This should not happen. Check config.log for additional information.
# yum install libc-client-devel



---

Thursday, January 14, 2010

ping sweep bash script

I found this simple bash script which does it job - ping sweep.

for i in {1..255}; do ping 10.0.0.$i -c 1 | grep "time=";done

Remember to change to change 10.0.0 to your network subnet accordingly.

I found this script from : http://www.markmmanning.com/blog/2008/12/ping-sweep-with-bash.html .



---