Create your own dataset for machine learning, same format as CIFAR-10 dataset, via PIL and numpy

Refers:
http://www.cs.toronto.edu/~kriz/cifar.html
https://www.tensorflow.org/tutorials/deep_cnn


The CIFAR-10 dataset consists of 60000 32x32 colour images in 10 classes.

ClixSense Click on the cat job use the image that its size is 128 x 96 px, and
the image is cat or dog, no other type.
I want to use CNN to do machine learning for this job. 
I collected some images now.

The key python codes to append one image with label to the dataset is as below:

from PIL import Image
import numpy as np
  im = Image.open(filename)
  im = (np.array(im))

  r = im[:,:,0].flatten()
  g = im[:,:,1].flatten()
  b = im[:,:,2].flatten()

  if iscat:
    label = [0]
  else:
    label = [1]

  out  = np.array(list(label) + list(r) + list(g) + list(b), np.uint8)
  out.tofile(dataset)





救赎主活着

我知道我的救赎主活着,末了必站立在地上。 (约伯记 19:25 和合本)
I know that my redeemer lives, and that in the end he will stand on the earth.  (Job 19:25 NIV)
我这皮肉灭绝之后,我必在肉体之外得见 神。 (约伯记 19:26 和合本)
And after my skin has been destroyed, yet in my flesh I will see God;  (Job 19:26 NIV)

谁能知道自己的错失呢?愿你赦免我隐而未现的过错。 (诗篇 19:12 和合本)
But who can discern their own errors? Forgive my hidden faults.  (Psalms 19:12 NIV)
求你拦阻仆人不犯任意妄为的罪,不容这罪辖制我,我便完全,免犯大罪。 (诗篇 19:13 和合本)
Keep your servant also from willful sins; may they not rule over me. Then I will be blameless, innocent of great transgression.  (Psalms 19:13 NIV)
耶和华—我的磐石,我的救赎主啊,愿我口中的言语、心里的意念在你面前蒙悦纳。 (诗篇 19:14 和合本)
May these words of my mouth and this meditation of my heart be pleasing in your sight, Lord , my Rock and my Redeemer.  (Psalms 19:14 NIV)


Installing tensorflow with CPU support only from source on Ubuntu 16.04

Refers :
https://www.tensorflow.org/install/install_sources
https://bazel.build/versions/master/docs/install.html


神是我们的终极帮助

约伯回答说: (约伯记 16:1 和合本)
Then Job replied:  (Job 16:1 NIV)
这样的话我听了许多;你们安慰人,反叫人愁烦。 (约伯记 16:2 和合本)
“I have heard many things like these; you are miserable comforters, all of you!  (Job 16:2 NIV)

有时家人和朋友的帮助是有限的,因此

我要向山举目;我的帮助从何而来? (诗篇 121:1 和合本)
I lift up my eyes to the mountains— where does my help come from?  (Psalms 121:1 NIV)
我的帮助从造天地的耶和华而来。 (诗篇 121:2 和合本)
My help comes from the Lord , the Maker of heaven and earth.  (Psalms 121:2 NIV)

有人靠车,有人靠马,但我们要提到耶和华—我们 神的名。 (诗篇 20:7 和合本)
Some trust in chariots and some in horses, but we trust in the name of the Lord our God.  (Psalms 20:7 NIV)


因着耶稣 我们如约伯一样有复活的盼望和信心



人为妇人所生,日子短少,多有患难; (约伯记 14:1 和合本)
“Mortals, born of woman, are of few days and full of trouble.  (Job 14:1 NIV)
出来如花,又被割下,飞去如影,不能存留。 (约伯记 14:2 和合本)
They spring up like flowers and wither away; like fleeting shadows, they do not endure.  (Job 14:2 NIV)
但人死亡而消灭;他气绝,竟在何处呢? (约伯记 14:10 和合本)
But a man dies and is laid low; he breathes his last and is no more.  (Job 14:10 NIV)
惟愿你把我藏在阴间,存于隐密处,等你的忿怒过去;愿你为我定了日期,记念我。 (约伯记 14:13 和合本)
“If only you would hide me in the grave and conceal me till your anger has passed! If only you would set me a time and then remember me!  (Job 14:13 NIV)
人若死了岂能再活呢?我只要在我一切争战的日子,等我被释放(或译:改变) 的时候来到。 (约伯记 14:14 和合本)
If someone dies, will they live again? All the days of my hard service I will wait for my renewal to come.  (Job 14:14 NIV)


死荫算什么 神必安慰,显为光明


那地甚是幽暗,是死荫混沌之地;那里的光好像幽暗。 (约伯记 10:22 和合本)
to the land of deepest night, of utter darkness and disorder, where even the light is like darkness.”  (Job 10:22 NIV)
他将深奥的事从黑暗中彰显,使死荫显为光明。 (约伯记 12:22 和合本)
He reveals the deep things of darkness and brings utter darkness into the light.  (Job 12:22 NIV)

