Entries Tagged 'development' ↓

How to repair an SQLite database

echo ".dump" | sqlite3 old.db | sqlite3 new.db

Explanation: pipe “.dump” to sqlite and use that output (the dump itself) to fill the new.db database.

Cleaning up Git

I had this huge git repository (1.9 gigabyte) and I couldn’t discover WHY is was SO big. After reading up on some git cleaning et cetera I did a `git gc`. I went from 1.9g to 12mb (megabytes yes). Unbelievable…

git-gc – Cleanup unnecessary files and optimize the local repository

Git: an easy way to change authors name

git filter-branch --commit-filter 'if [ "$GIT_AUTHOR_NAME" = "LeonB" ];
  then export GIT_AUTHOR_NAME="Leon Bogaert"; export GIT_AUTHOR_EMAIL=leon@tim-online.nl;

After this is done you can do:

git push -f

It says some scary things like:

# Your branch and 'origin/v3' have diverged,
# and have 75 and 75 different commits each, respectively.

But you can Ignore those.

motorrijweer.nl

Ik heb de eerste versie van motorrijweer.nl live gezet! ‘t Is nog vrij basis maar je kunt wel al voor een paar regio’s het motorweer/motorrijweer opvragen. Op naar de volgende versies!

Motorrijweer / motorweer

Removing the password from an (open) ssl key

openssl rsa -in www_silverpower_nl.key -out www_silverpower_nl.key.unencrypted

dump a Varien_Db_Select / Zend_Db_Select query


$query = $adapter->getProfiler()->getLastQueryProfile()->getQuery(); //print last executed query
foreach ($adapter->getProfiler()->getLastQueryProfile()->getQueryParams() as $k => $v) {
$query = $query = str_replace($k, "'{$v}'", $query);
}
var_dump($query);

A more complete example:


$adapter = Mage::getSingleton('core/resource')->getConnection('core_write');
$adapter->getProfiler()->setEnabled(true); //enable profiler

// Do database stuff

$number = 10;
$profiles = $adapter->getProfiler()->getQueryProfiles();
$profiles = array_slice($profiles, count($profiles)-$number, $number);

foreach ($profiles as $profile) {
$query = $profile->getQuery(); //print last executed query
foreach ($profile->getQueryParams() as $k => $v) {
$query = $query = str_replace($k, "'{$v}'", $query);
$query = preg_replace('/\?/', $v, $query);
}
var_dump($query);
}

git add -u

This is a nice one:

git add -u

This only adds already commited files to a new commit. And leaves files not in the git repository alone.

Sublime Text 2

I installed sublime text on my Ubuntu 11.10 box but I had some troubled loading external python modules:

loaded 937 snippets
>>> import distutils
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named distutils

This is how I solved it:

Edited ~/.local/share/applications/sublime.desktop
Especially this line:

Exec="/home/leon/Software/bin/sublime" %U

/home/leon/Software/bin/sublime contains this:

#!/bin/bash
cd /usr/lib/python2.7
/home/leon/Software/SublimeText2/sublime_text

Then I installed some excellent plugins:

Nice: github resumé

Generate your own Github resumé

Removing packages marked rc

I got an error when building the 2.32 version for ubuntu. Some packages once where installed but got removed. But they still had the status rc.

So I purged them with the help of this blog.

I compiled evolution with the help of a Makefile that I downloaded.

I had to add the “maverick” distro and install some additional packages such as:

  • gobject-introspection
  • autopoint
  • libgdata-dev

I removed the evolution-exchange plugin.

The master branch of gweather required gtk3 so I changed that to: gnome-2.30 (or something)
I had to apply a patch to solve a build error.

Bottom of this post: http://www.mail-archive.com/evolution-hackers@gnome.org/msg03863.html

http://www.mail-archive.com/evolution-list@gnome.org/msg15575.html