Articles

Previous page  123456  Next page

News 10 years Ago
 
Published by packi on in Technology

Maybe you shouldn’t code with a hangover, but I think its not just me who’s stumped while looking at the following linker message:

linking xyz (g++)
myfile.o: In function `MyFile':
/home/patrick/projects/xyz/trunk/src/myfile.cpp:608: undefined reference to `vtable for xyz::MyFile'

This happens if you declare an overriden (virtual) function but haven’t implemented it. Thank you ld for your clarity…

 
Published by packi on in Quotes

Speaking of a beautiful woman “Such things makes you question the nonexistence of god”

– Myself

 
Published by packi on in Quotes

“If god wanted us to go to church on Sundays he wouldn’t have invented gin tonic”

– Myself

 
Published by packi on in Technology

I’ve just published the first part of my article about our internal Wiki move operation. Read it here.

 
Published by packi on in Technology

…doesn’t mean I’m not busy. While finishing the winter semester and the semester project (on WLan positioning) I’ve had a run-in with Perl. Read about my CPAN adventure here.

 
News 11 years Ago
 
Published by packi on in Technology

While rummaging through my projects folder I’ve discovered the following script, I’ve written some time ago. It’s a script that rips the longest track from a DVD, but doesn’t compress them. That preserves all the languages, subtitles and doesn’t introduce new compression artifacts. But at the expense of disk space, that’s not too valuable nowadays, a DVD needs about 5 to 7 GB.
You’ll need lsdvd and transcode installed in order to run this script.

#!/bin/bash
#
# shellrip.sh − Copyright © 2006 by Patrick Staehlin <me@packi.ch>
#
# Rips the vob's from a DVD in 1 GB chunks.
#
# Usage:
# ./shellrip.sh [tracknr] [target_dir]
#
# The default tracknr is the longest track on the disk.
# If you don't specify target_dir, the dîrectory will be the dvd's title.
#

lsdvd /dev/dvd > tmpout 2> /dev/null
title=`grep "Disc Title" tmpout | cut -c 13-`
trackToRip=`grep "Longest" tmpout | cut -c 16-`
rm tmpout

if [ "x$2" != "x" ]; then
  title=$2
fi

titleAbs=`pwd`/$title;

if [ "x$1" != "x" ]; then
  if [ $trackToRip = $1 ]; then
    mkdir $title;
    cd $title;
  else
    trackToRip=$1;
    mkdir $title;
    cd $title;
    mkdir $1;
    cd $1;
    titleAbs=$titleAbs/$1;
    title="$title-$1";
  fi
else
  mkdir $title;
  cd $title;
fi

echo "DVD: $title will rip $trackToRip";
dr_exec tccat -t dvd -T $trackToRip,-1,1 -i /dev/dvd 2> /dev/null | 
dr_splitpipe -f $titleAbs/nav.log 1024 $titleAbs/$title vob 2> /dev/null | 
tcextract -a 0 -x ac3 -t vob | tcdecode -x ac3 | tcscan -x pcm
 
Published by packi on in Technology

Looking at at the following lines of C++ code:

#include <iostream>

using namespace std;

class A {
public:
  A() {};
  virtual ~A() {};
};

class B : public A {
};

class C : public A {
};

class F {
};

class D : public C,F {
};

For the C++ impaired, it defines a superclass A that has two descendants B and C. C itself has another descendant D. D has another superclass F.

If you’ve got an instance inst that’s a derivative of A you can use dynamic_cast<X*>(inst) to determine if inst is an instance of X.

I wrote a test function to determine if that’s really the case:

void test( A* _c ) {
  if( dynamic_cast<B*>(_c) ) {
    cout < "is B" < endl;
  }
  if( dynamic_cast<C*>(_c) ) {
    cout < "is C" < endl;
  }
  if( dynamic_cast<F*>(_c) ) {
    cout < "is F" < endl;
  }
}

int main() {
  cout < "creating B" < endl;
  test( new B() );
  cout < "creating C" < endl;
  test( new C() );
  cout < "creating D" < endl;
  test( new D() );
  return 0;
}

After compiling the file with g++ test.cpp and running the resulting executable I’ve got a somehow unexpected result:

patrick@pentagon ~/test $ ./a.out
creating B
is B
creating C
is C
creating D
is C
patrick@pentagon ~/test $

It is apparently a common mistake to read:

