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.

Secure SSH with RSA/DSA key

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.

PuttyGen screenshot

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.

Error in RegEx (atlrx.h) in Visual Studio C++ 2003 and 2005

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.

Updated file with bug fix:

  case RE_ADVANCE:
    if( szCurrInput == NULL || *szCurrInput == '\0' )
      goto Error;
    sz = CharTraits::Next(szCurrInput);
    szCurrInput = sz;
    if ( sz == NULL || *sz == '\0')
      goto Error;
    ip = 0;
    pContext->m_nTos = 0;
    break;

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.

XSLT snippet to convert string from CamelCase to hyphens (Hyphenize)

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).

Usage:

<xsl:call-template name="ConvertCamelToXmlStyle">
	<xsl:with-param name="text">OrmDesigner</xsl:with-param>
</xsl:call-template>

Result:

orm-designer

XSLT Template:

	<!-- =========================================================================== -->
	<!-- === Convert CameCaseText to camel-case-text                             === -->
	<!-- === (c) Inventic s.r.o. ORM Designer team (http://www.orm-designer.com) === -->
	<!-- =========================================================================== -->
	<xsl:template name="ConvertCamelToXmlStyle">
		<xsl:param name="text"/>
		<xsl:variable name="Upper">ABCDEFGHIJKLMNOPQRSTUVQXYZ ,</xsl:variable>
		<xsl:variable name="Lower">abcdefghijklmnopqrstuvwxyz</xsl:variable>

		<xsl:for-each select="str:split($text,'')">
			<xsl:choose>
				<xsl:when test="contains($Upper,node())">
					<xsl:if test="position()>1">
						<xsl:text>-</xsl:text>
					</xsl:if>
					<xsl:value-of select="translate(node(),$Upper,$Lower)"/>
				</xsl:when>
				<xsl:otherwise>
					<xsl:value-of select="node()"/>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:for-each>
	</xsl:template>

Feel free to use in whatever way you find it useful.