HNHacker News
TopNewBestAskShowJobs

tungwaiyip

80 karma · joined September 17, 2010

submissionscomments
tungwaiyip··on About Python 3
You are not making useful comment because you don't understanding the use case. Python 2 is very useful in handling binary data. This complain is not about unicode. This is about binary files manipulation.

I'm thrill about the unicode support. If they only add unicode string and leave the binary string alone and just require an additional literal prefix b, it will be an easy transition. Instead the design is changed for no good reason and the code are broken too.

tungwaiyip··on About Python 3
In Java, String and Char are two separate types. In Python, there is no separate char type. It is simply a string of length of 1. I do not have great theory to show which design is better either. I can only say the Python design work great for me in the past (for both text and binary string), and I suspect it is the more user friendly design of the two.

So in Python 3 the design of binary string is changed. Unlike the old string, bytes and binary string of length 1 are not the same. Working codes are broken, practice have to be changed, often it involves more complicated code (like [0] becomes [0:1]). All these happens with no apparent benefit other than it is more "coherent" in the eye of some people. This is the frustration I see after using Python 3 for some time.

tungwaiyip··on About Python 3
What you are looking for is imap(). In Python 2 there are entire collection of iterator variants. You can choose to use either the list or the iterator variants.

The problem with Python 3 is the list version is removed. You are forced to use iterator all the time. Things become inconvenient and ugly as a result. Bugs are regularly introduced because I forget to apply list().

  >>> "".join(map(lambda byte: chr(byte), b'abc'))
Compares to ''.join('abc'), this is what I call fuck'd. Luckily maxerickson suggested a better method.
tungwaiyip··on About Python 3
Thank you. This is good to know. I was rather frustrated to find binary data handling being changed with no easy translation in Python 3.

Here is another annoyance:

    In [207]: 'abc'[0] + 'def'
    Out[207]: 'adef'

    In [208]: b'abc'[0] + b'def'
    ---------------------------------------------------------------------------
    TypeError                                 Traceback (most recent call last)
    <ipython-input-208-458c625ec231> in <module>()
    ----> 1 b'abc'[0] + b'def'

    TypeError: unsupported operand type(s) for +: 'int' and 'bytes'
tungwaiyip··on About Python 3
Keyme, you and I are the few that have serious concern with the design of Python 3. I started to embrace it in a big way 6 months ago when most libraries I use are available in Python. I wish to say the wait is over and we should all move to Python 3 then everything will be great. Instead I find no compelling advantage. Maybe there will be when I start to use unicode string more. Instead I'm really annoyed by the default iterator and the binary string handling. I am afraid it is not a change for the good.

I come from the Java world when people take a lot of care to implement things as streams. It was initially shocking to see Python read an entire file into memory, turn it into list or other data structure with no regard to memeory usage. Then I have learned this work perfectly well when you have a small input, a few MB or so is a piece of cake for modern computer. It takes all the hassle out of setting up streams in Java. You optimize when you need to. But for 90% of stuff, a materialized list works perfectly well.

Now Python become more like Java in this respect. I can't do exploratory programming easily without adding list(). Many times I run into problem when I am building complex data structure like list of list, and end up getting a list of iterator. It takes the conciseness out of Python when I am forced to deal with iterator and to materialize the data.

The other big problem is the binary string. Binary string handling is one of the great feaute of Python. It it so much more friendly to manipulate binary data in Python compare to C or Java. In Python 3, it is pretty much broken. It would be an easy transition I only need to add a 'b' prefix to specify it as binary string literal. But in fact, the operation on binary string is so different from regular string that it is just broken.

  In [38]: list('abc')
  Out[38]: ['a', 'b', 'c']
  
  In [37]: list(b'abc')       # string become numbers??
  Out[37]: [97, 98, 99]
  
  In [43]: ''.join('abc')
  Out[43]: 'abc'
  
  In [44]: ''.join(b'abc')    # broken, no easy way to join them back into string
  ---------------------------------------------------------------------------
  TypeError                                 Traceback (most recent call last)
  <ipython-input-44-fcdbf85649d1> in <module>()
  ----> 1 ''.join(b'abc')
  
  TypeError: sequence item 0: expected str instance, int found
