Back from the dead… WordPress blogging tip for coders – Code Excerpts.

So a while back i stopped blogging, of course very few would know that since no one reads this blog.  Well the good news is I am back!

I recently transitioned from Windows to my arch nemesis Apple.  In doing so I cam across all kinds of things I should have blogged about but I never did.  One thing that had been keeping me from bloging was I lost windows Live Writer.  Which was the best blogging tool I have ever used.  So simple, and so functional.  Its a Microsoft product so obv. its not supported on a Mac so inorder to blog I needed an easy way to post code snippets…

This blog is dedicated to helping coders out there use the lovely TinyMCE editor that is built into wordpress.com.  I was looking for something to assist me in posting code snippets, and failed miserably… couldn’t find any one out that had explained what I am about to explain to you.  Everything you need to do snippets is built into wordpress… you just needed to find this lovely post on WordPress GIST.

I just spent 185 words to show you  10 lines of code.  Steps are pretty simple… go to gist.github.com create your code blurb.  Then all you need to do is embed in your markup:

(I just used a gist to show you how to use a gist….) Where the URL is from the gist you saved.  Voila!

class Nick:
def hi():
pass
view raw gistfile1.py hosted with ❤ by GitHub

A simple way to post code to blogs.   Hope this helps, it defiantly helped me get back into blogging again.

Tagged with: , ,
Posted in General, Microsoft, Programming

Microsoft Bluetooth Notebook Mouse 5000 won’t re-pair

Ran into an issue yesterday when my mouse randomly wouldn’t “connect.” It showed up the in the device manager but never would actually work. 

 

 

One issue I saw was there were no “hardware” device functions listed if I right clicked and went to properties on the device… this was a red flag so I started messing around.

 

2 hours later I finally fixed it. 

 

Try this first:

1.  Remove the device from Control Panel\Hardware and Sound\Devices and Printers.

