Saturday, January 14, 2012

How to create in git a remote repo from a local one?

To create a remote repo from a local one follow the steps:

L: git init
L: git commit -a -m "Message"
R: adduser repo
R: cd /home/repo
R: git init --bare
R: chmod -R g+w repo
R: chown -R repo:users repo
L: git push ssh://remote_server/home/repo master

I'm not sure how correct it is and if the access rights need to be like that but it works:).

Thursday, July 14, 2011

How to copy contacts from Nokia N900 to Windows Phone

To copy contacts from Nokia N900 to Windows Phone 7 follow the steps:

1) Export contacts as vcards on N900
2) Copy a folder with exported vcards to your computer
3) Merge all the vicards to one file; on Windows, run in a console:

C:\Users\user1\Desktop\Exported contacts>for %a in (*.vcf) do cat newline.txt >>%a
copy /B *.vcf merged_contacts.vcf

4) Import the merged file on gmail, as contacts
5) Configure your gmail account on a Windows Phone to copy imported contacts

Re-installing Ubuntu on an encrypted LVM without overwriting existing home partition

John Wiersba wrote a very good HOWTO about installing and re-installing Ubuntu on an encrypted LVM without overwriting existing home partition:

Sunday, May 8, 2011

Android game development - libgdx

Couple of weeks ago I did a quick research about writing games for Android and I found libgdx. I encourage everyone writing games for Android to take a look on it. It is really great! You can run the same code as a desktop application or as Android app (I haven't try it on the device yet). It covers bunch of useful APIs, including for example box2d wrapper, audio, graphics, json, etc.

Acer Aspire and Ubuntu 11.04 Issues

I've just updated Ubuntu 10.04 to 10.10 and then 11.04. I faced several issues. I didn't have time to work on them more, so I can present only quick, dirty workarounds without much explanation:

1) There was a blank screen when I tried to run Ubuntu after the upgrade

I had to run it in the safe mode (something like that - don't remember exactly the name) and enable different graphics driver.

2) When I start the laptop it always first shows just a blank screen and hangs, after I restart it again it works

3) WiFi stopped working

The interface is blocked. rfkill doesn't help. The quickest workaround is to execute the following command:

sudo rmmod acer_wmi

4) Touchpad is not working

Sunday, November 28, 2010

GTK3 HTML5

http://blogs.gnome.org/alexl/2010/11/23/gtk3-vs-html5/

Sunday, October 31, 2010

Maemo: Incompatible application package

Recently I copied some package to the N900 and when I tried to install it from the FileManager the installation failed and I got following message:
Unable to install 'qt4-homescreen-loader'. Incompatible application package.
The workaround is to install it manually from the XTerm:

sudo gainroot
dpkg -i DEBIAN_PACKAGE_FILENAME

In order to get the root access the certain application needs to be installed. More information can be found here.

I didn't dig into the problem so it might be that there was really something wrong with the package.

WinXP guest (VMWare Player) hangs every few seconds on the Ubunut 10.04 host

WinXP guest (VMWare Player 3.1.2 build-301548) hangs every few seconds on the Ubunut 10.04 host. To solve the problem add the following lines to your .vmx file:

MemTrimRate = "0"
mainMem.useNamedFile=false
sched.mem.pshare.enable = "FALSE"
prefvmx.useRecommendedLockedMemSize = "TRUE"

More details can be found here.


Sunday, August 22, 2010

Acer 4820TG - problem with a microphone and a headset on Linux

My headset ports didn't work on Ubuntu 10.04 64bits until I ran a command below and restarted my computer:

sudo apt-get install linux-backports-modules-alsa-lucid-generic

Information about it I found on this forum:
http://ubuntuforums.org/showthread.php?t=1046137&page=104

Saturday, August 21, 2010

Acer 4820TG - a problem with graphics cards on Linux

