LearnDiary http://www.learndiary.com/en A blog focusing on Linux, Open Source and IT in China. Tue, 23 Dec 2014 05:15:03 +0000 en-US hourly 1 https://wordpress.org/?v=5.0.15 Summary of MobileMate 0.1 and Ideas about Future MobileMate 0.2 http://www.learndiary.com/en/2014/12/summary-of-mobilemate-01-and-ideas-about-future-mobilemate-02.htm http://www.learndiary.com/en/2014/12/summary-of-mobilemate-01-and-ideas-about-future-mobilemate-02.htm#respond Tue, 23 Dec 2014 05:15:03 +0000 http://www.learndiary.com/en/?p=219 MobileMate is a Bash script open source command-line tools and integrated in a self-starting Linux LiveCD, used for audio and video conversion. For details, see the project home page: http://www.learndiary.com/mobilemate/. Project goal is to make the open-source tools more useful, and explore a way to get benefits from open source projects. Over the past two years has basically completed the development of version 0.1, due to 0.1b1 has no necessary to improvement, so skip the official version 0.1, now is just for thinking about the design of version 0.2. This article is the summary of version 0.1 and the idea about future version 0.2.

MobileMate developed from two years ago but has not received any useful feedback. And there are few downloads from Sourceforge.net project page. And, no one is interested in the online customized service I created at Taobao and Ebay. MobileMate 0.1 did not achieve the expected goal. I summed up the reason for the failure. In short, the complexity of the tool exceeds the effect of the use of tools that can be obtained. Universal audio and video conversion software has been too much, MobileMate functionality similar to them, but with bad usability. The advantage of Shell scripts is able to complete a specific task efficiently use only few command lines. But I made a full conversion tool with Shell Script. For the average user, the return of this tool can’t exceed the complexity of usage; For some experienced user, using it has no more better than writing their own scripts for a specific task. Although, in MobileMate 0.1, I tried to build the entire system use object-oriented thinking, but Shell is not, after all, an object-oriented language, makes some experienced users want to reuse code becomes difficult. For example, for use of an “object” in MobileMate, you have to import the configuration file, import initialization parameters at least. The object-oriented thinking in MobileMate can only helpful of MobileMate 0.1 functional partitioning and maintenance.
Of course, from MobileMate 0.1 developing. I am more familiar with the system construct principles of Linux, familiar with scripting. it can be considered a little harvest of it.

I write some ideas of the development of the future MobileMate 0.2 briefly below.

1, the project goal and the overall technology roadmap:
Keep unchanged, still using the Bash script command-line tools integrated in a Linux LiveCD for the audio and video conversion. And, search a way of how to obtain benefits from an open source project.

2, Linux LiveCD the tool based on:
Since version 0.1 was originally created for the conversion of video watching at mobile phone. So I tried to make its size as small as possible. Used customized TinyCore Linux LiveCD as Linux OS platform. Now I will focus on the usability of the toolkits script, the LiveCD size isn’t too important now. Plan to adopt the customized mainstream Linux distribution LiveCD as the toolkit platform. So, it is easy to install application package to expand functions. And, has a more friendly user interface. For example: using LXDE desktop Ubuntu LiveCD.

3, the organization of the shell scripts:
Version 0.1 is to make an universal audio and video conversion tool. The idea of version 0.2 is to divide the audio and video conversion functions into each individual gadget. Each individual gadget may be even only include one small command line. Each gadget can complete a separate function, you can put multiple gadgets together to complete a series of complex functions. You can use the command line in a terminal alone, you can also customize to pass parameters to the graphical user interface (eg: Zenity), then you can operate audio and video conversion with mouse click.
Below use an application scenario to explain this idea.
For example: I have a set of violin DVD, each DVD contains several chapters, each chapter has music with a scenery video background. Music is double-channel, piano accompaniment in left channel and right channel is violin solo. There is a still 3 seconds’ picture describes the name of the chapter and other information at the beginning of every chapter. The purpose of the application is: extract mp3 from every chapter, mp3 is divided into three kinds, namely: piano accompaniment, violin solo, ensemble. Every mp3 requirements plus the cover image, it is the still image at the beginning of every chapter, plus channel description (such as: violin solo).
The application requires functions can be divided into: Extract music of every chapter from DVD, separate them by channel; Extract picture from every chapter’s beginning still image; The picture plus channel description form mp3 cover picture base; Convert the base cover picture into appropriate size and format; Plus mp3 cover picture and mp3 music separated by audio channel.
Each individual function above can be done with a single command line. Then you can put the individual pieces of the command-line functions together get the automated conversion script. Or provide a standard graphical interface that allows user use the mouse to complete the conversion purpose.

