Showing posts with label something isn't quite right. Show all posts
Showing posts with label something isn't quite right. Show all posts

PNG what?

Deceptively put PNG header over some video stream. Some ppl took advantage of this to upload their large files to some popular social media sites (which keep PNG files).

 

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 still use them, wisely and adapt to changes, swiftly.

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).

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?).

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.

 

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.

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.

openezx

openezx.org used to be a place to share things development of EZX phones. The project was active mostly from 2004 to 2008. Went under in 2011/2012, just to be archived on Github and Open Source Mobile Communication Consortium earlier this year.

The original openezx.org now is a lesbian porn site. D'oh. The time of registration is somewhat close to the date the Github and OSMCOM went up.

pidof

I am still doing
kill `pidof <some thing>`
instead of pkill <the thing>

Am I old shool already?

4 days: JRM

DOI:10.20965/jrm.2019.p0671

[Received September 19, 2019; accepted September 22, 2019]
That. was. quick.

academia is skwd in many ways

Some reading for food for thought: Renewal model in academic knowledge systems 
The cited papers in the paper are also worth following. 

 This is why things like sci-hub is worth keeping: keep academic knowledge open (at least monetarily: no paywall), one-layered (a bit anarchist you might say), and keeping things identifiable.

I am not saying that academic publishing contributes nothing to the academic knowledge system itself, but everyone can actually learn to establish their academic publishing-indexing service themselves for their academic materials. There shall be no thing such as publish or perish, it should be publish for greater good.

fvcked up

Life lived up just for the sake of conformism is just sad.

this

Building LinuxCNC

LinuxCNC (formerly emc, and emc2) is a great tool to control your CNC controller, in my case a ST-V3.

Documentation on building the software is here, but it barely tells the whole dependency list and the automated dependency checker script simply wouldn't run on my Ubuntu 16.04 /LinuxMint 18.3 machine.

So far, here's it is for you apt-get install
autoconf
libmodbus-dev
yapps2
libxenomai
intltool
libtk-img
tclx
libreadline6-dev
libxmu-headers
libxmu-dev
tcl-dev
tk8.6-dev
python3-tk
python-tk


Go to the source directory and invoke:
./configure --with-realtime=uspace

Should've read these first:
https://forum.linuxcnc.org/9-installing-linuxcnc/32193-complete-how-to-linux-mint-18-1-32-64-rtai-or-preempt-with-rip-install-or-debhttps://forum.linuxcnc.org/9-installing-linuxcnc/32193-complete-how-to-linux-mint-18-1-32-64-rtai-or-preempt-with-rip-install-or-deb
https://forum.linuxcnc.org/9-installing-linuxcnc/33521-building-linuxcnc-dev-on-ubuntu-16-04-preempt-rt-kernel

Ikigai is (even) cruel

Ikigai is occupation-centric, hands down.

A mother might say that her reason to live is to watch/nurture/care her kid growing up. Well, she loves the cause (the kid); she may be either a good or bad parent; in the big picture, the world might not need that particular kid; and parenting costs bunch of money, time, energy, understanding, patience: all kind of resources, in short.

So, parenting is either mere love or passion. But I will take "my kid is my reason to keep on living" as wholly valid reason--not an excuse--to live your life.

Ikigai isn't even complete

You perhaps once stumbled upon this Venn diagram portraying Ikigai: "reason for being", "purpose of life", "reason to live", or whatchamacallit raison d'être. The word is represented by the character (生) which means disciple, livelihood, potential, unripe, or things along this line.


Image result for ikigai

The "purpose" is divided into four dimensions: whether one is adept at it, whether one is paid to do the task, whether the thing is something others actually need (hence beneficial), and whether one is enjoying it. But somehow, the depiction of this "purpose" using this Venn diagram kinda incomplete albeit you can still dwelve deep into it, make an essay out of it, and give TED-style talks on it. Still, technically the diagram with four circles here only features fourteen sections (including negative value for all factors), while permutations of four factors yield sixteen different values in total. So where are the remaining two?




This oval-ey diagram is definitely better. But two sections are left unexplained: "good job" (what you love and earns money, but you aren't necessarily good at it nor others need you to do it) and "contribution" (what you are good at for precisely what others need, but you kinda loathe it and doesn't get paid). The first definitely sounds wasted and the later sounds like one is being "used".

So what may these two be in real life?
  • prostitution is a good job: screw, hump, get paid; you don't need to be a proper porn star and definitely doing solicit sexual act isn't socially desirable conduct. If you are getting good at it, it is now either your passion or profession (or both, which is your now self-imposed ikigai). If somehow society accepts it, it is now your ikigai imposed by others, unfortunately, by being a prostitute.
  • being altruistic as a matter of contribution: do good samaritan out of good will, you are quite adept at it, then you are getting tired, experiencing burnout, later running out of resources (time, energy, money, etc) to do so. Your way out being this miserable is either to start to love it for good or get some money out of it (which makes you an entrepreneur at this stage)
  • entrepreneur: you aren't necessarily good at it but people needs you, you don't necessarily love it but somehow you get paid to continue doing it. So how you manage to do it? Let others with proper passion on it to do so and use others' resource to do your case, you connects will and energy, resource and passion, talent and demand.

So what's the take on this, or at least, my take on this?
Your raison d'être doesn't have to be wholesome and "complete" with love, money, talent, and acceptance of others at once. You can always define it yourself, being content with the moment, but always open up your mind for changes you are working on for the better or changes simply imposed by constraints, as things are often not quite right.

Kudos to guys at dreamstime/Toronto Star Graphic, Mark Winn, Dan Buettner, David McCandles for the wonderful graphs.