Libin's profile绿色家园PhotosBlogLists Tools Help

绿色家园

Green World(本空间文章,未经原作者同意,请勿做商业用途。未注明的文章均为转载。)

SQLite Resources for iPhone Developers

SQLite is a public domain database library that offers file and memory based relational database functionality from a single C library. The iPhone / iPod Touch has the SQLite library included and ready to roll and Apple expects the SQLite library to form the backbone of most applications’ data storage requirements.

We’ve collected together some of the best SQLite related tutorials, and libraries in order to help you on your way with this essential iPhone programming technology:

Tutorials

sqlite-tute1.pngiPhone SQLite Database Basics by Lee Falin is a comprehensive introduction to using SQLite in respect to iPhone application development. He covers SQLite database creation and iPhone specific database design considerations well. Lee’s tutorial has lots of screenshots and he takes a step-by-step approach that’s easy to follow. He walks through creating an SQLite database from scratch (on the desktop to start with) and then imports that into an XCode project. Bear in mind, however, that Lee’s tutorial is not about the actual coding necessary to use SQLite on the iPhone itself.

Reading data from a SQLite Database by Dean Collins is a wonderful “start to finish” tutorial that covers creating an SQLite database, creating an XCode project, and then all the code necessary to use that database within an iPhone app. There’s even a link to an archive of the code used in the tutorial so you can more quickly try it out for yourself.

SQLite Tutorial 1: Selecting Data by Jai Kirdatt is the first in five SQLite focused tutorials from the aforementioned author. This one covers creating an SQLite database and, like Dean’s tutorial above, using that database from Objective C. There’s more code and less screenshots than in the aforementioned tutorials, so this tutorial is worth coming to once you’re totally confident with the basics. Source code is available to download at the bottom of the post.

SQLite Tutorial 2: Deleting Data by Jai Kirdatt follows on nicely from the previous tutorial and quickly demonstrates how to delete rows of data from an SQLite database.

sqlite-tute2.pngSQLite Tutorial 3: Adding Data by Jai Kirdatt demonstrates how to add data to an SQLite database from Objective C.

SQLite Tutorial 4: Loading Data As Required by Jai Kirdatt shows how to select rows in a database to then display in a detail view. Data is only loaded when it is required.

SQLite Tutorial 5: Updating Data by Jai Kirdatt shows you how to update the database when fields on a form are edited and the application is then terminated.

Libraries

EntropyDB is an embedded object database for OS X 10.5 and iPhone OS written in Objective C that’s built on top of SQLite. It provides a nicer API than that offered by SQLite directly. You don’t need to use SQL at all, but instead just work with Objective C objects!

SQLitePersistentObjects allows you to call “save” on your objects and trust that they will be saved properly and can be easily reloaded in future. No SQL required.

FMDB is a library that acts as a wrapper around SQLite - inspired by JDBC. fmdb-migration-manager(originally by last week’s podcast interviewee - Dr Nic Williams) allows you to easily roll out database migrations using fmdb.

iPhone SQLite Persistence for Objects is an open source project that lets you add “object persistence” to your applications. The object persistence uses SQLite, and the library works on both the iPhone and iPod Touch.

Suggestions?

Know of any others? Leave a comment and we’ll do our best to include them!

SQLite + UITableView for iPhone

I see many people asking for SQLite tutorials around, and since I am using SQLite for the next part in the Advanced RSS Reader Tutorial, I thought I would write up a quick tutorial on using SQLite with the iPhone SDK.
1. Project Requirements
I suggest that you have at least a basic understanding of SQLite,writing SQL statements, the XCode interface and using the terminal inOSX. If you don’t know anything about any of these topics then thistutorial probably isn’t for you.
2. Creating our SQLite database for our tutorial
We first need to create a database for use with our application. Forthe purposes of this tutorial we will be building a database of animalsalong with a little information on them and a picture.
Fire up a new Terminal window and make a new folder to store the database in, here are the commands I ran
[pre]cd /Users/lookaflyingdonkey/Documents
mkdir SQLiteTutorial
cd SQLiteTutorial
sqlite3 AnimalDatabase.sql[/pre]You should now be at a “sqlite” command prompt, this is where wewill be building our database structure and entering some test data.
For our example we need the name of the animal, a short descriptionand a link to an image. Follow the commands below to create the tableand to enter some sample data.
[pre]CREATE TABLE animals ( id INTEGER PRIMARY KEY, name VARCHAR(50), description TEXT, image VARCHAR(255) );

INSERT INTO animals (name, description, image) VALUES ('Elephant', 'The elephant is a very large animal that lives in Africa and Asia', 'http://dblog.com.au/wp-content/elephant.jpg');
INSERT INTO animals (name, description, image) VALUES ('Monkey', 'Monkies can be VERY naughty and often steal clothing from unsuspecting tourists', 'http://dblog.com.au/wp-content/monkey.jpg');
INSERT INTO animals (name, description, image) VALUES ('Galah', 'Galahs are a wonderful bird and they make a great pet (I should know, I have one)', 'http://dblog.com.au/wp-content/galah.jpg');
INSERT INTO animals (name, description, image) VALUES ('Kangaroo', 'Well I had to add the Kangaroo as they are the essence of the Australian image', 'http://dblog.com.au/wp-content/kangaroo.jpg');[/pre]The first command will create the table with the required structureand the next four will insert some test data for us to work with. Toensure that you have entered the data correctly you can execute “SELECT* FROM animals;” and see if it returns the items above. Once you areconfident that everything had been created successfully you can leavethe sqlite command line by typing “.quit”.
3. Creating our Project
Now that our database is all ready to go we need to setup our X-Code project.
Start off by creating a new “Navigation-Based Application”.

Give your Project a name, I called mine “SQLiteTutorial”.
Now set your screen layout to how you prefer it, I suggest makingthe window as large as possible, and making the code view as tall aspossible by dragging the horizontal slider to the top. This will allowyou the most room to move when building your application.
Now its time to create the required classes and views for our application, we will start off by making our views.
Right Click on the “Resources” folder in the left hand pane andclick “Add File”, we want to create a new “View XIB” under the “UserInterfaces” group.