Imagine, even a very skilled Linux user, he also need do some internet searching and read the command line manual to finish the job above when the first time. Our aim is to let everyone to save the time of finding and learning as much as possible. And, just open our toolkit, look at corresponding directory for a specific task will be easy to write aultomated processing scripts.

So, which way to organize and document our script is a special request, to facilitate the users to find the function modules and the corresponding function usage as soon as possible.

In short, MobileMate 0.2 will be made use mainstream Linux distribution LiveCD as a platform, a collection of various audio and video conversion command-line script gadget, combined with a well-organized and well-documented, perhaps coupled with the other popular open source audio and video conversion tools, such as: ffmpeg GUI front-end WinFF, making DVD video command-line tool DVDWizard, etc..

About the future vision of MobileMate 0.2, I hope you can make comments and suggestions. Thank you.

]]>
http://www.learndiary.com/en/2014/12/summary-of-mobilemate-01-and-ideas-about-future-mobilemate-02.htm/feed 0
Install Debian 5 on an Old Computer http://www.learndiary.com/en/2014/12/install-debian-5-on-an-old-computer.htm http://www.learndiary.com/en/2014/12/install-debian-5-on-an-old-computer.htm#respond Tue, 16 Dec 2014 03:21:49 +0000 http://www.learndiary.com/en/?p=216 This is an obsolete old computer, probably 2004’s BIOS, Intel 865G motherboard, P4 2.4G CPU, Radeon 9600 128M graphics card, 1G RAM, 20G IDE hard drive. Here is a simple record of what I installed Debian 5(Debian Lenny) on this computer, and Torcs, ManiaDrive 3D racing game, AstroMenace 3D air combat game. And Google Chrome, Firefox browser, office software. Note this is simply records, maybe not very accurate.

In fact, this computer can run the latest version of the Linux distributions, maybe a bit slow. I ran Ubuntu GNOME 14.04 Live USB on it successfully. But I installed Debian 5 (2009 released), for two reasons: First, I searched on AMD graphics website, for my Radeon 9600 graphics card closed source driver is ati-driver-installer-9-3-x86.x86_64.run which issued at 2009, I tried, it can not even support Debian 6. I tested, it supports Debian 5 (2.6.26 kernel) and Ubuntu 8.04. And I can’t play several 3D games mentioned above without the 3D acceleration feature provided only by closed-source driver. The second reason is the old Linux should be more smoothly run on this computer. Debian 5 stopped support at about 2012, and it exists some vulnerabilities now definitely, but I just play on this computer, so do not consider this problem.

The first is install Debian 5 operating system, because I have created a tar.gz archive of Debian 5 system files, so unpack the archive directly to the hard drive. Then use Ubuntu GNOME 14.04 Live USB start the computer, modified “/boot/grub/menu.lst”, “/etc/fstab” and “/etc/mtab”(maybe not necessary) and so on, and then mount –bind the /dev directory to Debian’s /dev, refer to the LFS documentation for detail(Linux From Scratch – Version 7.6 – 6.2 Preparing Virtual Kernel File Systems.): http://www.linuxfromscratch.org/lfs/view/stable/chapter06/kernfs.html. Then, chroot to Debian 5 operating system, installed grub information to the master boot sector of hard drive with “grub-install” command. Used “update-grub” command to update the grub menu. Note, because I bound “/dev” of Ubuntu Live USB directory, you may need modify “/boot/grub/device.map” file of Debian 5, for example: change “/dev/hda” into “/dev/sda”. Otherwise, “grub-install /dev/sda” may fail. In addition, you can also reboot with Live USB, then modify the parameters of Grub boot item to enter into Debian 5, then install grub information to the master boot sector and update Grub menu.

Reboot, perhaps need some adjustments in order to enter newly installed Debian 5. And then modify the repository source, execute “sudo apt-get update” and “sudo apt-get dist-upgrade” upgrade Debian 5 to the latest version. Unsupported Debian version has a different repository source, I used is below:

deb http://archive.debian.org/debian/ lenny main contrib non-free
deb-src http://archive.debian.org/debian/ lenny main contrib non-free
deb http://archive.debian.org/debian-backports/ lenny-backports main contrib non-free
deb-src http://archive.debian.org/debian-backports/ lenny-backports main contrib non-free
deb http://archive.debian.org/debian-backports/ lenny-backports-sloppy main contrib non-free
deb-src http://archive.debian.org/debian-backports/ lenny-backports-sloppy main contrib non-free

