Thanks to this Sublime Java Compiler below:
1. Clone this to the Sublime Package:
https://github.com/psychowico/SublimeJavaCompiler
Which you can find it from the menu bar of Sublime: Preferences -> Browse Packages
2. Change the settings according to the Wiki of the Github project
Then it works!!
HiddenGhost-Shijie Xu
Remember My Little Forgettable Tips
Saturday, January 18, 2014
Saturday, November 9, 2013
Quick Sort
# -*- coding:utf-8 -*-
#!/usr/bin/python2
"""
===================================================
Merge Sort
Shijie Xu <xushijie520@gmail.com>
Created on Mon, Nov 9, 2013
===================================================
"""
L = [3, 5, 7, 8, 1, 9, 2, 4, 6, 123, 12, 19, 123123]
def QuickSort(m):
if len(m) < 2:
return m
else:
target = m.pop(0)
L1 = []
L2 = []
for item in m:
if item <= target:
L1.append(item)
else:
L2.append(item)
L1.append(target)
L = QuickSort(L1) + QuickSort(L2)
return L
result = QuickSort(L)
print result
#!/usr/bin/python2
"""
===================================================
Merge Sort
Shijie Xu <xushijie520@gmail.com>
Created on Mon, Nov 9, 2013
===================================================
"""
L = [3, 5, 7, 8, 1, 9, 2, 4, 6, 123, 12, 19, 123123]
def QuickSort(m):
if len(m) < 2:
return m
else:
target = m.pop(0)
L1 = []
L2 = []
for item in m:
if item <= target:
L1.append(item)
else:
L2.append(item)
L1.append(target)
L = QuickSort(L1) + QuickSort(L2)
return L
result = QuickSort(L)
print result
Merge Sort
# -*- coding:utf-8 -*-
#!/usr/bin/python2
"""
=====================================================
Merge Sort
Shijie Xu <xushijie520@gmail.com>
Created on Mon, Nov 9, 2013
=====================================================
"""
L = [7, 10, 5, 8, 1, 3, 2, 4, 6, 9]
def merge(x, y):
L = []
while (len(x) > 0) and (len(y) > 0):
if x[0] < y[0]:
L.append(x[0])
x.pop(0)
else:
L.append(y[0])
y.pop(0)
L += x if len(x) > 0 else y
return L
def msort(m):
if len(m) < 2:
return m
else:
mid = len(m) // 2
L1 = msort(m[:mid])
L2 = msort(m[mid:])
l_result = merge(L1, L2)
return l_result
reuslt = msort(L)
print reuslt
#!/usr/bin/python2
"""
=====================================================
Merge Sort
Shijie Xu <xushijie520@gmail.com>
Created on Mon, Nov 9, 2013
=====================================================
"""
L = [7, 10, 5, 8, 1, 3, 2, 4, 6, 9]
def merge(x, y):
L = []
while (len(x) > 0) and (len(y) > 0):
if x[0] < y[0]:
L.append(x[0])
x.pop(0)
else:
L.append(y[0])
y.pop(0)
L += x if len(x) > 0 else y
return L
def msort(m):
if len(m) < 2:
return m
else:
mid = len(m) // 2
L1 = msort(m[:mid])
L2 = msort(m[mid:])
l_result = merge(L1, L2)
return l_result
reuslt = msort(L)
print reuslt
Sunday, October 6, 2013
Seattle
This is a Learning Journal of the Seattle in CS program in New York University.
1) Local Test Mechanism
python repy.py restrictions.test <Your repy files>
2) Login to the Seattle
1) Local Test Mechanism
python repy.py restrictions.test <Your repy files>
2) Login to the Seattle
- python seash.py
- !> loadkeys <username> # load the the key information of the user
- !> as <username> # login as the user
- <username>@ !>
a) browse
# Browse the available resources in the Seattle.
b) on browsegood
# Use the resources which are working in good condition
c) run <Your repy files in your local path>
# Run the program
d) show log
# Show the result of what the program have executed
e) list
# List the information of the vessel that you own or control
4) Specific Functions & Variables in Seattle
You can refer to the webpage:
https://seattle.poly.edu/wiki/RepyApi#waitforconnlocaliplocalportfunction
mycontext: It is a dictionary type provided for the global variables
eg: mycontext['global_variables'] = 'This is a global varible'
settimer(waittime, function, arg): Set a timer that when it expires will start a new thread to call a function with a set of arguments. The thread is charged to your problem when you set the timer instead of when the timer fires. This function returns a timer handle that may be used to cancel the timer before the thread is started.
You can refer to the webpage:
https://seattle.poly.edu/wiki/RepyApi#waitforconnlocaliplocalportfunction
mycontext: It is a dictionary type provided for the global variables
eg: mycontext['global_variables'] = 'This is a global varible'
settimer(waittime, function, arg): Set a timer that when it expires will start a new thread to call a function with a set of arguments. The thread is charged to your problem when you set the timer instead of when the timer fires. This function returns a timer handle that may be used to cancel the timer before the thread is started.
Tuesday, August 27, 2013
Sublime Installation on Ubuntu
1. Download the Sublime Text for Linux version from the official website.
2. Extract the .bz2 format file to the location where you must can find.
3. Move the sublime folder to /opt/
sudo mv Sublime\ Text\ 2 /opt/
4. At some point you'd want to be able to call Sublime Text from the Terminal by just typing 'sublime'. To do that, we'll just create a symbolic link in '/usr/bin' like this:
sudo ln -s /opt/Sublime\ Text\ 2/sublime_text/ usr/bin/sublime
5. Create a launcher in Unity. To do this, we create a .desktop file in '/usr/share/applications/sublime.desktop'
Edit the config files below:
sudo sublime /usr/share/applications/sublime.desktop
paste the following content in the file:
[Desktop Entry]
Name=Sublime Text 2
# Only KDE 4 seems to use GenericName, so we reuse the KDE strings.
# From Ubuntu's language-pack-kde-XX-base packages, version 9.04-20090413.
GenericName=Text Editor
Exec=sublime
Terminal=false
Icon=/opt/Sublime Text 2/Icon/48x48/sublime_text.png
Type=Application
Categories=TextEditor;IDE;Development
X-Ayatana-Desktop-Shortcuts=NewWindow
[NewWindow Shortcut Group]
Name=New Window
Exec=sublime -n
TargetEnvironment=Unity
OK, you have installed the MOST powerful editor in the world....lol
2. Extract the .bz2 format file to the location where you must can find.
3. Move the sublime folder to /opt/
sudo mv Sublime\ Text\ 2 /opt/
4. At some point you'd want to be able to call Sublime Text from the Terminal by just typing 'sublime'. To do that, we'll just create a symbolic link in '/usr/bin' like this:
sudo ln -s /opt/Sublime\ Text\ 2/sublime_text/ usr/bin/sublime
5. Create a launcher in Unity. To do this, we create a .desktop file in '/usr/share/applications/sublime.desktop'
Edit the config files below:
sudo sublime /usr/share/applications/sublime.desktop
paste the following content in the file:
[Desktop Entry]
Name=Sublime Text 2
# Only KDE 4 seems to use GenericName, so we reuse the KDE strings.
# From Ubuntu's language-pack-kde-XX-base packages, version 9.04-20090413.
GenericName=Text Editor
Exec=sublime
Terminal=false
Icon=/opt/Sublime Text 2/Icon/48x48/sublime_text.png
Type=Application
Categories=TextEditor;IDE;Development
X-Ayatana-Desktop-Shortcuts=NewWindow
[NewWindow Shortcut Group]
Name=New Window
Exec=sublime -n
TargetEnvironment=Unity
OK, you have installed the MOST powerful editor in the world....lol
Saturday, April 27, 2013
Greek and Roman Mythology on Coursera
Small tips:
- Agamemnon is air, Archilles is the sun, Helen is the earth, Hector is the moon. But among the gods, Demeter is the liver, Dionysus is the spleen, and Apollo the bile.--<Metrodorus of Lampsacus>
Thursday, March 28, 2013
Ubuntu Apt Error
昨天装wps装毁了...结果apt update就error了,怎么修复呢?
如下:
sudo gedit /var/lib/dpkg/status
Delete the WPS-office block
然后一切似乎就科学了~
sudo apt-get update
sudo apt-get upgrade
如下:
sudo gedit /var/lib/dpkg/status
Delete the WPS-office block
然后一切似乎就科学了~
sudo apt-get update
sudo apt-get upgrade
Subscribe to:
Posts (Atom)