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 (/).