Archive for the ‘Projects’ Category

* 0.2 alpha – build 20130615

Posted on June 16th, 2013 by Alex. Filed under SpaceCoord 2.

SpaceCoord2LevelDisplayFinally I managed to integrate an interactive tutorial into the game. I also added the option to choose a difficulty level for the professional combat pilots out there. Try it out!

What else is new in this version?

  • added German translation
  • improved controls
  • several bug fixes



Get it on Google Play



* spacecoord 2 tutorial

Posted on April 22nd, 2013 by Alex. Filed under SpaceCoord 2.


SpaceCoord2 Main Menu
The first thing that greats you, is the main menu:

  • New – Start a new game. If you played a game before, but have not finished yet. The new game will overwrite the state of the old game.
  • Continue – Continue with a previous game. If you finished the previous one, this button is grayed out.
  • Upgrade – Here you can upgrade your ship with new weapons and features. However it is not yet fully tested and will be added in a release later.
  • Options – Change the volume of the music and sound effects
    • Credits – The game would not have been the one that it is now without the help of numerous people willing to share their work under a license that allows the use. If you want to know, where the graphics, fonts, music and sound effects are coming from, click here.
  • Exit – Save the current state of the game (if one is currently going on) and exit.

Game Layout

SpaceCoord2 Scene1
This image shows a scene in the game. On the left is the panel which allows you to enter another scene offering a different functionality each:

  • FTLFaster Than Light: In this scene, you can jump almost instantly to another sector in the galaxy. The farther away the sector from your current one, the more energy it costs. The energy display shows the energy that is left, after the jump was executed. Once the jump drive is engaged, it requires a huge amount of energy and cannot be interrupted. But you can leave the scene at any point in time.
  • SUB – Sublight Scene (shown in the image above). Whenever you are roaming around in the sector, you use the sublight engines. They are not as efficient as the jump drive compared to the distance, but they allow a precise navigation. Weapons can only be fired while the ship is traveling below the speed of light. With the left control, you control the ship (“MOVE”). Be aware of obstacles and planets damaging or even destroying your ship.

    With the right control you can fire your energy weapons and lasers. They require energy and as long as your reserves are filled, you can fire lasers. They are not as powerful as the torpedoes (see below). Hold the red marked button in the direction in which you want to fire. It takes a moment to charge the laser banks and to reload them.

  • SpaceCoord2 Torpedo SceneTOR – This is your torpedo room. Torpedoes are very powerful, but slow weapons. However your stock is limited, so take care in aiming by moving the red bar in the radar circle towards the direction of the enemy. The selection field allows you to select an appropriate torpedo which differ in its capabilities. However this will be implemented later.
  • SHD – Your ship is equipped with the latest shielding technology preventing any other object or energy penetrating the hull and armor. Shields require energy and can be recharge by using the ship’s resources. A light blue circle around any object shows the state an strength of the shield. If it is depleted and inflicted damage is compensated by the armor. If the armor is lost, your ship explodes and the galaxy is taken over by the evil enemies.


On top of the screen are displayed the time that is left to clear the galaxy, the energy level (TIME, ENERGY on the right), the state of the shields and armor (SHD and AMR on the left). The game is won, if all hostile ships have been eliminated. Or it is lost, if your ship exploded or you ran out of time or energy.

SpaceCoord2 Little IndicatorSpace is vast. Fortunately your ship is equipped with a short range scanner localizing objects that are within the sector, but are far to see. Watch out for the little round indicators which are conveniently integrated at the boundary of the Sublight Scene (“SUB”) by your ship’s computer.


Warning, the following text may contain spoilers. To reveal it, mark the black gap below with your mouse.

Beware of planets. A crash landing on a planet destroys your ship immediately.

There are several objects that will harm you and your crew. But help is still available, but hidden in the galaxy. At space stations you can refuel your energy reserves and do some maintenance to repair your armor. However you have to park your ship not so far away from it to use the services of the space stations.


Get it on Google Play


* initial release (version: 0.1 alpha, build 20130421)

Posted on April 22nd, 2013 by Alex. Filed under SpaceCoord 2.

