Archive for April, 2010

5分钟搞定翻 墙

1.注册macrovpn并登录

http://billing.macrovpn.com/user.php?cont=login

wps_clip_image-128

http://www.free-vpn.info/macrovpn/

wps_clip_image-216

http://www.free-vpn.info/windows-xp-pptp-vpn/

wps_clip_image-330

wps_clip_image-332

2,在xp上新建一个vpn连接

最方便的代理方式为pptp vpn连接,不需要客户端,在xp下面直接设置一下就可以通过VPN上网了。详细步骤如下图:

wps_clip_image-409

wps_clip_image-411

wps_clip_image-413

wps_clip_image-415

wps_clip_image-417

wps_clip_image-419

wps_clip_image-421

这样就已经链接成功了。

3,修改vpn,本地连接/或无线连接)的dns

把vpn连接的dns都改为国外的

wps_clip_image-476

wps_clip_image-478

同样的把本地连接或者无线连接的dns都改为国外的

美国:

208.67.222.222

208.67.220.220

165.87.13.129

165.87.201.244

205.171.3.65

205.171.2.65

198.41.0.4

198.41.0.4

198.32.64.12

192.33.4.12

192.203.230.10

192.5.5.241

192.112.36.4

192.36.148.17

192.58.128.30

192.9.9.3

193.0.14.129

128.9.0.107

128.8.10.90

66.33.206.206.

208.96.10.221

66.33.216.216

205.171.3.65

205.171.2.65

165.87.13.129

165.87.201.244

wps_clip_image-881

到此,如果能ping通tw itter.com,基本能上tw itter了

wps_clip_image-919

pythonlearn1

#pythonlearn1.py
#from __future__ import division
print 2 + 2
print 53672 + 235253
print 1/2 #0,after import __future__,is 0.5
print 1.0 / 2.0 #0.5
print 1/2.0 #0.5
print 1.0/2 #0.5
print 1/2. #0.5

#integer division
print 1//2#0
print 1.0 // 2.0#even with floats,0.0
#This is the remainder (modulus) operator,x % y gives the remainder of x divided by y.
print 1 % 2#1
print 2.75 % 0.5#0.25

print 2 ** 3 #8
print -3 ** 2 #-9
”’Note that the exponentiation operator binds tighter than the negation (unary minus),
so -3**2 is in fact the same as -(3**2).”’
print (-3) ** 2 #9

print 1000000000000000000L

print 0xAF #hexadecimal numbers,175
print 010 #octal numbers,8

”’run1.bat
e:
cd E:Python24
python "E:pythoncodepythonlearn1.py"
pause
”’

test scanf

image

#include <stdio.h>
int main()
{
    int _1;
    int _2;
    int _3;
    scanf("%d,%d,%d",&_1,&_2,&_3);
    printf("%d%d%d",_1,_2,_3);
    return 0;
}

unsigned int test

#include <stdio.h>
int main()
{
    unsigned int _1 = -14;
    int _2 = 6;
    int _in = 6;
    if(_1 +_2 > 5)
        printf("%d",_1+_2);//-8
    scanf("%d",&_in);
    return 0;
}

test2

#include <iostream>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
    char c_test[]="abcde";
    char *p;
    p = c_test;
    cout<<*++–++p<<endl;//b
    cout<<c_test<<endl;//abcde
    system("pause");
    return 0;
}

test1

#include <iostream>

using namespace std;

class A

{

public:

    int i;

    virtual void vfunc()

    {

        cout<<"Av"<<endl;

    }

    void func()

    {

        cout<<"A"<<endl;

    }

};

class B:public A

{

public:

    void vfunc()//virtual

    {

        cout<<"Bv"<<endl;

    }

    void func()

    {

        cout<<"B"<<endl;

    }

};

void inc(A a)

{

    a.i++;

}

void inc1(A &a)

{

    a.i++;

}

void main()

{

    A a;

    a.i = 1;

    A a1;

    a1 = a;

    inc(a);

    cout<<a.i<<endl;//1

    cout<<a1.i<<endl;//1

    inc1(a);

    cout<<a.i<<endl;//2

    cout<<a1.i<<endl;//1

 

    A* pa;

    pa = new B;

    pa->func();//A

    pa->vfunc();//Bv

    delete pa;

    A aObj;

    aObj.func();//A

    aObj.vfunc();//Av

    B b;

    b.func();//B

    b.vfunc();//Bv

    system("pause"); 

}

firstWxPython

First

#WindowsXP-KB942288-v3-x86.exe(for msi install update)

#python-2.6.x4.msi(for python 2.6)

#wxPython2.8-win32-unicode-2.8.10.1-py26.exe(for gui)

#vcredist_x86.exe(for vc++ 2008 runtime)

