<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>danejeffrey.com &#187; code</title>
	<atom:link href="http://danejeffrey.com/blog/tag/code/feed/" rel="self" type="application/rss+xml" />
	<link>http://danejeffrey.com/blog</link>
	<description>Good ways to break things.</description>
	<lastBuildDate>Wed, 05 Oct 2011 00:13:53 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Eclipse IDE &#8211; New Project, No Android Build Targets Available</title>
		<link>http://danejeffrey.com/blog/2011/01/25/eclipse-ide-new-project-no-android-build-targets-available/</link>
		<comments>http://danejeffrey.com/blog/2011/01/25/eclipse-ide-new-project-no-android-build-targets-available/#comments</comments>
		<pubDate>Tue, 25 Jan 2011 08:17:05 +0000</pubDate>
		<dc:creator>danejeff</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[code]]></category>

		<guid isPermaLink="false">http://danejeffrey.com/blog/?p=483</guid>
		<description><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://danejeffrey.com/blog/2011/01/25/eclipse-ide-new-project-no-android-build-targets-available/' addthis:title='Eclipse IDE &#8211; New Project, No Android Build Targets Available '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div>Installed the Andorid SDK on Windows as per guide at http://developer.android.com, all pretty straight forward. Decided to also use the Eclipse IDE for developing apps since it seems to be the recommended way of doing this (haven&#8217;t really done any Java development in the past). Installed Eclipse 3.6 (Helios) and installed the ADT plugin for [...]<div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://danejeffrey.com/blog/2011/01/25/eclipse-ide-new-project-no-android-build-targets-available/' addthis:title='Eclipse IDE &#8211; New Project, No Android Build Targets Available ' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>]]></description>
			<content:encoded><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://danejeffrey.com/blog/2011/01/25/eclipse-ide-new-project-no-android-build-targets-available/' addthis:title='Eclipse IDE &#8211; New Project, No Android Build Targets Available '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div><p>Installed the Andorid SDK on Windows as per guide at <a href="http://developer.android.com" target="_blank">http://developer.android.com</a>, all pretty straight forward. Decided to also use the Eclipse IDE for developing apps since it seems to be the recommended way of doing this (haven&#8217;t really done any Java development in the past).</p>
