存档

‘saving’ 分类的存档

FW: Readers Write About Symbian, OS X and the iPhone

2007年2月9日 hufey 评论已被关闭


Responding to Origins: Why the iPhone is ARM, and isn’t Symbian, sources from Sweden and Finland offer a revealing look inside Symbian development and how the OS is regarded at Nokia, and what that means for development on the iPhone.
One developer writes, “In most regards, Symbian’s reputation as a modern, robust, stable and advanced OS for smartphones is not well deserved. Sure, Symbian works, it has a very long feature list, and it’s probably even the best smartphone OS available today. But it’s mostly because the competition is pathetic than anything else.
“I have a done several Symbian projects and have a thorough knowledge and low-level understanding of Symbian. And I just hate it. It’s a very bad and uninspiring OS even from a programmers point of view.”
Nokia’s POS/OS
Sources close to Nokia say that Symbian is secretly regarded inside the company–even among high level senior executives–as a “piece-of-shit-OS,” explaining that “Finnish people usually have a very coarse language.”
A Symbian developer explains, “Nokia is more or less stuck with Symbian since it doesn’t have the competence nor the time to make a new OS from the ground up. Its only alternative, in practice, is to go Linux, which it is of course experimenting with, but it’s still not an easy path to go.
The Three Symbians
“That’s one of the reasons why Nokia is investing so much in the S60 middleware used on top of Symbian. S60 is so large and complex today, that I would regard S60 an OS itself, with Symbian as the kernel. It gives Nokia more control to add and change things on its own.
“Sony Ericsson, as one of the other large Symbian owners and licensee, just bought UIQ in November last year to get control of its own flavor of Symbian. UIQ is quite similar to Nokia’s S60 and should also be regarded as its own OS with Symbian as the kernel.
“From one point of view, there are no ‘Symbian’ phones in the market, but rather three incompatible and diverging OSs: NTT DoCoMo’s Symbian MOAP for Asia, Nokia’s Symbian S60, and Sony Ericsson’s Symbian UIQ.
“To make it even worse from a third party developer’s point of view, Nokia and Symbian made the new S60 version 3 binary incompatible to previous versions of S60. So none of your old Symbian apps will work on any new phones (i.e. if you actually bought any :-) .
“And of course UIQ has never been source code nor binary compatible with S60. But still you get the impression from analysts and media that ‘Symbian’ is one stable OS.
Symbian Signed
“For S60 version 3, they have introduced a new security model where it’s necessary to sign all apps with VeriSign to even get them to run. Something that costs several hundreds of dollars per year, just for the certificates, and makes shareware and hobby programming almost impossible from now on.
“Some operators are requiring the phones to be locked for any apps not carrying a ‘Symbian Signed’ certificate. Which means, you have to pay for a certification process where you are checked by Symbian, why you developed the application and why you want to use certain capabilities on the phone, e.g. read and store user data, using the telephony APIs, or the WIFI capabilities etc.
“All in the name of security, but of course it will be very tough to make programs, independently, that use functionality that’s not in the interest of the operators, such as non-operator controlled Voice over IP.
“So much for independently third-party software development on Symbian compared to the ‘closed’ model used on iPhone. In practice the difference is not that big. Apple will, of course, allow close partners to develop apps like they do with iPod Games today.
Symbian Design Issues
“When it comes to the myth of Symbian being a modern and robust OS, I have several objections. Symbian is severely limited by design decisions made in the beginning of ‘90. The design decisions were maybe okay at that point in time, when the target was Psion’s EPOC and EPOC32-based Series 3 & 5 with extreme memory and resource constraints compared with today’s devices.
“I could make a very long list of the problems but I’ll just summarize a few key areas:
1.
•Crippled C++ support. Symbian is C++ based—at least on the surface. When EPOC32 was designed (about 1993-1994 I think), there were very few good C++ compiler with full support for the newest C++ features like exceptions. Exceptions is the main feature in C++ for correct and efficient error handling. The other alternative is to use error codes like most operating systems use in their C APIs.
Symbian chose to select neither technique. They made their own home-cooked version of exceptions called Leaves. With an exception in C++, any memory or other resources in allocated objects are deallocated automatically in the correct order (deterministic destruction by calling each object’s destructor). This makes it (relatively) easy to make correct programs in C++ for both small and large projects.
In Symbian when a error is signaled with a leave (‘throw an exception’) no objects are deallocated. They just leak, if you don’t manually record each object allocated to be cleaned up. This process is extremely tedious, error prone and boring. The result is that it’s very hard and time consuming to make correct programs in Symbian, on the verge to be impossible in many cases.
C++ is a great language because of the advanced features, like exception handling with automatic cleanup (search for RAII, Resource Allocation Is Initialization), the standard C++ library (formerly called the STL library with lots and lots of support code for handling of data in containers-like lists and maps and tree structures, strings, algorithms, support for template code and last but not the least—all the standard patterns, practices and idioms all experienced C++ programmer are using on all design problems they are faced with.
If you remove the foundation for standard C++ development, it all falls together. Every design decision means the programmer has to think from the ground up to make a completely new architecture for the design because the normal way of thinking and the normal guarantees C++ and experience gives, doesn’t apply anymore. It really turns an experienced programmer into almost a beginner with lousy tools. It’s a nightmare for both programmer and development managers.
2.
•Confusing and limited string handling. There is no real support for a proper string handling. To use strings on Symbian you have to use a home-cooked and strange system of ‘descriptors.’ Every new programmer to Symbian spends the first weeks struggling just to understand how (and why) this system works.
The reason was apparently to save a few bytes on each string. But of course, today, that’s not even close to being relevant. Maybe a small point but, it’s yet another point that makes Symbian hard to use, hard to understand and hard to port programs to/from other platforms.
3.
•Limited support for multi-threading. An important technique used on all other platforms but is not used on Symbian. They do have limited support for threads, but it’s strongly recommended not to use threads since it ‘takes to much resources.’ That was hardly even a relevant argument in 1993 but it meant that Symbian uses ‘active objects’ instead of threads in almost all applications.
Active objects are just a very complicated variant of cooperative multitasking, where each object runs in sequence (unnaturally split into small subtasks) and are not able to preempt each other. It takes a lot of code to make this work, just to give the result of a system that is not very responsive, hard to program and port to/from other platforms. All for the aim of saving some CPU cycles in 1993.
4.
•Bad development environment. The development environment and SDK for Symbian (S60) is very strange and difficult to use. It can take several days to just make a functional installation of the SDK and development environment. My first installation a few years ago took over a week to setup and was very fragile. On the Nokia forums there are postings with recommendations on how to make a correct setup. If you do just one step in the wrong order it fucks up. You cannot use the latest version of Visual Studio but need to install Visual Studio 2003 to make it work. But everyone that does Windows programming have VS 2005 installed. Nokia also provides several commercial alternatives, ‘Carbide,’ that is based on Eclipse etc. But it is generally a very bad situation if you compare with Xcode/iPhone or other platforms.
Analysts Wrong on Symbian
“I realize the arguments above are quite technical, but they are nonetheless real and makes it very slow, error prone, and generally difficult to make applications on Symbian.
“This is just one of the reasons I believe the analysts and media are very wrong about the outlook for iPhone. Most media in Sweden (and elsewhere) have reported that the iPhone is nothing new at all. It’s mainly a nice package with limited/bad hardware and nothing particularly new on the software side.
“However, if you look at the speed and effort needed to make new applications on iPhone compared with other platforms it’s two completely different worlds. You have all the Cocoa frameworks that make it possible to create applications on a level not even available for most desktops today.”
“Most people don’t realize the huge difference in development speed (time to market), ability to make more advanced and useful applications with a greater user experience (read: Core Animation and other Leopard frameworks), code quality and maintenance ability—when you have full support for modern high-level languages and frameworks.
Existing Mobile Platforms vs OS X
“Of course, this is the same for most embedded programming projects: set-top boxes, mobile phones, stereo equipment, industrial equipment. But with phones, you are beginning to think about them as a small desktop computer and everyone tries to put in real applications in them.
“With Symbian (as well as WinCE, Palm OS, and I suppose also the Linux phones because they probably have a very limited number of Linux frameworks installed because of memory restrictions etc) you have a big problem to deliver on the marketing hype and media expectations because of all limitations. This is one of the reasons all mobile services are failing to badly—it’s simply to hard and complicated to deliver the market expectations with today’s platforms.
Five Years Ahead
“OS X and iPhone don’t have these limitations. It’s one of the reasons I believe Steve Jobs is more or less right in iPhone being 5 years ahead of the competition–of course there is slight marketing hype as well, but not that much an exaggeration as the media and analysts think. Making high quality, advanced applications with a superior user experience will be fast and easy with OS X. On other platforms it’s like competing with a small Fiat car in a Formula 1 race against Ferrari and Williams.
“OS X is probably only programmable in Objective C instead of C++, because of the Cocoa frameworks being used. But Objective-C is famous for being easy to program and you can freely mix Objective C and C++ in the same program. In Leopard Apple also introduces Objective-C 2.0 with garbage collection and lots of new stuff that makes it even better than C++ in some respects. And the Cocoa frameworks are world-class on desktop computer—they were even famous in the NeXTSTEP versions.
“So when you put all this together, Apple has sharp weapons and shining armor to compete with lesser equipped competitors for future smartphone apps and wireless services. Most analysts and media don’t have enough technical competence and knowledge to realize this.”

分类: saving 标签:

(收藏)汽车网络的分类及发展趋向

2007年1月23日 hufey 评论已被关闭
分类: saving 标签:

ZT: Linux: Accessing Files With O_DIRECT

2007年1月12日 hufey 评论已被关闭

Linux: Accessing Files With O_DIRECT
By Jeremy on Linux news
A thread on the lkml began with a query about using O_DIRECT when opening a file. An early white paper written by Andrea Arcangeli [interview] to describe the O_DIRECT patch before it was merged into the 2.4 kernel explains, “with O_DIRECT the kernel will do DMA directly from/to the physical memory pointed [to] by the userspace buffer passed as [a] parameter to the read/write syscalls. So there will be no CPU and memory bandwidth spent in the copies between userspace memory and kernel cache, and there will be no CPU time spent in kernel in the management of the cache (like cache lookups, per-page locks etc..).” Linux creator Linus Torvalds was quick to reply that despite all the claims there is no good reason for mounting files with O_DIRECT, suggesting that interfaces like madvise() and posix_fadvise() should be used instead, “there really is no valid reason for EVER using O_DIRECT. You need a buffer whatever IO you do, and it might as well be the page cache. There are better ways to control the page cache than play games and think that a page cache isn’t necessary.”
Linus went on to explain, “the only reason O_DIRECT exists is because database people are too used to it, because other OS’s haven’t had enough taste to tell them to do it right, so they’ve historically hacked their OS to get out of the way. As a result, our madvise and/or posix_fadvise interfaces may not be all that strong, because people sadly don’t use them that much. It’s a sad example of a totally broken interface (O_DIRECT) resulting in better interfaces not getting used, and then not getting as much development effort put into them.” To further underscore his point, he humorously added:

“The whole notion of “direct IO” is totally brain damaged. Just say no.
This is your brain: O
This is your brain on O_DIRECT: .
Any questions?

分类: saving 标签:

remote X apps running howto

2007年1月11日 hufey 评论已被关闭

host side: $xhost +[client_name|client ip]
client side: $export DISPLAY=[host_name|host ip]:0
$xapp

分类: saving 标签:

how to disable alignment trap from user space in linux

2006年12月23日 hufey 评论已被关闭

I was confused on that how to disable alignment trap from user space in linux. After lots of searching, code/document reading I got the point is, the linux kernel provides a mechanism/interface in procfs let user space application change the unalignment trap action of kernel to
“ignored”,
“warn”,
“fixup”,
“fixup+warn”,
“signal”,
“signal+warn”.
And default mode is 5(signal+warn), that means once unalignment memory access occurs, the kernel will send signal SIGBUS to kill the application.
We can just read all configuration info from /proc/cpu/alignment and just write a number to reset action mode like “echo 2 > /proc/cpu/alignment”.
See linux-2.6.x/Documentation/arm/mem_alignment,
—————————————————————————————-
Too many problems poped up because of unnoticed misaligned memory access in
kernel code lately. Therefore the alignment fixup is now unconditionally
configured in for SA11×0 based targets. According to Alan Cox, this is a
bad idea to configure it out, but Russell King has some good reasons for
doing so on some f***ed up ARM architectures like the EBSA110. However
this is not the case on many design I’m aware of, like all SA11×0 based
ones.
Of course this is a bad idea to rely on the alignment trap to perform
unaligned memory access in general. If those access are predictable, you
are better to use the macros provided by include/asm/unaligned.h. The
alignment trap can fixup misaligned access for the exception cases, but at
a high performance cost. It better be rare.
Now for user space applications, it is possible to configure the alignment
trap to SIGBUS any code performing unaligned access (good for debugging bad
code), or even fixup the access by software like for kernel code. The later
mode isn’t recommended for performance reasons (just think about the
floating point emulation that works about the same way). Fix your code
instead!
Please note that randomly changing the behaviour without good thought is
real bad – it changes the behaviour of all unaligned instructions in user
space, and might cause programs to fail unexpectedly.
To change the alignment trap behavior, simply echo a number into
/proc/sys/debug/alignment. The number is made up from various bits:
bit behavior when set
— —————–
0 A user process performing an unaligned memory access
will cause the kernel to print a message indicating
process name, pid, pc, instruction, address, and the
fault code.
1 The kernel will attempt to fix up the user process
performing the unaligned access. This is of course
slow (think about the floating point emulator) and
not recommended for production use.
2 The kernel will send a SIGBUS signal to the user process
performing the unaligned access.
Note that not all combinations are supported – only values 0 through 5.
(6 and 7 don’t make sense).
For example, the following will turn on the warnings, but without
fixing up or sending SIGBUS signals:
echo 1 > /proc/sys/debug/alignment
You can also read the content of the same file to get statistical
information on unaligned access occurrences plus the current mode of
operation for user space code.
Nicolas Pitre, Mar 13, 2001. Modified Russell King, Nov 30, 2001.
——————————————————————————————–
Note the procfs interface file location was changed. Not sure when it was.

分类: saving 标签:

Window$ CE family

2006年12月20日 hufey 评论已被关闭

分类: saving 标签:

光源色温对应表

2006年11月8日 hufey 评论已被关闭

高海拔陰天/雪天 11000k-18000k
雨天/高海拔晴天 9000k-11000k
烏雲密佈 8000k-9000k
薄雲 7000k-8000k
日光/晴天 6000k-7000k
閃光燈 5000k-5500k
螢光燈 4000k-5000k
日出/日落(没有雾) 3000k-4000k
新燈泡 3000k
舊燈泡 2500k
日出前 2000k
燭光 1000k

分类: saving 标签:

wireless lan又不工作了

2006年10月22日 hufey 评论已被关闭

好像是把gentoo的gcc升级到4.1之后的事儿
出现不停输出莫名其妙log的问题
只好先不管再找出10M老爷爷网卡接上网线emerge world
重build/install ndiswrapper,modprobe发现kernel是gcc 3.4编译的而ndiswrapper是4.1
再重新编译kernel
一切都正常了
gentoo真是脆弱,不知道debian一家怎么样?
买了个ibook打算装gentoo for powerpc来着,结果一个多月了一直拿她放电影

总不能真的就当买个mp4 player吧?

分类: saving 标签:

诡异的泡网blog计数器

2006年8月30日 hufey 评论已被关闭

前两天泡网服务器又出毛病了
大伙的blog计数器又归了零
于是,根据以往的惯例要跟大伙要最后的数字再重设
岁数大了,记不住细节
所以每次干这活,或者类似的活,都要从搜索程序路径开始,再根据回忆仔细想想要改哪
基本上,我都会先把自己的设对,自己当白耗子,术语所谓先走通
结果这次发现改了数也不对,看html source code,似乎默认的图片路径不对
再读代码,找到哪个变量起作用,再找到该变量从哪读出来的
再找设置文件,改设置
可是诡异的是,明明已经改对了,却始终看不到计数器的值
试了无数次,终于想到用ie来看,结果ie是对的
开始以为在乔治借我的小笔记本上装的FF有问题,第二天在单位的FF上看也是一样
难道firefox对《div》tag解析的和IE的不一样????
类似现象总归是IE的不对,因为FF对W3C的规范是遵守的最严格的了
想想又不对啊,以前FF都是对的ya,实在想不明白了。。。
算了,先让IE对了再说吧,FF的事改天再琢磨,反正说到底还是用IE的人多些。。。
第二天,在msn上看到了救星yining老兄,哭诉了这件事,结果在他那FF也是能看到计数器的
虽然他是在Ubuntu上的FF
肯定是哪个extension搞的鬼,tools,extension,一看就明白了
因为几台电脑都不是我的,我装的extension并不算多,几个最常用的而已
能屏蔽图片的,只有adblock plus了
点开adblock plus,赫然看到一条filter: counte[rd]
删掉
好了
不知道adblock plus从哪个版本开始提供这条filter的
每次装完FF我都会第一个装adblock plus

分类: saving 标签:

C++ operator priority table

2006年7月14日 hufey 评论已被关闭
Level Operator Description Grouping
1 :: scope Left-to-right
2 () [] . -> ++ -- dynamic_cast static_cast reinterpret_cast const_cast typeid postfix Left-to-right
3 ++ -- ~ ! sizeof new delete unary (prefix) Right-to-left
* & indirection and reference (pointers)
+ - unary sign operator
4 (type) type casting Right-to-left
5 .* ->* pointer-to-member Left-to-right
6 * / % multiplicative Left-to-right
7 + - additive Left-to-right
8 << >> shift Left-to-right
9 < > <= >= relational Left-to-right
10 == != equality Left-to-right
11 & bitwise AND Left-to-right
12 ^ bitwise XOR Left-to-right
13 | bitwise OR Left-to-right
14 && logical AND Left-to-right
15 || logical OR Left-to-right
16 ?: conditional Right-to-left
17 = *= /= %= += -= >>= <<= &= ^= != assignment Right-to-left
18 , comma Left-to-right
分类: saving 标签: