博文

设置Android模拟器上网的方法(2011-04-05 22:56:00)

摘要:
设置Android模拟器上网的方法 由于有些电脑上网需要设置代理才能上网,所以简单的启动模拟器,模拟器是不能直接上网的,而且模拟器对于网络部分没有直接设置模拟器的上网代理的程序或者是设置的部分。所以需要额外的处理才行。经过多方面的摸索,才得出一个方法。 下面是设置的步骤: 1、启动adb shell,这个一般是在sdk目录下的tools下的(在1.6之前),但是之后的版本都移到了platform tools目录下了。这个没有关系,一般可以把这个目录添加到系统的环境变量下的PATH后面,这样在只需要在执行里面或者cmd中输入就可以了。
在cmd中输入adb shell,或者是在运行里面直接输入adb shell就可以了。 2、通过运行getprop命令就可以获取系统的配置,主要是查看两个配置,一个是net.dns1,另外一个是net.gprs.http-proxy 。如果这两个的配置都和你pc上网的设置是一样的,那就不需要设置了。如果不一样,就看下一条。 3、通过setprop命令进行设置 设置dns,一般如果是通过路由器上网,可以把 dns设置为路由器的默认网关。192.168.1.1。 setprop net.dns1 192.168.1.1 另外就是设置代理了。如下: setprop net.gprs.http-proxy 192.168.1.1:8080 如果是其他代理,也是用这条指令,如
setprop net.gprs.http-proxy 10.81.110.1:8080 一般通过这三步就可以实现上网了。   另外,有的版本的模拟器在程序的设置里面有个命令的程序,这个和adb shell的功能是一样的,也就是可以通过输入指令来实现配置的修改和设置。原理是一样的,指令也是用一样的。大家可以试一下。......

阅读全文(7420) | 评论:0

Google中国赛代码参详Group2-750分(4)(2005-12-13 11:47:00)

摘要:
第二道题,权值750
Problem Statement
You are playing a card game, and in your hand, you are holding several
cards. Each card has a suit, 'S', 'H', 'D', or 'C', and a value between
1 and 10, inclusive. You may play cards as part of a set, which is
three or more cards of the same value, or as part of a run, which is
three or more cards of the same suit, in sequential order. (Runs may
not wrap, thus, 9-10-1 is not a valid run.) Each card may be played
only once.
For example, "1 S", "1 H" and "1 D" would be a valid set. "2 S", "3 S",
and "4 S" would be a valid run.
You want to play as many cards as possible, maybe in several plays (see
example 4). Given a String[] cards representing the cards held in your
hand, you are to return an int indicating the maximum number of cards
you can play. Each card will be given in the form "value suit" (quotes
added for clarity).
有一个纸牌游戏,共有四种花色'S', 'H', 'D',
'C',每个花色都有1到10数字的十张牌,出牌的时候可以一起一套3......

阅读全文(4551) | 评论:0

Google中国赛代码参详Group2-250分(3)(2005-12-13 11:45:00)

摘要:第一道题,权值250
Problem Statement
You are given a String disk representing the clusters on a disk. An 'X'
represents a used cluster, and a '.' represents an available cluster.
You are also given an int size representing the size, in clusters, of a
file waiting to be written to disk. A file can only be stored in
clusters not already being used.
Return the minimum number of groups of consecutive clusters needed to
store the file on the disk. (The disk does not wrap around at the end.)
Return -1 if the disk does not have enough space available to store the
file.
给你一个标有簇的磁盘,X表示已近被使用,.表示可以使用的空间,再给你一个要写入的字节数,写入到未使用的空间中,如果空间不够返回-1
如果写入成功返回写入的次数,如果未使用的空间是连续的只算写入一次,写入的方式有很多,求出最少的次数
Definition
Class:
DiskClusters
Method:
minimumFragmentation
Parameters:
String, int
Returns:
int
Method signature:
int minimumFragmentation(String disk, int size)
(be sure your method is public)
类DiskClusters方法public in......

阅读全文(4690) | 评论:1

Google中国赛代码参详Group22-750分(2)(2005-12-13 11:33:00)

摘要: Problem Statement      You are given a String[] grid representing a rectangular grid of letters. You are also given a String find, a word you are to find within the grid. The starting point may be anywhere in the grid. The path may move up, down, left, right, or diagonally from one letter to the next, and may use letters in the grid more than once, but you may not stay on the same cell twice in a row (see example 6 for clarification). You are to return an int indicating the number of ways find can be found within the grid. If the result is more than 1,000,000,000, return -1. Definition      Class: WordPath Method: countPaths Parameters: String[], String Returns: int Method signature: int countPaths(String[] grid, String find) (be sure your method is public)      Constraints - grid will contain between 1 and 50 elements, inclusive. - E......

阅读全文(4476) | 评论:1

Google中国赛代码参详Group22-250分(1)(2005-12-13 11:28:00)

摘要: Problem Statement      You are given a string input. You are to find the longest substring of input such that the reversal of the substring is also a substring of input. In case of a tie, return the string that occurs earliest in input. Definition      Class: ReverseSubstring Method: findReversed Parameters: string Returns: string Method signature: string findReversed(string input) (be sure your method is public)      Notes - The substring and its reversal may overlap partially or completely. - The entire original string is itself a valid substring (see example 4). Constraints - input will contain between 1 and 50 characters, inclusive. - Each character of input will be an uppercase letter ('A'-'Z'). Examples 0)      "XBCDEFYWFEDCBZ" Returns: "BCDEF" ......

阅读全文(4369) | 评论:0