George Opritescu

Developer from somewhere

updating to postgresql 9.2.4

I needed to upgrade pg_dump from 9.1.9 to 9.2.4, so I needed to upgrade postgresql as well. I found the solution here.

1
2
3
4
wget --quiet -O - http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get install postgresql-common -t raring
sudo apt-get install postgresql-9.2

After doing this I symlinked the 9.2.4 pg_dump version:

sudo ln -s /usr/lib/postgresql/9.2/bin/pg_dump /usr/bin/pg_dump
Read More

convert between encodings from the command line

Here’s how to change a file’s encoding from windows-1250 to utf-8:

1
iconv -f windows-1250 -t utf-8 some_file.txt
Read More

Compiling threads under ubuntu

Command to compile: g++ r.cpp -o x -pthread -std=c++0x

1
2
3
4
5
6
7
8
9
10
11
12
13
#include <iostream>
#include <thread>

using namespace std;
  
void do_work() {
  cout << "Doing work" << endl;
}

int main(int argc,char* argv[]) {
  std::thread t(do_work);
  t.join();
}
Read More

Compiling cpp code using a rakefile

Been trying to build smth with libcurl. These is my Rakefile:

1
2
3
4
5
6
7
8
9
10
PROG  = "x"                                                                                                                                               
files = FileList["**/*.cpp"]                                                    
linked_libs_folders  = ["/home/john/code/cpp1/curl-7.32.0/installed/lib"].map {|e| "-L#{e}"}.join(" ")
libs_to_link_against = ["curl"].map {|e| "-l#{e}"}.join(" ")                    
file PROG => files do                                                           
  puts "Compiling #{PROG}"                                                      
  sh "g++ #{files} -o #{PROG} #{linked_libs_folders} #{libs_to_link_against}"   
end                                                                             

task :default => [PROG] 
Read More

booting without full network configuration

So that I didn’t have to wait almost 2 min for my Ubuntu to book, I changed my /etc/network/interfaces file to this:

# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
Read More