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

September 29, 2008

AWLP And AWAPI - New versions out, now!

Lately I had a lot of spare time to work on my projects , and now I'm proud to announce new versions of Animaonline Weather API (2.0.3.0 BETA) and Animaonline Windows Live Presence Wrapper (2.0)


Animaonline Weather API 2.0.3.0 BETA
What's new:

The GPS Code was improved and tested on a Windows Mobile Device, it works now :)
A Windows Mobile GPS Test Application was added.
Note: GPS code is still unstable
Image Downloader for Windows Mobile

AWLP 2.0 (Animaonline Windows Live Presence Wrapper)
For those who don't know what AWLP is, here is a short description:
Animaonline Windows Live Presence Wrapper Let's you query Windows Live service for user's status.
Powered by Microsoft's Windows Live API
Usage Example:
Animaonline.WindowsLive.PresenceData Presence;
Presence.GetPresence("animaonline@gmail.com");
Console.WriteLine(Presence)

Returns user's current status / status text , nickname and icon

What's new:
The code has been improved in many ways, and the assembly is now CLS compliant :)


Back to Home

September 21, 2008

Animaonline Weather API 2.0 BETA, Released



Okay! It's been a while since I last posted, a lot has happened lately
and I simply didn't have time to post, but now I'm back,
and I would like to announce the release of Animaonline Weather API 2.0 BETA,
quite some time has passed since the first release (One year actually!), I had some time to go trough the code, and it was then that I found out that the whole code would be better if I rewrite it from scratch; so I did..

