Dienstag, 15. Oktober 2013

Build specific targets of a sub-makefile (inspired by Gruntjs)

I recently had a great idea:
When I was using gruntjs a couple of months ago, I was introduced to the possibility of sub-targets there. Those were specified using colons (":") to seperate parent target and subtarget. Since I am using dedicated sub-makefiles for single modules in my project, I just had the brilliant idea: realize something similar to access goals from those. This saves me the trouble of specifying the file used and to define necessary environment variables by hand.

So what I came up with initially and what worked out quite well, was this:
# idea from http://blog.jgc.org/2007/06/escaping-comma-and-space-in-gnu-make.html 
# I put this in my dedicated defs.mk file for general usage
 ,             := ,
 space         :=
 space         +=
 $(space)      := 
 $(space)      +=
   
 $(PROJECT)\:%:  
      $(eval SUBGOALS := $(subst $(,),$( ),$*))  
      $(PRINT) making $(PROJECT) with goal\(s\) $(SUBGOALS)...  
      $(MAKE) -f "$(abspath $(ROOTDIR)/Make/$(PROJECT).mk)" $(SUBGOALS)  
      $(PRINT) done making $(PROJECT) with goal\(s\) $(SUBGOALS)  

Here is an example, of what the benefit of this is:

$: make modulexy:libxy,binxy
making modulexy with goal(s) libxy binxy...

There is one problem, though: While you CAN run makefile goals in any recursion level
(e.g. $: make goal1:goal2:goal3: ...)
only the first level allows you to pass the goals together to a single instance of make. Things like
"$: make goal1:goal2:goal3.1,goal3.2"
will be executed as
"make -f goal1file goal2:goal3.1 goal3.2"
That means, the command tries to run goal3.2 in goal1file (the file belonging to goal1).
The workaround would be
"make goal1:goal2:goal3.1,goal2:goal3.2"
which is then causing two instances of make being run on the makefile belonging to goal2: One for goal3.1 and one for goal 3.2.

So far, I did not feel the need to improve this (by adding a way to evaluate brackets, for example. Imagine "$: make goal1:goal2:(goal3.1,goal3.2)"). But if you are in a desperate need of this, it will be hard to achieve with make-internal tools only. sed will probably be your friend, here.
Contact me, if you come to a solution, so I can add it here.

See you soon!

Donnerstag, 10. Oktober 2013

GNU Make as templating engine (???)

Hello visitors!

So this is already my second post about GNU Make I am writing within two weeks! My intention this time is to describe how you can get all the power of the Makefile-parser into any usual, build-related file.

To give you a better image of what I wanted to achieve originally and why, let me give you this scenario:
Imagine you are starting to work on yet another c/c++ program for GNU and you are trying to use as much basic project stuff as possible from your previous project. You are copying over makefiles, licenses, other textfiles and launching scripts. After that, you alter the name of the last project everywhere to match your new one's - which is pretty inconvenient if done by hand. You know: These project specific strings occuring in standard files all over the place should be kept at only one place, namely your build system's configuration file.

In my last article I was calling this build system configuration file for make "defs.mk". Now the question is: How will we get the definitions from there into our text files?

With the help of the standard *nix tools "cat", "sed" and "printf" I managed to write a small copy-over routine for make which performs make's variable expansion on the text files we want to reuse in the future. Here is the code:

 DOCFILES        = $(DOCSRCDIR)/LICENSE.txt $(DOCSRCDIR)/README.txt  
 DOCDESTS    = $(subst $(DOCSRCDIR),$(DISTDIR),$(DOCFILES))  
 .PHONY    = all  
 all: $(DOCDESTS)  
 $(DISTDIR)/%: $(DOCSRCDIR)/%  
 # Get the file's contents into "DOCCONTENT". Don't forget to escape "#"  
 # by using sed -e 's/\#/\\&/g' and also get rid of troublesome newlines  
 # (replaced with \n which is re-translated by printf later)  
 # http://stackoverflow.com/questions/1251999/sed-how-can-i-replace-a-newline-n  
     @$(eval DOCCONTENT := $(shell cat $^ | sed -e ':a;N;$$!ba;{s/\#/\\&/g;s/\n/\\n/g}'))  
     @printf "$(DOCCONTENT)" > $@  

By reading the document into the makefile variable "DOCCONTENT" all currently set variables are being expanded (replaced) in the script before we write it back to its destination. DISTDIR is hereby our distributiable package folder.

Inside the document we are also able to use make's inbuilt functions, such as $(wildcard and even $(shell. This is a bit risky though, since almost everything can be done this way. At least noone will complain about lacking features, though :)

I hope this can be helpful for you!
Regards

Dienstag, 1. Oktober 2013

My idea of how make should be done

Welcome dear reader!

When I start spending time with a new programming language, I usually want to get a clear picture first of how my workflow should look like. I simply want to do it right from the beginning, using state-of-the-art tools and profiting from others' experiences, so I will be able to work efficiently right away and so that my project evolves around a good structure.

Currently, I am trying out C++ (not for the first time, but this time for real), denying myself using an IDE which would get me started quickly but rendering me entirely planless of what is going on behind the scenes.
Naturally, I was confronted right at the beginning with the decision which build system to use. I started out using the best known one, gnu make, and got comfortable with it. Actually it was even so good, that when I decided to go for cmake instead (which seems to be next to autotools the only  relativley widespread build tool out there), I couldn't tell any improvements over make.

