PySide? 2? 6?

Currently I revisited some GUI programming for some weekends project with some friends at https://github.com/jendralhxr/uget2/. Our go-to python guy used to like guizero, but recently he is trying out tkinter and customTkinter. I have never really tried Tk and later found that customTkinter model-view-controller model is not as fluid as I experienced with Qt.

Hence, I revisited the community-official Qt-Python affairs: (saner person would just call these bindings instead)

 Thankfully, the official-official version has better naming scheme that is self-explanatony: 

But this version was said to be lagged for a while during Qt 5 term, albeit started earlier during the Qt 4 days. Company stuff, I guess.

All the projects are good with wonderful people working behind/on them. But this is what I don't really like with python people: not really considering how to pass on legacies (i.e. not quite respecting legacy code base, compatibility issues with third-party libraries, reluctance to re-study/re-write the code, and the inertial needs to keep the business going with developmental code).

I guess as end user, we can use them wisely and adapt to changes, swiftly.

what author? what email?

This paper looks indeed weird: 10.1142/S1793431120500013. The content is (kinda) okay: alternative alloy for RC cylindrical bridge pier which helps bridge by flexibly cope with seismic load. But the problem is in the list of authors. The last listed author (Nailiang Xiang) uses email address of supposedly another person (Ko Noryo).

Those two are actually the same person. It is his Japanese pseudonym. What gives

http://jendralhxr.blogspot.com/2017/10/we-all-of-us.html

I think the third part of the saga is about memories and reminiscence. We hear more voice echoes and occasional dissonant piano chords. Around the 3:00 mark, we hear the memoriiiiies. Grey did not elect to fill in the piano chords, this is not just any other pop song.

 

Compared to the older version (below), 2023's is definitely darker. It is no longer about anger, anguish, and helplessness. Death (as in void/emptiness) perhaps?



flashing latest jetpack (5.1.2 atm) for nvidia jetson xavier agx

My work pc is running the latest ubuntu jammy (22.04LTS) and NVidia has yet to release the promised Jetpack 6 and sdkmanager [supposedly] featuring ubuntu jammy for both the host and target board.

The latest jetpack currently available (5.1.2) features ubuntu focal (20.04LTS) target. They provided some docker images for the host, but the actual run-ability is questionable and we need some more workaround. Some ppl had it easy, most others struggled (here, here, and others).

Inside the docker container (host), we need to modify /etc/issue, /etc/lsb-release, /etc/os-release and /etc/apt/source.list to "pretend" as ubuntu jammy if your actual host is not actually one.

Here is my flashing/installation notes:

multidimensional array: C/C++ vs Octave/Matlab

I use these two families of programming languages quite often. I did C/C++ first then Octave/Matlab later on. The two differ in how they handle multi-directional array, especially ones more than 3-nest deep.

We know that computer memory uses (virtual?) contiguous address of memory--so by any means they are 1-dimensional. But program (and in this regard, the programming language) needs to map them somehow to fit the continuous address arrangement abstraction.

On 3-dimensional array, with C it is:

unsigned int val[2][4][3];
for (i=0; i<2; i++){
    for (j=0; j<4; j++){
        for (k=0; k<3; k++){
            printf("%d %d %d %p\n", i, j, k, &(val[i][j][k]));
        }   
    }
}

*
0 0 0 00007ff73f2dd040
0 0 1 00007ff73f2dd044
0 0 2 00007ff73f2dd048
0 1 0 00007ff73f2dd04c
0 1 1 00007ff73f2dd050
0 1 2 00007ff73f2dd054
0 2 0 00007ff73f2dd058
0 2 1 00007ff73f2dd05c
0 2 2 00007ff73f2dd060
0 3 0 00007ff73f2dd064
0 3 1 00007ff73f2dd068
0 3 2 00007ff73f2dd06c
1 0 0 00007ff73f2dd070
1 0 1 00007ff73f2dd074
1 0 2 00007ff73f2dd078
1 1 0 00007ff73f2dd07c
1 1 1 00007ff73f2dd080
1 1 2 00007ff73f2dd084
1 2 0 00007ff73f2dd088
1 2 1 00007ff73f2dd08c
1 2 2 00007ff73f2dd090
1 3 0 00007ff73f2dd094
1 3 1 00007ff73f2dd098
1 3 2 00007ff73f2dd09c

*/

See the memory address changes LSB (least significant [4] bytes, lol) based on the variable's LSB (last-shown beacon, I am making up this abbreviation).

With Octave, the story is slightly different. The two pages from the official documentation:
- https://docs.octave.org/v4.0.3/Index-Expressions.html
- https://docs.octave.org/v5.1.0/Advanced-Indexing.html
don't help much as they only give example up to only 2-dimension.

>> val= reshape(1:2*4*3, 2,4,3);
>> val =
ans(:,:,1) =
   1   3   5   7
   2   4   6   8
ans(:,:,2) =
    9   11   13   15
   10   12   14   16