Search on AMD’s site, the latest video card driver support Raedon 9600 is “ati-driver-installer-9-3-x86.x86_64.run”, downloaded and installed it. Under Debian 5, the driver can not support backports kernel 2.6.32, it supports 2.6.26 only. If you want to uninstall Raedon closed source driver, you can: “sudo sh /usr/share/ati/fglrx-uninstall.sh”, refer to here for detail: http://ubuntuforums.org/showthread.php?t=1056539 and http://askubuntu.com/questions/68306/how-do-i-remove-the-proprietary-ati-drivers. Rebbot after the installation, you can see ATI Catalyst settings in the bottom of “Applications” start menu, adjust graphics performance and quality with it.

Enter the “apt-get install torcs” on the console directly can install torcs 1.3.0 3D racing game. you can also download the latest version(1.3.6) of the source code from sourceforge.net to compile and install. The configuration required “./configure –disable-xrandr” on my machine to compile. But, finally, I found the old version seem play more smoothly.

ManiaDrive is a single-track 3D racing game focus on skills, it is said to simulate the TrackMania racing game. You can download the official statically compiled package online directly, unzip it and run. Maybe need “apt-get install oss-compat” package for sound.

This old computer can run the latest version of 3D air combat game AstroMenace compiled from source smoothly. According to guidelines in http://www.viewizard.com/download.php, I used svn download the latest version of the source code. Then, according to ReadMe.txt in source packages to compile and install game.

Did some online search, the latest version of Google Chrome support Debian 5 is: google-chrome-stable-12-0-742-112-r90304-i386.deb. I can not find the older version of Google Chrome on the Google official site. We need search it on the Internet.

The latest version of Firefox can be used. Downloaded from its official website.

I know there are only “WPS Office” and “YOZO Office” can support Chinese well on the Linux platforms. “WPS” can not run on Debian 5. The latest Personal Edition of “YOZO Office”(YozoOffice-7.0-0299.i686.deb) can run on Dedbian 5 smoothly. Need install openjdk-6-jre to run “YOZO Office”.

Thus, this old obsolete computer was recycled ok.

]]>
http://www.learndiary.com/en/2014/12/install-debian-5-on-an-old-computer.htm/feed 0
MobileMate-0.1b1 Released http://www.learndiary.com/en/2014/08/mobilemate-01b1-released.htm http://www.learndiary.com/en/2014/08/mobilemate-01b1-released.htm#respond Fri, 01 Aug 2014 08:41:40 +0000 http://www.learndiary.com/en/?p=212 This is the second public release of MobileMate video and audio converting tool. Based on MobileMate-0.1a42.1, the main changes of MobileMate as below:

1, Code, comment and format optimization:

Rewrote the “MobileMate” main program(/opt/mobilemate) Follow the “Google Shell Style Guide Revision 1.25” (http://google-styleguide.googlecode.com/svn/trunk/shell.xml?p=100).

2, Rewrote logging system:

Added “ERROR”, “INFO”, “DEBUG”, “TRIVAL” logging level. “ERROR” and “INFO” is always available, “DEBUG” and “TRIVAL” can be set in “conf/common.conf”, changed use a single log file to use the separate log file for every task.

3, Updated “libmp3lame.so.0.0.0” from version 3.98.2 to 3.99.5:

Old version will cause MobileMate always report encode failed message in spite of encode mp3 success or fail. Updated to new version fix this bug.

4, Enhanced output file naming:

Align digit in output file name, keep the original input source suffix in the output file name.

5, Added several options in “conf/common.conf”:

Can choose if backup task files(TASKBACKUP) and specify task backup directory (TASKBAKBASE), can specify log directory(LOGBASE).

6, Fixed some MobileMate main program bugs:

  • Fixed the bug of convert the video include subtitile stream to “mkv” file fail by disabled subtitle conversion temporarily;
  • Fixed “negative pad value” bug when choose Libav decoder sometimes;
  • Fixed wrong Display Aspect Ratio(DAR) bug when choose Mencoder decoder sometimes;
  • Fixed the bug when the specified section end before the splitting segment then converting will beyond the specified end time.

7, Fixed some MobileMate OS bugs:

  • Fixed the repository tcz package search function invalid problem (Caused by TinyCore Linux repository server side for old TinyCore) by modify ”/usr/bin/search.sh” and ”/usr/bin/provides.sh”;
  • Fixed the bug of “appbrowser” interface internationalization bug, and this bug also cause tcz package search function bug;
  • Added “src/fltk_projects_unicode-3.7.1.modi.20140723.tar.gz”, it based on “src/fltk_projects_unicode-3.7.1.modi.20130618.tar.gz”, fixed package search bug, enhanced “mkpatch.sh”, added script of compile and install “fltk-1.3” in “Makefile” and “Common.Mk” for fix the bug of install “fltk-1.3-dev.tcz” from repository will cause “fltk_projects_unicode” build fail;
  • Added “src/flwm_topside_unicode-3.7.1.modi.20140723.tar.gz”, it based on “src/flwm_topside_unicode-3.7.1.modi.20130618.tar.gz”,added script of compile and install “fltk-1.3” in “Makefile” for fix the bug of install “fltk-1.3-dev.tcz” from repository will cause “flwm_topside_unicode” build fail.

8, Integrated “mirrors.tcz”, changed default mirror from “http://mirrors.163.com/tinycorelinux/” to “ftp://distro.ibiblio.org/pub/linux/distributions/tinycorelinux/”.

See MobileMate home page for detail: http://www.learndiary.com/mobilemate/

Download page: http://learndiary.com/mobilemate/download

]]>
http://www.learndiary.com/en/2014/08/mobilemate-01b1-released.htm/feed 0
Use OOP Encapsulation Style Write Bash Script http://www.learndiary.com/en/2014/01/oop-encapsulation-write-bash.htm http://www.learndiary.com/en/2014/01/oop-encapsulation-write-bash.htm#respond Tue, 07 Jan 2014 10:55:33 +0000 http://www.learndiary.com/en/?p=208 OOP(Object-Oriented Programming), I am trying some OOP idea to make bash scripting more easier, easy to understand, modify and expand function in the Open Source project: MobileMate. There are three basic OO features: encapsulation, function polymorphism, and inheritance. Here only borrow its encapsulation idea. As a result, for a non-professional in programming, there are more layers, more classes, small class, small function, simple code, more tests in my coding.

