Getting error 2006 during database backup import. The problem is in short timeout and small packet size. It’s necessary to update my.cnf and restart MySql service.
For our side-project used for customer analytic we need simple way how to generate HTML pages with tables and charts. As HTML5 UI framework we’re using Foundation and for tables jQuery Tablesorter. Now the question is which chart library use for charts.
Today we received report from one of our customers about problem with our ORM Designer on WindowsXP – 32bit. Our latest version returns following error:
The procedure entry point GetTickCount64 could not be located in the dynamic link library KERNEL32.dll
The problem is that GetTickCount64 doesn’t exists in XP system.
Solution:
It’s necessary to compile your application (and any library which uses GetTickCount64) with correct WINVER and _WIN32_WINNT defines value. List of WINVER values for all Windows version can be found here.
You can define these values in your resource.h file:
#define WINVER 0x0501
#define _WIN32_WINNT 0x0501
or add it to a project property -> C/C++ -> Preprocessor -> Preprocessor Definitions:
Qt Solution:
If you want to define these values automatically in Qt project, add following lines to your .pro file:
#Windows XP compatability
DEFINES += "WINVER=0x0501"
DEFINES += "_WIN32_WINNT=0x0501"
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:
pageant.exe john_doe.ppk
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:
# /etc/ssh/sshd_config
PasswordAuthentication no
To load you key after you login to a Linux box (useful for deployment) insert:
# ~/.bash_profile
# include .bashrc if it exists
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
keychain --clear id_rsa
. ~/.keychain/$HOSTNAME-sh
ssh-add
Now we have a little bit more secured but more comfortable way to use SSH.
During our development we found that Microsoft RegEx (Regular expression) implementation contains a bug which caused crashes of our applications. The application module using RegEx passed all unit test, but sometimes under heavy usage the application crashed at our customer. Because we use BugTrap for error and crash notifications, we knew the error was in atlrx.h file.
After several hours of testing and searching we found the bug. The crash didn’t occur after first code execution, but we had to run thousand iterations of the same code over and over. The bug is located in file atlrx.h at line 708.
Original file looks like this:
case RE_ADVANCE:
sz = CharTraits::Next(szCurrInput);
szCurrInput = sz;
if ( sz == NULL || *sz == '\0')
goto Error;
ip = 0;
pContext->m_nTos = 0;
break;
Problem is, that variable szCurrInput have in some circumstances NULL value and this causes the crashes.
We change the first two lines. It is necessary to test szCurrInput variable for NULL and empty string value. If szCurrInput is NULL or empty string, it’s necessary to stop processing RegEx. Otherwise stack overflow during processing string occurs.
Note
Some time later we had other problems with Microsoft RegEx implementation and non-standard RegEx syntax. So we left MS RegEx parser and moved to Boost.Regex which is really nice piece of code (as well as other libraries of the Boost pack) and supports Perl and POSIX regular expressions. Whole Boost library is carefully unit test and can be relied on.
Here is a snippet to convert string in XSLT template from CamelCase to hyphenized text. (Developed today while creating new import/export templates for Doctrine2 YAML support).
Here is a snippet to convert string in XSLT template from hyphenized text to CamelCase. (Developed today while creating new import/export templates for Doctrine2 YAML support).
One of tool we’re using requires msdia80.dll file. Unfortunately this DLL is available only inside the VS2005 installation / redistributable pack. When you execute dump_syms.exe without this file, you will receive following message:
"OrmDesigner2" can't be opened because it is from an unidentified developer.
Solution
To solve this error message it’s necessary to do following steps:
Register in Apple developer program and pay $99 per year
Download and install developer certificate
Sign whole application
Test it!
1) Register on Developer.apple.com
You need to create registration here: https://developer.apple.com/. It’s necessary to fill info about contact person and company. After that, your registration will be reviewed by apple team and if everything will be OK, your registration will be approved.
Now you need to install this certificate to your developer machine. Simply double-click on certificate and let system to import it. You can check that certificate is imported in Go->Utilities->Keychain Access->login. Now search for “Developer ID Application: XXXX”
Note: In my case when I transfer certificate to several developer machines I need to migrate also other Apple certificates. Without that my certificate wasn’t a valid.
3) Sign your application
Now you need to sign your application including all plugins and frameworks inside app bundle. After you sing your app, you can’t do any changes in the bundle. So as first run your deploy as usual and as last step do app singing.
For ORM Designer sign script looks like this:
#go to deploy directory
cd $StarkDeploy.directory$/deploy
#sign app
codesign --force --verify --verbose --sign "Developer ID Application: Inventic s.r.o." ./OrmDesigner2.app
#sign all *.dylib files
find OrmDesigner2.app -name *.dylib | xargs -I $ codesign --force --verify --verbose --sign "Developer ID Application: Inventic s.r.o." $
#sign all Qt* frameworks
find OrmDesigner2.app -name Qt* -type f | xargs -I $ codesign --force --verify --verbose --sign "Developer ID Application: Inventic s.r.o." $
4) Test it!
As last step it’s necessary to test that sign process was successful. As first you can try following command line to validate it:
codesign -vvv -d OrmDesigner2.app
#RESULT:
Executable=/OrmDesigner2/DeployFiles/macos64/deploy/OrmDesigner2.app/Contents/MacOS/OrmDesigner2
Identifier=com.orm-designer.OrmDesigner2
Format=bundle with Mach-O thin (x86_64)
CodeDirectory v=20100 size=174478 flags=0x0(none) hashes=8717+3 location=embedded
Hash type=sha1 size=20
CDHash=5a491e16f7dcca15b44af4XXXX1a2d2dcc786518
Signature size=4237
Authority=Developer ID Application: Inventic s.r.o. (6BYV46LH6T)
Authority=Developer ID Certification Authority
Authority=Apple Root CA
Signed Time=6 Jun 2013 23:16:08
Info.plist entries=10
Sealed Resources rules=4 files=27
Internal requirements count=1 size=212
Now when you checked that App is correctly signed, it’s time to try it on clean computer where no security policy changes was made. Upload your app and execute it.
If you don’t see annoying screen “Can’t execute application from unidentified developer”, you win ;-).
We reached the point where we need some kind of CRM system. We have a lot of customers, oportunies and tasks we need to track and keep records. I tried several of them and read about much more. Here are summary of CRMs with short info about each.