Wednesday, April 25, 2012

Fix "local unversioned, incoming add upon update" in subversion

After doing an svn update, if you run svn status and get a " >   local unversioned, incoming add upon update" error, perform the following:

svn resolve --accept working <conflicting_dir>
svn revert <conflicting_dir>
svn status

Thanks, http://tomhennigan.blogspot.com/2012/01/resolve-tree-conflict-svn-local.html#!/2012/01/resolve-tree-conflict-svn-local.html

Thursday, April 12, 2012

rsync with ssh and non-default identify file

rsync -rtzvL --progress -e "ssh -i /home/user/.ssh/alt/id_dsa" /path/to/local/dir username@remotemachine.host.com:/path/to/remote/dir

Tuesday, April 10, 2012

Profile slow mysql queries

Edit /etc/my.cnf

Add the following to [mysqld] section:

log-slow-queries
long_query_time = 1

sudo /sbin/service mysqld restart

Generate load.

There will be a slow query log in the mysql data dir.  The mysql data dir can be found by performing the following query:

show variables like 'datadir';

Thanks, http://hackmysql.com/nontech

Log every query in mysql

Edit /etc/my.cnf

Add in the following line to the [mysqld] section:

log=/var/log/mysql_query.log

touch /var/log/mysql_query.log

chmod 644 /var/log/mysql_query.log

chown mysql:mysql /var/log/mysql_query.log

sudo /sbin/service mysqld restart

Friday, April 6, 2012

Getting a Qt app working with boost using cmake

The problem:

You're using cmake to compile a Qt app which also uses boost, and you get an compilation error message like this:

error: expected ‘:’ before ‘slots’

What might be going on:

Your CMakeLists.txt file might have something like this in it:

ADD_DEFINITIONS(-DQT_NO_KEYWORDS)

The previous line is there to allow your Qt app to cooperate with boost signals and slots.  However, if you need to use Qt signals and slots, there is a workaround.

What you should do:

For Qt, use the following keywords instead:

Q_EMIT
Q_SIGNALS
Q_SLOTS

Easy enough!

Thanks, http://stackoverflow.com/questions/6399005/qt-xapian-library

Thursday, April 5, 2012

Determine what yum installed

How to determine what yum installed on Fedora linux:

rpm -qi --filesbypkg package-name

For example

rpm -qi --filesbypkg qt-examples

Thanks http://stackoverflow.com/questions/8068516/how-do-i-find-out-w-yum-or-rpm-what-files-it-installed!

Wednesday, April 4, 2012

Compile Subversion with HTTPS support in Fedora Linux

Update: subversion has changed.  See this post for updated instructions: http://muddyazian.blogspot.com/2014/10/compile-subversion-for-fedora-19.html

Get your source at http://subversion.apache.org/download/

sudo yum install neon neon-devel apr-devel apr apr-util apr-util-devel
./configure --with-ssl
make -j8
sudo make install

People DO read this

Yay :)

http://ericislearning.blogspot.com/2011/05/git-and-eclipse-helios.html

Tuesday, April 3, 2012

Profiling PHP Code

Time Profiling PHP Code: this is how to get your PHP code profiled with xdebug, Fedora and httpd.  Concepts might stretch to other platforms.

1) Install xdebug

sudo yum install php-pecl-xdebug

2) Under /etc/php.ini Options, add in the following line:

zend_extension = /usr/lib64/php/modules/xdebug.so

3) In /etc/httpd/conf/httpd.conf, change the following:

<Directory />
    Options FollowSymLinks
    AllowOverride None
</Directory>

to this

<Directory />
    Options FollowSymLinks
#    AllowOverride None
    AllowOverride All
</Directory>


4) Also put in the AllowOverride All command in the following place:

#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "/var/www/html">

    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
    #
    # The Options directive is both complicated and important.  Please see
    # http://httpd.apache.org/docs/2.2/mod/core.html#options
    # for more information.
    #
    Options Indexes FollowSymLinks

    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   Options FileInfo AuthConfig Limit
    #
#    AllowOverride None
    AllowOverride All


5) Perform the following permissions change:

sudo chmod -R 777 /var/lib/php/session

6) In the PHP code directory that you want to profile, create a .htaccess file and add in the following:

php_value xdebug.profiler_enable 1
php_value xdebug.profiler_output_dir /tmp

7) Restart httpd

sudo /sbin/service/httpd restart

8) You'll need kcachegrind to visualize the profiling output.  Download and compile it. 

8a) Get the source from here: http://kcachegrind.sourceforge.net/html/Download.html

8b) tar -zxvf kcachegrind-0.7.1.tgz

8c) sudo yum install kdebase-devel

8d) cd kcachegrind-0.7.1

8e) mkdir build

8f) cd build

8g) ccmake ..

8h) All the defaults are fine, but you can change the CMAKE_BUILD_TYPE to Debug

8i) make -j12

8j) sudo make install

9) Now, run your PHP script.  The results are either in /tmp or /tmp/systemd-private-*/tmp and you can visualize them with the /usr/local/bin/kcachegrind cachegrind.out.1234.

If you run into problems, you might find hints in/var/log/httpd/error_log.  Or, you can try to run your php script on the command line, e.g.:

$ php index.php