tungwaiyip··on Introduction to Recommender Systems
In this short article I have implemented the algorithm in the Programming Collective Intelligence in 9 lines of code

http://tungwaiyip.info/2012/Collaborative%20Filtering.html

tungwaiyip··on Hong Kong Baffled by Snowden’s Hideout
All the press and comments assume his ultimate goal is to avoid extradition, which has not been requested so far. I think he know the consequence of his action very well. He wants to expose the government surveillance program and draw public outrage. If US government do request for extradition, this will go through the court system in Hong Kong. Hopefully it will be a fairly transparent system and give him another chance to raise the awareness of this program. He might end up in jail, but this would fulfill his goal, that is to expose the surveillance program to the greatest extend possible.
tungwaiyip··on SeenBefore: A search engine for what you have seen before
Yes, I have seen it before! I have build a personal search engine MindRetrieve back in 2005.

http://mindretrieve.net

Specifically I'm not comfortable for big web company to keep the history of my web activity. So I make it work completely locally. My project did not get much uptake, probably my lackluster marketing and other assorted issues are to blame. So good luck on this one!

tungwaiyip··on Unfortunate Python
This is just a lot of nitpicking, parroting of common wisdom, plus uninformed opinions and misapplication of use cases.

To complain about SimpleHTTPServer is not for use as production public web server is ridiculous. That was never its intended used and most people understand this. Not every HTTP server is a public web server however. It is very convenient to fire up one as a test server and to get around some of the browser security constraint on the file:// scheme. It is also useful for a lot of light weight internal integration and configuration UI. To deploy SimpleHTTPServer for production web server is not a correct use. But neither is deploying a heavy weight HTTP server like Apache for testing or light weight integration appropriate.

I agree JSON is preferable to pickle in most situations. But you have to understand the history context. Pickle was the standard way to serialize object well before JSON is popularized. Serialization is an important topic in general and you will find many other computer language provides similar facility. Also JSON only address a subset of the serialization problem.

The array module is used not only for performance. It also support tight packing of data. If you have a million integer, array pack them tight as 1 million x 4 bytes. To store them into a list will have a much larger memory footprint because the are stored as 1 million individual objects plus the data structure of the list. I happen to have written a proprietary database engine in Python where memory, disk and I/O footprint matter hugely. Go easy on berating it because there are use cases you are not aware of.

It is sad that the author do not understand namedtuple but choose to mock it. I studied the code extensively and emulated it in a my application. To appreciate namedtuple, think about what is the alternative to this implementation? Try to write your own that serve the same function. Yes you can more easily and the code more readable by doing it with __setattr__ and __getattr__. The only problem every time you access an attribute you get hit with a big overhead. The use of exec is not a hack but a deliberated decision to provide attribute access at a speed comparable to standard attribute access. I agree with the author, "do not do this at home". Leave the heavy lifting to the experts unless you really known Python inside out like namedtuple's author Raymond Hettinger.

tungwaiyip··on Deck.js: A JavaScript library for building modern HTML presentations.
This is pioneered by Opera some years ago. They have so many good ideas that they deserve lot more attention.

http://en.wikipedia.org/wiki/Opera_Show_Format

tungwaiyip··on Airbnb Nightmare: No End In Sight
And a lot of this is probably a rehash of those WTF moments the founders have with their girlfriend. Look at this statement:

<i>(the second co-founder) suggesting we meet for coffee as he “would enjoy meeting” me. He made no inquiry into my current emotional state, my safety or my well being.</i>

So Airbnb do all they can to escalate the case, to compensate her, to assist the police, etc, or as least it is the best for a tech company to do. All these seem secondary to the victim. What she really want is for someone to ask her if she is ok.

