Category Archives: Just Rambling

Someone Masquerading as me on Indeed and LinkedIn

I have recently been contacted by multiple people who have been getting scam virtual assistant job offers on Indeed and LinkedIn from someone using the email address [email protected]. And they are attempting some standard scammy tasks like “here’s a check” (which is fake) ” please deposit it then transfer $ to [some weird place]”. Please don’t be taken in. It is not me. I don’t have accounts on any of those websites. Indeed.com has been alerted and have done something about that account. If you have been contacted by anyone like this, let me know.  And I’m so sorry. 🙁 

Accidental Learning

In my Pluralsight course, Automated Testing for Fraidy Cats Like Me (an introduction to Unit Testing and TDD), I presented a use case that required retrieving  the date of a person’s most recent tweet.

The process of accomplishing that and then completely reworking it again this morning, made me think some more about how we accumulate knowledge even when we don’t have the need or time to take on learning about a big topic.

I’ve learned a lot of things by accident and because I’m curious and something of a pit bull, these become detours to otherwise productive days.

If you follow me on twitter, you see the random, seemingly unrelated things that I’m constantly wrestling with. Here’s an example.

Many Moons Ago, I Had a Silly Idea

I started with a stub method that just returned a date but I wanted to make it a little more real. I ended up spending hours and hours on this, trying to figure out the non-authentication API call to get the data.

Finally I was able to come up with a way to do that:

https://api.twitter.com/1/statuses/user_timeline/julielerman.json?count=1

Note that this was using version 1 of the twitter API and did not require authentication so it was easy enough to use this in my sample.

Then I needed to call it. I wasn’t used to making web calls from outside of some type of web application. So it took me a while to realize that I needed to use System.Net.WebClient.WebClient to execute the call. And exactly what call I wanted to execute took some time to discover as well. Naturally. It turned out that I wanted to use the DownloadString method.

 

 var uri = new Uri("https://api.twitter.com/1/statuses/user_timeline/" + twitterAlias + ".json?count=1");
 var client = new WebClient();
 var result = client.DownloadString(uri);

So I finally have the tweet. It’s was as string …not pretty. And I had to parse it to get at the DateCreated. I did some more searching and came upon a library I’d heard of (always with accolades!) countless times but had never had the chance to use: JSON.NET.

A little more exploration helped me learn I could use the API’s JObject class to parse the string into a recognized object

const string constTwitterDateTemplate = "ddd MMM dd HH:mm:ss +ffff yyyy";

and then extract the property I wanted:

o["created_at"]

But that didn’t work because it turned out that twitter has it’s very own special way of representing a date. Uggh! Back to GoogleBing for quite some time and I finally came up with the format and then how the heck to transform that format into one that could be read by .NET.

const string constTwitterDateTemplate = "ddd MMM dd HH:mm:ss +ffff yyyy";
var createdAt = DateTime.ParseExact((string)o["created_at"], 
        constTwitterDateTemplate, new System.Globalization.CultureInfo("en-US"));

Finally! I had a System.DateTime I could use!

In the end, I had a handful of lines of code to do what I wanted

public DateTime LatestTweetDateAsUtc(string twitterAlias)
{
  var uri = new Uri("https://api.twitter.com/1/statuses/user_timeline/" + twitterAlias + ".json?count=1");
  var client = new WebClient();
  var result = client.DownloadString(uri);
  var jsonString = result.Replace("[", "").Replace("]", "");
  var o = JObject.Parse(jsonString);
  const string constTwitterDateTemplate = "ddd MMM dd HH:mm:ss +ffff yyyy";
  var createdAt = DateTime.ParseExact((string)o["created_at"], 
    constTwitterDateTemplate, new System.Globalization.CultureInfo("en-US"));
  return createdAt;
}

But it had taken me hours and hours and hours to get to this.

The upside is that I learned about JSON.NET and got a basic understanding of its use.

The date transformation is one of those esoteric things I will forget I’ve done and have to search on the web next time I find I need to use it…this could be years from now. And WebClient…that could come in handy but I don’t foresee a lot of use for the work I do.

Other than the long-overdue exposure to JSON.NET, it was a wasted afternoon.

6 Months Later, I Came Across a Better Way

What I hadn’t discovered was TweetSharp. Because the v1 Twitter API is now depracated, I have to use v1.1. But v1.1 requires EVERY CALL to be authenticated.