Overview
I use converting part of MobileMate V0.1a42.1 code as an example to decription the way of using OOP encapsulation.

The relationship between scripts as below:
Caller: bin/guiconvert.sh
Be Called:
Generate converting scripts:
if convert all files in a folder: share/folderconvertor
if convert a single file:
if use MENCODER to decode: share/convertor
if use LIBAV to decode: share/lconvertor
Execute converting scripts to do the real converting:
share/taskmanager

Caller: share/folderconvertor
Be Called:
if use MENCODER to decode: share/convertor
if use LIBAV to decode: share/lconvertor

Caller: share/lconvertor
Be Called:
if convert to video: share/lv2vconvertor
if convert to audio: share/lx2aconvertor

Also, these scripts call some auxiliary “classes”, for example, “share/configurator” to hundle configuration files, “share/filedetector” to detect file information, “share/helper” holds some utility functions.

A “class”
Here, as an example, I use “share/lconvertor” to describe how I make a bash script class.

The “class”, “share/lconvertor”, the task is converting file to video or audio file using Libav as decoding tool.

There are three data members in “lconvertor”: lconvertor_input, lconvertor_output, lconvertor_option.

lconvertor_input: source file.
lconvertor_output: destination directory.
lconvertor_option: converting options.

There are method(function) members in “lconvertor”: lconvertor_init(), lconvertor_destroy(), lconvertor_set(), lconvertor_get(), lconvertor_is2video(), lconvertor_getvf(), lconvertor_getaf(), lconvertor_doconverts().

lconvertor_init(): initialize data members and maybe some other initialization operations at the begin.
lconvertor_destroy(): data members cleanup and maybe some other cleanup operation at the end.
lconvertor_set(): set the data members.
lconvertor_get(): get the data members’ value.
lconvertor_is2video(): check if the input file is a video or audio.
lconvertor_getvf(): according to the lconvertor_option, form the video filters chain string.
lconvertor_getaf(): according to the lconvertor_option, form the audio filters chain string.
lconvertor_doconverts(): according to the lconvertor_input, lconvertor_output, lconvertor_option, lconvertor_getvf(), lconvertor_getaf(), form the new options for the next layer class to be called, call the lv2vconvertor if converting to a video file and call the lx2aconvertor if converting to an audio file.

Well, you can see every data or method member has a prefix “lconvertor_”, it’s the “class” name. Because in the bash script, the data and method member is all public access, so need a technism to avoid conflict. Although the data member will be set a initial value when import the class “. …/share/lconvertor” or call the lconvertor_init() and lconvertor_destroy(). It’s double ensure avoid variable and function name conflict.

In fact, there are some full implimentations of shell OOP, for example: https://www.usenix.org/legacy/publications/library/proceedings/bos94/full_papers/haemer.ps , A New Object-Oriented Programming Language: sh Jeffrey Haemer, Canary Software, Inc..

