Ad

Wednesday, November 13, 2013

Codes : Python control flow looping through dates and months

While practicing data analysis, I came across a small piece of algorithm. I don't usually use Python, but for data analysis, it is preferred, so this part is iterated in Python.

This post is not for teaching, it's just to showcase my thought process, and for my future preference. It's a writing practice too. It is meant to be updated in the future when better solutions become available.

The prompt is to iterate over all the dates in 2009 and the months. Python has some built in functions per StackOverflow
building-a-list-of-months-by-iterating-between-two-dates-in-a-list-python
iterating-through-a-range-of-dates-in-python
best-way-to-find-the-months-between-two-dates-in-python
how-to-iterate-over-a-timespan-after-days-hours-weeks-and-months-in-python

What if we are building it from scratch, how would you use control flow to iterate through, just the simple and crisp way.

How would you solve it? How do you get the console to automatically print out each month and date of 2009 without giving any month extra days. For example Feb can never have 31st.

-------------------------------

It's a great control flow mini example because not all months are created equal.

  • February is unique, in 2009, it only has 28 days
  • For months equal to or below 7, odd months have 31 days, and even months have 30 days
  • For months greater than 7, odd months have 30 days, and even months have 31 days (so it's reversed)
So there are 5 cohorts / cases. But the terrible thing is that there are 5 check points for each of the months.



for x in range (1,13):
 print x
 if (x == 2):
  print "x equals to 2"
 elif (x <= 7 and x%2 == 0):
  print "x smaller than or equal to 7 and x is even"
 elif (x <= 7 and x%2 != 0):
  print "x smaller than or equal to 7 and x is odd"
 elif (x > 7 and x%2 == 0):
  print "x is greater than 7 and x is even"   
 else:
  print "x is greater than 7 and x is odd" 


Another Pythonist used some predefined scenarios instead of checking each:

for m in range(1,3):
 for d in range(1,32):
  if (m==2 and d > 28):
   break
  elif(m in [4,6,9,11] and d > 30):
   break

  timestamp = '2009' + str(m) + str(d)
  print timestamp

Now this is really a different way to solve it: one must iterate through the months then dates, finally cleverly break out of the dates when certain condition is met. But it's in certain sense more elegant, because the exceptions are clearer: m==2 and 4, 6, 9, 11. Versus the previous case, there were 5 cohorts, and you have to constantly think about which cohort to fall into, also more rooms for typos on > or < signs.

See more examples on Python control flow

The stackflow examples are better in many senses too, but seeing a date problem as a simple control flow example has its merits.

When I asked college friend Roger, he also used the datetime module. Except his answer is super crispy, I like it a lot! So I am sharing it here:







import datetime

startDate = datetime.date( 2009, 1, 1 )
endDate = datetime.date( 2010, 1, 1 )
dayDelta = datetime.timedelta( days=1 )

while startDate < endDate:
   print startDate
   startDate += dayDelta

Monday, November 11, 2013

The Surprising Sophistication of Corgi

I was supposed to practice my prototyping and wireframing skills and this happened ...

I really loved the businessweek.com cover: The Surprising Sophistication of Twitter


Then I thought about one famous business corgi

SOPHISTICATED CORGI


Then I couldn't resist, so I made my very own Sophisticated Corgi

Yeah, that shit is cute. Very cute.


All jokes aside, I think there's some really good lessons learnt from the article, so I will blog about it soon.



Sunday, November 10, 2013

Teach Your Kids How to Code | Book Recommendations for Young Adults

Disclaimer: this post is obviously laced with beloved not Amazon referral links. Use at your own... nah, all it means is that you are contributing about a few cents to CodeSumBlog yay for sustainable blogging.

Disclaimer 2: adults, don't be discouraged by the titles. I think the books recommended below are perfect for adults too. A much better alternative to dummy books on programming.

Time sensitive discount code: tech book publishing mogul O'reilly has a limited time discount for programming books or tech books for kids WKCODEKID
This deal expires November 14, 2013 at 5:00am PT and cannot be combined with other offers. Offer does not apply to or "Print & Ebook" bundle pricing.

I am a firm believer of alternative educations, because it just works for a lot of kids (and mainstream education too! I don't believe MOOC > school. I loved all my schools). Honestly, taking your young kids to watch Ender's Game or the Universal Studio's special effects show to see how minions come to life via CG and just how every movie and TV is green screen enabled ... probably works the magic! Hint hint, most of my Stanford friends who are superb engineers and founders have parents who already know engineering (and was taught math early on). Yup, get to it fast, if you are a happy fluffy person like me. My kids are definitely hanging out with engineers early on. Mark Zuckerberg said at 2013 Startup School, mostly he just built things when he was young (you know those garage fun times with daddies? working the toolbox? Now it's working on Ender's desk). By the time he quit Harvard, he already built multiple applications with thousands of users.

If you haven't already, allow your kids to try Codecademy.com, whose users can range all ages and countries. It's gamified.  Get them to think about Minecraft but not just playing, but building plugins. Please don't make them read dummy books. Kids are very smart and capable to learn (hello the whole point of Ender's Game), let them learn from legit real books.

I recommend the No Starch Press (to support this blog you can purchase from this amazon referral). No Starch Press is closely tied with O'Reilly (all mighty Wikipedia talks about O'Reilly Media distributes and promotes No Starch Press titles in the U.S., and No Starch uses various distributors worldwide.)