tungwaiyip··on Airbnb Nightmare: No End In Sight
I have some idea on the discrepancy. Neither party are being deliberately disingenuous. It is more of a point of view issue. This mess take a long time to fix even in the best circumstance. So it is natural for EJ to still feel violated and frightened. She say "Since June 30, this co-founder has been the only person at Airbnb from whom I have received occasional contact regarding my situation". I think she is too shaken to appreciate the direct involvement of the 2 founders. I'll be lot more piss off if the customer service is the only one to talk to me.

Airbnb does sound like they are doing their part. Although if they really do pressure EJ to take down her post it will be the dumbest thing to do. It is lot more useful to publicize they own effort to help and perhaps compensate the victim.

Arrington present only the worst point of view. The sky is falling if you only read his post.

tungwaiyip··on CA Amazon Tax Signed Into Law
And A2Z, Zappos, the Kindle group. Search the job board and you will find those Amazon subsidiary job come up often. The are enjoying huge tax advantage over other retailers. You can be sure they will make every legal maneuver to work around this.
tungwaiyip··on Poll: Do you support software patents?
I'm guilty too. I have some patents granted and I don't even know what it is about base on the description written by lawyers.
tungwaiyip··on Woman removes SIM card from smart energy meter, uses $193k of 3G data
tptacek, in the scenario that I've construct, if you misconfigured an app that result in an astronomical bill, we you pay it without contest? Will you do it if you have to sell your house to pay off the phone company?
tungwaiyip··on Woman removes SIM card from smart energy meter, uses $193k of 3G data
I say is telecom should not be allow to gouge consumers. They should not charge consumer an amount that is clearly not agreed upon.

If you have misconfigured an app on your phone and it run up $10,000 network charge in month. Will you hand over your $10,000 to the phone company? Do you think this is a fair charge?

Cap the telco off how much they can charge unless authorized. I think this is most fair for both party. Telco can cut off access, but no to gouge consumer.

tungwaiyip··on Woman removes SIM card from smart energy meter, uses $193k of 3G data
I agree. This is robbery! Completely anti-consumer! No sensible consumer or business could have pay this kind of service charge. Telstra could have easily block access to any individual with excessive network activity. The judge should reject this bill and ask arbitrator to come up with reasonable payment plan. Automatically upgrade her to unlimited plan and then add a small penalty should be a reasonable resolution.

Law maker should ban telco from excessive charge, say more than $1000 a month, unless authorized by the customer.

tungwaiyip··on Ask HN: Who is Hiring? (April 2011)
Kontagent (San Francisco, CA)

We are looking for sales and engineers! http://jobvite.com/m?3rJ72fw3

Kontagent measures people, not pages, and is a leading analytics platform for social application developers. The platform has been built to provide deep social behavior analysis and visualization that provides actionable insights via a hosted, on-demand service. It works with many of the world’s largest developers and brands, tracking thousands of social applications and games with over 100 million monthly active users and over 15 billion messages per month.

http://techcrunch.com/2011/02/10/facebook-analytics-platform...

http://venturebeat.com/2011/02/28/kontagent-launches-real-ti...

Email me waiyip.tung at kontagent.com if you need more information.

tungwaiyip··on Has YC ever funded a company with a Black founder?
It doesn't address your question directly. But I find it a good opportunity to show you a visualization I've made for San Francisco Elementary school assignment by ethnicity. Clearly the city is not distributed evenly.

http://tungwaiyip.info/2011/2011_SFUSD_ethnicity.html

tungwaiyip··on Ask HN: Who's Hiring? (March 2011 Edition)
Kontagent (San Francisco, CA)

We are looking for sales and engineers! http://jobvite.com/m?3zGZ1fwZ

Kontagent measures people, not pages, and is a leading analytics platform for social application developers. The platform has been built to provide deep social behavior analysis and visualization that provides actionable insights via a hosted, on-demand service. It works with many of the world’s largest developers and brands, tracking thousands of social applications and games with over 100 million monthly active users and over 15 billion messages per month.

http://techcrunch.com/2011/02/10/facebook-analytics-platform...

http://venturebeat.com/2011/02/28/kontagent-launches-real-ti...

Email me waiyip.tung at kontagent.com if you need more information.