So here I want to give you an overview of the conclusions I've drawn about how to use makefiles in a project-independent, yet absolutely clean manner:

  1. of all: The project's top-level structure:
    I wanted a clean top-level project directory with nothing in it but introductory documentation (license, readme...), one folder for source (src) and one to build into (build). Lateron, looking into other projects, I also saw that being able to offer support for several other (maybe ide-specific) build systems would be great, too, so I decided to give each one of them a separate directory - "Make" doing the first step here.
    That leads us getting something like:
    • project root
      • build
      • src
      • Make
      • ...
      • XCode/Eclipse etc.
    This way we can also strictly keep the build-tool related files from our code, as another positive sideeffect.

  2. how to even make it work:
    Now that we have decided to put all our makefiles into the Make directory, how will make get to see the files it has to build together? It is not even in the project's root directory. That's why we need to get this root directory first - the parent of the folder, our makefile resides in:
     ROOTDIR            = $(realpath $(dir $(realpath $(dir $(lastword $(MAKEFILE_LIST))))))  
    
    I am using here, that calling "realpath" on a directory name will cause the original path to be stripped of trailing slashes. Therefore, another call of "dir" on it will give me the parent directory. I know, this is somewhat hacky, but we just won't mind.
    So next thing is to export our ROOTDIR variable, so that all other makefiles can use it et voilà: Accessing specific directories far away from our "Make" directory won't be a problem any more.

  3. how to reuse our makefiles:
    I far as I could see, it is very common to extend a build system as the actual project grows with the time. The downside of this procedure is obvious: Makefiles written this way tend to be project specific and can hardly be reused. So we need ways to separate project specific attributes from the reoccuring parts of a makefile.
    First thing I'd recommend here is a dedicated defs.mk makefile containing all or most of your definitions. This way you will have all your project-dependent stuff just there and this will be easy to understand for external collaborators. Note that my make_boilerplate contains a nice draft of such a defs.mk file which you can use and modify as you like to.
    In the future, we will just include our definition file to gain access to our whole project's configuration:
     include $(ROOTDIR)/Make/defs.mk  
    
    Yes, I do know about the "MAKEFILES" environment variable, but I think, this way it is just more transparent. So let's just do it this way.

  4. recursive makefiles(?):
    Coming from Java WITH IDEs, I had a pretty detailed vision of how I wanted my project to be structured. Over all, folders play a central role in dividing pieces of code into single units of related functionality. But how to tell make that those source files, distributed over several hierarchies of folders, have to be built into one single binary?

    Recursive makefiles - while seeming obvious at first (icu, for example, is doing it this way) - didn't comply with my ideas stated above, since they had to lie in the source directory. Additionally, it relatively quickly turned out, that recursive use of makefiles is actually not desireable. Click here for details.

    So I went for good old "find" to get my .cpp files which I would then turn into a list of .o files:
     CXXFILES       = $(shell find $(SRCDIR) -type f -name '*.cpp')  
     CXXOBJECTS     = $(patsubst $(SRCDIR)/%.cpp,$(OBJDIR)/module/%.o,$(CXXFILES))  
    
    Those, as you can see, I put into their respective subdirectory in my object build directory.

  5. where to divide makefiles:
    When working with makefiles in a project, you often have them grow according to your needs while you are concentrating on your code. Therefore one often ends up having huge and unreadable makefiles that are likely to break on minimal changes. I suggest the following here: Have one makefile for each big part of your project. This will not contradict our earlier statement "recursive make considered harmful", since the makefile is still as self-contained as possible and should not call any sub-makes either. We just use the modularity of our project to have clean cuts. I suggest one makefile for every lib or binary of your own project, maybe one makefile for each of your dependencies if they have to be built from source or one single makefile together for all your prebuilt libraries.
    Standard targets that can be "outsourced" include:
    • deps.mk (for dependencies)
    • tests.mk
    • <projectname>.mk for your project

  6. handling indirect dependencies:
    We know that make works using a file's dependencies to create the file itself, if those are newer. Therefore we have to specify the dependencies, which we already automated. But we completely left out the fact, that header files included in our .cpp files are also dependencies.
    In order to be able to respond to changes made to only those included files, we will use a trick which I borrowed from here: We exploit the -M option (for gcc and similar), which gives us all files included by a codefile and write them into a seperate makefile, which we will include from now on. These secondary makefiles we will be giving the suffix ".d", as in "dependency". So the rule for .o files will be looking like 
     $(OBJDIR)/%.o: $(SRCDIR)/%.cpp  
         @mkdir -p $(dir $@)  
         @$(COMPILE.cxx) $@ $^  
         @# Create the .d file using gcc's -M or -MM option  
         $(CXX) $(CPPFLAGS) $(CXXFLAGS) -MM $(lastword $^) > $(patsubst %.o,%.d,$@)  
    
    Additionally, we will have to retrieve the existing .d files at the beginning of our makefile and include them:
     DEPFILES        = $(CXXOBJECTS:.o=.d)  
     -include $(DEPFILES)  
    
    The "-" in front of include turns off errors on file-not-found. And that's it!
    Make sure though that you include the DEPFILES only after the "all" target, so some object file won't become your default target.

  7. coping with different levels of verbosity:
    In general it has to be said, that make's philosophy can be a bit obstructive when it comes to communicating what is going on. First of all, there is no parse-time option to output messages to the console. Trying it with approaches like "$(shell echo some message)" will fail because make' s goal here is it to grab the shell command's output. So you will not be able to just dump all variable values of interest on make startup before a target is built. You will rather have to have an own "info" target doing that, which is prerequisite of your "all" target or you are calling yourself.

    The next problem is, that when you have a simple target that just aggregates other tasks, and you want to announce its start and its end, at least the first of those two cannot be achieved. For example, imagine you want to make sure, all build directories are set up correctly in target "directories: dir1 dir2 dir3". Where will you put the "Start creating directories" message? You will have to live with that limitation or invent a smart way to avoid this.

    To have control over what is printed and when, I suggest setting up variables like "PRINT" (echoing always) and "VPRINT" (echo if in verbose mode, otherwise just /bin/true). This can be extended to "VVPRINT" (VERBOSE = 2) etc. if necessary.
    Additionally, the make variable "MAKECMDGOALS" can be helpful to detect if the user ran make with the intention of getting more information as usual about the build process. I, for example, did the following right at the beginning of my main Makefile: 
     ifeq ($(filter info, $(MAKECMDGOALS)),info)
         VERBOSE = YES
         export VERBOSE # for all sub-makes
     endif
    
On these thoughts as a basis, I set up a small github repository I called "make_boilerplate". You will find it by following https://github.com/suluke/make_boilerplate . Maybe things will also be clearer if you take a look into the makefiles themselves.

I've been reading lots and lots of articles and stackoverflow questions on the internet to get all this done in a way I personally can live with. I don't guarantee you, though, that it is bugfree or even trapless. I see a high chance that some professional with 40 years of experience shows up and tells me about a bunch of flaws my makefile design comes with. Personally I don't see any problems so far though - and this is why I posted this. I hope, you will find it helpful, too.

Regards

suluke


Sources:

Sonntag, 22. September 2013

The best software to view and control Mac/Windows/Linux desktops on android remotely

Hello visitor!

In this article I want to show and review several ways and apps to view and control your desktop remotely via your android phone or tablet.

[Motivation]
 There are several reasons why one would want to control a pc remotely over the network. For example there is

  • You want to control that updates are correctly installed and then shut the computer down while you're still away from home
  • You want to make sure, steam games are downloaded properly so you can start playing as soon as you're home again
  • You want to help out a friend or family member with their computer without having to get there physically. Also, you're too lazy to start up your own pc.
  • You simply like the idea of having your desktop's complete power in your hand.
No matter what you want to achieve by remotely controlling your desktop with an android device, there are plenty of ways to get it done. Unfortunately though, it becomes hard to decide which of the apps and connection protocols will suit you the best.


[Defining some requirements]
  1. First of all, the price is a very important aspect. Personally, I have come to the conclusion, that although free apps have no effect on your wallet if turning out to be crap, mostly you don't want to have them as tools to rely on every day for the following reasons:great likelyhood of support/development being suddenly dropped or missing from the start
    • lacking features of the paid alternatives
    • the app showing a lot of annoying advertisement
    • unfriendly user interfaces
    On the other hand, most people out there will not use the app on a regular basis, so the price should be moderate.
    So we cherish: The app we are looking for should offer a free demo which can be upgraded to a fully-featured, ad-free version for less than 10$ or €
  2. The solution has to be as easy to be set up as possible, so we can expect inexperienced users to set up the desktop's control server by just pointing them to its website. Therefore, the server also has to be free.
  3. Personally, I am using Linux. At work, I have to maintain iMacs. And most people I know are using Windows. The solution I am looking for has to support all these three platforms.
[The competitors]
Being asked about remote desktop sharing, most people will probably immediately think of the following two keywords:
  1. TeamViewer (software product)
  2. VNC (protocol)
which both offer Android apps.
Then, after a little bit of research, one will additionally find the following solutions:
  1. RDP (protocol)
  2. Splashtop (software product)
  3. Google Chrome Remote Desktop
  4. Skype screen sharing
of which only the former two support Android with dedicated apps. [Sidenote: in the future, we can expect Chromoting]