ans(:,:,3) =
   17   19   21   23
   18   20   22   24

>> val(:,1,:)
ans(:,:,1) =
   1
   2
ans(:,:,2) =
    9
   10
ans(:,:,3) =
   17
   18

>> val(1,:,:)
ans =
ans(:,:,1) =
   1   3   5   7
ans(:,:,2) =
    9   11   13   15
ans(:,:,3) =
   17   19   21   23
   

See.... the first index in the element actually iterates first, i.e. the LSB now becomes MSB. It is somewhat nice to have first index as row vector/identifier and second index for the column. But what about third index? Fourth?

Well, sometimes you just have embrace the quirk.



Stages of moral development

Lawrence Kohlberg developed a model of human conscience development on مميز (mumayyiz), one's ability to perceive what's good/proper and wrong/bad.

It has been said there were three stages:

  • pre-conventional stage where right and wrong are determined based on whether something is praised or punished and where an action is chosen based on a cost/benefit, i.e. one is being pragmatic and rational---but life often doesn't encompass only materialistic behavior and both altruistic and manipulative behavior can have skewed scale due to people have different preferences/priorities;
  • conventional stage where actions recognized as good by others are considered good, one follows the mainstream and could be hiding something while retaining the conformist image. This approach is fostering herd mentality, killing creativity and self confidence, and not giving much incentive for one to contemplate on his actions;
  • post-conventional stage where actions based on one's own conscience are good, either he is enlightened or just playing god. Although such approach is needed when the current set of common morality norms/rules has yet to be specifically assigned to one's novel/unique conditions, often in such case asymmetric or lack of information persists and people just have different customs, values, cultures, habits, etc.

To the observation, these three are more of approaches rather than stages as they can happen simultaneously, i.e. conventional approach provides the general evaluation for pre-conventional approach. Although for most of the time they do agree with one another, exceptions do happen--in which we need to tread things more carefully and taking multiple/deeper perspective.

Well, at the end of the day: model is just a model. You chose what fits you best, but you still need to be open for other options (and updates).

marriage advice

Early morning, I placed a rather unscheduled phone call to a big brother.

Thank you for being there, and here back then. We are gonna visit you someday, when the dirt has settled, when the water can quench our thirst. 

We are, already, some steps forwards. Thanks to you too.

github: migrating remote from the old https to ssh

Github no longer allows HTTPS access to the repositories. SSH has been the new style since August last year.

remote: Support for password authentication was removed on August 13, 2021.

I have had an old repo which I had left since two years ago when HTTPS was still the norm there. As now I need to continue some more work on it, the usual git push ritual is no longer working as the remote was still on the HTTPS password authentication.

The way we change it so that remote points to SSH session is:

$ git remote remove origin
$ git remote add origin git@github.com:username/repo.git
$ git push --set-upstream origin main

Make sure your SSH public key is already registered up there in the cloud :)

Nanfang'ao Bridge collapse

Saw it right away. The arch/suspension bridge collapsed [more] due to the failing hanger cable. My claim is justified.

 

I guess I went to school not for nothing. Hopefully the phd is somewhat useful for the society later down the road.

A tale of two DOIs

10.1155/2013/756912 and 10.3233/SAV-2012-0736

I just happened to stumble upon these two DOIs which refer to the same document. Although the practice is not illegal by any means, it said to be deprecated (since when?).

passings

...in lieu of flowers, please consider donating in her name... to places she once were earnestly affiliated with.

Expert (?)

Expert system (the dumb) has these limitations: common sense, inspiration or intuition and flexibility to apply in the semi-relevant field. Experts (the sensible) decide based on their overall view of the occurred problem, but expert system has not enough information. Experts know their lack of knowledge and the limits of their information in dealing with new problems, but expert systems have narrow knowledge domain and just work when they are developed for specific or very specific problems. (source)

Unfortunately, off-the-shelf education can often make human just an expert system. The actual learning experiences: knowing what works and what doesn't, how and why, conceptualizing concepts across different phenomena; that make human an actual expert.

jacks of the trades: vehicle edition

Japan is quite a fascinating places when it comes to cars. The country has developed its automotive industry with quite a unique identity after WW2 but still likes the global "style" of automobile. Within the country, the are also subcultures associated with particular group of people, e.g. bosozoku, ricer, etc.

The Japanese consumers have indeed learnt a thing or two about cars when it comes down to pragmaticism of car ownership. Typical car ownership scenario in Japan involves family of 3 with one 4-seater kei or 5-seater compact hatchback; or family of 4/5 with one 7-seater (usually wagon) and a kei.

But, farmers, with ample subsidy from local government to run their business, regulated [high] price of agricultural produce, extended family living together within the same land plot, and relatively cheaper living cost in rural areas; have some spare change and purchasing power. And when they go for cars, oh boy, they GO!

This morning, I realized a farmer family in my town has five cars in their open-layout garage: just a roof with plastered floor. Those five cars are: a Subaru SUV,  a BMW station wagon, a Daihatsu kei, a Nissan kei truck, and a Mazda sedan.