Shell script is a useful tool, how to use it finish the job properly, it’s decided by own favorite seriously. With the limited shell scripting skill, and like the code more humanization, I chose oop encapsulation to write shell, and chose more layers, more classes, small class, small function, simple code, and more tests in my coding.

]]>
http://www.learndiary.com/en/2014/01/oop-encapsulation-write-bash.htm/feed 0
Backup http://www.learndiary.com/en/2013/12/backup.htm http://www.learndiary.com/en/2013/12/backup.htm#respond Sat, 14 Dec 2013 04:01:16 +0000 http://www.learndiary.com/en/?p=205 Some data in our computer can’t be lost, the most effective way is backup. This article describe some backup ways I have used. They are: incremental backup web host data, backup web host mysql data, backup Windows data with rsync server, backup Linux data into virtual machine hosted in Windows, using Linux software RAID 1 data redundance scheme .

Incremental backup web host data

For Linux virtual host service, cpanel control system, they provide Security web disk access, but no rsync service. We can mount the web disk, then use rsync incremental backup web data.

I am using root account under Debian Jessie to do this. First install davfs2 “sudo aptitude install davfs2”, create a mount item in “/etc/fstab” like this “https://a.server.com:2123/ /media/webdata davfs noauto,ro 0 0”. Create entry in “/etc/davfs2/secrets” for web disk client access authority like this “/media/webdata username password”, then “sudo chmod 0600 /etc/davfs2/secrets”. Execute “sudo mount /media/webdata” to mount the web disk.

Then, we can use rsync incremental backup web disk files like this “rsync -vzrltopg –delete –progress /media/webdata/html /htmldatabak/”.

Backup web host mysql data
And, we can also backup mysql data when use cpanel control system, first add “ACCESS HOSTS” in “Remote MySQL” menu of Cpanel, for example “1.2.3.4”. Then, we can dump mysql data from this IP machine like this “mysqldump -ha.server.com -udbuser -pdbpassword dbname > dbname.sql”.

Backup Windows data with rsync server
First, you need install a rsync server under Windows, here we choose cwRsync, free edition. Then, if you need authorizing to access Windows rsync server, you need some special setup. For detail see also: Install VNC, SSH, Rsync server on Windows http://www.learndiary.com/en/2013/11/vnc-ssh-rsync-server-on-windows.htm

Backup Linux data into virtual machine hosted in Windows
It seems Windows file system can’t be preserve all the data attribution of Linux data. I simply install a Linux virtual machine in Windows, then use rsync commend in virtual machine to backup another Linux machine data into this virtual machine.

A note about “–exclude” parameter in Rsync command
For example, command line “rsync -avz –exclude ‘f*.txt~’ /home/user/test/source/ /home/user/test/dest/” will exclude any file or directory which match the pattern of ‘f*.txt~’. So, “/home/user/test/source/f1.txt~/2.txt”, the directory “f1.txt~” and all the files and directories(include sub directories recursively) under it will be excluded; and, “/home/user/test/source/f1/f2.txt~”, the file “f2.txt~” will be excluded too. Tested under Debian Jessie.

Using Linux software RAID 1 data redundance scheme
In fact, this is not a backup, but a data redundance scheme mainly used in server. I use two disks create a Linux software RAID 1 partition store the important data, if one disk fail, I can still access data in a degraded RAID 1.

Do you have any other good backup methods? Tell us.

]]>
http://www.learndiary.com/en/2013/12/backup.htm/feed 0
Convert video to DVD – the original of MobileMate http://www.learndiary.com/en/2013/12/convert-video-to-dvd.htm http://www.learndiary.com/en/2013/12/convert-video-to-dvd.htm#respond Thu, 05 Dec 2013 11:54:05 +0000 http://www.learndiary.com/en/?p=194 MobileMate is an Open Source project for converting video/audio, it is customized based on TinyCore Linux, use bash to glue some open source tools to finish its job. The detail see its home page: MobileMate: http://www.learndiary.com/mobilemate/ . There are many softwares for converting video/audio, why create a new one? Briefly, MobileMate is a demo project for easy customizing your own automatical coverting tool. Let’s see the original idea of this project below.

The requirement

A friend of mine, he want convert thousands of low resolution videos(about: 352×288) into DVD.

Seek the existed tools

We tried famous Nero, and Devede(GUI tool), DVDWizard(bash scripts), etc..

Nero and Devede need add videos into a DVD manually, and there are some limitation, such as can’t exceed 7 hours’ video in one DVD, can’t use all the DVD volume, etc..

DVDWizard uses command line parameters to convert exist DVD format videos(mpg) into a DVD automatically, but, it need you calculate every files’ size to ensure the total DVD size will not exceed DVD volume, need convert videos to DVD mpg format first. And, it will generate a screenshot for every video automaticlly, this will slow down the converting speed in our use case.

I estimated the time needed for this converting job, it is about 2 years’ spare time of this friend. So I decided write a tool for this job inspired by DVDWizard.

The work process and effect of my customized tool