We now need to give it a name, to stick the Apple’s naming conventions we are going to call it “AnimalViewController.xib”, Now Click “Finish”.
Now we need to create two classes, the first one will represent ananimal, right click on the “Classes” folder in the left hand pane,click “Add > New File…”, choose the “NSObject subclass” templateunder the “Cocoa Touch Classes” group and name it “Animal”.
The second class will be for our AnimalsViewController, right clickon the “Classes” folder in the left hand pane, click “Add > NewFile…”, choose the “UIViewController subclass” under the “Cocoa TouchClasses” group and name it “AnimalViewController”.
4. Adding SQLite Framework and our Animal Database
Now that we have created all of our views and classes it is time to start the real grunt work.
First off we need to include the SQLite libraries so our applicationcan utilise them. To do this you will need to right click on the“Frameworks” folder in the left hand pane, then click on “Add >Existing Frameworks…”, then navigate to“/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.0.sdk/usr/lib/”and double click the “libsqlite3.0.dylib” file. A popup will appear,just click “Add” and the library will be added to your project.
We also need to add our database we created earlier to the Resourcesfolder, to do this simply right click on the “Resources” folder, click“Add > Existing Files…”, navigate to the location you created thedatabase in then double click on the AnimalDatabase.sql file. Anotherpopup will appear, just click add.
All done with the importing, time to code!
5. The Coding begins!
We are going to start the coding by building our “Animal” object,every animal will have 3 properties, a name, a description and an imageURL.
Open up the “Animal.h” file from the “Classes” folder and edit its contents to look like below,
[pre]#import <UIKit/UIKit.h>

@interface Animal : NSObject {
    NSString *name;
    NSString *description;
    NSString *imageURL;
}

@property (nonatomic, retain) NSString *name;
@property (nonatomic, retain) NSString *description;
@property (nonatomic, retain) NSString *imageURL;

-(id)initWithName:(NSString *)n description:(NSString *)d url:(NSString *)u;

@end
[/pre]Most of the above code should be pretty familiar to you, the only thing that may not be is the initWithName line, this line will allow us to create a new object with the required data, we could have used the default init function, but it will be easier for us to define our own.
Now we will actually have to implement the Animal Object, open up the “Animal.m” file and edit its contents to look like below:
[pre]#import "Animal.h"

@implementation Animal
@synthesize name, description, imageURL;

-(id)initWithName:(NSString *)n description:(NSString *)d url:(NSString *)u {
    self.name = n;
    self.description = d;
    self.imageURL = u;
    return self;
}
@end
[/pre]The above code should be pretty easy to read as well, it basicallystores the supplied data from the initWithName function and return theobject (self).
Now its time to setup the Application delegate to access the database.
Open up the “SQLiteTutorialAppDelegate.h” and edit its contents to look like below:
[pre]#import <UIKit/UIKit.h>
#import <sqlite3.h> // Import the SQLite database framework

@interface SQLiteTutorialAppDelegate : NSObject  {

    UIWindow *window;
    UINavigationController *navigationController;

    // Database variables
    NSString *databaseName;
    NSString *databasePath;

    // Array to store the animal objects
    NSMutableArray *animals;
}

@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet UINavigationController *navigationController;
@property (nonatomic, retain) NSMutableArray *animals;

@end
[/pre]What we are doing here is importing the SQLite database frameworkand creating some variables for storing the database details and anarray of animal objects.
Now open up the “SQLiteTutorialAppDelegate.m” file and edit its contents to look like below:
[pre]#import "SQLiteTutorialAppDelegate.h"
#import "RootViewController.h"
#import "Animal.h" // Import the animal object header

@implementation SQLiteTutorialAppDelegate

@synthesize window;
@synthesize navigationController;
@synthesize animals; // Synthesize the aminals array

- (void)applicationDidFinishLaunching:(UIApplication *)application {
    // Setup some globals
    databaseName = @"AnimalDatabase.sql";

    // Get the path to the documents directory and append the databaseName
    NSArray *documentPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *documentsDir = [documentPaths objectAtIndex:0];
    databasePath = [documentsDir stringByAppendingPathComponent:databaseName];

    // Execute the "checkAndCreateDatabase" function
    [self checkAndCreateDatabase];

    // Query the database for all animal records and construct the "animals" array
    [self readAnimalsFromDatabase];

    // Configure and show the window
    [window addSubview:[navigationController view]];
    [window makeKeyAndVisible];
}

- (void)applicationWillTerminate:(UIApplication *)application {
    // Save data if appropriate
}

- (void)dealloc {
    [animals release];
    [navigationController release];
    [window release];
    [super dealloc];
}

-(void) checkAndCreateDatabase{
    // Check if the SQL database has already been saved to the users phone, if not then copy it over
    BOOL success;

    // Create a FileManager object, we will use this to check the status
    // of the database and to copy it over if required
    NSFileManager *fileManager = [NSFileManager defaultManager];

    // Check if the database has already been created in the users filesystem
    success = [fileManager fileExistsAtPath:databasePath];

    // If the database already exists then return without doing anything
    if(success) return;

    // If not then proceed to copy the database from the application to the users filesystem

    // Get the path to the database in the application package
    NSString *databasePathFromApp = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:databaseName];

    // Copy the database from the package to the users filesystem
    [fileManager copyItemAtPath:databasePathFromApp toPath:databasePath error:nil];

    [fileManager release];
}

-(void) readAnimalsFromDatabase {
    // Setup the database object
    sqlite3 *database;

    // Init the animals Array
    animals = [[NSMutableArray alloc] init];

    // Open the database from the users filessytem
    if(sqlite3_open([databasePath UTF8String], &database) == SQLITE_OK) {
        // Setup the SQL Statement and compile it for faster access
        const char *sqlStatement = "select * from animals";
        sqlite3_stmt *compiledStatement;
        if(sqlite3_prepare_v2(database, sqlStatement, -1, &compiledStatement, NULL) == SQLITE_OK) {
            // Loop through the results and add them to the feeds array
            while(sqlite3_step(compiledStatement) == SQLITE_ROW) {
                // Read the data from the result row
                NSString *aName = [NSString stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 1)];
                NSString *aDescription = [NSString stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 2)];
                NSString *aImageUrl = [NSString stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 3)];

                // Create a new animal object with the data from the database
                Animal *animal = [[Animal alloc] initWithName:aName description:aDescription url:aImageUrl];

                // Add the animal object to the animals Array
                [animals addObject:animal];

                [animal release];
            }
        }
        // Release the compiled statement from memory
        sqlite3_finalize(compiledStatement);

    }
    sqlite3_close(database);

}

