How to compile FastCGI library in Visual Studio 2010 C++

FastCGI comes with Win32 project for VisualStudio6. Unfortunately when you try to open it in VisualStudio2010 the project will be corrupted. To correctly compile it for VS2010 it’s necessary to download library sources, get patches from cybozu.co.jp site and apply it.

Download library

Download latest version of Development Kit here and extract it to standalone directory.

FastCGI

Get and update patches

Download all five patches from Cybozu site. Now when you have patches it’s necessary to convert all files to correct windows-ending format. This can be done for example in Notepad++.

Convert to windows EOL

Get patch.exe application

Now you need some application capable to apply the patches. Unfortunately windows doesn’t contain any application for this task and also lot of comparing/merging applications can’t do that.

The simplest way is to download windows conversion of linux patch.exe app. Get it from gnuwin32 site – patch for windows.

Apply patch to project files

Apply patches

Open directory with fastcgi library, copy all patch files to this directory and open command line. As next run patch command for all fives patches:

...\fcgi-2.4.1-SNAP-0311112127>patch -Np1 < 4-vc9.patch
patching file Win32/FastCGI.sln
patching file Win32/authorizer.vcproj
patching file Win32/cgifcgi.vcproj
patching file Win32/config_h.vcproj
patching file Win32/echo-cpp.vcproj
patching file Win32/echo.vcproj
patching file Win32/echox.vcproj
patching file Win32/libfcgi.vcproj
patching file Win32/logdump.vcproj
patching file Win32/size.vcproj
patching file Win32/threaded.vcproj

In case you will see following error message:

patching file Win32/FastCGI.sln
Assertion failed: hunk, file ../patch-2.5.9-src/patch.c, line 354

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.

it’s necessary to convert ALL patch files to correct Windows format (correct EOL) as mentioned in previous section.

More patches…

When you apply patches by cybozu it’s time to apply my own patches ;-).

Manually updated rejected file

As first, it’s probably that you will see following message:

1 out of 26 hunks FAILED -- saving rejects to file libfcgi/os_win32.c.rej

It’s because original patch is for older version of library and file os_win32.c  is slightly different. To fix that, edit this file at line 841 and manually update following line:

//original
int len = p - bindPath + 1;

//updated line
intptr_t len = p - bindPath + 1;

Update VS project file

Now turn off generating the Map Files in project configuration. These files aren’t necessary and it isn’t possible to compile project correctly with this settings.

Turn off .map files

DONE

And that’s all. Now you will be able to sucesfully compile fast-cgi library.

Compilation complete

External links

FastCGI c++ library for all platforms (Windows, Mac and Linux)

List of existing libraries

Snippets

Stackoverflow articles

Tutorials

Other links

CGICC – how to update it for VS2010 COMPILATION

  •  error C2668: ‘cgicc::copy_if’ : ambiguous call to overloaded function – add cgicc:: to all cgicc::copy_if instances
  •  error LNK2019: unresolved external symbol – add compiled .lib path (…Debug\cgicc.lib) to all dependend projects

Problem installing Fedora18/19 on VMWare

During my attempts to install Fedora as virtual machine we got following error:

VMWare Fedora problem
dracut-initqueue[350]: mount: /dev/sr1 is write-protected, mounting read-only
dracut-initqueue[350]: warning: Could not boot

Entering emergency mode. Exit the shell to continue
Type "journalctl" to view systm logs.

dracut:/#

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.

How to fix problem when installing Fedora on VMW

When you remove this iso from you VM, run it again and everything will work as expected.

Fedora installation

C++ Code coverage tools for Windows and Linux (DRAFT)

Linux

  • CovTool – Free test coverage analyzer for C++
  • ggcov –  GTK+ GUI for exploring test coverage data produced by C and C++ programs compiled with gcc –coverage.
  • lcov – graphical front-end for GCC’s coverage testing tool gcov. Creates HTML pages containing the source code annotated with coverage information.
  • Trucov – open source program that works with the GCC compiler to display the control flow of a program and its test coverage information

STEPS:

1) add CXX, CFD + LINKER FLAGS

2) remove OBJS output dir and generate .o .gcov,… to root project directory

3)remove MOC directory output for Qt app

3)run gcov xx.cpp

— generate html

sudo apt-get install lcov (http://ltp.sourceforge.net/coverage/lcov.php)

lcov --capture --directory ~/dev/Applications/AtomixApp/AtomixApp --output-file coverage.info

How to use articles

How to integrate with jenkins

StackOverflow questions

DD-WRT Monitoring bandwidth per IP

For detailed bandwidth tracking there is a great plugin ip_conntrack available on dd-wrt.com forum.

Step 1 – upload plugin to DD-WRT

The easiest way how to upload any content to DD-WRT is build-it ProFTPD server. To enable it, open Services -> NAS and check ProFTPD server.

DD-WRT FTP

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)

<br />o 192.168.0.1<br />
Telnet

Step 3 – Install ip_conntrack plugin

Now it’s necessary to execute all steps described in ip_conntrack post.