The new release of awAPI has A LOT of improvements.

  • The performance has been drastically improved by 70-100 percent
  • The user now has ability to select the language the weather data will be queried in.
  • Querying weather data is now even simpler, can be done by one line of code!
  • I added GeoServices support, this includes GeoCoding (Which lets you find associated geographic coordinates from other geographic data, such as street addresses, or zip codes)
  • Reverse GeoCoding (Which is the opposite of GeoCoding: finding an associated textual location such as a street address, from geographic coordinates.)
  • GPS Support (Combined with GeoServices let's you query weather for the region you are in)
  • Google’s Maps support, allows you to generate Google Maps combining it with weather, GeoServices and GPS data
  • Multi Platform support, run the API on Windows, CE Devices, and the Mono Framework

Note: This is still a BETA version; I'm working on improving the final version and adding new features.

Check out the Recent Check-ins page for the latest version or visit this page for a compiled binary.

P.S.
You can make a donation if you'd like to support my work.


Back to Home

March 06, 2008

Internet Explorer 8 BETA





First Look: Internet Explorer 8

Here are some end-user features you can expect to see in Internet Explorer 8 Beta 1.


Activities
Activities are contextual services to quickly access a service from any webpage, like Facebook or Digg, Live Search, etc...

WebSlices
WebSlices is a new feature for websites to connect to their users by subscribing to content directly within a webpage. WebSlices behave just like feeds where clients can subscribe to get updates and notify the user of changes.

Favorites Bar
Like the one in Mozilla Firefox, lets you drag and drop URL's on it.

Automatic Crash Recovery

This one helps to prevent the loss of work and productivity in the unlikely event of the browser crashing or hanging.

Improved Phishing Filter
Internet Explorer 7 introduced the Phishing Filter, a feature which helps warn users when they visit a Phishing site. Phishing sites spoof a trusted legitimate site, with the goal of stealing the user’s personal or financial information. For Internet Explorer 8, we are building on the success of the Phishing Filter with a more comprehensive feature called the "Safety Filter."

Download it here

What’s new in Internet Explorer 8 for Developers
  1. Accessibility
  2. ActiveX Improvements
  3. Activities and WebSlices
  4. AJAX Enhancements
  5. CSS Compliance
  6. Developer Tools
  7. Document Compatibility Mode
  8. DOM Storage
  9. Protected Mode Cookies
  10. Selectors API
  11. Tab Isolation and Concurrency
For a detailed list go to this page


Back to Home

December 11, 2007

Windows Powershell 2.0 CTP Available



Microsoft has released Windows Powershell 2.0 CTP to Microsoft Beta testers, you can apply for the beta program at https://connect.microsoft.com/

A lot of new features has been added, here are my favorites

  • Script Debugger (Very neat)
  • GUI !
For a full list of new features go to Powershell 2.0 CTP beta program site at Microsoft Connect


Back to Home

December 07, 2007

Vista SP1 RC is here

Microsoft Released Vista SP1 to MSDN subscribers, here is the script to make it Visible in Windows Update, Right now I'm installing it, I will report as soon as the installation has been completed.

- Enjoy


Note: As far as I know the script should work on any Windows Vista versions, and in all countries.
How to update:

Open notepad -> Paste following text
@echo off
reg delete HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\VistaSp1 /f > NUL 2>&1
reg delete HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\WindowsUpdate\VistaSP1 /f > NUL 2>&1
reg add HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\VistaSp1 /v Beta1 /t REG_SZ /d da2ba4db-dedb-437e-8e7e-104643454bb6 /f
IF NOT %errorlevel% == 0 ( goto ERROR)
:SUCCESS
goto END
:ERROR
goto END
:END
pause
Save as .BAT or .CMD
Run as administrator (Right click the file, and click "Run as administrator")
Now check for updates on Windows Update


Back to Home

November 27, 2007

CodeDom Calculator


How to use
1: Compile the class and add to your application reference list.

2: Add the following line to display output
Console.WriteLine(CodeDomCalc.Calculator.Execute("2*55/1.5", "double").ToString());
[Save]


Back to Home

November 20, 2007

Visual Studio 2008 RTM avaialble for download


MSDN subscribers can now download Visual Studio 2008 RTM from MSDN


Back to Home

November 14, 2007

Converting Excel's DateTime serial to Windows DateTime



This little snippet here will allow you to convert excel encoded date to standard Windows DateTime.

public static DateTime ExcelDateConverter(int excelDateSerial)
{
if (excelDateSerial <>
{
excelDateSerial++;
}
return new DateTime((excelDateSerial + 693593) * (10000000L * 24 * 3600));

}


Back to Home

November 12, 2007

F# Windows Forms Tutorial



Here's a little tutorial on how to show a windows form from F# (The new .NET Language)

You can get the compiler from here


open System
open System.Windows.Forms

let form = new Form()
do form.Width <- 300
do form.Height <- 300
do form.FormBorderStyle <- FormBorderStyle.Fixed3D
do form.Text <- "Windows Form from F#"

let RichTextbox1 = new RichTextBox()
do RichTextbox1.Text <- "Hello Windows Forms From F#"
do RichTextbox1.Size <- new System.Drawing.Size(320,240)

let btn1 = new Button()
do btn1.Text <- "Click me!"
do btn1.Location <- new System.Drawing.Point(0,240)
let btn1Click (e: #IEvent<_>) = e.Add(fun _ -> System.Windows.Forms.MessageBox.Show("Hello World, from btnClick event handler!");())

do btn1Click btn1.Click

do form.Controls.Add(RichTextbox1)
do form.Controls.Add(btn1)

do Application.Run(form)


Back to Home

November 07, 2007

Office application does not quit after automation from Visual Studio .NET client


This is a common nasty problem that has bugged me a lot lately

When you automate a Microsoft Office application from Microsoft Visual Basic .NET or Microsoft Visual C# .NET, the Office application does not quit when you call the Quit method.

Here's the solution:

In your form's FormClosing event add the following code

ExcelApp.Application.Application.Quit();
ExcelApp.Application.Quit();
GC.Collect();
GC.WaitForPendingFinalizers();


Source: http://support.microsoft.com/?kbid=317109


Back to Home

September 23, 2007

Fixing "Cross-thread operation not valid"


Did you ever get this error? Well I did! I got it pretty often lately…

But I found a quick fix that you can use to fix that issue instead of writing a lot of thread handling code, joining the threads, and so on…

You can just use this little snippet in your application’s Main void

Here it goes:
CheckForIllegalCrossThreadCalls = false;

P.S. Remember to add System.Windows.Forms to your assembly!


Back to Home