Thursday 25 June 2015

touch2 progress.

got code. once compiled using proveded makefile, it says:
it can not accept 1e50
which can be get around by.
-fdefault-real-8

at the moment file libaztec.a is missing.
a request is submitted for downloading


Friday 19 June 2015

try to use latex to update blogs

$\Psi$ \[ \begin{align} \nabla \times \vec{\mathbf{B}} -\, \frac1c\, \frac{\partial\vec{\mathbf{E}}} {\partial t} & = \frac{4\pi}{c}\vec{\mathbf{j}} \\ \nabla \cdot \vec{\mathbf{E}} & = 4 \pi \rho \\ \nabla \times \vec{\mathbf{E}}\, +\, \frac1c\, \frac{\partial\vec{\mathbf{B}}}{\partial t} & = \vec{\mathbf{0}} \\ \nabla \cdot \vec{\mathbf{B}} & = 0 \end{align} \]
asdfdsafsa \chapter{} \section{INTRODUCTION} \textbf{Duration}: January 2014 to Continuing \textbf{Name of the Employer}: School of Civil Engineering \textbf{Designation}: Research \section{BACKGROUND} \N Urban network sewage network serves

Monday 8 June 2015

openbox study

To get used to another window manager that is desktop-metaphor-based, I decided to have a further dig on Openbox that is able to stand in parallel with i3wm. here are the updates.

(1) tint2 is found to work very well with openbox. tint2 provides a taskbar at the bottom of the screen, which makes the desktop very much like windows.
(2) the following script works perfectly as keyboard short cut.
should be stored at .config/openbox/rc.xml (see ubuntu in toshiba)
The time I spent to configure it is that the W-left should be stored at the end of the keybinding list.

(3) Current problem: one of the reasons I want to use this method is that I can work at home in a windows-based machine, using tightvnc based command. however, windows is heavily relying on the windows key, which makes the keybindings at the tightvnc useless. TO 13-06-08



Sunday 7 June 2015

tightvnc and vino study

I decide to work on vnc due to the necessary to work at home using the graphic interface. I think the main reason to display the whole thing remotely is because X11 forward is still too slow, at least for matlab figures.


1. Install vnc.
# Make sure Debian is the latest and greatest:
# be noticed
# http://raspberrypi.stackexchange.com/questions/4474/tightvnc-copy-paste-between-local-os-and-raspberry-pi
apt-get install xorg lxde-core tightvncserver 

# Start VNC to create config file for password (run as a normal user)
tightvncserver :1
# Then stop VNC
tightvncserver -kill :1
# Edit config file to start session with LXDE:
vim ~/.vnc/xstartup
# Add this at the bottom of the file:

#!/bin/sh
xrdb $HOME/.Xresources
#xsetroot -solid grey
#x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
#x-window-manager &
# Fix to make GNOME work
export XKL_XMODMAP_DISABLE=1
#/etc/X11/Xsession
#lxterminal &
#/usr/bin/lxsession -s LXDE &
exec openbox-session &
#--------------  openbox -----------------------------
#!/bin/sh
xrdb $HOME/.Xresources
xsetroot -solid grey
x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
openbox &
# ------   working for twm  ------
xrdb $HOME/.Xresources
xsetroot -solid grey
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
twm &
# --------------------- a working solution for i3----------------------------
xrdb $HOME/.Xresources
xsetroot -solid grey
x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
i3 &


and make sure this file is executable.


# Restart VNC
tightvncserver :1   # working for a debian distro but not on gentoo distributions..

for the client, the things that are needed to execute is
1. openup vnc, for example the app within chrome and input
192.168.0.4::5901


for the office (gentoo) machine, i use
 vncviewer ae429-1105:1  #from a ssh that connects to office.

vncserver :1 -geometry 1440x900 -depth 24  # start the server
pkill Xvnc # stop
vncserver -geometry  1680x1010 -depth 24 :1  # works perfectly with office machine

2. Solving X11 forward problem when using tightvnc combining with tmux.
The problem of using this conbination is that at tightvnc when attaching a seesion that was used to be working locally (i.e., DISPLAY=:0), all the X11 pops out locally rather than the window from tightvnc. The way of solving such problem is:
a. check "echo $DISPLAY" at the terminal in tightvnc window.
b. attach tmux sessions
c. change DISPLAY variable into the value displayed in a. e.g., "export DISPLAY=:1"

This may indicate that every time there is a swich of change working environment (from local use to ssh). one needs to change the environment variables.
more reading http://unix.stackexchange.com/questions/75681/why-do-i-have-to-re-set-env-vars-in-tmux-when-i-re-attach