#Extract and set correct permissions
chmod +x /tmp/MyPage/*.sh
ln -s /tmp/MyPage/www/qos_conntrack.js /tmp/www/

#register new page
nvram set mypage_scripts="/tmp/MyPage/qos_conntrack.sh"
nvram commit

#activate new page
/tmp/MyPage/traffic_monitor.sh&

Step 4 – Configure automatic execution of script

Not tested, more info on plugin page

External links

Jenkinks and MacOS application signing

After re-installing our MacOS building machine which we’re using for ORM Designer deploy, we started to getting following message:

./OrmDesigner2.app: User interaction is not allowed.

After short searching on the internet I found it’s required to click on “Always Allow” dialog…. which unfortunately we don’t have on the console ;-).

The trick is in the keychain unlock. For this purpose we can use following command:

security unlock-keychain -pPASSWORD ~/Library/Keychains/login.keychain

That’s all. After this command I’m able to sign my application from Jenkinks command line again.

External links

Slow execution of application from Visual studio

Today my Visual Studio 2010 started to execute my application super slowly. When I tried to execute my application (without any changes in source-code) the delay between “Start Debugging” and application start was about one minute.

I know that too many breakpoints or breakpoints in templates could caused this, but I don’t see any breakpoint in my Breakpoints window.

Breakpoint window

But as I have found that the problem was really caused by breakpoints. In some special cases – when you’re using some external tools to modified your project file (.sln/.vcxproj) – breakpoints can disappear and begin to make a trouble (I’m using Qt qmake to update my project based on .pro files.)

The solution is pretty easy. Use Delete All Breakpoins from Debug menu:

Delete all breakpoints

And your problem will be solved ;-).

List of online (live) chat services for your web

Service Free plan Basic paid plan Features/Notes
www.clickdesk.com
pricing
$0/month

  • 1 Agent
  • 30 chats/month
  • 1 department
  • 1 domain
  • 25 help desk/month
  • GTalk integration
  • 1 concurent chat
$9.99-14.99/month/agent

  • price per agents
  • 3 departures
  • 3 domains
  • Skype, webchat
  • visitor info
  • 5 concurent chat
  • IM integration support
mylivechat.com
pricing
$0/month

  • 1 Agent
  • 1 departure
  • unlimited domains
  • unlimited chats
  • basic visitor monitoring
$25/month

  • 2 agents
  • unlimited departures
  • advanced monitoring
  • $12 for additional agent
  • Doesn’t support IM clients
flexytalk.com
pricing
$0/month

  • 1 Agent
  • 1 domains
  • 1 channel
$4-9/month

  • 1 agent
  • 2 channels/agent
  • $8 for additional agent
  • Gtalk/Jabber support
  • 2months for free on annual payment
zopim.com
pricing
$0/month

  • 1 Agent
  • 1 concurrent chat
  • 14-day chat history
$9.80/month/agent

  • Unlimited chats
  • 2 triggers
  • 2 departments
  • Gtalk/Skype support
  • HTML5 dashboard
  • See visitor webpath
www.livechatinc.com
pricing
No free plan $39/month/agent

  • Unlimited chats
  • Groups
  • Reports
  • Browser/Win/MacOSX/iPhone/Android support
  • Integration to several other products
www.userlike.com
pricing
No free plan $29/month

  • 3 operators
  • 3 widgets
  • Chat panel
  • Automatic Invites
  • CRM integration
  • 20% discount on yearly subscriptions
  • 6 months for free for startups
  • Integration to several other products
  • IM integration (jabber, pandion)
www.purechat.com Completely free

  • 100% free
  • no ads
  • unlimited chats/operators
  • Missing IM support
  • “Failed to connect to PureChat!” error when I tried it
www.velaro.com
pricing
No free plan $29.95/month/operator

  • basic plan (business plan for $99/month)
  • Click-to-Chat
  • 3-rd party integration only for business plan
  • for $29.95 very limited
  • Integration to several other products
  • Missing IM integration
www.boldchat.com
pricing
free license
$0/month

  • Multi-domain deployment
  • 1 simultaneous license allowed
  • 750 monthly chats
  • 3 concurrent chats
  • no visitors tracking
  • no UI customization
$99.95/month/operator

  • basic plan (business plan for $499 and $999/month)
  • super-expensive 😉
  • 3-rd party integration only for business plan
  • for $29.95 very limited
  • Integration to several other products
  • Missing IM integration
www.olark.com
pricing
free license
$0/month

  • 1 operator
  • 20 monthly chats
$17.00/month

  • 1 operator
  • Gold plan for $49/month for 4 operators
  • CRM integration
  • IM integration
  • 10% discount on 1 year subscription
www.websitealive.com
pricing
No free license $29.95/month

  • 2 operator
  • Additional operators for $9.95/month
  • Visitors tracking
  • Mobile chat
  • Customization
  • Missing IM integration

Another web-chats:

Service for translating IP to geolocation (country)

Today I need for our statistic server translate IP of our users to country codes. After short searching I found following services:

Winner 😉

Free

Paid

List of services

How to unroot Samsung Galaxy S3 device

Because of warranty I needed to unroot my S3. After a lot of searching I found following articles which helped me to revert my phone to factory defaults.

Used software

  • TrianglAway – tool for reseting flash-counter inside the android firmware
  • SamMobile – server with all Samsung S3 firmwares
  • Samsung Updates – Official Samsung site with all firmwares

HTML5 + Javascript chart libraries

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.

Chart libraries

Tested and usefull

Not tested, hard to use, not attractive …

GetTickCount64 problem on WindowsXP

The procedure entry point GetTickCount64 could not be located in the dynamic link library KERNEL32.dll
The procedure entry point GetTickCount64 could not be located in the dynamic link library KERNEL32.dll

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:

2013-08-29_15-45-10

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"

External links:

Why I am not using phpMyAdmin on production servers

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:

Putty tunnel screenshot

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.