Samstag, 22. Juni 2013

How to enable menu icons in apps running on KDE


When running software on KDE you may noticed that menu entries that should have icons have not. This can be changed via System Settings->Application Appearance->GTK Configuration. Config dialog is shown in below image. Enable check boxes: Show Icons in GTK Buttons and Show Icons in GTK Menus.


Result in application menus looks like shown in the following image. Example was taken from Eclipse IDE.











Note: I'm running Linux Mint 14. So window manager is KDE running on an Ubuntu/Debian core.
If you are running Ubuntu you may find help here: http://askubuntu.com/questions/96776/missing-icons-in-dropdown-menus-in-eclipse

Montag, 15. Oktober 2012

Solr Commands

This is just a notepad for Solr curl commands. Solr is a search engine. Wiki can be found here.

Add a binary document
curl "http://localhost:8983/solr/update/extract?literal.id=doc1&commit=true" -F "mydocument=@your_document.pdf"

Add a CSV file
curl 
"http://localhost:8983/solr/update/csv?stream.file=exampledocs/document.csv&separator=;&commit=true&optimze=true&stream.contentType=text/plain;charset=utf-8"
Keep in mind, that you need to specify fields in you CSV file in schema.xml.
Delete entire index
# query to delete index
curl http://localhost:8983/solr/update --data '*:*' -H 'Content-type:text/xml; charset=utf-8'
# commit changes
curl http://localhost:8983/solr/update --data '' -H 'Content-type:text/xml; charset=utf-8'

Sonntag, 7. Oktober 2012

How to list old files on Windows

Today just a quick one. Following command outputs all files that are older than 57 days. Quite handy for many stuff :)

forfiles /p k:\ /d -57 /c "cmd /c echo @FILE:@FDATE"

Sonntag, 18. März 2012

Monty Pyhton's Meaning of Life

Here is something to refelct on a rainy sunday afternoon :)

There's everything in this movie, everything that fits.
From the Meaning of Life in the universe, To girls with great big tits.

We've got movie stars and foreign cars, Explosions and the lot
Filmed as only we know how, On the budget that we've got.

We spent a fortune on locations And quite a bit on drink
And there's ever the odd philosophical joke, Just to make you buggers think.

Yet some parts are as serious And as deep as you could wish
But largely it's all tits and ass And quite a bit of fish.

Other bits are fairly childish And some are frankly rude
But at least we've got a lot of nice girls All banging around in the nude.

So take your seats, enjoy yourselves And let's just hope it's funny
Because it's not only done to make you laugh But to make us lots of money.

So sit back and have a good time With your boyfriend or your wife
Relax and just enjoy yourself For this is the Meaning of Life

Sonntag, 18. Dezember 2011

Autowire Jira

When developing plugins for Jira (4.x) you may encountered auto wiring problems in modules with non trivial constructors. For example if you want to enhance time sheet plugin (link) with some custom functions and you want to inject UserManager from shared access layer (link). So you need to let Jira inject UserManager. It will not work via setters/getters if you have a complex constructor (i.e. one with parameters).
So you need to add to injected interface to your constructor - but you have to take care that this doesn't break anything else in your plugin. So overloading existing constructor is the only way to bypass this problem.
As Jira is based on Spring, if someone knows how to solve this problem more elegantly please let me know!

Mittwoch, 30. November 2011

Install Vmware Tools

Installing VMware Tools on CentOS

I don't remember ho often I installed CentOS on VMware and yet I always need to google how this tool installation works. So first of all you need to mount cdrom with vmware tools (image is inserted by player automatically). This can be done by:
mount /dev/cdrom /media/cdrom
Make sure cdrom folder exists. You can chose of course any existing folder. After that just copy VMware package to e.g. /tmp and extract it with:
tar -xzvf WMwareTools-...tar.gz
After that you can enter newly created folder with extracted tools and run vmware-install.pl

Mittwoch, 9. November 2011

Cygwin and telnet

If you are looking for small network tools like telnet, you may found it difficult to find via package search in cygwin's setup tool. That's because it is part of package inetutils. Thought that might save some folks out there google time :)

Mittwoch, 3. August 2011

Starbuck's Unix Tricks

This is just a collection of small tricks I found useful when working on a Unix shell

Rename multiple files
Following bash snippet solves a very common task. You have a list of files or folders and want to add a prefix or suffix. Please note that this little for loop do not differentiate folders and files. Found it nevertheless quite useful:

for f in `ls`;do mv "$f" "$(echo $f"_mysuffix")"; done

Recursive grep on Solaris
On Solaris you usually don't have a recursive grep so you need to work with find and grep.
find . -name *.conf | xargs grep -i 'PATTERN'