[General opinions]
So here are my opinions on the remaining four:

  1. From my personal experience, TeamViewer performs pretty bad on Linux and the framerates are still far from fluid, even if one gets it to work. Therefore I will not cover the program here. Nevertheless, I encourage everyone to download the software himself and test it, for it is free.
  2. VNC: The probably best supported protocol out there for our task, but I will drop covering it here in favor of rdp for reasons I am explaining later
  3. RDP: Comes preinstalled with Windows, so nothing to set up here. It will also perform better than VNC on Windows servers, for it is able to communicate unalterable components of the user interface such as the desktop background, standard widgets used etc. to generate less traffic on disply changes. A servers also exists for Linux (xrdp) and is available to enterprise customers from aquaconnect - which I couldn't test. Actually I thought there was a free server, but I was mistaken as I found out while writing this.
  4. Splashtop is a one-manufracturer software product bundling desktop server and apps. It isn't quite cheap if it isn't on sale and offers no demo, but from personal experience, I can only recommend this app, especially when it comes to multimedia. This is because frame rates are almost excellent and it can transmit audio - even on Linux. There are several versions, of which one requires a one-time payment while most of the others are given away for free as long as you have signed a service contract for the splashtop remote service.
[My RDP app recommendation]
If you are on Mac OS, you already have VNC integrated - called ARDP. I'm afraid I will have to leave you alone picking an app that suits your needs, since I focused on RDP.
For all the others, it is probably a good bet to go for rdp as you will have the faster protocol. In the play store, there is a ton of apps to choose from. I tested the following:

of which I liked Remote RDP by Yongtao Wong the most - even in the free version (limited to 1 server), directly followed by aRDP by Unandtech, which is even opensource, by the way. Both perform with decent framerates and mostly efficient and intuitive user interfaces. In addition, both can transmit arrow keys (for example via hacker's keyboard) as far as I remember, which is often helpful if tapping is too unprecise.

This said, you should be ready to go by now, into the wilderness of the countless rdp apps out there.
If you are willing to pay a little more to invest in a closed system which therefore performs a lot better, I kindly remind you of Splashtop Remote.

Cheers,

suluke

Montag, 9. September 2013

[Rezension] Snakebyte iDroid:Con Gamecontroller

Hallo Fremder!

Kürzlich habe ich mir den iDroid:Con Gamecontroller der Firma Snakebyte gekauft. Den Link zum Produkt findet sich hier.

Ich hatte den Controller hauptsächlich mit der Intention gekauft, ihn an meinem PC zum Spielen zu benutzen - aber auch, um die Option zu haben, ihn an meinen Mobilgeräten zu verwenden. Nach etwa 2 Wochen täglicher Benutzung (es sind Semesterferien :D) will ich nun meine Erfahrungen mit anderen Interessenten teilen. Da ich durchgehend Android Geräte besitze habe ich allerdings keine Erfahrungen mit iOS machen können.

1. Verpackung, Lieferumfang, Inbetriebnahme
Die gelieferte Box ist kompakt, mit einem Sichtfenster und aus dünnem Karton. Neben Controller und mini-USB Kabel liegen nur zwei Zettelchen dabei: Einmal Werbung für weitere Snakebyte Produkte, zum anderen die relative klein ausgefallene Bedienungsanleitung (auch online verfügbar, ich hab sie schon verloren). Ok, viel zu verstehen gibt es nicht, aber ich war ein bisschen in meinem Stolz verletzt, für die allergrundlegenste Operation bereits dieses Blatt konsultieren zu müssen: Die Verbindung mit dem zu steuernden Endgerät. Der Trick ist hierbei, die Powertaste zusammen mit der für den gewünschten Controllermodus zuständigen Knopf gedrückt zu halten, bis das Gerät schnell blinkt und damit es ab nun vom Spielgerät erkannt werden kann.
Das beigelegte Kabel, welches lediglich zum Laden dient, ist ausreichend lang um es dauerhaft an einem Rechner zu haben. Somit kann man relativ gut eine permanente Stromversorgung des Controllers realisieren.

2. Verarbeitung
Für den relativ geringen Preis bekommt man einen anständig verarbeiteten Controller - er könnte sich wertiger anfühlen, billig wirkt er aber auch nicht. Das liegt wohl an dem matten Plastik, welches verwendet wurde. Hauptsächlich stören die vier Hauptknöpfe (A,B,X,Y) und das Steuerkreuz, da sich deren Material irgendwie weniger wertig in das Gesamtbild einfügt. Zudem lassen sich die Knöpfe in ihren Löchern horizontal bewegen und sie machen beim wieder hochkommen ein klick, der doch deutlich hörbar ist (mich aber nich weiter stört. Tastengeräusche gehören ja irgendwo zum Spielen dazu)

3. Nutzung
[Positiv]
Zuerst das Positive: Der Controller wurde von mir unter (Arch-)Linux, Windows 8 und Android getestet, wobei ich allerdings nicht alle Verbindungsmodi ausprobiert habe.
Unter Linux beispielsweise spielte ich Psychonauts, wo sich der 4 Achsen/12 Tasten Modus besser machte, als der 5-Achsen Modus, weil das Spiel einfach nichts mit den analogen Schultertasten anfangen konnte. Die Verbindung ließ sich leicht (über blueman) einrichten, wobei allerdings nach Nutzung des Controllers an einem anderen Gerät/anderem Betriebssystem eine komplette Neukoppelung (entfernen aus "Bekannt"-Liste & neu hinzufügen) nötig war. Darauf wird auch in der Bedienungsanleitung hingewiesen.

Unter Android habe ich die Maus-Steuerung getestet, da ich insgesamt nicht der größte Fan von First Person Shootern auf mobilen Geräten bin. Diese funktionierte, wenn auch Wischgesten sehr unelegant sind. Das liegt aber am Betriebssystem.

Unter Windows 8 spielte ich Burnout Paradise, wo ich die Schultertasten analog benutzen konnte (wie bei Rennspielen auf der XBox). Hier klappte aber seltsamerweise das starten von Rennen über linke Schultertaste + rechte Schultertaste nicht, sodass ich immer zur Tastatur rücken musste, um a+y zu drücken.

Probleme mit etwaiger Verzögerung über die Funkverbindung habe ich nicht ausmachen können. Wobei Jump'n'Run und Rennspiele da wahrscheinlich nicht so sehr von beeinträchtigt werden.
Auch habe ich keine nennenswerte Probleme mit Schmutz auf dem Controller. Aber ich benutze ihn ja auch noch nicht lange. Hygienisch ist ohnehin, den Controller regelmäßig zu reinigen.

[Negativ]
Generell ist aber die Benutzung in Windows 8 am nervigsten. Das Betriebssystem bekommt es nicht hin, eine erneute Verbindung zum Controller herzustellen (ich bin mir relativ sicher, dass das nicht nur gerätewechselbedingt ist), sodass man den Controller immer wieder aus der Geräteliste entfernen muss. Dann braucht Windows nochmal bestimmt 30 Sekunden, um sich mit dem Gerät "anzufreunden", also Treiber zurechtzurücken oder was weiß ich. Windows und seine Ladebalken...
Zudem ist es etwas blöd, dass der Controller schon nach relativ kurzer Zeit von alleine in den Ruhemodus geht. Ok, ich schätze es sind jedes mal 15 Minuten die er wartet, aber dann muss ich mich unter Windows 8 wieder mit dem genannten Verhalten herumschlagen. Oder unter Linux muss ich das Spiel kurzzeitig beenden, weil man aus Psychonauts nicht heraus"tabben" kann. Wahrscheinlich ist das aber alles Bluetooth-bedingt oder ließe sich beheben, wenn ich meine Geräte permanent sichtbar hätte. Dann könnte der Controller einen eigenen Verbindungsversuch machen. Oder ich bin selbst schuld, irgendwo eine "automatisch mit bekannten Geräten verbinden" Option (unter Linux) übersehen zu haben.
Als letztes muss ich noch den Umgang mit dem Akkustand kritisieren: Soweit ich sehen kann fehlt dieser schlicht und ergreifend. So ist mir mitten im Spiel einmal der Controller ohne Vorwarnung gestorben.

[Fazit & Bewertung]
Als Fazit würde ich also darauf hinweisen, dass bei diesem Wireless Controller viel Komfort einer plug'n'play Lösung mit Kabel verlorengeht. Außerdem muss man auf die Stromversorgung achten (und den auto-Standby). Der Vorteil des ganzen ist die plattformübergreifende Verwendbarkeit und die Unabhängigkeit von Kabeln.
Weil der Controller für mich seinen Zweck erfüllt und seine Problemchen größtenteils auf das Hauptmerkmal "Bluetoothverbindung" zurückzuführen sind, gibt's von mir 4 Sterne von 5, mit einem Stern Abzug für fehlende Akkuanzeige. Der Preis macht dabei das äußerliche wett.

Ich hoffe, diese Einschätzung hilft da draußen jemandem. Über Feedback würde ich mich wie immer freuen.

Viel Spaß beim Zocken!

Sonntag, 8. September 2013

[Steam][SDL][OpenAL] Stuttering sound in many Linux games

Hello folks.
On my Linux system (up-to-date Arch Linux) I was having trouble with several open-al based games, namely Psyschonauts, Super Hexagon and FTL/Faster Than Light. All games were purchased via Steam. The problem was, that the games' sounds came out somehow garbled - stuttering to be more precise. All I could do was restarting the game once or twice and hope that it would finally do as intended. As there are several components involved and common to the stuttering sound (SDL, OpenAL, Steam, Pulse Audio, Linux), it was not easy for me to put the problem into words google could understand.

After doing a lot of research with no results of which none of them solved my problems, I finally stumbled about a small, german  forum post, that seemed somehow to be connected to this issue. It also mentioned high cpu load when these problems occur, which I could confirm espacially while playing FTL. The post was suggesting that it might help to go into Mixer/ Pavu Control, take the particular audio stream of the game (for steam games it is usually a steam-connected strem), and turn it down a little - from 100% to let's say 90%. And voilà: After following this advice I seem to have no troubles left with those games.
If you don't have a program calles "Pavu control" or Pulse audio Mixer yet, it is almost certain that you will find it in your distribution's repository.
And that's it!

But wait - what happened? As the mentioned post suggests, it is a problem of the sound overmodulating. I guess, there is an (artificial) limit set to the physical outgoing sound volume, that causes sounds which are too loud to be filtered. Since this is probably an expensive operation, intercepting the audio stream, filter it and continue to play it again, this will presumably cause the high cpu usage noticed before. I don't know why, but openAL seems to cause a lot of those too-high sounds to be generated (at least the version used by steam).
Now, by setting the limit of the virtual stream lower than before, this problem gets solved.

Happy playing!

Donnerstag, 29. August 2013

Linux dual monitor: Don't stretch fullscreen over all monitors in SDL games (psychonauts, ftl, superhexagon)

[EDIT] Some time after I wrote this, I also found this article:
http://www.maketecheasier.com/run-fullscreen-games-in-linux-with-dual-monitors/
which is a lot nicer written.

Hello everybody!

I'm using two monitors on my Linux machine: The 13" 1366x768px inbuilt one of my laptop and my 24" full hd monitor. I don't need to say, that those do not really match to display one application over both of them. Unfortunately though, many games based on the well known sdl library try to do exactly this: When in fullscreen, they only offer me resolutions like "3286x1080" after the notebook's resolution (nothing in between). When opening in windowed mode, they calculate the middle of the screen by taking both screens into consideration, thus opening between them.
All I want to do, though, is having fullscreen games opening with full hd resolution on my external monitor, and windowed games in the middle of just this monitor.

I was quite happy lately, when I discovered that wine/crossover will open all windows on the external monitor if I tell xrandr, that it is my "--primary" screen, using "xrandr --output HDMI-0 --primary". This doesn't work for native, sdl-based games of course, although it kind of fits in here, so I thought to mention it.

So, today I got my bluetooth controller and I really wanted to play psychonauts with it. It, too, featured the said issue, and this time I just didn't want to give up. After some heavy googling, I finally came up with the SDL_VIDEO_FULLSCREEN_HEAD variable mentioned HERE (archwiki ftw!), and -thank god- it worked as expected. So for you it is:
$: SDL_VIDEO_FULLSCREEN_HEAD=0 ~/.steam/root/SteamApps/common/Psychonauts/Psychonauts

I hope this helps someone out there. I wish happy gaming.
Sincerely

suluke

Related: 
A topic on a mailing list also discussing a similar solution can be found here: http://icculus.org/pipermail/psychonauts/2012-June/000000.html

Montag, 29. Juli 2013

Overview over Galaxy Conquest games

Hello visitors!

Have you ever played this kind of game, where you start with about one planet that produces ships and you have to conquer the rest of the planets in a given galaxy with those?

I really love this simple but addictive types of games, especially after I got the game Starlink for free as the app of the day in the amazon appshop.

After I spent a couple of hours playing it I felt the need for a game like this on my linux pc, but sadly I did not find any free/open source games out there.
Here is what I found as alternatives though:

  • Pax Galaxia by Sillysoft. It's pretty old as of now, but since the game does not need a lot of graphics it could compete easily with the others - if there weren't the 20$ they still demand for this game. I still mention it because it can be seen as a forerunner here.
  • GalaxIR by smyno (I think he called himself meryodev before) is an Android only app. I started with this game and the demo is already pretty good as well as it also features a multiplayer mode for 2 players via bluetooth.
  • Galcon or Galactic Conquest and Galcon Fusion by Phil Hassey are established trademarks in this field. The games are available for almost every platform (even palm) out there and costs around 10 bucks (at least on steam). There will also be a sequel to it - Galcon 2 - which already successfully absolved its kickstarter campaign.
  • Starlink by Tasharen, which I already mentioned. It costs between 2$ (mobile) and 4$ (desktop) and is available for android (google, amazon) and every desktop platform, purchaseble via Desura. A demo can be found on the developer's website.
  • Auralux is an incredibly beatiful games which also adds on-way battles instead of just planteside battles to the game. Unfortunately only supports iPhone, Android and Windows - but it's completely free (as far as I could see)
  • Currently, I am playing Eufloria. It has a pretty cool story mode and some funny additins, like upgrades. Unfortunatley, on smartphones (where I am playing on), those extra features make the game a bit quirky to control sometmes. It is sill worth the time, although 15€ on Steam (windows only) seem a bit expensive. It is also available on iTunes for 4.49€, Google Play and Amazon Appstore (2.99€ each).
Then, there are other games which can somehow be compared to this kind of game.
  • One example is Gratuitous Space Battles by Positech games. Usually it costs between 15 and 17 dollars, but is currently (25th of July to August 1st 2013) available in the humble bundle weekly sale for less than 4$. It's more extensive and doesn't focus on my type of gameplay explained here, but especially the dlc "galactic conquest" looks familiar in the overview map with what I've been doing.
  • Another game I found interesting and I wanted to play while researching was "Risk". It is turn based and thus fairly different, but may suit your taste if you liked the above games. Here is a video which attracted me and there is also the steam page of the game, where it is being sold for 10$ (or 10€ in my case)
  • Maybe you want to have a look at star twine. It's beautiful, though it didn't really appeal to me as far as gameplay is concerned. Price: 10$ and only windows is supported
  • Osmos, by hemisphere games. You are a cell-alike bubble and need to get bigger until you finally dominate all other bubbles on the field. There is not much left of the original priciple of the games above, but I can really recommend it. Available for all platforms, somewhere between 2 and 10 dollars for the mobile and desktop versions.
I hope I could give you an overview over all the available games. If you have a game to add here, leave a comment.
Until then, yours
suluke

Sonntag, 28. Juli 2013

[Rezept] Tante Emma Kuchen

Guten Morgen, liebe Backfreudige!

Hiermit teile ich das Rezept zu meinem Lieblingskuchen mit euch, so, wie ich es von meiner Oma übernommen habe:
  1. Zutaten:
    • Teig:
      • 1 Becher Sahne (200ml)
      • 1 Becher Zucker
      • 2 Becher Mehl
      • 4 Eier
      • 1 Päckchen Backpulver
      • 1 Päckchen Vanillezucker
      • Optional: Etwas Zitronenschale und eine Prise Salz
    • Belag
      • 200g gehackte Mandeln
      • 1 Becher Zucker
      • 1 Päckchen Vanillezucker
      • 125g zerlassene Butter
      • 4 EL Milch
    • Sonstiges:
      • Springform
  2. Zubereitung:
    • Zuerst den Teig durch zusammengeben der Zutaten in einer Schüssel anrichten und gut verrühren. Etwas zum Entlüften stehen lassen schadet nicht, kann aber vernachlässigt werden.
    • Teig in die Springform geben und bei 140°C Umluft bzw. 150-160°C Ober- & Unterhitze im vorgeheizten Backofen ca. 20 bis 25 Minuten anbacken.
    • In der Zwischenzeit Butter zerlassen und Belag durch Zusammengeben und gutes Verrühren aller Zutaten anrichten.
    • Teig auf Konsistenz überprüfen. Er sollte fest genug sein, dass er unbeschadet mit der Mandelmasse bedeckt werden kann. Dies dann auch tuen.
    • Anschließend Kuchen für weitere 20-30 Minuten im Backofen bei gleicher Temperatur fertig backen. Der Kuchen ist fertig, wenn der Belag goldbraun karamellisiert ist.
  3. Geschätzter Zeitaufwand: 1 bis 1,5 Stunden
Der Grund, warum ich diesen Kuchen so gerne mag, ist nicht nur sein vortrefflicher Geschmack kombiniert mit seinem saftigen Biss, sondern auch die Einfachheit der Zubereitung. Zudem sind Teig und Belag im Rohzustand bereits sehr lecker und eignen sich daher grandios zum Auslecken der Schüsseln.

Die Namensgebung habe ich auch von meiner Großmutter. Ein direkter Vergleich zum Bienenstich liegt nahe, doch es fehlt die Cremefüllung. Daher könnte ich mir mit spezieller Butter und geeigneter Wahl eines Ersatzes für die Sahne und die 4 EL Milch (Wasser? Sojamilch?) auch eine recht einfache laktosefreie Zubereitung vorstellen.

Ich bin mir sicher, er wird euch schmecken :)
Guten Appetit!









