Lava Lamp

image

When i was a child, I used to drool over the things you could get for points in the back of Marvel comics.    One of them was a Lava lamp.

My coworker Mike offered one up as part of moving.  I snatched it up.  And I’ve.. been obsessing about it.

The result of my obsession:  using my iPhone 6 to do a Time-Lapse, with a lamp in the background providing additional lighting.   In 3 Instagram videos:

 

1. Lava Lamp Cooldown:  https://www.instagram.com/p/BOoAqRDDPmu/?taken-by=sunnywiz

When heat is removed, it very quickly loses convection.. stuff is still liquid, but doesn’t move as much.  As that cools, it seems to shrink a bit.  (Although, I don’t know that the water displacement changes … i didn’t think to check that).   A cat comes by to check things out later.

2. Lava Lamp Warmup Part 1:  https://www.instagram.com/p/BOoMoN4jf9N/?taken-by=sunnywiz

The liquid at the bottom builds pressure and pokes holes through the solids above it, causing some geysers and debris.   The video ends where you can see the whole mass melting a bit.

3. Lava Lamp Warmup Part 2: https://www.instagram.com/p/BOoMuwLjOss/?taken-by=sunnywiz

More and more of the wax melts and starts playing into convection.  Once you get convection, the melting process speeds up (I think).

 

Looks like the heating side of things is somewhere around 127F, and the tapered area (from the bulge up) is 106F all the way up – I think that’s why its tapered like that, so that the heat loss is distributed evenly?

a Rubiks Cube, a father, and a son.

Note the lowercase f and s.

My father showed me how to solve a Rubik’s cube.

There were many things sub-optimal, perhaps, about my nuclear family of origin; however, some things that went very well:

  • In the 1980’s, when the Rubiks’ Cube became a thing, lots of people were writing books on how to solve it.
  • Not a lot of Maths books though. My father (Sat Pal Gulati) always wanted to be famous, respected, known, and he decided to write a maths book about the maths of a Rubik’s cube.  This was probably 1984?
  • He showed me, by example / osmosis, his solution..
  • .. which gave me a mindfulness of patterns.
  • This mindfulness of patterns has helped me in my programming career and in life in general.

Or maybe, I was always prone to pattern-recognition, and this was one of the first ways my mind used that skill.

My father was never able to publish his book – he finished it, and I remember him working with some printers in India to get it published, but he only printed a few (100?) copies, and never got a distribution channel to sell it.  But he was very proud of it, I think.   I would love to get a copy of it, but I don’t think I can.

My son enjoyed playing with a Rubik’s cube.

I’ve shown off my Rad Rubik’s Skills every now and then – mind, I’m not a speed solver.  Best time so far has been 1:58, usually more like 3:00.  Mostly as a party trick, I don’t own a cube of my own at the moment.

At a family gathering, my wife’s sisters’s husband’s brother’s son had a cube – and it was a big topic of conversation for the evening.  I showed off my inner child’s skills (thank you dad).   Later in the evening, my son (who is now a young man, on his own, with a son of his own), picked up the cube.. and I could see his gears turning, his fingers ruminating.  My heart melted.

So, for Christmas

I am investing.

I am investing in the availability of patterns for young (and not quite as young) minds to grab on to.

I am investing in my inner child who loved this stuff.

There’s a beauty that I cannot describe in working with these kinds of puzzles.   Its the same beauty that I see in Maths that people either get, or their eyes glaze over.

Just waking up in bed this morning, my mind started playing with a 4x4x4 cube, and I realized how the solution is the same as the 2x2x2 – the inner edges are the same as an inner 2x2x2.

What’s this Pattern / Solution?

