Sunday, December 27, 2015

Styles' BasedOn Default Style

Just a small how-to/tip... and note to self.

Often you want to modify a control's property while keeping the others the same (maintain the other properties' values).

<Style TargetType="Label" BasedOn="{StaticResource {x:Type Label}}">

This modifies the Label type within the context, but retains it's previous style (in my case a ResourceDictionary).

Wednesday, December 23, 2015

Deciding to Take Responsibility

After watching Joelle's TED talk and reading her book, it just hit me that most of my life, I wasn’t really taking responsibility. I was responsible in certain areas but in terms of health and actually wanting to live… not really. I trusted things (and people) were going to turn out how they did and I could only go with the flow.

Basically Come What May thinking. My disability and my environment kinda of reinforced that.

Doctors: nothing you do will make a difference… eat whatever you want and hope for a cure

Parents: make the best out of your current situation, you can't really hope for more.

Work: you did a great job… keep working hard (for the little that we give you).

And of course myself: I am disabled, things are hard, what exactly can I hope for? Why set high goals when it seems they will be unreachable, just try to make the best I can out perhaps just enjoy the life you have left…

Well the last part after the or and that thinking in general might be the cause of the downturn in health… I really like chocolate, meat, junk food…. Don't like exercising but hey… I didn't matter… there what the doctor said and you know do I really care when I do.. But then again that belief had to come from somewhere...

So seemed dying ASAP isn't such a bad idea because there's nothing in this world that I like… other than maybe some food and TV. Hence why I binge on both...

But after watching her and Martin Pistorius’ talks, something inside went off… can I actually do better than my current situation and were decisions I made correct or just heavily influenced by my environment?

Did I place my trust in the wrong people… maybe I should've just done what I did back in school…

If I want something done right, got to do it myself. Got to take responsibility… for my own life… all of it…

But now the question remains… is it too late? But I guess YOLO right?

Alright time to give it a shot!

Friday, December 4, 2015

Writing Blog Posts With Word

So just a random tip. If your blog supports input via HTML and you prefer writing posts/drafts in a nicer editor (Microsoft Word, any that supports saving as a HTML file), YOU CAN!

Write the post in Word with all the standard formatting.

DO USE

  • standard headers and paragraphs
  • standard formats: bold, underline, italics
  • links are OK


DO NOT USE/AVOID

  • bullets
  • indenting/tab/multiple spaces
  • images (has to be inserted in the blog)


In Word Save As Web Page, Filtered 

This is very important otherwise Word uses it's own HTML style. May not apply to older versions but if you have this option, use it.


Open the document in a good text editor (recommend Notepad++). Skip the <style> section.



Highlight all the text in your document, should be easy to spot, and copy it



Create a new post and select the HTML section and then paste it all in.

Save the Post and then switch to the regular editor and clean it up. The issues should be minor and very quick to clean.


Clearing My Quora Reading List

Hi! Yes it’s been awhile since my last post but just a lot of things going on lately and also learning algorithms takes A LOT of time and energy. But at least this time I am motivated: I realized this is the final frontier in what I should learn... and I may need it to really get a job that doesn’t feel like work and pays appropriately…

Also... it seems understanding, implementing and applying this stuff to solve real problems... is kind of interesting....

I’m also on vacation (at home) this week so clearing up a lot of things lower priority things on the To Do List, in particular my Quora Reading List. 

Below, I've categorized each into it's own section.

Google

I’m not too serious about working here yet but I was reminded of all the algo stuff by one of their recruiters, so I guess for me it would be a dream goal. Icing on the cake… but honestly… free food is great but I use a lot of their apps … and I’ve found a lot of issues and annoyances…

But... at work I have been complaining for months about a bug in an internal API my team uses. I know the manager directly so finally he said “here’s the source code; you figure it out”. I did… after looking through a few code files in less than 30 minutes… So lately I've also been thinking that I need a change...

https://www.quora.com/What-should-I-expect-in-a-Software-Engineer-interview-at-Google-and-how-should-I-prepare Good tips and I found out who Gayle Laakmann McDowell is.. But yea I have a long way to go… I don’t have any CS background… :(

https://www.quora.com/I-just-had-a-first-interview-at-Google-I-coded-the-right-solution-on-the-board-but-the-interviewer-helped-me-several-times-along-the-way-How-likely-am-I-to-pass
Interviewers at Google are more interested in your thought process and ability to solve problems than your ability to answer a single question
https://www.quora.com/Does-ones-extreme-knowledge-of-Android-programming-alone-able-to-fetch-that-person-a-job-at-Google
No. Google, like most companies of that caliber, doesn't care much about which programming languages/technologies you know.
... 
To be perfectly honest, people who define their programming skills by their languages/technologies tend to struggle more.
I have seen others whose projects were designed so well and the people on it were so knowledgeable that he could take 3-week vacations without a hiccup. Jokes about job security aside, Google is smart enough to value the latter more because it is a cornerstone of good leadership. Moreover, it has the added bonus that people will want to work on your project because they learn a lot and have a chance of growing

Hm…. Since I can take vacations without my code blowing up in Production am I a good developer who automated and documented a lot of things… or just working on a tiny project?


https://www.quora.com/Is-it-hard-to-get-a-job-at-Google Based on Stephen Kurtzman’s answer I might have a chance… if I can learn all that stuff… and they actually do something that interests me…

https://www.quora.com/Is-working-at-Google-overrated Apparently not... Not sure what projects though… the one’s I see are pretty…. Meh…

Software Development Questions

I think Quora feels that most of what I like (and I guess that’s true) so I get a lot of these on my Feed.



Solid experience in all of this takes a while, but it's one of those situations where being ahead keeps you ahead. Once you have breadth and depth, you'll be stronger and more flexible than most professional programmers, which will help you find better and more challenging programming jobs, which will allow you to learn from the work and from others and keep improving your skills quickly.

It’s a pretty long list though and I really doubt I want to know C++…. But actually I think I have like 50%+ already..

https://www.quora.com/What-are-the-growth-stages-of-a-programmer Stages are pretty interesting and varied…



So these last few again seem to be saying… revisit functional again…




Investing

Another topic I am kind of interested in… when I am not being burned by Mr. Market


Miscellanous

Random questions I’ve seen or asked.

The total US household value is $70 trillion so $16 trillion debt is nothing