Donnerstag, 18. Juli 2013

[Steam 4 Linux]: Game not starting, only Error message is "SteamAPI_init() failed"

Hello there, reader!

It's summer and this means it is steam sale! This is the good news :) But when you are on linux and you just bought some really cool game, you may still encounter problems due to linux only having received a lot of attention by game developers just for the past couple of months.

So did I, namely with the game "Osmos" by the Hemisphere game studios. I had bought it when it was cheap some days ago, installed it but couldn't get it to start. Clicking on the "play" button within steam would only pop up the "Steam news" dialog - at most.

Commandline debugging
So I started steam from commandline and dug into all the funny warnings it throws during runtime. But the only error I found in connection with my attempts to launch Osmos was 
"SteamAPI_init() failed" - following startup messages of Osmos.bin32 (Unfortunately steam only offers the 32 bit version of the game, although there is a 64 bit version available I think, google for Osmos.bin64)

Missing libs?
I recently switched to arch linux, so of course I thought of missing 32 bit libs at first.
Indeed I was missing lib32-intel-dri (the 32 bit intel driver for mesa) and I think lib32-openal too, but none of them fixed the problem - although the 32 bit graphics driver dramatically increased the performance of half life 1. You may still want to look at the aur package "osmos" to have a look at the immediate dependencies here. I also used the handy command "ldd" on Osmos.bin32 to find out about all libs used by the binary.

Exit: The solution
After a long time I grew more and more desperate searching the internet unsuccessfully, when finally I had the lucky thought to try out something I stumbled upon earlier without giving it too much attention: I did not exit steam via right click on the tray icon but via the "steam" entry in the menu bar of the program. It's funny, but it seems like this is the only way to make steam apply certain updates on shutdown. At least some additional lines in the console output mentioning "package updates" suggest that - and really: After starting Steam again Osmos would finally launch!

Résumé
So I thought I might share this little piece of info with you - namely that you should use the menu button to exit steam from time to time to make sure your installation stays up to date.

If you have some other game making trouble, have a look at the arch wiki's "specific troubleshooting" section here.

I hope this helps. If you liked this, I would be happy if you left me a comment.

See you later, yours
suluke

Montag, 1. Juli 2013

XFCE suddenly not applying any themes any more

Hello people out there!

Recently I faced some strange behaviour with my Xfce 4 (.10) after I had plugged in a beamer. On first login after startup it wouldn't apply the window theme I set, nor would it use my preferred icon theme.
Also, setting the theme again with the xfce settings dialog (xfce4-appearance-settings) would not have any effect. Logging out and logging in again solved the issue temporarily, though.

Usually I already use a dual monitor setup and the beamer just switched place with my desktop monitor. So this was obviously a dual or multi monitor problem, and the first place I looked in for error messages was ~/.xsession-errors. There I encountered a line saying:
"The program 'xfsettingsd' received an X Window System error"

So the error occured in xfsettingsd, which also explained why using the settings dialogs hadn't had any effect later on.
Luckily, google would directly lead me to https://bugzilla.redhat.com/show_bug.cgi?id=867455 when searching for this error message, where I found the solution:
By simply deleting
.config/xfce4/xfconf/xfce-perchannel-xml/displays.xml
I was able to fix the error. As mentioned in the bug report, the file was recreated. Nevertheless I recommend to backup the file, since one never knows if such a file contains additional configuration markup you would maybe want to have access to later.

I hope this information can help somebody. If you want to thank me or want me to add something or maybe have any suggestions for improvements, I would be glad if you left me a comment.

Until then, see you soon

suluke

Sonntag, 21. April 2013

Dark theme for Eclipse Juno on dark Xfce in 3 steps

