Digijustin

Now New and Improved

April 16, 2012
by justin
0 comments

Real Time Stock Ticker for PHP

For the last week or so, I have been looking for a good real time stock ticker to put up on a client’s web site since their feed with Yahoo kept failing intermittently. About 30% of the time, it would return an error that read “Received Failure” which while amusing, the client didn’t want to have anything to do with it.

So I spent a few hours going to different sites to see if they had a feed and none would give me what I wanted. All I needed was the current price, value change, percentage change and time last updated. Seemed impossible. Then I had the idea to just scrape data from Google’s Financial site and the rest is history.

I found this PHP project called PHP Simple HTML DOM Parser and used it in my code. Super simple.

include('simple_html_dom.php');
$tickerCID = '22144'; //This is Apple (AAPL) ticker ID on Google
$stockSymbol = 'AAPL';
$html = file_get_html('https://www.google.com/finance?q=NASDAQ:' . $stockSymbol);
$price = $html->find('span[id=ref_' . $tickerCID . '_l]', 0);
$lasttrade = $price->plaintext;
$spanChange = $html->find('span[id=ref_' . $tickerCID . '_c]', 0);
$change = $spanChange->plaintext;
$spanPercChange = $html->find('span[id=ref_' . $tickerCID . '_cp]', 0);
$percChange = $spanPercChange->plaintext;
$rightNowDate = date("M j");
$quoteTime = $html->find('span[id=ref_' . $tickerCID . '_ltt]', 0);
$rightNow = $rightNowDate . ' ' . $quoteTime->plaintext;

Then when I need to access that data, I just have this DIV in the body:

NASDAQ: AAPL

$      

It was that easy once I got the hang of it. Hope this can help someone with the same crap I had to go through.

September 12, 2011
by justin
0 comments

Social Media vs. Newspapers

These days you can’t really go anywhere without hearing of Twitter, Facebook or some form of social media. It’s everywhere and the reason is, because it’s instant and easy. What you aren’t hearing about as much is newspapers.

Newspapers used to be the only game in town and then TV but newspapers still had their place. Well in today’s “I need the news RIGHT THIS SECOND“, newspapers have been pushed out of the way but social media platforms like Twitter and Facebook.

I stumbled across this article from the The Independent in the UK about how people are moving away from traditional ways of getting news and moving more towards alternative means such as social media and various online resources. People, myself included, don’t have time to wait around for tomorrow morning to find out the news of today.

Some people say that they still get the daily paper for the coupons it comes with. Nowadays, you can type in “PRODUCT promo code” and get a multitude of deals on whatever you want. Plus Amazon is still pretty cheap if you’re okay with not going to a store to pick something up. Also, with the advent of Groupon, LivingSocial and other group couponing sites, this will only get better with time and further push the papers out.

Classifieds have moved aside for Craigslist and blogs have taken the place of Editorials. These are just more reasons why there really isn’t a need for newspapers any more other to cover my table with when my kids paint.

What do you think?

January 11, 2011
by justin
1 Comment

A Match Made in Heaven – iPhone and Verizon. Or is it?

So later today, it’s widely expected that Verizon and Apple will finally team up and deliver the iPhone to Verizon. This is something that it seems everyone has been begging for since the iPhone was first released on AT&T. I have read several articles and the pros and cons about hopping on this bandwagon.

I’m excited that the iPhone is moving to another carrier. I think that this will be good for it. At the same time, it might be its downfall too. The main problem people have with the iPhone isn’t the device at all, it’s the carrier. While I am guilty for not going to AT&T solely based on what I’ve heard about their network, it might not be all their fault.

Think of it like this: there are so many phones consuming a ton of data and clogging the “tubes” so that their network is straining under the weight of its own success. I kinda think that Verizon will have some of the same issues although I’m sure they have known for a while this is coming and have adjusted their network in advance. At least I hope.

I recently moved from T-Mobile to Verizon and have a Droid X and I love it. I am curious to see if an influx of new users will slow down my connection and reduce my call quality.

Overall I think it’s a great move for Apple as now they have 2 carriers printing money for them. I do think that some of the issues with AT&T will show up with Verizon but only time will tell.

December 8, 2010
by justin
1 Comment

Why Can’t I Figure Out Facebook?

Okay it’s not that bad but I lately I have had the opportunity to get back into working with Facebook in several projects over the past few months. The good thing is that I’ve been able to work in almost all the ways you can interact with Facebook. I have worked on an external site using Connect and the Graph API, a page tab and a canvas page.

The bad part of doing things this way is that they are all done in 3 totally different ways. Just when I feel I’m doing well with one, another will come up and throw me in another direction. Good thing with that is that I’m getting the experience to figure all 3 methods out. Just with client timelines, it makes it fun when the same end functionality has very different implementation and I don’t have the time to make it perfect.

I do plan on posting some of my findings because I’ve personally had a tough time finding all the information I need online. Hopefully I’ll get a break in the action soon so that I can share.

August 2, 2010
by justin
0 comments

New Fun Inside of Facebook’s C# SDK

Two weeks ago Facebook released their own C# SDK for developers to use. I downloaded it right off the bat but noticed that it had a few holes in it but did give a clean way to call their new Graph API.