In fact No Starch Press talks about Wikipedia, building with Legos and also

  • Linux
  • Command line
  • Internet protocols
  • HTML CSS JavaScript
  • Full stack
  • Photoshop
  • R (for data analysis, statistics and social science researches in general)
    • yes as an neotany economists (with only Bachelor of Arts), I can safely say, no future social science will be safely exempted from knowing how to conduct research and analyze the research
    • yup Economics + math, political science + math, journalism + math, law + math
When I first visited Cornell, they say I must have played Legos to be a sound engineer in the future. Now I think one needs to know how to program to succeed in all disciplines. Modern academic skills are : reading, writing, public speaking, searching (as in Google), programming, data analysis.

Dear parents, please start early. Kids are so capable of learning languages (natural, foreign and programming languages), do them a favor get them started early so they don't have to start late like me : ) cheers. And it's okay if you don't know how to program. Kids will figure it out. You don't know how to play Minecraft either. But you probably *read* Ender's Game so do something.

Sheryl Sandberg also recently said on Quora, breaking the gender imbalance early is an important step to get girls code more. Since many of us agree that programming is an important skills. Let's make sure girls have it early and solid.

Inspiring female coders early: YouNoodle showcasing amazing women's initiatives in the bay area hackbrightacademy Women Who Code Women 2.0 as female founder resources. In my opinion, these are some of the most important initiatives and community efforts, especially Women Who Code which is completely open to all for attendance. Featured video http://vimeo.com/78776386

Consumer Brand Predictions