我虽然行过死荫的幽谷,也不怕遭害,因为你与我同在;你的杖,你的竿,都安慰我。 (诗篇 23:4 和合本)
Even though I walk through the darkest valley, I will fear no evil, for you are with me; your rod and your staff, they comfort me.  (Psalms 23:4 NIV)


How to config Oracle java on your Ubuntu

install via ppa source
sudo add-apt-repository ppa:webupd8team/java

sudo apt-get update

sudo apt-get install oracle-java8-installer

sudo update-java-alternatives -s java-8-oracle


耶稣是中保



他本不像我是人,使我可以回答他,又使我们可以同听审判。 (约伯记 9:32 和合本)
“He is not a mere mortal like me that I might answer him, that we might confront each other in court. (Job 9:32 NIV)
我们中间没有听讼的人可以向我们两造按手。 (约伯记 9:33 和合本)
If only there were someone to mediate between us, someone to bring us together, (Job 9:33 NIV)
愿他把杖离开我,不使惊惶威吓我。 (约伯记 9:34 和合本)
someone to remove God’s rod from me, so that his terror would frighten me no more. (Job 9:34 NIV)
我就说话,也不惧怕他,现在我却不是那样。 (约伯记 9:35 和合本)

约伯此时还不知有中保,得见神面后明白了

Then I would speak up without fear of him, but as it now stands with me, I cannot. (Job 9:35 NIV)
现今,在天有我的见证,在上有我的中保。 (约伯记 16:19 和合本)
Even now my witness is in heaven; my advocate is on high. (Job 16:19 NIV)

因为只有一位 神,在 神和人中间,只有一位中保,乃是降世为人的基督耶稣; (提摩太前书 2:5 和合本)
For there is one God and one mediator between God and mankind, the man Christ Jesus, (1 Timothy 2:5 NIV)

How to define new IPC Messages in Chromium project

I encountered some strange errors when I added my own IPC messages in xxx_messages.h like:

IPC_ENUM_TRAITS(xxx)
IPC_MESSAGE_CONTROL1(xxxx, std::string)

因信称义



鉴察人的主啊,我若有罪,于你何妨?为何以我当你的箭靶子,使我厌弃自己的性命? (约伯记 7:20 和合本)
If I have sinned, what have I done to you, you who see everything we do? Why have you made me your target? Have I become a burden to you?  (Job 7:20 NIV)

是的 人犯了罪丝毫影响不了至高的神 造物主是全然无罪的 且祂极憎恶罪 但是人是无法行全律法的
就如经上所记:没有义人,连一个也没有。 (罗马书 3:10 和合本)
As it is written: “There is no one righteous, not even one;  (Romans 3:10 NIV)
因为世人都犯了罪,亏缺了 神的荣耀;  (罗马书 3:23 和合本)
for all have sinned and fall short of the glory of God,  (Romans 3:23 NIV)
如今却蒙 神的恩典,因基督耶稣的救赎,就白白地称义。  (罗马书 3:24 和合本)
and all are justified freely by his grace through the redemption that came by Christ Jesus.  (Romans 3:24 NIV)


苦难背后是神更丰盛的祝福



人生在世必遇患难,如同火星飞腾。至于我,我必仰望 神,把我的事情托付他。 (约伯记 5:7-8 和合本)

“Blessed is the one whom God corrects; so do not despise the discipline of the Almighty. For he wounds, but he also binds up; he injures, but his hands also heal. ...You will know that your children will be many, and your descendants like the grass of the earth. You will come to the grave in full vigor, like sheaves gathered in season.  (Job 5:17-18,25-26 NIV)


无辜的人有谁灭亡?

 
有,从亚伯起,苦难不都是犯罪的结果。
叫世上所流义人的血都归到你们身上,从义人亚伯的血起,直到你们在殿和坛中间所杀的巴拉加的儿子撒迦利亚的血为止。  (马太福音 23:35 和合本)
“Consider now: Who, being innocent, has ever perished? Where were the upright ever destroyed?  (Job 4:7 NIV)
Now Cain said to his brother Abel, “Let’s go out to the field.” While they were in the field, Cain attacked his brother Abel and killed him.  (Genesis 4:8 NIV)

Sample Codes : Use abstract unix socket to do IPC




ViewerDebugging tesseract-ocr on Ubuntu 16.04

Refers:
https://github.com/tesseract-ocr/tesseract/wiki/Compiling
https://github.com/tesseract-ocr/tesseract/wiki/ViewerDebugging

神就是那光 道路 真理 生命