So I had to sign up for an application key (https://dev.twitter.com/apps).

Then I looked for some help with how to authenticate my app. The code was a nightmare. More learning curves.

Then I found TweetSharp.

Within 1/2 hr I had authentication set up and figured out how to get a users’s latest tweet. And the best part was TweetSharps Tweet class does the work of transforming the date to a DateTime for you. (Using JSON.NET and possibly code similar to mine. I get I can figure that out by looking at the code on github. 🙂 )

      var service = new TwitterService(_my_ConsumerKey_providedbytwitter, my_ConsumerSecret_providedbytwitter);       service.AuthenticateWith(my_Token_providedbytwitter,my_TokenSecret_providedbytwitter);       var user = service.GetUserProfileFor(
new GetUserProfileForOptions {ScreenName = "julielerman"});       var tweet = service.ListTweetsOnUserTimeline(
new ListTweetsOnUserTimelineOptions{ UserId = user.Id, Count = 1 }).FirstOrDefault();       DateTime thedate = tweet.CreatedDate;

So….for many, nothing new here.

A Lesson Bigger Than Just The Code

What’s more interesting to me than the actual solution is the process I went through. Getting that twitter date was just a made up scenario that I decided to pursue for my example. It stopped me in my tracks and I became consumed in solving it, not once but twice. First when I was building the course and second when I wanted to share *that* code and discovered the API no longer worked. It’s fun to learn new little things that don’t require you to read a whole book. So I now know enough to be dangerous about JSON.NET and about TweetSharp. However I’m well aware of my limitations.

It also interested me to consider how this process, repeated over the years, has resulted in my having a quiver filled with a slew of little bits of very useful, somewhat scattered, information. This is very different than learning a big topic, like testing or Entity Framework. However they are a starting point at which I can leverage the tool and make it work for me.

Which somehow ties back to my keynote at CodeStock this summer where I spoke about approaching big learning curves one small bit at a time. For example how I’m currently using and benefitting from pieces of Domain Driven Design even though I’m a long way from understanding or being expert at the *whole* thing. However my pursuit of DDD is hardly accidental! I’m working diligently to understand it and use it (and share what I’ve learned).

I’m not sure if I’ve wrapped up with anything useful here but I got what I was thinking about out of my head so I can get back to wrestling with my next topic!

The what-if brain: Social pariah for developers?

As developers and analysts, we spend a lot of time asking “what if?”.

What if the user enters too many characters into this data entry field?

What if the network hiccups during a database save?

What if users are allowed to delete the record for this consecutively numbered item and then another user worries about a missing item #?

The longer we have been coding or working with domain owners to plan software, the more problems we can anticipate and ask “what if” about. It’s a good thing.

But this “talent” has had an adverse impact on my personal life. I can’t turn off the “what-if” brain.

What if I gain too much speed on this icy ski slope and can’t stop and … and … . (This one freezes me at the top of the slope while my friends stand waiting for me lower down wondering WTF is wrong with me.)

What if the dog sees someone across the road and runs to greet them and there’s a car coming up the road but they don’t see him heading down the driveway? (Been there, done that. I watched one of my dogs get hit and killed by a car years ago.)

What if we did something wrong with the woodstove before we left the house?

What if I order this menu item but change my mind by the time it arrives at the table?

Most of the people in my life who aren’t part of my developer-friends circle just don’t understand this.

My husband just thinks I’m a ridiculous worrier.

I’m afraid that my friend’s children will learn to be afraid of more things because of me.

My neighbors think I’m a complete lunatic about Sampson or any of their dogs in the road.

I don’t have an answer for this. I’m not about to let my guard down in my software development or in my life. But I do tend to explain my little problem as a job hazard– that I just can’t turn off the “what-if” brain just because I’m not in front of the computer.

You?

Nathan Myhrvold, Microsoft Research founder, in The New Yorker

This week’s The New Yorker issue is focused on invention and there is a really fun read on Nathan Myhrvold, Intellectual Ventures, dinosaurs, Alexander Graham Bell and more called In the Air.

Having been on the nosy Lake Washington cruise which goes by his house, Gates’ and others, it was funny to read his wife describe their house as “the place in the sci-fi movie where the aliens live”.

The article is focused on the process of invention and highlights some of the amazing brainstorming sessions that Myhrvold has with IV participants (including Bill Gates) who’s goal is to patent 1000 new inventions a year. They are at about 500 /year now, dealing with everyting from medicine to nuclear fision.

DevTeach is coming to Toronto Ontario in just a few more weeks!

I COPIED THIS ENTIRE BLOG POST DIRECTLY FROM GUY BARRETTE’S BLOG and made one little edit! So shoot me! 🙂
 

If you’re living in Toronto and don’t attend DevTeach, [Guy Barrette says he’s] gonna beat you up and force you to code in Clipper for the rest of your life.  Seriously, DevTeach has one of the greatest speakers lineup of all the .NET conferences.

Honestly, where can you hear, see, talk to, describe your problems (IT/Dev related or not) and have a beer with these guys/gals?

Scott Bellware Benjamin Day Oren Eini Cathi Gero Barry Gervin The one and only Kate Gregory YAG The Zen of Scott Hanselman Moi Beth[mond] Massi Kevin MacNeish Roy Osherove Rodman Partyboy Palermo Paul [Yes, it's true. I live on a boat] Sherriff Joel Semeniuk Richard Campbell Peter DeBetta Don Kiely of the Alaska Keilys Bill Vaughn Adam Machanic Carl Franklin Rob Windsor Jim Duffy

And that’s only half of them!!!

Need more reasons?

Keynote by Scott Hanselman, Microsoft
Scott Hanselman is one of the most prolific, renowned and respected blogger (
http://www.hanselman.com) and podcaster (http://www.hanselminutes.com) about technologies. Scott is a hands-on thinker, a renowned speaker and writer. He has written a few books, most recently with Bill Evjen and Devin Rader on Professional ASP.NET. In July 2007, he joined Microsoft as a Senior Program Manager in the Developer Division. In his new role he’ll continue to explore and explain a broad portfolio of technologies, both inside and outside Microsoft. He aims to spread the good word about developing software, most often on the Microsoft stack. Before this he was the Chief Architect at Corillian Corporation, now a part of Checkfree, for 6+ years and before that he was a Principal Consultant at STEP Technology for nearly 7 years.
http://www.devteach.com/keynote.aspx

Silverlight 2.0 workshop
For the first time an independent conference is having a workshop on Building Business Applications with Silverlight 2.0.  Join Rod Paddock and Jim Duffy as they give you a head start down the road to developing business-oriented Rich Internet Applications (RIA) with Microsoft Silverlight 2.0. In case you just crawled out from under a rock, Microsoft Silverlight 2.0 is a cross-browser, cross-platform, and cross-device plug-in positioned to revolutionize the way next generation Rich Internet Applications are developed. Microsoft’s commitment to providing an extensive platform for developers and designers to collaborate on creating the next generation of RIAs is very clear and its name is Silverlight 2.0. In this intensive, full-day workshop, Rod and Jim will share their insight and experience building business applications with Silverlight 2.0 including a review of some of the Internet’s more visible Silverlight web applications. This workshop is happening on Friday May 16 at the Hilton Toronto.
http://www.devteach.com/PostConference.aspx#PreSP

Bonus session: .NET Rock host a panel May 14th at 18:00
This year the bonus session (Wednesday May 14 at 18:00) will be a panel of speakers debating the Future of .NET. Where is .NET going? How will new development influence .NET and be influenced by .NET? Join Carl Franklin and Richard Campbell from .NET Rocks as they moderate a discussion on the future directions of .NET. The panellists include individuals who have strong visions of the future of software development and the role that .NET can play in that future. Attend this session and bring your questions to get some insight into the potential future of .NET! This bonus session is free for everyone. Panelists are: Ted Neward,Oren Eini ,Scott Bellware
http://www.devteach.com/BonusSession.aspx

Party with Palermo, DevTeach Toronto Edition
Jeffrey Palermo (MVP) is hosting Monday May 12th in Toronto is acclaimed “Party with Palermo”. This is the official social event  kicking off DevTeach Toronto. The event is not just for the attendees of Toronto it’s  a free event for everyone. It’s a unique chance for the attendees, speakers and locals  to meet and talk with a free beer.   The event will be held at the Menage club  location and you need to RSVP to attend. Get all the details at this link:
http://www.partywithpalermo.com/

Make sure that DevTeach comes back to Toronto.  Register right now for this year’s conference.