Wednesday, 10 December 2008

Some language characteristic in Python

''' represent multi-line String.

Raw Strings. Strings start with a r or R. r"Newlines are indicated by \n". The special character in the String is not prefixed by a escape.

Unicode Strings. Strings start with u or U. u"This is a Unicode string.". Automatically converted into Unicode format.

String literal concatenation. If you place two string literals side by side, they are automatically concatenated by Python. For example, 'What\'s' 'your name?' is automatically converted in to "What's your name?".

Notice for different kind programmers:
Note for C/C++ Programmers
There is no separate char data type in Python. There is no real need for it and I am sure you
won't miss it.

Note for Perl/PHP Programmers
Remember that single-quoted strings and double-quoted strings are the same - they do not differin any way.

Note for Regular Expression Users


Indentation in python is used to define block. And don't use a mixture of tab and whitespace to indentation

Some significant features in Python

Interpreted
A program written in a compiled language like C or C++ is converted
from the source language i.e. C or C++ into a language that is spoken
by your computer (binary code i.e. 0s and 1s) using a compiler with
various flags and options. When you run the program, the linker/loader
software copies the program from hard disk to memory and starts running
it.
Python, on the other hand, does not need compilation to binary. You
just run the program directly from the source code. Internally, Python
converts the source code into an intermediate form called bytecodes and
then translates this into the native language of your computer and then
runs it. All this, actually, makes using Python much easier since you
don't have to worry about compiling the program, making sure that the
proper libraries are linked and loaded, etc, etc. This also makes your Python
programs much more portable, since you can just copy your Python
program onto another computer and it just works!

Extensible
If you need a critical piece of code to run very fast or want to have some
piece of algorithm not to be open, you can code that part of your program
in C or C++ and then use them from your Python program.

Embeddable
You can embed Python within your C/C++ programs to give 'scripting'
capabilities for your program's users.

Extensive Libraries
The Python Standard Library is huge indeed. It can help you do various
things involving regular expressions, documentation generation, unit
testing, threading, databases, web browsers, CGI, ftp, email, XML,
XML-RPC, HTML, WAV files, cryptography, GUI (graphical user interfaces),
Tk, and other system-dependent stuff. Remember, all this is
always available wherever Python is installed. This is called the 'Batteries
Included' philosophy of Python.
Besides, the standard library, there are various other high-quality libraries
such as wxPython [http://www.wxpython.org], Twisted
[http://www.twistedmatrix.com/products/twisted], Python Imaging Library
[http://www.pythonware.com/products/pil/index.htm] and many
more.

Tuesday, 9 December 2008

Beginning to Python

Python can run many platforms. Python is available for all major operating systems: Windows, Linux/Unix, OS/2, Mac, Amiga, among others.

Python can play well with others:

Python can integrate with COM, .NET, and CORBA objects.

For Java libraries, use Jython, an implementation of Python for the Java Virtual Machine.

For .NET, try IronPython , Microsoft's new implementation of Python for .NET, or Python for .NET.

Python is also supported for the Internet Communications Engine (ICE) and many other integration technologies.

If you find something that Python cannot do, or if you need the performance advantage of low-level code, you can write extension modules in C or C++, or wrap existing code with SWIG or Boost.Python. Wrapped modules appear to your program exactly like native Python code. That's language integration made easy. You can also go the opposite route and embed Python in your own application, providing your users with a language they'll enjoy using.


Python Success Stories


Monday, 8 December 2008

CUDA

CUDA is a technology that enable you to use the computing resource in GPU(Graphics processing Unit) to compute. This technology is given by NVIDIA.
The following is from wiki

CUDA (originally Compute Unified Device Architecture although this is no longer used) is a parallel computing architecture developed by NVIDIA. Simply put, CUDA is the compute engine in NVIDIA graphics processing units or GPUs, that is accessible to software developers through industry standard programming languages. Programmers use C for CUDA, compiled through a PathScale Open64 C compiler,[1] to code algorithms for execution on the GPU. CUDA is architected to support all computational interfaces, including C and new open standards like OpenCL and DX11 Compute. Third party wrappers are also available for Python, Fortran and Java.


The latest drivers all contain the necessary CUDA components. CUDA works with all NVIDIA GPUs from the G8X series onwards, including GeForce, Quadro and the Tesla line. NVIDIA states that programs developed for the GeForce 8 series will also work without modification on all future Nvidia video cards, due to binary compatibility. CUDA gives developers access to the native instruction set and memory of the parallel computational elements in CUDA GPUs. Using CUDA, the latest NVIDIA GPUs effectively become open architectures like CPUs (Central Processing Units). Unlike CPUs however, GPUs have a parallel "many-core" architecture, each core capable of running thousands of threads simultaneously - if an application is suited to this kind of an architecture, the GPU can offer large performance benefits.


In the computer gaming industry, in addition to graphics rendering, graphics cards are used in game physics calculations (physical effects like debris, smoke, fire, fluids), an example being PhysX and Bullet (software). CUDA has also been used to accelerate non-graphical applications in computational biology, cryptography and other fields by an order of magnitude or more.[2][3][4]


CUDA provides both a low level API and a higher level API. The initial CUDA SDK was made public 15th February 2007. NVIDIA has released versions of the CUDA API for Microsoft Windows, Linux and Mac OS X was added as a fully supported platform in version 2.0[5], which supersedes the beta released February 14, 2008.[6]


Advantages

CUDA has several advantages over traditional general purpose computation on GPUs (GPGPU) using graphics APIs.

  • It uses the standard C language, with some simple extensions.
  • Scattered reads – code can read to arbitrary addresses in memory.
  • Shared memory – CUDA exposes a fast shared memory region (16KB in size) that can be shared amongst threads. This can be used as a user-managed cache, enabling higher bandwidth than is possible using texture lookups.[7]
  • Faster downloads and readbacks to and from the GPU
  • Full support for integer and bitwise operations, including integer texture lookups.

Limitations

  • It uses a recursion-free subset of C language, plus some simple extensions. However, a single process must run spread across multiple disjoint memory spaces, unlike other C language runtime environments.
  • Texture rendering is not supported.
  • Recursive functions are not supported and must be converted to loops.
  • For double precision there are no deviations from the IEEE 754 standard. In single precision, Denormals and signalling NaNs are not supported; only two IEEE rounding modes are supported (chop and round-to-nearest even), and those are specified on a per-instruction basis rather than in a control word (whether this is a limitation is arguable); and the precision of division/square root is slightly lower than single precision.
  • The bus bandwidth and latency between the CPU and the GPU may be a bottleneck.
  • Threads should be run in groups of at least 32 for best performance, with total number of threads numbering in the thousands. Branches in the program code do not impact performance significantly, provided that each of 32 threads takes the same execution path; the SIMD execution model becomes a significant limitation for any inherently divergent task (e.g., traversing a ray tracing acceleration data structure).
  • CUDA-enabled GPUs are only available from NVIDIA (GeForce 8 series and above, Quadro and Tesla)[8]

Sunday, 7 December 2008

DataBinding in Flex

Flex let us use a very simple way to bind our data to the controls.
I will show just a very simple example first, more complicated examples will be add in future.
*Simple:
<mx:HBox> <mx:Text id="output" text="{input.text}"> </mx:Text> <mx:TextInput id="input"> </mx:TextInput> </mx:HBox>
The output text can updated instantly when you change the content in "input" TextInput control.

This is called inline data binding.Inline data binding represents the most limited use of ActionScript, because it can evaluate only one expression. For instance, the preceding example evaluates the expression input.text. You could use a more complex expression, such as the
following:
text="{'User input: ' + input.text}"

Test blog send from email

This is a blog send from email.

Ways to detect Flash version

1. Change the template file in the SDK Resource directory resides in Flex Builder.
There many items you can define, such as applicationName or backgroundColor.
2. Using SWFObject. For more reference, see here: http://
blog.deconcept.com/swfobject