lseek()

If you ever wonder how to use basic open, seek, read/write operations on native file descriptor (in Linux), here's a brief example. It should give general overview on how it's done.
I was actually not quite sure how to lseek() before writing this post myself.

#include <unistd.h>
#include <fcntl.h>


int fd;
int main(){
    fd = open("foo",O_WRONLY | O_CREAT, S_IRWXU);
    lseek(fd, 0, SEEK_END);
    write(fd,"abc\n",4);
    }


See, the offset and whence value can be played around. I can do {SEEK_SET, SEEK_END} to get exactly the same result. :D

Anyway, it's nice to see OR operation on enum values.

IBM 7094 Daisy Bell

It was dubbed "first computer to sing"; a bunch of guys hacked into IBM 7094 to make it sing (or make some mass-understandable beeps in this regards). It probably involved some degree of speech and music synth. The song was Daisy Bell (A Bicycle Built for Two) written in 1892 by Harry Dacre.



Daisy, Daisy,
Give me your answer do!
I'm half crazy,
All for the love of you!
It won't be a stylish marriage,
I can't afford a carriage
But you'll look sweet upon the seat
Of a bicycle made for two.
...
  Harry, Harry, here is my answer true
  You're half crazy if you think that that will do
  If you can't afford a carriage
  There won't be any marriage
  Cause I'll be switched if I'll get hitched
  On a bicycle built for two


I wish she's willing to be my stoker.

Hamradio HT

One of my dream was having all-you-can-have-it portable transciever device. So these good guys made it. 50-1000 MHz sounds like a broad choice of bands you can play with.
https://github.com/testaco/whitebox

You can download the presentation to Algoram: Hamcation here
http://algoram.com/presentations/Hamcation2015.pdf



_____
I like the way they refer to Handy-talky; I've always been a Motorola fans.

Zenwalk 7.9.3; memoirs of a slacker

I've been on Slackware and many of its derivatives for quite some time already. I just take them for granted and use those distros with it-just-works approach with Salix (64-bit) these days.

Until an email came several days ago:
Hi,
An improved and up to date version of Zenwalk 64 : Zenwalk 7.9.3 is ready. http://download.zenwalk.org/x86_64/7.9.3/
This unofficial release is stable (at least as stable as any official release, and it is maintained via the current repository).
It could be released as a beta or even "RC 8.0", but I prefer to wait for Slackware 14.2.


I cried like a little girl.

I've used Zenwalk when it was still exclusively build for 32-bit boxes (4.8 to 7.2, if I recall it right). Then I moved to Salix because I'd like to run 64-bit operating system on my old Aspire 4720z laptop, at that time Zenwalk didn't support 64-bit CPU; it was the time of Slackware 13.0 or 13.1. I experienced tgz -> tlz -> txz transition and ext4 failing.

I'd liked Zenwalk better than Salix. This is just too much for me at the moment.

I downloaded Zenwalk-current ISO already, yet I am not sure if I'll use it in any of my recent box.
______
PS: I think I am in love

Soundcloud: ze-consciencia

This guy is just great: https://soundcloud.com/ze-consciencia

Significant Other

I'd been arguing with my sister about what love is. I won pretty much by saying that love is "giving other people enough power to destroy you; and hoping them not to do so". I made an example how a mother taught her daughter how to cook--how to handle knife; trusting the little kid not to stab her someday in the future.

This is pretty much how people with huge chunk of responsibilities do this, or at least, that's how two of distinguished professors in my university have it. Although both of them belong to the same faculty, the two didn't take exactly the same approach to the technology they're developing. They didn't rather different focus in researches though they work together in (fewer) other projects.

And here's the good part:
0. they love each other,
1. they get credit for the work they'd done personally (or with their respective research group),
2. they get credit for their spouse's work--for being a supportive figure (while not being directly related to the work),
3. they are referred on citation references in entries that are similar (that they share family name); more citations!
4. they have enough power to outwit their spouse's work--yet at this point it refers back to point (2).

Damn, that's just uber!

____
My significant other will surely have more than enough power to end my life, anytime she desires so.

Linux: SCIM on Slackware64 (it is Salix64, anyway)

As I am going to learn different cultures with different charsets, I am going to need trustworthy input method for different for different charsets: Latin (English), Arabic, Japanese (Hiragana, Katakana and Kanji). I'll explain certain things for each language later in another posts, I promise.