受患难的人为何有光赐给他呢?心中愁苦的人为何有生命赐给他呢?

约伯此时视死亡为脱离苦难的最后方法,因为此时他还不知道有复活的事。

“Have you not put a hedge around him and his household and everything he has? You have blessed the work of his hands, so that his flocks and herds are spread throughout the land.  (Job 1:10 NIV)
Why is life given to a man whose way is hidden, whom God has hedged in?  (Job 3:23 NIV)

hedge的意思从起初的四面围护变成了四面围困,经历失去所有,自身遭罪的约伯一定程度上已经陷入了撒旦的诡计中。

用二节诗篇来帮助我们无论何境况都顺服神。
倚靠耶和华的人好像锡安山,永不动摇。众山怎样围绕耶路撒冷,耶和华也照样围绕他的百姓,从今时直到永远。 (诗篇 125:1-2 和合本)


Sample Codes: rotate & scale an image with OpenCV on Ubuntu 16.04

First of all, please configure opencv on your linux system.

How to build latest tesseract & Leptonica from source on Ubuntu 16.04

 
Refers: 
https://github.com/tesseract-ocr/tesseract/wiki/Compiling
http://www.leptonica.org/

神眷顾我们

但有人在经上某处证明说:人算什么,你竟顾念他?世人算什么,你竟眷顾他? (希伯来书 2:6 和合本) 神喜悦约伯战胜苦难 生活难免有苦难 问题 不要抱怨 怀疑 因为神是眷顾我们的 Then the Lord said to Satan, “Have you considered my servant Job? There is no one on earth like him; he is blameless and upright, a man who fears God and shuns evil. And he still maintains his integrity, though you incited me against him to ruin him without any reason.” ...He replied, “You are talking like a foolish woman. Shall we accept good from God, and not trouble?” In all this, Job did not sin in what he said. (Job 2:3,10 NIV)

约伯敬畏 神是无故的吗?

约伯敬畏 神 岂是无故呢?
这就是撒旦的离间,他在地上走来走去就是要离间众圣徒和 神的关系。
愿我们都能学着约伯的顺服,
说:“我赤身出于母胎,也必赤身归回;赏赐的是耶和华,收取的也是耶和华。耶和华的名是应当称颂的。” (约伯记 1:21 和合本)
“Does Job fear God for nothing?” Satan replied. ...At this, Job got up and tore his robe and shaved his head. Then he fell to the ground in worship and said: “Naked I came from my mother’s womb, and naked I will depart. The Lord gave and the Lord has taken away; may the name of the Lord be praised.” In all this, Job did not sin by charging God with wrongdoing.  (Job 1:9,20-22 NIV)


How to install dual boot loader ubuntu system with windows

Almost same as below doc:
https://www.ubuntu.com/download/desktop/install-ubuntu-desktop

What you need to do is to act as an advanced user, choose "something else" option in the third step.

We need to allocate space manually.


We need to allocate new partition from free space.
At least two partition is needed.
/
and swap partition.
The size for swap is always 2*memory(I have 4G memory, so I use 8G as my swap size).

That's all we need to differ from the normal installation.
And please select the correct boot loader device like below.

If you can't find ubuntu boot loader option after you completed the installation.
you can check my post and try to fix it.

How to fix up the missing ubuntu boot loader in your dual-boot computer(windows&ubuntu)

When I install ubuntu 16.04 on my computer, I made a mistake.
I select /dev/sda7 as the device for boot loader installation.
it caused that there was no ubuntu boot option after you completed
the installation.
The correct selection should be /dev/sda like below.


And one day you update your windows to a new version, the ubuntu boot loader
will overwrite and leads to the same problem.

anyway, we have to fix up the problem.
let't follow the same step when we try to install dual boot system.
here is the link.
but this time we just to install the boot loader for ubuntu, not real install the ubuntu system.
so please remember to click quit once you go to here.


















What we need to do is just open a terminal and type below command.

get root permission
$sudo -i 
find your mount point of your ubuntu system. mine is /dev/sda7
mount your ubuntu system
#mount /dev/sda7 /mnt
if you have a /boot partition of your ubuntun system, please remember mount it too
install boot loader
#grub-install --root-directory=/mnt /dev/sda
/dev/sda is the disk device where your windows loader placed.

ok. restart your computer and you will find your ubuntu boot loader come back.
the last command. open your terminal again.
$sudo update-grub

How to install ubuntu 16.04 on windows via grub4dos, dual boot system

first download grub4dos tool and ubuntu 16.04 iso
here is the links I used, or you can google it.
grub4dos
ubuntu 16.04 iso

Set up scmbug with subversion & bugzilla

First of all, please install bugzilla and subversion.
Regarding bugzilla, this is a post how to set up it, just click.

敬畏神,远离恶事,常常这样行



