Cloning multiple git repos
For example I have clones of
Linus Torvalds's repo:
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
Block Maintainer, Jens Axboe's repo:
git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-2.6-block.git
...
If I do individual clones of all these repositories, it downloads and maintains duplicate copies of same objects wasting disk space, and network bandwidth.
git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
git clone git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-2.6-block.git
So I was looking for a way to share the common objects so that duplicate objects wont waste disk and network. And no surprise, git has a way to do that. Just that I was unaware of a simple option, "--reference".
git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
git clone --reference linux-2.6/ git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-2.6-block.git
Difference between cloning Jens' git with and without --reference to Linus's git.
# git clone git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-2.6-block.git
Initialized empty Git repository in /home/knikanth/labs-sw/linus/linux-2.6-block/.git/
remote: Counting objects: 1180249, done.
remote: Compressing objects: 100% (295444/295444), done.
remote: Total 1180249 (delta 984716), reused 1073684 (delta 878311)
Receiving objects: 100% (1180249/1180249), 289.32 MiB | 496 KiB/s, done.
Resolving deltas: 100% (984716/984716), done.
Checking out files: 100% (27842/27842), done.
# du -sh linux-2.6-block/
714M linux-2.6-block/
# git clone --reference linux-2.6/ git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-2.6-block.git
Initialized empty Git repository in /home/knikanth/labs-sw/linus/linux-2.6-block/.git/
remote: Counting objects: 111061, done.
remote: Compressing objects: 100% (19021/19021), done.
remote: Total 100463 (delta 84138), reused 95679 (delta 79959)
Receiving objects: 100% (100463/100463), 23.21 MiB | 1209 KiB/s, done.
Resolving deltas: 100% (84138/84138), completed with 8189 local objects.
Checking out files: 100% (27842/27842), done.
# du -sh linux-2.6-block/
468M linux-2.6-block/
--reference automatically sets up .git/objects/info/alternates to obtain objects from the reference repository. Now I wonder whether it is possible to have circular references, multiple references, etc.. The plural file name, "alternates" suggests it should be possible, but "git clone" ignores multiple --reference on the command line!
BTW git uses SHA-1 digests to identify objects. I wonder what is the chance of a SHA-1 collision and how git handles it? The SHA-1 digest has 40 Hex-digits == 160 bits.. So at most, only 2160 objects are possible. :-)
Imagen en java con Swing
img1 = new ImageIcon(getClass().getResource(“/Imagenes/1.jpg”)).getImage();
Power Management in openSUSE and SLE11
Power Management in openSUSE and SLE11
Wanna know what we're doing to make your laptop run longer? Have a look at the new wiki page I have just finished. It talks about three major topics:
- What is done
- What can be done better
- What is not done
It might give you some hints to tease even more out of your battery runtime.
Discussion welcome!
Kolab on its way back
After a long time, with lots of not visible activity Kolab, the groupware server build with many known open source components, is slowly getting back into openSUSE. For a year or so it was not possible to use Kolab on openSUSE versions newer than 10.3. That was due to the move from openldap 2.3 to 2.4. The latter does no longer support slurpd as replication mechanism, but uses syncrepl instead. Hence, kolab had to be extended to be able to work with new replication protocol. After that the way the webclient horde was packaged, changed from (to make a long story short) 1 big package, to many small packages. This in preparation for horde4. Today, the following message was posted to the kolab-user e-maillist:
after a lot of tests on a virtual system I finally upgraded my
productive Kolab server to 2.2.1 with the Suse packages.
Now you should now, that kolab-2.2.1 was released about month in April 2009. Although we (Marcus Huewe, Alar Sing, and the author of this article) are not there yet, seeing this message means a lot to us. We’re making good process!
Презентации
SlideShare
Продолжение работы со списками
А теперь код. Он похож на предыдущей, только вместо pLast и prev используем pFirst и next:
typedef struct S2{int a; int b; S2* next;} S2_t;
// одно связанный список
S2_t *p2=0, *pLast2=0, *pFirst=0;
//построение списка
for(int i=0;i<10;++i)
{
p2=(S2_t *)malloc(sizeof(S2_t));
memset(p2,0,sizeof(S2_t));
p2->a=i;
p2->b=i+10;
if(pLast2)
pLast2->next=p2;
else
pFirst=p2;
pLast2=p2;
}
//работа со списком
p2=pFirst;
while(p2){
printf("a: %d b: %d\n", p2->a,p2->b);
p2=p2->next;
}
//Удаляем четные элементы
p2=pFirst;
S2_t* p22=pFirst;
while(p2){
if(!(p2->a&1)){
if(p2==pFirst){
p22=p2->next;
pFirst=p22;
free(p2);
p2=p22;
}else{
p22->next=p2->next;
free(p2);
p2=p22->next;
}
}else{
p22=p2;
p2=p2->next;
}
}
printf("After removing:\n");
p2=pFirst;
while(p2){
printf("a: %d b: %d\n", p2->a,p2->b);
p2=p2->next;
}
//удаление списка
p2=pFirst;
while(p2){
pFirst=p2->next;
free(p2);
p2=pFirst;
}
Работа с динамическими списками
Структура может выглядеть так:
typedef struct S1{int a; int b; S1* prev;} S1_t;
- имеет указатель на предыдущую
typedef struct S2{int a; int b; S2* next;} S2_t;
- имеет указатель на последующую
Построим для первой структуры список из 10 элементов:
printf("first:\n");
// односвязанный список
S1_t *p1=0, *pLast=0;
//построение списка
for(int i=0;i<10;++i)
{
p1=(S1_t *)malloc(sizeof(S1_t));
memset(p1,0,sizeof(S1_t));
p1->a=i;
p1->b=i+10;
if(pLast)
p1->prev=pLast;
pLast=p1;
}
Выведем список на экран:
p1=pLast;
while(p1){
printf("a: %d b: %d\n", p1->a,p1->b);
p1=p1->prev;
}
Удалим из списка структуры, которые содержат первое нулевое поле либо четное:
p1=pLast;
S1_t* p11=pLast;
while(p1){
if(!(p1->a&1)){
if(p1==pLast){
p11=p1->prev;
pLast=p11;
free(p1);
p1=p11;
}else{
p11->prev=p1->prev;
free(p1);
p1=p11->prev;
}
}else{
p11=p1;
p1=p1->prev;
}
}
После работы надо освободить память:
p1=pLast;
while(p1){
pLast=p1->prev;
free(p1);
p1=pLast;
}
В начале работы со списком я всегда устанавливаю указатель p, с которым работаю, в начало списка.
При работе с одно связанным списком главное хранить указатель на последний элемент списка, если в списке указатели в структурах указывают с последующей на предыдущую структуры.
И надо хранить указатель на первую структуру в списке, если предыдущая структура хранит указатель на последующую.
В следующем посте я приведу пример для такой структуры.
Vacation / Trip report
Friday (24th april): Roadtrip starting at 10:00 in Nuernberg ... We drove straight to Hamburg as the first days stop. Spent the evening at the Aussenalster, lounging at a jetty cafe and enjoying the setting sun over the water. Tried not to get run over by Joggers and Bikers. Hotel was a nice one in St Georg, except I could listen to everything happen in the neighbouring rooms and the staircase.
Saturday: Walked around the Binnenalster and the City. Met by chance my brother who lives in Hamburg. Met an old study friend of Edith and spent more time walking around and looking at St Pauli / Landungsbruecken, Ferries, Oevelgoenne and Blankenese. Then we drove on towards Luebeck. Luebeck was quieter and emptier then we imagined (or we did not really find the cool places). So Steakhouse first, and Irish Pub across the nice Hotel (Alter Speicher) later on.
Sunday: Visited the Guenter Grass House and the Figurenmuseum (funny enough, lots of hand puppets from all over the world ... but no Muppets (r).) ... Then drove on towards Denmark, where we spent the night in the even quieter costal town Fredericia.
Denmark smelled strongly of Guelle everywhere, farmers have been busy getting it to the fields apparently.
Monday: Drove on to visit Lindholm Hoje, a Viking grave site and after walking around it a bit, drove on the Ålbæk, near the northern most tip of Denmark. We had rented a vacation flat for 4 nights at a farmers place, quiet and nice. Lots of drinking and chatting.
Tuesday: Visited Skagen withs its art museum, and the tip of denmark in Grenen, where Skagerrak (Nordsee aka North Sea) and Kattegat (Ostsee aka Baltic Sea) meet each other, and the
a large aquarium in Hirthals.
Wednesday: A walk through the woods.
Thursday: More sightseeing around the area, visited to only left-as-is wandering dune Råbjerg Mile, various beaches on both the North and Baltic Sea. Enjoyed local fish in the evening.
Friday: Drove (mostly with a Ferry from Fredrikshaven) to Goeteborg. Spent the afternoon walking around in Goeteborg, drinking beer and watching the local girls who obviously are accustomed to walk around in shorts and tshirts at 10 degree celsius. Nice hotel called Vasa.
Saturday: Drove through south sweden and denmark to Gedser and then ferried over to Rostock. Found a nice hotel in Warnemuende and relaxed with beach walking and beer/wine.
Sunday: More refreshing beach walking, saying good by to the sea... Drove southwards, with a lunch stop in Potsdam to visit Sanssouci, then onwards back to Nuernberg.
Monday-Wednesday: Washing, helping Rasmus with his home network and getting barbeque as thanks, fixing libgphoto2...
Images are here.
Tomboy 0.15.0 Development Release Brings New Features and Fixes, Even For 0.14.x Users!
- New NoteDirectoryWatcher add-in supports editing of your note files in other programs (think Dropbox).
- The first of many improvements to start-up time, by not rebuilding the add-in registry every time Tomboy starts. This also fixes start-up bugs on a few distributions, including Windows.
- Random start-up crash in GConf fixed.
- Many improvements to the printing add-in.
- Better note and URL auto-linking.
- Console output on Windows command prompts now works correctly, for better error reporting.
See our NEWS file for information on some usability improvements, better GMime support, Mono.Addins upgrade on Windows, and more.
Please visit our download page for source tarballs, Windows installers, and Mac disk images. Note that the Windows installer is still a work-in-progress, and for now you should always uninstall the previous version of Tomboy before installing a new one.
NoteDirectoryWatcher Add-in Available for 0.14.x Users on Linux, Windows, and Mac!
For years, users in various situations have tried setting up ad-hoc note synchronization solutions by syncing their ~/.tomboy directory between computers. This has never been supported, and because Tomboy would not notice outside changes to note files while it was running, could easily lead to data loss and confusion. Thanks to Mike Fletcher, we are one step closer to supporting this group of users. With this add-in enabled, if another process modifies your note files, Tomboy will notice the change and update appropriately (after a short delay).
The great thing about add-ins is that we can make this feature available for download to all of our 0.14.x users. Source is in git, but you can download this cross-platform binary, drop it in ~/.tomboy/addins/ , enable it in your preferences and try it out! As this is our first release of this feature, bugs are expected, so please report any problems you experience. :-)
Please remember that sharing your ~/.tomboy is still not recommended, because it contains a bunch of add-in metadata that should not be shared unless you have identical set-ups on each system. In an upcoming version of Tomboy, we will be getting rid of ~/.tomboy and following the FreeDesktop XDG specification, so note data and add-in configuration will be stored separately. If you care about our migration from ~/.tomboy to XDG directories, please read my proposal on the bug and leave your comments.
Upcoming Releases
"Droplet", Copyright Ellery Armstrong, Milk Teeth Photography, Used With Permission
Some of the fixes in 0.15.0 will be coming to our next 0.14.x maintenance release: 0.14.2. Expect news about this in a few days.
Our next development release, 0.15.1, should include some new features in note synchronization, better Windows support when multiple GTK+ apps are installed, and the typical assortment of fixes and improvements. We are planning to have a bug day soon where we'll milestone a lot of our outstanding bugs. I'll let you know when we have a date. :-)
Lastly, after the last Tomboy planning meeting, we developed a roadmap for our next stable release, which, pending a few specific improvements, will be versioned 1.0. I'll be writing more about this in the future, but for now, feel free to check it out, and if you are interested in helping, toss your name in there!
This post brought to you by the Tomboy Blogposter add-in.