Recently I was struggling with running Ubuntu 10.04 on Acer Aspire Timeline X 4820TG. After I installed ATI/AMD proprietary FGLRX graphics driver X didn't start. I didn't have time to solve the problem properly but I found out that after I've changed SWITCHABLE mode to DISCRETE in a BIOS settings for graphics cards I'm able to start Ubuntu properly.

Tuesday, May 25, 2010

Simple template for an application using Gnome Tracker client

Recently I've been investigating Gnome Tracker. It is a very nice project.

To learn some basics I wrote a very simple example. Although there were some good examples on the wiki I thought that for the very beginners it would be nice to have whole files and at the same time I could contribute to open source:). Here is the result:

http://live.gnome.org/Tracker/Documentation/ClientDevelopmentFromScratch

Friday, May 21, 2010

VMware on Ubuntu 10

Very quick fix for VMware on Ubuntu 10 (Lucid):
http://blog.gnu-designs.com/solved-building-vmware-workstation-modules-on-linux-2-6-32

Just follow the wintamute's suggestion in the comments.

Wednesday, May 12, 2010

GStreamer Rulez!

I heard about GStreamer every now and then but I didn't really know what it is about. Today I decided to check it out. It is awesome! :) To get excited about it check the notes below...

My environment: Ubuntu 9.10, with installed gstreamer and additional plugins (gstreamer0.10-plugins-gl, frei0r-plugins)

Below you can find instructions how to add a repository with additional plugins:
https://launchpad.net/~gstreamer-developers/+archive/ppa/

About GStreamer:
http://gstreamer.freedesktop.org/data/doc/gstreamer/head/manual/html/chapter-gstreamer.html

GStreamer:
http://www.gstreamer.net/

List of all gstreamer plugins - including effects, etc.:
http://gstreamer.freedesktop.org/documentation/plugins.html

Other blogs which were very helpful:
http://vimeo.com/groups/14747/videos/6673554 - this contains a sample video
http://bluwiki.com/go/GStreamer
http://www.twm-kd.com/computers/software/webcam-and-linux-gstreamer-tutorial/

Now the best part. Playing with videos!

Here is the original video:


The line below will turn a video into a cartoon:
$ gst-launch-0.10 filesrc location=Elphel_RV_2.ogg ! decodebin ! ffmpegcolorspace ! frei0r-filter-cartoon ! ffmpegcolorspace ! xvimagesink


The line below will add some plasma effect:
$ gst-launch-0.10 filesrc location=Elphel_RV_2.ogg ! decodebin ! ffmpegcolorspace ! frei0r-filter-distort0r ! ffmpegcolorspace ! xvimagesink

The line below will play the video on the cube rotating above the mirror and save it as .ogg file:
$ gst-launch-0.10 filesrc location=Elphel_RV_2.ogg ! decodebin ! glupload ! glfiltercube ! glfilterglass ! gldownload ! queue ! ffmpegcolorspace ! theoraenc ! queue ! oggmux ! filesink location=Elphel_RV_2_cube_glass.ogg

The line below will play the video on the cube rotating above the mirror:
$ gst-launch-0.10 filesrc location=Elphel_RV_2.ogg ! decodebin ! glupload ! glfiltercube ! glfilterglass ! gldownload ! queue ! ffmpegcolorspace ! xvimagesink


For more info about plugins run:
$ gst-inspect-0.10 glfiltercube

Beside .ogg also other formats are supported, for example mp4.


Monday, May 10, 2010

Git

Very good tutorial about interesting Version Control System - Git by Bart Trojanowski:
http://excess.org/article/2008/07/ogre-git-tutorial/

Commands which I found very useful:
  • git clone, git fetch, git rebase,
  • git checkout, git branch, git merge
  • git stash

Friday, March 26, 2010

Application crash

Recently I had very interesting problem. There was an object which caused an application crash when it was deleted. During debugging the content of the object's destructor worked properly, but after a closing bracket application just crashed. After time consuming investigation I found out that the object was defined as global, on the stack. Then a pointer to it was passed to some method which at some point deleted this object using that pointer. Of course when the program exited it tried to destroy already destroyed object.

QObject::deleteLater() - the best way to hide bugs

The method deleteLater() is very often used to avoid application crashes. In fact in most cases it just hides the real problem! Qt provides several methods to avoid dangling pointers and control objects lifetime. For example QObject::setParent can be used or "destroyed" signal. Developers should use them and really dig to the problem, understand what is going on in their product.

Additionally it is important to remember that deleteLater() works only if a main loop (qapp.exec()) of an application is already running or is going to be started after the call. Otherwise the object won't be deleted. In some cases even if there is no memory leaks when a program is running objects might not be cleaned before the program exists. In general it is not a problem since the memory will be freed by the system. Unfortunately it is not possible for valgrind to check if this is the case what basically means that it will report many memory leaks. It is then time consuming to investigate which leaks are real.

http://doc.trolltech.com/4.6/qobject.html#details
http://doc.trolltech.com/4.6/objecttrees.html
http://doc.trolltech.com/4.6/qobject.html#dtor.QObject
http://doc.trolltech.com/4.6/qobject.html#deleteLater

Monday, March 22, 2010

Git

Extremely good presentation about Git:
http://excess.org/article/2008/07/ogre-git-tutorial/

Saturday, January 30, 2010

Declarative UI in Qt - Qml

I'm really happy to say that finally there is declarative support for UI development in Qt coming. This is what I've been waiting for. This was WPF advantage over Qt.

More details here: Declarative UI

Thursday, December 17, 2009

HTML 5, WebGL

It seems that I finally found a technology on which I want to focus mainly - HTML 5 and WebGL.

Below are some demos:

UI for WWW

So far I've been focusing mainly on desktop applications. Just few days ago I realized how easy it is to create some nice and fancy UI for web sites. Below a list of java script frameworks which I'm going to investigate:

Monday, November 2, 2009

What else is wrong with Story Points as a time unit?

There is one another point against considering a story point as a certain period of time (e.g. half a day). It is difficult to use special planning cards for a planning session because their values are like 1, 2, 3, 5, 8, 13, 20, etc. but the time in other hand is linear. So the problem is what to do if we estimate that something should take 17 days?

Sunday, October 25, 2009

Nokia Web Runtime - Simple, but powerful application

I'm going to show how to build a simple Nokia WRT based application. As an example I'm going to use an application which I wrote last evening. Here it is...



Tools

UI/UX design

Source code

How to deploy

Issues
  • options.add - doesn't work on Nokia N95
  • ui - looks completely different in Aptana Studio and Nokia N95
  • div - specifying hight of blocks in percentages doesn't really work in the Aptana Studio preview
Useful links

Thursday, October 22, 2009

Qt - floating tabs - my brand new feature from 2006

In the beginning of 2006 I was in the middle of writing a bachelor thesis with my two friends (Maciej Blomberg and Tomasz Lasko). I was mainly responsible for a design and an implementation of a user interface.

We were writing a cross-platform communicator with a text chat, a voice chat, and shared editing. Some of us wanted that every chat will be in a separate dialog and some of us that all chats will be in one dialog but in different tabs. Suddenly a brand new idea came up to my mind - floating tabs! A user was able to move tabs between dialogs and take them out which makes from them another dialog. Check the movie below...



I checked about twenty UI frameworks and none of them provided such feature. However after some time I found out that gimp had something similar, although gtk didn't provide that. After some tests and investigation I chose Qt as a UI framework for our application. It also didn't provide floating tabs so I decided to implement it by myself.

I took the latests Qt sources and started to analyze them and investigate the architecture. I didn't want to do any hacking. My goal was to make it clear, consistent with Qt design and API. Finally I found out few ways of changing Qt source codes to get that feature done. For our communicator I chose the best one. It worked great! It was amazing! I considered to send it to Trolltech, but unfortunatelly I didn't.

I think that it is better to write it now then never and additionally it seems that althought Qt has QDockWidget, it still doesn't have floating tabs. Maybe it 's not too late to contribute to Qt's source code.