In the land of Uz there lived a man whose name was Job. This man was blameless and upright; he feared God and shunned evil. ...When a period of feasting had run its course, Job would make arrangements for them to be purified. Early in the morning he would sacrifice a burnt offering for each of them, thinking, “Perhaps my children have sinned and cursed God in their hearts.” This was Job’s regular custom.  (Job 1:1,5 NIV)


Setup bugzilla on Ubuntu

prepare:
1 apache
$sudo apt-get install apache2
2 mysqlserver
$sudo apt-get install mysql-server
ps: after installed, you need to input password for root(user of adminstrator group, not user group, please keep the password in mind)
3 sendmail
sudo apt-get install sendmail
4 download bugzilla package from http://www.bugzilla.org/

Ubuntu 16.04 add 32-bit architecture

sudo dpkg --add-architecture i386
sudo apt -get update
sudo apt-get -f dist-upgrade 
 

set proxy for app-get



The easy way is

 $export http_proxy=http://xxx.xxx.xxx.xxx:xxxx 

if not work, try

$sudo http_proxy=http://xxx.xxx.xxx.xxx:xxxx apt-get update

http:// shall not be missed, otherwise you will encounter below errors :

Cannot initiate the connection to 8080:80 (0.0.31.144).

 

Dialog that can remember last selected folder, using MFC


How zygote and render process was created in Chromium

How zygote process was created

rebase all dll of cygwin for Win7/Vista system to fix fork issue

在cygwin的安装目录(通常是c:\cygwin\bin)下提供了一个rebase的脚本程序。
在同一目录下有个ash.exe程序是用来执行这个脚本的。


在windows系统上,按如下步骤做即可:
1.打开CMD窗口(按下Win+R键启动运行窗口,输入CMD,最后按下回车键即可)
2.切换到c:\cygwin\bin目录(命令行:cd /d c:\cygwin\bin
3.运行ash.exe程序(命令行:ash.exe)
4.启动rebase脚本(命令:./bin/rebaseall -v)


这么做主要是为了解决在Vista或是Windows7系统下,Cygwin的fork出不来的实现问题。

vim + ctags + taglist + cscope, use as sourceinsight in linux system


how to start apache service or httpd service and how to auto run it after boot

apache服务,或者说httpd服务,如何启动,如何开机启动。
2010-04-02 09:59

how to fix S 1023 error while installing Microsoft DirectX SDK(June 2010)

安装Microsoft DirectX SDK (June 2010)时到最后在installing VC++ runtime等东东时最后报出个S 1023的错误。
我的情况是这样的,我原来安装过 DirectX SDK (February 2010)的版本,然后又卸载了。
有这么一个程序:C:\Program Files\Microsoft DirectX SDK (June 2010)\system\uninstall\vc10redist_x86.exe
双击发现我的电脑上已经安装过Microsof Visual C++ 2010 x86 redistributable 版本了。

所以打开控制面板,卸载程序Microsof Visual C++ 2010 x86 redistributable

然后再重新安装Microsoft DirectX SDK (June 2010)就成了

Simple : if you have installed 
Microsof Visual C++ 2010 x86 redistributable before, then uninstall it and reinstall the SDK again.

perl learning : xml parse & xpath simple implementation


Capture CScrollView paint content into image

最近做的一个东东,有个要求,需要将绘制在视窗中的内容保存成图片。而该视窗的类是继承于MFC中的CScrollView,即是滚动视图。滚动视图的文档内容往往都会比可见的视口要大许多。由于之前没做过这方面的玩意,所以随即百度、Google了一把。于是发现网上讲和较多的是屏幕截图或是只是捕获当前窗口可见区域的内容,滚动视图隐藏的部分要么截出来是黑的或是根本捕获不到。并没有找到符合自己要求的,但在网上查找这方面东东多了点,些许有了点想法。于是乎就立马code验证了,以下是验证过程。

perl learning : xpath search

perl learning : read xml to hash table


perl learning : hash table traversal


NMAKE Guide——中文版本(七)


NMAKE Guide——中文版本(六)


NMAKE Guide——中文版本(五)


NMAKE Guide——中文版本(四)


NMAKE Guide——中文版本(三)


NMAKE Guide——中文版本(二)

   

NMAKE Guide——中文版本(一)


旧事已过,都变成新的了 the old has gone, the new has come

若有人在基督里,他就是新造的人。旧事已过,都变成新的了。(哥林多后书 5:17)
Therefore, if anyone is in Christ, he is a new creation; the old has gone, the new has come! (2 Corinthians 5:17 NIV)

fixed: embedded-redis: Unable to run on macOS Sonoma

Issue you might see below error while trying to run embedded-redis for your testing on your macOS after you upgrade to Sonoma. java.la...