At last, I wrote a tool using bash to glue some open source command line tools in the spare time of a month, install it into Ubuntu. And my freind used about 3 months to finish his job successfully.

First, put all videos into a folder, the order is decided by their file name. The tool will read the information of video, calculate the duartion and choose proper bitrate, put them into a DVD with acceptable quality and utilize the maximum volume of the DVD disc. As a result, a DVD can contain about 18 hours’ video. The tool will convert these videos into DVD iso image files into another folder. This process didn’t need the involving of human.

Burn DVD image file into real DVD disc need manual operation yet, just single click on a iso image file, the burning will done.

The technique overview

As said above, this tool use bash to glue some open source command lines to finish the job. They are: FFmpeg, Mencoder, Mplayer, ImageMagick(convert, composite), spumux, dvdauthor, mkisofs, growisofs, vlc, etc..

FFmpeg and Mencoder, Mplayer detect video information and convert video to DVD format mpg file.

ImageMagick make the DVD GUI menu.

Spumux and dvdauthor make the DVD menu, navigation, DVD data structure.

Mkiosfs make DVD data into a DVD iso image file.

Growisofs burn iso onto real DVD disc.

Vlc is good at playing DVD iso image file directly.

Then install a Linux onto machine, setup the tool in operation system. End.

The whole process is no need of manual operation except burn to real DVD. A lightspot is tool can read the information of original file, decide put how many files into a DVD with proper quality automatically. For the common burn software, you need put the files into DVD manually, if total size exceed DVD volume, then you need reduce some files back. This is a very annoying thing.

Install a fresh OS onto machine is a heavy way, so I choose customized a video/audio converting tool based on the TinycoreLinux Live CD as a use case demo. And also create VMWare and VirtualBox virtual machine version. In fact, I recommend use the virtual machine version.

The end

This is an article about how to use Linux and Open Source treasure house make our life ease. And, also the original of MobileMate open source project: http://www.learndiary.com/mobilemate/.

]]>
http://www.learndiary.com/en/2013/12/convert-video-to-dvd.htm/feed 0
Install VNC, SSH, Rsync server on Windows http://www.learndiary.com/en/2013/11/vnc-ssh-rsync-server-on-windows.htm http://www.learndiary.com/en/2013/11/vnc-ssh-rsync-server-on-windows.htm#respond Tue, 26 Nov 2013 08:36:15 +0000 http://www.learndiary.com/en/?p=191 This article records installing some softwares on Windows 7 Home Edition, so I can visit Windows from ohter computers. They are UltraVNC for visit Windows Desktop(No rdp server in Windows Home Edition ), Copssh for visit Windows through SSH, cwRsync for incremental backup Windows files.

UltrVNC:
http://www.uvnc.com/

You can use the Windows Desktop remotely when don’t use it locally at the same time. I configure it through the firewall, but failed, so use firewall advanced configuration open a local port for UltrVNC. See also: Open a Port in Windows 7’s Firewall: http://maximumpcguides.com/windows-7/open-a-port-in-windows-7s-firewall/

Copssh and cwRsync:
https://www.itefix.no/i2/freesoftware

These two servers will be running use an administrator account user, newly created or existed in system already.

There are some tricks for using password visit cwRsync Server running on Windows.
“rsyncd.conf” in server side need set “auth users”, “serets file” and keep “strict modes = true”(the default value), the “secrets file” in server and the “password-file” in guest must only be readable by the user running the cwRsync server. I must mount the folder which include these two files under Windows with “acl” option(Windows’ acl need filesystem support, NTFS is ok, Linux guest need “chmod 0600 “). And, I think it is best to delete all other user’s permission on these two files.

The configuration file example in cwRsync server:

********************************************************
/rsyncd.conf

uid = nobody
gid = nobody
use chroot = false
hosts allow = *
transfer logging = yes
log file = rsyncd.log

[test]
path = /cygdrive/d/test
read only = true
auth users = testor
secrets file = /etc/rsync_scrt/rsyncd.scrt
strict modes = true

********************************************************

/etc/rsync_scrt/rsyncd.scrt

testor:123456

********************************************************

Mount the folder with “acl” option:
Append into: /etc/fstab

C:/Program\040Files\040(x86)/ICW/etc/rsync_scrt /etc/rsync_scrt ntfs override,binary,acl 0 0

********************************************************

Command line example to visit cwRsync Server:

rsync -avz --progress testor@192.168.1.2::test/ ~/test/ --password-file=/etc/rsync_scrt/rsyncd.pass

********************************************************

/etc/rsync_scrt/rsyncd.pass

123456

********************************************************