[EDIT 2013/11/08]
In the meantime, Eclipse Kepler was released and I have moved to an Eclipse installation via Arch User Repository. I do not know which of both broke my guide, but I really couldn't get it to work any more, so I checked the web again and found THIS "install-new-software"-installable theme via Stackoverflow. To turn it on, go the same way as before (Window->Preferences->General->Appearance).

Hey folks!

Since I had to spend some time googling again to make this work, I thought I'd just write down the necessary steps for some of you.

Actually it is pretty easy to "dark theme" eclipse juno when knowing how to:
  1. Install "dark juno" by Roger Dudler from here by
    1. Downloading the plugin zip file
    2. Extracting the "plugin" folder from the zip with its contents to <eclipse installation directory>/dropins/
    3. (Re-)starting Eclipse
    4. Navigating to Window->Preferences->General->Appearance and choosing "Dark Juno" in the dropdown
  2. Install the Eclipse Color Theme from the Eclipse Market
  3. Look for a nice theme on http://eclipsecolorthemes.org/ and apply it via Window->Preferences->General->Appearance->Color theme
That should be it. My result (with Color theme "Zenburn") looked like this:

Happy coding!

Sonntag, 7. April 2013

Set up an apache/httpd server on fedora 18 for raspberry pi

Hello!

Setting up an apache server on raspberry with fedora 18 is straight forward.

Just run the following command (as root):
# yum install httpd

After that, you probably want to start apache and have it started at bootup:
# service httpd start
# systemctl enable httpd.service


To unblock port 80 in fedora's firewall (make the server available from outside), run

# firewall-cmd --add-port=80/tcp
and (to make it permanent. i.e. surviving reboots)
# firewall-cmd --permanent --add-port=80/tcp

You may also want to install the following packages
  • mysql mysql-server
    installs mysql and its database server. Autostart by running
    # systemctl enable mysqld.service
  • php
    install php 5
  • php-mysql
    installs mysql support for php
by running
# yum install <packagename>
where you replace <packagename> with one or more of the ones given above.

After having installed all of them, you're running a complete LAMP (linux, apache, mysql, php) server on your raspberry.

Congratulations!

[UPDATE Apr. 28 2013] Since solely running "firewall-cmd" will not survive any restarts, I added the additional command including "--permanent" option to the blog post.

Freitag, 22. Februar 2013

Linux Skype "send file via drag & drop"-problem

Hello everyone!

Skype on Linux isn't as bad as many think it is...I guess. At least for me the most important features work as good as so I would never come to the idea that I needed to boot windows in order to have a convenient conversation.

There are some minor "flaws" though - e.g features in the UI microsoft didn't (want to?) make work on linux. One of those is the fact that you cannot simply drag a file from nautilus/konqueror/thunar (I only confirmed thunar, so correct me if this is an xfce-only problem) and drop it onto the skype window to send it. Thus, you will probably need to click on the (+), then "send file" and the navigate to the file (again). If you are used to have the system file manager open in the file-to-send's folder next to your skype window, this is not really a nice workflow to be honest, compared to what is possible in the windows version.

I spend quite some time researching on this, so I guess that I have to tell that this lack isn't "fixable" as of now unfortunately (although I would be glad to have someone correct me here, too).
BUT I just found out another way to simplify the process by accident:

Skype seems to accept files to send from the clipboard!

Thus, ctrl-c with the desired file selected in your file manager and then ctrl+v inside skype will have the same effect as dragging and dropping on windows and is almost as convenient.

I hope this text will be findable in google so others may see this alternate solution, too. If you like this "workaround" or have a better solution, leave a comment.

Until then: Good bye!

Yours suluke

Sonntag, 17. Februar 2013

Xfce dark theme firefox font color issue

Good evening everybody!

For quite a while now I'm using xfce with a nicely looking dark/black theme ("dark orange bird" to be precise) and it's just so much better for my eyes this way.
There has only been one problem coming along with it, namely appearing in firefox, which was that FF seemingly adopted the white font color from the system when rendering fonts in input fields (e.g. in the main search field on the google webpages).

Unfortunately, "Preferences" -> "Content" -> "Colors" -> disable "Use system colors" did not resolve the problem, so I had to google a bit further and finally found Stefan Hellmann's guide HERE

The Problem described there was bit different from mine, since I wanted everything to stay "normal" with a white google page and black letters on white ground, so the userContent.css I ended up with looked a bit different:

input { 
   -moz-appearance: none !important;
   color: black;
}

textarea {
   -moz-appearance: none !important;
   color: black;
}

I also had to create the "chrome" folder. And don't be confused - what was FOO:BAR in Stefan Hellmann's blog post can greatly differ from that. Usually it ends with :DEFAULT and (at least for me) starts with some seemingly random letters.

I hope this may help someone out there.
See you soon

suluke

Samstag, 16. Februar 2013

[Fedora 18 x64] Enable Adobe flash player in Steam for Linux

Hey folks!

The last two days I played around a little with the (relatively) new steam for linux.
One thing I noticed was, that game preview videos did not play with the notice that flash player wasn't installed.
So I searched the web and finally found THIS guide, which basically just
  1. downloads the 32bit flash player from HERE
  2. extracts the libflashplayer.so from it and 
  3. places it in /usr/lib/mozilla/plugins. You will need super user rights to do this.
This worked fine for me, although you have to make sure the lib is marked executable (and readable, of course). If you can't remember the command, here you go:

sudo chmod 755 /usr/lib/mozilla/plugins/libflashplayer.so

Afterwards, restart steam if it has been running and enjoy!

Samstag, 2. Juni 2012

Impressions on Dagi P507 capacitive touchscreen stylus

Hello folks!

I recently ordered the Dagi P507 capacitive touchscreen stylus as a consequence of an article I read in the German computer magazine There it was presented as a very convincing product with a completely new concept, and since I own a tablet, I hoped to be able to use it for drawing.

A nice demo video, though rather a commercial, can be found on Youtube:


I bought the stylus at Brando's (<<LINK>>) for only 23 US$ including shipping fees and had to wait 50 days, although they estimated 20 days at most. Maybe the German customs didn't know whether to charge me additional taxes or not. But now I finally have it and I can share my experiences so far.