SpaceCoord2 Icon


The formerly peaceful galaxy has been taken over by evil enemies. Only one ship stands still in their path and fights back. But the time and resources are running short and every action needs to be planned ahead. Can you free the worlds and bring back the peace?

The Internet permission is for displaying Ads only. There are no ads shown during the game play.


I uploaded the initial release of SpaceCoord 2 to Google Play. It is a reimplementation of classic game that I used to play in my childhood. Please note that this version is an early alpha and maybe full of bugs. Hence I would appreciate, if you report any trouble or bugs. Also suggestions and feature requests are most welcome. Over the coming days/months/years, I am going to add features and squash the bugs, so stay tuned!

Credits and Licenses

The following sound files used in this game, are from and licensed under the CC-Attribution License:

The following sound files are royalty free and downloaded from Teknoaxe:

The following font files used in this game, are from and licensed under the CC-Attribution Share Alike License:


Get it on Google Play


* libboost and read_graphviz_dp

Posted on March 20th, 2013 by Alex. Filed under CPP.

After describing, how graphs can be stored, the question arises, how can they be read? Again we use this graph as an example

Example Graph

Example Graph

which is represented in the file

digraph G {
	1 [op=2];
	2 [op=2];
	3 [op=2];
	4 [op=2];
	5 [op=0];
	6 [op=2];
	7 [op=2];
	8 [op=0];
	9 [op=8];
	10 [op=1];
	11 [op=1];
	1->6 ;
	2->6 ;
	3->7 ;
	4->8 ;
	5->9 ;
	6->10 ;
	7->11 ;
	10->11 ;

The vertices are a struct in my source code:

struct Vertex {			//-- properties of a node
	unsigned int id;	// The ID of the vertex.
	int asapTime;		// The time index when this vertex can be scheduled EARLIEST.
	int alapTime;		// The time index when this vertex can be scheduled LATEST.
	ops_e op;			// The type of operation that needs to be performed in this vertex

ops_e in line 5 is an enum type:

enum ops_e {ADD, SUB, MUL, DIV, RSH, LSH, RSHR, LSHR, CMP, total_ops};

Based on the previous experience the operators << and >> for ops_e are already overloaded and added to the std namespace.

The graph itself is stored as an adjacency list:

typedef adjacency_list<vecS, vecS, bidirectionalS, Vertex, no_property> DFGAdjList;

To read the graph, the dynamic properties need to be defined:

dynamic_properties dpInput;"id", get(&Vertex::id, dfg));"op", get(&Vertex::op, dfg));

//-- open the file
string filename = argv[1];
ifstream fin(filename.c_str());

//-- Fill dfg with the content of the file
read_graphviz(fin, dfg, dpInput, "id");

Have a look at the directory libboost/read_graphviz_dp in the zip file which can be downloaded below, to see the whole source code used in this example. If you get an error message such as

$ ./main
terminate called after throwing an instance of 'boost::exception_detail::clone_impl >'
what(): Property not found: alapTime.

check the, if all properties are included. As you can see, in the source code, the property alapTime has not been defined. It might also necessary to use a current library to run this code which has been tested with version 1.53. To update a newer version, please refer the installation manual in the section "Option 2: write_graphviz_dp()".


The source code can be downloaded here: libboost.tar.bz2


* libboost and write_graphviz(_dp)?

Posted on March 20th, 2013 by Alex. Filed under CPP.

Currently I am working with the boost library to handle graph operations. A requirement is to read and write the graphs from and to a file, which caused me a lot of head ache and time consuming searches for examples, how other developers implemented it. The found examples were somewhat not applicable to my problem. Hence I am summarizing here what I found out to write a graph to a file, so that other may simply copy and past most of the code. In another posting I am going to show, how I read the graph from a file. The code for the whole program can be downloaded at the bottom.

Lets assume I have the following graph which is used for all examples.

Example Graph

Example Graph

Probably you will recognize this graph from the paper “Force-directed scheduling for the behavioral synthesis of ASIC’s” by Pierre G. Paulin and John P. Knight.

