Feeds:
Posts
Comments

Imagine you ended up in a git repository which has submodules, and those submodules have submodules, and so on … and you did something and suddenly those things do not synchronize as expected.

The magic command to do here is:

git submodule foreach --recursive "git submodule sync"

Followed by any other git submodule command, such as:

git submodule update --init --recursive

Riddle

roses

After long fights and missing documentation, finally found it out how to write text using ruby on a png file.

    img = Cairo::ImageSurface.from_png('input.png')
    cr = Cairo::Context.new(img)

    cr.select_font_face "Arial", Cairo::FONT_SLANT_NORMAL,
                        Cairo::FONT_WEIGHT_NORMAL
    cr.set_font_size 13
    cr.move_to 20, 30
    cr.show_text "Lorem ipsum"
    cr.target.write_to_png("output-file.png")

When you start snapcraft and the build stage takes a lot of time, there is a chance that your compiler died because of lack of memory (initially snapcraft delivers 2G for your VM, some projects may require more memory to build).

Do the following

snapcraft clean

SNAPCRAFT_BUILD_ENVIRONMENT_MEMORY=8G snapcraft

This will tell snapcraft to increase the memory to 8GB for the VM before starting the build.

Imagine that you want to put a checkbox in a QML TableView, where you have a model of some objects:

class SomeObject : public QObject
{
    Q_OBJECT
    Q_PROPERTY(bool visible 
    		READ isVisible 
    		WRITE setVisible 
    		NOTIFY visibleChanged)

    // ... whatever more you need
};

Then create something like this in your QML:

TableView {
    id: root
    model: whatever_gives_you_a_list_of_some_objects
    TableViewColumn {
        title: qsTr('')
        role: "visible"
        delegate: CheckBox {
            checked: { styleData.value }
            onClicked: {
                modelData.visible = checked
            }
        }
    }
    width: 32
}

Hope it helps someone one day 🙂 Or if not, I might come back here to read it again if I might need it

Todays’ git nightmare

Let’s suppose the followings:

  • you have a big project, which has several submodules, which are of course shared between other big projects, with people working on them continuously.
  • your current task requires modifications to some submodules, and also your project files too
  • You modify your project files, the submodule files and forget the all eternal rule to not to commit anything inside a submodule, unless you want to go down the path of endless headscratching. So you have committed in the submodule.
  • But you did not manage to push it, git was not happy about something, so you check out the submodule’s repository, and commit/push your changes there.
  • And you also push the changes to the project files…

Here is where nightmare modus in git is switched on.

Now, once your commit goes up to the cloud, containing the reference to your local submodule commit nothing will work on the system for anyone else but you.

The only way I have found this to be fixable is: replace the hex id of the git commit of the submodule that represents your changes in all files in the .git directory of your project (just search and replace)  with the hex id from the submodule’s own directory and commit and push again your project.

I have just found the following app in one of my university archives backups’ backup…

Seems I was pretty fond of geometry those days …

grphs

Consists of: 64990 bytes of Turbo Pascal code, some graphic files and an extra mouse handling unit (Yes, seemingly I had time those days).

<off_topic>

I was sort of disappointed by this movie due to the simple fact that … they have built up the amazing world of Ninjago in the seven seasons of the cartoons, with personalities with whom you can identify and with whom you can connect, like or hate them, enticing background stories, there were real inter-personal conflicts, true character development, intrigues, fight between good and evil … And they have left this all out from the movie… The only thing that made is was an over clichéd Father-Son conflict.

It’s like since Star Wars came out 30+ years ago, the epic story writers can’t come up with anything different/original even when they have such a rich world as the one the Ninjago show is supposed to be happening in …

All that was left out, and the rootless Lego Power Ranger Ninjas kicked in. I know that it was meant to be for kids (but for heavens’ sake, all the 7 seasons were meant for them too and kids have had no problems understanding the fundamentals of the world of Ninjago till now) but it really would have been great to feel that this movie is happening in the world we (they) have got used to and WERE EXPECTING.

What happened to the first Spinjitzu Master? The Serpentines, Nadakhan, Nindroids and all the characters struggling with everyday lego life? Yes, kids understood that Ninjas need money in order to have a “base”, it is just so … lame to put them in huge robots instantly out of the closet.

And Koko? For heavens’ sake… What’s wrong with Misako?

</off_topic>

After the worrying signs (for more details see: https://fritzone.wordpress.com/2016/11/30/google-just-redlisted-my-netscanner/) today I have discovered that my most popular open source tool which allowed scanning of local networks (having around 90000 downloads from sourceforge) has been finally purged by sourceforge.

So if you try to access https://sourceforge.net/projects/netscan/ it will just give you the blank stare of an absent minded office droid.

It would have been nice from sourceforge at least an explanatory letter of why it happened, however I don’t expect anything like that.

my_tombstone

For upcoming projects… such as netscan 0.2 (see screenshot below) I will make sure to choose a different open source host.

Screenshot 2017-08-10 13.53.15

I have just recently rediscovered the source code of a text editor application I wrote … long time ago as a university project (possibly in 1999 or even before). It is sort of the resemblance of my favourite then editor, Borlands’ Turbo Pascals’ IDE. Just a hint to see how it looks:

te1

I was thinking that vow, today I’d really like to have it in my Linux console, since it’s basically a … text mode application. So I tried to read its’ source code… and that’s when it struck me that this application will never make on Linux, since … it uses direct memory addressing, such as:

type  scrtype=array[1..2000] of word;
var screen:scrtype absolute $B800:0;

and it’s full with assembly instructions and direct memory access, in the form of:

procedure flip;ASSEMBLER;
asm
 push ds
 mov ax, 0b800h
 mov es, ax
 mov ax, Tseg
 mov ds, ax
 xor si, si
 xor di, di
 mov cx, 1000
 db 0F3h, 066h, 0A5h
 pop ds
end;

Down even to the level of hardcoding the rep movs WORD PTR es:[edi],WORD PTR ds:[esi] instruction into hexa bytes since the builtin assembler of Turbo Pascal was choking on this instructions and did not compile it.

Little did I know in those days, about writing portable applications … what the heck, we didn’t even had a Linux computer at our university.

Today the times have changed a bit. I write all my applications in standard compliant C++, and test it on multiple systems, on various compilers and OS’s. That is the only way that ensures maximum portability and maintainability.