<p>Installed Eclipse 3.6 (Helios) and installed the ADT plugin for it, as detailed <a href="http://developer.android.com/sdk/eclipse-adt.html#installing" target="_blank">here</a>.</p>
<p>Following that, tried to build a new project following the guide <a href="http://developer.android.com/guide/developing/eclipse-adt.html" target="_blank">here</a>.</p>
<p>Got to the New Project page but there were no Build Targets available in the list.</p>
<p>For me, the issue was that Eclipse didn&#8217;t know where the Android SDK was located, so it didn&#8217;t know what builds were available. To fix:<br />
1. In Eclipse go to Window -&gt; Preferences<br />
2. Click on Android<br />
3. Browse to the path of the SDK (for me, on Windows, this was default C:\Program Files\Android\android-sdk-windows)<br />
4. Click Apply, then OK</p>
<p>The builds that have been added to the SDK will appear in the list. Go to File -&gt; New -&gt; Project again and this time the Build Targets list is there:</p>
<p><a href="http://danejeffrey.com/blog/wp-content/uploads/2011/01/NewProject.png"><img class="aligncenter size-medium wp-image-485" title="NewAndroidProject" src="http://danejeffrey.com/blog/wp-content/uploads/2011/01/NewProject-194x300.png" alt="" width="194" height="300" /></a></p>
<img src="http://danejeffrey.com/blog/?ak_action=api_record_view&id=483&type=feed" alt="" /><div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://danejeffrey.com/blog/2011/01/25/eclipse-ide-new-project-no-android-build-targets-available/' addthis:title='Eclipse IDE &#8211; New Project, No Android Build Targets Available ' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>]]></content:encoded>
			<wfw:commentRss>http://danejeffrey.com/blog/2011/01/25/eclipse-ide-new-project-no-android-build-targets-available/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>VMware PowerCLI for Host and Guest CPU Details, Includes OS and Power State</title>
		<link>http://danejeffrey.com/blog/2011/01/25/vmware-powercli-for-host-and-guest-cpu-details-includes-os-and-power-state/</link>
		<comments>http://danejeffrey.com/blog/2011/01/25/vmware-powercli-for-host-and-guest-cpu-details-includes-os-and-power-state/#comments</comments>
		<pubDate>Tue, 25 Jan 2011 05:44:31 +0000</pubDate>
		<dc:creator>danejeff</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[VMware]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[powershell]]></category>

		<guid isPermaLink="false">http://danejeffrey.com/blog/?p=504</guid>
		<description><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://danejeffrey.com/blog/2011/01/25/vmware-powercli-for-host-and-guest-cpu-details-includes-os-and-power-state/' addthis:title='VMware PowerCLI for Host and Guest CPU Details, Includes OS and Power State '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div>The following will get CPU (num of cores) counts from hosts and will also get vCPU counts from VM&#8217;s. It will also get the operating system of each VM, its power state and the average CPU for the past week. The end of each section also has a count of the number of objects (hosts [...]<div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://danejeffrey.com/blog/2011/01/25/vmware-powercli-for-host-and-guest-cpu-details-includes-os-and-power-state/' addthis:title='VMware PowerCLI for Host and Guest CPU Details, Includes OS and Power State ' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>]]></description>
			<content:encoded><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://danejeffrey.com/blog/2011/01/25/vmware-powercli-for-host-and-guest-cpu-details-includes-os-and-power-state/' addthis:title='VMware PowerCLI for Host and Guest CPU Details, Includes OS and Power State '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div><p>The following will get CPU (num of cores) counts from hosts and will also get vCPU counts from VM&#8217;s. It will also get the operating system of each VM, its power state and the average CPU for the past week. The end of each section also has a count of the number of objects (hosts and VMs) in the environment.</p>
<pre class="brush:vb">Connect-VIServer &lt;Your_vCenter_Server&gt;
# define start and finish days (1 week period)
$startdate=(get-date).addDays(-7)
$finishdate=(get-date).addDays(-1)
# initialise counters
$vmcount=0
$hostcount=0

ForEach ($esxhost in (Get-VMHost | Sort Name)){
	Write-Host $esxhost.Name","$esxhost.NumCPU
    $hostcount++
}
Write-Host "Total Hosts:" $hostcount

ForEach ($vm in (Get-VM | Sort Name)){
    If ($vm.PowerState -eq 'PoweredOn'){
        $vstats = (Get-Stat -entity $vm -stat cpu.usage.average -Start $startdate -Finish $finishdate | measure-object -property value -average)
        # round to two decimal places
        $vavg = [system.math]::round($vstats.average,2)
    }Else{
        $vavg = 0
    }
	Write-Host $vm.Name","$vm.Guest.OSFullName","$vm.PowerState","$vm.NumCPU","$vavg
    $vmcount++
}

Write-Host "Total VM's:" $vmcount</pre>
<img src="http://danejeffrey.com/blog/?ak_action=api_record_view&id=504&type=feed" alt="" /><div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://danejeffrey.com/blog/2011/01/25/vmware-powercli-for-host-and-guest-cpu-details-includes-os-and-power-state/' addthis:title='VMware PowerCLI for Host and Guest CPU Details, Includes OS and Power State ' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>]]></content:encoded>
			<wfw:commentRss>http://danejeffrey.com/blog/2011/01/25/vmware-powercli-for-host-and-guest-cpu-details-includes-os-and-power-state/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Idea: Twitter Search &#8211; Random User Profile Image</title>
		<link>http://danejeffrey.com/blog/2011/01/12/idea-twitter-search-random-user-profile-image/</link>
		<comments>http://danejeffrey.com/blog/2011/01/12/idea-twitter-search-random-user-profile-image/#comments</comments>
		<pubDate>Wed, 12 Jan 2011 00:07:00 +0000</pubDate>
		<dc:creator>danejeff</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[idea]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://danejeffrey.com/blog/?p=479</guid>
		<description><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://danejeffrey.com/blog/2011/01/12/idea-twitter-search-random-user-profile-image/' addthis:title='Idea: Twitter Search &#8211; Random User Profile Image '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div>Its a random scatter of user profile images based on search criteria. Where? Here (suggest using Chrome for this): http://danejeffrey.com/projects/twitsearch.php  Using: Twitter Search API, JavaScript, jQuery and some CSS (also ref: http://johnmc.co/llum/using-json-to-access-the-twitter-search-api/ for use of $.getJSON).<div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://danejeffrey.com/blog/2011/01/12/idea-twitter-search-random-user-profile-image/' addthis:title='Idea: Twitter Search &#8211; Random User Profile Image ' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>]]></description>
			<content:encoded><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://danejeffrey.com/blog/2011/01/12/idea-twitter-search-random-user-profile-image/' addthis:title='Idea: Twitter Search &#8211; Random User Profile Image '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div><p>Its a random scatter of user profile images based on search criteria. Where? Here (suggest using <a href="http://www.google.com/chrome" target="_blank">Chrome</a> for this):</p>