Wai Yip Tung

tungwaiyip··on Winning San Francisco's Startup Scene
The weather is not dreary. It is beautiful and sunny right now. And it is like this most of the time. I always enjoy the bright view across the bay. The temperature is often on the cool side. This bit you have to get use to. It is actually a great relieve for people escape from sweltering heat elsewhere.
tungwaiyip··on Ask HN: When to leave a startup?
Ask yourself honestly if you are unhappy. This alone is a big reason to move. For me being unhappy is even worst than being pay poorly.

The tech job market is very hot lately. You should check out your option out there.

tungwaiyip··on Winning San Francisco's Startup Scene
1. San Francisco has a very vibrant tech startup scene that's unmatched elsewhere. That's the same comment many people from different parts of the world tell me. They all seems to be excited to be here.

2. San Francisco is small. I'm happy with 15 minutes bike commute. Many of our customers are a few blocks away. This week we are abuzz with a big developer's conference in Moscone Center next block. Such events big and small keep happening through out the year.

3. The author seems to enjoy drinking and partying a lot. But don't get it wrong. You don't have to drink to enjoy San Francisco. I do none of those but I simply love the natural environment, the activities and the dramatic coastline around here. There are something for everyone.

tungwaiyip··on San Francisco Wants to Tax Your Stock Options – All of Them
Yes, every time I exercise NQSO, a paystub is sent to me and tax is withheld. I also get a paystub when exercising ISO, although no tax is withheld. It is actually more chore for me because I need to keep track of the gain and send estimated tax (I only do same day sale, the only sane option in my opinion). The article is very misleading to imply stock option is tax free. Techcrunch never grant her any stock option I figure.
tungwaiyip··on Hong Kong gets 1 Gbps broadband service for $26 a month
I have HKBN at one time. It is a lot less exciting than it sounds. I picked cheapest package at only 100M. It is a large pipe but the problem is I'm only getting trickles from it. The actually speed don't even match my unglamorous ADSL in US. It seems the Transpacific network has only very limited bandwidth. So if you are watching video served by a CDN in Hong Kong you will be fairly happy. But 95% of internet connection I'm making, such as to my company's VPN, is to the US. And the bandwidth is pathetic. Forget about 1Gbps. If I can get a guaranteed 3Mbps I'll be fairly happy.
tungwaiyip··on Pervasive myths about older software developers
This is some highlight from the book "The Secret Life of the Grown Up Brain" by Barbara Strauch

Neuroscientists found that:

* Longitudinal studies shows cognitive skills peak at middle age.

* Older people are happier. As one ages, they become calmer, more positive, and being able to regular them emotion better.

* The amount of white matter in the brain, myelin, continue to increase well into middle age. (i.e. better brain function)

* Older people are using both hemispheres of the brain to handle complex task, a phenomenon known as bilateralization. This is linked to higher cognitive ability.

http://tungwaiyip.info/blog/2010/10/29/secret_life_of_the_gr...

tungwaiyip··on Ask HN: Who's Hiring? (February 2011 Edition)
waiyip.tung at kontagent.com

Please feel free to ping me. Sorry I haven't see your message until today.

tungwaiyip··on E-ink writing pad, Noteslate.
Kindle DX - 24cm diagonal $379

Noteslate - 33cm diagonal $99

I will buy one just for reading PDF. But like a few other commenters, I seriously doubt this is a real product though.

tungwaiyip··on Poll: How old are you?
It was same group of people responding. They have grown old :-O
tungwaiyip··on Why is Google so hysterically hypocritical about Bing using its public data?
I'll try to make my point again. There is one school of thinking that Google is profiting by farming information from the Internet, literally on the back of many people's labor. You can prove this by running a "Google Sting", that is known as "Google bombing". By having many people setting up honeypot to link an arbitrary keyword to certain URL, you seem to be able to fool Google to artifically associate such keyword with the URL, thus "proving" Google is profiting from your labor. I don't really buy this logic. But Google's accusation of Bing steal from them seems very close to this line of framing.
← PreviousPage 2 of 3Next →