Except 90%+ of that can just leave if the government wants to repay debt?
But the other problem they say is this is structural (I agree) but… we have a do nothing Congress (OK they can fight like 5 year olds) and they seem to be here to stay… maybe Trump should be President?... At least he’ll do something… I would hope…

Some good laughs

Alright "that's all folks!"

Saturday, November 7, 2015

The Problem with x, y, z (Why Write Descriptive Code)

I was going through some algorithm books lately and had a somewhat hard time looking at the code samples. To help I tried copying some onto my computer. While doing that I realized a lot of the variables' names suck... and also they took some shortcuts/optimizations. 

Perhaps they were trying to save pages... but their index is like 40 pages long and who ever reads that? Or maybe they want readers to figure out the mess to help them learn… I don’t think it’s a good strategy though because hard things just turn people away.

But this was also something I fought with at work. When I first took on the code base, it had a lot of non-trivial but short variables. You have 100 lines but one of the important variables is called  x or tmp.

Maybe to PhDs, those variables are trivial to them… but I don’t think they are for someone who is trying to understand the stuff for the first time…

But anyway yes, I usually name variables with a longer name such as an actual word/phrase or abbreviation of one. 

I am also a very liberal commentor sometimes writing small comment blocks to explain what a somewhat large block of code does... usually these are legacy and I write them after spending 30 minutes figuring out what they actually do...

A common scenario is in nested loops,  I don’t want to worry about forgetting what i and j really mean.  Yes they are counters but you’re probably using them in the loops. A common example,  reading data out of a data table or 2-D array.

Usually you think in units of row and column but you decide to call the iterator x, y. Well, come back in a month and tell me which is for row or column in 2 seconds? In fact, you’re probably going to mix them up within the loop while you are coding it. 

But how about r,  c?  For most this will do but sometimes it’s just better to use row,  col…  especially if you have some other variables.

I guess in the end it’s just readability: can I naturally understand the code and clearly tell what it does? Good variable naming is a big one.. . Organization/modularity is another.

Also it avoids unnecessary work, why spend 10 minutes on something when it can be figured out in like 10 seconds,  given good documentation and style? 

Again… it's better to be long term lazy than short-term lazy. Or as they say in the Phoenix Project: reducing and avoiding technical debt, because one day it will come back... with a very big vengeance.

EDIT: Sort of... actually I wrote this in a draft probably over a year ago...

Variable Names Should Be Descriptive

Cryptic names may be good for job security but more often than not you leave on your own free will. However, if you're still around, you're probably going to be banging your head sometime in the not-so-distant future when you need to make a change and you cannot figure out what this 'x' variable is for.

If you're just using for a counter in a small loop, fine. If the variable is a class variable or the logic spans 20+ lines, you may want to think again.

Comments are Basically Free

A lot of people may disagree with me but I tend to use comments pretty liberally. I understand code should be dead simple but there are often times where you are unable or cannot change existing code... or at the time you are writing it, you cannot think of an elegant solution.

