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

Monday, January 14, 2013

Python 代码模块八股文


 Python 代码模块八股文
  1. Path and unicode
  2. Module docstr
  3. __author__; __version__
  4. import
  5. Global Variables
  6. Class
  7. Function
  8. __name__=="__main__"

Tuesday, January 8, 2013

Remove advertisement in Foxit Reader

Foxit Reader
Foxit Advertisement Menuchange the default measurement unit:
http://en.kioskea.net/faq/19301-foxit-reader-change-the-default-measurement-units

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


  1. C:/Windows/System32/cmd.exe (run as Administrator)
  2. powercfg -h off (powercfg -h on to turn it on)
  3. 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 called logfile 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 called path 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

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];
            }
        });

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">&lsaquo;</a>
        <a class="carousel-control right" href="#myCarousel" data-slide="next">&rsaquo;</a>
    </div>

Tuesday, December 25, 2012

Python dictionary and zip


  1. len(myDict)
  2. eletment in myDict
  3. for key in myDict:
  4. for key in myDict.keys()
  5. for key, value in myDict.items():
  6. for value in myDict.values():

  1. myDict,ckear()
  2. aDict,update(bDict) - for each key in bDict, updates aDict with that key/value pair

zip() is the built-in function
  1. zip("abc", [1, 2, 3])  --> [(‘a’,1),(‘b’,2),(‘c’,3)] 
  2. 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+NOpens a new window.
Ctrl+TOpens a new tab.
Ctrl+Shift+NOpens 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+TReopens 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+8Switches to the tab at the specified position number on the tab strip.
Ctrl+9Switches to the last tab.
Ctrl+Tab or Ctrl+PgDownSwitches to the next tab.
Ctrl+Shift+Tab or Ctrl+PgUpSwitches to the previous tab.
Alt+F4 or Ctrl + Shift + WCloses the current window.
Ctrl+W or Ctrl+F4Closes 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+HomeOpens your homepage in your current window.

Google Chrome feature shortcuts

Alt+F or Alt+E or F10Opens the Chrome menu Chrome menu, which lets you customize and control settings in Google Chrome.
Ctrl+Shift+BToggles the bookmarks bar on and off.
Ctrl+HOpens the History page.
Ctrl+JOpens the Downloads page.
Shift+EscOpens the Task Manager.
Shift+Alt+TSets focus on the first tool in the browser toolbar. You can then use the following shortcuts to move around in the toolbar:
  • Press Tab, Shift+Tab, Home, End, right arrow, and left arrow to move focus to different items in the toolbar.
  • Press Space or Enter to activate toolbar buttons, including page actions and browser actions.
  • Press Shift+F10 to bring up any associated context menu (e.g. browsing history for the Back button).
  • Press Esc to return focus from the toolbar back to the page.
F6 or Shift+F6Switches focus to the next keyboard-accessible pane. Panes include:
  • Highlights the URL in the address bar
  • Bookmarks bar (if visible)
  • The main web content (including any infobars)
  • Downloads bar (if visible)
Ctrl+Shift+JOpens Developer Tools.
Ctrl+Shift+DeleteOpens the Clear Browsing Data dialog.
F1Opens the Help Center in a new tab (our favorite).
Ctrl+Shift+MSwitch 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+EnterAdds 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+DHighlights the URL.
Ctrl+K or Ctrl+EPlaces 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+BackspaceDeletes 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+PPrints your current page.
Ctrl+SSaves your current page.
F5 or Ctrl+RReloads your current page.
EscStops the loading of your current page.
Ctrl+FOpens the find bar.
Ctrl+G or F3Finds the next match for your input in the find bar.
Ctrl+Shift+GShift+F3, or Shift+EnterFinds 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+F5Reloads your current page, ignoring cached content.
Press Alt and click a link.Downloads the target of the link.
Ctrl+UOpens the source of your current page.
Drag a link to bookmarks barSaves the link as a bookmark.
Ctrl+DSaves your current webpage as a bookmark.
Ctrl+Shift+DSaves all open pages as bookmarks in a new folder.
F11Opens 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+0Returns everything on the page to normal size.
Space barScrolls down the web page.
HomeGoes to the top of the page.
EndGoes to the bottom of the page.
Press Shift and scroll your mousewheel.Scrolls horizontally on the page.

Text shortcuts

Ctrl+CCopies highlighted content to the clipboard.
Ctrl+V or Shift+InsertPastes content from the clipboard.
Ctrl+Shift+VPaste content from the clipboard without formatting.
Ctrl+X or Shift+DeleteDeletes the highlighted content and copies it to the clipboard.

student bid

studentlink -> others -> student sale