Blog Archive

Wednesday, July 13, 2011

cmd出问题了! - Windows专区 / WindowsXP/2003/2008

环境变量的问题

右击我的电脑 属性 高级 环境变量 系统变量 Path 改成
%SystemRoot%\system32;%SystemRoot%;

2010年最佳iPhone和Android 应用程序

2010年最佳iPhone和Android 应用程序
最经常提到的iPhone 应用 (用户应用列表中)

   1. Facebook
   2. Evernote
   3. Twitter
   4. Yelp
   5. Pandora Radio
   6. foursquare
   7. Angry Birds
   8. Dropbox
   9. Skype
  10. Google Earth
(注意:  Google的移动应用程序才排到第十位)

最经常提到的Android 应用 (用户应用列表中)

   1. Angry Birds
   2. Evernote
   3. Google Maps
   4. Foursquare
   5. Google Shopper
   6. Pandora Radio
   7. Remember The Milk
   8. Springpad
   9. TWIDROID PRO for Twitter
  10. Dropbox

最值得拥有的iPhone 应用 (用户应用列表中)

   1. Facebook
   2. Google Mobile App
   3. Pandora Radio
   4. Shazam
   5. Google Earth
   6. Skype
   7. Evernote
   8. Kindle
   9. Twitter
  10. Remote

最值得拥有的Android应用 (用户列表中)

   1. Google Maps
   2. Facebook for Android
   3. Barcode Scanner
   4. Amazon MP3
   5. YouTube
   6. Google Goggles
   7. Advanced Task Killer
   8. Google Sky Map
   9. Pandora Radio
  10. Kindle for Android

下载次数最多的iOS 应用 (免费的)

   1. Appolicious for iPad
   2. Appolicious
   3. Flipboard
   4. Dragon Dictation
   5. Netflix
   6. Tap Tap Revenge 3
   7. ABC Player
   8. Evernote
   9. Pandora Radio
  10. Lose It!
  11. Space Miner Blast
  12. Siri Assistant
  13. W.TV
  14. Unblock Me FREE
  15. 3D Brick Breaker Revolution FREE
  16. Crush the Castle Free
  17. GodFinger for iPad
  18. Google Earth
  19. Dexter
  20. NinJump

下载次数最多的iOS 应用 (收费的)

   1. Modern Combat 2: Black Pegasus
   2. Spider-Man: Total Mayhem
   3. Real Soccer 2011
   4. Angry Birds
   5. Zombie Wonderland
   6. The Word Chase
   7. Grand Theft Auto: Chinatown Wars HD
   8. Monkey Island 2 Special Edition: LeChuck’s Revenge
   9. Bruce Lee Dragon Warrior
  10. The Last Airbender
  11. Word Warp
  12. NBA Elite 11 by EA Sports
  13. WordZinga!
  14. Angry Birds Seasons
  15. Splinter Cell Conviction
  16. Skate It by EA
  17. Doodle Jump
  18. WordSnake…Words Without Borders
  19. PREDATORS
  20. Fruit Ninja

下载次数最多的Android 应用 (免费的)

   1. Angry Birds
   2. Skyfire Web Browser 3.0
   3. Barcode Scanner
   4. Angry Birds Lite Beta
   5. Flash download
   6. Skype Mobile on Verizon
   7. Appolicious AndroidApps.com
   8. Facebook for Android
   9. Kindle for Android
  10. Lookout Mobile Security
  11. Skype
  12. Talking Tom Cat
  13. Porn Videos
  14. Flash Player 10.1
  15. MSN Talk
  16. AndroMoviX
  17. ShopSavvy Barcode Scanner
  18. Paper Toss
  19. Pandora Radio
  20. Porn Videos private FREE

下载次数最多的Android应用 (收费的):

   1. Jewellust
   2. FIFA 10 by EA Sports
   3. Robo Defense
   4. Asphalt HD
   5. Angry Birds
   6. Talking Carl
   7. Advanced Task Manager
   8. Abduction! 2
   9. Beautiful Widgets
  10. Doodle Jump
  11. Root Explorer (File Manager)
  12. Car Locator
  13. Deer Hunter 3D
  14. Fruit Ninja
  15. Skies of Glory
  16. The Sims 3 for Android
  17. Tanks!
  18. Speedx 3D
  19. Pocket God
  20. Real HDMI

Compiling C and C++ Programs

http://pages.cs.wisc.edu/~beechung/ref/gcc-intro.html



Compiling C and C++ Programs

gcc is the "GNU" C Compiler, and g++ is the "GNU C++ compiler, while cc and CC are the Sun C and C++ compilers also available on Sun workstations. Below are several examples that show how to use g++ to compile C++ programs, although much of the information applies to C programs as well as compiling with the other compilers.

Example 1: Compiling a simple program

Consider the following example: Let "hello.C" be a file that contains the following C++ code.
#include "iostream.h"
  int main() 
  {
    cout << "Hello\n";
  } 
