piątek, 2 marca 2012

How to create empty Git repository and clone it locally

Useful if you have ssh access to some server and want to keep your origin repo there and push changes to it.
atoe@server:~/gitrepos/testrepo$ git config --global user.name atoe
atoe@server:~/gitrepos/testrepo$ git config --global user.email atoe@my.domain
atoe@server:~/gitrepos/testrepo$ git init --bare
Initialized empty Git repository in /home/users/atoe/gitrepos/testrepo

# verify the config
atoe@server:~/gitrepos/testrepo$ git config --list
user.name=atoe
user.email=atoe@my.domain
core.repositoryformatversion=0
core.filemode=true
core.bare=true

# now on local machine
$ git clone atoe@server:~/gitrepos/testrepo
Initialized empty Git repository in /home/atoe/work/testrepo/.git/
warning: You appear to have cloned an empty repository.

By the same token you can create origin on your local machine but synchronise it in Dropbox.

środa, 29 lutego 2012

Extract sound from YouTube MP4 videos to Ogg Vorbis files

I simply googled up dir2ogg man page
Then I used it in such a way on a current directory (use --delete-input if you want to delete the source files - I didn't want to until I have checked the results):
dir2ogg -q 1 -a .

sobota, 18 lutego 2012

Hamcrest everyItem matcher

Couldn't make that matcher work. Even found the solution http://blog.dutchworks.nl/2011/02/19/some-trouble-with-getting-the-right-version-of-hamcrest-and-the-solution/
...but somehow it didn't work - probably I was tired and made some stupid mistake.
Eclipse compiler kept complaining about some generics type mismatch. Then I extracted a matcher to a local variable and added a type (SomeObject below) to it. And the it worked. And - as you can see in the second matcher usage - after inlining a matcher the syntax is the syntax from the blog post above - and it works - this time. BTW - IDE refactorings are really useful. Even more than I thought.
// the service method we want to test
List<SomeObject> results = service.doSomething(parameter);
assertEquals("unexpected size", 3, results.size());
// a matcher which basically checks that someObject.getLabel() == "generic"
Matcher<SomeObject> labelTypedMatcher = hasProperty("label", is("generic"));
// and now we want to ensure that all the results meet the condition above
assertThat(results, everyItem(labelTypedMatcher));
// you do not have to create local variable, but then the syntax is, well, unusual a bit
// now we want every object meet the condition (someObject.getTypeId() == "generic")
assertThat(results, everyItem(Matchers.<SomeObject>hasProperty("typeId", is("007"))));

środa, 15 lutego 2012

How to use Konsole with OpenExtern in eclipse

"Konsole is the X terminal emulator of KDE with support for several sessions" as you can learn from konsole.kde.org
Open extern "an eclipse plugin, which you can use to open a shell (either a command prompt - CMD or a linux shell), or a folder (windows explorer, nautilus, konqueror) from eclipse's resource navigator or package explorer" - see http://code.google.com/p/openextern/
Now it is useful, simply, and Konsole has a parameter to specify working dir, just use it.
Choose Window-Preferences in eclipse, Open extern has its own entry there. Set for "open shell command" the value:
konsole --workdir {path}

środa, 1 lutego 2012

How to quickly call a stored procedure in Spring

If your procedure does not take parameters nor return any values (or you're not interested), do just that:

DataSource dataSource = getDataSourceSomehowMostProbablyFromYourSpringContext();

SimpleJdbcCall theProcedureCall = new SimpleJdbcCall(dataSource).withProcedureName("myproc");

That's it

sobota, 28 stycznia 2012

Windows 98 SE under VMware Player

What you need:

  • Win 98 SE CD (obviously...)
  • SoundBlaster PCI 128 drivers
  • some of the unofficial Win98 Service Packs (e.g. http://exuberant.ms11.net/98sesp.html or - I guess Polish only - http://www.softmania.pl/program-1252-nieoficjalny_service_pack_plus_dla_windows_98_se.html)
  • VMware Tools - windows.iso, take it from e.g. http://packages.vmware.com/tools/esx/5.0/index.html

Remarks:

  • do not use USB 2.0 - uncheck it in VM's settings. see http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1011734
  • install SB PCI 128 drivers to have sound working

piątek, 18 listopada 2011

Python 2.7 under Ubuntu Lucid

The latest 2.x version available is 2.6.5.

1. Add ppa:pythoneers/lts PPA

2. sudo apt-get install python2.7

To add some more packages use eggs. E.g. download

http://pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11-py2.7.egg

and

sudo sh setuptools-0.6c11-py2.7.egg