There are various input methods available for Linux, yet I'll just stick with Slackware's good old default: SCIM. SCIM is official package in Slackware64. So installing the packages is pretty classic.

#installpkg ./slackware64/x/scim*.txz

Also make sure you are using UTF8-capable locale. Check /etc/profile.d/lang.sh for something like this:
export LANG=en_US.utf8

Enable SCIM script(s) in /etc/profile.d/ too
chmod +x /etc/profile.d/scim*
--anyway, is the anyone out there using csh in their daily mortal life?

OKI COREFIDO C301dn on Linux

My lab has got some (network) printers from OKI for lab members to print their works. The model students can use are OKI COREFIDO C301dn. Most guys here running Windows 7 or 8 (just like anywhere else), and getting it running from my Slacktop (it's Salix 14.1) is some extra work.

A quick lookup at OpenPrinting redirects me to foo2hiperc, which provides PostScript-compatible hiperc driver wrapper (which I don't know what this hiperc thing is).

You just get to download the package from http://foo2zjs.rkkda.com/foo2zjs.tar.gz,
untar
$ make
$ getweb 301
# make install
add the printer from your cups manager using the PPD given by foo2hiperc.
--I am still running cups 1.5.4  

________
Also, a little cite here:
All important desktop applications (GTK/GNOME, Qt/KDE, LibreOffice/OpenOffice.org, Firefox, Thunderbird, ...) send print jobs in PDF and not in PostScript any more by default. In addition, a complete CUPS filter chain to process print jobs in PDF is available and used.
 wow!

A gift: a mouse

E-3LUE Fresco Pro (EMS 107)



Sean gave me this, a Japanese mouse (e-blue) which he bought in Indonesia, then I brought it back to Japan, lol.

Though nowadays, I use my cheapo wired mouse more often.

Anyway, thank you very much.

Synaptics TouchPad Toggle

My new work laptop (Dell Latitude 3540) doesn't toggle touchpad on/off via hardware level, the key combination (Fn+F3) is merely XF86TouchpadToggle which XFCE [still at the moment] doesn't know what to do with.

I made a simple synaptics-toggle script:
if [ -f /tmp/synaptics-touchpadoff ]
then
    synclient TouchPadOff=0;
    rm /tmp/synaptics-touchpadoff;
else
    synclient TouchPadOff=1;
    touch /tmp/synaptics-touchpadoff;
fi


and mapped the script to XFCE keyboard binding utility. 

Upon finding ArchLinux more elegant solution here, I had to admit I was a bit ashamed.


Bisexuality


Recently my dear sister asked me about my view on bisexuality. As an electrical (computer) engineer [graduate], I put a simple analogy between sexual intercourse and power line plug-socket contact. Pretty dumb idea, yet I still had to make my mind up before posting this blog post days later on.

Plug is male: masculine, protruding, dominant, extrusive, yang, first.
Socket is female: feminine, recessed, recessive, intrusive, yin, either zeroth or second.
Things are mostly mix-and-match from these two, with major affiliation to one and minor influence from another. This is the thing that many psychoanalysts use to describe with the term 'bisexuality', hence it's different from common bisexuality (pan-sexuality) you can look up on wiki.

Heterosexuality is simple, traditional and well-known working method of sexual fulfillment.
Homosexuality isn't necessarily stupid, unnatural, and forbidden [by law], but it's definitely fruitless, improper and unsafe in its nature.
    Bisexuality(heterosexuality AND homosexuality);
Bisexuality is when a subject is neither exclusively heterosexual nor homosexual.

Saikat Guha in Tripartite Analysis of Sexual gratification explained the components of sexual gratification: physiological components, aesthetic components, and erotic component. This should apply for any form of sexual activity.
  • Physiological component: biological functions of body related to sexual activity: hormones, reproduction, sexual organs, sensory stimulus.
  • Aesthetic component: attraction towards certain qualities (personal traits) of a subject: fetishes, fashion, and favor towards specifics of a subject which quantify to [physical] measurements.
  • Erotic component: care, affection, sympathy.
Thus every aspects of living being related to sexual activity will have its qualities associated (majorly) to either male or female, e.g. estrogen/testosterone, breast/biceps, motherly/fatherly love. Non-living things are associated with this sexes too (we call it genders), for example swords are mostly named with masculine names, e.g. Gladius and vessels are named with feminine names, e.g. Elizabeth.

So how about same-gender sexual interaction?


Heterosexual: It's Schuko plug plugged in to Euro socket, looks just normal although the combination isn't from the same type. Here's just-fine if not proper electrical contact.

 
Homosexual: Two Schuko plugs tied and clamped together with twisted single wires. This surely isn't a proper way to use your electrical appliances, still there's electrical contact made.

If different-genders interaction is called contact, I'll call same-sex interaction either crash, clash, or something just isn't quite right here.

Bisexuality (pan-sexuality) just isn't my thing.

EECCIS 2014

My alma mater (Electrical Eng., Brawijaya University) holds an seminar bi-annually on various subjects on electrical engineering: electrical power, electronics, telecommunication, control system, computer engineering. This year's EECCIS 2014 is the 7th time, and the first time it's held joint committee with Universiti Tun Hussein Onn.



In the plenary session of the seminar, I had a chance to ask Prof. Dato' Mohd. Noh Dalimin after his lecture on superconductor applications for environmental sustainability. The presentation material wasn't that far from 1st year Electrochemisty on superconducting material (no 3rd order integral on temperature gradient and such; thx, God), still he gave us many enlightening insights.

I asked him about the feasibility of implementing superconductors as power line infrastructure considering that cryogenic cooling system is dire expensive; let alone that heat from the sunlight is enormous all year long in tropical countries. His answer was simple:
as the system deemed cost-ineffective at the moment, it means that there is a lot of room for improvement. And making those improvements that later yield tremendous benefit will surely cost huge amount of [sacrifices/]resources, too.

It gets me so damn hard.

___________

thank you so much for the pen case , it's made from recycled paper (the pen too); reminds us to be environmentally friendly.

Oldie Beauty

I've been riding with this utility bike for quite some time. She is an old bike (from late 80s or early 90s, I suppose) which I already broke the fork she came initially with. The original paint is purple but already covered with black layer by the time I purchased her from local flea market.

About the group: the brake-shift levers are old Altus, the rear derailer is A050, front mech is Tourney. The wheel is Nova Rigida with local-made Delitire tire. The latest addition is messy bluish-black paintjob (which is a big mess done by me personally) and the invert-installed fork.

I had to install the fork inverted because I messed welding the headtube (the original one simply tore away), putting it way too reclined. Given the stem is already too short, the handling is hard and nippy, thus to compensate this problem I had to invert the fork so the front axle is closer way back.


 
simple black beauty

Retirees

I've finally retired my faithful KMC Z9 and 3 sprockets (2300's 15T and 13T, Deore's 11T). All of them have gone through considerable abuse (by me personally). May peace be upon them.

The chain: KMC Z9, beaten up pretty good













The chain is elongated way too much. It makes squeaky noise under heavy pedal stroke. Not that I am a powerful pusher-sprinter, I just forgot to replace it sooner (it's been around for 2-3 years already if I remember correctly).

Let's get technical: 15.5 links are 20 cm long (the tile is 20 cm wide). The math is: 15.5 links x 1.57 cm (standard chain pitch) = 19.685 cm is the way a good chain should be. So how abused my chain has gone through? 20 cm / 15.5 links = 1.29... cm/link; 1.29 x 20 cm = 25.8... cm. Sheldon here said that it is way over the tolarable length (25.7 cm for 20 links--10 links if you count inside-outside links as a link).

I guess I am pretty stupid not to change it sooner.

top 3 sprockets













I rode all-odd 8-speed 25T-11T, and the top (smallest) three are my favorites. On commuting rides, I mostly went with 50/34 at front 13T at the rear, occasionally switching to 15T or 11T for extra acceleration or extra 'push' rescpectively. To make things worse: I'd like to do some climbing on 34T compact front and 15T in the rear. Yeah, you may call me pussy now.

The sprockets are probably heavily dammaged by the over-elongated chain. As I replaced the chain (with another KMC Z9 of course), it frequently 'skipped/jumped' if I am on 34 in the front. So I need to change these sprockets too. Now I am riding 26T-23T-21T-19T-17T-15T-13T-12T. Yeah, you may call me pussy again now.

The moral is: always inspect your chain regularly, 2 weeks or so will do.

---update
Forgot to include my loose bottom bracket's bearings too (Sora's Hollowtech II)
the left bearing is super-loose, the right is so-so

Nervousness-induced Stupidity

Last Friday (6/27) I had an interview for my entrance exam for a scholarship program over Skype. And I kind of failed it, quite miserably I have to admit. The pace of the interview was so nervous-inducingly fast.
  • I forgot my registration number for the test,
  • I forgot what RISC stands for, it's reduced instruction-set computer anyway,
  • I couldn't even said that RISC uses fewer clock cycle(s) per instruction compared to "de facto" standard of x86 processor architecture family which belongs to CISC architecture: complex instruction-set computer,
  • I couldn't clearly explain my internship experience (which could be strong point in the interview)--even I mention the organization's name wrong in English,
  • I showed how little my experience with FPGA by saying the furthest I had gone with it is merely dumb stopwatch, 
  • I showed how lame my experience in programming in assembler language,
  • I spoke gibberish thing like: I love being in a team, which has no real implication IRL,
  • I brought up non-technical issues on something in which we hope such issue won't happen related to its technical implementation,
  • I was pausing mid-sentence... over and over again,
  • I was sure my voice wasn't audibly illegible,
  • ... and all other silly mistakes I did unawarely
The only thing I was confident about is when I said "I'd definitely do".
...I was just panicking like stupid, definitely.

iptables: transition intrapositioned to extrapositioned negation

Just today when I was writing iptables rule for my lab's gateway which (sadly) still have to rely heavily on IPv4 NAT (network address translation), it spew something cute when I put such rule:

# iptables -t nat -A POSTROUTING -s 192.168.0.0/25 -d ! 192.168.0.0/24 -o br1 -j MASQUERADE
The rule tells iptables to masquarade packets originating from 192.168.0.0/25 which destination isn't within 192.168.0.0/24 (my lab has two gateways for each /25 subnet, fyi).

It said:
Using intrapositioned negation (`--option ! this`) is deprecated in favor of extrapositioned (`! --option this`).

The rule still worked just fine. But as a good guy, let's adhere to the current standard (which is assumed to be 'more correct' :D )
# iptables -t nat -A POSTROUTING -s 192.168.0.0/25 ! -d 192.168.0.0/24 -o br1 -j MASQUERADE

vsftp: anonymous can do 'em all

I need quick vsftpd config to allow anonymous user to anything on my ftp server, I wouldn't need security/auth this time.

anon_root=/home/liyan/ristie
anon_mkdir_write_enable=YES
anon_other_write_enable=YES
anon_upload_enable=YES
anon_world_readable_only=YES
anonymous_enable=YES
listen=YES
listen_port=21
local_enable=NO

write_enable=YES

Spring the daemon up and you're good to go.

Qt 4.8 is better than Qt 5.x

I am currently helping a friend doing project on Qt and OpenCV. There're some problem I encounter regarding library dependencies:

I can't build newer OpenCV (2.4.9) against  libavutil.so.52 (ffmpeg-2.1.4), therefore I resorted to Slackbuild's prebuilt OpenCV 2.4.5

I can't compile sanely valid Qt program OpenCV 2.4.5 on Qt 5.2. Which in turn becase OpenCV 2.4.5 is build around Qt 4 (4.8 most likely). I hate this dependency hell.

So here I am, reverting back to Qt 4.8. Good thing Slackware64-current's is Qt 4.8.2.

libsecret: udev getting pwn'd

My filemanager (pcmanfm) just stopped recognizing newly plugged-in USB flashdrives after I upgraded from Slackware64-14.0 to Slackware64-14.1 (it's actually Salix64 anyway). Running /usr/libexec/gvfs-udisks2-volume-monitor told me that libsecret is missing.

# installpkg libsecret-0.15-x86_64-1.txz
simply solved the problem.

Yet, I found the library's name (libsecret) is quite weird, up to par with libconfuse.

/usr/bin/nc: cpi

This band (netcat) is wickedly sick, releasing their album (Cycles per Instruction) as Linux kernel module!

The approach is pretty simple:
#include "../netcat.h" 
#define NETCAT_CPI_TRK1_LEN 624344 
struct netcat_track netcat_cpi_trk1 = { 
    .name = "Interrupt 0x7f", 
    .len = NETCAT_CPI_TRK1_LEN, 
    .data = { 
         #include "trk1data.h" 
    } 
};

It (the C header file) is actually a wavefile , you can redirect it to media player just as normal I/O operation. Just like silly "Hello world!" kprintf from kernel demo program you used to write on Intro to *NIX Operating System lecture.

Anyway, I am quite afraid there will be path issue between this netcat and the legitimate netcat.