The standard way to compile this program is with the command
g++ hello.C -o hello 
This command compiles hello.C into an executable program named "hello" that you run by typing 'hello' at the command line. It does nothing more than print the word "hello" on the screen.
Alternatively, the above program could be compiled using the following two commands.
g++ -c hello.C
  g++ hello.o -o hello 
The end result is the same, but this two-step method first compiles hello.C into a machine code file named "hello.o" and then links hello.o with some system libraries to produce the final program "hello". In fact the first method also does this two-stage process of compiling and linking, but the stages are done transparently, and the intermediate file "hello.o" is deleted in the process.

Frequently used compilation options

C and C++ compilers allow for many options for how to compile a program, and the examples below demonstrate how to use many of the more commonly used options. In each example, "myprog.C" contains C++ source code for the executable "myprog". In most cases options can be combined, although it is generally not useful to use "debugging" and "optimization" options together.
Compile myprog.C so that myprog contains symbolic information that enables it to be debugged with the gdb debugger.
g++ -g myprog.C -o myprog
Have the compiler generate many warnings about syntactically correct but questionable looking code. It is good practice to always use this option with gcc and g++.
g++ -Wall myprog.C -o myprog
Generate symbolic information for gdb and many warning messages.
g++ -g -Wall myprog.C -o myprog
Generate optimized code on a Solaris machine with warnings. The -O is a capital o and not the number 0!
g++ -Wall -O -mv8 myprog.C -o myprog
Generate optimized code on a Solaris machine using Sun's own CC compiler. This code will generally be faster than g++ optimized code.
CC -fast myprog.C -o myprog
Generate optimized code on a Linux machine.
g++ -O myprog.C -o myprog
Compile myprog.C when it contains Xlib graphics routines.
g++ myprog.C -o myprog -lX11
If "myprog.c" is a C program, then the above commands will all work by replacing g++ with gcc and "myprog.C" with "myprog.c". Below are a few examples that apply only to C programs.
Compile a C program that uses math functions such as "sqrt".
gcc myprog.C -o myprog -lm
Compile a C program with the "electric fence" library. This library, available on all the Linux machines, causes many incorrectly written programs to crash as soon as an error occurs. It is useful for debugging as the error location can be quickly determined using gdb. However, it should only be used for debugging as the executable myprog will be much slower and use much more memory than usual.
gcc -g myprog.C -o myprog -lefence

Example 2: Compiling a program with multiple source files

If the source code is in several files, say "file1.C" and "file2.C", then they can be compiled into an executable program named "myprog" using the following command:
g++ file1.C file2.C -o myprog 
The same result can be achieved using the following three commands:
g++ -c file1.C
  g++ -c file2.C
  g++ file1.o file2.o -o myprog 
The advantage of the second method is that it compiles each of the source files separately. If, for instance, the above commands were used to create "myprog", and "file1.C" was subsequently modified, then the following commands would correctly update "myprog".
g++ -c file1.C
  g++ file1.o file2.o -o myprog 
Note that file2.C does not need to be recompiled, so the time required to rebuild myprog is shorter than if the first method for compiling myprog were used. When there are numerous source file, and a change is only made to one of them, the time savings can be significant. This process, though somewhat complicated, is generally handled automatically by a makefile.

Send from my iPhone

MPI quick tutorial

http://en.wikipedia.org/wiki/OpenMP


1) Code:        Refer to attachment at the end of this article
2) Compile:   gcc -fopenmp hello.c
3) Run:          ./a.out
4) Results:    (It depends on your own case, mine is 2-core machine)
Hello World from thread 1
Hello World from thread 0
There are 2 threads


Attachment:
#############################

Hello World

This is a basic program, that exercises the parallel, private and barrier directives, as well as the functions omp_get_thread_num and omp_get_num_threads (not to be confused).

This program can be compiled using gcc-4.4 with the flag -fopenmp
//FILENAME: hello.c
#include <omp.h>
#include <stdio.h>
#include <stdlib.h>
 
int main (int argc, char *argv[]) {
  int th_id, nthreads;
  #pragma omp parallel private(th_id)
  {
    th_id = omp_get_thread_num();
    printf("Hello World from thread %d\n", th_id);
    #pragma omp barrier
    if ( th_id == 0 ) {
      nthreads = omp_get_num_threads();
      printf("There are %d threads\n",nthreads);
    }
  }
  return EXIT_SUCCESS;
}

Monday, July 11, 2011

如何学习Objective-C

如何学习Objective-C: "如何学习Objective-C[ 1 ]"

如何学习Objective-C[ 1 ]

http://www.rocklv.net/2004/news/article_250.html