[…]
class D : public C,F {
[…]

as:

[…]
class D : public C,  public F {
[…]

when it really means:

[…]
class D : public C,  private F {
[…]

Defining the inheritance of F as public finally yielded the expected result:

patrick@pentagon ~/test $ ./a.out
creating B
is B
creating C
is C
creating D
is C
is F
patrick@pentagon ~/test $

You can download the full source for this test here.

 
Published by packi on in Others

As I don’t want to get lost in some online casino (the ones that are actively spaming this blog for example) the search for an off line alternative has begun. I’ve stopped my quest after discovering PokerTH.
After downloading and untaring the first trap is that it doesn’t compile the usual ./configure && make && make install way but is served as a KDevelop project. No problem for me as I usually use KDevelop for my projects but surely a show-stopper for a gnome user (you know, the foot thing), not willing to install KDevelop just to try it out once.

After firing up kdevelop and a successful compile run later you’re presented the following screen:

Some time later in the game (just before I folded):

Anyway enjoy the last hours in 06 and see you later in 07 (or in 06 2.0 as portrayed in todays userfiriendly strip).

 
Published by packi on in Others

Copyright (c) Visa International Service AssociationYesterday was my money day. I had to take care of some financial aspects of my life, not that there any to speak of.
Anyway, I’ve got a letter from my bank to call their security section. Earlier I’ve received an email with the same content, but put it down as a poorly executed phishing attempt.

Well it turns out (as far as I can remember the phone conversation) that there was a leak at Visa International in mid December and my CC No. was possibly amongst the leaked bits and bytes.
It seems that its secure to use the card over the internet as long as the number is not stored at Visa International. Somewhat ironic. On the bright side the new CC is (obviously) free.

The other thing to be taken care of was my rather steep tax-bill, but even that could be sorted out.

 
Published by packi on in Technology

As a sysadmin I’ve come in touch with programming languages (counting scripting languages in) that you probably wouldn’t use for everydays work. The other day I had to deal with Python.

What’s the difference between

def filter_reviewers( usernames, recipients, 
    recipients_with_fullnames, users, paths, change ):
[…]
  for line in os.popen( p4 + ' describe -s ' + change ):
    # skip everything before Affected files …
    if ready == 0:
      if re.search( r'^Affected files \.\.\.', line ) != None:
        ready = 1
[…]

and

def filter_reviewers( usernames, recipients, 
    recipients_with_fullnames, users, paths, change ):
[…]
  for line in os.popen( p4 + ' describe -s ' + change ):
    # skip everything before Affected files …
    if ready == 0:
      if re.search( r'^Affected files \.\.\.', line ) != None:
	ready = 1
[…]

Apparently nothing. But a closer look reveals that the second sample has tabs in it. Since Python uses spaces to keep code-blocks together you shouldn’t use tabs (or rather your editor shouldn’t as in my example).

The code above is copied from my additions to p4review.py which should any time now be in the Perforce’s p4 opensource-repository.

 
Published by packi on in Others

Just in case you’ve wondered why it’s been so quiet lately, here some pointers:

  1. Busy on projects not yet published
  2. Working on school projects
  3. Just working
  4. Being a lazy person

Well it was, admittedly, mostly number 4, but I’ve published some articles over at Encodo’s new Blogs.

 
Published by packi on in Logic Analyzer

Back in August, during the spring break I’ve fooled around with KiCAD to create the schematics for the logic analyzer.


Since then I’ve finished the VHDL code, only to find out my CPLD has not enough macrocells to implement the design *ahrg*.

 
Published by packi on in Cockpit

I’ve figured that the software needs to be finished first before even thinking of any real construction (all size constraints in my flat aside). So I’ve started up blender and gave it a shot:

Uhm, yes my desktop is that wide, isn’t yours?

Next on the todo-list is adding some wings (bah, who needs em anyway?) and implementing the FCS in Nasal.

 
Published by packi on in Technology

Just stumbled upon a FAQ that I consider a must read for any serious C++ programmer:

http://www.parashift.com/c++-faq-lite/

Given that I’ve been using C++ for several years, I’ve learned quite a bit reading that FAQ.

 
Published by packi on in Others

In The Recruit the story makes us belive that the CIA has a program called ICE9 which can replicate itself through the powergrid and due to that ability pass all firewalls. Even with a broader distribution of ethernet-/internet over powerlines that might prove to be difficult since this would again have to pass a firewall.
Antitrust tries to convice the watcher that a satelite based broadcasting system can remotely broadcast movies to every handheld device. With todays cell-phones one can’t really exchange businesscards properly (well, I can’t).

While the plot in both movies make it people raise their eyebrows, the actual realization differs greatly. And that is what finally counts (at least to me).

The Recruit uses the a Hollywood like “special operating system” with people having “root access granted” just by typing some code on a console that suddenly appears.
Antitrust on the other side seems to be using some kind of linux and they actually show some Java code that Milo’s working on:

            if (buf[0] == (byte)'G' &&
                buf[1] == (byte)'E' &&
                buf[2] == (byte)'T' &&
                buf[3] == (byte)' ') {
                doingGet = true;

Being a geek I’ve tried to locate that code and found it here. Its a sample implementation of a very basic webserver from sun.

On my quest to find more information on the “password hacking” code used in The Recruit I’ve stumbled upon this site. A site dedicated to “hacker cracker/security” related movies. They don’t show any framegrabs but ASCII art of the computer screens within the movies. Geeky!

Previous page  123456  Next page