Later I noticed that the Subaru SUV is no longer there, now there is a Mazda SUV.

The immediate neighbor has a Lexus, a Toyota wagon, and three keis. And the next neighbor collects Porsches, and drives quite a VW. Oh boy.

This neighbor just got a BMW replacing the VW for the daily.

 

migrating to a smaller SSD from larger harddrive with GPT partitioning

 A friend recently purchased an SSD (Crucial CT240BX500SSD1) to replace the now-getting-slower HDD (WDC WD5000LPCX)in his laptop. The SSD is smaller so simple dd won't like like what I did previously. Thankfully the old drive was not full and we can cram the content in.

The laptop has optical drive bay which I swapped with 2.5" drive caddy so we can use both the old and new drive together.

I went with FossaPup64 as it fits the only flashdrive within my grasp (1 GB) today. The current version of cfdisk now does support EFI beautifully, we can just mimic the partition table from the old drive, given that we still have the EFI partition, a reserved partition for the recovery mode,and Windows system partition.

Disk: /dev/sda (the new SSD)
Size: 223.58 GiB, 240057409536 bytes, 468862128 sectors
Label: gpt, identifier: 4AFD6168-865F-4702-BD2F-ADF7B40C7458

Device          Start         End     Sectors     Size Type
/dev/sda1        2048      534527      532480     260M EFI System           
/dev/sda2      534528      567295       32768      16M Microsoft reserved
/dev/sda3      567296   468862094   468294799   223.3G Microsoft basic data

Disk: /dev/sdb (the old HDD)
Size: 465.78 GiB, 500107862016 bytes, 976773168 sectors
Label: gpt, identifier: 1C7B31D6-E6ED-4F17-B1A5-F3CA5D141DB0

Device         Start       End   Sectors   Size Type
/dev/sdb1       2048    534527    532480   260M EFI System                  
/dev/sdb2     534528    567295     32768    16M Microsoft reserved
/dev/sdb3     567296 974725119 974157824 464.5G Microsoft basic data
/dev/sdb4  974725120 976773119   2048000  1000M Windows recovery environment

mkfs.ntfs -f /dev/sda3
mount -t ntfs-3g /dev/sda3 /mnt/sda3
mount -t ntfs /dev/sdb3 /mnt/sdb3 (so as not to accidentally delete things)
rsync -rtvu /mnt/sdb3 /mnt/sda3

The business is then about reinitializing the loaders in the boot/system partition with bcdedit business. Then, profit!

A man of birds

If only more professors share his perspective on scientific archiving. http://shankarraman.in/2021/03/31/why-i-will-not-review-or-write-for-elsevier-wiley-and-other-commercial-scientific-journals/

My take on this, knowing that sci-hub has already  had such broad impact on scientific dissemination and it won't go anywhere anytime soon, there are some things we can do [prolly] right away to sort things out, harmonizing the need of academia and the openness of knowledge:

  • entrust articles archiving to public libraries, they know how to index things,
  • article processing fees go to paying those librarians (just add a floor to the amount so that if the journals aren't very popular, those librarians can still get by),
  • hire server space from the likes of Google, just like porn sites do,
  • stop making citation counts (IF, h-index, CI, etc) as a measure of how capable a person is in their field; just do an actual interview,
  • start making friends in the academia, exchange emails, do actual discussions!

Academia should realize that scientific reputation goes much more beyond citation counting (it probably tells a bit about the article's in-site readership though, but not much more).

Recovery story

I-35W Mississippi River bridge

After 40 years of a faithful service, she collapsed due to some undersized gusset not being able to bear the increasing load.

 

I-35W Saint Anthony Falls Bridge 

Then the replacement is a well-loved and praised bridge.


Such a story.

Forgot what I was doing

But most likely that numpy array works so inefficiently compared to item/itemset on opencv-python, here


 

A practicioner's view

Bridge maintenance and safety: A practicioner's view

C. Seim is one hell of a guy. :) His paper (talk?) talked about how bridge maintenance progresses from analyses on primary effects (static loading, force balance, material properties, etc.; all that is incorporated into bridge design); to secondary effects (dynamic loading properties, time-dependent [finite element] analysis of the members; towards tertiary effects (material behavior to temperature, resistance to corrosion, bearing durability, the list goes on)

 I have not listed any references, as these are my thoughts alone, based on my own experiences.

That's one smug remarks from him, he deserved it.

python opencv VideoWriter results in invalid video file

Little did I know that OpenCV's VideoWriter could not handle saving into oddball-frame-sized video files. Python's not so verbose output doesn't help at all. Your program will still run fine like nothing wrong is happening, in the end it produces not-supposed-to-be file size like 578 kB or sth.

I bumped into similar SO articles [1, 2] which mentioned the case. I confirmed that VideoWriter works nicely when the frame dimensions (both height and width) is multiple of 8.

I am just so bad with farewells

I, indeed, am.