@end
[/pre]Now I know that may look like a fair bit of code and it probablyalso looks quite scary! But really it is quite simple and I have triedto comment nearly every line to describe to you what the line does andwhy it is there.
The checkAndCreateDatabase function checks to seeif we have already copied our database from the application bundle tothe users filesystem (in their documents folder), if the databasehasn’t already been created or it has been removed for some reason itwill be recreated from the default database.
Next the readAnimalsFromDatabase function will makea connection to the database that is stored in the users documentsfolder, and then executes the SQL statement “SELECT * FROM animals”. Itwill then go through each row that is returned and it will extract thename, description and imageURL from the result and build an Animal object for each. You  will see the “sqlite3_column_text” function used here, there are many more of these for returning other field types such as “sqlite3_column_int” for integers, “sqlite3_column_blob” for blobs or “sqlite3_column_value” to get an unknown value.
Now that we have the data in our array and we have it in our known format we are ready to start displaying it.
Open up the “RootViewController.m” file and edit the numberOfRowsInSection to look like the following:
[pre]SQLiteTutorialAppDelegate *appDelegate = (SQLiteTutorialAppDelegate *)[[UIApplication sharedApplication] delegate];
return appDelegate.animals.count;
[/pre]What this does is it creates a link to the application delegate, andthen the second line returns the size f the animals array in outApplication delegate, this array was filled previously from the SQLitedatabase.
Now in the cellForRowAtIndexPath function you will need at change it to look like the following:
[pre]- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    static NSString *CellIdentifier = @"Cell";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
    }

    // Set up the cell
    SQLiteTutorialAppDelegate *appDelegate = (SQLiteTutorialAppDelegate *)[[UIApplication sharedApplication] delegate];
    Animal *animal = (Animal *)[appDelegate.animals objectAtIndex:indexPath.row];

    [cell setText:animal.name];
    return cell;
}
[/pre]We pretty much just added 3 lines under the “// Set up the cell” line, the first one is the same as we added previously to access the application delegate. The second line creates a new Animalobject based on the array from the application delegate, it will beused to create a row for each individual record in the database. On thefinal line we are just setting the text of the cell to the name fieldfrom the Animal object.
You can now run the program and you should see a table view with the4 animals we added to the database, if you added more than my defaultanimals you should see them in here as well.
We will now setup the AnimalViewController, open up the “AnimalViewController.h” file and edit its contents to below:
[pre]#import <UIKit/UIKit.h>

@interface AnimalViewController : UIViewController {
    IBOutlet UITextView *animalDesciption;
    IBOutlet UIImageView *animalImage;
}

@property (nonatomic, retain) IBOutlet UITextView *animalDesciption;
@property (nonatomic, retain) IBOutlet UIImageView *animalImage;

@end
[/pre]What we are doing above is adding an outlet for the description and image for the Animal, we will use these later on when we link the view up.
Now open up the “AnimalViewController.m” file and add a synthesize call for for the description and image, this will go under the “@implementation AnimalViewController” line, like so:
[pre]#import "AnimalViewController.h"

@implementation AnimalViewController

@synthesize animalDesciption, animalImage;
[/pre]Now it is time to make the detailed view page appear when you selecta record. Open up the “AnimalViewController.xib” file from theresources folder and the interface builder should appear.
The first thing we need to do is to set the File’s Owner Class to AnimalViewController, this is done by selecting the “File’s Owner” item in the main window and then clicking Tools > Identity Inspector in the top menu, and then selecting AnimalViewController from the class dropdown.
Your inspector window should now look like this:

We are going to be using a UITextView for the description (as it will allow for word wrapping and scrolling in the case that the description is quite large) and a UIImageView to display the image. I have laid mine out like below:

Now that we have everything laid out it is time to link them all up, start by holding control and click+drag from the “File’s Owner” to the “View” objects, a little gray menu will appear and you will need to select view. Now hold control and click+drag from the “File’s Owner” to the UITextView in the layout window, you should see “animalDescription” in the popup list, select it. Repeat this process for the UIImageView and you should see animalImage appear, select it also.
Now save the interface and close the interface builder.
Nearly done! All we have to do now is to setup the code for when a user presses on a record in the table view.
Open up the “RootViewController.h” file and edit its contents to below:
[pre]#import <UIKit/UIKit.h>
#import "AnimalViewController.h"

@interface RootViewController : UITableViewController {
    AnimalViewController *animalView;
}

@property(nonatomic, retain) AnimalViewController *animalView; 

@end
[/pre]We are creating an instance of the AnimalViewController to be used bu the RootViewController when a user presses on an item.
Now open up the “RootViewController.m” file and edit the top part of the file to look like below:
[pre]#import "RootViewController.h"
#import "SQLiteTutorialAppDelegate.h"
#import "Animal.h"

@implementation RootViewController
@synthesize animalView;
[/pre]This will just synthesize the animalView that we just added.
First up lets set the default title of our view, to do this you needto uncomment the viewDidLoad function, and edit it to below:
[pre]- (void)viewDidLoad {
    [super viewDidLoad];
    // Uncomment the following line to add the Edit button to the navigation bar.
    // self.navigationItem.rightBarButtonItem = self.editButtonItem;

    self.title = @"My Zoo";
}
[/pre]We also need to edit the didSelectRowAtIndexPath
function in this file, edit it to look like below:
[pre]- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    // Navigation logic -- create and push a new view controller
    SQLiteTutorialAppDelegate *appDelegate = (SQLiteTutorialAppDelegate *)[[UIApplication sharedApplication] delegate];
    Animal *animal = (Animal *)[appDelegate.animals objectAtIndex:indexPath.row];

    if(self.animalView == nil) {
        AnimalViewController *viewController = [[AnimalViewController alloc] initWithNibName:@"AnimalViewController" bundle:nil];
        self.animalView = viewController;
        [viewController release];
    }

    // Setup the animation
    [self.navigationController pushViewController:self.animalView animated:YES];
    // Set the title of the view to the animal's name
    self.animalView.title = [animal name];
    // Set the description field to the animals description
    [self.animalView.animalDesciption setText:[animal description]];
    // Load the animals image into a NSData boject and then assign it to the UIImageView
    NSData *imageData = [NSData dataWithContentsOfURL:[NSURL URLWithString:[animal imageURL]]];
    UIImage *animalImage = [[UIImage alloc] initWithData:imageData cache:YES];
    self.animalView.animalImage.image = animalImage;

}
[/pre]What we are doing here is checking to see if the animalView object has already been created, if not then create it.
The next few lines are used to setup the animation (slide from rightto left) and to set the actual data fields to those of the selectedanimal.
Now you should be ready to fire up the application and see it in all its glory.
You should see your windows looking like below.
 
November 17

Useful open source libraries for IPhone Development

It’s been almost 3 months since the IPhone SDK’s infamous NDA restrictions were lifted, and there are now a good set of open source libraries available for the IPhone. In this post I will go through the ones that I know of one way or another. If you are aware of more high quality open source projects, please let me know in the comments so that I can update this post.