Creating folder structures
Following snippet shows how to create based on a list of base folder how to create a common deep folder structure. Things to notice here is -p switch for mkdir and how to iterate over comma separated lists.
#!/bin/bash

IFS=","
FOLDERS="a,b,c"
#cd /yourbasefolder
for i in $FOLDERS
do
   mkdir -p $i/your/folder/structure
done


Count frequencies
Below snippets extracts from an access logfile (apache, application server, etc) column with requester's IP address and compute frequencies. It is piping logfile content to awk to extract on column (separator configured with FS). Next pipe sorts IP addresses, couting step is then done with uniq another nice UNIX tool. Last not least couting is sorted to have a nice chartlist.

cat logs/access.log | awk '{FS = "\t"}; {print $5}' | sort | uniq -c | sort

Freitag, 3. Juni 2011

SQL Server Tools

This post contains some Powershell scripts to quick check some things on a running SQL Server instance. Imagine you got a SQL server delivered by a data centre team and now you are responsible for installing a software that shall use this server.
Before looking in all the various bugs in your delivered software, it is a good idea to check if SQL server was installed and prepared properly. Usually you have some credentials and a server address. So a little tool that checks if instance can be reached with this data would be nice.
Script you can find at [1] does exactly that. Just replace vars with your server's data (hostname, port, credentials). It also retrieves exact version with which you can check if correct patch level was installed (see Microsoft's info at [3]).
Another fancy thing would be to check which databases or roles are available with your user. This can be done using a nice object called Microsoft.SqlServer.Management.SMO.Server . Just google for this object to learn more. A script that retrieves databases, roles and some other interesting infos can be found at [4]. A much more extense example can be found at [5])


References
[1] UserConnectionTest.ps1
https://connectionteste.svn.sourceforge.net/svnroot/connectionteste/SQLTools/UserConnectionTest.ps1
[2] SQL Server Connection String Parameter
http://www.connectionstrings.com/Articles/Show/all-sql-server-connection-string-keywords
[3] SQL Version
http://support.microsoft.com/kb/321185
[4] GetSQLUserRoles.ps1
https://connectionteste.svn.sourceforge.net/svnroot/connectionteste/SQLTools/GetSQLUserRoles.ps1
[5] Lots of SQL Server instance details
http://mspowershell.blogspot.com/2009/12/most-dbas-have-had-to-examine-unknown.html

Dig and Cygwin

Just a quick tip today. If you need dig, a handy DNS query tool, on your cygwin bash you have to install bind package. Searching for Dig in cygwin's setup tool does not help, so after I figured out it is part of BIND I thought I help save some time ;)
Bind is a full blown DNS server but it's not that big to install and dig is definitly worth it ;)

Montag, 14. März 2011

My PowerShell Profile

Starbuck's Powershell profile
This article contains my growing PowerShell profile file. For those of you that are familiar with Unix shells this is a file similiar to .bashrc/.cshrc/... Per default executing this file this forbidden by policy, so you not to activate that. See this article for an interesting introduction to aliases and activation of profile files.

For the impatient reader execute the following command on a PS started as administrator:
Set-ExecutionPolicy Unrestricted 

And here is my (growing) Profile:

# implements a simple curl, lots of stuff still to do :)
function curl($url) {
    if($url){
        if(!$url.StartsWith("http://")) {
            $url = "http://" + $url;
        }
        return (new-object System.Net.WebClient).DownloadString($url);
    }
    else {
        return "Please provide a URL";
    }
}

# this is my tail -f
function tf ($file) {
    if($file) {
        get-content -wait $file;
    }
    else {
        write-host "Please provide a file to listen!";
    }
}

Montag, 28. Februar 2011

Call user functions with USER_INT

Custom PHP in Typoscript

These two listing just shall show you a working example of calling custom PHP functions from Typoscript. I just publish this because in all the existing examples I found some details were missing.

The following listing shows usage of USER_INT which causes no caching of this content element. Please note that your class needs to have a prefix "user_" to be excuted via userFunc. Use admin panel to get according feedback.

includeLibs.hashTools = fileadmin/hashTools.php
page.200 = USER_INT
page.200 {
  userFunc = user_MyTools->testFunction
 }

Following PHP listing shows a simple function to be called via Typoscript.
<?php

class user_MyTools {

  function testFunction($content,$conf) {
     return "Hallo Welt!";
  }

}

?>

Typoscript link with parameters

How to create an external link with parameters with Typoscript

Have you ever had the need to add to an external link some dynamic parameters? Well before you grab your PHP editor and start developing have a look into the following Typoscript listing:

[loginUser = *]

