I got this exception when I used the charts built-in to .NET 3.5. The scenario in which I got this exception was only when the charts first appeared after postback.
Solution: In the web.config file add 'POST' to the DataVisualization verbs:
The old syntax:
<add path="ChartImg.axd" verb="GET,HEAD" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
validate="false" />
The new syntax:
<add path="ChartImg.axd" verb="GET,HEAD,POST" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
validate="false" />
Monday, May 31, 2010
Tuesday, May 11, 2010
Android SDK Error: Unable to resolve target 'android-X'
There are few variants of this error message:
Unable to resolve target 'android-1'
Unable to resolve target 'android-2'
Unable to resolve target 'android-3'
Unable to resolve target 'android-4'
Unable to resolve target 'android-5'
Unable to resolve target 'android-6'
Unable to resolve target 'android-7'
Unable to resolve target 'android-8'
Unable to resolve target 'android-9'
Unable to resolve target 'android-10'
Unable to resolve target 'android-11'
Unable to resolve target 'android-12'
Unable to resolve target 'android-13'
Unable to resolve target 'android-14'
Unable to resolve target 'android-15'
Unable to resolve target 'android-16'
Unable to resolve target 'android-17'
Unable to resolve target 'android-18'
Unable to resolve target 'android-19'
Unable to resolve target 'android-20'
Unable to resolve target 'android-21'
Reason: Could not find the proper Android SDK version. If the android SDK is installed correctly the problem is that the platform SDK requested by the "default.properties" is not installed. For example:
Unable to resolve target 'android-1' - (Android 1.0) change the "default.properties"
Unable to resolve target 'android-2' - (Android 1.1) change the "default.properties"
Unable to resolve target 'android-3' - install SDK Platform Android 1.5
Unable to resolve target 'android-4' - install SDK Platform Android 1.6
Unable to resolve target 'android-5' - install SDK Platform Android 2.0
Unable to resolve target 'android-6' - install SDK Platform Android 2.0.1
Unable to resolve target 'android-7' - install SDK Platform Android 2.1
Unable to resolve target 'android-8' - install SDK Platform Android 2.2
Unable to resolve target 'android-9' - install SDK Platform Android 2.3
Unable to resolve target 'android-10' - install SDK Platform Android 2.3.3
Unable to resolve target 'android-11' - install SDK Platform Android 3.0
Unable to resolve target 'android-12' - install SDK Platform Android 3.1
Unable to resolve target 'android-13' - install SDK Platform Android 3.2
Unable to resolve target 'android-14' - install SDK Platform Android 4.0
Unable to resolve target 'android-15' - install SDK Platform Android 4.0.3
Unable to resolve target 'android-16' - install SDK Platform Android 4.1
Unable to resolve target 'android-17' - install SDK Platform Android 4.2
Unable to resolve target 'android-18' - install SDK Platform Android 4.3
Unable to resolve target 'android-19' - install SDK Platform Android 4.4
Unable to resolve target 'android-20' - (Android 4.4w) change the "default.properties"
Unable to resolve target 'android-21' - install SDK Platform Android 5.0.1
You can do this using the Android SDK Setup utility:
Option 1: Eclipse -
"Windows" \ "Android SDK and AVD Manager" \ "Available packages"
Option 2: Command line - start the "SDK Setup" here (x86):
C:\Program Files\Google\Android SDK\SDK Setup.exe
or here (x64)
C:\Program Files (x86)\Google\Android SDK\SDK Setup.exe
Unable to resolve target 'android-1'
Unable to resolve target 'android-2'
Unable to resolve target 'android-3'
Unable to resolve target 'android-4'
Unable to resolve target 'android-5'
Unable to resolve target 'android-6'
Unable to resolve target 'android-7'
Unable to resolve target 'android-8'
Unable to resolve target 'android-9'
Unable to resolve target 'android-10'
Unable to resolve target 'android-11'
Unable to resolve target 'android-12'
Unable to resolve target 'android-13'
Unable to resolve target 'android-14'
Unable to resolve target 'android-15'
Unable to resolve target 'android-16'
Unable to resolve target 'android-17'
Unable to resolve target 'android-18'
Unable to resolve target 'android-19'
Unable to resolve target 'android-20'
Unable to resolve target 'android-21'
Reason: Could not find the proper Android SDK version. If the android SDK is installed correctly the problem is that the platform SDK requested by the "default.properties" is not installed. For example:
Unable to resolve target 'android-1' - (Android 1.0) change the "default.properties"
Unable to resolve target 'android-2' - (Android 1.1) change the "default.properties"
Unable to resolve target 'android-3' - install SDK Platform Android 1.5
Unable to resolve target 'android-4' - install SDK Platform Android 1.6
Unable to resolve target 'android-5' - install SDK Platform Android 2.0
Unable to resolve target 'android-6' - install SDK Platform Android 2.0.1
Unable to resolve target 'android-7' - install SDK Platform Android 2.1
Unable to resolve target 'android-8' - install SDK Platform Android 2.2
Unable to resolve target 'android-9' - install SDK Platform Android 2.3
Unable to resolve target 'android-10' - install SDK Platform Android 2.3.3
Unable to resolve target 'android-11' - install SDK Platform Android 3.0
Unable to resolve target 'android-12' - install SDK Platform Android 3.1
Unable to resolve target 'android-13' - install SDK Platform Android 3.2
Unable to resolve target 'android-14' - install SDK Platform Android 4.0
Unable to resolve target 'android-15' - install SDK Platform Android 4.0.3
Unable to resolve target 'android-16' - install SDK Platform Android 4.1
Unable to resolve target 'android-17' - install SDK Platform Android 4.2
Unable to resolve target 'android-18' - install SDK Platform Android 4.3
Unable to resolve target 'android-19' - install SDK Platform Android 4.4
Unable to resolve target 'android-20' - (Android 4.4w) change the "default.properties"
Unable to resolve target 'android-21' - install SDK Platform Android 5.0.1
You can do this using the Android SDK Setup utility:
Option 1: Eclipse -
"Windows" \ "Android SDK and AVD Manager" \ "Available packages"
Option 2: Command line - start the "SDK Setup" here (x86):
C:\Program Files\Google\Android SDK\SDK Setup.exe
or here (x64)
C:\Program Files (x86)\Google\Android SDK\SDK Setup.exe
Labels:
Android
Sunday, April 11, 2010
GoDaddy windows hosting with WordPress Permalinks
After moving multiple domains hosted in GoDaddy to a single Delux windows account I found out that the WordPress permalinks (e.g. SEO nice URL) aren't working anymore.
There are multiple discussions online regarding this problem, mostly regarding redirecting the 404 error page. However the solution is SUPER simple - RTFM (the following answer appears in the WordPress permalink setting page): add a file "web.config" containing the following lines
There are multiple discussions online regarding this problem, mostly regarding redirecting the 404 error page. However the solution is SUPER simple - RTFM (the following answer appears in the WordPress permalink setting page): add a file "web.config" containing the following lines
<?xml version="1.0"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Main Rule" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="index.php" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
Saturday, April 10, 2010
Twitter statistics: Avg. number of follower by time zone
About a week ago I saw this post on TechCrunch and I wondered what other irrelevant statistics I can find on Twitter (given the fact I've already put some time in collecting and parsing Twitter data).
Here is the number of followers by time zone settings (removed time zones with less than 10,000 users, sorry Sydney).
Minimal analysis:

Data collected from the Twitter Sampling API, March 21st-25th, 2010.
Total number of users visible during that time frame: 2.5M (which is a very nice sample).
Here is the number of followers by time zone settings (removed time zones with less than 10,000 users, sorry Sydney).
Minimal analysis:
- Greenland - More people set their time zone to Greenland than the population there...
- Alska - Over 6% (!) of the population are tweeting [see also - 'Greenland'].
- Tokyo - Don't set your time zone to Tokyo if you want people to listen to you, lot's of people are tweeting from Tokyo but no one listens.
- No Time Zone - There's a very low followers count for people with no time zone setting - I guess the reason is that those people are new to Twitter or just don't care enough (those people are about 20% of this entire sample).

Data collected from the Twitter Sampling API, March 21st-25th, 2010.
Total number of users visible during that time frame: 2.5M (which is a very nice sample).
Labels:
Twitter
Saturday, March 27, 2010
Parsing Twitter JSON: Comparing C# libraries performance
Twitter stream API return the data in JSON format. There are multiple JSON libraries in C#, however since I wanted to parse large volumes of data I did a short performance test to see which library gives the best performance in parsing Twitter JSON data.
The libraries tested:
* Json.NET - A popular C# JSON library.
* Gapi.NET - Gapi.NET is not a JSON parsing library, but it contains JSON parsing routines.
* Procurios - Yet another C# JSON library. See also this blog post how to use it to parse Twiter data.
* JavaScriptSerializer - .NET 3.5 built-in JSON parser.
* DataContractJsonSerializer - .NET 3.5 built-in JSON parser.
* AjaxPro - A C# AJAX library.
Results:

The test:
* Data: Twitter Stream API sampling interface data for one hour (2PM GMT) during Match 24th 2010. File size is 285Mb, contains 208,530 lines, one JSON object per line.
* Computer: HP Pavillion DV6000, Intel T9300 2.5GHz, 4GB Memory running Windows 7 x64
* Software: with each library I've performed a very simple test - parse all the messages & get the 'text' field data of every message, if it exists (see code below).
Results:
* Json.NET - 12 seconds, no errors.
* Gapi.NET - 10 seconds, no errors.
* Procurios - 35 seconds, 207 errors.
* JavaScriptSerializer - 77 seconds, no errors.
* DataContractJsonSerializer - 24 seconds, 7452 errors (all the JSON objects that did not contain 'text' element).
* AjaxPro - 16 seconds, no errors.
Code:
Here's the code used for parsing a single line in each of the libraries. Variable line contains a JSON object, the extracted tweet is stored in the variable text.
Json.NET parsing code
Gapi.NET parsing code
Procurios parsing code
JavaScriptSerializer
DataContractJsonSerializer
AjaxPro
The libraries tested:
* Json.NET - A popular C# JSON library.
* Gapi.NET - Gapi.NET is not a JSON parsing library, but it contains JSON parsing routines.
* Procurios - Yet another C# JSON library. See also this blog post how to use it to parse Twiter data.
* JavaScriptSerializer - .NET 3.5 built-in JSON parser.
* DataContractJsonSerializer - .NET 3.5 built-in JSON parser.
* AjaxPro - A C# AJAX library.
Results:

The test:
* Data: Twitter Stream API sampling interface data for one hour (2PM GMT) during Match 24th 2010. File size is 285Mb, contains 208,530 lines, one JSON object per line.
* Computer: HP Pavillion DV6000, Intel T9300 2.5GHz, 4GB Memory running Windows 7 x64
* Software: with each library I've performed a very simple test - parse all the messages & get the 'text' field data of every message, if it exists (see code below).
Results:
* Json.NET - 12 seconds, no errors.
* Gapi.NET - 10 seconds, no errors.
* Procurios - 35 seconds, 207 errors.
* JavaScriptSerializer - 77 seconds, no errors.
* DataContractJsonSerializer - 24 seconds, 7452 errors (all the JSON objects that did not contain 'text' element).
* AjaxPro - 16 seconds, no errors.
Code:
Here's the code used for parsing a single line in each of the libraries. Variable line contains a JSON object, the extracted tweet is stored in the variable text.
Json.NET parsing code
DictionaryjsonObjects = new Dictionary ();
StringReader lineReader = new StringReader(line);
using (Newtonsoft.Json.JsonTextReader jsonReader =
new Newtonsoft.Json.JsonTextReader(lineReader))
{
while (jsonReader.Read())
{
if ((jsonReader.ValueType != null) && (jsonReader.Depth == 1))
{
string key = jsonReader.Value.ToString();
jsonReader.Read();
jsonObjects.Add(key, jsonReader.Value);
}
}
}
object textObject;
if (jsonObjects.TryGetValue("text", out textObject) == true)
text = textObject.ToString();
Gapi.NET parsing code
Gapi.Json.JsonObject jsonLine = Gapi.Json.JsonObject.Parse(line);
Gapi.Json.JsonValue textValue;
if (jsonLine.TryGetValue("text", out textValue) == true)
text = textValue.ToString();
Procurios parsing code
Hashtable jsonHash = (Hashtable)Procurios.Public.JSON.JsonDecode(line);
text = jsonHash["text"] as string;
JavaScriptSerializer
public class TwitterJsonObject
{
public string text;
}
JavaScriptSerializer jSerialize = new JavaScriptSerializer();
TwitterJsonObject twitterJsonObject = jSerialize.Deserialize<twitterjsonobject>(line);
text = twitterJsonObject.text;
DataContractJsonSerializer
// This line is executed once
DataContractJsonSerializer ser = new DataContractJsonSerializer(typeof(TwitterJsonObject));
// This code is executed for every JSON object
MemoryStream ms = new MemoryStream(Encoding.Unicode.GetBytes(line));
TwitterJsonObject twitterJsonObject = ser.ReadObject(ms) as TwitterJsonObject;
text = twitterJsonObject.text;
AjaxPro
TwitterJsonObject twitterJsonObject = AjaxPro.JavaScriptDeserializer.DeserializeFromJson(line, typeof(TwitterJsonObject)) as TwitterJsonObject;
text = twitterJsonObject.text;
Thursday, March 25, 2010
DoDragDrop prevents DoubleClick event from firing
I've tried implementing Drag & Drop in a ListView object, however, calling DoDragDrop from either MouseMove or MouseDown prevented DoubleClick event from firing.
There are few posts online about it, mostly saying using MouseDown event and checking:
e.Clicks == 1
(see for example: here)
However this didn't work for me (DoubleClick fired some times, but most of the time it didn't). After doing further research I came with the following full solution:
There are few posts online about it, mostly saying using MouseDown event and checking:
e.Clicks == 1
(see for example: here)
However this didn't work for me (DoubleClick fired some times, but most of the time it didn't). After doing further research I came with the following full solution:
bool _beginDragDrop = false;
void ListViewBase_MouseMove(object sender, MouseEventArgs e)
{
if ((e.Button == MouseButtons.Left)&&(_beginDragDrop == true))
{
// Replace this with the object you want to Drag & Drop
object draggedObject = this;
this.DoDragDrop(draggedObject, DragDropEffects.Copy);
}
}
void ListViewBase_MouseDown(object sender, MouseEventArgs e)
{
if ((e.Button == MouseButtons.Left) && (e.Clicks == 1))
_beginDragDrop = true;
else
_beginDragDrop = false;
}
Labels:
C#
Monday, February 22, 2010
AjaxToolkit: TabContainer not visible after setting TabPanel.Visible = false
After upgrading AjaxToolkit I had the following weird problem: a TabContainer disappeared.
A short investigation showed that it was cause because I was setting a TabPanel property
tabPanel.Visible = false
Bottom line: If you set the ActiveTab of the TabContainer to Visible=false => the TabContainer will not be drawn. I'm not sure if it's a bug or a feature.
Resolution: Change the ActiveTab when you set TabPanel.Visible = false
A short investigation showed that it was cause because I was setting a TabPanel property
tabPanel.Visible = false
Bottom line: If you set the ActiveTab of the TabContainer to Visible=false => the TabContainer will not be drawn. I'm not sure if it's a bug or a feature.
Resolution: Change the ActiveTab when you set TabPanel.Visible = false
Labels:
AJAX,
AjaxToolkit,
ASP.NET
Subscribe to:
Comments (Atom)