pigfoot’s weblog

We should forget about small efficiencies — Donald Knuth

Archive for the ‘Develop’ Category

Python 2.5 released

Python

Python 2.5 final released!, from digg.

This release (mailing list announcement) includes:

  • PEP 308: conditional expressions
  • PEP 328: absolute and relative imports
  • PEP 341: unified try/except/finally
  • PEP 342: new generator features
  • PEP 343: the ‘with’ statement
  • new packages: ctypes, ElementTree, hashlib, sqlite, wsgiref

For more details, you can refer to Python 2.5 what’s new.

Popularity: 28% [?]

CLR Inside Out: IronPython

CLR Inside Out: IronPython, from MSDN Magazine

IronPython is the code name for an implementation of the Python programming language written by the CLR team at Microsoft. IronPython runs on the Microsoft .NET Framework and supports an interactive console with fully dynamic compilation. It is well integrated with the rest of the .NET Framework and makes all .NET libraries easily available to Python programmers, while maintaining full compatibility with the Python language.

This column will give a brief overview of Python and what sets dynamic languages apart from other languages. I will discuss iterative development, describe how IronPython integrates with .NET while staying true to Python syntax, and show the advantages of using IronPython to utilize .NET.

Besides, Here are some sample codes on CodePlex:

Popularity: 19% [?]

  • 0 Comments
  • Filed under: Develop, Python
  • Peer to Peer (p2p) in Windows Vista - People Near Me API from ebooth’s blog.

    The overview of the p2p APIs available in Windows Vista is:

    • PNRP (Peer Name Resolution Protocol) is like server-less DNS. It allows clients to register secured and unsecured peer names that can be resolved over the internet. Currently large data centers are required to host services that PNRP has the potential to replace. PNRP gives people the ability to discover a friend and see their presence online and then play a game or work on a project together.
    • PNM (People Near Me) allows for dynamic discovery and invitation of computers running Windows Vista on the same subnet or Ad-hoc wireless. This means you can play games with people in the airport, swap photos with your friends or collaborate with colleagues. For example Windows Meeting Space uses PNM.
    • Peer Naming API allows email providers to tie PNRP names to email addresses. Then any program that uses the WinSock APIs can resolve registered email addresses. This means you can literally ping a friend or put their email address where you would have to put an IP address in a game.
    • Graphing is a mesh networking API. It allows groups of people to share information and collaborate. A game could create a mesh of online players so that it could do server-less match making. Or an evangelism team could collaborate on a document without having to upload the latest copy to a server.
    • Grouping is the security component of Graphing. It allows for a group to be administrated, so that membership and permissions can be restricted. Think of Grouping and Graphing as a database in the cloud.
    • Peer Channel is the only managed API in the P2P API suite. It allows for mesh replication instead of mesh collaboration.
    • Application Invite (AppInvite) allows a user to invite another user to use a collaboration application. Any application can register with the invite API and when a user sends an invite to use that application the application will be launched by Windows Vista. Windows Meeting Space is an example of an application that uses AppInvite.
    • Contacts API allows the creation and administration of p2p contacts.
    • Serverless Presence: Gets contact presence information.

    Popularity: 45% [?]

    Linux Per-Process Syscall Hooking

    Linux Per-Process Syscall Hooking, by Pluf.

    This document describes a new syscall hooking technique for Linux systems and exposes how it can be implemented as part of a virus or a backdoor in order to take full control over an userland application.

    Although there are some well-known methods for hooking functions, they are mostly based on the ELF format itself.

    This technique is focused on thoses pieces of code that are externally called by the main program and invoke a system call or system service.

    A simple implementation of this hooking mechanism has been developed as a result of the research and it is included with the article.

    This code provided does not have all the features you wish but includes the required ones, is not a real backdoor but a simple proof of concept, perfect to write your own one.

    Popularity: 31% [?]

  • 0 Comments
  • Filed under: C/C++, Develop, Kernel
  • mar project goes live!

    Recently, I’m surveying how to deploy Mozilla Firefox/Thunderbird with it’s update channel, but it’s very hard to use for un-official builders like me.

    Generally speaking, Firefox will try to send HTTP request to mozilla official site with some client information. For example, a nightly BonEcho will try to get document from this URL.

    AS you see, Firefox try to send some information like Firefox version, host architecture, host OS version and so on, and to get server response through SSL (in fact, it’s TLSv1). Of course, you can use any browser to see what the corresponding response is by this URL.

    Then Firefox can get type “complete” of patch tag, fetching the .mar file at mozilla official FTP site, and performing update procedure.

    Everything seems great, doesn’t it? Not exactly. It means that the Firefox updater program only support .mar file format, not gz, bzip2 format — the common compression we’ve known. Consequently I must have enough knowledge to know how to pack .mar archive as well.

    Hence, I create a project called mar hosting on Google Code (Brief introduction on ijliao’s blog). I hope these simple tool s could create, extract, and view the mozilla archive more easy.

    Popularity: 22% [?]

  • 0 Comments
  • Filed under: C/C++, Develop
  • Effective Python Programming

    Python

    Effective Python Programming, from OSCON 2005.

    Python’s growing popularity has brought many new developers to the language, often coming from other languages that have very different idioms and restrictions. This can lead to less-than-optimal coding styles.

    This tutorial focuses on writing Python in a “Pythonic” way, working through a series of examples.

    This is a concentrated exercise in helping people write code in a way that makes the best use of language features. It is of course possible to write bad Python–just as it’s possible to write bad code in any language. However, it is suprisingly easy to write good Python and hopefully this tutorial will help you bootstrap yourself into a better Python programmer.

    This tutorial is aimed at people who already know Python, but don’t consider themselves experts. (Python experts will probably know most of the things discussed in this tutorial.)

    You can download the presentation file (PDF) (159 slides) here.

    Popularity: 17% [?]

  • 0 Comments
  • Filed under: Develop, Python
  • Buffering in HTTP.SYS

    Buffering in HTTP.SYS, from Windows Core Networking Team’s blog.

    故事內容是這樣的. IIS 5.0 之前是用 WinSock 來 implement, 這樣預設會打開 buffering 機制, 到了 Windows 2003 的 IIS 6.0 開始, 則改由 HTTP.SYS 來負責. 這樣反而會遇到 performance 下降的問題.

    主要的理由我猜是 Nagle’s Algorithm. 現在的 socket 實作預設都會打開 TCP 的 Nagle’s Algorithm. 這個演算法簡單的說, 就是利用 delay ack 來減少網路上所傳輸 packet 量, 進而增加 TCP 的 performance. 不幸的是, Nagle’s Algorithm 對於小 packet 的幫助比較明顯, 大 packet 反而會有 latency 拉長的反效果. 換句話說, 對於一次傳輸大量資料的網路程式, 應該要 disable Nagle’s Algorithm 會有比較好的 performance.

    目前在 Windows 2003 SP1 之後有一個 workaround 的辦法, 就是利用 HTTP_SEND_RESPONSE_FLAG_BUFFER_DATA 這個 flag. 雖然說還有另一個 flag 是 HTTP_SEND_RESPONSE_FLAG_ENABLE_NAGLING, 表示預設應該是 disable Nagle’s Algorithm, 不過我還是很好奇, 為甚麼預設明明 disable Nagle’s Algorithm, performance 沒上去的原因, 和一般網路程式 enable Nagle’s Algorithm 一樣呢?

    Popularity: 45% [?]