How to connect to remote computer with private key by using ssh:
If your private key was created for Windows, it will probably not work on linux/mac. It's necessary to convert it by using puttygen (on mac or windows). You need to open it by puttygen and choose "Save as openssh" from menu.
It's necessary to configure which parameters are passed to fast-cgi application from nginx server. For this purposes serves fastcgi_param keyword. It's a good practice to keeps all fastcgi params together. For this purposes nginx has fastcgi.conf file. This file already contains most of useful fastcgi_param bindings.
To include this file use include statement:
How to pass custom headers to fast-cgi app
Default configuration pass only default headers to fast-cgi. It's necessary to add few more configurations statements:
After that headers are passed as HTTP_* parameters:
During my attempts to install Fedora as virtual machine we got following error:
[caption width="774" align="aligncenter"] VMWare Fedora problem [/caption]
The solution is pretty simple. The problem is inside VMWare automatical installer and VMWare's **autoinst.iso** image which is automatically connected to virtual machine.
To resolve this issue, stop your virtual machine, open **Edit virtual machine settings** and remove first CD drive with mounted autoinst.iso.
[caption width="660" align="aligncenter"] How to fix problem when installing Fedora on VMW[/caption]
When you remove this iso from you VM, run it again and everything will work as expected.
Now you can upload any content to your router by any FTP client.
Step 2 - connect to router by telnet
My DD-WRT firmware has some problems with SSH so it isn't possible to use it. It's not a big deal because we can connect to router by telnet (in Win7 it's necessary to install it Add or Remove program->Turn Windows Features -> Telnet client). Run **Telnet** from start menu and type (use IP address based on your own configuration)
Even though I find phpMyAdmin and similar tools useful I don't like them on production servers. When I spent a lot of my time protecting website against SQL injection I don't want to leave opened doors to access the database through phpMyAdmin. Many phpMyAdmin installations are not protected with HTTPS and just one login on a public or attacked wifi can lead to a lot of troubles. So I recommend to delete the phpMyAdmin installation from the server and start with a more comfortable and secured way to do the task.
SSH tunnel will give you the security you're looking for. Start your Putty, load the session and configure tunnel:
I've selected port 3366 to be used on my local machine so it avoids conflict with my other installation. Now I can connect from any tool to MySQL database at localhost:3366. I prefer Netbeans IDE and MySQL Workbench which is also really great for server/user configuration.
We are using SSH a lot to deploy our projects and to do common maintenance tasks. If you are accessing your server many times a day you might find frustrating typing the password all the time. You can use private key instead. Here are some detailed articles about adding RSA key and configuring SSH daemon. Bellow is a summary of the basic steps for Windows users.
Putty which is a great alternative to the Linux tools. To generate private/public key you should use PuttyGen.exe. Run the application, click generate and follow the instructions. It's a good idea to put your name into the key comment so you could easily recognize your public key in configuration files. You should also protect your key with a password.
Copy the public key which is located in the big text field above Key fingerprint field. Append the public key into /root/.ssh/authorized_keys file (if you want to login as root). You might need to create this file if it doesn't exist already. Click on Save private key button and save the key to a secured place. You can now use this private key to login with putty to the remote server. To make things more comfortable you can use an agent to store unlocked private keys in the memory while you are logged into your computer. Run this command after you login:
Without any further settings you should now be able to login to the remote SSH without password. If everything worked as expected you can now disable password authenticated access to make your server more secure:
To load you key after you login to a Linux box (useful for deployment) insert:
# include .bashrc if it exists
if [ -f ~/.bashrc ]; then
keychain --clear id_rsa
Now we have a little bit more secured but more comfortable way to use SSH.
Integration of Google breakpad on any platform is really challenge. I didn't figure out how to do it by using recommended ways. So I did it my way ;-)
Create your own Qt project
As first thing I did when integrating Qt and Breakpad is creation of my own .pri file. I manually add all required files from Breakpad one-by-one, starting with src/platform/exception_handler continuing with all files included in previous ones. The complete .pri file you will find at end of this post.
After that I created simple CCrashHandler (inspired by qt-breakpad project) class which register exception handler. It's necessary to implement this handler for each platform separately because each platform have different parameters in google_breakpad::ExceptionHandler() constructor. CrashHandler source code you can find also at end of this post.
Do almost all steps like on Linux integration. There is one exception, because you can't compile Breakpad tools using linux-like configure&make. You have to build these tools with XCode.
Compile google_breakpad/src/tools/mac/dump_syms/dump_syms.xcodeproj with XCode
Before I managed to successfully compile dump_syms in XCode, I have to update Architectures Debug/Release to 64-bit Intel and BaseSDK to "Latest Mac OS X". I also fix all issues displayed in the left part of XCode window.
Next step is change compilation type from Debug to Release. After a short searching I found a way in "Schema->Edit schema->Build configuration".
To be honest, I was not sure what I did, but it worked ;-). Maybe there is some easier way how to compile dump_syms in xcode, but I don't know how. This was my first contact with XCode ;-).
The application is compiled to path "/Users/User/Library/Developer/Xcode/DerivedData/dump_syms-bjvr/Build/Products/Release/dump_syms". Now copy dump_syms to safe location from where you will use it.
The most amazing thing I found about dump_syms is their platform independence. If you correctly extract symbol file on each platform and store it in one location, you can analyze any crashdump on one location. No matter what is source platform, you will analyze .dmp file by using **minidump_stackwalk ./crash.dmp ./symbols**.
How to include CrashHandler directly to your project
This is what I get when I follow all includes from **.h** and **.cpp** files starting with exception_handler.h for all platforms. With small modification you can include it to your project and your application will be fully breakpad-able ;-).
And this is the minimal implementation of your new CrashHandler. My ownd crash handler is much more sophisticate to perform reporting, sending crash dump etc. But for purposes of this article this is what you need (And also I don't want to share my whole know-how here ;-)))
I have a lot of virtual machines used for my everyday development. It's very frustrating the SVN update speed if you have several externals in your main SVN source.
Today when I wait for some compilation start searching if there is anything what could improve SVN speed. After searching a lot of articles about faster network, better server hdd,... I found article with mention how SVN client communicate with server (intensively ;-) ). But without any clue how to improve it.
So I start searching how SVN client communiacte from within VMWare machines to server. I noticed that VMWare default network settings is NAT: Used to share the host's IP address:
So I start trying other network methods and this is the result:
When I use "Custom: Specific virtual network" and choose "VMnet0 Bridged", my svn update is about ten times faster than on NAT settings!!. I also tried first option "Bridged:..." but this doesn't work for me.
Today I need to share some testing data (deployment package) from one Ubuntu to another. Probably the simplest way is to install samba-server to Ubuntu and access it from the second one.
How to install samba server in Ubuntu
To install samba server, use:
When asked, enter new samba access password for selected user. Now you need to install gnome-install-tools to be able use shares-admin command to view all shared folders
Now setup folder sharing and close dialog. From now, you can use
to access your samba-shared folder.
How to access samba sharing from Ubuntu
If you want to access samba share from ubuntu using GUI-way, follow next steps:
1) Open Places->Connect to Server
2) Choose Type: Windows Share
3) To "Server" field enter IP of your server (or computer-name)
4) To "Share" enter path of your shared folder
5) "Folder" keep as is "/"
6) Enter user details based on previous samba server settings
Now click "Connect" and your shared folder should be connected.
Today I encountered another issue when compiling my Qt application http://www.orm-designer.com/ under Linux. The size of final executable was about 400MB.
The first thought was that there is some static libraries compiled to application. But the problem was elsewhere.
Unlike to Windows compilation where linker creates .exe and .pdb file, linux linker creates only one final file. So this file includes also lot of additional symbols useful for debugging and post-mortem bugs finding. But it is not so usefull for distribution your application. To strip all these symbols, use following command
Strip command have a lot of switches, but after a short testing it seems that the results are the same. Maybe I'm doing something wrong or simply my executable doesn't contain any additional infos for stripping.
**I found solution also for the problem with executing application form in-app directory!!, Look to text bellow.** Warning: This solution has one big disadvantage ;-(. It's necessary to execute application only from app-dir. In other cases system doesn't find required libraries. The solution could be run patchelf on the client computer with final installation path
Using -rpath to specify predetermined path. This method requires the users have this directory and have the full access to this directory
Another solution, the simplest one
I'm not sure why this solution isn't mentioned in Qt forums or anywhere else. Maybe this solution isn't so clean and perfect for Linux gurus, but it's perfect for me.
The solution is in simply changing the search path in already compiled application to "." (current directory) **current application location by using $ORIGIN variable**, so application will search all libraries in application directory first. It's simple, it's clean. All libraries distributed with application will be isolated in application directory and app-loader will not load any other library by mistake.
**Updated**: The keyword $ORIGIN do the trick, that you can run application from anywhere on your computer. $ORIGIN is absolute path to your executable.
And how to do this change? As first, you need to download small utility called PatchELF. With this application you can change -rpath in app to anything you need.
And it is. Now you can copy all required libraries to directory with your application and everything will works correctly.
If your application using some externals dynamic libraries (called .dylib in MacOs system), you have to provide all these libraries. The simplest way is to provide these libraries into the Application.app directory.
Find out which libraries are used
Qt provide really useful tool called **"otool"** which serves to lots of purpose. One of them is to detect which shared libraries are required by our application. For this purpose otool has parameter -L. The usage is following:
Output could looks like this:
Output from "otool" is simmilar to linux tool "ldd".
The Mac Deployment Tool
Because manual copying and configuring all shared libraries to our application could be difficult, Qt have deployment tool which do all work for us. Tool is called "macdeployqt" and can be found in /Developer/Tools/Qt/macdeployqt.
**Note:** Every time when you call macdeployqt tool, project have to be build from scratch. But is sufficient when whole result directory is removed and linked again:
Quick post about problem which I already solved, but think that could be handy for someone else.
I have following code:
When compiling under Visual studio, everything is ok. But when try the same code snippet under g++, have following error:
This is because compiler doesn’t known FindByType method, because T2 is templated argument. The solution which I found is in adding keyword template before FindByType method name. So updated source code will look like this:
After this update, code will be compiled correctly under both compilers.
Compilation under Windows is possible only using MinGW and with few modifications in TENG code (because there is few glitch which didn't meet c++ standards). If you want more information or updated TENG version, please let me know.