Even if the code is good, sometimes you do need a JavaDoc or whatever they call it, to remind you or whoever works on the code, what the method does and any important, but small details, that could be missed like: "You know this code below looks obsolete but trust me if you remove it, people will complain." (this would have been nice to know in a few situations that I've come across).

Saturday, October 31, 2015

Thinking Like a Computer

This is still a WIP, will add some specific results later...

While we focus more on getting computers to think like us (but even better), I think there are a few things we can learn from them.

The way I see it, the brain is like the main parts of a computer: CPU, storage, memory.

However, the space in our heads is more limited than even the space available for these in a laptop. Smartphones don't do much themselves... they rely a lot on the Cloud, basically a massive supercomputer.

So this is how I see it:

Brain

  • CPU
    • Critical Thinking/Evaluation: uses the below to make decisions
    • Random Access to Storage and Memory: responsible for causing thoughts to suddenly pop-up; some useful, some not, others become useful when Ideas Engine puts them together
    • Recall/Search/Indexing Engine: algorithms, heuristics, data mining that can run on Memory and Internal Storage
    • Ideas Engine/Subconscious: utilizes all these in the background to create AHA!s
  • Memory
    • Fast access like a HashTable
    • Short-term: things may not stay long and get lost randomly; forced retention takes a lot of energy
    • Working Memory: things you need to know, use constantly, and handy for getting whatever you're working on done quickly
    • Certain knowledge can be loaded and found from long-term but may take time (i.e. syntax and programming style in a specific language)
  • Internal Storage (long-term memory)
    • Long-term 
    • Retention is uncertain
    • Mostly random access so finding important things are slow
    • Sometimes feels like a bottomless pit but again recall and retention is slow and uncertain

I've emphasized what I feel are some key traits and the CPU does a lot of them. More importantly though the amount of space for each is dynamically allocated, particularly between Memory and CPU.

So what I think I've discovered is:

Shrinking the Memory and using the space to expand and strengthening the CPU is leads to increased random thoughts and also more talking to myself. These lead to more random ideas and some of them are quite good... solutions, blog topics, talking through problems and hypothetical scenarios.

So how do I shrink the Memory?

Well Working Memory is important but again you don't need to and cannot remember all of it.

Instead I hold links. Similar to a computer, we have External Storage (paper, computers, smartphones).

So basically write things down; some examples:
  • I have a blog idea? Write a brief summary somewhere and just remember that I have an idea and where I put it (putting in the same place helps a lot because then it goes into long-term)
  • Some new system I build is fresh in my mind (Memory), but am I really going to remember it 6 months down the line? More importantly, do I need to waste this space holding it? No... write some simple but clear documentation and create some cheat sheets. Finally, I create a link and use the freed space for something else
  • I can't remember the 100 different usernames and passwords! Then just use single sign on like Facebook, Google, a password manager, etc
By doing this, I can shrink Memory by offloading the actual data and just holding links which I can easily remember and cheaply store. Hey, found some free space!

Now just a short note on Internal Storage. As I said above, it is somewhat like a bottom-less pit, very fuzzy, and really just random access. Think about questions like this, when were a kid, when was the first time you... They usually take a while to answer and it's probably the CPU's Search Engine at work. Similarly you know when after interviews and tests, you go: "Arg.. I should've ..."

So now that you've freed up a whole bunch of space, grow your CPU to fill it up!
Especially the Search Engine and Subconscious. This is again why I feel thoughts are now flying around. These merge into ideas and solutions, allow me to rant for hours, and summon random facts that I use to... well my friend knows.

Basically all I have to do is say "I am looking for something like..." and after a few seconds, days, or weeks... BOOM! AHA! result/solution found!

So here's some tips... I may edit more later I was just thinking about these... randomly.

To build grow your Random Recall Engine (and I think this is like the best part):
  • Blog, give speeches: As you can see, I can ramble longer and longer nowadays. Why? Because when I fire this engine up, it just keeps going and going jumping from one idea to the next. I am pretty sure this is how good speakers like those on TED give their speeches: Put in a main idea and hit Start
  • Argue with and persuade people: similar idea, you need persuasive reasons with a (Search( Engine you can find them quickly
OK I am cutting it a bit short but my Engine/CPU is getting tired... maybe more on this later and clean up the ideas because... well I am pretty much just streaming whatever comes up now.

EDIT:

OK so for personal things I tend to offload them on my phone, I have a few reminders and notepad and these are own the front page... along with common apps. Yes easy to find is another way to reduce the amount of energy spent on not so useful things. Less energy here, more for creativity and problem solving.


Whenever I suddenly think of something I just pull out my phone and write a note. These screenshots are the results of one of these. 

You can also see the idea of heuristics and how they are data mined from you Storage and Memory is also something that popped into my mind... I think while making lunch.


Alright... I am dry for now... maybe more to come...

Why Modularity?

Originally, I wanted to focus on how modular code design increases reusability (thus reducing code duplication) and leads to new ideas… but really it applies to many things. So let me talk a bit about that first.

You probably remember as a kid, you played with Legos.  They came with basic small pieces (usually… I think there are bigger ones now), and you put them together to create whatever you thought of.

Similarly in school, at least in the early years, you learned the basics which were used to build/understand more complex ideas.

Now back to coding. Recently, this has been a growing movement, and I think driven by multiple forces but all really address the same thing: inter-dependencies in monster code (henceforth known as MC).

Agile
MC is hard to change without accidentally breaking some functionality, Also boundaries between components are fuzzy: many many "hidden" relationships that don't show up until something (in Production) causes it to blow up. This means more time spent testing and debugging.

Clear Code
MC usually does many things…  at the same time…  which means the whole logic is hard to understand and debug. Humans' minds can only keep track of a handful of variables, especially if they are called x, y, z.

Testability
MC is tightly coupled and have dependencies all over the place that impact results… or even whether you get one or not (tightly coupled external services).

So then these need to be tested manually… again huge waste of time. I commonly hear stories of releases taking whole days and a team of people because the testing is all manual and it is very hard to automate… culprit?  MC and poor systems design.

Small generic code is usually fairly easy to decouple,  just stick an interface between them. In fact, you can then use a mocking framework to "mock up" an implementation for unit tests.

But actually Testability needs to be designed into the system and usually that leads to... modular components. That's also why we need to move to TDD where modularity becomes a basic requirement.

Reusability
Creating independent modules means that you can take existing, well-tested code and plug them into other apps. This is probably the main reason for the Apache Java libraries that address a lot boilerplate code. Similarly, I have created my own libraries that I use in a lot of my C# apps.

By reusing code, development is faster. Moreover, you are not wasting time and energy writing something that you already implemented 6 months ago. Or copying the same code snippet 50 times when you need to make a bug fix or improvement. And I doubt you will do much of the latter with the amount of "work" involved. Generally, you want to follow DRY: don't repeat yourself. Again TDD should help: if you're writing a similar test, maybe you should look at an existing module...

This time and energy saved (along with that from automated testing and deployment) is usually where new ideas come from.

You can also take a handful of them and write some new code that puts them all together in some new way and…  Voila! You just quickly (and cleanly) solved a really annoying problem or created a useful new app/solution.


Friday, October 30, 2015

I'm Sorry... I am having a bad night...

I think I just posted another 2 rants about how technology companies are like idiots these days... oops I did it again

Anyway, I will probably go back to normal tomorrow, I'm just all fired up now about this so let's just get it over with...

The Problem with Metrics... Listen Up Google...

One of the complaints listed here, What is the worst part about working at Google? is an obsession with metrics. First of all, while data is nice, it's still kind of like statistics... depending on how you collect it, you can make it say almost anything.

So most likely you are going to go by... majority rules. Let see, didn't Apple say something like:
Consumers don't know what they want?
But there's usually a small group of people, a super minority that does tend to know what they want. And well maybe they aren't exactly consumers... they are more like technologists... without the super smarts to get into big tech shops... or just the cramming needed to get past the interviews or have any interest in joining...

But they tend to be self-identifying and very collaborative and helpful when asked or given a chance to speak. In fact, they/we are the ones submitting most of the bug tickets and feature suggestions. But what do we get back? Nothing... It seems we just end up yelling into the mountains.

Google...

You're apps are draining my battery and data.... unnecessarily. We've been yelling at you and talking among ourselves for years... All you need to do is put in some settings so we don't need to forcefully kill and block them.

Also, the Gmail app is a mess... The web version is actually much more functional feature-wise... but anyway, I think I have told you guys repeatedly already so you want the details? You come ask me.

But this may also have something to do with your engineers' tendency to always chase shiny new things and because they seem to be zoomed into some challenging algorithmic problem rather than trying to deliver a high quality product to users... hey why don't you hire some full stack developers instead of massive teams of specialists...

Anyway, why don't you put some more focus on the minority that actually knows what we and probably everyone else wants... rather than putting your attention on a majority... that don't know the status quo can be changed until it is.

I Hate Windows 10

This is a sudden post but I've had enough of Microsoft's aggressive tactics. I am someone that wants full control over my devices and ABSOLUTELY HATE NAGGING...

Windows 10.... full of nagging that can't be turned off.... Up to Windows 8.1... I could at least get it to stop... Windows 10? NOPE....


  • It won't stop asking me to use Edge and all their other "awesome" apps... even after I told it NO!
  • I can't tell Windows Update to go away for good... it still wants me to at least schedule reboots... NO is NO.... I will reboot when I feel like it...
  • Now that I want to shutdown... since I am now not busy and would like the update installed...  It just says shutdown... What's the update?  It seems I need to tell it to Restart...  through the Check For Updates app...  All I can say is... Are you people idiots? 
Probably more to come...

Saturday, October 24, 2015

Backlog: The Enemy of Starting and Catalyst for Procrastination

OK this should be a short post.... unless I somehow get into RANT mode... which may be a topic of another post by itself actually....

But yes don't you often get the feeling when trying to start something and then you feel resistance. You think about all the work you would have to do... and that it is indeed work as opposed to play. Hey another topic! I think I am back on a roll now! 

Crap... Just when I was getting started... time for dinner...

Updated 7:30PM Alright I'm back... 2 hours later
... Rebooting... Figuring out where I left...

So you start thinking about all the work you would need to do. Here are some examples but I am sure you can think of more:


  • Blogging: I have another 5 post ideas... this is going to take a lot of time....
  • Taxes: 
    • September: I currently have 100 receipts that I need to itemize... let's do it next week... 
    • + 1 week ... : more receipts ... will do it next week....
    • April: so many now.... but I NEED to get this done or the government will be on me... CRAP, CRAP, CRAP, CRAP, CRAP!!!!!!
  • Magazines/Online Courses: I am already behind by 3 issues/lessons... can I really catch up? how much time is it going to take? why bother?
  • Books: my reading list has over 30 books... and each has 200+ pages... My Kindle collection has another 1,000+ and gets longer every week... I'm never going to be able to finish this... what's the point of starting.... Maybe I will read one when I am really, really, really bored...


And now you start thinking: What to do.... what to do, where do I start...

All the while...

  1. Nothing actually gets done 
  2. You get more and more stress out
  3. The piles keep getting bigger


So what do I do? And I think what you should do

  • Prioritize
  • Make a recurring plan
  • Follow it mostly and occasionally, grit your teeth and JUST DO IT!

So back to the example and here's what I do for the first two steps:
  • Blogging
    • Plan
      • I'll try to do at least one post a week, assuming I have something to say
      • I can also do it during my commute there are some really nice benefits to long commutes by public transportation
      • There are also benefits to blogging See separate post
    • Priority: medium-high, hey it's pretty fun and I have the time
  •  Taxes
    • Plan
      • Every week or two, I will digitize the receipts and enter the amounts into an Excel file
      • Mostly just keep the number of receipts needed to be processed low
    • Priority: high, this stuff isn't as fun as blogging so have to kind of push it
  • Magazines/SlideShare/News (these tend to fall together)
    • Plan
      • Magazines: keep it manageable and up to the month; can always skim
      • Everything else: leisure activity, maybe just check a few times week, no real back-log with these
    • Priority: medium
  • Books
    • I'll read the ones I find interesting and +1 if they are short but informative Yes +1 is actually good for something, I use it to mean that doing gives you some free bonuses so yea actually not Google's intended purpose
    • Priority
      • Short and/or useful: medium
      • Need to know: high
      • Kindle and long books: low... super low
OK so I think you get the point and it's been an hour so... just going to stop now... will wrap up and clean up maybe in another update.

Saturday, October 3, 2015

Is Apple's Revolutionary New Features Really That Revolutionary?

Lately Apple is once again at it hyping new features such as 3D Force as a new feature that will change the way people use devices.

The sensitive touch is kind of nice and Apple has introduced new hardware such as fingerprint scanner which may be a nice addition but this 3D Force thing seems like its fixing it's own problem...

Similar to how it was hyping Folders for it's iOS 4 a long time ago.

For these, all I want to say is "Hey Apple welcome to the party, thanks for catching up to the times!"
Back then Android already used folders and the jailbreak community had that as well.

Back to 3D Force, I am usually an Android user but wanted to do some e-book reading and note taking on the iPad since it is more suitable, bigger screen.

Google has standards about what a long-press and other common actions should do and usually the developers follow these because it makes intuitive sense to them...

Apple... there are no standards and their apps are the worst offenders of all....

Take Photos. I take screen shots of my notes and highlights while I read and then round them up and upload to Google Drive. But I review these before that in the app.

Sometimes I have duplicates and so I open the app and see the photos... but to Delete them I can just long-press...

No I have to click on the "Select" button on top... then select the images I want to delete and then click on a Delete or Trash icon...

Android? Just long press and it goes into Selection mode where I can multi-select and then choose a Delete action which is now in the action bar.



Sunday, September 13, 2015

Hibernate != Sleep... Tech companies have lost touch with users and/or are just getting dumber

Recently I had to reinstall Windows so installed Windows 10. I also enabled hibernate instead of hybrid sleep... In fact, I don't understand why they removed explicit hibernation and made it so hard to get it back. Maybe that's why users have been slow to upgrade from XP? I believe Hibernate was feature...

Or perhaps MS has some deal with power utilities? You want to keep your current state? well you have to leave your computer on for a few hours in sleep mode before it will shut off completely.

But I KNOW when I want my computer completely off (hibernate) vs. on stand by (sleep). By the way this concept has been hyped in software engineering for a few years now (inversion of control). Apparently some big-shot project manager at Microsoft cannot understand this... and so...

When I hibernated my computer, it was waking up at 2AM in the morning to check for and install updates...

The configuration to turn it off was under Power Options > Advanced > Sleep > Auto-Wake Timer but I am pretty sure any non-technical user would never figure this out.

OK so my rant on Microsoft is over but here's the main thing...

Over the last couple of years technology companies (Apple, Samsung, Google, Facebook) are pretty much telling users: "[do it] our way or the highway (goodbye)". Or they are hiring a bunch of morons... 

I already said goodbye to Apple years ago, the only way I would even think about going back is if they paid me... My iPad 2 is now a glorified e-book and magazine reader. Samsung I never liked...

Facebook unfortunately I am stuck with as everyone is on it. Their customer service is horrible and their Messenger app keeps crashing. I’ve reported the issue explicitly including how to replicate but all I got was a few thankyou’s…  But no fix… The root-cause, I have observed, seems to be, a null pointer exception… With some debugging skills, even a junior developer could fix this… So now every time it crashes (several times a day), I sent them the crash report with notes calling all their engineers idiots because if you cannot fix a NPE… you are an idiot…

My beef with Google? They have been removing useful features/functions in their apps or hiding them deeper and deeper with each update…

Uh... the whole reason I liked Android over iOS was because it was highly customizable. Yet Google feels like they know what customers want:

It’s completely OK to eat up 2GB of mobile data a month to check and install updates or send continuous messages to Google…

You know... mobile providers throttle your connection once you hit 2.5GB… on an unlimited plan.

I installed a firewall app that completely blocked Google’s crap from running while on mobile, my monthly data usage is only 700 MB.

Sure I don’t get push notifications but do I really want them while I am at work anyway?

The Maps app will now tell you the current time including traffic but not the ideal time

Yea that's great and all... except when I am stuck in a snowstorm that causes massive delays and so have some time to consider alternate routes during a good day... except all the times that come up are for... right now. This used to be there but some idiot felt it was unnecessary... because most likely he rides the Google bus to work everyday.

The Gmail app has less options than the mobile web version.

Maybe Inbox fixes this (I highly doubt) but I don’t like the workflow. (I keep my emails manageable and use Boxbe to automatically filter out all the spam).

Simplicity is great and all but I think this is more stupidity... again taking useful features out of products. If you really think it’s going to confuse users, stick it in a Developer Mode.

But wait…

The Gmail app has an Add/Change Label and Move to Label… What?

I recall… a Label = Tag, you mark messages with them, Label != Folder…

Now they are saying Labels can be used as a Tag, Folder, or Both. And they never explained why. I guess some developer felt like putting it in at some point…







Logically, you should use one... not both... Just put in an option which style a user wants to use it as.

Perhaps, the new logo may be a message to everyone that their user experience team now mostly consists of 5 year olds...





UPDATE 10/3

Been awhile again, had few personal issues lately, I have a few posts drafted... but first lets add to the list.


Ahh Facebook... do you think keeping all the chats since day one is uhm,,,, a violation of web privacy? I think email companies, last time I checked can only keep deleted messages for 60 days: http://smallbusiness.chron.com/long-gmail-keep-emails-65391.html

In fact I never knew you were keeping my chat logs in the first place until they popped up in Messenger...

Also those Delete buttons in Messenger... don't do shit... Yes that's how pissed off I am...

It may be a technicality and it seems there's a Help document with that but... I should not have to look this up.

https://www.facebook.com/help/messenger-app/242107552657620

And again this is moronic!!!! GMail has had an Undo button since.... The whole point is if you send a message mistakenly you have a chance to unsend... Outlook has a Recall function since... even longer... it doesn't work all the time (when the message has already been read) but it's there...

By the way, where do these Facebook messages get sent to... I think it gets sent to... Facebook.

Why would I want to delete individual messages if it just deletes for me?

Anyway... Facebook: misleading, moronic, moronic, moronic, violation of privacy...

Next Google....

Your material design is great but do you think when I am writing a review for an App in the Play Store, on my phone... and just accidentally click out of the popup... I want the review to be immediately deleted?

At least show a confirmation box morons....

And here's a new comer but still.... Quora

In their Android app... after I search for a question and do not find it.... I click "Ask Question" ... and have to type the entire question again....This has been the case since....

Clearly nobody at Quora uses their own app...

10/17/2015: Maybe somebody read this post or read my complaint, it the Quora issue is now fixed :) I cannot say the same for the others... and my list just keeps getting longer...

Facebook.... those event notifications are just great! sarcasm...

You notify me the day that my contacts (I am actually not that close to most Facebook friends) are going to the event.... How is that of any use....

I'm sorry I do not have a magic teleporter that can instantly get me into the city or most of the time I need this thing called..... PLANNING.

Wouldn't it make more sense to tell me that "friends" are going to events the moment they put check "Attending"?

Otherwise I get the feeling when I see the notification saying "... is attending an event today", Facebook you are actually telling me:

"Haha, you loser! Look at the amazing event ... is going to... you missed out! sucks for you!"

And there's apparently no option to configure it otherwise... I guess I will just have Android forcefully suppress these notifications.... Bad Facebook, bad....

Saturday, September 5, 2015

Talking to My Subconscious

I'm not sure to describe it but usually I have a voice in my head. In fact, it seems to be speaking now as I type, formulating and revising each sentence. In fact, often when I have a thought that I want to write down, I find myself drafting it in my mind and repeating it over and over again which different changes until I sounds "perfect".

The last sentence would be one of them. And the last sentence here as a comment that just popped in my mind. And this is in particular what I am talking about.

Actually... I have never done pair coding but from what I've read about it, It seems I have a 24/7 partner that usually goes... "hey wait a minute...", "oh yea... did you remember to ...", or "how about we try this... "

Not sure if this is normal or perhaps I have somehow trained my subconscious to actually work with me or for me instead of just throwing random pointless thoughts around in my head. I still get random thoughts but most of these as you can see are very logical and useful.

And occasionally I do get a "gut feeling" but more often than not, it is right.

But it seems now... neither of us have anymore ideas on how to keep going on about this. Maybe we will revise later but for now...

This is the End


The 24/7 Notepad

I have written a lot about how I tend to write things down at work, but actually I do it for myself as well. I have a simple notepad app on my phone, which is always around me. Whenever I think of something I should remember for later  (todos,  ideas,  solutions) , I just quickly create a new note, and write enough details so I can recall everything or at least the important points later (this takes some practice).

There are a few (significant, I think…) benefits to this. These are also mentioned in the other posts in various forms but:

  • You don’t have to worry about forgetting, which saves you a lot of stress and energy
  • You can use those brain cells for other things; you just have to remember you wrote it down or make it a habit to review your notes periodically
  • If you forget,  it doesn’t matter as it’s all written down and you can quickly pick it up again

So here is an example which I actually did while originally drafting this post (this is the final version, probably).

And by the way I just thought of including this while changing trains and when I wrote this, I immediately felt a huge relief that I no longer had to remember what I wanted to say.

In the morning during my commute,  I tend to go over all the work that needs to be done and then make a todo list. The problem is that my commute is over an hour long so remembering all of it is… a huge energy and resource drain, and I probably won’t remember anyway…

So I just write it down on my notepad and then do other things such as reading the news, watching some videos, and writing this post.  All while happily knowing that when I get to work,  I have a plan and I just execute…  usually with some….. uh….. adjustments.



Sunday, August 30, 2015

What is a 10x Programmer?

Sorry again... got sidetracked with a bunch of things: new interesting project at work, reading Team Geek, and an addictive mobile game (yea... and it seems blogging is still not really a habit yet).

Regarding Team Geek, great book.  It's written by some Googlers and filled with fun facts and funny pictures. It goes through a lot of ideas about how to be a great developer/engineer/manager/team player.

Recently a recruiter asked me what I would like in an ideal job, I wish I could just point him to this book.

OK... so originally I wanted to write a long post about the 10x Programmer, but I'll just keep my point short since I've had previous rants about Software Developer Heuristics and keeping things simple (this and this).

And that's really all there is to it, I think. So here's a summary:
  • Have a broad background and experience so that you can 
    • pick up new ideas quickly and integrate them to your existing knowledge base
    • develop an entire solution/proof-of-concept (front-, middle-, back-end) fairly quickly... and bug-free
    • have brain flashes of new ideas and solutions that make 1 + 1 > 2
  • Automate, automate, automate! 
    • Know how to identify and get the computer to do all the boring, repetitive work (basically the other 90%) 
    • Make it check your code so that releasing a bug is almost impossible (unit tests and automated integration tests)
    • Now you can focus your energy and time on doing something that actually has real value instead of trying to just keep the lights on


Tuesday, August 18, 2015

Move To Digitization

Actually a very old post, maybe 6 months ago (OK not that old) but just realized it was a draft. Didn;t really edit it though...

I'm preparing to move to a new house and the whole family is going through all our stuff and seeing what to keep or throw away... there's a lot...

I came across a huge piles and folders of CD/DVDs which I haven't touched in years. And I realized that people never use anything if takes significant effort to locate, even less so if it's not important.

(I also came across a lot of other stuff from my childhood which did bring back some interesting memories... more on this as well below)

Anyway, I guess this is also caused by the current shift in culture, where everything is digital and can be accessed almost instantly. Unfortunately, digging through volumes of DVDs or other stuff is too much work in this context, so it seems we just put it away and forget about them. This may work well for some stocks but this stuff takes up space somewhere and for most of the time, produce no value.

It's probably poorly organized as well.

Digital things though are usually really well organized in folders (at least for me) and there' is also the ability to search through huge amounts of it with very little effort.

So now I'm in the process of digitally archiving all those CDs into my external HD (and cloud, I got 2TB of space there as well).

I'm also going to take a few pictures of some of the old stuff that did bring back memories, mostly old school books. I don't know but to me, physically holding it doesn't really mean much to me but seeing the general contents brought out some sentimentalism so it seems the picture would be enough, maybe a video?

Either way, it seems the the digital form provides more value than the physical one and again: it takes up far less space, is now organize-able, and at my finger tips instead of in a box somewhere in the attic.

I can't wait until we have realistic VR with all senses... we could just can in all the old stuff or something and get rid of them and we would still be able to get the memories back.

Sunday, August 16, 2015

Motivation for Making Things Easy

So this is actually related to the previous post and another way of seeing it.

I have streamlined a lot of our processes such as build and testing (probably mentioned this several times already). But what is the motivation for building these and other tools that make doing things easier?

There are a lot of reasons but at their core is this fact: it reduces (significantly) the cost associated with doing whatever it is that they are supposed to do.

So what?

Well let's take shipping new features for a (software) product, something that is done a lot. If it takes 4 days to build and release a new version, what tends to happen?
Well from my observations and experience:
  • A single release typically has a huge list of features... and when something goes wrong it is very hard to figure out which change actually broke it (I am starting to hear prayers...)*
  • Releases are done less frequently; ready features are still waiting (and when they do go through, is been a month and no one remembers exactly what this feature does and what exactly needs testing)
  • Time and energy are wasted on mundane work that a computer could do in seconds
*Also if it needs rolling back, the features that are working fine would be removed as well. I did this once when I first took over a project. It wasn't my bug but still it was impacting users so had to rollback and removed some unrelated features. Users weren't too happy.

All of this can be summed up as either immediate pain or cause of future pain.
And so this brings us to my conclusion (it might sound familiar and like it should be coming from a philosopher):

There are really only 2 things that motivate people: pain and pleasure (reward)
Therefore if cost of doing something (Cost) > Reward, the tendency is it will not get done... until  Pain > Cost

And in the context of software development, the work is then rushed through and poorly tested, leading to production issues which again take away time from doing other work, which leads to less time for testing and developing quality code, which ... (You get the point)

Basically MORE PAIN

So what is the solution?

Reduce the cost to the point that Cost < Reward, or in other words:


Make things easier!

Sunday, August 9, 2015

The Path of Least Resistance

As everybody probably knows, electricity flows through the path of least resistance. Well generally people do as well!

Surprised? Probably not right? I'm sure you can think of your own examples where you take the easy way out which may or may not have negative consequences later.

So what is (IT) upper management thinking...

We have all these lengthy procedures and "paperwork" needed to get things done. But a bigger issue is the software used to do all this is buggy, slow, and not intuitive...

And surprisingly, we brought these from vendors... using (a lot of) money! If these targeted consumers, i.e people buying iPhones, I'm pretty sure they would be out of business by now.

As a developer, I like building programs that make doing things intuitive and easier... not harder. At the very least they should fix this yet upper management takes no feedback from users and the vendors never do anything on their own... Other then maybe update a picture somewhere or add a note that says their program is incompatible with Chrome.

So here's some questions I want to really ask these guys…

  • Why do we buy software that looks like they were built and last updated in 1990? 
  • More importantly do you think people will do the right things if doing the right things to perfection is so unnecessarily difficult?
  • Why are there systems that seem to trap useful data without any good ways of getting it out (data silos)?
  • If developers have to spend all their energy dealing with these clunky applications and manually transferring the data out of them, how much innovation do you think we will do?
And lastly... It's already hard to get most people innovating or to do the right things, so why are you making it harder?

The Cost of Eating Healthy is Not as Steep as I Thought...

For lunch at work I always buy, mostly because I really can't make my own the night before and don't like eating left over dinner.

I use to (grammar...) eat at Panera and griped about how much it cost: $7-8 per sandwich, $4 for a soup… other restaurants are similar or even more expensive probably because the area has a lot of banks.

A month ago, I came across a huge sheet of coupons for a fast food restaurant and have been pretty much eating that for lunch up to now. $4 gets me 2 burgers and fries!

However... I just realized a correlation. Lately my productivity has plummeted... Brain kind of feels like mush at work. Also my motivation for doing personal work like coding, learning algo, and blogging (yea...) have been near zero. Even watching TV feels like a chore.

So to confirm the hypothesis, I ate at Panera on Friday, and it seems to be working. I wrote this post! However, this is rather short and I'm writing it at 12 AM (ideal blogging hour?)... and editing at 9AM while sitting outside (so maybe it's just the fact of having nothing else to do and I wasn't really tired last night).

Another benefit I guess is since you are paying so much, you may feel richer. I think there's the saying: you are what you think/believe/do.

So if you believe you are rich and act like it, you will become rich!

Tuesday, July 21, 2015

The Gap Between a Developer/Programmer and a Software Engineer

I am by far not the authority on this but at this point I am more of the former, but have some glimpse of the latter, and hopefully will be able to move over.

Most of the time these are interchangeable but what I am really talking about is the difference between programmers at places like banks (IT) versus the ones at tech companies (CS) like Google.

I have never worked at a tech shop but recently spoke to an interviewer at Bloomberg,  a finance company but whose life blood is mostly in the technology and we did talk about what tech shops look for in general.

The former companies don’t see technology as their life blood (developers are under traders,  bankers, …), even though they should. I mean if the systems fail, all hell would still break loose so you would think they hire good developers and keep them happy and productive. But most of the time it seems we are the first to get cut, the last to get any rewards, and have to deal with clunky systems and bureaucracy… They also hire a bunch of code monkeys (as my friend likes to put it) and domain experts, people "really good" at just one thing which they have been doing for many years. 

The majority though aren’t much of an expert…  just old. Doing something for many years does not automatically make you an expert or even good at it. Furthermore, do you really want someone who cannot keep up with the times or evaluate and adopt new technologies that are would increase efficiency or create new innovations?

Tech companies, again from what I've heard, understand that technology is their life, blood and they need their systems to work perfectly... 99.999% of the time... and at a much larger scale. 

The systems I work on are tiny and with users who have no better options (we’re a mini monopoly).  How many users does Google handle per second? And how much competition do they have?

In addition, they innovate like crazy…  code monkeys do not innovate… For innovation, you need engineers, who are unhindered by constant bureaucracy (we have a lot of that, takes forever to get things done). And at that scale, they better know how to optimize like crazy too (algorithms and data structures). 

...so if I want to fall into the 2nd group, I’ve got my work cut out for me. I don’t think I am a code monkey, as I constantly look for ways to improve our systems (using new technologies) and fix inefficiencies when I see them. But currently without Algo. and DS, I cannot think at their scale, where tiny inefficiencies that I may overlook, become huge problems... 

As I told the interviewer: at the scale I work at… list.Sort() is good enough… at a tech companies it rarely is.

But there may be another element: the subjects also provide building blocks and frameworks that may be very helpful for creating new technology.

I think I am pretty good at making  1 + 1 > 10… An engineer with his knowledge can make  1 + 1 > 100 or maybe  1,000,000….


Friday, February 13, 2015

Regex Non-Greedy Matching

Yea... it's been awhile and apologies. Lately been overloaded with work that I'm just too tired at the end of the day...

Anyway this is going to be short post and more of a note to myself. Needed to do some regex in order to remove the [] sections from a string like this: ab[123]cde[456]fgh

\[.*\] gives me abfgh

To get a non-greedy match, you need to append ? after .* so:

\[.*?\] yields abcdefgh

Saturday, January 17, 2015

I'm Long Term Lazy

Apparently my managers are very happy this year with my performance and what I accomplished.

At the start of the year, I pretty much got full development ownership of several projects... and well there were lot's of issues. Over the year, I proposed and implemented several improvements (among many other tasks) including: automated build and deployment, automated (integration) testing, and application and procedures documentation.

Now the overall benefits are greater stability (less PROD issues), smaller iterations, faster turnaround, and clearer understanding of code... but to be honest, all I really considered was: What's in it for me? how will it make my job easier? How much will it cost me (in effort)?

I think many people under pressure or time constraints just think how can I fix the immediate issue?

While the most immediate and simple solution may work really well, often it's just a quick fix and if you don't do anything else, it will may come back in the distant future as a bigger problem.

My approach is... OK immediate issue fixed, now how do I make sure I never have to deal with this problem ever again or at least greatly reduce the likelihood that I will.

And usually the answer involves all those great benefits that my managers seem to like :)

See... short-term lazy people cut corners and then it usually comes back to bite them with bigger problems.

Long-term lazy people know duct-tape solutions lead to bigger problems and there for invest more time and thought on how to make sure the solution is mostly future-proof.

I'd rather spend 2 days figuring out how to automate our builds, rather than spending 1 day a week (or month) just on packaging and deploying programs.

Or I'd rather spend a week thinking about good design, implementation, and testing out prototypes, instead of 2 days a week putting out Production fires caused by lousy design.

And it's not just time, because usually the longer option is also much more boring.

Sunday, January 11, 2015

Shortcuts and Best Practices

Sometimes you think you don't need to follow Best Practices and that your situation is unique and different.... And that you're the best to judge right since you know the specifics of your current situation right?

... Not quite because most situations change so more often than not, taking that shortcut is going to hurt more than the extra few minutes it would've taken to implement according to best practices.

Trust me... I know... (Below are some personal examples.)

Getters and Setters 

When I first used Getters and Setters in Java, I always wondered why we needed write out the functions specifically, instead of like in C# where you could just use something like:

public string Name {get; set;}

At first, I actually didn't even know why we did this. Why not just use a public variable? Well you quickly realize making everything public is a very bad idea. When an object's field is changed by another object, usually it would like to know about it or have some say in what it can be changed to.

(It also saves you a lot of trouble if the underlying data type changes from like an int to a string, becomes a composite of multiple other values.)

But anyway... why would I ever need to implement it like as below?

Java
private String name;
public void setName(String value)
{
     name = value;
}

public String getName()
{
     return name;
}

Or slightly better

C# (Slightly easier)

private string name;
public string Name
{
    get
    {
         return name;
    }
    set
    {
         name = value;
    }
}


Why does Java make you write you to write it out? It does two things:

  • It shows you how Properties actually work; C# is just automatically creating it when it's compiled (this understanding also helps you realize what a struct backing field is and why you get the related error)
  • It will save you a minor inconvenience in the future where you need to add some validation logic or raise an event... like for INotifyPropertyChanged

Variable Naming

Early in my career and as a hobbyist, I would usually create some local variables for some calculation or formatting logic. But I used vague names for them as, at the time, they seemed trivial or temporary.

The keyword is seemed but as the surrounding code grew longer, very often it became less trivial: having a variable used like 5 times in some loop that spans over 50 lines of code makes it... not trivial.

Anyway, it saved me a few second at the time, but then months later there is an issue... you go back to the code and you cannot recall at all what this variable (or the function) is supposed to be used for.

If you're lucky you may be able to walk through it and figure it out... after like an hour.

Nowadays names are cheap and with code hinting, not very hard to type out. Use descriptive names and also comment when needed, because while they may not look so nice... they're really cheap.

Using x,y instead of row, col may make you feel smart until you spend 10 minutes trying to figure out if your incrementing a row or column (and sometimes like for an Excel output... that kind of matters... a lot).

Unit Testing

I work on existing systems, designed not by me. Test-ability was never considered and not a core part of the applications' designs (which also I think contributed to how messy and tightly coupled everything was).

Anyway, because we don't have tests for every possible usage, it is now extremely difficult to make core logic changes. One of the things I am doing this year is figuring out test cases from our usage data and creating automated tests that give us 100% certainty that any change does not alter existing behavior.

Another shortcut that now causes a lot more pain and issues... than it should.

Conclusion

The general thing about shortcuts is that you really need to think about and be able to predict whether or not the shortcut is worth it. For a small application, you can see far ahead and be pretty sure, and the cost of changing it is very low.

For a large and/or critical application or component, I've learned the hard way, from my own coding and from cleaning up other people's messes, that it is just better to not take the shortcut in the first place.

ALWAYS follow best practices, unless you are literally 150% sure the shortcut is worth it.







Software Development Heuristics

While my core strength is C#,  I've worked in so many languages and on various levels  (of the stack) that I've picked up many tools,  paradigms,  best practices, and  other bits of knowledge and experience.

I'm not sure if I would be considered a full-stack developer,  generalist or something else, but whatever you call, I've found that these bits of knowledge are what really makes a difference, especially when tackling new problems or issues. Particularly when things come together such as:

  • Experience and confidence in searching for existing solutions
  • Ability to evaluate choices and utilize the appropriate frameworks, because of similar situations in other languages or projects such that you can foresee future issues or outcomes
  • And most of all when small bits a pieces of information literally come together and leads you to an elegant new solution either by guiding your thought process or in an actual AHA! moment (I do a lot of the former; have had some of the latter, usually after thinking about a problem all day and just when I'm about to fall asleep)
You could call it experience but I think it's a bit different:
  • Being really good at one specific thing would not yield this result
  • It's more like being decently or really good at one or a few things BUT also have a some knowledge of a bit of everything else, which guides you in analyzing new problems, AND the ability to look further when needed to evaluate potential solutions or ideas

I suppose it would be more of an entrepreneurial mindset as that's where innovations come from: very often it's taking multiple existing ideas and putting them together and then adding something else.

For me particularly, it started by learning different languages and programming approaches from functional programming, to MVC/MVVM, JSON syntax, Java anonymous classes, etc.

Coupled with constantly being faced with similar issues and needing similar solutions, those experiences led to learning design patterns. And other experiences led to my explorations in testing and mocking frameworks.

But all along the way you may collect these bits of knowledge, which you may quickly forget the specifics because of non-use, but at least the general ideas and key concepts remain, and that makes a huge difference. They are what I would call heuristics.

They guide you when analyzing problems because you now know what is possible and you have more options to choose from. More importantly, you can quickly evaluate new and similar options and your past experiences will produce questions that should be answered. Or something like, Hmm... MVC might be useful here; I'm a bit fuzzy on it but I should look into this instead of just going ahead and start writing code.

A lot of times now when given a new problem, I find myself thinking at this higher level: I need to do  A,  B,  C.  What tools should I use to best accomplish these or where should start looking for the most appropriate solution? Do I write my own code or can I not reinvent most of the wheel?

I guess it's not restricted to programmers and is basically what you would call an expert: you know things and you can  put them together to come to conclusions in a variety of new situations.

My broad background helps me look for solutions in some creative places or when given something new,  a general framework of questions to figure out what to do.

And I guess it's also a productivity thing too: you are basically building on previous knowledge,  so you don't have to start from scratch each time. This makes you a much more efficient and versatile developer.

Friday, January 2, 2015

Using Anonymous Functions in C#

Recently started using a lot more anonymous functions in C#... probably due to JavaScript and Java's influence.

The first caveat with anonymous functions though is that they cannot be debugged. The whole block is basically a single command, you cannot step in while debugging.

I think that is also true in the other languages as well and related to how it's compiled.

So generally I would recommend you keep the functions in them small and simple, such as simple sorting or transformation logic.

You can replace any delegate parameter (including Predicate, Action, or Func, basically anything that wants a reference to a function) which an anonymous function.

For the 3 "special" types:

  • An Action again takes in 0 or more parameters and does something, returning no value.
  • A Func takes 0 or more parameters and returns 1 values.
  • A Predicate is a Func that usually returns -1, 0, 1 which defines the order between two input parameters.

http://stackoverflow.com/questions/4317479/func-vs-action-vs-predicate

If the anonymous function takes 0 parameters, you can pass it:

() => DoAction(someParameterInTheCallingFunction);

Sorry... can't remember a specific example... but it usually involves creating function calls which will be executed by another object that doesn't expect to pass it's own parameter values.

Or a you could define a block of code. I don't recommend this unless the block is small and pretty simple; the likelihood of debugging very close to 0.

() =>
{


}


If not, you can create a separate function matching the delegate signature and pass the function name as  the parameter itself:

MethodThatAcceptsFunc(DoSomething)

If you do that, you can debug the elements in the method body.

If the delegate accepts one or more multiple parameters like Func<object, int, int, int>

Use (int1, int2, int3) => return DoSomething(int1,int2,int3));

The signature for DoSomething would be object DoSomething(int a, int b, int c) and again you could just pass in the method directly.


Android Phone Keeps Rebooting When Powering Off

I've noticed a few times that when I try to turn off the phone with the Shut Down button, it restarts instead. I'm guessing there's some software bug which may or may not be related to my rooting the phone.

The reason I need to shutdown is because either because I'm low on power and I need to save what's left or it doesn't charge when plugged in... 

Usually, the "Power Off" command doesn't work so I would take out the battery, forcing it off. However, I have to take the phone out of the case and even then it's not the easiest thing to do when you're standing on a train (and you need to turn it off to save whatever power is remaining).

Well if you're rooted, you can restart into BootLoader (precise steps vary, but CyanogenMod has an Advanced Reboot menu where I can just tell it to restart into BootLoader). Once rebooted, one of the options is "Power Off". Selecting that seems to do it... which also suggests it's an OS related issue.