JSON Library

Currently, there are 3 choices that I know of:

JSON Framework: I used this one in one of my projects, and did not run into problems. Recently after the update to the new SDK 2.2, you may need to make a quick change to your project as outlined at the end of this discussion.

Touch JSON: This one is from the same project owners as the TouchXML.

Blake Seely’s BSJSONAdditions: This one is little older and intended for the Mac originally. According to the author of the JSON Framework a little slower as per his performance benchmarks

DOM XML Library

IPhone SDK includes an event driven (SAX based) XML parser called NSXMLParser. But if you need DOM style parser, you are out of luck unless you use the libxml2 library directly. There is no MacOS X equivalent of NSXML on the IPhone.

However luckily there are at least 2 options that I know of that you might use if you really need the DOM tree:

TouchXML: Open source lightweight replacement for Cocoa’s NSXML cluster of classes based onlibxml2.

Matt Gallagher: Wrote a lightweight wrapper on top of libxml2 and describes this in his blog entry.

However note that in a memory and CPU constrained environment like IPhone, it does make more sense to use an event driven parser (probably why Apple decided not to include NSXML in the first place). There is a recent SDK sample called XMLPerformance that shows parsing large number of items in an efficient way using both the NSXMLParser and the lower level SAX parser provided in libxml2.

Google Data APIs

So you would like to access Picasa, Google Calendar, Google Contacts and more… Well there is a very comprehensive ObjectiveC Client Library that you can include as a static library in your applications.

Twitter

Craig Hockenberry of the awesome Twitterific fame, made the source code of the Mobile Twitterific available to serve as a “Best Practices” document. There you can find how to connect to Twitter, get and post tweets etc.

Flickr

Unfortunately the well-known Cocoa API for Flickr is still not ported to the IPhone. However it looks like they are working on porting it to IPhone as of November 2008.

Game Engines

There are at least 3 game engines that I know of:

2D Gaming – Cocos 2D: This one is intended for 2D games, demos and other graphical/interactive applications. It is a port from the Python based cocos2d design. It uses Open ES 1.1, instead of the Quartz 2D and integrates the Chipmunk 2d physics engine.

3D Gaming – SIO2 Interactive: A 3D engine written in C using OpenGL ES.

3D Gaming – Oolong Engine: Mainly written in C++ with some ObjectiveC. Based on OpenGL ES 1.1 and includes the Bullet 3D physics engine.

You can also take a look at some IPhone game source code:

Tris: The source code for the Tetris clone that was pulled out of the Appstore earlier.

Molecules: This is not a game, but serves as a good tutorial for OpenGL ES development.

Unit Testing and Mock Frameworks

As of IPhone SDK 2.2, Apple now includes the OCUnit. This was discussed in the Stanford IPhone Application Programming course and you can download the presentation and the sample. So right of the bat you are now set up for unit testing, no more excuses.

Google actually has a more comprehensive framework in their Google Toolbox for Mac that even includes support for UI testing.

There is also a mock object framework called OCMock that is designed for MacOS X Cocoa, but witha little bit of work you can get that to work for your IPhone projects.

September 23

Chromium 快捷键列表

 
窗口和标签页快捷键
Ctrl+N 打开新窗口
Ctrl+T 打开新标签页
Ctrl+Shift+N 在隐身模式下打开新窗口
Ctrl+O,然后选择文件 在谷歌浏览器中打开计算机上的文件
按住 Ctrl 键,然后点击链接 从后台在新标签页中打开链接,但您仍停留在当前标签页中
按住 Ctrl+Shift 键,然后点击链接 在新标签页中打开链接,同时切换到新打开的标签页
按住 Shift 键,然后点击链接 在新窗口中打开链接
Alt+F4 关闭当前窗口
Ctrl+Shift+T 重新打开上次关闭的标签页。谷歌浏览器可记住最近关闭的 10 个标签页。
将链接拖动到标签页内 在指定标签页中打开链接
将链接拖动到两个标签页之间 在标签页横条的指定位置建立一个新标签页,在该标签页中打开链接
Ctrl+1  Ctrl+8 切换到指定位置编号的标签页。您按下的数字代表标签页横条上的相应标签位置。
Ctrl+9 切换到最后一个标签页
Ctrl+Tab Ctrl+PgDown 切换到下一个标签页
Ctrl+Shift+Tab Ctrl+PgUp 切换到上一个标签页
Ctrl+W  Ctrl+F4 关闭当前标签页或弹出式窗口
Alt+Home 打开主页

地址栏快捷键

在地址栏,进行下列操作之一:
键入搜索字词 使用默认搜索引擎进行搜索
键入网址中"www."和".com"之间的部分,然后按 Ctrl+Enter  为您在地址栏中输入的内容添加"www."和".com",然后打开网址
键入搜索引擎关键字或网址,按 Tab 键,然后键入搜索字词 使用与关键字或网址相关联的搜索引擎进行搜索。如果谷歌浏览器可以识别您要使用的搜索引擎,则会提示您按 Tab 键。
F6  Ctrl+L  Alt+D 选中网址区域中的内容
键入网址,然后按Alt+Enter  在新标签页中打开网址

打开谷歌浏览器各功能的快捷键

Ctrl+B 打开和关闭书签栏
Ctrl+Shift+B 打开书签管理器
Ctrl+H 查看"历史记录"页
Ctrl+J 查看"下载"页
Shift+Escape 查看任务管理器
Shift+Alt+T 将焦点设置在工具栏上。使用键盘上的向右和向左箭头,可导航至工具栏上的不同按钮。

网页快捷键

Ctrl+P 打印当前页
Ctrl+S 保存当前页
F5 重新加载当前页
Esc 停止加载当前页
Ctrl+F 打开"在网页上查找"框
点击鼠标中键或滚轮(只在谷歌浏览器测试版(只有英文版)中可用) 激活自动滚动。当您移动鼠标时,网页会根据鼠标的移动方向自动滚动。
Ctrl+F5  Shift+F5 重新加载当前页,但忽略缓存内容
按住 Alt 键,然后点击链接 下载链接
Ctrl+G  F3 查找与您在"在网页上查找"框中输入的内容相匹配的下一个匹配项
Ctrl+Shift+G  Shift+F3 查找与您在"在网页上查找"框中输入的内容相匹配的上一个匹配项
Ctrl+U 查看源代码
将链接拖动到书签栏 将链接加入书签
Ctrl+D 将当前网页加入书签
Ctrl++,或者按住 Ctrl 键并向上滚动鼠标滚轮 放大网页上的所有内容
Ctrl+-,或者按住 Ctrl 键并向下滚动鼠标滚轮 缩小网页上的所有内容
Ctrl+0 将网页上的所有内容都恢复到正常大小