3. Is vino a good package?
it should be pointed out that ubuntu uses Vino to do the remote connecting stuff. which is albeit identical to the desktop, very slow comparing with tightvnc (pretty much like qq remote).
the way to setup such connections is
a. type vino-preferences and enable desktopsharing ability.
b. tricky part : apt-get install dconf-tool, then find org->gnome->desktop->applications->remote-access-> deselect require-encryption.
c. use vnc application to remote connecting the desktop.

4. scalling in tightvnc viewer.
It is found that tightvnc viewer does not support dynamically changing resolution, but in windows tightvncviewer, one can scale the resolution to satisfy the change of the screen, which is pretty convinent.

5. working seamlessly with termserv.
Somehow the termserv machine does not support directly connecting to 5901 port, which is the default port for tightvnc. but I have made a way to workaround.
1. open putty->tunnel->sourceport 5901, destination 127.0.0.1:5901, choose local, choose auto.
2. go to tightvncviewer, choose127.0.0.1:5901. then you should be able to see the result perfectly.
in tightvncviewer, one can scale the size of the window so changing resolution dynamicly is not a issue at all.
6. working seamlessly with linux
the problem using linux as a client to control a vnc client is that, one has to remap some of the keys (e.g., win key) so that the host machine and guest machine has individual keys representing their functions. (e.g., user does not want to press win buttom with both host and client behaving the same as press win, instead, one key has to be working for host machine and another one for guest).

resolving this problem requires knowledge of the desktop environment on both client and host machine. this paragraph only works for the situation where client has i3wm (using mod4 as function key).

if server is openbox, one can add the following script to rc.xml for achieving aerosnap:
<keybind key="C-Left">        # HalfLeftScreen
      <action name="UnmaximizeFull"/>
      <action name="MoveResizeTo"><x>0</x><y>0</y><height>97%</height><width>50%</width></action>
    </keybind>
    <keybind key="C-Right">        # HalfRightScreen
      <action name="UnmaximizeFull"/>
      <action name="MoveResizeTo"><x>-0</x><y>0</y><height>97%</height><width>50%</width></action>
    </keybind>
 if server is i3wm then one can change the mod key as right window key.
note that openbox and i3wm is not the same in terms of master key. for i3wm, one can assign a key as master key, so if one is able to map the master key to another key, problem gets solved. Instead, openbox always use 'absolute address' to define a key (C represents control, W represents windows key). this is a bit difficult to change, unless one define and keybinding that does not conflict with other keybindings, just like the snippet above.




Saturday 6 June 2015

mac os study

Bought mac for my wife as the previous pc was almost 6 years old. the other reason is that i can really look into how posix is applied among different os.
seriously a linux/unix user does not feel and problem in using mac system at all. Instead, from my experience, Unity and gnome3 is just a free replica of mac system!!!  here is the list about how i improve the mac machines.

(1) To make directory paths visible atop Finder windows, open Terminal.app (/Applications/Utilities/) and type the following command:

defaults write com.apple.finder _FXShowPosixPathInTitle -bool YES


(2) never use the file system with case sensitive function as some of the applications (e.g., adobe apps) does not support case sensitive journals.



(3) make terminal more good looking..
follow this website: (http://osxdaily.com/2013/02/05/improve-terminal-appearance-mac-os-x/)
execute the following command in terminal:

export PS1="\[\033[36m\]\u\[\033[m\]@\[\033[32m\]\h:\[\033[33;1m\]\w\[\033[m\]\$ "
export CLICOLOR=1
export LSCOLORS=ExFxBxDxCxegedabagacad
alias ls='ls -GFh'


(4) how to cut files:

just copy by command+c
then go to the destinations, using command+option+v to paste files.

(5) at the moment ntfs driver is not able to write. also my ext 4 journal is not able to be read and mount.
solution: install macfuse and ntfs-3g

(6) once a x application is opened from sshed terminal, the x application starts to boot and exit loop.
solution:

https://xquartz.macosforge.org/trac/ticket/589
rm -rf /tmp/.X11-unix
mkdir /tmp/.X11-unix

Thursday 4 June 2015

flopy

install:
pip install flopy --upgrade

i got stuck to set the path for modflow execution.
it seems that the executional file


>>> mf = flopy.modflow.Modflow(modelname, exe_name='mf2005')
>>> success, buff = mf.run_model()
FloPy is using the following executable to run the model: mf2005
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python2.7/site-packages/flopy/mbase.py", line 375, in run_model
    stdout=sp.PIPE, cwd=self.model_ws)
  File "/usr/lib64/python2.7/subprocess.py", line 710, in __init__
    errread, errwrite)
  File "/usr/lib64/python2.7/subprocess.py", line 1335, in _execute_child
    raise child_exception


OSError: [Errno 2] No such file or directory