posted on 2007-12-18 13:40:00 by fyuan 评论(13) 阅读(6163)
http://biz.yahoo.com/prnews/060615/sfth059.html?.v=61
REDMOND, Wash., June 15 /PRNewswire-FirstCall/ -- Microsoft Corp. (Nasdaq: MSFT - News) today announced that effective July 2008 Bill Gates, chairman, will transition out of a day-to-day role in the company to spend more time on his global health and education work at the Bill & Melinda Gates Foundation. The company announced a two-year transition process to ensure that there is a smooth and orderly transfer of Gates' daily responsibilities, and said that after July 2008 Gates would continue to serve as the company's chairman and an advisor on key development projects.
The company announced that Chief Technical Officer Ray Ozzie will immediately assume the title of chief software architect and begin working side by side with Gates on all technical architecture and product oversight responsibilities, to ensure a smooth transition. Similarly, Chief Technical Officer Craig Mundie will immediately take the new title of chief research and strategy officer and will work closely with Gates to assume his responsibility for the company's research and incubation efforts; Mundie also will partner with general counsel Brad Smith to guide Microsoft's intellectual property and technology policy efforts.
posted on 2006-06-16 04:53:00 by fyuan 评论(15) 阅读(6731)
突然发现 SPACES.MSN 还不错, 慢慢再把有用的东西移过去.
谢谢 JOYCODE 的款待.
posted on 2006-03-02 06:34:00 by fyuan 评论(5) 阅读(9219)
一年多前申请了一个 MSDN Blog, 荒废多时.最近参加 PDC 2005,实在没办法拖了, 只能重启 blogs.msdn.com/fyuan.
重点讨论:
- XPS (XML Paper Specification)
- WPF (Windows Presentation Foundation)
- Printing
posted on 2005-09-25 12:49:00 by fyuan 评论(13) 阅读(5246)
上海福州路曾经是上大学时常去的地方, 这次回国, 专门旧地重游. 在上海书城逛了很久. 除了买了一大堆围棋书以外, 还买了一本梁肇新 《编程高手箴言》.
买梁肇新的书有几个原因:
1) 他是一个真正的程序员
2) 他敢称高手
3) 他的书确实是写出来的
4) 曾经有位中国的编辑让我写一本书
可能我应解释一下为何要写这个书评. 小时候, 家里有一个破破的有线收音机, 老爸常常听, 并时时加以评论. 慢慢的我也习惯了对什么人说的话都用自几的脑子去分析, 很多事就清楚多了, 很多神话就破了, 说的话就有人听了, 自信心就提高了.
写这个书评不是为了证明梁肇新不是高手. 我觉得梁肇新是一个编程高手, 而且是一个经营高手. 但我不相信绝对的高手, 反对对高手的迷信. 不管作者是不是高手, 每本书应经得起推敲. 越是高手的书越可能有误导性.
第一章前半部分可在此看到: http://blog.csdn.net/iyanglian/archive/2004/09/13/102494.aspx
第一章: 程序点滴
- 好的开始是成功的一半. 本书首先试图告诉你什么是程序员? 为什么要做这样的程序? 正确的入门方法是什么?
简单公式有误导性. 何为开始? 何为好的开始? 何为成功? 何为成功的一半?
有了 "首先", 应有一个 "然后" 之类的.
有了 "这样的程序", 前面应提过某种程序.
"正确的入门方法"? 有错的的入门方法吗? 用了错的的入门方法又有什么不好?
-
程序≠软件: 如果你写个程序,别人就可以拿来用。这时候的程序就能产生价值,这个程序就直接等同于软件。但软件行业发展到现在,程序也不等同于软件了。
此书对软件有特别的定义, 产生价值的程序才是软件. 而后的章节进一步将软件定义成经过经销商销售的程序. 所以 "程序≠软件" 指的是并非所有的程序度能让经销商销售产生价值.
软件确实不等与程序, 不论其有无价值. 软件 = 程序 + 文档 + 服务.
-
因为现在写程序很容易,但是你的这个程序很难产生什么样的商业意义,也不能产生什么价值,这就很难直接变成软件。
要写和几十年前一样的程序是很容易, 模拟别人的现有程序比较容易, 但写符合现代标准的, 或有创新的程序越来越难.
-- 慢慢道来 --
posted on 2005-04-28 08:41:00 by fyuan 评论(63) 阅读(14987)
近来很少来这边, 长在 CSDN. 居然那边有人喜欢读一个老程序员的即兴言论 (http://community.csdn.net/Expert/TopicView.asp?id=3812393).
诧异之余, 还是接受 SmallRole 的建议, 主动交代, 和盘托出:
其他的慢慢加上
posted on 2005-03-02 07:26:00 by fyuan 评论(23) 阅读(7627)
My last post includes a link to www.redfin.com, which shows satellite pictures of Seattle area where Microsoft headerquarter is located. Someone said that there are too many buildings, so it's hard to find Microsoft buildings.
I've put together a huge bitmap showing Microsoft main campus and west campus. There are dozens of Microsoft buildings in the picture.
Here is the link http://blog.joycode.com/fyuan/articles/34760.aspx. Note, these pictures were taken before Building 36 was built. Warning: it could be quite slow to load all the bitmaps.
For Microsoft building numbers, check:
http://www.microsoft.com/careers/mslife/locations/images/campus_map.jpg
http://www.microsoft.com/careers/mslife/locations/images/north_campus.jpg
http://www.microsoft.com/careers/mslife/locations/images/west_campus.jpg
I work in Building 2, one of 6 X-shaped initial Microsoft buildings.
posted on 2004-10-01 06:10:00 by fyuan 评论(9) 阅读(4660)
Software Town, USA
Looking at Microsoft from Sky
Buildings 1-6, 8-11, 16-22, 24-28, 30-35, 40-44, 50, 100-102, 108-110, 112-119
Check www.redfin.com
posted on 2004-10-01 01:44:00 by fyuan 评论(16) 阅读(4865)
Visit www.redfin.com, click on “Polular searches” - “Microsoft Redmond” in the bottom right corner, you will see a satellite picture of Microsoft area. Microsoft main campus buildings are in the top-left corner.
My office building (Building 2) is about 1/3 from left and 1/3 from top. My home is at the bottom left corner. You can also see a red car parked in the drive way of my next door neighbour, if you know where to look.
posted on 2004-09-28 05:29:00 by fyuan 评论(9) 阅读(4100)
On August 9th, I posted the following problem on community.csdn.net, under VC/MFC 基础类:
Problem: Write code to generate a bitmap rotated 90 degrees clockwise from the original bitmap, without using any graphics library.
If you want to post your code here, write on your own, do not refer to anything else, no copy/paste, write your code here, review your code before submitting, and include how much time you spend. Add comments in English when possible.
I want to see who can give a good enough answer.
There have been lots of responses to this simple programming problem and some quite interesting discussions. Here is the link to the CSDN thread: http://community.csdn.net/Expert/topic/3254/3254627.xml?temp=.7896845
Here is the link to my comments, including my code: http://blog.joycode.com/fyuan/articles/30945.aspx
posted on 2004-08-19 10:12:00 by fyuan 评论(10) 阅读(5417)
On August 9th, I posted the following problem on community.csdn.net, under VC/MFC 基础类:
Problem: Write code to generate a bitmap rotated 90 degrees clockwise from the original bitmap, without using any graphics library.
If you want to post your code here, write on your own, do not refer to anything else, no copy/paste, write your code here, review your code before submitting, and include how much time you spend. Add comments in English when possible.
I want to see who can give a good enough answer.
There have been lots of responses to this simple programming problem and some quite interesting discussions. Here is the link to the CSDN thread: http://community.csdn.net/Expert/topic/3254/3254627.xml?temp=.7896845
So here I'm going to comment on those responses.
|
hahu(地痞 -- 勿近) ( |
#define WIDTHBYTES(bits) (((bits) + 31) / 32 * 4) =>Global alloc bytes for destination bitmap.... |
This captures the essence of the problem quite well. Such quick thinking is essential in interviews. But the 'code' as it stands is just a simple sketch, far away from useable code.
|
ehom(?!) ( |
//位图旋转,24位/32位 time 10-20 mins |
Apparently the author is an experienced programmer. But the code here solves a slightly different problem, it loads a bitmap from disk and writes back a rotated image. In interviews, you have to focus on the problem given to give the best answer, so you can't afford to work on anything else (like file I/O here). Also, what is required (implicitly) is to write reusable modular code, not a demo program.
|
yuliangpei(踏雪无痕) ( |
int i,j; 其中,数据复制这一段不能直接用于程序,应该根据位图的bitCount而进行调整。程序是对应象素来写的。信手写的,不知对否? |
Good understanding of the problem, far from complete usable code. Using two dimensional array notation is good for understanding the problem, but if you use that in your real code, it's less general or less efficient. One small mistake, Width - 1 - i should be used in place of Width -i.
|
ehom(?!) ( |
|
To ehom's second version, I said “Quite a few problems in ehon's code”. Here are they:
- The function prototype int rotated90(BitmapData bmpdata) is wrong. The original problem askes you to generate a (new) rotated image from an existing image, there is no way a new image can be returned. bmpdata is passed as value type, it can't even modify an existing image to its rotated image. Rotate90 will be a better name.
- bmpdata.bpp/8 does not handle bpp=15.
- getSize, needs to check for multiplication overflow
- No allocation failure check for new char[imagesize]
- No allocation failure check for new unsigned long[bmpWidth]. This is also not needed. Also bmpWidth * sizeof(unsigned long) could overflow integer range.
- memcpy inside nested loop is slow. Do not use that in performance critical code.
- memcpy(bmpdata.pScan0, bufdst, imagesize) is dangerous, rotated image could be larger than original image because of scanline alignment.
- scanlinedst and n, mixing pointers with integer will generate compile time error/warning. It does not work on 64-bit compiler, because int is still 32-bit while pointers are 64-bit.
|
holyeagle(一杯清茶) ( |
|
Mostly similar problems, plus some new:
- File IO is not required.
- ROTATEINFO is not a good design, it mixes source bitmap with destination bitmap.
- CFile, avoid using MFC when possible.
- OPENBMP(1), write reusable code, not sample code, pass the file name as parameter
- pBmpInfo and other memory allocation could be leaked.
- GetImageSize could overflow.
- ASSERT(NULL ! pSrcData && NULL != pDstData) is not valid, allocation could fail.
- Bitmap could still be compressed.
- RotateImage need runtime check for 1,2,4 bpp and when nBpp is not a multiple of 8.
- memcpy is slow for performance critical code.
|
joysunstar(鹤鸣) ( |
void Rotatebmp90() // this program rotate a 24bits-bitmap file by 90 degrees CString strFileName = fileDlg.GetPathName() ; bmpFile.Read(&bmfh,sizeof(BITMAPFILEHEADER) ) ; DWORD width = bmih.biWidth ; bmNewInfo->bmiHeader.biHeight = width ; m_ImgWidth = width ; if(lpSrc) bmpFile.Read(lpSrc,bmih.biSizeImage) ; BYTE *pixel ; } UpdateAllViews(NULL) ; |
- File selection dialog box and file I/O is not required.
- Where is bminfo and bmNewInfo declared?
- offHeight * 3 is not the same as (height * 3 + 3 ) /4 * 4
- biSizeImage could overflow.
- Where is lpSrc and lpDest declared? Member variable of the class?
- The code within the nested loop is really slow.
|
ALNG(?) ( |
// start at 9:30 struct BitmapInfo /// @brief: internally used helper function to get the address }; // 11 12 13 14 void BitmapInfo::rotate90Clockwise() } |
- Should BitmapInfo be a class, instead of a struct?
- Quite a few mixing of unsigned with int.
- Critical BitmapInfo copy constructor skipped.
- Rotated image may be larger than original image in space because of scanline alignment. Simply switching height and width does not give you rotated image, stride may be wrong after that.
- copyPixel copies source pixels into tmp bitmap, which is then thrown away?
- The rotating loop is slow, you're trusting compiler to be able to do all the optimizations.
- Not a single error check.
|
ambochan(打杂) ( |
Lots of NT GDI calls |
Does not meet requirement. Do not use any graphics library.
Your job could be to implement those graphics library, not using it as an application programmer.
|
huanyun(无妻徒刑) ( |
typedef struct tagXIMGDATA void FreeImg(XIMGDATA& ImgDst) int RotateImg(XIMGDATA& ImgDst,const XIMGDATA& ImgSrc) int nWidthS = ImgSrc.width; int nRowLenDst = nWidthD * nBitCount / 8; int i,x,y,nPosS=0,nPosD=0; |
- Why not use a class? Then FreeImg and RotateImg will just be member functions.
- Missing important constructor, at least to set pScan0 to NULL.
- delete [] ImgDst.pScan0, pScan0 is void pointer.
- pSrc can be const pointer.
- Checking for nWidthS, nHeightS larger than 10000 is good, but too restrictive.
- Checking for nBitCount > 64 is too restrictive, GDI+ supports ARGB 16-bit per channel images
- nRowLenSrc could be negative for bottom-up images.
- Why ++nRowLenDst?
- Check for nHeightD * nRowLenDst overflow
- For each pixel writing to destination using pDst[nPosD] |= bMaskD is slow.
- Why for (x=0;;++x)? When does it end?
- Slow rotating loop.
|
tuqvb(风间苍月) ( |
// *********************************************************** template // *********************************************************** typedef struct _stPixel24 _stPixel24& operator= (PIXEL32 p32){ return *this;} operator PIXEL32(void){ return 0;}#define WIDTH 83 PIXEL24 image24[WIDTH][HEIGHT]; PIXEL32 image32[HEIGHT][WIDTH]; Ration90(WIDTH, HEIGHT, &image32[0][0], WIDTH * sizeof(PIXEL32), &image24[0][0], HEIGHT * sizeof(PIXEL24)); Ration90(HEIGHT, WIDTH, &image24[0][0], WIDTH * sizeof(PIXEL24), &image32[0][0], HEIGHT * sizeof(PIXEL32)); |
Finally, someone thought about using template!! I acutally used template in production code (part of Avalon code). But you should at least explain why did you choose to use template. The benefit of using template is to avoid memcpy in the inner loop. The binary code generated will be larger, but it will be much faster, because each instantiation will be for a constant color depth. Compiler will be able to generate the minimum code for that case.
- pldst and xdoffset can be merged into a single variable.
- plsrc and xoffset can be merged into a single variable.
- Code is not complete. The problem is to write (generic) code to generate a rotated image from an image.
To be fair, here is my code
|
Some explanations:
- It's OK to write a simple solution using memcpy or a loop to copy each pixels. But you need to understand that such a solution is considered slow for a high performance graphics library. For 1000 x 1000 pixel image, the inner loop will be executed 1 million times.
- memcpy has two implementations: one inline implementation and one out-of-line function implementation. The inline version should be faster for small data size, the out-of-line implementation is optimized for copying large amount of data.
- memcpy is considered slow here because the size parameter is a variable, so compiler/runtime library has to use a loop to implement it. Any loop or conditional jump is considered slow in such an inner loop.
- Using template is faster here because each instance of the template knows its pixel size as a constant, so copying a pixel can be implemented in a single instruction for 8-bpp 15-bpp, 16-bpp, 32-bpp images, much faster than a loop.
- Checking for multiplication overflow is essential to avoid heap buffer overrun which could result in security risks.
- The code here is not compiled, nor tested.
Thanks for all the replies.
posted on 2004-08-18 02:27:00 by fyuan 评论(11) 阅读(9661)
Mark Schmidt has joined Microsoft today. Mark was a coworker of mine while I was working at HP Vancouver, WA. He has written several books including Microsoft Visual C# .NET 2003 Developer's Cookbook.
Here is a message from Mark:
Finally made it.
posted on 2004-07-27 12:40:00 by fyuan 评论(12) 阅读(3838)
We drove to California last week. On the first day, we drove all the way from Bellevue to a small town on the California coast. So it was quite late when we arived there. Two motels we checked had no room left. The third one offered us $109.99 + tax, after AAA discount, for a room with two beds. We had to take it reluctantly, as we had never paid such price for a motel room. I was expecting something in the $50 to $60 range,
Once in the room, I looked around to see what is so special about this expensive motel room and found a notice in the back of the door. It is a printed notice about room rates, rules and regulations, and several sections from laws of California regarding hotels.
Laws of California
Room Rate Statute
California Civil Code Section 1863:
Every keeper of a hotel, inn, boading-house or lodginhhouse, shall post in a conspicuous place in the office or public room, and in every bedroom of said hotel, boarding house, Inn or lodginghouse, a printed copy of this section, and a statement of rate or change of rates by the day for lodging.
No charge or sum shall be collected or received for any greater sum than specified in subdivision
For any violation of this subvision, the offender shall forfeit to the injured party one hundred dollars ($100) or three times the amount of the sum charged in excess of what he is entitled to, whichever is greater. ...
The rate for the room was listed as $105 for 3 persons, so they over-charged us $4.99. But if you read the printed California law carefully as a software engineer, the innkeeper owe me max(100, 3 * (109.99 - 105)) = 100.
The next morning, I took the notice to the office and walked away with a 100 dollar bill, after explaining the defect I found to them for two minutes.
posted on 2004-07-12 15:26:00 by fyuan 评论(9) 阅读(4044)
一 苏州的童年
二 上海机械学院
February 27th, 1978, the first day of a new school term started in the 3rd middle school of Suzhou (苏州市第三中学). It was kind of sad for me, because I took the college entrance examination as one of the only two students allowed to in my grade. Stories of people receiving admission letters have been circling around. It was a huge deal as colleges in China had closed their doors do high school students for over ten years since the Culture Revolution. Mom was worried that her family background, being the daughter of a landlord, could have affected my admission. Now that I'm still sitting at my desk in my middle school.
Half way through the morning classes, my physics teacher walked in through the door and stopped the class. He pulled out a piece of paper and started to read. It was a strange thing, for things like that are normally for arresting real bad kids who were inolved in gang fights with knives. But this time it turned out to be admission letter for me to 上海机械学院, an almost unknown college in Shanghai.
Before taking the college entrance examination, I had to write down schools I would like to apply. I was quite good with math in school, actually the best in math in whole school since elementary school. My nickname in the first middle school I attended was 袁罗庚, after 华罗庚, the most famous mathematian in China. As I really wanted to be a mathematian, so I wrote down mathmatics departments of three best universites in China as my choices: 复旦大学, 南京大学, and 北京大学. They are sorted according to distances from Suzhou. To make sure they will not assign me to some small college at the far corners of China, I checked the box which saided I would not accept any other assignment. Those were the decisions I made with my father, but before actually submitting the form, I changed my last choice to 上海机械学院 before consulting my father again.
Shortly after that, I packed up and took a train to Shanghai, enrolled in 上海机械学院 自动化系 工业电子自动化专业.
三 南京大学 师从徐家福
四 南京大学 陈世福教研组
五 新加坡 华人小公司
六 新加坡 惠普
七 Vancouver 惠普
八 作家梦
九 微软: 如鱼得水
见: http://spaces.msn.com/fengyuancom
posted on 2004-06-29 13:48:00 by fyuan 评论(10) 阅读(3077)
Yesterday when I was about to send an email to an internal email alias, I noticed a new name, Matt Pietrek. So I wrote him a quick message asking if he is THE Matt Pietrek. His reply was:
Yes, I'm Matt Pietrek. I don't know of any others. ![]()
Matt is new hire March 22, 2004.
Another famous guy working for Microsoft people may not aware is Tony Hoare (http://research.microsoft.com/~thoare/). I met him while studying in Nanjing University back in the 80s.
posted on 2004-06-09 01:49:00 by fyuan 评论(17) 阅读(5259)
)
)
)
)
)
)