文字快捷键

选中内容,然后按 Ctrl+C  将内容复制到剪贴板
将光标置于文本字段中,然后按 Ctrl+V Shift+Insert  从剪贴板粘贴当前内容
将光标置于文本字段中,然后按 Ctrl+Shift+V  从剪贴板粘贴当前内容的纯文本部分
选中文字字段中的内容,然后按 Ctrl+X Shift+Delete  删除内容并将其复制到剪贴板

查看更多快捷键

Backspace,或同时按住 Alt 和向左箭头键 转至标签页浏览历史记录中的上一页
Shift+Backspace,或同时按住 Alt 和向右箭头键 转至标签页浏览历史记录中的下一页
Ctrl+K  Ctrl+E 将"?"置于地址栏中。在"?"之后键入搜索字词,以使用默认搜索引擎进行搜索。
将光标置于地址栏中,然后同时按住 Ctrl和向左箭头键 跳到地址栏中的前一个字词
将光标置于地址栏中,然后同时按住 Ctrl和向右箭头键 跳到地址栏中的下一个字词
将光标置于地址栏中,然后按住Ctrl+Backspace  删除地址栏中的上一个字词
空格键 向下滚动网页
Home 转至网页顶部
End 转至网页底部
按住 Shift 键并滚动鼠标滚轮(只在谷歌浏览器测试版(只有英文版)中可用) 在网页上水平滚动
July 17

将linux-2.6.4内核移植到S3C2410

摘自:http://www.cublog.cn/u2/70445/showart_1721091.html

 

1. 构建起环境

    要使用内核,首先要编译内核。如果不选择合适的内核和编译器,就会出现错误。典型的就是如下的错误:

EG:

CC arch/arm/kernel/asm-offsets.s

cc1: error : invalid option 'apcs'

cc1: error : invalid option 'no-sched-prolog'

cc1: error : invalid option 'little-endian'

cc1: error : invalid option 'abi=apcs-gnu'

arch/arm/kernel/asm-offsets.c:1: error: bad value (armv4) for -march=switch

arch/arm/kernel/asm-offsets.c:1: error: bad value (armv4) for -mtune=switch

make[1]: *** [arch/arm/kernel/asm-offsets.s] Error 1

make: *** [arch/arm/kernel/asm-offsets.s] Error 2

re:asm-offsets.s 这个文件编译出错一般是编译器问题,不要用2.95.3,用3.4.1

    这里主要是编译器版本的问题,2.6内核不能使用以往的2.95.3版本的gcc,需改用3.4.1版本。关于编译器,最好不要自己做,下载网上现成的就可以了。http://www.gnuarm.com/这里有arm的编译器下载。

    内核的版本对于编译倒关系不大,一般都能编译成功,而关键还在于配置。为了对s3c2410有更好的支持,建议使用2.6.10以后的版本。网上2.6.11版本用的人也挺多的,相关资料也挺多的,但是新版本对硬件的支持更好更稳定。比如在2.6.11中没有DM9000和CS8900的网卡驱动,在2.6.14版本中就已经对其支持。我选用的是2.6.14版本,现使用三星默认的配置文件arch/arm/configs/s3c2410_defconfig,顺利编译通过。

    kernel: http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.11.7.tar.bz2

    compiler: ftp://ftp.handhelds.org/projects/toolchain/arm-linux-gcc-3.4.1.tar.bz2

 

2. 运行内核,显示调试信息

    运行内核肯定没问题,但是搞不好你就出现了一下问题:

Uncompressing Linux................................................................ done, booting the kernel.

就不动了,以前用2.4.18内核是可以启动的。

re:命令行的console参数错了,应该为console=ttySAC0,不是console=ttyS0。

    因为2.6对2410的串口支持已经很好了,使用默认配置的话就不要去怀疑串口驱动了。问题出在命令行上,有人说我将默认的命令行改成了console=ttySAC0也还是不行。这只能说明改动了默认的命令行,只有在bootloader没有传递命令行参数给内核的时候才起作用。如果你的bootloader启动过2.4的内核,命令行参数肯定是不对的,在bootloader中将命令行改了就行了。例如:console=ttySAC0,115200 root=/dev/ram init=/linuxrc rw initrd=0x30008000,0x320000 

    因为烧写bootlader麻烦,时间长,调试阶段不建议修改bootloader。我将内核中的arch/arm/kernel/setup.c文件中的parse_tag_cmdline()函数中的内容注释掉,并且配置正确的CONFIG_CMDLINE参数,即可运行。以后每当改变内核参数只要改变CONFIG_CMDLINE就可以了。(CONFIG_CMDLINE这个值可以在make menuconfig中配置,2.6.11版本和2.6.14版本配置位置有所不同,请注意)。

 

3. 激动的看到shell

    当做完以上工作时看到内核信息哗哗哗的出来已经很兴奋了吧,我也是,但是很快你会看到下面有如下错误:

Please append a correct "root=" boot option

Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(1,0)

re:传递一个合理的root参数,如果已经传递了,请确认内核是否支持

    如果使用console=ttySAC0,115200 root=/dev/ram init=/linuxrc rw initrd=0x30008000,0x320000这个命令行参数,需要使用ramdisk和initrd。所以确保CONFIG_RAMDISK=y和CONFIG_INITRD=y。在device driver=》Block device下面可以配置。

    这里的ramdisk是把内存块当做一个块设备来使用,相当于一个位于内存中的磁盘分区;而initrd就是用于初始化系统的ramdisk,用来mount真正的root。

    这里使用initrd是为了调试方便,不需要使用flash和网络。一般使用是多数会用到mtd,调试时使用nfsroot,在移植完相关硬件后再来讨论。

    当内核支持了以后还需要有initrd。使用网上下载的现成的,如何制作等会介绍。例如:我有一个initrd为ramdisk.image.gz,在bootloader下加载到指定的0x30800000处,然后启动内核即可。一般出现如下信息表示ramdisk加载成功了。

RAMDISK: Compressed image found at block 0

VFS: Mounted root (ext2 filesystem) readonly.

Freeing init memory: 96K

Warning: unable to open an initial console.

re:unable to open an initial console是因为没有支持devfs。

   但是又出现了Warning: unable to open an initial console.这个错误。难道是console的问题?no。有些initrd是用于又devfs支持的内核,所以在/dev/目录下没有设备文件。两种办法解决这个问题:1.copy设备节点;2.让内核支持devfs。两个方法没有什么好与差,只是在2.6.14版本中devfs的配置选项在make menuconfig的时候会看不到。linux除去了devfs的配置,提供了替代品udev,但是对这个不熟悉,而且听说也不稳定,所以还是打算用devfs。可以在.config文件中直接添加CONFIG_DEVFS_FS,但由于每次make menuconfig之后会重新写.config文件,每次编译要添加一次,很麻烦,所以不建议。我是把2.6.11版本中的/fs/Kconfig复制过来替换掉。这样配置的时候就能看到devfs的选项了。配置时注意还要选中Automatical mount at boot选项。

Freeing init memory: 80K

Warning: unable to open an initial console.

Kernel panic - not syncing: No init found. Try passing init= option to kernel.

re:init参数没有传递,或者制作的ramdisk有问题。

XXX:目前这个地方我也没弄好。正疑惑。用别人的initrd可以,自己用busybox做的就不行。而且用别人的也不是很稳定。有可能时busybox在编译完了后没有copy相关库,需要静态编译。

 

    当解决了以上问题之后,多数能兴奋的看到shell了。

 

4. 制作自己的initrd

    这个initrd的制作可以参考网上一些制作floppy disk的文章。

4.1 制作一个ext2的文件系统映象

~# dd if=/dev/zero of=ramdisk.image bs=1M count=2

~# echo y | mke2fs -i 2000 -m 0 ramdisk.image

~# mkdir mnt

~# mount -o loop ramdisk.image mnt

    这样,ramdisk.image这个ext2文件系统映象就做完了,他相当于一个磁盘分区。

 

 

5.显示自定义logo

在配置内核的时候选中了启动Logo的支持。

使用下面的方法可以将企鹅的Logo换成自己喜欢的任意图片。

首先准备一幅自己喜欢的图片,然后将背景涂成黑色。然后将该图片保存成png格式,例如linuxlogo.png。在Linux下使用下面的命令:

 

# pngtopnm linuxlogo.png > linuxlogo.pnm

# pnmquant 224 linuxlogo.pnm > linuxlogo224.pnm

# pnmtoplainpnm linuxlogo224.pnm > linuxlogo224.ppm

 

然后.ppm替换/usr/src/linux-2.6.8.1/drivers/后用生成的linuxlogo224video/logo/logo_linux_clut224.ppm(最好先做好备份),然后删除同一目录下的logo_linux_clut224.c文件,重新编译内核,启动之后就可以在屏幕左上方看到自己的Logo了。

May 30

介绍qmake

qmake是用来为不同的平台的开发项目创建makefile的Trolltech开发一个易于使用的工具。qmake简化了makefile的生成,所以为了创建一个makefile只需要一个只有几行信息的文件。qmake可以供任何一个软件项目使用,而不用管它是不是用Qt写的,尽管它包含了为支持Qt开发所拥有的额外的特征。

qmake基于一个项目文件这样的信息来生成makefile。项目文件可以由开发者生成。项目文件通常很简单,但是如果需要它是非常完善的。不用修改项目文件,qmake也可以为为Microsoft Visual Studio生成项目。

qmake的概念

QMAKESPEC环境变量

举例来说,如果你在Windows下使用Microsoft Visual Studio,然后你需要把QMAKESPEC环境变量设置为win32-msvc。如果你在Solaris上使用gcc,你需要把QMAKESPEC环境变量设置为solaris-g++

在qt/mkspecs中的每一个目录里面,都有一个包含了平台和编译器特定信息的qmake.conf文件。这些设置适用于你要使用qmake的任何项目,请不要修改它,除非你是一个专家。例如,假如你所有的应用程序都必须和一个特定的库连接,你可以把这个信息添加到相应的qmake.conf文件中。

项目(.pro)文件

一个项目文件是用来告诉qmake关于为这个应用程序创建makefile所需要的细节。例如,一个源文件和头文件的列表、任何应用程序特定配置、例如一个必需要连接的额外库、或者一个额外的包含路径,都应该放到项目文件中。

“#”注释

你可以为项目文件添加注释。注释由“#”符号开始,一直到这一行的结束。

模板

模板变量告诉qmake为这个应用程序生成哪种makefile。下面是可供使用的选择:

  • app - 建立一个应用程序的makefile。这是默认值,所以如果模板没有被指定,这个将被使用。

  • lib - 建立一个库的makefile。

  • vcapp - 建立一个应用程序的Visual Studio项目文件。

  • vclib - 建立一个库的Visual Studio项目文件。

  • subdirs - 这是一个特殊的模板,它可以创建一个能够进入特定目录并且为一个项目文件生成makefile并且为它调用make的makefile。

“app”模板

“app”模板告诉qmake为建立一个应用程序生成一个makefile。当使用这个模板时,下面这些qmake系统变量是被承认的。你应该在你的.pro文件中使用它们来为你的应用程序指定特定信息。

  • HEADERS - 应用程序中的所有头文件的列表。

  • SOURCES - 应用程序中的所有源文件的列表。

  • FORMS - 应用程序中的所有.ui文件(由Qt设计器生成)的列表。

  • LEXSOURCES - 应用程序中的所有lex源文件的列表。

  • YACCSOURCES - 应用程序中的所有yacc源文件的列表。

  • TARGET - 可执行应用程序的名称。默认值为项目文件的名称。(如果需要扩展名,会被自动加上。)

  • DESTDIR - 放置可执行程序目标的目录。

  • DEFINES - 应用程序所需的额外的预处理程序定义的列表。

  • INCLUDEPATH - 应用程序所需的额外的包含路径的列表。

  • DEPENDPATH - 应用程序所依赖的搜索路径。

  • VPATH - 寻找补充文件的搜索路径。

  • DEF_FILE - 只有Windows需要:应用程序所要连接的.def文件。

  • RC_FILE - 只有Windows需要:应用程序的资源文件。

  • RES_FILE - 只有Windows需要:应用程序所要连接的资源文件。

你只需要使用那些你已经有值的系统变量,例如,如果你不需要任何额外的INCLUDEPATH,那么你就不需要指定它,qmake会为所需的提供默认值。例如,一个实例项目文件也许就像这样:

TEMPLATE = app
DESTDIR = c:\helloapp
HEADERS += hello.h
SOURCES += hello.cpp
SOURCES += main.cpp
DEFINES += QT_DLL
CONFIG += qt warn_on release

如果条目是单值的,比如template或者目的目录,我们是用“=”,但如果是多值条目,我们使用“+=”来为这个类型添加现有的条目。使用“=”会用新值替换原有的值,例如,如果我们写了DEFINES=QT_DLL,其它所有的定义都将被删除。

