Categories
IT

Using Linux command line arguments containing spaces in a variable

Last days had some trouble with space characters used in file names and the consequences of passing parameters using those file names to Linux programs.
Consider the following example:
test1.sh:
cmdline="-DMyTest=\"1 2 3\" -some \"./Arguments.test\" -testpath=\"/my test\" \"my test\""
echo ----------------------------------------------
./test2.sh $cmdline
echo ----------------------------------------------
./test2.sh -DMyTest="1 2 3" -some "./Arguments.test" -testpath="/my test" "my test"

test2.sh:
echo Using '"$@"';
for p in "$@";
do
echo "[$p]";
done

Calling test1.sh, the result is:
----------------------------------------------
Using "$@"
[-DMyTest="1]
[2]
[3"]
[-some]
["./Arguments.test"]
[-testpath="/my]
[test"]
["my]
[test"]
----------------------------------------------
Using "$@"
[-DMyTest=1 2 3]
[-some]
[./Arguments.test]
[-testpath=/my test]
[my test]

– where the first part is an issue as it does not read my arguments as expected.
The solution was very simple, in the first call use
eval ./test2.sh $cmdline
instead. Although the solution is really simple, it was difficult to Google anything useful thus this post.
Finally found a hint in http://www.linuxjournal.com/content/bash-preserving-whitespace-using-set-and-eval

P.S. If you need to call a Linux shell command using Java – Runtime.exec() method, use an array as the input and DON’T try to wrap every argument in spaces. It works on Windows but not Linux.

Categories
Semantics

Facebook graph API, open social network & linked data

I am very excited about the recent announcement of Facebook: http://developers.facebook.com/docs/api . It is very close to what I imagined writing the linkedPIM specification. I have some remarks though:

  • semantics still need to be better captured, using JSON does not solve anything – I would use an OWL model to define the standard
  • the model will need to be extended, another argument for using RDF/OWL
  • Facebook seems to be preparing for competing with linkedin, which is very natural imho I base this assumption on example dataset:
  • "work": [
    {
    "employer": {
    "id": 20531316728,
    "name": "Facebook"
    },
    "position": {
    "id": 111595812193665,
    "name": "Director, Product"
    },
    "start_date": "2009-08"
    },

  • profile model is really poor, it should be much more like in the address book (telephones etc) – base it on the vcard
  • they still try to keep the social web in frame of their own portal. it would be better to claim ownership of a protocol and semantic model which every portal can use (become the main layer in the service architecture)

P.S. The old “Chinese” curse is fulfilled. We are living in exciting times.

Categories
Funny

Pi-day

As yesterday was the pi-day 🙂
This is my favorite expression of pi

from http://en.wikipedia.org/wiki/Leibniz_formula_for_pi (the nice part being the “Efficiency in Ï€ calculation” section)

Categories
Semantics

I-SEMANTICS 2009

Going to i-semantics + i-know conference 2nd-4th of September.
http://i-semantics.tugraz.at/program

My current schedule (based on available information, might change when the info changes):
Day1:

  • Towards a New Generation of Social Networks: Merging Social Web with Semantic Web
  • Semantische Suche in Medienarchiven (praxis)
  • Applying Organizational Learning to Enterprise Knowledge Maturing
  • Understanding Maturity Models. Results of a Structured Content Analysis
  • A Knowledge Workbench for Software Development
  • The European Dictionary of Skills and Competences (DISCO): an Example of Usage Scenarios for Ontologies
  • Web x.0 – Was bringt wirklich neuen Nutzen für Unternehmen? (praxis)
  • Semantic Web Awareness Barometer 2009 – Comparing Research – and Application-oriented Approaches to Social Software and the Semantic Web
  • Maturity and Applicability Assessment of Semantic Web Technologies

Day2:

  • Can Software Developers Use Linked Data Vocabulary?
  • Monitoring RSS Feeds
  • Wissensmanagement im Projektmanagement (praxis)
  • Der Einsatz von Web 2.0 in der Internen Kommunikation (praxis)
  • Cooperation-Event

Day3:

  • Ontology Change Management
  • SALERO Intelligent Media Annotation & Search
  • Best Practice Forum
  • Die dunklen Seiten des Wissensmanagement und Web 2.0 (praxis)

See you there 😉