The stylus comes in a small paper box and with a plastic cap [B] (I don't know what it is used for as of now), a second metal spring [A] and several new tip stickers [C] included.
How the stylus was delivered (at least similar)


The spring can easily be overseen in my opinion, so be careful when throwing the packaging away.

<<My opinion>>:
The pen is a real enhancement in terms of precision on capacitive touchscreens. Even with the free version of AutoCAD's Sketchbook (express) you feel quickly like a "real artist" and at all places it saves you nerves by minimizing the number of misclicks.

The pen has a high build-quality and is as heavy as a full-metal pen. I didn't like the looseness of the cap when putting it on the backend of the pen when writing though. For me the length is still ok, but for others the pen might be too short.

I cannot say, whether or not and how often the tip stickers have to be changed, so far it doesn't seem necessary in any way.


The smoothness of the pen gliding over the screen depends. On my tablet it feels sometimes a bit scratchy, but probably because of the dirt it accumulates from time to time. On my sellphone, it feels very smooth. I think that by extending the spring a bit, you will even feel more like you write on paper because of the extended resistance - feeling just like pushing a pen into soft cardboard.

Of course there remains the problem with your hand heels. When writing a longer text or after some minutes of continuous drawing, you will feel the want to lay down your hand on the rest of the screen. I haven't met any good software trying to recognize and ignoring that so far, but I admit I haven't really looked for it. I don't even know whether this kind of filtering is technically possible or not, but I guess there exist only few non-paid solutions (on Android).

Dagi P507 in action


All in all, the pen is definitely worth its money and it is fun to use, but somehow it is not a perfect solution. Capacitive touchscreens are in fact not very precise, so everything will have to stay finger-friendly which minimizes the use of the stylus, and professionals who want real precision, pressure recognition etc. will buy other equipment. Remaining applications are taking notes on your tablet (but don't forget to keep your hand heels up), presenting on your mobile devices and maybe feel a bit nostalgic over the old PDAs.

I hope you got an impression on this product,
see you soon

suluke

Dienstag, 22. Mai 2012

Show a preview of your latest blogspot post on your external domain homepage

Hello readers!


During my internship I was given the task to find out on how to realize a small preview of the newest post from a blog here on blogspot. The problem was, that the previews should be integrated into a website owned by our client which was hosted by a different provider on a different domain, and that they should always keep up to date without any modifications. Additionally, my boss preferred to have the preview generated on client side, because it means less traffic and probably less trouble when integrating it into the rest of the framework-based project. In plain words, I was supposed to use Javascript.

So I searched the internet for multiple keyword combinations but did not find any solutions of someone who did that before. So I had to come up with a solution myself.

I believe there are three possible approaches for that:
The worst should be to go via the blog homepage, because then the desired information would either be mixed up with all sort of additional markup or completely hidden in other js-scripts.

The second approach is probably the most elegant one, but not completely simple to realize: If I tried to receive the data by pulling it from the blog's atom/rss feed I would have my information in a relatively good structure and Google would probably not set a limit to the number of accesses per day. Unfortunately though, plain javascript does not provide tools to parse the xml-alike feed output and I did not want to mess with an external library or parse the feed myself, which is probably still relatively easy with regular expression matches.

But I went the third way, which is probably the first one that came to your mind: Via the blogger api.
The api is currently under construction (heading for version 2) and the registration process takes some time to complete. You have to register/create a new api-Project on https://code.google.com/apis/console/ and apply for the permission to use the blogger api in it. The response e-mail took about twelve hours during the two times I tried it, which is the reason why I even think that there is only one Google employee who manually admits the usage of the api for your project.

Afterwards you simply do what the blogger-team wrote in their answer and you get access to the API-key, which is used by Google to keep track of your usage. I believe, the standard daily quota is about 1000 and I hope, it is counted by IPs and not by API-calls. Otherwise the permitted accesses would be exhausted quite rapidly.

Here is the code of my blogger.js file that generates the preview:
 /**  
  * Version: 2012/05/23 rev.1  
  *   
  * This script obtains information from the first post of a blogger-blog   
  * (in particular title + first image) and injects it into a specific  
  * place in the webpage.  
  *   
  * Currently, the information is written into an element (<div>) with the  
  * ID "blogger_output"  
  *   
  * To be able to style the information via css, the following classes are given to it:  
  * post title (p-tag): blogger_title  
  * post image (img-tag): blogger_image  
  */  
   
 function Blogger() {  
    Blogger.init();  
 }  
   
 Blogger.htmlOut = "blogger_output"; //The html-element, in which the blog-preview is to be written  
 Blogger.gAPI_URL = "https://www.googleapis.com/blogger/v2/blogs/"; //the blogger api base-url  
 Blogger.blogID = "9034413279324519603"; //The id of the blog whose latest post we want to generate a preview from  
 Blogger.apiKey = "AIzaSyCYuAlcd4NzcvTB2Igp7b2Tuuak_mLfcfk"; //The api-key to access the blogger-api  
   
 /**  
  * Writes a new line of (html-) text into the output element specified above  
  * @param text Some text to be written into the htmlOut element  
  */  
 Blogger.echo = function(text, writeInID) {  
    document.getElementById(writeInID).innerHTML += text;  
 };  
   
 /**  
  * Dynamically injects a script to the end of the body of the page  
  * @param jsname the url or name of the script to be injected  
  */  
 Blogger.injectScript = function (jsname) {  
    var scr = document.createElement('script');  
    scr.setAttribute('type','text/javascript');  
    scr.setAttribute('src',jsname);  
      
    var body = document.getElementsByTagName('body')[0];  
    body.appendChild(scr);  
 };  
   
 /**  
  * This is the callback method of the first blogger api call. Currently it does all  
  * the work (get title, image(s), preview text...), but at a later point we hope  
  * the blogger REST-api will support at least images as an additional resource type.   
  * In this case it is easy to add a second callback method correponding to the image[s]  
  * of the first post only.  
  * @param response The response of the google server after our api call  
  */  
 Blogger.handleBlog = function(response) {  
    //extract image url  
    var imgTag = response.items[0].content.match('(\\u003cimg.*?(/\\u003e))')[0];  
    var imgUrl = imgTag.match('http:.*?(?=\")');  
      
    //output  
    var aName = "blogger_link";  
    this.echo('<a id="' + aName + '" class="' + aName + '" href="' + response.items[0].url + '"></a>', this.htmlOut);  
    this.echo('<p class="blogger_title">' + response.items[0].title + '</p>', aName);  
      
    //Maybe a post has no image  
    //TODO: In this case, other information from the post could be shown  
    if(imgUrl != null) {  
       this.echo('<img class="blogger_image" alt="" src="' + imgUrl + '"/>', aName);  
    }  
    this.echo('</a>');  
 };  
   
 /**  
  * The first method of the script.  
  */  
 Blogger.init = function() {  
    //Inject script to obtain blog-data from google/blogger  
    var callback = 'Blogger.handleBlog';  
    var jsname = this.gAPI_URL + this.blogID + '/posts?callback=' + callback + '&key=' + this.apiKey;  
    this.injectScript(jsname);  
    return;  
 };  
   
   
 Blogger();  

Of course, you have to replace the values of the variablesapiKey and blogID with your personal data.

There are two techniques used here that may require explanation for beginners:
First, the data is received in JSON format via JSON with Padding (JSONP). You will easily find guides on this by using the internet.
And secondly there is the dynamic javascript injection in injectScript, which I borrowed from http://javascript.about.com/library/bladdjs.htm.

Additionally, there are a few things that I wanted to comment on here:
First thing is: please don't forget that I am an intern and this is actually my first try in anything javascript related. This is my first attempt of a pure js version.

You can also find a version of this script as a jquery-plugin under http://dl.dropbox.com/u/19826318/Blogger/bloggerJQP.js
In this case, only jquery has to be loaded, followed by the script call.

Secondly, you might have seen some passages in the code which refer to the current status of the blogger api. I really hope, there will be some improvement there as far as resource types are concerned. At least, the developer in charge has already received and approved a feature request upon this.

The code is well documented I hope, and there are classes/IDs given to the output later on which allow easy CSS-styling.

Used in a website, the html might look like the following:
1:  <html>  
2:   <head>  
3:    <title>JavaScript-Test</title>  
4:   </head>  
5:   <body>  
6:    <div id='blogger_output'><p>Neues aus meinem Blog:</p></div>  
7:    <script src="blogger.js" type="text/javascript"></script>  
8:   </body>  
9:  </html>  
...where the <div>-tag's id "blogger_output" is required for the script to be able to write the content into.

Result: 
Title and image of the post, all linking to the original post-url
Title and image of the post, all linking to the original post-url

I hope, this might be useful for some web-developer or intern out there. Please leave a comment if you liked it or if you have suggestions on how to improve this:)

See you soon,
suluke







Helpful links:
Getting started of the blogger JSON api 2.0
Code formatter for blogger

Dienstag, 8. Mai 2012

Why b43 driver does not load, even though brcmsmac is blacklisted

Hello world!
For some time now, I am trying to switch from my Microsoft Windows installation to a Linux one, Fedora 17beta to be precise. I am progressing very fast, but here and there it takes some time to get some things working for which you had a tool on Windows that doesn't exist on linux and which is too sophisticated for wine.


The hardest issue so far was the following:
In Windows 7HP it is fairly easy to turn your laptop's wireless card into a hotspot and thus sharing its ethernet connection with some other devices, in my case my smartphone and tablet. This is somehow important to me, because my room is simply too remote from our usual router, and my devices running android's apps have to be updated regularly. For the task of turning my notebook into a hotspot there exist several tools, simply go to www.alternativeto.net and pick the one you like best. I personally got along best with Virtual Router, since it is open source, free, and somehow light-weight. I can also recommend Virtual Wifi Router Version 2, it doesn't even require an installation, but somehow there are some graphical glitches.


Ok, let's get back to the original topic. Under Linux, those tools do NOT exist, there is only one software package that I could find that provides this feature, but of course not with a nice graphical UI. It is called "hostapd". For more advanced users it should be easy to get it running and there are a lot of guides covering how to get it to work with different dhcp servers etc.


BUT that is not the initial problem. Wireless in Linux is a world for itself, and especially the drivers and their features vary like animals in a zoo. Hostapd needs special drivers complying with the new mac80211 stack, which provides host-mode functionality. My notebook includes a broadcom card called BCM43225, and the only driver that promised to have this feature was b43, only working with my card since kernel 3.2.


So I initiated everything - I installed the firmwarecutter (b43-fwcutter), blacklisted the originally used driver brcmsmac and since it did not work from the beginning (of course) I even posted stupid questions into a forum. Finally I decided to compile my own kernel, completely stripped of brcmsmac, which I assumed to be interfering with b43. And then --- boom! I stumbled upon this option in the kernel configuration tool
Wireless LAN --> Broadcom43xx wireless support --> Hardware support that overlaps with the brcmsmac driver
Screenshot of xconfig












I hope you see, what the point is. It is possible to disable b43's support for all cards that can be used with brcmsmac, and the developers of Fedora promptly used this "feature". But why would you do that??? I mean, read <<<HERE>>> and you will get the impression that the kernel hackers themself are more convinced with their own work than with the new driver programmed by Broadcom. Is it really so complicated to filter drivers so that only one is used at a time for the same hardware that you have to hardcode limitations into overlapping drivers?


I spent hours on searching the web for someone maybe having the same problem. "Why does b43 not feel responsible for BCM43225", "why doesn't it load automatically?" etc. The answer is: The distributors (I'm sure Ubuntu does the same) couldn't imagine someone wanting to have more features in the driver. Ok, I might be a bit demanding - for a product that I use for free and that is so great. Dear Linux community, you are awesome. And I have to apologize if I sound  reproaching. In the end it is Broadcom's fault, since they didn't cooperate and still do not add all the features to their drivers. Please consider this article as constructive criticism.


I hope that if there is someone out there that wants to do something similar will find this post so that he doesn't have to waste so much time.


Yours sincerly,
suluke

Mittwoch, 25. April 2012

Rooting HTC Legend with Firmware 3.15, HBoot 1.001 and flashing CM9

Hello to the world out there,
today's post will be kind of obsolete from the beginning, but since I had so much trouble achieving what I wanted, I decided to share my experiences.

My sister has an HTC Legend, which is a beautiful phone in my opinion. And the fact that it survived her lifestyle for almost two years now with the only exception of one battery due to it having been dropped into water and a lost battery cover speaks clearly for it. Unfortunately though, the hardware is outdated from today's point of view.

When my sister asked me to help her installing a game called "temple run", whose installation failed on FroYo, I decided to help my sister getting even more out of the Legend, which means rooting and flashing a nice custom rom. As the title says, her stock rom didn't have the best prerequisites for rooting with
Firmware 3.15, Android 2.2 (FroYo)
HBoot 1.001, which cannot be s-offed, thus meaning that /system and /recovery will always be write-protected except from within recovery
and seemingly a branding from her provider, meaning that I had to have a goldcard inserted for everything

Ok, my major problem was downgrading to firmware 1.31, Android 2.1 (Eclair), I followed all the guides in >>here<<, which caused me to face the first Problem, namely that VISIONary wouldn't be successful, thus not resulting in a temp root. Another hard reset solved that, but any other tool doing the job (like super oneclick) should also do the job. The RUU failed several times with error 171 (waiting for bootloader too long) while the Legend was stuck at a black screen with some HTC update logo. The solution for that was finally to manually boot into bootloader (taking out battery and restarting with Power and Back button pressed simultaneously) and running the RUU again.

With the still not rooted Legend on firmware 1.31 I then tried to follow >>this<< guide from within my Win7-x64 installation, which also caused problems, so I had to switch to my Linux installation. By the way, I also tried it on WinXP in VirtualBox, but since VirtualBox did not not auto-reconnect the device after reboots, I didn't succeed here, too. VMWare does probably do this better.

I'm a little ashamed for having had the next problem, but maybe I am not the only one who simply couldn't imagine to use the trackball in the custom recovery popping up next after step1. Just so you know: it is being done this way and this will be the recovery from which you can install every custom rom in the future. The only disadvantage is that you always have to start it using a script on your PC, so a cable connection is required. But while researching the forums at XDA I think I saw that there are other ways to start recovery ("fake flash") and there are even CWM recoveries available for us with s-on devices. Additionally I can tell you, that I didn't have to switch the micro-SD to a non-goldcard one, maybe it is not mandatory and the guys from the guide just wanted to prevent that someone loses its "goldcardness" by writing the rootedupdate.zip on it. As far as I know, it has nothing to do with the necessity to have a goldcard inserted when flashing roms in the future. Once a device is branded, you will always need a goldcard to install another rom.

Well, after that all worked, I headed to the XDA-Developers and found this awesome new CM9-Rom for the HTC Legend: http://forum.xda-developers.com/showthread.php?t=1562595
As you can see in the video, it runs in a very acceptable speed, but I still did the following to improve the performance:
    [Settings-> System Performance]
    I set the maximum speed to 787MHz &the governor to "SmartAss2"
    I disabled tile rendering and enabled 16bit transparency
    [Settings-> Developer Settings]
    I activated "force 2D hardware acceleration"
    (I don't think they are exactly called and labeled like this, but you can hopefully figure out what I mean)
As a result I believe that even the fade-in animation of the app-drawer isn't laggy any more.

Of course, I also had to mess with the boot-loops after installing g-apps, but luckily the solution for that is already linked to in the OP of the rom [here].

So, in the end all this was actually "simple" if I had known everything I know now before. Next thing is maybe to figure out how to get the app working for my sister. This time installation doesn't fail from the beginning, but instead the app crashes right after opening it. Logcat showed me some exceptions that occur while  trying to load some mono library which cannot be found. So I'm afraid that it will probably be impossible for me to solve that:(

Good bye for now, you see I have things to be done
yours suluke