Jade asked about being able to solve it, and I’ve been thinking about it.   I think there are some realizations that add up:

  • First you have to be able to see the “edge” pieces from the “corner” pieces, and the relationship to the “center” pieces.   Pieces are not in place till all the colors match their respective centers.
  • Then, given you have a face that is already solved,  you can find two moves:
    • one move A will remove one piece from that solved face.
    • a different move B, to put that one piece back in the solved face.
    • your solved face is still solved.
    • Sorry, we’re going into Maths territory here by giving things names like A and B.
  • Then, you study the effects of A+B on the rest of the pieces
    • some pieces swap with each other
    • some pieces go for a 3-way swap with either other
    • sometimes pieces rotate in place.
  • Now think about mirrors.  So if you do a move on a left side, vs if you mirror it, and do it on the right side.
  • Now think about (A+B) + (A’ + B’)  (yeah, I had to jump into Maths.  I could make a video if someone asks)
    • Some things will cancel out
    • This ends up moving a few pieces with surgical precision.

I wrote the above before I found the links below .. its so much easier to show.

What Specifically did my father show me?

My father’s system has you solve the top face first, and then work on:

  • Bottom corners placement
  • Bottom corners rotation
  • Bottom edges
  • Mid edges placement
  • Edge rotation

Pattern 1: To position and rotate corners

Click on the bottom row of buttons to move the cube around, S to stop rotation, R to reset rotation.

  • A+B: https://rubiks3x3.com/algorithm/edit.html?moves=rDRDFdf
    • A = rDR moves the Yellow-Orange-Blue corner piece out
    • then move the YOB piece back in with B = DFdf
    • omitting a final d .. better for combining below
    • Yellow face stays unchanged
    • White Corners:
      • Red-Blue unchanged
      • Orange-Green and Orange-Blue 2-swap (with a rotate)
      • Red-Green rotate (rotations are always in pairs, the other part of this rotate was in the Orange-Blue)
    • Use this move to position corners, don’t worry about rotation.
  • A’+B’: https://rubiks3x3.com/algorithm/edit.html?moves=LdldfDF
    • Same as above, but mirrored.
    • Same effects, except a different piece rotates.
  • A + B + A’ + B’:    https://rubiks3x3.com/algorithm/edit.html?moves=rDRDFdfLdldfDF
    • The two front bottom (white + orange) corner pieces don’t move.
    • The two back bottom corners (white+red) rotate so that white ends up on the back.  Ie, whatever was on the L+R is now on the bottom.
    • Use this move to rotate corners.

Pattern 2: To move things from the middle to the bottom edges

Pattern 3: Moving Edge pieces around

Rotating the cube so that the offending middle pieces are.. well, you’ll see:

Pattern 4: Rotating Edge pieces

This one is so simple, yet .. amazing somehow.

And that’s it.  That’s all I had to remember to get the cube solved.

The same moves apply to solving the 2x2x2 – there are no edges.

And this morning I realized it would solve the 4x4x4, 5x5x5, etc, as well.

Thanks Dad.

Catch up Post – How to be a Grandpa

OMG! I haven’t posted in a while.. that’s probably because I switched over to my personal blog and released a bunch of emotion in political posts, which I felt did not belong here.

No Big. 

Okay, so what have I learned lately?   What have I tweaked lately?

  • I once again found a reason to write a mega-blog-post of all projects worked on.
  • Personally, I’ve been working on some code for tracking hierarchical todo’s; blog post to follow when i get reporting to work correctly. 
  • Workwise, on a WPF project, dealing with a fairly complicated screen, working against mocks of controls that are not available yet.
  • I got to create a pretty cool christmas card.  I’ll post it after it goes out..  I created a flowchart…

But most of my learning is happening here:

imageHow To Be a Grandpa

I did not have biological kids of my own, so this is my first experience at taking care of babies.

I have learned things like:

  • Different strategies for holding baby
    • support the neck is crucial, but after that there’s lots of options – the pin, the back-holder, the knee holder, the double handed neck buffer, etc.
  • Different strategies for burping baby.  
    • I like the over-the shoulder method most, but baby sometimes raises head up, so I have to stabilize between right hand and cheek, while left does the tapping. 
    • (the other method is in front, seated, with the baby facing to my right.)
  • Lots of baby songs.  Head/Shoulder/Knees/Toes
    • Spotify seems to have a very good selection of Kid’s stuff.
    • Amazon Prime Music has more repeats.
  • Diaper-changing.  
    • I’m still trying to perfect the vertical positioning, and the centering of the velcro on the front, without causing gastric distress.
    • There’s also the quick-shield skill .. baby loves to time things and gitcha with some surprises.
  • Bottle-feeding, and cleaning, and fixing.
  • That there are many different sizes of rectangular fabric, called by different names, used for different purposes.

