Thursday, May 12, 2022

vim binary mode


open file

convert to hex presentation 

:%!xxd

editing in hex format



convert back to see what is changed

:%!xxd -r






Monday, November 22, 2021

git: create pat how to use it?

PAT is personal access token 

 git remote remove origin

 git remote add origin https://[pat]@github.com/[username]/[project].git 

Friday, November 19, 2021

dig

 Ok hostinger not work for me. 

purchased a domain "dsmarkchen.com" from godday instead

to check dns:

 dig www.dsmarkchen.com +nostats +nocomments +nocmd


 

Friday, September 24, 2021

Eagle

 

 

Canto 9

Meaning

19

in dream I seemed to see an eagle poised,
with golden pinions, in the sky: its wings
were open; it was ready to swoop down.

 

Eagle: spiritual flight, Saint Lucy (light)

 

And I seemed to be there where Ganymede
deserted his own family when he
was snatched up for the high consistory.

 

 

Within myself I thought: “This eagle may
be used to hunting only here; its claws
refuse to carry upward any prey

 

 

found elsewhere.” Then it seemed to me that, wheeling
slightly and terrible as lightning, it
swooped, snatching me up to the fire’s orbit.

Lightning: eagle usually associate with lightning (thunderbolt, means knowledge)

 

And there it seemed that he and I were burning;
and this imagined conflagration scorched
me so—I was compelled to break my sleep.

Burning (in the fire):purify (the sins)

 The first dream in purgatory. Eagle and Serpent are a mystic pair, we have serpent in canto 8 btw. Serpent is bound to earth, while eagle is in flight. A pair of timeless fight. In buddhism, we have dragon and eagle too.

  • Hell. Look back, we see eagle with thunderbolt, the sprit breaks the binding of  pride of flash 
  • Purgatorio. Predict that the purify of spirit in the fires of purgatory.

Thursday, September 23, 2021

Gaze

A New Persective On Dante's Dream of Siren is a wonderful article that I discoverred recently.


It covers the second dream in purgatorio, it provides a key to understanding divine comedy as a whole.

(To me, all three dreams in purgatorio are fascinating.)

 

 

Canto 19

Meaning

7

a stammering woman came to me in dream:
her eyes askew, and crooked on her feet,
her hands were crippled, her complexion sallow.

Not to be loved

10

I looked at her; and just as sun revives
cold limbs that night made numb, so did my gaze
loosen her tongue and then, in little time,

gaze

13

set her contorted limbs in perfect order;
and, with the coloring that love prefers,
my eyes transformed the wanness of her features.

Projected love

16

And when her speech had been set free, then she
began to sing so, that it would have been
most difficult for me to turn aside.

Can't escape

19

“I am,” she sang, “I am the pleasing siren,
who in midsea leads mariners astray—
there is so much delight in hearing me.

 

 

22

I turned aside Ulysses, although he
had longed to journey; who grows used to me
seldom departs—I satisfy him so.”

Siren change songs to fit the desire of hearers

25

Her lips were not yet done when, there beside me,
a woman showed herself, alert and saintly,
to cast the siren into much confusion.

Lady (reason, power of free choice)

28

“O Virgil, Virgil, tell me: who is this?”
she asked most scornfully; and he came forward,
his eyes intent upon that honest one.

 

31

He seized the other, baring her in front,
tearing her clothes, and showing me her belly;
the stench that came from there awakened me.

