Sunday 12 July 2015

second x11 server

I am trying to make a second X sesstion over ssh.

http://unix.stackexchange.com/questions/85383/how-to-start-a-second-x-session
http://unix.stackexchange.com/questions/85383/how-to-start-a-second-x-session
solution:

run startx -- :1


  1. adfasdf
  2. 1232131


  3. adfasdf

    Tuesday 7 July 2015

    paraview study

    the reason I decided to start looking at paraview is that it gives a flexible view on the meshes and all other things.

    view the meshing numbers:
    1. at the layout window choose select mesh. then use click and drag to select the desired cells
    2. tab view -> selection display inspector
    3. at the newly opened selection display inspect-> cell labels, then choose the one to display

    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.