If you are interested in the presented application or its source codes, feel free to write me an email.

Sunday, September 27, 2009

Scrum - Estimating Stories

Let's imagine that we have a bunch of things which we want to do. Let's call these things stories. Now imagine that we don't know exactly how to do all that things but we would like to know when we finish all of them and how much work left. We would like to correct our estimations, know more as we will go forward with finishing every next story. What we can do? We take out as much as we can from the only information which we have - the bunch of stories and our experience (if we have one).

Some of the stories are complex, some are simple but seem to require a lot of work. So which word would cover complexity and time at once? The word is effort! OK, so currently we know that we want to estimate the effort required to do the stories. But which unit we are going to use? How we will measure that, in hours, in meters? Actually it is just our guess, so this is an abstract unit. We can call it however we want, but because it is relate to stories let's call this unit just a story point.

OK, so we have kind of an abstract unit and a bunch of stories. So what we can do now is for example choose one small and one big story, and assign to them appropriately small and big amount of story points. Now we can compare other stories to them. Thanks to that we will know relative effort of the stories. When we start to do the stories we will learn how much time one story point takes us and based on that better estimate when we are going to finish all bunch.

This is just the general idea behind the story points. In the next post I'll give you more details.

Wednesday, September 23, 2009

If-Modified-Since

When using If-Modified-Since it is important to remember that milliseconds are truncated. Many people and books say that the solution is to always truncate milliseconds before storing the time. It is NOT a good solution if the server can update entities more than once per second. Look at the example scenario below:

Client:
- getFeed Time: 12:12:12:1
Server:
- First Feed Update Time: 12:12:12:4
- Return Feed, Last Updated 12:12:12 Time: 12:12:12:14
- Second Feed Update Time: 12:12:12:56
Client:
- getFeed since 12:12:12
Server:
- Return Not Modified after 12:12:12

Server compares seconds instead of milliseconds and replies Not Modified, although there was an update after returning the feed (Second Feed Update). The solution is to store lastCheckedTime in the beginning of a request processing on the server and use it as Last Updated. Than the client would ask about changes using that time.

The other soultion is to use counters instead of timestamps.

I'll exmplain it better when I find more time:).

Monday, September 21, 2009

"Nasza Klasa" User Interface and User Experience

There is a polish web site called nasza-klasa. Recently a new function was added there - Ĺšledzik. It allows users to write a short message which is then shown on a start page of her\his friends. When I saw it first time, I asked myself: "What is this!?!". It seems that there are other users who don't like it either. I took time and figured out why my reaction was like that. Especially that the idea behind that function is really good. I realized that the problem is with its place on the web site, how it is shown. It is a first thing which I see after login and it's not what I used to see and what I would like to see first. Currently users have to always scroll down first to see information which is more important for them, to start to browse the web site like they already get used to do. I suppose that the reaction would be completely different if the new function would be put in a different place.

This is a really good example how important UI\UX are.

Monday, September 14, 2009

Android game

Almost one year ago I started developing a simple game for Android. I always wanted to create a game which would look like drawn on the paper. Unfortunately I had to stop working on the game, but below you can see something working:).

Saturday, September 12, 2009

Eclipse E4 and XWT - First Steps

I've been working with wxWidgets, Qt, GTK, JFace, SWT and Windows Presentation Foundation. Now it's time to check XWT. In order to do that I've started to write my next application using that tool. So far I found only two problems. One is that preview for XWT UI doesn't work for the examples from eclipse cvs (at least on Ubuntu) and second that XWT versions of the examples doesn't want to compile (a solution is described below).