<p><a href="http://danejeffrey.com/projects/twitsearch.php">http://danejeffrey.com/projects/twitsearch.php</a> </p>
<p>Using: <a href="http://search.twitter.com/api/" target="_blank">Twitter Search API</a>, JavaScript, jQuery and some CSS (also ref: <a href="http://johnmc.co/llum/using-json-to-access-the-twitter-search-api/">http://johnmc.co/llum/using-json-to-access-the-twitter-search-api/</a> for use of $.getJSON).</p>
<img src="http://danejeffrey.com/blog/?ak_action=api_record_view&id=479&type=feed" alt="" /><div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://danejeffrey.com/blog/2011/01/12/idea-twitter-search-random-user-profile-image/' addthis:title='Idea: Twitter Search &#8211; Random User Profile Image ' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>]]></content:encoded>
			<wfw:commentRss>http://danejeffrey.com/blog/2011/01/12/idea-twitter-search-random-user-profile-image/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Active Directory Site and Subnet List VBScript</title>
		<link>http://danejeffrey.com/blog/2011/01/04/active-directory-site-and-subnet-list-vbscript/</link>
		<comments>http://danejeffrey.com/blog/2011/01/04/active-directory-site-and-subnet-list-vbscript/#comments</comments>
		<pubDate>Tue, 04 Jan 2011 05:45:50 +0000</pubDate>
		<dc:creator>danejeff</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[vbscript]]></category>

		<guid isPermaLink="false">http://danejeffrey.com/blog/?p=463</guid>
		<description><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://danejeffrey.com/blog/2011/01/04/active-directory-site-and-subnet-list-vbscript/' addthis:title='Active Directory Site and Subnet List VBScript '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div>This will list Active Directory sites and subnets and display in a MsgBox. Formatting is ugly but that&#8217;s easy to change as required. 'Get list of AD subnets Set oRootDSE = GetObject("LDAP://RootDSE") sConfigurationNC = oRootDSE.Get("configurationNamingContext") Set oRootDSE = Nothing sSubnetsContainer = "LDAP://cn=Subnets,cn=Sites" &#38; "," &#38; sConfigurationNC Set oSubnetsContainer = GetObject(sSubnetsContainer) For Each sResult In oSubnetsContainer [...]<div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://danejeffrey.com/blog/2011/01/04/active-directory-site-and-subnet-list-vbscript/' addthis:title='Active Directory Site and Subnet List VBScript ' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>]]></description>
			<content:encoded><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://danejeffrey.com/blog/2011/01/04/active-directory-site-and-subnet-list-vbscript/' addthis:title='Active Directory Site and Subnet List VBScript '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div><p>This will list Active Directory sites and subnets and display in a MsgBox. Formatting is ugly but that&#8217;s easy to change as required.</p>
<pre class="brush:vb">'Get list of AD subnets

Set oRootDSE = GetObject("LDAP://RootDSE")
sConfigurationNC = oRootDSE.Get("configurationNamingContext")
Set oRootDSE = Nothing 