“lib”模板

“lib”模板告诉qmake为建立一个库而生成makefile。当使用这个模板时,除了“app”模板中提到系统变量,还有一个VERSION是被支持的。你需要在为库指定特定信息的.pro文件中使用它们。

  • VERSION - 目标库的版本号,比如,2.3.1。

“subdirs”模板

“subdirs”模板告诉qmake生成一个makefile,它可以进入到特定子目录并为这个目录中的项目文件生成makefile并且为它调用make。

在这个模板中只有一个系统变量SUBDIRS可以被识别。这个变量中包含了所要处理的含有项目文件的子目录的列表。这个项目文件的名称是和子目录同名的,这样qmake就可以发现它。例如,如果子目里是“myapp”,那么在这个目录中的项目文件应该被叫做myapp.pro

CONFIG变量

配置变量指定了编译器所要使用的选项和所需要被连接的库。配置变量中可以添加任何东西,但只有下面这些选项可以被qmake识别。

下面这些选项控制着使用哪些编译器标志:

  • release - 应用程序将以release模式连编。如果“debug”被指定,它将被忽略。

  • debug - 应用程序将以debug模式连编。

  • warn_on - 编译器会输出尽可能多的警告信息。如果“warn_off”被指定,它将被忽略。

  • warn_off - 编译器会输出尽可能少的警告信息。

下面这些选项定义了所要连编的库/应用程序的类型:

  • qt - 应用程序是一个Qt应用程序,并且Qt库将会被连接。

  • thread - 应用程序是一个多线程应用程序。

  • x11 - 应用程序是一个X11应用程序或库。

  • windows - 只用于“app”模板:应用程序是一个Windows下的窗口应用程序。

  • console - 只用于“app”模板:应用程序是一个Windows下的控制台应用程序。

  • dll - 只用于“lib”模板:库是一个共享库(dll)。

  • staticlib - 只用于“lib”模板:库是一个静态库。

  • plugin - 只用于“lib”模板:库是一个插件,这将会使dll选项生效。

例如,如果你的应用程序使用Qt库,并且你想把它连编为一个可调试的多线程的应用程序,你的项目文件应该会有下面这行:

    CONFIG += qt thread debug

注意,你必须使用“+=”,不要使用“=”,否则qmake就不能正确使用连编Qt的设置了,比如没法获得所编译的Qt库的类型了。

May 29

编译meshlab 1.21全接触


1. 编译环境:

       a. visual studio 2008 perfessional edition,因为已经安装了sp1,所以不确定它会对编译有何影响。

       b. QT opensource v4.50,只编译了其动态库文件(静态库无法编译完全)。

执行“Visual Studio 2008 命令提示 ”控制台工具后,在QT根目录执行QT编译环境设置脚本,该脚本同时为meshlab生成vc 项目工程的环境。一下为该脚本原文:

@echo off

set cur_dir=%cd%\

set QTDIR=%cur_dir%

set QMAKESPEC=win32-msvc2008

set ConfPara=-debug-and-release -opensource -fast -no-dbus -no-webkit

 

set PATH=%QTDIR%/bin;%PATH%

set INCLUDE=%MINGWDIR%/include;%QTDIR%/include;%QWTDIR%/src;%LOG4QTDIR%/src;%INCLUDE%

set LIB=%MINGWDIR%/lib;%QTDIR%/lib;%QWTDIR%/lib;%LIB%

 

echo ***********************************************************************

echo Created By gmail:bygreencn.gmail.com

echo Includes  : QT 4.5.0Visual Studio 2008

echo QT        : %QTDIR%

echo QMAKESPEC: %QMAKESPEC%

echo ConfPara: %ConfPara%

echo ***********************************************************************

@REM pause

@REM nmake clean

@REM nmake confclean

@REM configure.exe %ConfPara%

 

@REM pause

@REM echo build it now?

@REM nmake clean

cmd /k

 

       c.下载MeshLab's source code version 1.2.1,我下载的是All Inclusive package

2. 生成所需的VC项目工程文件

a. 上一步的控制台,进入.\ meshlab\src\external,执行qmake -tp vc -recursive external.pro

b. 上一步的控制台,进入.\ meshlab\src,执行qmake -tp vc -recursive meshlabv12.pro

3. 编译meshlab

       a. 首先编译external library。用vc打开.\ meshlab\src\external\external.sln,进入配置管理器,选择编译debugrelease版本,在选择生成解决方案,等待编译全部通过,它会生成三个库文件。bz.lib,3ds.libmuparser.lib,我发现3ds.lib的生成有些问题,会使得meshlabLINK时无法正确连接函数,我在lib3ds\type.h做了一下修改:

//#ifdef _MSC_VER

//#ifdef LIB3DS_EXPORTS

//#define LIB3DSAPI __declspec(dllexport)

//#else              

//#define LIB3DSAPI __declspec(dllimport)

//#endif           

//#else

#define LIB3DSAPI

//#endif

       b.编译meshlabmeshlab所有的plugin工程的设置有些问题,这些工程都制定输出为动态库,但是输出文件却指定为输出为*****.lib,这导致所有的plugins的工程都失败。我的做法是把指定输出为*****.dll,这里应该必须为dll,因为New的对话框中会根据plugins文件夹下的内容动态生成,因为这些应该也是动态加载的,因为静态库是不行的了。

1). 需要为io_lib指定其需要的lib3ds.lib(external library)

2). 需要为io_epoch指定其需要的bz2.lib和头文件的位置(external library)

如果哪个plugin工程出现类似这个错误:

1>Project : error PRJ0019: 某个工具从以下位置返回了错误代码: "MOC v3dImportDialog.h"

1>项目: warning PRJ0018 : 未找到下列环境变量:

1>$(QTDIR)

只需要用生成VC项目的那个控制台环境进入相应的plugin目录,执行qmake -tp vc -recursive xxxxxx.pro来重新生成该工程即可。

 

编译整个项目,大概需要十多分钟。然后就可以进入.\meshlab\src\meshlab\debug或者.\meshlab\src\meshlab\release执行meshlab.exe;记得要把QTDLL库文件拷贝到这个目录或者将QTDLL库所在目录加入到系统PATH中啊。

 

May 13

破解无线路由器密码

Posted by chinahang 2009年5月13日

随着社会的进步!WIFI上网日益普及,特别是大城市中随便在一个小区搜索一下就能找到好多热点,搜索到热点然后链接上去那么我们就可以尽情的享受免费上网服务了。
不过除了公共场所以及菜鸟用户之外几乎所有的WIFI信号都是加密的,很简单换作是你你也不愿意把自己的带宽免费拿出来给别人用,所以如果你搜索到你附近有热点想免费上网的话请仔细往下学习...
                                                           

                                                       破解静态WEP KEY全过程

 

 