1.请先把C语言基础学好;
2.看《Programming in Objective-C 2.0》,不要看《Objective-C 2.0程序设计》;
3.看《Cocoa Design Patterns》和《Cocoa Programming Developer's Handbook》,不要因为他们很难而我们自己是初学者所以就不看;
4.是的,你需要一台Mac,如果你真的打算好好学Objective-C和Cocoa的话;
5.不要放过任何一个看上去很简单的小编程问题——他们往往并不那么简单,或者可以引伸出很多知识点;
6.会用Objective-C,并不说明你会Cocoa编程;
7.学语法并不难,Foundation,Appkit,UIKit,Core Data,Core Animation也不过如此——难的是长期坚持实践和不遗余力的查阅文档;
8.请时刻记住,要写出好的App,界面设计和程序功能同等重要——其实可以时刻记住:Mac/iOS用户界面规约也是必读的文档;
9.不看C语言的书,是学不好Objective-C语言的;
10.浮躁的人容易说:XX语言不行了,应该学YY;——是你自己不行了吧!?
11.浮躁的人容易问:我到底该学什么;——别问,学就对了;
12.浮躁的人容易问:XX有钱途吗;——建议你去抢银行;
13.浮躁的人容易说:我要中文版!我英文不行!——不行?学呀!
14.浮躁的人容易问:XX和YY哪个好;——告诉你吧,都好——只要你学就行;
15.浮躁的人分两种:a)只观望而不学的人;b)只学而不坚持的人;
16.Cocoa是Objective-C的框架,主要包括Foundation,Appkit和Core Data。Cocoa Touch是Cocoa的iOS版本,主要包括Foundation,UIKit和Core Data;
17.Objective-C不仅仅是为C加了个类——运行时环境同样至关重要;
18.学习编程最好的方法之一就是阅读文档和源代码,请善用Xcode文档里的程序实例源代码;
19.请记住,Objective-C是“动态”的语言;
20.请阅读《Objective-C 2.0 Programming Language》等文档——官方的文档总是最权威,最完整的参考书;
21.看得懂的书,请仔细看;看不懂的书,请硬着头皮看;
22.别指望看第一遍书就能记住和掌握什么——请看第二遍、第三遍;
23.请记住,iOS和Mac开发本质上是相同的,不过区别也同样要被重视;
24.不要停留在Xcode的层面上。掌握通过命令行使用gcc和gdb,以及git等工具,将使你效率倍增;
25.和别人一起讨论有意义的Objective-C和Cocoa知识点,而不是争吵Cocoa行不行或者Objective-C与C++哪个好;
26.不要被各种Core XXX等“技术”名词所迷惑,它们只不过是C和Objective-C的框架(库)而已;
27.如果你学过C++,请暂时忘记使用.(点)调用方法,Objective-C是用方括号的,并且更准确的名字叫做“消息传递”;
28.Objective-C是C语言的严格超集,和C语言联系紧密,C语言是Objective-C的一部分;
29.请不要认为学过C++语言再改学Objective-C就没有什么问题——你只不过又在学一门全新的语言而已;
30.读完了《Cocoa Programming Developer's Handbook》以后再来认定自己是不是已经学会了Objective-C;
31.学习编程的秘诀是:编程,编程,再编程;
32.请留意下列书籍:《Cocoa Programming Developer's Handbook》《Cocoa Design Pattern》《iOS 4 Advaced Programming》《Cocoa Programming A Quick-Start Guide for Developers》;
33.不要因为苹果是个商业公司,你就可以忘记开源。于个人来说,开源是给予,但你却获得了更多。别忘了,苹果自己也使用了大量开源技术;
34.请把书上的程序例子亲手输入到电脑上实践,即使配套光盘中有源代码;
35.空闲的时候可以把自己的想法变成代码,并放到github上去,或把它变成App Store里的一个软件;
36.请重视Objective-C的运行时环境编程,并将其切实的运用到自己的程序中;
37.经常回顾自己以前写过的程序,并尝试重写,把自己学到的新知识运用进去;
38.不要漏掉书中任何一个练习题——请全部做完并记录下解题思路;
39.Objective-C,Cocoa和Xcode集成开发环境要同时学习和掌握;
40.既然决定了学Objective-C,就请坚持学下去,因为学习程序设计语言的目的是掌握程序设计技术,而程序设计技术是跨语言的;
41.工欲善其事,必先利其器,要做好Objective-C和Cocoa开发,请用好Xcode;
42.当你写Cocoa程序写到一半却发现自己用的方法很拙劣时,请不要马上停手;请尽快将余下的部分粗略的完成以保证这个设计的完整性,然后分析自己的 错误并重新设计和编写(参见43);
43.别心急,设计Objective-C的类确实不容易;自己程序中的类和自己的类设计水平是在不断的编程实践中完善和发展的;
44.决不要因为程序“很小”就不遵循某些你不熟练的规则——好习惯是培养出来的,而不是一次记住的;
45.每学到一个Objective-C的难点的时候,尝试着对别人讲解这个知识点并让他理解——你能讲清楚才说明你真的理解了;
46.记录下在和别人交流时发现的自己忽视或不理解的知识点;
47.请不断地对自己写的程序提出更高的要求,哪怕你的程序版本号会变成Version 100.XX;
48.保存好你写过的所有的程序——github是你最佳的代码托管工具;
49.请不要做浮躁的人;
50.请热爱Objective-C!