page.201 = COA_INT
page.201 {
10 = TEXT
10.value = My fancy link
10.typolink.parameter {
  dataWrap = http://www.mysite.de/index.php?param=value&id={TSFE:fe_user|user|uid}&name={TSFE:fe_user|user|username}_{TSFE:fe_user|user|city}
 }
}
[global]
What this script does is it creates a link using typolink function and you can add some parameters to it. Good thing here is, that can add some dynamic parameters such as user name of current logged in user.

With accessing TSFE which is the central array that Typo3 uses to store almost everything you can add many more interesting parameters.

Please note that content object used here is COA_INT and that means this is generated every time a page is displayed. This way for every user this example creates a proper parameter.

Dienstag, 22. Februar 2011

Powershell test Web Service

For all of you who haven't touched it yet - Microsoft has put an interesting shell to Windows operating systems called Powershell. Following code creates a web service stub (proxy in dot.net speak) and calls a method. If you call a web service that is running on a IIS you often need some kind of authentication.
#  build credential object 
$Pass = ConvertTo-SecureString " xxxx " –AsPlaintext –Force
$Cred = New-Object System.Management.Automation.PsCredential "domain\User",$Pass

# just a simple web service tester
$wsProxy = New-WebServiceProxy -Credential $Cred -URI http://yourserver.com/path?WSDL
$result = $wsProxy.WebServiceMethod('Parameter') 
$result


To use this example you need to replace WebServiceMethod with the web service method you want to use. It is up to you to provide proper parameters. Having a look into service's WSDL file will help here.

General note, execution of unsigend srcripts needs to be activated. Please see
http://www.windowsecurity.com/articles/PowerShell-Security.html for more information.

Montag, 26. Juli 2010

propCom - requirements and todos

This post is a collection of requirements for propCom. Keep in mind, that this is work in progress.

Requirements
The following list contains desired functions and requirements  for propCom. It's a kind of wish list and don't hesitate to comment your suggestions.
  • Two modes: simple comparison of two Java property files and multiple comparison defined by a CSV-File
  • build ant task in order to integrate property file checking to your ant scripts
  • Comparison means checking equality of key sets in two property file. It means not checking if property values are identical
  • Output is a CSV/XML-File (not decided yet) , maybe similar to JUnit test results
  • proper exception handling (e.g. when comparing multiple files, define what to do if one file can not be found)

ToDos
  • restructure code (input, functional code, output formatter)
  • write proper readme
  • add license statement
  • add proper bash script

propCom - first Release

We proudly present propCom version 0.1 that can be downloaded at SourceForge on the propCom repository. This is a first release and far away from being usable in real world projects. For now propCom is a command line tool and we will develop all desired functions for command line usage. When the functional code is somewhat mature and structured a custom developed ant task will make use of that code.

Dienstag, 13. Juli 2010

propCom - some more details

When developing Java Enterprise (JEE) applications property files are widely used. Even in medium projects soon you have at least half a dozen of these property files. So deploying (see and please read http://en.wikipedia.org/wiki/Software_deployment) such a software is a sophisticated step in software devlopment. Now a productive version is usually only one of several instances to establish.
Especially when using agile development methods like scrum setups for feature testing, user acceptance testing, integration testing,... are necessary. Therefore your half dozen property files multiply with the number of setups (or environments). And that means you waste a lot of time and panic to find that forgotten property needed for that feature that has to be tested till yesterday the latest...
So this is the motivation for developing a tool like propCom. First step is developing a java command line tool that can be used to quick check if a given list of property files have the same key sets. As this is not that useful (I know Java on CLI will never match Bash or Perl) but eventual goal is an Ant/Maven integration. This way completness checks on property files can be done automatically.
Ok folks that's it for today. Next post I will show the then finished CLI version.

Donnerstag, 24. Juni 2010

propCom - to ease a deployers pain

I just started a new project on Sourceforge to build a command line tool to compare key sets of Java property files. Sound pretty simple but it's quite usefull as it is a common and tricky task to maintain multiple test and integration versions of a software. Therefore an automatic tool that checks if all properties are set in a certain instance is helpful. PropCom is not intendended to check if properties are set to somehow correct values but only if all properties are present.
You can find this project on Sourceforge under https://sourceforge.net/projects/propcom  If you like to join development - just send me a message.

That's it for today and condolences for bella Italia...

Some details about me

Hi folks out there!

My name is Markus aka Starbuck and I'm a computer scientist from Germany. I eventually started a blog to let the world know what cool stuff I do ;) Don't worry just kidding. This blog is intended to be a storage for tips and tricks I found useful.
To be continued...

Montag, 21. Juni 2010

Hello World!

Yet another hello world post!

This is just a test for inserting syntax highlighted source code using http://alexgorbatchev.com/wiki/SyntaxHighlighter:Brushes
if(a==b) {
 alert(a);
} else {
 alert(b);
}