Belly (Dante's desire)

Here interpret "Belly" to "Dante's desire" is  thunderbolt to me. 


Affect: 

 

Canto 19

Meaning

58

“The one you saw,” he said, “that ancient witch—
for her alone one must atone above;
you saw how man can free himself from her.

How man can free her?

61

Let that suffice, and hurry on your way;
fasten your eyes upon the lure that’s spun
by the eternal King with His great spheres.”

Lure (Beatrice)


 

The author identify false images and true image (Beatrice), and argues that true image "drives the lover to investigate his desires".

The article (or the author) tries to use reason to exaplain true image, which will eventually fail. I still view the Beatrice image as esthetic image.


 

Sunday, November 22, 2020

Love your fate!

 The pandemic of covid-19 in Alberta is rocking everyday, today was 1500, yesterday 1300, the day before 1100. Where is the ceiling? But my wife is my light, we have a little conversation this morning. If the life (virus) want to take your life, you can't avoid but have to accept it. Shouldn't depend the master's super power to heal the disease, or reciting the mantra or buddha's name to get rid of it. That's the spirit of "Love your fate!"

Dante has rely on the heavenly Marie and Beatrice, with this super natural power, he can't be defeat in seeking the source. James Joyce follows him, in Ulysses at the beginning that milk women acted like Athena (from my teacher Joseph Campbell). I am such a stupid head, I disdained that milk women as poor with no hope.


Wednesday, September 23, 2020

Say 'Yes'

I have a little meditation this morning. My mind is contemplating what to focus of the meditation topic, not on "who  recite the buddha's name",  as by my master in cttb originally said you have to find a good question to contemplate a few years ago. As I go though divine comedy of Dante (mostly in inferno), James Joyce, and Joseph Campell. There's some words from Joe, "I have say no all my live...", then I have a little thought of that say 'yes'. After meditation, is breakfast time, toast and coffee. I've chance to open Ulysses, the last page and the last section, to read. That is the start of my day. And a good day. Yes.

Thursday, December 29, 2016

isleapyear by Java


public class LeapYear {
    public static final int LEAP = 1;
    public static final int COMMON = 0;
    public static int isLeapYear(int d) {
        if(d%400 == 0) return 1;
        if(d%100 == 0) return 0;
        if(d%4 == 0) return 1;
       
        return 0;
    }
}


import org.junit.*;
import static org.junit.Assert.*;
public class LeapYearTest {
    @Test
    public void test_1996_is_leap_year() {
        int actual = LeapYear.isLeapYear(1996);
        assertEquals(LeapYear.LEAP, actual);
    }
    @Test
    public void test_2001_is_common_year() {
        int actual = LeapYear.isLeapYear(2001);
        assertEquals(LeapYear.COMMON, actual);
    }
    @Test
    public void test_1900_is_common_year() {
        int actual = LeapYear.isLeapYear(1900);
        assertEquals(LeapYear.COMMON, actual);
    }
    @Test
    public void test_2000_is_leap_year() {
        int actual = LeapYear.isLeapYear(2000);
        assertEquals(LeapYear.LEAP, actual);
    }

}

Friday, May 27, 2011

macbook pro alsa information

I install fedora 14 to my macbook pro. Alsa information (alsa-info) is located at

http://www.alsa-project.org/db/?f=fbe5944331a383db3659bae2cd06659142f28af4

Tuesday, July 27, 2010

a script to replace extention of files

Suppose the file extension is "foo".


#!/bin/bash

for f in `find . -name "*.foo" -type f`
do
newname=`echo "$f" | sed "s/\.foo$//"`
mv $f $newname
echo "mv $f to $newname"
done

exit 0

Monday, July 5, 2010

vmware fusion -- network no connection

The following tip can fix "network bridge device on /dev/vmnet0 is not running" failure.


$ sudo /Library/Application\ Support/VMWare Fusion/boot.sh –-restart

Wednesday, June 30, 2010

unlock android emulator

$ adb devices (to find port number 5554)
$ telnet localhost 5554
event send EV_KEY:KEY_MENU:1

ubuntu 10.04 notes

1 install vmware-tools

$ uname -a -> to find linux header version
$ sudo apt-get install linux-headers-2.6.32-21-generic
$ sudo apt-get install build-essential
$ sudo ./vmware-install.pl


2 build android 2.2

$ sudo apt-get install gcc-multilib g++-multilib zlib1g-dev gperf
$ sudo aptitude install libncurses-dev
$ sudo apt-get install bison flex git-core curl
$ sudo apt-get install openjdk-6-jdk
$ repo init -u git://android.git.kernel.org/platform/manifest.git -b
android-2.2_r1
$ repo sync
$ vim ./build/core/main.mk change 1.5 to 1.6
$ source ./build/envsetup.sh
$ lunch 1
$ make -j8

Wednesday, March 17, 2010

learning iphone programming

I start to write some code for learning iphone programming especially objective-c.

The first example shows here is an example to call ANSI C API (that is the first thing I want to figure out in the object-c environment).



/** @find_date generate date string from current time
*/
- (char*) find_date
{
static char date_str[80];
struct tm * my_tm = NULL;
char *month_str[12] = {
"January", "February", "March", "April",
"May", "June", "July", "August",
"September", "October", "November", "December"
};
time_t time_val;
time_val = time(NULL);
my_tm = localtime(&time_val);
sprintf(date_str, "%s%02d", month_str[my_tm->tm_mon], my_tm->tm_mday);
return date_str;
}



And here is the call to find_date. (convert to NSString from C-String)


{
char date_str[80];
sprintf(date_str, "modified: %s", [self find_date]);
label2.text = [NSString stringWithCString: date_str];
}



Now another example, with given date as input, open a file and read the data from the file, returns the buffer which contains the file content.


- (char*) init_jk_quote: (char*) date_str
{
FILE* fp;
char* quote_buf;
int length;

fp = fopen(date_str, "r");
if (fp == NULL) return NULL;
fseek(fp, 0, SEEK_END);
length = ftell(fp);

quote_buf = (char*) malloc(length);
if (quote_buf == NULL) {
fclose(fp);
return NULL;
}
fseek(fp, 0, SEEK_SET);

fread(quote_buf, sizeof(char), length, fp);
fclose(fp);
return quote_buf;
}
- (void) free_jk_quote: (char*) quote_buf
{
if (quote_buf)
free(quote_buf);
quote_buf = NULL;
}




And the call to the functions is demonstrated here.


{
char* quote_text;


quote_text = [self init_jk_quote: "/tmp/March17.txt"];
if (quote_text == NULL || strlen(quote_text)== 0) {
label3.text = @"not supported!";
}
else {
NSString* mystring = [NSString stringWithCString: quote_text];
label3.text = [@"my quote: " stringByAppendingString: mystring];
}
[self free_jk_quote:quote_text];
}




I think I need to break my habit of writing in C, and convert it to objective-c, so how to convert the above functions in object-c style? That is mainly something I need to learn.

Monday, March 15, 2010

eight steps to become an iphone developer

Here is the link on how to become an iphone developer.

In brief:
1. buy a mac (done)
2. down the sdk (done)
3. learn objective c
4. start writing something
5. sign-up as an official developer ($99 done)
6. prepare for a few weeks of work
7. submit your app to Apple
8. adapt, market and survive!

It did not mention a iphone but I already bought it. I would spend some effort to become a iphone developer. Learning is important to a programmer, just like several years ago, I learn the development on Linux, and later found that it is useful in my career. I did work on Linux platform. Mobile is a big market as I knew, so I can gain some skill here for the purpose of surviving.

Thursday, February 25, 2010

patching the code using cvs

I have blogged this and this,

But I would use the following command to create a patch and apply the patch.





$ cd /devel/foo
$ cvs diff -uNa > patch.txt
...
$ cvs co -r z_markc_-22jan2010 foo
$ cd foo
$ patch -p0 < /path/to/your/patch.txt


In creating a patch, "-a" is used for added code if needed.

Monday, January 4, 2010

merge library

1. extract the libraries foo and goo.


$ mkdir t
$ cd t
$ ar x ../libfoo.a
$ ar x ../libgoo.a


2. Prepare "Makefile.t"

all:
$(CROSS_COMPILE)g++ -shared -o libbar.so ./t
$(AR) -rcs libbar.a ./t/*.o


3.generate the new lib


$ make -f Makefile.t

Tuesday, November 24, 2009

use glib

1. install glib

$ apt-get install libglib2.0-dev


2. write source code to print "hello world!"

#include
int main(int argc, char** argv)
{
g_printf("hello world!\n");
}


3. compile

gcc `pkg-config --libs --cflags glib-2.0` hello.c

Tuesday, September 22, 2009

find/grep command

The following command searches C/C++ source code to find the content of "equalizer".

$ find ~/myspace/git/opencore -type f -name "*.[ch] -o -name "*.cpp" -exec grep -I "equalizer" {} \; -print

Tuesday, September 15, 2009

ubuntu - recording


I use "alsamixer -c 0" to set up my recording with microphone.