Aug 25

C# Ventures - Unable to convert MySQL date/time value to System.DateTime

Since I am petty new to this language I decided to give myself a pretty easy project... Connect to an MySQL database and return the results.

So it's been a while since I wrote an article.

To jump everyone up to speed...

I got a job at Ipayment doing C# and thought it would be a great opportunity to blog about some of the problems I am already encountering as well as tricks I find useful along my way.

I was using the SQL Library 

("Using System.Data.MySqlClient") 

I was doing a connection and executing a query then populating a data grid. 

Everything seemed to be working with what I was doing so I decided to switch over to Mysql.

This is when I received this bloody error. 

"Unable to convert MySQL date/time value to System.DateTime"

So I did some research and found that this error occurs when you have a null datatime field.

Solution?  Add to the connection string

Allow Zero Datetime=true

This should remove the error and now null dates will show.

May 20

Check out Comics.LA

http://comics.la

May 01

Simple Image Grab In Wordpress

Grabbing your media is always harder then it needs to be.

I wrote a simple function that you can use in your functions.php file

(Located in your Theme Folder)

Size options: thumbnail, medium, large or full

function grab_img($id,$size)
{
	
	//Get images attached to the post
	$args = array(
		'post_type' => 'attachment',
		'post_mime_type' => 'image',
		'numberposts' => -1,
			'order' => 'ASC',
		'post_status' => null,
		'post_parent' => $id
	);
	$attachments = get_posts($args);
	if ($attachments) {
		foreach ($attachments as $attachment) {
			$img = wp_get_attachment_image_src( $attachment->ID,$size );
					break;
			}
	//Display image
	
	return  $img[0];
	}

}

Then in any theme file call the function

<img src="<?php grab_img(get_the_ID(),'thumbnail') ?>" alt="" />

 

Apr 20

Plomer - Creativity is the power to connect.

Creativity is the power to connect the seemingly unconnected.

— William Plomer

Apr 20

An Expert

An expert is a person who has made all the mistakes that can be made in a very narrow field.

— NIELS BOHR

Mar 14

Advice on Life

A little old but I think this is one of the greatest pieces of advice for anyone that has a passion for anything. I have it posted on my wall and I look to it for inspiration to actually do something. Thanks to Randall for all of his great stuff at xkcd.com

 

Mar 13

Thumbnail Generator Started

256 x 256
128 x 128
64 x 64
32 x 32
24 x 24
16 x 16

Visit: http://thumb.2theleft.la/

Mar 08

Tron Legacy

Anyone else excited? A new Tron movie is set to hit this year and apparently the previews are showing in theaters currently.

Mar 02

2theleft Scrape Site Launched!

Over 5 sites being scraped already...

Mar 01

Who's your VPS provider?

A recent comparison of VPS providers by Eivind Uggedal makes a pretty clean cut case. The study shows that between Slicehost, Linode, Prgmr, Rackspace and Amazon EC2, one is the definate winner in all benchmarks. Linode is a XEN based provider which I do know has wiped the floor with other hypervisors for quite some time. I'll let you take a look at the data for yourself but pay attention to the notes at the foot of each graph. Some graphs measure a score(where higher is better) and some measure runtime(where lower times mean the process was faster in execution).

Unixbench single process score (higher is better).


Unixbench 4 parallel processes score (higher is better).

 

SQL-bench on PostgreSQL. Runtime in seconds (lower is better).

 

Django test suite on PostgreSQL. Runtime in seconds (lower is better).

Feb 26

Off URL Launched!

Mess with your friends by making your URL's Offensive..

Feb 26

Corporate America

Monster Energy Drink VS. Vermonster

Feb 24

Off URL Launched

Mess with your friends by generated very obscene urls...

Visit: http://url.2theleft.la/

Feb 24

GofreakMedia Affilated!

My friend over at gofreakmedia added our banner for 87tube.

Visit: http://gofreakmedia.com/blog/

Feb 22

2theleft Business Cards

Some Serious shouts to derek for coming up with the design

 

 

 

Feb 21

The Contraption II

The Contraption II was one of the longest contraption videos created by Baynham & Tyers...

>

Feb 18

Pretty Pleased With Budadex Design

Shouts to Ian for the help

Feb 15

One Day...

One Day

Feb 14

Injecting jQuery into your WebBrowser Control

jQuery + C# + WebBrowser = Win

If you're working with the WebBrowser control in the .NET Framework you know how painful it is to have to select elements using standard methods. SelectElementById is convenient, however most elements do not have an id.

jQuery provides a relatively powerful element selector system. As a web developer, being without jQuery is annoying. Thats why we need to inject it into our WebBrowser control so we can play around with it.

The first thing you're going to need to do is add a reference to MSHTML.dll. Then, in the top of your source file, add this:

using mshtml;

First we need to inject the actual jQuery source. For this example, we're going to use Google's generous CDN to link the jQuery source. 

HtmlElement head = WebBrowser1.Document.GetElementsByTagName("head")[0];
HtmlElement script_element = WebBrowser1.Document.CreateElement("script");
IHTMLScriptElement element = (IHTMLScriptElement)script_element.DomElement;
element.type = "text/javascript";
element.src = "http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js";
head.AppendChild(script_element);

Now, the key part is determining when to inject that code. I prefer the Document_Completed method, as this automatically injects the code with each page refresh. You're probably also wondering how we use it.

I prefer this method:

string js = "function Exec() { $(".rows").hide("fast"); }";
HtmlElement head = _omegleBrowser.Document.GetElementsByTagName("head")[0];
HtmlElement el = _omegleBrowser.Document.CreateElement("script");
IHTMLScriptElement element = (IHTMLScriptElement)el.DomElement;
element.text = js;
head.AppendChild(el);
WebBrowser1.Document.InvokeScript("Exec");

Enjoy!

 

 

Feb 13

View of Augmented Reality Years from Now

This is a take on augmented reality as it might be in the future thought up by Keiichi Matsuda...

He did it as a college product but it may be a view of the amazing and scary things to make it in to our daily lives.

>

About

Living.. Eating... Breathing Tech...

Subscribe

Elsewhere

Categories

Recent Posts

Archive

BlogRoll

Popular Posts

Django Popular