sSubnetsContainer = "LDAP://cn=Subnets,cn=Sites" &amp; "," &amp; sConfigurationNC
Set oSubnetsContainer = GetObject(sSubnetsContainer)

For Each sResult In oSubnetsContainer

	aSNInfo = Split(sResult.cn, "/")
	If Instr(sResult.siteObject, ",") = 0 Then
		sSN = sSN &amp; aSNInfo(0) &amp; vbTab &amp; vbTab
	Else
		sSN = sSN &amp; aSNInfo(0) &amp; ": " &amp; _
			Mid(Left(sResult.siteObject, Instr(sResult.siteObject, ",") - 1), 4) &amp; _
			vbTab &amp; vbTab
	End if
Next
wscript.echo sSN</pre>
<p>To display your computer&#8217;s site:</p>
<pre class="brush:vb">Set adsSystemInfo = CreateObject("ADSystemInfo")
WScript.echo "Your site is: " &amp; adsSystemInfo.SiteName
Set adsSystemInfo = Nothing</pre>
<img src="http://danejeffrey.com/blog/?ak_action=api_record_view&id=463&type=feed" alt="" /><div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://danejeffrey.com/blog/2011/01/04/active-directory-site-and-subnet-list-vbscript/' addthis:title='Active Directory Site and Subnet List VBScript ' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>]]></content:encoded>
			<wfw:commentRss>http://danejeffrey.com/blog/2011/01/04/active-directory-site-and-subnet-list-vbscript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HTTP Get Using MSXML2.XMLHTTP Object VBScript</title>
		<link>http://danejeffrey.com/blog/2010/12/23/http-get-using-msxml2-xmlhttp-object-vbscript/</link>
		<comments>http://danejeffrey.com/blog/2010/12/23/http-get-using-msxml2-xmlhttp-object-vbscript/#comments</comments>
		<pubDate>Thu, 23 Dec 2010 05:41:16 +0000</pubDate>
		<dc:creator>danejeff</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[vbscript]]></category>

		<guid isPermaLink="false">http://danejeffrey.com/blog/?p=461</guid>
		<description><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://danejeffrey.com/blog/2010/12/23/http-get-using-msxml2-xmlhttp-object-vbscript/' addthis:title='HTTP Get Using MSXML2.XMLHTTP Object VBScript '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div>Use the XMLHTTP object to issue an HTTP Get on a remote web server. Set objHTTP = CreateObject("MSXML2.XMLHTTP") objHTTP.open "GET", "http://localhost/default.htm, False objHTTP.send strResponse = objHTTP.responseText Ref: http://msdn.microsoft.com/en-us/library/ms757849(VS.85).aspx<div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://danejeffrey.com/blog/2010/12/23/http-get-using-msxml2-xmlhttp-object-vbscript/' addthis:title='HTTP Get Using MSXML2.XMLHTTP Object VBScript ' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>]]></description>
			<content:encoded><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://danejeffrey.com/blog/2010/12/23/http-get-using-msxml2-xmlhttp-object-vbscript/' addthis:title='HTTP Get Using MSXML2.XMLHTTP Object VBScript '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div><p>Use the XMLHTTP object to issue an HTTP Get on a remote web server.</p>
<pre class="brush:vb">Set objHTTP = CreateObject("MSXML2.XMLHTTP")
objHTTP.open "GET", "http://localhost/default.htm, False
objHTTP.send
strResponse = objHTTP.responseText</pre>
<p>Ref: <a href="http://msdn.microsoft.com/en-us/library/ms757849(VS.85).aspx">http://msdn.microsoft.com/en-us/library/ms757849(VS.85).aspx</a></p>
<img src="http://danejeffrey.com/blog/?ak_action=api_record_view&id=461&type=feed" alt="" /><div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://danejeffrey.com/blog/2010/12/23/http-get-using-msxml2-xmlhttp-object-vbscript/' addthis:title='HTTP Get Using MSXML2.XMLHTTP Object VBScript ' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>]]></content:encoded>
			<wfw:commentRss>http://danejeffrey.com/blog/2010/12/23/http-get-using-msxml2-xmlhttp-object-vbscript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