One of the most glaring issues was that it can’t authenticate fully. I looked all over Google for it and finally found out that it’s an issue with the cookie that Facebook itself writes. The first key in the cookie is access_token and that passes the token from Facebook that allows you to make calls on behalf of the logged in user. Well the cookie’s value itself is one big string wrapped inside of quotation marks so the key is “access_token rather than access_token. This caused some hairpulling on my part but now that it is coded for it, it is working like a charm.

So the code should read like this if you’re using C#:

GetFacebookCookieValue(""access_token")

Hope that helps anyone who ran into that as I did.

August 2, 2010
by justin
0 comments

New Fun Inside of Facebook's C# SDK

Two weeks ago Facebook released their own C# SDK for developers to use. I downloaded it right off the bat but noticed that it had a few holes in it but did give a clean way to call their new Graph API.

One of the most glaring issues was that it can’t authenticate fully. I looked all over Google for it and finally found out that it’s an issue with the cookie that Facebook itself writes. The first key in the cookie is access_token and that passes the token from Facebook that allows you to make calls on behalf of the logged in user. Well the cookie’s value itself is one big string wrapped inside of quotation marks so the key is “access_token rather than access_token. This caused some hairpulling on my part but now that it is coded for it, it is working like a charm.

So the code should read like this if you’re using C#:

GetFacebookCookieValue("\"access_token")

Hope that helps anyone who ran into that as I did.

June 9, 2010
by justin
1 Comment

Changes

I recently decided that a change was in order and decided to leave my position at Cramer-Krasselt to join the team at Nomadic. They are doing a ton of stuff that I feel that I can be an asset for and honestly, it’s pretty cool too.

I’ll miss all my co-workers at CK but I am moving onto new challenges and opportunities.

March 29, 2010
by justin
0 comments

Good Service vs GoDaddy’s Service

A few days ago I was working on a project for a client here at work. I had a situation where I just needed to create a simple web service that made a call to ExactTarget’s API. Was pretty easy and had it working flawlessly on my local computer within a couple of hours. I pushed it up to our site on GoDaddy to test and received an error. I found out that there is an assembly that the ExactTarget code needs to work and that it needed to run with elevated trust. Well apparently GoDaddy doesn’t allow for that.

So in my nerd rage, I posted to Twitter that I was upset:

Is @GoDaddy really an ASP.NET host or do they pretend to be? Anything I try to do mildly difficult, their shared hosting fails on.

I had seen that GoDaddy was pretty quick on their responses that day but not with my message. The next day, I did receive a message from them asking what my issue/question was and I promptly responded. I still haven’t heard back.

But what was interesting to me about this was that not long after my response to GoDaddy, I received a message from WinHost:

@digijustin What was it that GoDaddy had issues with doing?

I was pretty impressed and responded quickly and they even responded back saying that they could in fact do with GoDaddy couldn’t. Cool. Score one for them and hang another zero for GoDaddy.

Right after my response to WinHost, I received another Tweet. This time from DiscountASP to tell me that they too support what I was trying to do.

I was really impressed with these 2 hosts that they would jump in to help me out while GoDaddy left me hanging. I didn’t end up needing a Windows solution as the PHP option I was chasing ended up working but still time after time, GoDaddy fails me every time I try to do something that deviates from easy.

Next time I need a Windows host, I will have an easier time looking in the direction of WinHost and DiscountASP before I even think about GoDaddy.

 

March 29, 2010
by justin
0 comments

Good Service vs GoDaddy's Service

A few days ago I was working on a project for a client here at work. I had a situation where I just needed to create a simple web service that made a call to ExactTarget’s API. Was pretty easy and had it working flawlessly on my local computer within a couple of hours. I pushed it up to our site on GoDaddy to test and received an error. I found out that there is an assembly that the ExactTarget code needs to work and that it needed to run with elevated trust. Well apparently GoDaddy doesn’t allow for that.

So in my nerd rage, I posted to Twitter that I was upset:

Is @GoDaddy really an ASP.NET host or do they pretend to be? Anything I try to do mildly difficult, their shared hosting fails on.

I had seen that GoDaddy was pretty quick on their responses that day but not with my message. The next day, I did receive a message from them asking what my issue/question was and I promptly responded. I still haven’t heard back.

But what was interesting to me about this was that not long after my response to GoDaddy, I received a message from WinHost:

@digijustin What was it that GoDaddy had issues with doing?

I was pretty impressed and responded quickly and they even responded back saying that they could in fact do with GoDaddy couldn’t. Cool. Score one for them and hang another zero for GoDaddy.

Right after my response to WinHost, I received another Tweet. This time from DiscountASP to tell me that they too support what I was trying to do.

I was really impressed with these 2 hosts that they would jump in to help me out while GoDaddy left me hanging. I didn’t end up needing a Windows solution as the PHP option I was chasing ended up working but still time after time, GoDaddy fails me every time I try to do something that deviates from easy.

Next time I need a Windows host, I will have an easier time looking in the direction of WinHost and DiscountASP before I even think about GoDaddy.

 

February 1, 2010
by justin
4 Comments

How Do You Code?

I consider myself a decent programmer but I know that there is a ton more to learn and no one programmer will ever know everything as programming is evolving all the time. But occasionally, programmers come across a decision on how to program a certain site/job. As a C# developer, I always prefer to code in C# but does it make sense to not always do what you’re comfortable in?

For example, if I have a site that I need to create and server isn’t an issue, do I do it in what I’m good at with C# or do I try coding it in PHP?

I guess my question is “would you rather be better at one thing or pretty good at a few things?” What is better for you?