Somewhere along the way, I found myself to be pretty good with Brand predictions. I really understand how consumer brands work, especially how affordable "luxurious" consumer brands can emerge: Starbucks (not Peet's), Jawbone, Mac, ... also software like Skype, Evernote ... Even RockMelt (when I did their user research, I was able to make some key observations on their strategies and tactics, then they got bought)

I'd like to discuss some of the brands here. Introduce them one by one week by week, and see how they perform in the future.

We should also consider predictions brain exercises. Scientists have proven that we perform no better than chimps when it comes to predicting stock. When the choices are so limited (binary: popular or not, Obama or Hillary or McCain), buy/sell/hold, no matter how informed our answers are, they just have such a good chance of being wrong. We are limited by the choices and also the models and tools we have.

I enjoy making product discoveries of physical products (that's why i own an online store stores.ebay.com/dotpink) and also web products (that's why i write a blog).

Twitter and eCommerce, Social Media and small business eCommerce
When I become a small retail business owner, my perception of Social Media completely changed. It became a marketing tool for small retail "hackers". SEO is all very great if you can land on the first page of search engine results. SEO is helpful if people actually know how to look you up (sorry as fancy as Google is, for small retailers, it is like a big Yellow Page booklet). Every clever Social Media post can become a small jolt to traffic. It is more of a guerrilla warfare than game changing advantage. Social Media is great for "spasm" shares, so we cannot expect the life time of each message to be long, unless you are a super star already (that's just selection bias). For all I am concerned, just having effective call-to-action templates that you can cycle through for small retailers will improve your website traffic quite a bit. And the more frequently (not the more quantity) you introduce your product, usage, product in action, the better result you can get.

Note, I am not talking about advertising via Twitter / Facebook / Pinterest / ... for small business owners, you best bet is user generated sincere contents, but frequent contents too. It will take a while to see results, but a $300 per week impression payment via Facebook advertising may just be too much for any small business budget. Small business owners are actually cheap, we have to be, our margin is already low.

[Updated on Nov 11] I love updating my posts. Info changes all the time. New info just become available. Here's an opinion from Growth Hacking site http://t.co/KuhM6IhzJs by Michael Ugino on why small business should avoid burning budget on advertisement even if it is on Social Media, and instead should focus on generating a critical mass of CONTENT. A rule of thumb is to have 1000/week unique visits before considering Return On Investment ROI of advertising with hefty amounts.

NativeUnion Monocle Headphones


NativeUnion made some debut in SoCal (seen most often in actual stores near Los Angeles, not so much San Francisco) with its Pop handheld, wired retro phone designs with vibrant colors. That was a good start. Then it reinvented the product and made it into a "Monocle", just the label itself is classy, hipster and artsy.

I use it to make calls, hang it around my neck or messenger bag for easy access, and easily switch between speaker mode (say I want to share Youtube videos with friends) and headphone mode (say I don't want to disturb others on my commute). The tangle free cord (literally cord, not like headphone cord) design is great (Dr. Dre's flat ribbon design was great, but the headphones broke super fast during my business travels. Can't last, hence not worth the price tag).


  • I loved the hip fashionable design
  • flat design intuitive manual
  • vibrant colors but also have solid black and metallic design options
  • cord-design wires
  • smart little hooks that adjust the length
  • It's not an easy product to find on amazon, ebay or a retailer hub ... yet
  • And yeah, I can pretend I am a DJ and dance to my monocle, that's pretty cool
  • Since DJs hold the headphones any way (as opposed to wearing), why not just make it a monocle duh, smart designs are sometimes too obvious and harsh when the status quo is broken
  • I can't imagine how cool the chaining option is
Re-novating a classical old design, a vintage old entrenched design is the hardest. Since the NativeUnion had breakthroughs multiple times, I think it will do very well. Just like when Jawbone first started.



A great product design that isn't obvious is the customer support and post-sales designs. NativeUnion allows you to register your product and interact with their well design website. The brand experience is very very obvious. When I check out the brand name again upon buying monocle, I immediately remembered my POP phone (my Asian parent is using it to reduce phone radiation effects in China. A great product for busy business people), and wonder if I can register my Monocle too. It's pretty hard for me to remember my previous purchase by the same brand given how many distractions there are in the world right now. Kudos for creating that brand consistency for physical products (very difficult).
POP Phones

On Monocles, this New Yorker cover on Twitter.com is pretty clever and epic.
The Surprising Sophistication of Twitter

Monday, October 21, 2013

Y Combinator Startup School 2013 Highlights

I wrote most of these tweets, but to cross-check for originals versus retweets please check here http://www.twitter.com/i_stanford


Y Combinator Startupschool 2013 Highlights

Ron Conway ultimate Angel Investor godfather

User interface IP is the new algorithm (the sauce of startup success) @startupschool #ronconway

hire fast fire fast, even if it is cofounders

Ben @pinterest was a founder with a rare non-type-A calming effect says #ronconway

When @pinterest started Ben had to do focus groups with women in coffee shops call them next day to ensure engagement. #feedbackloop

40% of his startups will fail [talking generic stats, and expectations highlighting inherent risks of startup failing]



Paul Graham (Y Combinator): 

Successful entrepreneurs are the cockroaches of the corporate world. [refers to resilience in light of hardship]
Mark Zuckerberg: pre-FB friending meant 0, no access to content like newsfeed. Paul Graham: social networks had the nodes of friend graph no arcs

Nathan Blecharczyk (founder of Airbnb): 

investors want the Bs not the Ms baby. [b = billion, m = million major lol humor]



Mark Zuckerberg Founder of Facebook.com

Facebook.com: will enter lockdown mode when competitors are ahead on strategic positions. [Mark Zuckerberg]
Mark Zuckerberg: pre-FB friending meant 0, no access to content like newsfeed. Paul Graham: social networks had the nodes of friend graph no arcs

By another Twitter account: Optimizely raised their A round by hosting a mock board meeting with the top investor prospects. Genius

"As an entrepreneur, your job is not to execute the algorithm, your job is to write the algorithm." -  by twitter account Christopher

Dan is all about feedback and action loops. @startupschool while cash > 0 do feedback then action repeat

Scale talent @Optimizely by @dsiroker it was about hiring new people > current average of existing talent pool. Always scale. 

Product.name  = "Google" + http://product.name  ensured substantial user for feedback loops @Optimizely @startupschool

an from @Optimizely @dsiroker  started with @stanford fashioning neon orange shoes at @startupschool @ycombinator color [this was retweeted by Dan!]

Startup School account tweet: Motivation for creating : wanted to build something "sufficiently epic" to be his life's work.

3 weeks of cash left @evernote investor wasn't going to close deal on the day Lehman collapsed. Phil called everyone in vain @startupschool [this tweet was retweeted by startupschool]

@evernote is Phil's epic work epic work doesn't need an exit strategy. 

 Phil founder of @evernote joked don't even make friends with people you can't found company with. Laughingly @startupschool   @ycombinator





Jack Dorsey founder of twitter and square :  

"The Art Spirit" by Robert Henri

advice is to have a do and donts daily everyday.

the heart of a startup is the founding team's art & crafting, mastery of crafting

Chris Dixon at andreessen horowitz

idea exercise: what would for X Y look like? office hr team today : we are building games like codecademy

university education is a bundle of experiences which will be tear apart 2 b replaced slowly

Tweet by @startupschool “The same thing that’s happened to newspapers in the past 20 years will happen to education in the next 20 years.” - on MOOCs

Additional highlights:

"It's better to make a small number of users really love you than a large number kind of like you"

Stanford Professor Startup Engineering Coursera teacher - balaji srinivasan

philosophy US is a nation of VOICE & EXIT. Vote to change system or immigrate,leave. In startup world is found ur own company

startup tech landscape illustrated



Y Combinator Startup School 2013 - Speaker List plus a casual summary



While the event is by invitation only, it could be watched live. The startupschool 2013 videos are available here on youtube. Checkout the impressive speaker list, and a casual overview of what they said:


This is a pretty awesome casual summary, though casual.

Chase Adam | Founder, Watsi

unusually successful talk by founder of first non-profit at Y Combinator. Business + Tech applied to non-profit in  providing health care

Nate Blecharczyk | Founder, Airbnb

talks about exponential growth and handling exponential growth

Ron Conway | Partner, SV Angel 

overview of fundraising, paperworks, financial backbone of startups

Chris Dixon | Partner, Andreessen Horowitz; Founder, Hunch, SiteAdvisor 


talks about ideas and how to find winning ideas

Jack Dorsey | Founder, Square, Twitter 

gets personal and talk about how to use philosophical wisdoms in literature and non-fiction to get by tough times in startups

Diane Greene | Founder, VMWare

the early founding of VM and getting the process right

Phil Libin | Founder, Evernote, CoreStreet 

gets personal talks about tough times at Evernote, building lifetime epic work in startup

Dan Siroker | Founder, Optimizely 

the philosophical algorithms of founding companies and getting it right through feedback loops

Balaji Srinivasan | Founder, Counsyl; Lecturer, Stanford 

philosophical examination of new tech utopia, as the backbone of US economy and "political exit"

Mark Zuckerberg | Founder, Facebook


gets personal and talk about early startup years of Facebook, and hacking building constantly in Harvard

Need to think about how to succeed in Y Combinator interview and get into the accelerator, or better yet understand how to have super-fast legit reflex speed answers for a oral business plan fitting for Y Combinator? Checkout Paul Graham and Sam Altman's live office hour interview for 3 startup ideas, 1 admitted 2 failed. Ask yourself why and why not?


Two additional parts of the blog post:
You can get a sense on my twitter account http://www.twitter.com/i_stanford if you filter by @startupschool or #startupschool #startupschool2013 I had Twitter on the entire time, so this is going to be epic.
2. Why Y Combinator has turned me away from startup-ing, with a twist though!

Sunday, October 6, 2013

Product Management Studies: Evernote Physical Product UI

Read about Evernote's new Post-It Note partnership product on Mashable.com You can now tag each color with smart tags, given them meanings, get free premium membership, and digitalize your doodles and blueprints with the help of 3M.

Checkout the new Evernote market place https://www.evernote.com/market/ It is making physical products cool again.

Post-It Note may not be the sexist product any more, but honestly, honestly, these four colors are pretty FLAT, yes, that means they are cool! >_< right? iOS7 is flat (though it may not be cool), but these vintage colors are making a come back. Electric blue? Just a little more neon than the flat blue. Not the same I know, but definitely some affinity. If I were 3M, I would turn these four colors to flat colors though. Then it would be perfect!

What about an Evernote green? What would you tag it with? Your answer may just be the brand value/image of Evernote.


The product is rather similar to the Moleskin Evernote notebooks, which have beautiful pressed cover filled with Evernote's popular logos and icons (the founder was very proud of the logo).


Then I can't help but noticed the wallet, seemingly simple. I immediately noticed to whom Evernote is trying to market. Can you guess what is the geo location of its potential customers?
If you have used the fast on-time metros of the far east, or their ever-so-abundant vending machines, you may recognize the tiny green card that is known as Suica (yes, our clipper cards might have learnt a thing or two from this one). Below is a "infograph" of the intended contents. Yes, all Japanese.

Evernote has achieved somewhat of a cultish status and popularity in Japan. The fan base was like the Mac Apple lovers back then. It is not too surprising that Evernote will boldly display these pictures on their American website. Japan is also associated with good modern designs, high quality, concise, and top-notch. Imagine, how people will feel, if these bills were Chinese (no offense to any one, i am just proposing a quick exercise of perspective)? It just doesn't say the same about design quality.





React UI, UI UX, Reactstrap React Bootstrap

React UI MATERIAL  Install yarn add @material-ui/icons Reactstrap FORMS. Controlled Forms. Uncontrolled Forms.  Columns, grid