April 2008 Archives
from __future__ import with_statement
def fixFile(fileName) :
with open(fileName, "r") as f :
str = f.read().replace("\r\n", "\n").replace("\r", "\n")
with open(fileName, "w") as f :
f.write(str)
http://chrisarndt.de/en/software/python/threadpool/ http://chrisarndt.de/en/software/python/threadpool/threadpool.py.html http://snippets.dzone.com/posts/show/4425 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/203871 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/502291 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/435883 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/196618
Programming for multicore processors poses new challenges. Here are eight rules for multicore programming to help you be successful:
- Think parallel. Approach all problems looking for the parallelism. Understand where parallelism is, and organize your thinking to express it. Decide on the best parallel approach before other design or implementation decisions. Learn to "Think Parallel."
- Program using abstraction. Focus on writing code to express parallelism, but avoid writing code to manage threads or processor cores. Libraries, OpenMP, and Intel Threading Building Blocks are all examples of using abstractions. Do not use raw native threads (pthreads, Windows threads, Boost threads, and the like). Threads and MPI are the assembly languages for parallelism. They offer maximum flexibility, but require too much time to write, debug, and maintain. Your programming should be at a high-enough level that your code is about your problem, not about thread or core management.
- Program in tasks (chores), not threads (cores). Leave the mapping of tasks to threads or processor cores as a distinctly separate operation in your program, preferably an abstraction you are using that handles thread/core management for you. Create an abundance of tasks in your program, or a task that can be spread across processor cores automatically (such as an OpenMP loop). By creating tasks, you are free to create as many as you can without worrying about oversubscription.
- Design with the option to turn concurrency off. To make debugging simpler, create programs that can run without concurrency. This way, when debugging, you can run programs first with--then without--concurrency, and see if both runs fail or not. Debugging common issues is simpler when the program is not running concurrently because it is more familiar and better supported by today's tools. Knowing that something fails only when run concurrently hints at the type of bug you are tracking down. If you ignore this rule and can't force your program to run in only one thread, you'll spend too much time debugging. Since you want to have the capability to run in a single thread specifically for debugging, it doesn't need to be efficient. You just need to avoid creating parallel programs that require concurrency to work correctly, such as many producer-consumer models. MPI programs often violate this rule, which is part of the reason MPI programs can be problematic to implement and debug.
- Avoid using locks. Simply say "no" to locks. Locks slow programs, reduce their scalability, and are the source of bugs in parallel programs. Make implicit synchronization the solution for your program. When you still need explicit synchronization, use atomic operations. Use locks only as a last resort. Work hard to design the need for locks completely out of your program.
- Use tools and libraries designed to help with concurrency. Don't "tough it out" with old tools. Be critical of tool support with regards to how it presents and interacts with parallelism. Most tools are not yet ready for parallelism. Look for threadsafe libraries--ideally ones that are designed to utilize parallelism themselves.
- Use scalable memory allocators. Threaded programs need to use scalable memory allocators. Period. There are a number of solutions and I'd guess that all of them are better than malloc(). Using scalable memory allocators speeds up applications by eliminating global bottlenecks, reusing memory within threads to better utilize caches, and partitioning properly to avoid cache line sharing.
- Design to scale through increased workloads. The amount of work your program needs to handle increases over time. Plan for that. Designed with scaling in mind, your program will handle more work as the number of processor cores increase. Every year, we ask our computers to do more and more. Your designs should favor using increases in parallelism to give you advantages in handling bigger workloads in the future.
I wrote these rules with explicit mention of threading everywhere. Only rule #7 is specifically related to threading. Threading is not the only way to get value out of multicore. Running multiple programs or multiple processes is often used, especially in server applications.
These rules will work well for you to get the most out of multicore. Some will grow in importance over the next 10 years, as the number of processor cores rises and we see an increase in the diversity of the cores themselves. The coming of heterogeneous processors and NUMA, for instance, makes rule #3 more and more important.
You should understand all eight and take all eight to heart. I look forward to any comments you may have about these rules or parallelism in general.
After you do this, Firefox gives up all but 8MB of memory when minimized.
- Type about:config in the Address Bar
- Right Click in the page and select New -> Boolean
- Create variable config.trim_on_minimize
- Set variable to True
QuickFIX is a full-featured open source FIX engine, currently compatible with the FIX 4.0-4.4 spec. It runs on Windows, Linux, Solaris, FreeBSD and Mac OS X. API's are available for C++, Java, .NET, Python and Ruby.
Links to documents
The following was scraped from an online PowerPoint presentation:
Session level messages
- logon/logout
- heartbeat
- test request
- resend request
- reject
- sequence reset
Application level messages
- new order
- execution report
- order cancel/replace request
- allocation
- trade capture report
- confirmation
For each field:
- tag (a unique number)
- field name
- data type (string, char, price, quantity)
- description
- FIXML name (XML element name)
User-defined messages
User-defined fields
Message syntaxes
- 'tag=value' syntax
- tag (tag number)
- =
- value
- delimiter (ASCII SOH)
- FIXML syntax
- XML schema defined
- application messages only, no session level
Sample transaction
(1) buy side connect to TCP socket on port of sell side FIX engine
(2) sell side accepts TCP connection
(1) send Logon message
(2) send Logon message back
(1) send New Order message
(2) send Execution Report acknowledging order
(2) send Execution Report containing fillBuy 5000 IBM at 110.75
8=FIX4.2^ # BeginString 9=251^ # BodyLength 35=D^ # MsgType (New Order) 49=AFUNDMGR^ # SenderCompID (AFUNDMGR) 56=ABROKER^ # TargetCompID (ABROKER) 34=2^ # MsgSeqNum (2) 52=20030615-01:14:49^ # SendTime 11=12345^ # ClOrderID (CLient Order ID) 21=1^ # HandleInst (automated exec) 55=IBM^ # Symbol (IBM) 54=1^ # Side (buy) 60=2003061501:14:49^ # 38=5000^ # OrderQty (5000) 40=2^ # OrdType (Limit) 44=110.75^ # Price (110.75) 10=127^ # Checksum
<FIXML> <FIXMLMessage> <Header> <SendingTime></SendingTime> <Sender> <CompID>AFUNDMGR</CompID> </Sender> <Target> <CompID>ABROKERR</CompID> </Target> </Header> <ApplicationMessage> <Order> <ClOrdID></ClOrdID> <HandlInst Value="1" /> <Instrument> <Symbol>IBM</Symbol> </Instrument> <Side Value="1" /> <TransactTime></TransactTime> <OrderQtyData> <OrderQty>5000</OrderQty> </OrderQtyData> <OrderType Value="2" /> <Price>110.75</Price> </Order> </ApplicationMessage> </FIXMLMessage> </FIXML>
- Python 2.4: 96th percentile
- C# 2.0: 96th percentile
- Written English (UK): 98th percentile
- Written English: 99th percentile
- SQL ANSI: 99th percentile
- MS SQL Server programming
- .NET Framework
- .NET Framework 2.0
- .NET Framework Fundamentals
- ADO.NET
A list of the nights that Lincoln Center Midsummer Night Swing will be hosting swing bands:
| Date | Band |
|---|---|
| 2008-07-08 | Nellie McKay and the Aristocrats Swing Band |
| 2008-07-09 | Chuck Brown |
| 2008-07-10 | Michael Arenella and His Dreamland Orchestra |
| 2008-07-15 | Alan Gresik Swing Shift Orchestra |
| 2008-07-17 | Orquesta Tipica Imperial |
| 2008-07-22 | Harlem Renaissance Orchestra |
| 2008-07-24 | Lavay Smith and Her Red Hot Skillet Lickers |