If you want to start with XWT I would suggest reading the source code of examples:
  1. Download the newest Eclipse e4
  2. Start it
  3. From main menu choose File->Import
  4. Select CVS->Projects from CVS
  5. Select Create a new repository location
  6. Paste :pserver:dev.eclipse.org:/cvsroot/eclipse to Host
  7. Set anonymous as a user
  8. Leave an empty password
  9. Select Use an existing module
  10. From the list of modules select all examples in e4->org.eclipse.e4.xwt->examples
  11. Select also e4->org.eclipse.e4.xwt->bundles->org.eclipse.e4.xwt.ui.workbench (without this bundle xwt examples don't want compile)
  12. Click Finish
To run one of examples:
  1. Start Eclipse e4
  2. Open file contacts.product from a project org.eclipse.e4.demo.contacts
  3. Choose Overview tab in a view where file was opened
  4. Click Launch an Eclipse application
Useful links:

http://www.vogella.de/blog/2009/08/18/eclipse-e4-css/
http://www.soyatec.org/xwt/trunk/org.soyatec.xwt.emf.demo/src/demo/
http://wiki.eclipse.org/E4/XWT/Running_the_demos
http://wiki.eclipse.org/E4/XWT
http://www.vogella.de/articles/EclipseE4/article.html
http://dev.eclipse.org/blogs/yvesyang/2009/01/17/xwt-getting-started/
http://dev.eclipse.org/blogs/yvesyang/2008/11/28/xwt-declarative-ui-designed-for-eclipse/
http://download.eclipse.org/e4/downloads/drops/S-0.9M5-200907101930/e4-news-M5.html

Friday, July 31, 2009

JMeter - Tests recording and sending binary files (multipart/mixed requests)

Few weeks ago I wanted to test uploading a binary file to HTTP server using JMeter. It is a very good tool, but there are some issues. Theoretically there are three ways of doing this in JMeter.

1. Creating a single request file from scratch

The hardest approach is to create a full HTTP request, containing all the headers and content of the binary file and use that file in a definition of a test case.

2. Recording a test case

JMeter allows recording traffic between a server and a client. Unfortunately for some reason a recorded http request was corrupted. There was a problem with some characters, so the server wasn't able to parse even a header of the request. I thought that the problem is in a wrong encoding. I changed it to "UTF-8" in "HTTP Request Defaults" and it started to work. The file appeared on the server. After that, I wanted to check if it works with other encoding types, it worked the same with all of them. Than I removed completely the encoding setting and it still worked. Then I removed JMeter and installed (unpacked) it again and tried without setting the encoding - it worked. It seems that setting the encoding solves the problem, but I have no idea why it still worked although I removed it. Unfortunately I didn't have time to investigate it deeper.

3. Creating a test case manually using a JMeter UI

In the JMeter UI there is a dialog which allows defining a test case. Tester is able to add a http request header paramters and attach files which will be send as a content of the http request. The problem is that there is no way to set a content type as multipart/mixed, what was required in my case.

JMeter as a proxy - binary files corrupted

During investigation I noticed that when JMeter is set as a proxy, uploaded files are somehow corrupted. It might be related to previously mentioned encoding settings. For those who want to do performance tests I think that it doesn't matter that much.

I need to mention that I didn't spend too much time to investigate the problem and I used JMeter with GUI. If someone knows better solutions, comments will be appreciated.

Besides described issues, JMeter is a really useful tool.

Saturday, June 6, 2009

Scrum Master Role

I've been working in Scrum projects about two and half years. Scrum and Agile were interesting for me since the beginning so I've been reading about it, watching how it is implemented and discussing it with friends. I thought that I got an idea and CSM training is just a mere formality. I wasn't right...

I thought that the Scrum Master role is to kind of help the Team or the Product Owner to figure out some solution for a certain problem, or even find it for them. This is the point where I misunderstood the role, I went to far. The Scrum Master responsibility is just to make sure that the Scrum is properly implemented. That's all. Scrum Master has to make sure that appropriate tasks are handled by appropriate Scrum roles, that responsibilities are divided in a Scrum way, that all Scrum tools are used when it is necessary and what is the most important that people want to use the Scrum because they understand it and found it useful. In order to achieve that the Scrum Master should react when roles don't follow the process and by asking appropriate questions and using appropriate Scrum tools find a reason and escalate a problem to an appropriate level and let it be handled by an appropriate role - this is one of the main goal of the Scrum. It means that the difficulty is to figure out questions which force people to take the responsibility and help them to find a real cause of a problem or understand the Scrum. I realized that my tendency was to make a decision which were in other roles responsibility.

It actually in a sense simplify a role, since Scrum Master doesn't have to make any decisions, doesn't have to know solutions for the Product Owner or the Team problems, he just have to take care about the Scrum - like actually the Scrum Master title says.

Recommended book: "Agile Project Management with Scrum" Ken Schwaber

Quotes

"The definition of insanity is doing the same thing over and over again and expecting different results" Albert Einstein

"A complex system that works is invariably found to have evolved from a simple system that worked. The inverse proposition also appears to be true: A complex system designed from scratch never works and cannot be made to work. You have to start over, beginning with a working simple system." John Gall's

"The best is an enemy of good"

Thursday, September 11, 2008

UI Virtualization, UI Recycling, Data Virtualization and Efficient Scrolling in WPF

Some time ago I decided to write an efficient panel in WPF. I wanted that it arranges controls inside in multiple columns and rows, loads data very fast without blocking UI, and saves memory. I didn't want to implement a completely new control from scratch.

I found only several articles about this issue:

Dan Crevier - a virtualized panel and Ben Constable - IScrollInfo implementation:
http://rhnatiuk.wordpress.com/2006/12/13/implementing-a-virtualized-panel-in-wpf/
Dr.WPF - very good information about classes used to implement the panel:
http://www.drwpf.com/blog/ItemsControlSeries/tabid/59/Default.aspx
Wired Prairie - a multithreaded data loading (PhotoScroller):
http://www.wiredprairie.us/journal/2007/04/photoscroll_the_worst_named_wp.html

Cedric Dussud's - good overview of possible optimalization approaches in WPF:
http://download.microsoft.com/download/2/d/b/2db72dcf-5ae0-445f-b709-7f34437d8b21/Scrolling_in_WPF.doc
Beatriz Costa - other useful information:
http://www.beacosta.com/blog/

Only one article describes how to do a UI recycling but unfortunately by creating a control from scratch so I was forced to figure out my own way of doing this. Below you can find the result.

To proceed you need to know sources of examples of Dan Crevier, Ben Constable and Wired Prairie (PhotoScroller).

UI Recycling, UI Virtualization and Smoothly Scrolling

In the MeassureOverride method I check the maximum number of items which can be visible at once. Then I create such number of containers and add them to the internal children list of the panel. To create them I use GenerateNext and PrepareItemContainer methods of ItemContainerGenerator. I use GenerateNext method because the generator asks ItemsControl to create an appropriate UI element representing an item so I don't have to know what is its type. Because I'm not sure how the generator is implemented inside after that I remove created items from the generator. Then during scrolling, also in MeassureOverride I fill containers (starting always from the beginning) with appropriate data using DataContext:

(children[i] as ContentPresenter).DataContext = _itemsControl.Items[firstVisibleItemIndex + i];

In order to get smoothly scrolling (per pixel) I update _trans.Y in this way:

_trans.Y = -(offset%ChildSize);

in SetVerticalOffset method.

Data Virtualization

In order to load data for visible items only, in a way which doesn't block a UI, I created DataLoader (see the PhotoScroller example). It has a list of objects which need to be fill with data (for example loaded from a hard disk). The data are loaded in LIFO (Last In, First Out) order, after loading they are removed from the list. The objects are removed from the list also when they are not visible anymore, so the DataLoader doesn't load unnecessary data. The DataLoader works in a separate thread. Objects which needs to be fill are added in the MeassureOverride method, when the DataContext is set.

This is very short description. I'm going to describe it soon in more details, with sources.

Summary

I presented here just an overview of the solution. A lot of issues, like for example a panel resizing or a synchronization between threads weren't described here yet. I'm also not sure that this solution is correct from the WPF point of view. Anyway it seems to works fine and very fast :).