Posts

Showing posts from 2012

AVD Manager - Unable to find a 'userdata.img' file for ABI armeabi to copy into the AVD folder

Image
When trying to create a new Android 4.0.3 virtual device I hit this problem for ages. When I clicked Create AVD it was just doing nothing:

On further investigation I noticed that eclipse was saying the following:
"Unable to find a 'userdata.img' file for ABI armeabi to copy into the AVD folder."
In order to fix this problem, in Eclipse choose Window -> Android SDK Manager
Once this loads, you need to ensure that you have installed ARM EABI v7a System Image under Android 4.0.3 (API15). 
Once this is installed, try to create the AVD again and it should just work. It would have been much better if the "Create AVD" button did something instead of just failing silently! Hope this helps you out.

ASP.NET upload image to database and retrieve into gallery

Image
A recent request to a website I've been creating was to allow users to upload photos to the website, so that other users can see them. In order to do this I created this proof of concept which was easy to incorporate into my sites(s).  You can download the complete source here:
The first step is to create a database which will store the images and the description of the image. In Microsoft SQL Server I've created a new Database named "Example" and one table named "Photos". Within this table, create three columns:
Column Type UniqueID Unique Identifier Photo Image Description Text
Note: You'll need to add something like this to your Web.config file:
<appSettings>       <addkey="ConnectionString"value="Data Source=*your instance name*;Initial Catalog=Example;Integrated Security=True"/> </appSettings>

For the website, I've kept the default styles when you create a new ASP.NET Web Application, removing the two content pages …

Set JAVA_HOME in Windows 7

Image
A common hassle whenever you get a new laptop or PC is setting up the java environment variables so that when you install Eclipse or Netbeans you are ready to go. For your, and my own future reference, this is how it is done (on Windows 7 at least).

1. Find out where you have installed the JDK, or install it from here:

e.g. C:\Program Files\Java\jdk1.7.0_04

2. Press the Windows button and type in "Environment Variables" and press enter.


This will open the following window:


3. Under System Variables, click "New..." and enter JAVA_HOME for the variable name, and the path to your jdk for your variable value:



4. Press OK.

5. Select the variable "Path" and choose to Edit this, and add the following at the end of the string:

%JAVA_HOME%\bin; 

6. Press OK, and then OK to the main dialog. You will now have your Java environment variables set up correctly.

That should be it - if I've missed anything out or you have any problems let me know!

Check AdSense on the go - Android

Image
As soon as I joined the AdSense programme the first thing I wanted to be able to do was to check my earnings on the move on my phone.

Let me introduce you to AdSense Dashboard

https://play.google.com/store/apps/details?id=com.ctoforaday.asfedash&hl=en/a>n


Check your earnings today, yesterday, this month, this year and all time! What more do you need!

P.s its free!

Allow users to download file from your site

I was recently asked to provide a download link to allow users of my website to download a file (a word document).

After an initial Google it seemed that this was going to be a lot more complicated than I thought, but in reality the solution is incredibly simple!

Within your website, create a folder (e.g. named downloads) where you will keep the files that users can download.Within your webpage (or ASP.NET page) add a simple anchor tag (that's the <a>... </a> you usually use for links.Set the href property to the location of the file to download. It's that simple - so you should end up with a tag like:
<a href="../Downloads/documentToDownload.doc">Click here to download file!</a>
Clicking this in your page instead of linking to a page will simply start downloading the file in your browser - easy!

ASP.NET error when sending email: Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.

I came across this error after deploying a website:


Server Error in '/' Application.
Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machineKey> configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 
Exception Details: System.Web.HttpException: Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machineKey> configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.
Quite a nasty looking one but with a very simple fix - just need to add the following to your web.config file in the system.web section:
 <pagesvalidateRequest="false"enableEve…

VS2010 - Ctrl + Click: Installing Microsoft Productivity Power Tools

Image
The worst thing about developing in Java is the IDE's - Eclipse and Netbeans just don't compare to Visual Studio. However the one thing they do allow you to do is press control and click to take you to a definition - something severely lacking from VS...until now!

Productivity Power Tools is an extension for Visual Studio 2010 which contains ctrl + click among other helpful tools. To install this tool follow these steps:


In VS click the tools option on the toolbar, and select Extension Manager...
You will now be shown the extension manager dialog. Select the "Online Gallery" dialog on the left handside, and in the top right hand side search box enter "Productivity Power Tools". 
Press download and the download/installation process will start. Press install at the prompt. Once complete you will be notified that you need to restart VS. Press "Restart Now". 
Note that restarting VS may take a while depending on the speed of your machine. Once you restart…