#py2exe-0.6.9.win32-py2.6.exe(build .py firle to exe)

######################################

#firstWxPython.py

import sys, os

import wx

class main_window(wx.Frame):

def __init__(self, parent, id, title):

wx.Frame.__init__(self, parent, -1, title, size = (200, 100),style=wx.DEFAULT_FRAME_STYLE|wx.NO_FULL_REPAINT_ON_RESIZE)

self.control = wx.TextCtrl(self, -1, style=wx.TE_MULTILINE)

self.Show(True)

class App(wx.App):

def OnInit(self):

frame = main_window(None, -1, "wxPython: (A Demonstration)")

self.SetTopWindow(frame)

return 1

app = App(0)

app.MainLoop()

####################################################

#mysetup.py

from distutils.core import setup

import py2exe

setup(

windows = [

{

"script": "firstWxPython.py",

"icon_resources": [(1, "app.ico")]

}

],

)

::usePy2exe.bat

c:python26python mysetup.py py2exe

#now excute usePy2exe.bat waiting for build the exe

clip_image002[4]

#and then in dist directory, run firstWxPython.exe

clip_image004[4]

#and firstWxPython.exe depend on the other files(some exe and dll etc.) in this directory.

Second

#WindowsXP-KB942288-v3-x86.exe(for msi install update)

#python-2.4.2.msi(for python 2.4)

#pywin32-214.win32-py2.4.exe(for some win32 support)

#wxPython2.8-win32-ansi-2.8.10.1-py24.exe(maybe should use unicode version)(for gui)

#pyinstaller_1.3.zip(for build .py file to exe) (extract to some directory eg. C:pyinstaller-1.3)

clip_image006[4]

::myPyinstaller.bat

c:python24python c:pyinstaller-1.3configure.py

c:python24python c:pyinstaller-1.3Makespec.py firstWxPython.py –onefile –windowed –icon=app.ico

c:python24python c:pyinstaller-1.3build.py firstWxPython.spec

#then run firstWxPython.exe,just one exe,some kind of slower

clip_image008[4]

vs2010 idea

 

手上拿到的是2010 ultimate rc版(本来413日已出了最后版本,之前兴冲冲的没看清就下载了)

 

新建一个工程,发现很多不同,首先图标变了,蓝色的,似乎要好看些,但明显与前几版有些差别。里面的风格也是浅蓝色的风格,第一感觉不错。

新建工程时,发现这个浏览用的是这个。老实说,不是很爽,之前的几个vs.net用的打开文件夹对话框都是很酷的。

 

随意编译一个MFC项目,发现

error C2146: syntax error : missing ‘;’ before identifier ‘PVOID64’

编译错误。

查看工具选项-vc++目录发现这个,意思VC++目录没有全局设置了,每个工程都要设置自己的vc++目录。

之前那个编译错误是由于自己安装了directx sdk,这些设置又不小心让vs2010知道了,所以现在要改变vc++目录中几个目录的先后顺序,但vs2010继承过来的Vc++目录设置并不是很容易改变(估计会藏在c盘我的文档某个xml配置文件中),我也没去深究,总之,

首先把include directories设为

$(WindowsSdkDir)commoninclude;$(VCInstallDir)include;$(VCInstallDir)atlmfcinclude;$(WindowsSdkDir)include;$(FrameworkSDKDir)include

再把library directories设为

$(WindowsSdkDir)commonlib;$(VCInstallDir)lib;$(VCInstallDir)atlmfclib;$(WindowsSdkDir)lib;$(FrameworkSDKDir)lib

重新编译,通过

如果看官还想探究更多,请自己看

http://blogs.msdn.com/vsproject/archive/2009/07/07/vc-directories.aspx

 

程序运行截图

不错。还可以切换界面风格。

 

顺带说一下Improved IntelliSense,这个也不错,IntelliSense确实比vs20052008改进了很多,速度快很多。

还有个补丁

Visual Studio 2010 runs faster when the Windows Automation API 3.0 is installed-Applications that use Windows Automation APIs can significantly decrease Microsoft Visual Studio IntelliSense performance

 http://support.microsoft.com/kb/981741/en-us

 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

c#的测试非常顺利

 

总得来说,vs2010很不错!好嘢!

 

i continue studying c++ and STL

The STL consists of three major kinds of components: containers, algorithms, and iterators. Containers contain and organize elements. Algorithms perform operations. Iterators are used to access the elements of a container. This is nothing new, as many traditional libraries have these components, and many traditional libraries are implemented with templates. The STL’s inspired idea is that containers and the algorithms that operate on them need no knowledge of each other. This sleight of hand is accomplished with iterators.

quoted from

C++ Common Knowledge: Essential Intermediate Programming

By Stephen C. Dewhurst