发现

首先通过NetStumbler确认客户端已在某AP的覆盖区内,并通过AP信号的参数进行‘踩点’(数据搜集)。

NetStumbler 下载地址  

通 过上图的红色框框部分内容确定该SSID名为demonalex的AP为802.11b类型设 备,Encryption属性为‘已加密’,根据802.11b所支持的算法标准,该算法确定为WEP。有一点需要注意:NetStumbler对任何有 使用加密算法的STA[802.11无线站点]都会在Encryption属性上标识为WEP算法,如上图中SSID为gzpia的AP使用的加密算法是 WPA2-AES。

破解

下载Win32AirCrack程序集---WinAirCrackPack工具包(下载地址:http://www.demonalex.net/download/wireless/aircrack/WinAircrackPack.zip)。解压缩后得到一个大概4MB的目录,其中包括六个EXE文件:

aircrack.exe  WIN32aircrack程序

airdecap.exe      WEP/WPA解码程序

airodump.exe  数据帧捕捉程序

Updater.exe WIN32aircrack的升级程序

WinAircrack.exe      WIN32aircrack图形前端

wzcook.exe 本地无线网卡缓存中的WEPKEY记录程序

 

我们本次实验的目的是通过捕捉适当的数据帧进行IV(初始化向量)暴力破解得到WEP KEY,因此只需要使用airodump.exe(捕捉数据帧用)与WinAircrack.exe(破解WEP KEY用)两个程序就可以了。

首先打开ariodump.exe程序,按照下述操作:

 
首 先程序会提示本机目前存在的所有无线网卡接口,并要求你输入需要捕捉数据帧的无线网卡接口编号,在这里我选择使用支持通用驱动的BUFFALO WNIC---编号‘26’;然后程序要求你输入该WNIC的芯片类型,目前大多国际通用芯片都是使用‘HermesI/Realtek’子集的,因此选 择‘o’;然后需要输入要捕捉的信号所处的频道,我们需要捕捉的AP所处的频道为‘6’;提示输入捕捉数据帧后存在的文件名及其位置,若不写绝对路径则文 件默认存在在winaircrack的安装目录下,以.cap结尾,我在上例中使用的是‘last’; 最后winaircrack提示:‘是否只写入/记录IV[初始化向量]到cap文件中去?’,我在这里选择‘否/n’;确定以上步骤后程序开始捕捉数据 包。

下 面的过程就是漫长的等待了,直至上表中‘Packets’列的总数为300000时即可满足实验要求。根据实验的经验所得:当该AP的通信数据流量极度频 繁、数据流量极大时,‘Packets’所对应的数值增长的加速度越大。当程序运行至满足‘Packets’=300000的要求时按Ctrl+C结束该 进程。 此时你会发现在winaircrack的安装目录下将生成last.cap与last.txt两个文件。其中last.cap为通用嗅探器数据包记录文件 类型,可以使用ethereal程序打开查看相关信息;last.txt为此次嗅探任务最终的统计数据(使用‘记事本/notepad’打开 last.txt后得出下图)。

下面破解工作主要是针对last.cap进行。首先执行WinAirCrack.exe文件:

单击上图红色框框部分的文件夹按钮,弹出*.cap选定对话框,选择last.cap文件,然后通过点击右方的‘Wep’按钮切换主界面至WEP破解选项界面:

选 择‘Key size’为64(目前大多数用户都是使用这个长度的WEP KEY,因此这一步骤完全是靠猜测选定该值),最后单击主界面右下方的‘Aircrack the key…’按钮,此时将弹出一个内嵌在cmd.exe下运行的进程对话框,并在提示得出WEP KEY:

利用

打开无线网卡的连接参数设置窗口,设置参数为:

SSIDdemonalex

频道:6

WEP KEY111112222264位)

OK,现在可以享受连入别人WLAN的乐趣了。

April 28

让VS 2008支持Subversion插件Ankhsvn

Visual Studio 2005 有一个开源的Subversion插件,Ankhsvn  (http://ankhsvn.tigris.org/),安装后,VS 2005中将内置Subversion的支持,可以直接在VS里面提交修改。我经常用它和TortoiseSVN 配合来使用Subversion,十分方便。

可是升级到Visual Studio 2008后,发现Ankhsvn没有集成进来,因为目前的Ankhsvn还不支持VS2008,据说下个版本才会支持VS 2008。

不过这不影响我们在Visual Studio 2008中使用Ankhsvn,我们可以自己动手修改注册表,将Ankhsvn集成进VS 2008。方法很简单。

  1. 运行 regedit
  2. 找到 HKLMSOFTWAREMicrosoftVisualStudio8.0AddinsAnkh
  3. 右键点击它,选择导出,并指定一个文件保存。
  4. 用记事本或者其他文本编辑器打开这个文件,将其中的VisualStudio8.0替换为VisualStudio9.0
  5. 最后,双击这个修改后的注册表文件,提示是否导入进系统注册表,选择是。

再次打开Visual Studio 2008后,就会发现Ankhsvn已经集成进系统了。

为了方便操作,我写了一个vbscript脚本来进行上述操作。使用很简单,将下面的脚本保存到一个文本文件,命名为ankh.vbs,然后双击该文件即可运行。运行后,重新打开Visual Studio 2008,就会发现Ankhsv已经集成进来了。

顺便再推荐几个常用的免费的插件:

[FREE VISUAL STUDIO ADD-INS]
http://searchwindevelopment.techtarget.com/originalContent/0,289142,sid8_gci1262570,00.html


需要提醒的是,注册表操作不慎可能会导致系统崩溃,因此请谨慎修改注册表。

Dim shell, filename, fso, file, content
Set shell = CreateObject("wscript.shell"
)
Set fso = CreateObject("Scripting.FileSystemObject"
)
filename 
= "ankh.reg"


shell.run 
"reg export HKLMSOFTWAREMicrosoftVisualStudio8.0AddinsAnkh " & filename, 1True

Set file = fso.OpenTextFile(filename, 1FalseTrue)
content 
=
 file.ReadAll
content 
= Replace(content, "VisualStudio8.0""VisualStudio9.0"
)
content 
= Replace(content, ".NET 2005"".NET 2008"
)
file.Close()

Set file = fso.OpenTextFile(filename, 2True
)
file.Write content
file.Close()

shell.run 
"reg import " & filename, 1true


fso.DeleteFile filename
 

Libin

Custom HTML