October 21, 2012

Published with Blogger-droid v2.0.9


Back to Home

December 15, 2010

Blog moved!

This blog has moved to http://www.animaonline.com :)


Back to Home

March 11, 2010

twNowplaying



I made this little program today, it tweets your currently playing track from Spotify to Twitter
It is an Alpha version so it's not 100% bug free.

Anyway, I will be happy for all the feedback that I can get.

To get started, download the archive , extract all of its contents to any directory, and run the twNowplayinge.exe. Then, press the Twitter icon to authenticate.

Here's an example of what some tweets posted by it look like.

#twNowplaying
(note the #twNowplaying tag)

Later versions will make it possible to sync the currently playing track from Last.fm and Windows Media Player.

And don't forget to follow me @ twitter

Download it from here

Later! :)


Back to Home

January 24, 2010

awAPI Weather Condition Images


Adam Pendle over at blindmotion , shared a list of all weather condition images that are available for Animaonline Weather API , plus some custom looking images, that are looking Good. :)


Check it out


Back to Home

December 16, 2009

Animaonline Weather API 2.5.0.0 Is Here



That's right! Animaonline Weather API 2.5.0.0 has been released!
One year has passed since it's last release!
I simply don't have that much time to code, now that I'm married ;)

The new awAPI uses LINQ for all it's core operations, making it much faster, and more stable than the previous versions! The core has been rewritten from scratch and uses a new format, so the old documentation is now considered to be deprecated. But, that doesn't mean it became more difficult to use, in fact it's much simpler in this version!
The API .dll file can be downloaded from Project's download section here on CodePlex.

The source code will be available, as soon as I get my Team Foundation Server up and running!

Here's some example API usage code goodies for ya'll!

var phoenixWeather =

Animaonline.Weather.GoogleWeatherAPI.GetWeather(Animaonline.Globals.LanguageCode.en_US, "Phoenix, AZ");

Console.WriteLine("Current Condition: {0}",

phoenixWeather.CurrentConditions.Condition);

Console.WriteLine("Current Humidity: {0}",

phoenixWeather.CurrentConditions.Humidity);

Console.WriteLine("Current Temperature: {0}",

phoenixWeather.CurrentConditions.Temperature.Fahrenheit);

Console.WriteLine("Current Wind Condition: {0}",

phoenixWeather.CurrentConditions.WindCondition);


You also have

phoenixWeather.ForecastConditions (Which is a List<*> of ForecastCondition objects)

phoenixWeather.ForecastInformation


Plus all the goodies from the old versions; such as:

GeoCoding

GeoNames

Google Maps Generation

GeoRSS Generation

All to be found in the new Animaonline.Geo namespace! ;)


and much more...


Thanks to everyone of you that are using my API, it really makes it worth the effort I put into it!

I would also thank everyone that have donated!, thank you!!! :)




Enjoy

/Roman A.


Back to Home

November 17, 2009

Saving ASP.NET FileUpload files in all browsers



After a number of non-successful attempts on making the ASP.NET FileUpload dialog work in Mozilla Firefox browsers, and reading some stuff on the net, I made my own version of the FileUpload dialog, well.. actually it's just a modified version of the FileUpload from the BCL.
Anyways, it fixes the issue when FileDialog returns just the file name, instead of the full folder name , in non IE browsers , and it does so by writing the underlying stream to a file. Spares you the headache ;)

Here's the code.

P.s. to those of you who's still reading my blog, thank you and sorry for not posting in a long time.

using System;

using System.Web.UI.WebControls;

using System.IO;

namespace Animaonline

{

public class FileUploadPro : FileUpload

{

public void SaveFileMozilla(string fileName)

{

try

{

byte[] bytes = new byte[base.PostedFile.ContentLength];

PostedFile.InputStream.Read(bytes, 0, base.PostedFile.ContentLength);

using (FileStream fileWriter = new FileStream(fileName, FileMode.Create))

{

fileWriter.Write(bytes, 0, bytes.Length);

}

}

catch (Exception)

{

throw;

}

}

}

}



Back to Home

January 22, 2009

Microsoft Accelerator (GPU) based Pi Calculation - A C# Port



This is a quick and dirty port.
Microsoft Research Accelerator Project


using
System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Research.DataParallelArrays;

namespace piSharp.cs
{
class Program
{
static void Main(string[] args)
{
Random r =
new Random();
// create randomly generated samples in the unit square centered on (0,0)

int iSize = 1500;
float[,] x = new float[iSize + 1, iSize + 1];
// x coordinate
float[,] y = new float[iSize + 1, iSize + 1];
// y coordinate
int i = 0;
int j = 0;

// create an x and y arrays of random numbers between 0 and 1
for (i = 0; i <= iSize - 1; i += 1) { for (j = 0; j <= iSize - 1; j += 1) { x[i, j] = (float)r.NextDouble();
y[i, j] = (
float)r.NextDouble();
}
}
ParallelArrays.InitGPU();

// make x and y data parallel arrays
DisposableFloatParallelArray parallelX =
new DisposableFloatParallelArray(x);
DisposableFloatParallelArray parallelY =
new DisposableFloatParallelArray(y);

// center them about (0, 0) with range (-1, 1)
FloatParallelArray parallelXCentered =
default(FloatParallelArray);
FloatParallelArray parallelYCentered =
default(FloatParallelArray);
parallelXCentered = ParallelArrays.Multiply(ParallelArrays.Subtract(parallelX, 0.5f), 2f);
parallelYCentered = ParallelArrays.Multiply(ParallelArrays.Subtract(parallelY, 0.5f), 2f);

// calculate distance of (x,y) from 0, ie. Sqrt(x^2 + y^2)
FloatParallelArray parallelXSquare =
default(FloatParallelArray);
FloatParallelArray parallelYSquare =
default(FloatParallelArray);
FloatParallelArray parallelDistance =
default(FloatParallelArray);
parallelXSquare = ParallelArrays.Multiply(parallelXCentered, parallelXCentered);
parallelYSquare = ParallelArrays.Multiply(parallelYCentered, parallelYCentered);
parallelDistance = ParallelArrays.Sqrt(ParallelArrays.Add(parallelXSquare, parallelYSquare));
float[,] test = new float[iSize + 1, iSize + 1];
ParallelArrays.ToArray(parallelDistance,
out test);

// create an array of 1's if distance <> 1
FloatParallelArray parallelOne =
new FloatParallelArray(1f, parallelX.Shape);
FloatParallelArray parallelZero =
new FloatParallelArray(0f, parallelX.Shape);
FloatParallelArray parallelInCircle =
default(FloatParallelArray);

parallelInCircle = ParallelArrays.Select(ParallelArrays.Subtract(parallelOne, parallelDistance), parallelOne, parallelZero);

// the number inside the circle is the sum of the entire InCircle array
FloatParallelArray parallelCountInCircle =
default(FloatParallelArray);
parallelCountInCircle = ParallelArrays.Sum(parallelInCircle);

float[] inCircle = new float[2];
ParallelArrays.ToArray(parallelCountInCircle,
out inCircle);
parallelX.Dispose();
parallelY.Dispose();

// approximate pi--area of unit circle is pi
// area of square from -1,1 is 4
// inCircle/(total number of points) == pi/4
float pi = 0;
pi = 4 * inCircle[0] / (iSize * iSize);
System.Console.WriteLine(
"Pi is approximately " + pi.ToString());
ParallelArrays.UnInit();

// Prompt user for exit for running in VS IDE
System.Console.WriteLine(
"Press Enter to Exit");
System.Console.ReadLine();
}
}
}


Back to Home