Saturday, January 19, 2013
eclipse C++ full install instruction
http://www3.ntu.edu.sg/home/ehchua/programming/howto/EclipseCpp_HowTo.html
Console2 - A Better Windows Command Prompt
http://www.hanselman.com/blog/Console2ABetterWindowsCommandPrompt.asp
---
I was working on my Mac today and while I maintain that the OS X finder is as effective as shooting your hands fill of Novocaine, I remain envious of the simplicity of their Terminal. Not much interesting has happened in the command prompt world in Windows since, well, ever. I actually blogged about text mode as a missed opportunity in 2004. That post is still valid today, I think. Text is fast. I spend lots of time there and I will race anyone with a mouse, any day.
Save doc as PDF in bulk (JavaScript +Powershell)
SaveAsPDF.js
var fso = new ActiveXObject("Scripting.FileSystemObject");
var docPath = WScript.Arguments(0);
docPath = fso.GetAbsolutePathName(docPath);
var pdfPath = docPath.replace(/\.doc[^.]*$/, ".pdf");
var objWord = null;
Tuesday, January 15, 2013
Install StatET in Eclipse
http://www.walware.de/it/downloads/rj.mframe
eclipse -> help -> install new software -> input the url above -> select all -> next ...
done
eclipse -> help -> install new software -> input the url above -> select all -> next ...
done
Monday, January 14, 2013
Python 代码模块八股文
Python 代码模块八股文
- Path and unicode
- Module docstr
- __author__; __version__
- import
- Global Variables
- Class
- Function
- __name__=="__main__"
Tuesday, January 8, 2013
Remove advertisement in Foxit Reader
Sunday, January 6, 2013
VMware 8 hide toolbar edge
Edit > Preferences > Display > Uncheck "Show toolbar edge when unpinned in full screen" you'll be all set!
Wednesday, January 2, 2013
Turn off Hibernate Windows 8
- C:/Windows/System32/cmd.exe (run as Administrator)
- powercfg -h off (powercfg -h on to turn it on)
- Will free up space of 75% of RAM
Tuesday, January 1, 2013
Simple Python Script in UNIX calculating the number of PHP session files
This script reads the number of PHP session files in your server's /tmp directory, then writes a summary report to a log file.
#!/usr/bin/python import os from time import strftime stamp = strftime("%Y-%m-%d %H:%M:%S") logfile = '/path/to/your/logfile.log' path = '/path/to/tmp/directory/' files = os.listdir(path) bytes = 0 numfiles = 0 for f in files: if f.startswith('sess_'): info = os.stat(path + f) numfiles += 1 bytes += info[6] if numfiles > 1: title = 'files' else: title = 'file' string = stamp + " -- " + str(numfiles) + " session " \ + title +", " + str(bytes) + " bytes\n" file = open(logfile,"a") file.writelines(string) file.close()
Listing 12 shows the entire script. Open an editor, and paste the code into it and save the file as tmp.py somewhere on your system. Then run chmod + x
on that file to make it executable
Next, create a variable calledlogfile
and put in a path to a file (it doesn't need to exist yet) where you'll actually store log file messages. For simplicity, I put log files in a /logs folder, but you could put them anywhere. Similarly, you need a variable calledpath
that contains the path to your /tmp directory. It can be any path you want as long as you end it with a trailing slash (/
).
Monday, December 31, 2012
add Python to windows 8
D:\Program Files (x86)\python273;D:\Program Files (x86)\python273\Lib\lib-tk;D:\Program Files (x86)\python273\DLLs;D:\Program Files (x86)\python273\Lib;
google chart tools
in the Google Chart Tools documentation:
Options: hAxis.showTextEvery
in the code
new google.visualization.LineChart(document.getElementById('block_line_visualization')).
draw(data, { title: "y-axis: Quantity | x-axis: Time-Frame",
width: 700, height: 700,
vAxis: {maxValue: 6},
hAxis: {showTextEvery:1}
}
);
Sunday, December 30, 2012
Windows 8 Use touchpad while “typing
http://superuser.com/questions/504571/use-touchpad-while-typing
synpnatics:
in the mouse setting, set the palm check to minimum
synpnatics:
in the mouse setting, set the palm check to minimum
Saturday, December 29, 2012
Aggregate Function in Djano Model
>>> from terminal_app.models import CntrOffload
>>> from django.db.models import Min
>>> CntrOffload.objects.aggregate(Min('exec_datetime'))
{'exec_datetime__min': datetime.datetime(2012, 12, 22, 0, 16, 28)}
>>> CntrOffload.objects.filter(vv_c='4588').aggregate(Min('exec_datetime'))
{'exec_datetime__min': datetime.datetime(2012, 12, 26, 3, 30, 32)}
>>>
Bootstrap grid with {%ifchanged xx%}
<div>
<div class="row-fluid"></div> #otherwise not in position
{% for block in blocks %}
{% if forloop.counter|divisibleby:"6" %}
<div class="row">
{% endif %}
{% ifchanged block.code %}
<div class="span2">
{{ block.code }}
</div>
{% endifchanged %}
{% if forloop.counter|divisibleby:"6" %}
</div>
{% endif %}
{% endfor %}
</div>
Thursday, December 27, 2012
datepicker Enable Specific Dates
http://codeasp.net/blogs/raghav_khunger/microsoft-net/1087/jquery-datepicker-enable-specific-dates
dict['dateObjs'] = AvailableDate.objects.all()
<script type="text/javascript">
$(function () {
//'12-22-2012'
var daysToEnable = [
{% for dateObj in dateObjs %}
'{{ dateObj.date|date:"m-d-Y"}}'{% if not forloop.last %},{% endif %}
{% endfor %}
];
$('#datepicker').datepicker({
beforeShowDay: enableSpecificDates,
dateFormat: 'M. dd, yy'
});
function enableSpecificDates(date) {
var month = date.getMonth();
var day = date.getDate();
var year = date.getFullYear();
for (i = 0; i < daysToEnable.length; i++) {
if ($.inArray((month + 1) + '-' + day + '-' + year, daysToEnable) != -1) {
return [true];
}
}
return [false];
}
});
dict['dateObjs'] = AvailableDate.objects.all()
<script type="text/javascript">
$(function () {
//'12-22-2012'
var daysToEnable = [
{% for dateObj in dateObjs %}
'{{ dateObj.date|date:"m-d-Y"}}'{% if not forloop.last %},{% endif %}
{% endfor %}
];
$('#datepicker').datepicker({
beforeShowDay: enableSpecificDates,
dateFormat: 'M. dd, yy'
});
function enableSpecificDates(date) {
var month = date.getMonth();
var day = date.getDate();
var year = date.getFullYear();
for (i = 0; i < daysToEnable.length; i++) {
if ($.inArray((month + 1) + '-' + day + '-' + year, daysToEnable) != -1) {
return [true];
}
}
return [false];
}
});
Popover
<a href="#" class="btn btn-primary btn-small changeButton"
rel="popover" data-placement="bottom"
data-html="true"
data-content="
<form action='/start/' method='post'>{% csrf_token %}
<fieldset>
<legend>Date Selection</legend>
<label>date:
<input type='text' id='datepicker' name='date' placeholder='date of view'>
</label>
<button type='submit' class='btn btn-primary btn-small' value='submit'>Submit</button>
</fieldset>
</form>"
>
Change</a>
ajax
loading page
loading animation
http://jsfiddle.net/VpDUG/1844/
Wednesday, December 26, 2012
Bootstrap Carousel
<div id="myCarousel" class="carousel slide">
<!-- Carousel items -->
<div class="carousel-inner">
<div class="active item">
<img src="http://www.act.com.hk/images/en_leading06_psa.jpg" alt="">
<div class="carousel-caption">
<h4>First Thumbnail label</h4>
<p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p>
</div>
</div>
<div class="item">
</div>
<div class="item">
</div>
</div>
<!-- Carousel nav -->
<a class="carousel-control left" href="#myCarousel" data-slide="prev">‹</a>
<a class="carousel-control right" href="#myCarousel" data-slide="next">›</a>
</div>
Tuesday, December 25, 2012
Python dictionary and zip
- len(myDict)
- eletment in myDict
- for key in myDict:
- for key in myDict.keys()
- for key, value in myDict.items():
- for value in myDict.values():
- myDict,ckear()
- aDict,update(bDict) - for each key in bDict, updates aDict with that key/value pair
zip() is the built-in function
- zip("abc", [1, 2, 3]) --> [(‘a’,1),(‘b’,2),(‘c’,3)]
- dict(zip("abc", [1, 2, 3]) -->{'a': 1, 'c': 3, 'b': 2}
aString = "\n".join(aList)
aList = aString.split("\n")
OrderedDict
reports = collections.OrderedDict()
the OrderedDict will remember the sequence of key insertion
Chrome Shortcuts on Windows
source: https://support.google.com/chrome/bin/answer.py?hl=en&answer=157179
Tab and window shortcuts
Ctrl+N | Opens a new window. |
Ctrl+T | Opens a new tab. |
Ctrl+Shift+N | Opens a new window in incognito mode. |
Press Ctrl+O, then select file. | Opens a file from your computer in Google Chrome. |
Press Ctrl and click a link. Or click a link with your middle mouse button (or mousewheel). | Opens the link in a new tab in the background . |
Press Ctrl+Shift and click a link. Or pressShift and click a link with your middle mouse button (or mousewheel). | Opens the link in a new tab and switches to the newly opened tab. |
Press Shift and click a link. | Opens the link in a new window. |
Ctrl+Shift+T | Reopens the last tab you've closed. Google Chrome remembers the last 10 tabs you've closed. |
Drag a link to a tab. | Opens the link in the tab. |
Drag a link to a blank area on the tab strip. | Opens the link in a new tab. |
Drag a tab out of the tab strip. | Opens the tab in a new window. |
Drag a tab out of the tab strip and into an existing window. | Opens the tab in the existing window. |
Press Esc while dragging a tab. | Returns the tab to its original position. |
Ctrl+1 through Ctrl+8 | Switches to the tab at the specified position number on the tab strip. |
Ctrl+9 | Switches to the last tab. |
Ctrl+Tab or Ctrl+PgDown | Switches to the next tab. |
Ctrl+Shift+Tab or Ctrl+PgUp | Switches to the previous tab. |
Alt+F4 or Ctrl + Shift + W | Closes the current window. |
Ctrl+W or Ctrl+F4 | Closes the current tab or pop-up. |
Click a tab with your middle mouse button (or mousewheel). | Closes the tab you clicked. |
Right-click, or click and hold either the Back or Forward arrow in the browser toolbar. | Displays your browsing history in the tab. |
Press Backspace, or Alt and the left arrow together. | Goes to the previous page in your browsing history for the tab. |
Press Shift+Backspace, or Alt and the right arrow together. | Goes to the next page in your browsing history for the tab. |
Press Ctrl and click either the Back arrow, Forward arrow, or Go button in the toolbar. Or click either button with your middle mouse button (or mousewheel). | Opens the button destination in a new tab in the background. |
Double-click the blank area on the tab strip. | Maximizes or minimizes the window. |
Alt+Home | Opens your homepage in your current window. |
Google Chrome feature shortcuts
Alt+F or Alt+E or F10 | Opens the Chrome menu |
Ctrl+Shift+B | Toggles the bookmarks bar on and off. |
Ctrl+H | Opens the History page. |
Ctrl+J | Opens the Downloads page. |
Shift+Esc | Opens the Task Manager. |
Shift+Alt+T | Sets focus on the first tool in the browser toolbar. You can then use the following shortcuts to move around in the toolbar:
|
F6 or Shift+F6 | Switches focus to the next keyboard-accessible pane. Panes include:
|
Ctrl+Shift+J | Opens Developer Tools. |
Ctrl+Shift+Delete | Opens the Clear Browsing Data dialog. |
F1 | Opens the Help Center in a new tab (our favorite). |
Ctrl+Shift+M | Switch between multiple users. |
Address bar shortcuts
Use the following shortcuts in the address bar:Type a search term, then press Enter. | Performs a search using your default search engine. |
Type a search engine keyword, press Space, type a search term, and press Enter. | Performs a search using the search engine associated with the keyword. |
Begin typing a search engine URL, press Tabwhen prompted, type a search term, and press Enter. | Performs a search using the search engine associated with the URL. |
Ctrl+Enter | Adds www. and .com to your input in the address bar and open the resulting URL. |
Type a URL, then press Alt+Enter. | Opens the URL in a new tab. |
Ctrl+L or Alt+D | Highlights the URL. |
Ctrl+K or Ctrl+E | Places a '?' in the address bar. Type a search term after the question mark to perform a search using your default search engine. |
Press Ctrl and the left arrow together. | Moves your cursor to the preceding key term in the address bar |
Press Ctrl and the right arrow together. | Moves your cursor to the next key term in the address bar |
Ctrl+Backspace | Deletes the key term that precedes your cursor in the address bar |
Select an entry in the address bar drop-down menu with your keyboard arrows, then pressShift+Delete. | Deletes the entry from your browsing history, if possible. |
Click an entry in the address bar drop-down menu with your middle mouse button (or mousewheel). | Opens the entry in a new tab in the background. |
Press Page Up or Page Down when the address bar drop-down menu is visible. | Selects the first or last entry in the drop-down menu. |
Webpage shortcuts
Ctrl+P | Prints your current page. |
Ctrl+S | Saves your current page. |
F5 or Ctrl+R | Reloads your current page. |
Esc | Stops the loading of your current page. |
Ctrl+F | Opens the find bar. |
Ctrl+G or F3 | Finds the next match for your input in the find bar. |
Ctrl+Shift+G, Shift+F3, or Shift+Enter | Finds the previous match for your input in the find bar. |
Click the middle mouse button (or mousewheel). | Activates auto-scrolling. As you move your mouse, the page automatically scrolls according to the direction of the mouse. |
Ctrl+F5 or Shift+F5 | Reloads your current page, ignoring cached content. |
Press Alt and click a link. | Downloads the target of the link. |
Ctrl+U | Opens the source of your current page. |
Drag a link to bookmarks bar | Saves the link as a bookmark. |
Ctrl+D | Saves your current webpage as a bookmark. |
Ctrl+Shift+D | Saves all open pages as bookmarks in a new folder. |
F11 | Opens your page in full-screen mode. PressF11 again to exit full-screen. |
Ctrl and +, or press Ctrl and scroll your mousewheel up. | Enlarges everything on the page. |
Ctrl and -, or press Ctrl and scroll your mousewheel down. | Makes everything on the page smaller. |
Ctrl+0 | Returns everything on the page to normal size. |
Space bar | Scrolls down the web page. |
Home | Goes to the top of the page. |
End | Goes to the bottom of the page. |
Press Shift and scroll your mousewheel. | Scrolls horizontally on the page. |
Text shortcuts
Ctrl+C | Copies highlighted content to the clipboard. |
Ctrl+V or Shift+Insert | Pastes content from the clipboard. |
Ctrl+Shift+V | Paste content from the clipboard without formatting. |
Ctrl+X or Shift+Delete | Deletes the highlighted content and copies it to the clipboard. |
Subscribe to:
Posts (Atom)