wtorek, 18 grudnia 2012

How to mount ZIP file under Linux

No Archive Mounter, just plain command line - useful for automation.
Basically, here is a nice description.
But I needed just a read-only access. It was for having a large ZIP file with Oracle docs locally and being able to browse it. So I did it in such a way:
sudo apt-get install fuse-zip
mkdir -p ~/docs/Ora11.2/zip
cp ~/Downloads/E11882_01.zip ~/docs/Ora11.2
cd ~/docs/Ora11.2
fuse-zip -r E11882_01.zip zip/

(-r stands for ro mounting)

wtorek, 20 listopada 2012

Non-US date format in Thunderbird in KDE

Just modify Thunderbird in Kickoff:

export LC_ALL=en_GB.utf8; thunderbird %u
This way you'll have European date format irrespective of system-wide KDE language settings (which do not seem to be obeyed by Thunderbird BTW)

Open JAR files in Krusader (UPDATE: and WAR as well)

On my Mint box Krusader opens JARs in Ark by default. I prefer to treat them as normal archive files, browseable in Krusader. In settings choose Protocols, then find application/x-java-archive in Mimes (bottom-right corner) and move it to Links.

For WAR - do the same for application/x-webarchive type

poniedziałek, 19 listopada 2012

Add remote origin to an existing Git repo

atoe@atoe$ ~/somerepo git remote add --track master origin /home/atoe/Dropbox/gitrepos/somerepo.git

That's it. See that post, especially comments.

środa, 12 września 2012

Pipe bash command output into Kate

Man page is your friend:

-i, --stdin
Read the contents of stdin

For example:
grep -v DoNotNeedIt application.log | kate -i &

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 (the 2nd option prevents Konsole from creating a new window):
konsole --workdir {path} --new-tab

ś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