Cut your pdf into 6 inch in Linux

###Preparation Yaourt briss will show the following result:

	1 aur/briss 0.9-2 (58)
	    Java tool to crop pages of PDF documents to one or more regions selected with a GUI.
	==> Enter n° of packages to be installed (ex: 1 2 3 or 1-3)

Install it and now we will going to cut our pdfs. ###Cutting First you can manually cut your pdf, and set it to fit your own size.Simply input “briss” then you can got a window for your operation.
Or via command line:

	$ briss -s Your_pdf.pdf

The result is listed as following:

resized

###Tips How to resize your image to fixed size:

	$ convert -resize 1000x from.jpg to.jpg

Enable enc28j60 on Raspberry PI

###Kernel Source Preparation Install libncurses5-dev for make menuconfig

	$ sudo apt-get install libncurses5-dev
	$ sudo apt-get update && sudo apt-get upgrade -y
Get the source code and configure the kernel modules
	git clone --depth 1 https://github.com/raspberrypi/linux.git
	cd linux
	zcat /proc/config.gz >.config
	edit .config and enable

The Configuration image listed as following:

kernelconfig

###Wiring Preparation

	ENC - RPi
	===============
	VCC - 3v3
	GND - GND
	CS - CE0 (gpio 8)
	SI - MOSI (gpio 10)
	SCK - SCKL (gpio 11)
	SO - MISO (gpio 9)

Rapsberry PI GPIO Description:

GPIOs

GPIOs:

GPIO

###Speedup compiling Using cross-compiler:
Resolve the cross-compiler issue:

	[root@XXXyyy lib]# cp libppl.so.13 libppl.so.12
	[root@XXXyyy lib]# pwd
	/usr/lib

The yaourt’s cross-compiler is not ok, so we need to use official cross-compiler, download it from :

	$ git clone git://github.com/raspberrypi/tools.git
	#### Install crosscompiler for RaspberryPI ####
	$ export PATH="/media/x/vmware/rasp/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin:$PATH"

Then you can use cross-compiler to compile your own kernel image and kernel modules.

Things to be done(4)

Transfer Chinese to Pinyin using bash or python.
__How to cut the pdf and generate the suitable version in Linux. __

Correcting My Weather Script

Due to http://haitao.smzdm.com/youhui/88923 Nanjing Environmenmental Monitoring System changed their website, my python script can’t fetch the correct data from this page, I have to find another data source, from http://www.cnpm25.cn/city/nanjing.html, but this source has about 1 hour’s delay to the official site.

Because the source changes, the previous script can’t work any more, I made following changes, following is the changes in python code

	# table which contians the atmosphere information
	table = soup.find('table', {'id':'xiang1'})
		
	for subrows in rows:
	  if "玄武湖" in subrows.text:
	    XuanwuLake = subrows
	XuanwuLake_subitem = XuanwuLake.findAll('td')
	# PM 2.5
	pm_array[1] = XuanwuLake_subitem[3].text
	# PM 10
	pm_array[0] = XuanwuLake_subitem[4].text
	# Fetch only the digits from the output
	insert_pm25 = int(re.search('\d+', pm_array[1]).group())
	insert_pm10 = int(re.search('\d+', pm_array[0]).group())

	# Insert into the database
	cur.execute('insert into foo values(?, ?, ? , ? ,?)', (word1, word2, insert_pm10, insert_pm25, currenttime_linux))

Also because the pollution is too serious, we have to change the following lines:

	-   yaxis: { min: 0, max: 200},
	+   yaxis: { min: 0, max: 300},

After reboot, we then see the result is updated .

###Tips on delete the inserted sqlite3 records

	$ sqlite /srv/www1/weather1.db
	sqlite> select * from foo
	18|88|123|62.0|1383303610000
	19|83|258μg/m³|145μg/m³|1383395165000
	sqlite> .schema foo
	CREATE TABLE foo (d_temper integer, d_humi integer, d_pm10 integer, d_pm25 real, d_time timestamp);
	sqlite> delete from foo where d_time = 1383395165000;

Deal With Kernel Panic

Recently My ArchLinux always crashes at a certain time after boot up. So following is what I am doing to solve this fucking crash problem. ###Enable FSCK I didn’t enable fsck at boot up. so now I will open this parameter via:

	[root@XXXyyy Trusty]# tune2fs -c 30 /dev/sda2
	tune2fs 1.42.8 (20-Jun-2013)
	Setting maximal mount count to 30
	[root@XXXyyy Trusty]# tune2fs -c 30 /dev/sda3
	tune2fs 1.42.8 (20-Jun-2013)
	Setting maximal mount count to 30

###Deal with systemd problem Check which serivce is failed during startup:

	[root@XXXyyy Trusty]# systemctl | grep -i failed
	samba.service                                                                                         loaded failed failed    Samba AD Daemon
	systemd-modules-load.service                                                                          loaded failed failed    Load Kernel Modules

Disable the samba.service:

	systemctl disable samba.service

Check the auto loaded modules:

	[root@XXXyyy Trusty]# cat /etc/modules-load.d/virtualbox.conf
	vboxdrv
	#vboxnetflt
	#voxnetadap
	#vboxpci

I think the order should have some problems, so I change the sequence to the upper.
Now reboot you will get no systemd related problems. ###Video Problems Install some intel based packages:

	pacman -S lib32-intel-dri
	pacman -S libva-intel-driver

To Be determined:
Some issues with X crashing, GPU hanging, or problems with X freezing, can be fixed by disabling the GPU usage with the NoAccel option:

	/etc/X11/xorg.conf.d/20-intel.conf
	Section "Device"
	   Identifier "Intel Graphics"
	   Driver "intel"
	   Option "NoAccel" "True"
	EndSection

Continue to investigate, next time when my machine is frozened, remote ssh to the machine, to see if it really could be access.