Mittwoch, 7. Dezember 2011

All Methods from a Javascript Object

I wrote that little helper because webdeveloper toolbar didn't show all methods to me. Maybe it's useful for you too.

https://gist.github.com/1441816

Donnerstag, 1. Dezember 2011

console.log & debug flag?

Instead of checking the DEBUG flag everytime you need a debug info, like this:

    if (DEBUG) {
        console.log("my debug output");
    }

you can just check the DEBUG flag once and disable the console.log function, like this:

    if (DEBUG === false) {
        console = {
            log: function() {}
        };
    }

This enables you to simply call:

    console.log("my debug output")

in your application. If DEBUG is true, you'll get your output. If DEBUG is false, console.log() will be called but is an empty function and thus will produce no output / error.

Samstag, 19. November 2011

Automated slackware package creation from given sourcefile

Slackware packages are a great (the only good way) to keep track of the installed software on (and to cleanly remove installed software from) your slackware machine.

Most packages that you can find in the www (slackbuilds.org, http://packages.slackware.it, ...) are outdated. You know that: Looking at slackbuilds.org for a tool, then looking at the version number and see that there's a source on the builders homepage that's x major and y minor releases further.

I, personally, hate to install 'old' software. I want the newest. So I have to built from source - make, ./configure --flags, make install to a DESTDIR, cp docs, change rights and makepkg at the end.

This sucks. To learn a bit about writing shellscripts I started to write a shellscript that does the job (yes, I know about pkgbuild). Currently it's able to:
  • remove old sources
  • remove old package
  • extract the source package (tar.gz / tar.bz2)
  • copy a given layout file (supported by apache httpd for instance)
  • make install to DESTDIR
  • create documentation directory
  • copy documentation files (like README, INSTALL, AUTHORS...)
  • chown root.root DESTDIR
  • build package with makepkg
  • echo build time
 And here is what I plan to add:
  • remove sources after successful build
  • remove installation from DESTDIR after successful build
  • automatically search SRCDIR for documentation and copy it
  • really important: create slack_desc for created package
  • really important: output last 5 rows if build fails
  • really important: check for $DESTDIR support
  • make it much cleaner
  • less params
Yesterday I built the whole xfce4 from source in approx 15 minutes. Added install.sh to installpkg the packages in the right order and et voilà - installed xfce4 in 30 seconds. :-)

NOTE: I don't make any warranties that my script will work for you or won't fuck up your machine.
    So if you want to give it a try, look here: https://gist.github.com/1379368

    NOTE: I don't make any warranties that my script will work for you or won't fuck up your machine.

    Change keyboard layout in Slackware 13.37

    /usr/share/X11/xorg.conf.d/90-keyboard-layout.conf

    Sonntag, 2. Oktober 2011

    Measuring compile time to check overclocking of cpu

    Step 1:
    Use standard cpu clock and a source of medium size:
        time -p ./configure && make
    and note down time next to 'real'.

    Step2:
    Remove sources, extract again, overclock cpu and run

        time -p ./configure && make
    again. Compare the value next to 'real' with the noted down value.

    Dienstag, 27. September 2011