I’ve also learned that as a mid-40’s person, I don’t have the resiliency I used to have regarding interrupted sleep patterns.  We take care of baby two nights a week, and one of those nights also translates into most of the next day. 

I’ve also learned that my wife, having been a single mom when she was raising her offspring, is frickin’ amazing.

I’m also discovering that there are many songs, which, while I may not play them for myself, I go back to to sing to the baby.  Because.. baby has NOT heard these songs.

Cheers!

Aftermath of an Election 2016

Been processing.  And .. here’s some interesting bits I’ve seen echoing.

CGP Grey Electoral College and other Voting System videos:

https://www.youtube.com/playlist?list=PLej2SlXPEd37YwwEY7mm0WyZ8cfB1TxXa   This is a playlist with 17 videos; #7 & #8 are the key ones, however, they’re all excellent sources on how the process works.

But the best bit was his update here:

[youtube=http://www.youtube.com/watch?v=zcZTTB10_Vo]
[UPDATED VERSION!] The Trouble With The Electoral College

Which leads us to The National Popular Vote initiative:

http://www.nationalpopularvote.com/  pasted from them, my emphasis added:

The National Popular Vote bill would guarantee the Presidency to the candidate who receives the most popular votes in the entire U.S. It has been enacted into law in 11 states with 165 electoral votes, and will take effect when enacted by states with 105 more. The bill has passed one chamber in 12 additional states with 96 electoral votes.  Most recently, the bill was passed by a bipartisan 40–16 vote in the Republican-controlled Arizona House, 28–18 in Republican-controlled Oklahoma Senate, 57–4 in Republican-controlled New York Senate, and 37–21 in Democratic-controlled Oregon House.

Link with graphic:  http://www.nationalpopularvote.com/written-explanation which has a lot more words.

And then there is FairVote:

http://www.fairvote.org/  which .. its not obvious, but its the STV system listed in Gray’s videos.  Or, better explained with a graphic:

image

This was a real ballot.  And Maine has now voted to make it state-wide.   Apparently they did that after a particularly horrible candidate got in due to the previous system.   Hopefully this system can grow to other states as well.

There is this note on violence:

[youtube=http://www.youtube.com/watch?v=abwc7AAXn3A]
A Breif, Personal Letter from America

A meaningful (for me) excerpt with my emphasis added:

“Not everyone who voted for Trump is a ___ … despite what filter bubbles would have you believe, uh, they’re not, but:  All the ___ voted for Trump.  And .. the trouble is that now the ____ think the country and the world agrees with them, so as it was with Brexit, the hatecrimes in the UK spiked, and .. no matter how many of his policies Trump actually gets to implement, that spike of intolerance, ____ is going to happen, and  I reckon its going to last longer.” 

I’m leaving out the word he used so that it doesn’t cause a stir; he didn’t mean it to cause a stir either.

The point being, the violence that will be broadcast… remember folks, its a bunch of deluded individuals.   I will hope that they are incorrect, and they will be relatively unsupported, and it will pass, as it did in the UK – its hard to find, but “The peak daily total between May and August was seen on 1 July, when 207 alleged race or religious hate crimes were recorded.” (http://www.independent.co.uk/news/uk/crime/brexit-hate-crimes-racism-eu-referendum-vote-attacks-increase-police-figures-official-a7358866.html)

How It Happened

This article is the best I’ve found on what happened:  http://www.cracked.com/blog/6-reasons-trumps-rise-that-no-one-talks-about/.  My takeaway is, there are people who have been ignored: Rural America.  And I don’t even like that word Rural there.  It almost sounds like “backward”.  What I mean is.. Small town, maybe?   I didn’t grow up there, but I have many friends who did.   And yeah, if they found somebody whom they resonated with, I could see the slight additional turnout on their side.

So, note to future leaders:  Please consider the needs of the non-city as well, as you go about your stuff.

OTOH, you can look at voter turnout (in k) – Registered, and Voted, and %:

image

(this is from an older version of the Wiki page:  https://en.wikipedia.org/w/index.php?title=Voter_turnout_in_the_United_States_presidential_elections&oldid=748821487 … the current one has no % for 2016 because numbers are still in flux.) 

And Neat Exit-Poll Breakdowns

http://college.usatoday.com/2016/11/09/how-we-voted-by-age-education-race-and-sexual-orientation/

(lots of cool charts)

Not Yet the Stage for a Woman President

My mom had an excellent point.  Even if H had won.. she would have been hamstrung by the republican controlled House and Senate.   And since everybody seems to blame the president for what everybody else does on their watch .. maybe not the most auspicious. 

And there’s the possibilities of change

https://assets.donaldjtrump.com/CONTRACT_FOR_THE_VOTER.pdf

Granted, likely none of the good stuff might happen.  However, term limits on Congress … I agree with that.    There’s a ton I don’t agree with, but there’s not a lot I can do about that, but that is one thing I do agree with.

However, reading through his 100 days thing – wow, yeah, terrifying.  Here’s a line by line analysis of the above:  http://www.npr.org/2016/11/10/501597652/fact-check-donald-trumps-first-100-days-action-plan

OTOH, maybe we need more pain before people can see the bigger picture.    Hope the planet survives.   And I hope people can see the bigger picture and not just scapegoat yet another thing.   Wait, I’m going negative, that’s not the intent here.

Ah well.    its going to be several interesting years.   

Hang in there folks.  And if you need a hug, just ask.  I give hugs freely, for all.  

Addendum:  reading up some “news” about the hate-speech going on ..  very sad.  Hate is so.. powerful an emotion.   So viral.  And to be on the receiving end of it .. to have that blanket of security ripped away from you .. it hurts.  I wish I knew how to love on people such that they didn’t need to hate anymore.

Voting 2016 (opinion)

I have a jumbled thread of stuff in my head, that .. maybe if I put it out as a post, I can clear my mind.   I would not normally make this post here; but as I think about it — this is definitely a good indicator of how I think.  This blog is about showcasing my strengths.  This is a strength.  So yes, I’ll post this here, and claim this part of myself as part of my public persona.

“Why are you always defending ____?”   asks my wife.  Resulted in a lot of internal conversation, which resulted in this post.   TLDR: I want to make gazoonkingly sure that I have opinions but don’t hate holders of the opposite opinion.  So I feed myself from both plates, make sure my emotions are stable, and then make a perspective choice, rather than an emotional one.

I don’t want to feed the craziness out there, I’d rather help bring unifying order.   Yet, I am not in control of other people.   However, someone I respect urged, if I don’t state my opinion, how can those who want to listen, listen?   Also hence this post.

As I expressed to a friend, if 51% of the country votes for Trump, even if I disagree am not in agreement with them, their group conscience has spoken.  If that does happen, I think it will be a spectacular 4 years, which will end in either “wow, we didn’t want to go here” unification, or, even more polarization.  At some point in time, with enough polarization, it might warrant a country-sized split.

My perception of Hillary

  • Takes lots of notes.
  • Listens very much.   Absorbs.  Understands.
  • Tries to find middle ground.
  • Very smart.
  • Well integrated into current system – for better or worse.
  • Does want to change things for the better, for such outcomes of better as are practical and possible.
  • Does not go for radical changes / that don’t have a high chance of success / unless personally held belief of moral ground makes this imperative.
  • Not inherently evil.
  • Very plugged in to surrounding system, and  thus any failures of that system could be laid at her feet, but that would also be incorrect.
  • Has to wear a large emotional protective barrier / thus can’t hang out, be personable, etc / unless you are allowed into her barrier / yielding the conflicting reports of “very warm” and “cold”.

The ickier perception.

How does one tell somebody, that I think they’re being take advantage of?    Maybe its not possible.  I’ll approach it from another angle.

That sets the background.   Then, enter this:

  • Ratings – http://www.people-press.org/2015/05/19/hillary-clinton-approval-timeline/
    • Specifically when she’s not running for something, its high, but if she’s applying for a job, [the spin cycle starts and] it dips low.   This was my first clue that maybe all the emotions that were being tapped about this candidate, might have been planted, and were not for warranted.  This is when I went looking for additional information to form my own opinion.

What I think is going on is, a pretty long-running campaign, that uses some cognitive viruses out there – tap on people’s emotions.  Once the emotions are tapped, folks’ minds close down.

There’s some reference to some of the .. crazy depths that this got to, here:  https://www.whitehouse.gov/the-press-office/2016/10/13/remarks-president-ohio-democratic-party-dinner  (search for: “political expedience”).

Interestingly, any time somebody wants to bring “logic/reasoning” etc in to talk about stuff, there’s a programmed defense that the virality goes for: Call them “IYI”, intellectual-yet-idiot.  If you google that phrase, fun times.

So, summary –

  • for political expedience
  • viral memes have been fed to media to feed to people
  • this worked well for media because “flashy” sells better than “sensible”
    • and they are a business that needs to make profits
  • viral memes lead to polarization and self-agreement cliques
  • emotions have taken over
  • that’s that.

At this point, only the folks with something to sell, would benefit in this system.   Discourse is right out the door.

Also at this point, for anybody in the middle of such a system to risk entertaining any new thought – would be to risk cultural rejection of the culture that surrounds them – and just won’t happen.   The backlash would be too hard.

How did I change my mind?

I started off in another camp – I had several soundbites in my head, of how horrible HC was.    I decided to abandon them, and go searching for pro-candidate information for all the candidates in question at the time, which were Bernie, HC, DT.   I also went looking for stuff on GJ, I didn’t get a chance to research JS at the time.

The best piece I found on HC was this one:

Note, I would have been pro-Bernie, but I think they made the right choice.    I think his platform was too radically different, and thus change would have been much harder.

I did go looking for stuff on DT.  I wanted to find something that showed him as intelligent, thoughtful, concerned.     I couldn’t find it – most of the stuff that I found was using virality and emotions to effectively do a sales job.    I would LOVE to have found something where he was in a business meeting being very intelligent and being a good leader and directing people in a way that brought them up – that’s the leadership style I prefer – and I am biased and this is about me – and I couldn’t find that.

GJ – I liked what he _said_ he represented, however, I found him too easy to excite.    And at times, he seemed, well, stoned.   So while I agree with him on many points, not sure that he would be effective.   His running mate, on the other hand – amazing and wow.   Wish he would run.

JS – recently anyway, I didn’t look her up earlier –  I found her to not have an in-depth understanding of the details of issues, kinda waving her hands in the air, broad gestures.   I don’t think she would be effective.

Pro-DT Culture

I have several friends who are voting for the T.     Here’s what I perceive about them – this is also a bit of creative rambling, me casting things onto them, that’s probably more a reflection on me than them:

  • Love family.  (100% of them)
  • Country Music.  (several; related to: love of family).
  • The world has to do with several stages, that you pass through, one after the other, nostalgia, emotions, but the “way” is effectively set, there is strength in that knowledge, the way things should be, ought to be, is known.
    • Pretty danged close to classic Asian-Indian culture, btw.
  • Trust the system, because the system is part of the stages.
  • Love that which is known, ignore the stuff outside of it.

None of them are overtly racist.  None of them overtly hate.    And if you don’t get them, then they’ll nod, sigh, wish you got them, and then they move on, with their world, and you don’t matter to them.

I love them, and I get to honor them.  That’s the world they live in.

There might be other Pro-DT folks who are, shall I say, edgier, but in general, I don’t know / maintain relationships with / people who hate.

Splitting the Vote

Why not vote GJ instead of HC if I don’t agree with DT?

I often see this diagram in my head on this subject:

image

https://flowingdata.com/2016/08/02/small-percentage-of-americans-actually-picked-clinton-and-trump/

Granted this is about the primaries, and I think turnout is higher for the actual election, but the idea is that, if everybody actually turned out and voted, it would be very easy to get an independent elected.  So vote your conscience, vote independent.      That would work for me, IF I didn’t think that HC had some merit.  However, I DO think she has merit.    So, I’m –10 about trump, probably an 8 about HC and maybe a 6 about GJ.  Lets say I was a 10 about GJ.    I’d rather do an STV vote, and put GJ first, then HC, and just not include DT, to make sure he NEVER got my vote.

But we’re not in STV.     And I do think HC is more fit for the job than GJ, assuming that there’s support in the congress / senate, which is another beast entirely.

Conclusion

I think that’s about it.   I don’t think this would convince anybody about anything.    I am one small vote in a large sea of votes, and this is approximately how I reasoned my way to where I’m at now.

I would hope that the country I choose to call home will go for listening, acknowledging, lifting people up, but also not enabling dependent behavior.

Making Educational Videos for Code Louisville

I volunteered to be a mentor for the latest session of CodeLouisville, on the .Net side.

No big deal, I thought.. and then, TreeHouse was unable to get their Entity Framework videos ready on time, so we, the mentors, volunteered to pick up the slack.

Naturally, I don’t do well when given an open ended problem, so I went into crazy-detail-mode.    I paid $15 for a 1-year subscription to https://screencast-o-matic.com/home  (VERY GOOD), and I started making videos.

And I ran out of steam.  Because, of course, I chose the slow, measured, one-thing-at-a-time approach, and I created far too much work for me to do myself.

Luckily, two other mentors suggested that we do X for our mentoring session – so if what I was doing was from top down, they were going bottom up.  Basically, show the fast way to create an MVC website, Code First, Scaffold, and let the students backtrack from there.

This worked VERY well.   It boot-kicked the students into effective land.  At least one of them showed me some working code in their project in the same week.

Lessons Learned

I am too. detail-oriented for my own good.

When in doubt, ask people what they need.

Sometimes, you just have to show the finished product and NOT explain everything, then go back and explain what is needed.   Its okay, people are resilient, they will survive Smile.

I like screencast-creation, but not more than a few hours a week: For a 20 minute screencast, it takes about 40 minutes of recording, about 2 hours of editing, another 20 minutes of rendering and uploading.   So basically plan on 4-5 hours for a 20 minute video on a topic.    Thus, I can probably sustain generating 10 minutes of educational content a week.

What Did I make

This is a walkthrough of LocalDB:   https://docs.google.com/document/d/1tTDKTQsfGPr_nFSbEifGQRc8dc-FfrxbPUfnc7CyKoc/edit?usp=sharing

This is a walkthrough of C# talking to SQL:  https://docs.google.com/document/d/1lSt-C5-L3VwLLGE6oJO3A_UOpIu2lYA-EWMhzAo-Ye0/edit?usp=sharing – it has links to 5 videos, and (eventually) links to code in github.

Unit Testing vs Integration Testing

Unit Testing

  • mock everything external to your code.
  • mock everything up to the thing to be tested
  • do some stuff
  • assert one thing.
  • Don’t continue a test – instead, mock up the environment to match the new thing to test, and write that in a new test, with a new assert.
  • Its cheap to run lots of tests
  • Its cheap to mock things.

Integration Testing

  • Its expensive to set up data
    • That’s a talk to itself, on how to do that in a sane repeatable way.
  • There is no mocking. Its real stuff, all the time.
  • Thus, when you achieve one milestone, your test (more like a “flow”) continues to the second milestone. Examples:
    • Upload, Pause, Continue Upload, Download, Pause, Continue Download
    • Upload, kill upload, Upload again
    • Upload, Download, kill Download, Download again.
    • Create item, edit item, rename/move item, delete item.
    • Its too expensive to try to get to a middle state, unlike mock-land.
  • Along the way, you print out “assessments” (to go with a AAA-style term) of where your test is at and what data its seeing.
    • ie, Arrange, and then
    • Act Assess Assert
    • Act Assess Assert
    • Act Assess Assert
  • In case of failure, you compare the log of the failed test with the log of a successful previous test to see what’s different.
  • The test can be VERY complicated – and LONG – and that’s fine. You only know the detail of the test while you are building it.
    • Once it goes green in a CI system, you forget the detail, until it fails.
    • If it does fail, you debug through the test to re-understand the test and inspect data along the way.
  • Expect flakiness
    • Sometimes things just fail. Example: locks placed on tables in PostGres for Unique in their UAT environment by some other process.
    • Sometimes things fail because of a reason
      • Somebody changed a schema.
      • Somebody deleted some key data
      • Some process crashed
      • Previous other test left behind data that FK locks the data you want to work with.
      • All these need human care and feeding and verification, its not “mathematically sound” like unit tests are.
    • Its a good idea to put an Assert.Ignore() if any failures happen during Arrange() section (ie, databases are down, file system full, etc – no longer a valid test. Not failed, but not valid, so ignored.
      • Can postpone this till a test starts to be flaky.
  • But when it works
    • you know that all the stuff is CORRECT in that environment.
    • And when it works in CI day after day after day, any failures = “somebody changed something unexpected” and needs to be looked at.
      • Fairly often its a shared DB, and somebody else changed schema in a way that you’re not yet accounting for.
      • Or somebody changed the defaults of something, and your test data that you’re hinging a test on has not been updated to match.

Which Ones To Use Where

  • Use Unit Tests to explore the boundaries and paths inherent in a piece of code.
    • Faster
    • Many of them
  • Use a single integration test (or just a few) to run through the code with all dependent systems
    • try to hit every SQL statement / external service at least once
    • If it worked, combined with all the unit tests, you’re probably good

SQLite for C#/SQL Developers

Current project uses sqlite3 for local storage of stuff for various reasons.  This was our first time working with it.  We’ve learned a few things that are not obvious.. coming from a SqlServer world —

Tooling

SQLite Expert for the win.  It has a chocolatey package as well, although that failed to install once for me (but worked twice.  Who knows).

Note that SQLite is multi-process-open-able; data inserted by your program shows up automatically in the Data tab in SQLite Expert.  However, if SQLite Expert has the .db3 file open, can’t delete it to scrub it clean.

All the same: varchar nvarchar and text

SQLite doesn’t care.   It has 5 types of “data” it can store, depending on what the data is.  Handy reference: http://www.tutorialspoint.com/sqlite/sqlite_data_types.htm.

So when we were doing “uniqueidentifier” it was actually doing BLOB under the hood.

Its entirely dependent on what you’re trying to store, as to what gets stored.   So you can store a string in an int field.   https://www.sqlite.org/faq.html#q3  — its a feature, not a bug.

GUIDs as binary, beware Endian.

Most programmatic forms of storing Guid data end up storing it as Binary/Blob.   You know its binary if you do:

select id, hex(id)

And you get two things that look about the same size in length, but are shuffled around:

{E589C188-2575-4AC6-BD41-A66A00A1AF22}

88C189E57525C64ABD41A66A00A1AF22

You might say “hey! bad Endian!”  but actually its Guid.ToByteArray() that’s doing the re-shuffling.

So, if you see the value {E589C1… in a grid result, and you want to select it, and you say

select .... where id=x'e589c1...'

That doesn’t work!  you have to give the bytes in the other order (as returned from hex(id)).

Foreign Keys Not On By Default from C#

This one was a shocker.  Its a pragma to turn foreign key checking on.  However, tools such as SQLite Expert do this automatically for you.

What we ended up with is a GetOpenDbConnection() call that did both .Open() and executed the pragma.

Logging Generated SQL from Dapper

A lot of this got figured out after we could see the SQL Generated by the various libraries we were working with. Turns out, that’s 2 statements after your connection is opened:

con.Flags |= SQLiteConnectionFlags.LogAll;
con.Trace += (o, e) => { Console.WriteLine("SQL: " + e.Statement); };

In Conclusion

These are the bombshells we’ve experienced over the last week.  Hopefully, all the bombshells are done with now.

Other than this learning curve — very solid, very fast, very nice.  2 Thumbs Up. Plus One. Heart It.

git rebase

I’ve never done a rebase before.  I figured today would be a good day to try it out.   It’s a simple case —

imageimage

From the client’s point of view, origin/master is ahead by one commit.   It happens to be a conflicting change.

In Tortoise (I’m starting out easy), I pick “Rebase”, and I’m saying I want to change my branch SG-EndToEndTest to be “re-based on” remote master.

image

  • Its showing me the list of commits that I’ve had, since I started my branch from wherever
  • Everything is picked.  Could choose to not-pick some stuff, leave it behind, like config file changes for local debugging.

I click “Start Rebase”.  It starts from the bottom of the list (ID=1) above and triest to re-apply the commits to the new root.   It runs into conflicts –

image

I right click on the conflict, edit it .. turns out TortoiseDiff doesn’t think it’s a conflict, I can easily mark it as resolved.  I have to do this twice, both in .csproj files.

When its done, its all still local – server’s not any different – but local shows:

image

  • The old commits are still there.
  • But they’ve been cloned and re-grafted onto a new source node, and the label has been moved.
  • If I had to, I could undo everything by force-moving SG-EndToEndTest to be based on ad1c.

If I now push up to the server – I get an error:

image

Instead, I have to push with –force (“may discard unknown changes”) (ie, “tell the server to do stuff where it discards changes that I, the client, know nothing about – JUST MOVE THE REF”)

image

Now the server looks like this:

image

That was my first, very simple, rebase (without squashing).

The pull request that I had open against that branch survived as well, and changed from “Cannot merge – conflicts” to “Can merge automatically”:

image

Goodbye to old code and dreams of immeasurable wealth

imageIn the Beginning

I would always hear about people who wrote simple pieces of software, who were in the right spot, at the right time, and their stuff got used and they became famous, and.. perhaps even rich. 

Every time I heard such a story, my baby tyrant would say: “I want that!  Lets DO that!”

To which my Fuddy-grownup would say, “Honey, you probably won’t become famous, and it probably won’t work out.  Are you sure?”

And the Couch-Buddy would say, “Ah, too much work.  Lets read some more facebook.”

I Made a Decision

I started coding this thing that I thought would be a good start of things.  It was an app to make reading twitter easier – less context switches.  It was also an experiment in using Azure, Visual Studio Online, and a little bit in starting bootstrap from scratch.

I got it working.

I started the code 7/26/2015, and by 9/22/2015 I was ready for the big time.   This was mostly an hour or two during a workweek in the evenings, and maybe an hour or two on a Sunday morning.

I had a logo created, bought a bootstrap style, I had added what I thought were the key features I needed, I rebranded it, and I bought a domain name.

image  image

I stopped.

And then life got complicated, and I let it sit – costing me monthly $, btw.  $17 per month to keep it hosted at the cheapest level I could get away with, AND have a domain name.  I used it for a while. 

Eventually, I got cheap, and work distributed a full MSDN license to me with an azure subscription, so I nuked it.

I’m letting it go.

Very recently, I put it back online under my MSDN license –  You can use it here:

http://twit-sort.azurewebsites.net/

I’ve cleaned up the code that I deployed, removed all the passwordly bits from it, and uploaded it to github.  Here’s the guts of it:

https://github.com/sunnywiz/twit-sort/blob/master/azuremvcapp1/Controllers/ReadController.cs

Letting go the dreams as well

I would have liked to have seen this thing become better.

  • I could have done a face lift on the front page.  Too many words.  Replace with screenshots of the configuration page and the read page.
  • I could have made it more colorful. Orange and Blue!  You can see this in the icon a bit.
  • I could have made it front-end js only, with no server side talking to twitter, using local-storage for persistence
  • I could have added “click hashtag or username” to create additional groupings on the fly.  delete groupings on the fly as well.

The good news is, all these dreams live on, in a future project – that works with Facebook, instead of Twitter

Conclusion

Letting this one go to make psychic room for other things that interest me.   May it bless others.  If you write a good one like this I’ll use it.