See also:
How to Get Pro Features in Windows Home Versions with Third Party Tools: http://www.howtogeek.com/124260/

]]>
http://www.learndiary.com/en/2013/11/vnc-ssh-rsync-server-on-windows.htm/feed 0
Leave comment need answer math now http://www.learndiary.com/en/2013/11/leave-comment-need-answer-math.htm http://www.learndiary.com/en/2013/11/leave-comment-need-answer-math.htm#respond Thu, 21 Nov 2013 06:08:12 +0000 http://www.learndiary.com/en/?p=184 For anti-spam, comment on this blog need do a simple math now. I’m sorry for inconvenience.

]]>
http://www.learndiary.com/en/2013/11/leave-comment-need-answer-math.htm/feed 0
Install Linux on Asrock Z87 Pro3 Motherboard http://www.learndiary.com/en/2013/11/linux-on-asrock-z87-pro3.htm http://www.learndiary.com/en/2013/11/linux-on-asrock-z87-pro3.htm#respond Mon, 18 Nov 2013 12:29:13 +0000 http://www.learndiary.com/en/?p=182 It’s lucky, I have installed Debian Linux testing(Jessie) and Fedora 19 on Asrock Z87 Pro3 Motherboard successfully, with i7-4770 Haswell CPU, one single Kingston DDR3 1600 8GB memory,  two West Data WD10EZEX 1T hard disk drivers assembled as Linux software raid. This article is a memo note for me and intend to share for some people.

Before buy:
As we known, Linux is less supported by the desktop hardware companies(even this Z87 board, its official support OS is Windows 7/8). So, purchasing a new desktop computer hardware will face the hardware compatibility problem in Linux sometimes. I do some home work before buying it. Its onboard net card is “Giga PHY Intel® I217V”, onboard sound card is “Realtek ALC892”, both of them has Linux driver in its officical website. 6 intel sata3 interface support intel fake-raid(intel Rapid Storage Technology), I think intel’s product should supported by Linux. So, I bought it. Because I don’t play big game, so I think intel i7-4770’s integerated display card hd4600 should ok.

Install Linux OS:
I have tried install Debian 7.2, Debian Testing(Jessie), Fedora 19 on the hardware.

Original Debian 7.2 is old for this computer, it can’t recognize intel i217v ethernet card, and can’t use cpu’s integrated graphics to enable gnome-shell, so I don’t use it on this computer.

Fedora 19 Live CD works well on this machine, and it is easy to install on this machine within its Live CD desktop environment.

Because I am familiar with Debian, I installed Debian Testing(Jessie) on this machine. It works well too.

I record some key points of mine installing Linux below:

1, Onboard Fake-Raid(here is intel Rapid Storage Technology) v.s. Linux software Raid

The main reazon of Purchasing this Asrock Z87 Pro3 motherboard is I want taste its onboard raid function. I bought two hard disks. For intel Rapid Storage Technology, this Fake-Raid can be set into two separated raid, this can be done by press Ctrl+i enter intel raid setup interface when booting. For example, one is raid0 for speed access disk and another is raid1 for data safe. Fedora 19 Live CD can recognized these two raids and install it on the raid without any broblem. But for install Debian Jessie, need some tricks, see Debian wiki: DebianInstaller SataRaid: https://wiki.debian.org/DebianInstaller/SataRaid

After several days’ struggle, I choose Linux software raid for this machine. three main reasons:

1), Both onboard Fake Raid and Linux software Raid use the CPU do the raid calculating, they have equal performance.

2), Linux Software Raid is more flexible. Combine Raid with LVM, I can adjust raid easily, for example, shriking the LVM on raid0 and extending the LVM on raid1.

3), Just as Debian wiki said in above page, “only if you want to have a dual-boot system with Debian and the other operating system on the same Serial ATA RAID”. For example, you need other OS access your Linux data(I have not tested it here). In my situation, I don’t need other OS visit my Linux data, if I need install other OSes, I can still adjust LVM to empty some raid partition for this easily. My Linux can visit the data in these OSes, if these OSes can recognize Linux software raid and LVM, they can also access data in Linux too.

See also: Intel Matrix Storage Manager vs Linux Software RAID: http://superuser.com/questions/461506/intel-matrix-storage-manager-vs-linux-software-raid

There are also three points about fake raid and software raid:

1), Delete the Intel fake raid in the BIOS raid setup isn’t delete the disk data really, you can still rebuild same type and size raid, then to recover your fake raid;

2), When use Linux software raid, disable NCQ of disk seems necessary. For my case, disable NCQ improve raid0 hdparm read test from about 250 MB/sec to 340 MB/sec(twice of single disk). The command example to close NCQ: “echo 1 > /sys/block/sda/device/queue_depth”. See also: Raid Performance: https://raid.wiki.kernel.org/index.php/Performance ;