2.  Click the connect button on the mouse (you should see the lights alternating flashing green/red.

3.  Inside of Devices and Printers click add device.

image

4.  Right click the “Microsoft Bluetooth Notebook Mouse 5000” option and click properties.

5.  Under bluetooth services check ”Drivers for keyboard, mice, etc (HID)”

image

6.  Click Okay

7.  You should see a “Installing Driver Device Software” notification window.

image

8.  In device manager you will now see the device with a  clock on it.

image

9.  After about 30 seconds you should get a popup that says Bluetooth HID successfully installed, and then in Devices and Printers the little clock is gone and you have mouse access!

 

So if the above didn’t work don’t worry you can still do it.  The first step is to take control of the existing mouse driver.

1.  As administrator navigate to C:\Windows\System32\Drivers. 

2.  Find the mouclass.sys file and right click and select properties.

3.  Change to the security tab, and click “Advanced” button.

4. Click Owner, then Edit button.

5. Select your user, and hit okay, and okay again, and okay one more time.  You should be back on the security tab.

6.  Under security, select edit and remove all permissions for System and TrustedInstaller.  You can do this by clicking the “Deny” Full Control box.

7.  Now try to reinstall the mouse as above, but this time you will see an exclamation point. On the mouse, once you see this go and delete the mouclass.sys file, and hit trouble shoot.  It will say something about missing driver, just hit okay a couple times, and you will be up and running!

Tagged with: , , , ,
Posted in General, Microsoft

QPID Python API – Careful with your content…

Just wanted to throw out something that to me wasn’t obvious.

We ran into an issue today where  our send was crashing.  Nothing crazy about the code something like

message = Message()
message.subject = "headache"
message.content = message_content
sender.send(message)

And then we crashed… :

UnicodeDecodeError: ‘utf8’ codec can’t decode byte 0xb6 in position 31: invalid start byte

What most people would ask would be.. well what is your content?  It was a string, but it was a unicode string and the api handles those differently.  So set message_content to:

message_content=u'Et tu brute?'

And your test will crash.  Basically this issue generally isn’t experienced because people use the content and subject arguments of the Message() constructor

message = Message(content=u'Et tu brute?')

When you do this, it will "infer" the content_type from the content provided.  It just happens that for regular strings it will set the content_type to None.  If we would have passed our content to the constructor it would have set the content_type to "text/plain" because the content is a unicode string.

So in our example above we needed to do:

message = Message()
message.subject = "headache"
message.content = message_content
message.content_type="text/plain"
#or we could do getType(message.content) its inside of the messaging module
sender.send(message)
#no crash.

To me this is an annoyance, esp when dealing with strings in python…  just wanted to throw it out there before someone else experiences the same issue I have.

A final note is when printing messages

message = Message()
message.subject = "headache"
message.content = message_content
print message
message.content_type="text/plain"
print message

Prints out something like:

>  Message(subject=’headache’, content_type=None, content=u’secret content’)

>  Message(subject=’headache’, content=u’secret content’)

Notice that there is a "content_type" property in the first, and not the second… why you might ask?  Well it only prints out the content_type IF your content_type DOESN’T match your content….  I did not know this until after this horrific finding but now that I know, this is a huge red flag, that something is wrong with your message.

Tagged with: ,
Posted in Python, Qpid

Verizon Customer Service and IT Continued…

Its no shock that my experience dealing with Verizon customer service ended with this survey:

Verizon_5

1.5 Hour earlier:

In attempt to access my DVR.. so i log onto http://www.verizon.com/ click some links and ultimately try to transition to http://verizon.com/fiostvcentral/.  You would think it would be simple?  But unfortunately their portal blows.  I log into verizon.com, click My Verizon Services –> TV-> MY TV , and I get redirected to https://auth.verizon.com/ssowebapp/logout.jsp?target=https://www36.verizon.com/fiostv/web/signin.aspx?msv=317

(the same thing happens when I log into http://verizon.com/fiostvcentral directly)

1 Hour earlier

I log into verizon support chat to talk about my issues.. well I can’t explain to the rep what sso is so I let her take control and try to “log in” herself.  She kept logging in and saying see it works!

image

Except the fact its just an Advertisement “portal” screen… as soon as i click anything it crashes…

image

She kept trying to log in, at one point she tried to clear my “browsing history" not the actual cookies or objects, just the sites i had visited.. that surprisingly didn’t work.. after the 10th time attempting to log into the FiosTvCentral Site…

1 Hour later.. (I give up…)

Verizon_1 Verizon_2

Head explodes.. (but i was right..)

Verizon_3  Verizon_4

 

Unfortunately Someswara will not meet her goal, because I love Verizon’s service, but I can’t recommend putting anyone through the process of signing up for Verizon, arranging them to install it, and then having to pay a bill. As I have said countless time, Verizon’s internal IT entropy is killing them..

 

For anyone that already has Fios installed, and has been through the pain and agony above I fully recommend you stay with Verizon…

Tagged with: , , , , ,
Posted in Amazement, General, Issues, Life, Verizon

Annoying Email Messages

Advertisement emails… we all get them, even though we uncheck that stupid box “Subscribe to Promotions.” 

image

But its time to stop ignoring them.  Think about all the time you spend managing emails that you don’t even read?  The process is generally open the email, close it.  Ah…. the email is now changed from Unread to Read… or the image is now image . Or we have to click a bunch of check boxes, and then select “mark as read”…

image

But its a small price to pay for a piece of mind…we will all sleep better now knowing that we have no unread mail.

 

There is a better way to go about this and its to actually open the mail… scroll all the way to the bottom and click “Unsubscribe.” By law they have to give you the opportunity to opt out.. but be careful.. there is a reason i am writing this blog…

 

Let me show you what I just went through with Bose…

Step 1.  Open the email, and scroll all the way to the bottom.

image

Step 2.  Click the “click here” link. If you can’t follow this step, please hit the backspace key…

Step 3.  A page will appear that is seemingly simple, just enter your email address and click “Unsubscribe.”

image

Step 4.  Voilà!  Done…. wait.. am I?

Step 5.  A new page will appear, with what you just typed in, click “Unsubscribe” again!

image

Voila!  Done!  This time it says:

image

 

The lesson to be learned, is to never stop until you see confirmation that whatever company has received your request to unsubscribe.  Bose knows that some people would have stopped after step 4.  Most people trust it will be a simple process, enter email, click button, done.

 

Take the time an unsubscribe from advertisements you don’t want….

Tagged with: , , ,
Posted in Amazement, General, Google, Issues, Life, Thoughts, Web Sites, World Wide Web

Verizon IT & Customer Support

Been really busy recently, so I haven’t had time to do some post, but luckly Verizon provided me with some inspiration.  So Verizon FIOS is amazing, I will not argue the fact that Verizon delivers an amazing product.  They do well when it comes to actually delivering something.  When it comes to organizational IT & customer service, in my opinion they are among the worst.  For the technical folks, just skip the the page break, unless you want to hear a quick rant…

 

So it all started one gloomy Tuesday when I came home after a long day of work, cut on the TV, and was greeted with a “This is not a technical issue, please contact XXX-XXX-XXXX and provide them with the reference code XYZ.”  Simple enough right?

NO.  I call the number, and can’t speak to someone.  You can ONLY* enter a code, so i enter the code.. and ring ring..

 

Hello, repair department..

Me:  Hi, I got this message it says… 

Repair Depo:  Sorry, that sounds like a billing issue, let me transfer you (20 mins on hold)

Billing Depo:  Hi who am I speaking with, how can I help you…

Me:  I got this message and it says..

Billing Depo:  Let me pull up your account, whats your number, verify, etc..  hmmm nothing is wrong with your account, it must be a technical issue, let me transfer you… (30 mins)

Tech Depo:  Hi how can I help you?

Me:  I got this message and it says..

Tech Depo:  What’s your name?  verify your phone number… hmm I am having trouble finding your account… what’s your address again?  Something is wrong here, it looks like your service was terminated, and a new one was setup today.  I need to transfer you to sales to sort this out…

 

Sale Dep:  How can I help you..?

Me:  I got this message and it says .. and I was told my service was canceled?

Sales Dep:  Who am I speaking with, verify phone number… yes I see that there was a disconnect ordered for this address, and a new connect.

Me:  Who ordered this?  I haven’t sent any request to change my account?

Sales Dep:  I can’t say, all i can say is there is new service at this account..

Me:  I live at that address… I have no service, you all have done something wrong.

 

So eventually we came to the conclusion that my neighbors decided to register their new service at my address, they sent a technician out, and re ran all the cables from my apartment to their apartment.  As soon as I found out this was an issue, I promptly responded switch it back!  They said sorry sir we can not do that with out speaking with the new tenants.  Really?  You did it to me… after 3 hours of speaking with various department I requested to talk to their retention department, and they transferred me to the “overrride” department.  I was then informed that they have to trust the customers calling requesting service.  If they say they live somewhere, then they have to believe them.  I then asked a logical question.. am I a customer ?  Why don’t you trust that I have not moved?   I finally just said fix it, if you need to change my address do it.  They then told me the next available time to get a person out was 3 days.  After some threatening to leave Verizon comments they said they would send someone out the next day.

 

Well they send someone out, but he never calls me to let me know he is at my house.  I get home Wednesday and still dont have service so I have to run the gauntlet again.  After 2 hours we find out the technician had the wrong number.. he called the new tenants, and they didnt’ answer.  Well, its ironic that they managed to get the wrong number because no numbers on my account have changed..  they then said it would be a week before they could send someone else out.  I politely said YOU ALL MESSED THIS UP, fix it tomrrow or cancel my service.  “If we send someone out again tomrrow, you better be there!,” I would have been there today if you would have called!

 

So I finally got my service restored, but had to call Verizon one final time because they sent me a double bill.  Needless to say they said “we know where the payments are” I guess that means I am ok?  Because they transferred me, and then inadvertently hung up on me.

Needless to say, Verizon needs some major help when it comes to Business Process, and Customer Service.

 

Read more ›

Tagged with: , , , ,
Posted in Cell Phones, Customer Service, Issues, Life, Thoughts, Verizon, World Wide Web

Interrupting your user

When designing user interfaces a lot of thought needs to go into when you are going to interrupt a user.  I am going to walk you through an example of what not to do.  My example deals with messing around with CSVs in excel.  I recently have been doing a lot of data loading via CSV and found myself getting consistently interupted by Excel when trying to save.  Pretty simple concept, once I have changed a document I should be able to click save ( yup thats it, nothing else.. pretty simple request huh?). 

 

Well take a walk with me…

Step 1.  Right click your desktop->new->Text Document

Step 2.  Change the name to Test.csv

Step 3.  Double Click Test.csv and it will open in Excel.

Now you will have an empty spreadsheet.  I am going to enter(| indicate next cell) : This | Is | A | Bad | UI | Interaction

 

Excel_CSV_PreSave

Step 4.  Click Save.

Kaboom.  Greeted with a Sound AND Messagebox:

Excel_CSV_ClickSave

So I dont understand?  I just entered text why is it complaining about tabs?  Oh well I want to Save my csv format… so i click yes.

Step 5. Click Yes

Step 6.  Close

I then go to close the workbook and am greeted with:

Excel_CSV_NoChanges_Close

Hmm.. I didn’t change anything so NO!

Step 7. Click No.

So lets open it back up and see what’s going on.

Step 8. Double click Test.csv

Excel_CSV_NoChanges_Close_ClickedNo

Really?  I guess that first warning was justified. Apparently, when I clicked yes to keep the format it meant, collapse into one cell and insert ? character…hmm.

Note: If you are on Windows 7 you might just see ThisIsABadUIInteraction either way it collapsed the text into one cell

Lets get out of here

Step 9.  Close

Excel_CSV_NoChanges_Close

GAH!  Again!

Step 10.  Click No

So now I am just going to take over, I am going to open up the raw text and fix the CSV myself. 

Step 11.  Edit text and place “,” between each word and remove the TABs.  Save and Close.

Excel_CSV_Fixing_WithVim

Step 12. Open this thing back up(in Excel).

Ah.. much better.

Step 13.  Add a new row

EXcel_Csv_Take2

Step 14.  Save (yes)

Here comes that warning again… click yes.

Excel_CSV_Changes_Y_SaveAs_Exist_Y_NonCompatx2 (1)

Step 15.  Close

Nooooo not again.  I don’t think I changed anything….

Excel_CSV_NoChanges_Close

Step 16.  Lets click yes for the fun of it…

Woah…. Save As?  Really?

Excel_CSV_Changes_Y_SaveAs

Well I don’t want to change the name… so I click

Step 17. Click Save

Noooo tooo many decisions…

 Excel_CSV_Changes_Y_SaveAs_Exists

Really?

Step 18.  Click Yes.

We have to be done right…?

Excel_CSV_Changes_Y_SaveAs_Exist_Y_NonCompatx2 (1)

Brain explodes… get a friend to click yes…

Step 19.  Click Yes.

 

FINALLY it closes.

 

So just take that for what its worth. There are really only 3 issues that reoccur that makes the process painful.   One if I open up a document and click save:  Save it, pretty simple.  Excel offers a “Save As” option, if i want to specify a different name or change the type I will select “Save As”.  Second, when its time to close prompt me to save changes (if I have actually changed anything) and then accept my answer and close.  In our situation it took 5 clicks to close… ?

 

Another thing I notices was the dialog that says “filename may contain features that are not compatible with ..(CSV or TAB).  What does that mean?  I didn’t do anything more than enter csv stuff.  I didn’t use formulas, charts, etc so what is it complaining about?  The first time I opened a CSV, it was completely empty.   But for some reason it decided it was a TAB delimited format?  Who knows.  Its almost like they are trying to scare you into the “lastest Excel format.”  Oh well, if you take anything away from this entry:

 

Americans are indecisive by nature, so don’t overwhelm  with unnecessary, and very word prompts.  Code to the things that the majority of people will want/need to do, and only interrupt people when it is completely necessary.

Tagged with: , , , , , ,
Posted in C#, Issues, Java, LinkedIn, Microsoft, Programming, Windows

.NET 4.0 Dynamic

There is a built in type now in .NET 4.0 called “dynamic.”  Just as its name implied its a lose type, it has an infinite amount of properties and methods…(reminds me of python)  This should not be confused with “var” which is a strongly typed lazy-man’s variable. 

 

Dynamic is whatever you want it to be quick example… 

 

The below code illustrates the use of dynamics.   I have declared a simple class that has two properties (Name and Description) and one method PrintUsingReflection…

 

using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Generic;
using System.Reflection;

namespace BlogTests
{
    public class Test
    {
        public string Name { get; set; }
        public string Description { get; set; }

        public void PrintUsingReflection(object test)
        {
            string name = test.GetType().GetProperty("Name")
			    .GetValue(test, null) as string;
            string Description = test.GetType()
			   .GetProperty("Description")
			   .GetValue(test, null) as string;

            Console.WriteLine("Hello there " 
			    + name + " description"
				+ Description);
        }
    }

    [TestClass()]
    public class DynamicExample
    {
        [TestMethod]
        public void ThisIsATest()
        {
            object test = new Test()
            {
                Name = "Nick",
                Description = "Nicks Dynamic Variable!"
            };

            PrintUsingDynamics(test);
        }

        private void PrintUsingDynamics(object test)
        {
            dynamic dynamicTest = test;
            Console.WriteLine("Hello there " + 
			   dynamicTest.Name + " description" +
			   dynamicTest.Description);
            dynamicTest.PrintUsingReflection(test);
        }
    }
}

 

Lets start with the test method called ThisIsATest()..

I am going to start by initializing a class called Test and then cast it to an object…

object test = new Test()
{
    Name = "Nick",
    Description = "Nicks Dynamic Variable!"
};
PrintUsingDynamics(test);

I then pass the object to PrintUsingDynamics() within the method you will see:

dynamic dynamicTest = test;
Console.WriteLine("Hello there " + dynamicTest.Name + " description" + dynamicTest.Description);

I take the provided object(which is really a “Test” class) and assign it to the “dynamicTest” variable.  At this point it is now a lose type…

In case you don’t believe me.. lets see what intellisense has to say about “dynamicTest.”

 

Dynamic_AutoComplete

 

Inside my Console.WriteLine i then attempt to access the Name and Description properties… then the black magic of dynamics takes over.  Volia! 

“Hello there Nick Nicks Dynamic Variable”.. displays. 

 

Back in the day we would have had to have done some really code heavy reflection:

private void PrintUsingReflection(object test)
{
    string name =  
	   test.GetType()
	     .GetProperty("Name")
		 .GetValue(test, null) as string;
    string Description =    
	   test.GetType()
	     .GetProperty("Description")
		 .GetValue(test, null) as string;

   Console.WriteLine("Hello there " + name  + 
                    " description" + Description);
}

Now if you look at the line after we print out "Hello there..” you will see dynamicTest.PrintUsingReflection(test);

dynamic dynamicTest = test;
Console.WriteLine("Hello there " + dynamicTest.Name + " description" + dynamicTest.Description);
dynamicTest.PrintUsingReflection(test);

Which is an example of accessing a “method” on a dynamic type.  At runtime the compiler crosses its fingers, and then calls the method PrintUsingReflection and hopes that the method exists… and volia!  Once again

“Hello there Nick Nicks Dynamic Variable”.. displays. 

 

This has been around for a while… but its incredibly useful!

 

Which one is easier (correct answer is dynamics)….?  The basic premise is whatever you type has to exist.. the compiler basically skips compile time checking.. and at runtime will resolve any property/method calls so be careful!

 

This comes in handy when doing things with “DataItems” that are anonymous types… avoids you having to create some type of “internal” type just so you can get to the data you need..

Tagged with: , , , , ,
Posted in C#, General, LinkedIn, Microsoft, Programming

Stumble….

Reached the end of the internet?  This site will help StumbleUpon.

 

I feel like this is a paid advertisement, I assure you it is not, but this is a pretty neat site that is basically a “pandora” for web sites.  You enter in the types of stuff you want to see…

Stumble_Preferences

Then click “Save Preferences..” then click  Stumble!

Stumble_Home 

It will then randomly choose a site for you for me it was (http://www.stumbleupon.com/stumbleupon.com/video.php?v=27aOpc)

Stumble_Funny_Or_Die

This time, it chose an amazingly funny video… notice the appearance of a toolbar there which gives you various options. 

Lets stumble one more time

Stumble_Mens_Health

This time it took me to a site in the  “Health” category…

 

A little about the usage of the site.. first its free!  All you have to do is register.

 

Stumble_ToolBar

1. Stumble (click it and it will take you to a new website)

2. I like it, basically says show me more like this.

3. Thumbs down, didn’t like this one… try not to show anything like this.

4.  Share options these allow you to post to facebook, twitter or email (icon or share button)

5. The drop down list that says All topics allows you to toggle between your categories.  So in stead of looking through everything maybe you want to see “News”

6.  Lastly is Conversational icon and that takes you to a site which shows you what users thought of whatever you were viewing.

 

On the far right side of the toolbar:

Stumble_ToolBar_right

You will see some additional icons. 

1. “’0 Favorites” takes you to your favorites page which is anything that you have given a “thumbs up”

2.  You have a home icon that takes you to stumbleupon.com

3.  Lastly the x is how you close the icon bar.

 

One final note is the globe SU icon above the house is the google chrome extension that will bring up the toolbar whenever you want.  Its useful if you want it you can install it here:

https://chrome.google.com/extensions/detail/kcahibnffhnnjcedflmchmokndkjnhpg

 

I have found it useful, esp. when i reached the end of the internet….

Tagged with:
Posted in Entertainment, General, Web Sites, World Wide Web

StackOverflow.com

StackOverflow.com is a community based Question and Answer site that is free and reliable. When people are having those completely random, inexplicable issues, while developing code and there is no solution in site this site is your savior. Unless you are coding in Cobalt or some other really rare environment you post a question, and within seconds will get some type of feedback. It’s been along for so long why am I blogging about it? Well recently, they finally released an api that allows for you to share your reputation as an image. For years they have allowed this, but it was javascript/iframe based which did not allow for embedding in public forums(most strip out the html markup).

 

Today I am happy to announce to you that this is no longer a limitation.

 

They now have an url friendly way to share your rep!

http://stackoverflow.com/users/flair/USER_ID_HERE.png

So why is this important to share with people?  Well SO is a reputation based site, so as you help other people you gain reputation.  Here is how the reputation works:

    answer is voted up:  +10

    question is voted up:  +5

    answer is accepted: +15 (+2 to acceptor)

    post is voted down: -2 (-1 to voter)

 

Reputation is not easy to come by, there are a lot of bored developers out there trolling the site just waiting for a question they can answer,and the community is not shy about down voting bad answers.  As a result the reputation you earned is well respected among software developers.

 

 

I recommend you getting involved in the site on both sides.  If you are having issues, ask questions.  If you are looking for some feedback on a design idea?  ask the question.  If you are doing something you aren’t quite sure is industry standard?  ask the question.

 

And when you don’t have any questions to answer, spend a couple minutes a day helping out others.  I guarantee the process of helping outers will increase the breadth and depth of your knowledge.

 

 

The creators of SO recently have expanded their sites to other areas most can be seen here ( http://stackexchange.com/) these sites range Administration (server issues),  Programming,  Food, Music, Gamming, so if software isn’t your thing.. maybe one of the other sites might make for a good hobby…

Tagged with: , , , ,
Posted in C#, General, Java, Linux, Microsoft, OS, Programming, Web Sites, Windows, World Wide Web