This graph is a data flow graph (DFG). The vertices of this graph contain some properties such as operations to be executed and some integers for the sake of an example. The edges show the dependencies between the operations. The properties of each vertex are defined in a struct:

struct Vertex {			//-- properties of a node
	unsigned int id;	// The ID of the vertex.
	int asapTime;		// The time index when this vertex can be scheduled EARLIEST.
	int alapTime;		// The time index when this vertex can be scheduled LATEST.
	ops_e op;			// The type of operation that needs to be performed in this vertex

ops_e in line 5 is an enum type:

enum ops_e {ADD, SUB, MUL, DIV, RSH, LSH, RSHR, LSHR, CMP, total_ops};

For the graph I am using a adjacency_list. As you can see, I am using the struct Vertex to define the vertex properties. I do not care about the edges, so they have no_property. Apart form that I am using a bidirectional graph so that I can nicely walk through outgoing and incoming edges.

typedef adjacency_list<vecS, vecS, bidirectionalS, Vertex, no_property> DFGAdjList;

Now the graph needs to be filled to get the example:

// the definition of Vertex, ops_e and DFGAdjList are omitted here
enum nodes_e {N1, N2, N3, N4, N5, N6, N7, N8, N9, N10, N11, N12, N13, N14, N15, total_nodes};
typedef graph_traits<DFGAdjList>::vertex_descriptor VertexDesc;

int main(void) {
	VertexDesc curVertexDFG;
	DFGAdjList dfg;

	//-- Fill the verices with operations
	ops_e operations[11];
	operations[0] = MUL;
	operations[1] = MUL;
	operations[2] = MUL;
	operations[3] = MUL;
	operations[4] = ADD;
	operations[5] = MUL;
	operations[6] = MUL;
	operations[7] = ADD;
	operations[8] = CMP;
	operations[9] = SUB;
	operations[10] = SUB;

	for(int i=0; i<11; ++i) {
		curVertexDFG = add_vertex(dfg);
		dfg[curVertexDFG].id = i;
		dfg[curVertexDFG].asapTime = -1;
		dfg[curVertexDFG].alapTime = -1;
		dfg[curVertexDFG].op = operations[i];

	//-- Add the edges
	add_edge(N1, N6, dfg);
	add_edge(N2, N6, dfg);
	add_edge(N3, N7, dfg);
	add_edge(N4, N8, dfg);
	add_edge(N5, N9, dfg);
	add_edge(N6, N10, dfg);
	add_edge(N7, N11, dfg);
	add_edge(N10, N11, dfg);


So, now this graph needs to be stored. There are two options: Using a writer class telling write_graphviz() how this graph is stored. This option works at least in libboost 1.41. Or using dynamic properties by using write_graphviz_dp(). For that I have to update the library, which is quite an easy job. I would like to show you both options:

Option 1: write_graphviz()

A writer class is quite simply implemented. You do not need to understand the whole thing, just the places that you need to adapt to work for your graph. In this example the helper class looks like the following one:

template <class GraphType> class myVertexWriter {
	myVertexWriter(GraphType _graphType) : graphType(_graphType) {}
	template <class VertexOrEdge> void operator()(std::ostream &out, const VertexOrEdge &v) const {
		out << "[id=\"" << graphType[v].id << "\", " <<
			"op=\"" << graphType[v].op  << "\", " <<
			"asapTime=\"" << graphType[v].asapTime << "\", " <<
			"alapTime=\"" << graphType[v].alapTime << "\", " <<
			"label=\"" << graphType[v].id << "\\nop:" << graphType[v].op << "\"]"; // for dotty

	GraphType graphType;

As you can see, the class is templated so it can be used for all kind of graph types (DFGAdjList) in this example. So it tells the function write_graphviz() how the graph is stored. The main program is extended to call the function:

	add_edge(N7, N11, dfg);
	add_edge(N10, N11, dfg);

	myVertexWriter<DFGAdjList> vw(dfg); //-- instantiate the writer class
	ofstream fout("");
	write_graphviz_dp(fout, dfg, vw);


The files are located in the directory libboost/write_graphviz in the zip-file. After compiling the code by executing make in the console, a new file “” is created with the following content:

digraph G {
0[id="0", op="2", asapTime="-1", alapTime="-1", label="0\nop:2"];
1[id="1", op="2", asapTime="-1", alapTime="-1", label="1\nop:2"];
2[id="2", op="2", asapTime="-1", alapTime="-1", label="2\nop:2"];
3[id="3", op="2", asapTime="-1", alapTime="-1", label="3\nop:2"];
4[id="4", op="0", asapTime="-1", alapTime="-1", label="4\nop:0"];
5[id="5", op="2", asapTime="-1", alapTime="-1", label="5\nop:2"];
6[id="6", op="2", asapTime="-1", alapTime="-1", label="6\nop:2"];
7[id="7", op="0", asapTime="-1", alapTime="-1", label="7\nop:0"];
8[id="8", op="8", asapTime="-1", alapTime="-1", label="8\nop:8"];
9[id="9", op="1", asapTime="-1", alapTime="-1", label="9\nop:1"];
10[id="10", op="1", asapTime="-1", alapTime="-1", label="10\nop:1"];
0->5 ;
1->5 ;
2->6 ;
3->7 ;
4->8 ;
5->9 ;
6->10 ;
9->10 ;

which is the representation of the example graph in .dot format. dot -Tjpg > graph.jpg in the console converts into graph.jpg:Graph after write_graphviz()

Option 2: write_graphviz_dp()

This function call uses dynamic properties (dp) to store the vertex properties. As far as I remember this function was introduced into libboost with version 1.44. Hence if you are running on an Debian stable system or another one, which does not have a current libboost, the road does not have to end here. A new version of libboost is easily installed and can be done, if you do not have root access to the system. Without using graphviz functions, nothing has to be compiled anyway. Here is a short description of the commands that I executed to get the libraries compiled to allow me to use write_graphviz_dp():

  1. Download the latest stable boost library from here. There is a “Download” link in the gray box.
  2. Download the .bz file and save it somewhere, where you have space and where you find it.
  3. Execute tar xfj boost_1_53_0.tar.bz2 in the console to unpack the files. As you can see at the time of writing this post, version 1.53 was the current release.
  4. Change into the newly created directory with cd boost_1_53_0, execute ./bootstrap --prefix=YOUR_DESTINATION_DIR --with-libraries=graph,regex
  5. It takes around 10 seconds, till the command prompt comes back. After that execute ./b2 -j6 install, which compiles the required parts using 6 cores (-j6) and copies everything to YOUR_DESTINATION_DIR.
  6. Now we have to tell the compiled programs using the graph and regex library to use the new library: export LD_LIBRARY_PATH=YOUR_DESTINATION_DIR/lib/:$LD_LIBRARY_PATH.
  7. And we have to tell the compiler to use the new header files (.hpp) during compilation and linking process by adding -IYOUR_DESTINATION_DIR/include -LYOUR_DESTINATION_DIR/lib/ -lboost_graph -lboost_regex to the c++ command. Have a look at the Makefile in libboost/write_graphviz_dp in the zip-file which can be downloaded below.

After the new library is installed, the main file is modified to

	add_edge(N7, N11, dfg);
	add_edge(N10, N11, dfg);

	//-- what is stored?
	dynamic_properties dpOutput;"id", get(&Vertex::id, dfg));"op", get(&Vertex::op, dfg));"asapTime", get(&Vertex::asapTime, dfg));"alapTime", get(&Vertex::alapTime, dfg));

	//-- save the graph in a file
	ofstream fout("");
	write_graphviz_dp(fout, dfg, dpOutput, string("id"));

	//-- send it to the console
	write_graphviz_dp(std::cout, dfg, dpOutput, string("id"));


and the writer class myVertexWriter is removed, since there is no need for it anymore. If this is compiled, the compiler throws a long list of error messages at you. Somewhere down in these lines is the following is written:

YOUR_DESTINATION_DIR/include/boost/lexical_cast.hpp:1513: error: no match for ‘operator<<’ in ‘((boost::detail::lexical_stream_limited_src, true>*)this)->boost::detail::lexical_stream_limited_src, true>::out_stream << input’


YOUR_DESTINATION_DIR/include/boost/lexical_cast.hpp:1899: error: no match for ‘operator>>’ in ‘stream >> output’

So something could not be stored. Since the struct of Vertex only uses mostly primitives (integers here), it has something to do with the enum type. If line 8 in the code above is commented, it compiles. But how to include the enum type into the output? By overloading the << and >> operator:

enum ops_e {ADD, SUB, MUL, DIV, RSH, LSH, RSHR, LSHR, CMP, total_ops};
std::ostream& operator<<(std::ostream &os, const ops_e op) {
	os << (int)op;
	return os;
std::istream& operator>>(std::istream &is, ops_e &op) {
	int operation;
	is >> operation;
	op = static_cast<ops_e>(operation);
	return is;

Unfortunately this does not work and the error messages do not change at all. On Stackoverflow a user reported the same error message. The problem is that the overloading << and >> operators are defined globally, but the function lexical_cast only looks into the namespaces of std and boost and hence cannot find any of these defined operators. Hence they need to be added to std:

enum ops_e {ADD, SUB, MUL, DIV, RSH, LSH, RSHR, LSHR, CMP, total_ops};
namespace std {
	std::ostream& operator<<(std::ostream &os, const ops_e op) {
		os << (int)op;
		return os;
	std::istream& operator>>(std::istream &is, ops_e &op) {
		int operation;
		is >> operation;
		op = static_cast<ops_e>(operation);
		return is;

Now it compiles and works. The question is, why should somebody go through the pain in choosing option 2? The answer is that this can be easily read in by read_graphviz_dp().


The example code can be downloaded here: libboost.tar.bz2


* samsung galaxy s3 – a short review

Posted on July 22nd, 2012 by Alex. Filed under Android.

I got my hands on a Samsung Galaxy S III (or SGS3 or I9300) recently and I must say, it is a very impressive piece of technology. However it also has its flaws that pop up occasionally and which should not be present in a smart phone carrying this price tag. Before you consider of getting an SGS3, you should be made aware of these bugs which are hopefully only software bugs and can be fixed by future updates. Till then the proud owner of an SGS3 has to live with the workarounds provided here. Hopefully Samsung does not drop its premium customers like a hot potato as it happened with the Galaxy S1. It took around a year before Froyo came onto the S1, which was already outdated by that time.

Currently there are three flaws:

Battery charging

To adapt my solar charger to the new phone, some changes were necessary to make the phone to believe that it gets charged by a wall charger. After the modification, the phone drew only 60mA at 5V from the charger. Assuming the battery is very low and considering the capacity of the battery of 2100mAh, it will take 35h to charge the battery not including the power that is required for normal operation. This is unacceptable. However after checking through the charger assuming that something went wrong, I switched off the phone and suddenly it drew 900mA through the charger. This is probably a software bug which will be fixed in an update. In fact on the same day I updated the phone and since then, this problem did not occur any more.

If you have the same problem, shut down or reboot your phone. According to posts in forums this fixed the slow charging issue.

[Update 28/07/2012] Since I updated the software of the phone through the official Kies, I have not encountered this problem any more.

Missing Mass Storage Media Mode

It is most convenient to plug in the phone into the USB port of a host machine and to copy some files such as songs, documents, etc. onto the newly detected drive. However with the SGS3 plugged in, no drive, not even a partition shows up. A search revealed that the so called UMS (USB mass storage device class) mode ahs been removed by Google to give priority to the MTP (Media Transfer Protocol). Why Google chose to go for a literally proprietary protocol developed by Microsoft for an Linux based Android phone is mysterious. Since I am running Debian Stable, support is not be expected for the next few years. Fortunately there are two solutions to this problem:

  1. Using a software such as AndFTP allows me to transfer files easily through the WiFi connection. However the software becomes buggy and slow, if some 500 files need to be transfered.
  2. Using ADB from the android SDK which allows to push and pull files to and from the phone. USB Debugging needs to be activated to do that. ADB also supports the file and directory transfer recursively. Unfortunately the whole SDK needs to be downloaded just to acquire the command line tool.

“Network disabled. Poor connection”

While connecting the SGS3 to my WiFi card in my laptop which can act as an access point does not pose any problem, hooking up the phone to a proper WiFi hotspot needed more effort. After authentication and acquiring an IP address from the DHCP server, the phone marked the connection as not usable, since the connectivity was too poor. The distance between the AP and the phone was less than a meter and everything else such as SGS1 and laptops, were able to connect to it. Playing around with the settings such as Fragmentation or RTS Threshold or the different intervals (DTIM, Beacon) did not lead to any improvement. However I figured out, if the access to the network is configured in such a way that only a static IP address is required, the phone connects to the same AP effortless. Maybe the reason is that I am using a private network starting with 10.X.X.X/24 instead of the usual 192.168.0.X.


* solar panel for galaxy s (i9000)

Posted on May 13th, 2012 by Alex. Filed under Android, Cycle Tours.

For extended cycle trips I am using my Samsung Galaxy S for GPS tracking. However prolonged trips cause a serious power drain on the battery and an external power source is required. Hence I bought a small solar panel (Specs: Rated peak power (Pmax): 3Wp, rated voltage (Vpm): 8.5V) for Rs.450 (approx USD10) and some electronic components to get a constant voltage of 5V corresponding to the output voltage of a USB port.

While testing under several different conditions, if the phone charges, it turned out that the phone discharges at a fast rate, if the solar panel is covered by shade (even slightly) or the sun does not shine orthogonal onto the panel. The reason is that while charging, the CPU of the phone does not enter a deep sleep state in which it is partly switched off reducing the power consumption. If the panel is partly covered, the CPU draws more power than the panel can provide. In addition, it seems that the minimum frequency is set to 200MHz while charging. Hence the CPU runs constantly at 200MHz even if it does not have anything to do causing the power drain. As soon as the power is disconnected, 100MHz and Deep Sleep are added to the available frequencies (1000MHz, 800MHz, 400MHz, 200Mhz). CPU Spy is a small application allowing to check the history of used frequencies.

I did not find any solution to force the Deep Sleep state while the phone is connected to the solar panel (or any other power source). However a developer called existz published TalonDEV, a kernel that allows the CPU to be clocked at 100MHz even while charging. As a nice side effect after installing the kernel is the reduction of the screen brightness whose setting was too high in the Gingerbread-Samsung edition as compared to Froyo.

After installing the TalonDEV kernel, the charging ratings are much better. I still have to do further tests, but if the solar panel is shaded partly, it still charges the phone, which was not achieved before.

[Update 14/05/2012] After some testing with the TalonDEV kernel, I ran into stability problems. Random screen freezes occurred even with the unclocked and the most current version. In addition the back key stopped working and the gallery could not find any images anymore. So I installed another kernel called Semaphore. However only the Semaphore kernel for Ice Cream Sandwich (ICS) supports the 100MHz frequency while charging.

After some further testing, I figured out that the Semaphore kernel clocks the CPU at 100MHz, if the phone is charging through the wall charger and not via USB. So the statement above is not entirely correct. I do not know about the behavior of the kernel that is shipped originally with DarkyROM, since I did not test it. Comments are welcome.

So the trick is to convince the phone that it gets charged by the wall charger. You can check the state, if it charges via USB or AC in Settings -> About phone -> Status -> Battery status. Digging around in the Internet and the disassembly of an emergency charger running on 2 AA batteries which put the charging state into the AC mode, revealed that the +5V USB line needs to be connected to both data lines (D- and D+) through a 470kOhm resistor. I updated the diagram below accordingly. Now whenever I connect the solar panel, the charging state is in AC mode and the CPU is clock at 100MHz at minimum.

Installation – TalonDEV

This section gives a brief guide, how to install the kernel. My Galaxy S is running on Darky’s ROM v10.4.2 [XWJW1] for quite some time now. I am not describing how I installed that one, since the are plenty of videos and installation guides in the forum which are easy to follow. Through DarkyOTA I installed the XXJVU modem, because I experienced some problems with my provider using the modem firmware of the original DarkyROM.

To install the TalonDEV kernel, download the zip file mentioned in the thread. I took, which over clocks the CPU to 1200MHz (as compared to 1000MHz). If you experience problems regarding stability, I suggest taking instead. I have not tried the BIGMEM version yet, since I am happy with the way it is at the moment.

Copy the zip file to your phone (internal SD Card), reboot into recovery (by installing DarkyROM you already know, how to do that) and install the zip file. After the installation is successful, reboot the phone which will take around 5 minutes. So have patience watching the original Samsung S symbol changing its color.

To further tweak the power consumption, I will start playing around with the voltages supplied to the CPU. The application Control Freak allows it easily through a GUI (There are several apps with the same name in Google Play. They are not the right ones.). I will start the testing as soon as I am convinced that the kernel is stable with the current configuration.

Installation – Semaphore

There is a nice installation guide on how to flash the Semaphore kernel in Linux as well as Windows.

The Circuitry

Thanks for planing of that circuit has to go to Abhijit of CEDT (now DESE) of IISc, who is the brain behind that circuit. I am somewhat illiterated, if it comes to electronics.

To get the maximum power out of the solar panel, I am using an LM1086-5V which constantly gives 5V at its output port. A 7805 will also serve the purpose. However the efficiency of that component is not as high as the LM1086. Although there is an LM1086-ADJ which is able to give a range of different output voltages, it will complicate the whole circuit due to the necessity of additional resistors. One aim was to keep the circuit as simple and small as possible. The less components the circuitry has, the lesser is the probability that something breaks midway through an extended cycle tour. And usually I do not carry soldering irons with me while cycling. 😉

The following diagram gives the required specs of the capacitors smoothening the constantly fluctuating output of the solar panel while riding, and the resistor avoiding spikes, if a device is connected to the USB port. I apologize for the somewhat crude diagram, but as I mentioned, I am not a electronics guy.

Version 1 of the converter. The phone charges in USB mode forcing the CPU to run at 200MHz continously.

Version 2 of the converter. THe phone charges in AC mode allowing the CPU to be clocked at 100MHz at minimum.

The whole circuit is integrated in a somewhat water resistant box which is attached below the panel keeping it away from rain.

[Update 22/07/2012]
For the Samsung Galaxy S III (or SGS3, I9300) the 470kOhm resistor connecting the D+ and D- lines (pin 2 and 3 representing the data lines) to the 5V supply is not required. In fact, the phone does not detect any charging, if the version 2 of the solar charger is used. In this case, some modifications are required: If D+ and D- are shorted the charging is done in AC mode with a higher current of up to 900mA whereas in USB the maximum drawable current is 500mA. If D+ and D- are left open and floating (like in version 1 of the charger), the phone is charged in USB mode. Similar to the S1, the charging mode determines the CPU clocks: While in AC mode the CPU can go into a deep sleep and consume very little power, the minimum frequency in USB mode is 200MHz.


* speed up debian

Posted on April 7th, 2012 by Alex. Filed under Linux.

The following tricks to speed up several things in Debian, were collected through multiple forums.

Application Acceleration

There is a package called preload, an “adaptive readahead daemon”. It analyzes the programs the user starts and tries to accelerate them based on the previous users behavior. If it works, is too early for me to decide. Since the effect (if any) is probably slowly creeping in, I will not be able to feel any difference. In a week or month, I am planning to deactivate the service temporarily to see the difference.

In this post the author also mentions to append the lines vm.swappiness=20 and vm.vfs_cache_pressure=50 to /etc/sysctl.conf and describes them shortly. So I will not do that here.


First it is always a good idea to deactivate services, which are of no use. For instance why should someone start the bluetooth daemon, if there is no bluetooth device around? A little tool called sysv-rc-conf, lets the user comfortably decide, what should be started in which run level.

An incredible speedup during booting, I could observe after installing e4rat. It is my understanding e4rat ensures that files which are required during the booting sequence, are nicely lined up on the hard disk, so that all of them can be read in one single linear read request. Therefore e4rat will not be very helpful, if you boot from a SDD, since there are no mechanical parts which need to move around slowing down the accesses. There is a Debian package in the download section, so there is no need to compile the software by yourself. After installation (dpkg -i e4rat.deb as root) The following instructions are partly taken from the README file and are quite straight forward.

  1. Restart your machine and add the following line to the kernel parameters in GRUB by editing the entry (press e) and edit the line starting with kernel. Simply append the following line and press Ctrl+x to boot the kernel:
  2. If you are the only user of your machine, wait till the X server comes up and log in. This ensures that even your graphical login is accelerated. If you are working on a multiuser machine, just wait till you see the login prompt of the X server.
  3. Change to the tty (by pressing Ctrl+Alt+1), login as root and execute init 1.
  4. It will take some time to collect the data. It says something like Sending TERM to applications . In my case it took around 2 minutes till init 1 has been reached. Now you are in the single user environment. Type in your root password to login.
  5. Execute e4rat-realloc /var/lib/e4rat/startup.log
  6. Add init=/sbin/e4rat-preload to the kernel parameters (like you did in the first step). Please note that, if a new kernel is installed, the configuration file of GRUP is regenerated and your entry vanishes. Even if you edit the entry as you did in the first step, these changes are not permanent. To permanently add this line, change /etc/default/grub to
    # If you change this file, run 'update-grub' afterwards to update
    # /boot/grub/grub.cfg.
    GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
    GRUB_CMDLINE_LINUX="rootfstype=ext4 resume=/dev/sda6 i915.i916_enable_rc6=1 init=/sbin/e4rat-preload"

    The entries should be self explanatory.

  7. That’s all. Reboot by typing init 6 and enjoy the speedup.

To use e4rat, the package auditd needs to be removed, since there is a conflicting dependency. If you use your own kernel, you need to activate CONFIG_AUDIT and CONFIG_AUDITSYSCALL.

Cleaning up your system

Apart from the usual apt-get clean, apt-get autoremove and this one, I found a view more tricks for cleaning up the system.


There are many packages which are installed during the course of time. They grow in numbers, since Debian is a system that is installed once and runs ever since. For instance, if I compiled something that is not in the repositories and which depended on additional libraries, these libraries were most likely to remain in the system, since I probably forgot, which libraries and their dependencies I installed. But after compilation these development files can be removed again, hence just consuming hard disk space. A neat program to find all packages that got installed manually and do not have a dependency or a reason to be installed is deborphan.

Executing deborphan -H -a -z shows this list. Carefully go through that list and purge the packages which are obsolete. However there are a few you might want to keep. For instance, if you use ekiga and installed it manually, deborphan also lists that one.


You might also want to try out localepurge which “reclaims disk space removing unneeded localizations”. However the full descriptions states:

This is a script to recover disk space wasted for unneeded locales, Gnome/KDE localizations and localized man pages. Depending on the installation, it is possible to save some 200, 300, or even more mega bytes of disk space dedicated for localization you will most probably never have any use for. It is run automagically upon completion of any apt installation actions.

Please note, that this tool is a hack which is *not* integrated with Debian’s package management system and therefore is not for the faint of heart. This program interferes with the Debian package management and does provoke strange, but usually harmless, behaviour of programs related with apt/dpkg like dpkg-repack, reportbug, etc. Responsibility for its usage and possible breakage of your system therefore lies in the sysadmin’s (your) hands.

Please definitely do abstain from reporting any such bugs blaming localepurge if you break your system by using it. If you don’t know what you are doing and can’t handle any resulting breakage on your own then please simply don’t use this package.

So it is up to you to use it.

This list is by far not complete. New things will be added, if I stumble upon them. If you know something that helped you speeding up your system, please let me know. One condition though: The system should be the same like before. It is obvious that, if someone wants to speed up the machine to its maximum, he/she will not use e.g. Gnome, KDE or other heavy weights. But many users want to stick with what they have and just tune this a bit.


RSS Feeds: