Saturday, December 14, 2013

Connection to sql server on VS 2012

SqlConnection connection = new SqlConnection();
            connection.ConnectionString = ("Server=.\\sqlexpress; user id=sa; password=home; database=webapp");
            connection.Open();
            TextBox1.Text = "Connected";

Wednesday, November 7, 2012

Split file on linux and combine on windows

I have a problem with git on windows, then I tried to clone it on ubuntu.
The problem is  after I tar my source folder I can't attach it in the email attach file. because the file's size is more than 10MB. (I have no flashdrive)

   Then I search the solution how to do it and I found this link http://stackoverflow.com/questions/1120095/split-files-using-tar-gz-zip-or-bzip2

   very easy to do.
split on linux

split -b 1024m "file.tar.gz" "file.tar.gz.part-"

combine it on windows
copy /b file1 + file2 + file3 + file4 filetogether

Wednesday, August 29, 2012

Joomla error with ftp

original link : http://forum.joomla.org/viewtopic.php?p=2257486

I would like to share my trouble shooting experience below:

(1) ensure you have a valid ftp account ID and password. the ftp account should be valid for your Joomla root folder, such as public_html.
(2) use a 3rd part ftp client, like leechftp, to verify your ftp account ID, password, ftp IP, port number, and your access to the Joomla root folder. if you fail this step, you need to fix it to make sure you have correct data to add to your global configuration in later steps.
(3) once you have verify the data you have, you can log in as a administrator to your Joomla back-end and go to your global configuration> server.
(4) add all of your account data in step (2) above but keep the "enable ftp" to "no". click "apply". if you have error, you need to fix your access permission to configuration.php file before moving on. (some people may confuse their ftp problem with configuration.php problem, when they enable ftp and get an error, because, if you enable ftp, Joomla no only saves your settings but also tests your ftp connection.)
(5) if you pass step (4), it means that you have the correct permission to update your configuration.php and your ftp account values should be added to the file. then, you can switch "enable ftp" from "no" to "yes".
(6) if you see "FTP::login" error, your ftp account data are bad. go back to step (2) above to fix them.
(7) if you pass step (6) with no "FTP::login" error but have "FTP::write" error, then your remaining problem is your "ftp root". make sure the "ftp root" value is a "local" path, not the full path of your web site. for example, you should put "/public_html", even though the full path is "/home/<your_id>/public_html". if you have the correct path value and pass the steps above, you should have no more error.
(8) to test your ftp settings, go to media manager and try to upload a file and you should have no problem. and, you complete your ftp setting.

My lessons learned are ...

(1) I use a new ftp account with no access to public_html.
(2) I use a correct ftp account but put the full path for my ftp root.
(3) I thought I had ftp problem but the actual problem was failing to update my configuration.php file due to file permission. File permission was fixed after I correct it by using the same user as the user I installed Joomla (make sure you can edit the file, when you login as the user to your Linux or other OS account without Joomla).

Hope these steps will help you to isolate and troubleshoot the problems correctly.


Joseph

Friday, September 9, 2011

Ubuntu : how to remote desktop by using x11vnc

source from : http://ubuntuforums.org/showthread.php?t=488207


1. Install x11vnc & xinetd package (if you have not already)


Code:
sudo apt-get install x11vnc xinetd

2. Set the VNC passwd


Code:
sudo x11vnc -storepasswd yourpasswordhere /etc/x11vnc.pass

3. Add x11vnc service to xinetd:


Code:
sudo gedit /etc/xinetd.d/x11vnc

Enter this into the new file:



Code:
service x11vnc

{

        port            = 5900

        type            = UNLISTED

        socket_type     = stream

        protocol        = tcp

        wait            = no

        user            = root

        server          = /usr/bin/x11vnc

        server_args     = -inetd -o /var/log/x11vnc.log -display :0 -auth /var/lib/gdm/:0.Xauth -many -bg

        disable         = no

}

4. Configure GDM to run x11vnc when at loading time:


Code:
sudo gedit /etc/X11/gdm/Init/Default

and this line to the file:


Code:
/usr/bin/x11vnc -rfbauth /etc/x11vnc.pass -o /tmp/x11vnc.log -forever -bg -rfbport 5900

(you can change the port and other parameters)


5. If you restart your PC at this stage you’ll only be able to login, then the GDM will kill your session. To avoid this we must change another file:


Code:
sudo gedit /etc/X11/gdm/gdm.conf

now search for this line :

#KillInitClients=true

And change it to this:

KillInitClients=false


6. Restart xinetd (usually there is no need to reboot, but occasionally it might be required)


Code:
sudo /etc/init.d/xinetd stop

sudo killall x11vnc

sudo /etc/init.d/xinetd start

7. Install OpenSSH-Server for remote connections...using putty or whatever...


Code:
sudo apt-get install openssh-server

Restart your box, you will have resumable VNC sessions available on startup available via a secure shell.






Tuesday, April 12, 2011

How to make lrzsz (ZMODEM, XMODEM) for angstrom-linux

1. Download lrzsz form http://www.ohse.de/uwe/software/lrzsz.html

2. config Cross-compiler

                CC=arm-angstrom-linux-gnueabi-gcc CXX=arm-angstrom-linux-gnueabi-g++ ./configure --build=i386-linux --host=arm-linux --target=arm --prefix={your folder}

                make
                make install
look inside bin folder that you located and copy to your board and run it.
Done.

mini2440 LCD shifted right

I got this problem when i compiled new kernel.

 I looked for the solution to solve this problem but The best solution is just set config in bootargs


The mini2440=0tb is used for an older 3.5" LCD. The LCDs after 2009 Nov
(T35) requires the 3tb parameter.

Use setenv bootargs root=/dev/mtdblock3 rootfstype=jffs2
console=ttySAC0,115200 mini2440=3tb; saveenv; reset or similar in the uboot
prompt to solve the issue.

Sunday, April 10, 2011

Qt : How to add static image in your code

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);


    QWidget *pic = new QWidget(ui->tab);
    pic->setStyleSheet("background-image: url(path/to/yourImage.jpg)");
    pic->setGeometry(QRect(10,10,220,48)); // your location and size.


}