3), Install /root on the LVM over Linux software raid is possible, no necessary seperated /boot partition needed, I tested it in the virtual machine with Debian 7.2, both LVM over raid0 and LVM over raid1 is ok, see: DebianInstaller SoftwareRaidRoot: https://wiki.debian.org/DebianInstaller/SoftwareRaidRoot .

In the end, the overview of my disks now is:
Two hard disks, partiting every disk into 21 partitions, the first 20 partitions of two disks formed 20 raid0, and the last partition formed 1 raid1. Then, the first raid0 used as /boot partition(in fact, separated /boot partition isn’t necessary ), later 19 raid0 formed a volume group for fast accessing, and the one raid1 formed a volume group for safe data storing. Then, create logic volume for swap partition, and partitions for mounting /, /home, etc.. Raid1 volume group created a logic volume too.

I think, using this “lvm over raid over multiple partitions” scheme, it is easy to adjust data storing layout. For example, shrink fast access volume group and extend safe data storing volume group.

The main question of installing is settled. The other steps of installing Debian Jessie is similar as before.

2, Wake on Lan over internet

Wake on lan over internet is possible. See: Wake On LAN: https://wiki.debian.org/WakeOnLan . Follow the instruction to set WOL. In Asrock Z87 Pro3 UEFI setup, I must enble “Advanced->ACPI Configuration->PCI Devices On”. I set a static local network ip in “/etc/network/interfaces” for my machine, append “ethernet-wol g” at the end of this config file. Then did a port mapping using UDP protocol in the router, e.g., port 12345, bound the ip with MAC address of onboard intel i217v ethernet card. After I shutdown the machine using Debian’s shutdown menu item, I can wake up the machine over internet, in Linux, I use command line “wakeonlan -i <PULIC IP> -p 12345 <MAC ADDRESS>” to wake up it. Under windows, I use “WakeOnLanGui“: http://www.depicus.com/wake-on-lan/wake-on-lan-gui.aspx , the netmask field should fill “255.255.255.255” when wake up over internet.

3, Virtual Machine installation
I tested VMware Player 6.0.1, VirtualBox 4.3.2, QEMU emulator version 1.1.2 (qemu-kvm-1.1.2+dfsg-6, Debian), both of them works fine in this machine. Gnome-shell is available in the Linux guest OS, e.g., Fedora 19 LiveCD. Another tip, for VMware Player, enble 3D displaying support in guest, need add line “mks.gl.allowBlacklistedDrivers = “TRUE”” into virtual machine configuration file. It is no problem for using Gnome-shell of Linux guest without adding this line, but VMware Player will warn of this.

4, Chinese input methods in VNC Viewer

Start vnc4server in this machine, Fcitx in Wheezy in VNC Viewer will delay about 20 seconds to startup. Fcitx in Testing, Unstable can not work in VNC Viewer simply. Ibus works in VNC Viewer well. But Ibus in Jessie has changed its enabling key, press “Alt + Shift” will circle between all available input methods, and “Shift” will toggle between English and Chinese. I modified /usr/share/im-config/xinputrc.common to start ibus as below:

if [ -n "$SSH_TTY" ]; then
if [ "$DISPLAY" != ":0" ]; then
IM_CONFIG_XINPUTRC_USR=$HOME/.xinputrc.vnc
echo "`date`: I'm in a ssh client: $SSH_TTY  and in a display isn't :0" >> $HOME/xinput.log
fi
fi

The default input method config file ~/.xinputrc filled with “run_im fcitx” and “~/xinputrc.vnc” is “run_im ibus”.

Conclusion:
All in one sentence, Asrock Z87 Pro3 works well with current Linux basically.

]]>
http://www.learndiary.com/en/2013/11/linux-on-asrock-z87-pro3.htm/feed 0
MobileMate ready http://www.learndiary.com/en/2013/09/mobilemate-ready.htm Sun, 15 Sep 2013 02:42:51 +0000 http://www.learndiary.com/en/?p=178 MobileMate is an open source video and audio converting tool customized on Tinycore Linux, released under GNU General Public License version 2.0 (GPLv2). Although its initial is aimed for mobilephone video/audio converting. But it has been developing to a common video/audio converting tool for its powerful back-end open source tool Mplayer and Ffmpeg/Libav.

It use Bash to glue some open source tools such as MPlayer, FFmpeg(Libav), Zenity as GUI, Grep, Sed, etc., easy to modify fit your own needs.

The all detail about it: news, download, installation, using, and devloper’s corner, etc., see its website: MobileMate.

This is an experimental project, it uses TinyCore Linux livecd as a running platform. I need confirm an important question:

Integrate the tool into a livecd is a practicable way to deliver the software?

]]>