Category: Working

工作工作

  • Two python versions in system

    We have some python scripts for scheduled jobs. They are moved from a old machine and work very well automatically and manually. When we moved them to another machine, manually run them works fine. But they don’t work when we put them in corn.

    After some search, there are two python versions in system. One is in /usr/bin and another one is in /usr/local/bin. Hmmm… That’s $PATH problem!

    In bash shell, when we run the scripts manually, they are run by /usr/local/bin/python.

    In cron, they are run by /usr/bin/python. Unfortunately, this version is too old to be compatible with our scripts.

  • Install Eclipse on Ubuntu

    Eclipse Kepler (4.3) is released on June 16, 2013. I want to try it on my Ubuntu 12.04 LTS. Follow these steps for the installation:

    1. Download Eclipse from eclipse.org
    2. Extract the eclipse-xxx-xxx-xxx-linux-gtk-x86_64.tar.gz using
      tar -zxvf eclipse-xxx-xxx-xxx-linux-gtk-x86_64.tar.gz
      
    3. Switch to root
      sudo -i
      
    4. Copy extracted folder to /opt and rename to eclipse_kepler
      cp -r eclipse /opt/eclipse_kepler
      
    5. Create a desktop file and install it.
      gedit eclipse_kepler.desktop
      

      The content of eclipse_kepler.desktop:

      [Desktop Entry]
      Name=Eclipse 
      Type=Application
      Exec=/opt/eclipse_kepler/eclipse
      Terminal=false
      Icon=/opt/eclipse_kepler/icon.xpm
      Comment=Integrated Development Environment
      NoDisplay=false
      Categories=Development;IDE
      Name[en]=Eclipse Kepler
      

      Execute the following command to install it in the unity:

      desktop-file-install eclipse_kepler.desktop
    6. Create a symlink in /usr/local/bin using
      cd /usr/local/bin
      ln -s /opt/eclipse_kepler/eclipse
      
    7. Integrate the Eclipse menu in Unity top panel using
      cd /usr/lib/x86_64-linux-gnu/gtk-2.0/2.10.0/menuproxies && sudo sed -i 's/Eclipse/Xclipse/' libappmenu.so
      
    8. Launch Eclipse
      /opt/eclipse_kepler/eclipse -clean &
      
    9. Lock Eclipse to the launcher bar by clicking right button on Lock to Launcher

    Reference:

  • Hide Users on Welcome Screen in Windows

    If you create some local user accounts in Windows for providing some services, but don’t want to let them show in Welcome Screen. You can add some settings in Windows Registry.

    Windows Registry Editor Version 5.00
    
    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\SpecialAccounts\UserList]
    "cyg_server"=dword:00000000
    
    

    I have tried this in Windows 7 and Windows 2008 R2. It works.
    Google reference: “Hide Users on Welcome Screen in Windows”.

  • Resize Launcher in Unity 2D

    I twittered about the memory usage is fat in Unity 3D. Although my T410 works fine. I still want to try to switch to Unity 2D. After that, the default icon in launcher is too large (48×48) as in Unity 3D. But the rezise bar in Appearance is gone. 

    See the reference post for how to do it.

    Reference: How to resize Launcher in Unity 2D.

  • Markdown in Notepad++ with Perl/Cygwin

    Notepad++ is my primary text editor in Windows and I also have Perl installed in Cygwin.
    To Markdown files under Notepad++ with NppExec plugin, I use following scripts:

    A bash shell script to call Markdown.pl:

    #!/bin/bash
    #c:\cygwin\bin\bash.exe -l "/cygdrive/c/cygwin/home/$USER/Markdown.sh" "$(FULL_CURRENT_PATH)" $(CURRENT_DIRECTORY) $(NAME_PART)
    current_path=<code>cygpath -u $1</code>
    current_dir=<code>cygpath -u $2</code>
    out_file=$current_dir/$3.html
    echo &quot;Markdowning file: &quot;$current_path
    ~/Markdown_1.0.1/Markdown.pl &quot;$current_path&quot; &gt; &quot;$out_file&quot;
    echo &quot;Result file: &quot;$out_file

    The NppExec script:

    c:\cygwin\bin\bash.exe -l &quot;/cygdrive/c/cygwin/home/$(SYS.USERNAME)/Markdown.sh&quot; &quot;$(FULL_CURRENT_PATH)&quot; &quot;$(CURRENT_DIRECTORY)&quot; &quot;$(NAME_PART)&quot;
    NPP_OPEN $(CURRENT_DIRECTORY)\$(NAME_PART).html
    

    The HTML will be opened in Notepad++. I didn’t try to find a way to open it in browser directly yet.

    Reference post: “Markdown in Notepad++