Showing posts with label Web. Show all posts
Showing posts with label Web. Show all posts

2011-03-04

Use your own tools

I got an email today from Microsoft and it had a calendar appointment in it for outlook when I looked at the map link and is was using google maps not bing.
Maybe if you want other people to use your maps you should use them yourself.

2010-05-11

File storage in the cloud

I have been playing with google app engine for a while now mainly with Granite Data Services and Flex, recently I decided to see if I could store files in the datastore as blobs.

I stared by searching on the web on how to save a file as a blob to the datastore after a bit of playing I managed to get it all working using JSP pages and the apache commons fileupload, using this little bit of code:
ServletFileUpload upload = new ServletFileUpload(); FileItemIterator iter; iter = upload.getItemIterator(req); FileItemStream fileItem;
while(iter.hasNext() == true) {  fileItem = iter.next();  InputStream fileStream = fileItem.openStream();  Blob imageBlob = new Blob(IOUtils.toByteArray(fileStream));  if (fileItem.getContentType() != null)   FileDAL.createFile(fileItem.getName(), fileItem.getContentType(), imageBlob); }
The full source is available on github.

I have decided that I really hate JSP Pages so I am going to look into a different template engine stay tuned...

2009-07-29

Controlling Flex With Javascript

For work I had to do a proof of concept to show that I could control flex using javascript and here is is with the source, if you want to do it follow this article.

I did have one problem tho and that was i was using Flash Develop and there is no "Create Ajax Bridge." menu option, luckily this can be solved pretty simply just by copying the the files from you sdk directory to you project they are located in


[sdk]\frameworks\javascript\fabridge\src\bridge\.

2009-07-14

Embedding Flex Components

Embedded Flex ComponentsOk, so before I start I have to say that the control is not actually embedded, all I managed it to do is get control as an image and apply it as a material to the plane. Click the image to the right to see the demo you can view the source by right clicking the demo. I am working on getting the material to update when the control updates but that may be a while before it is working perfectly, as this is all I need for the project template.

2009-07-09

Using an Embedded Flex Image in Papervision3D

One of the problems had setting up the demo in the previous post was using embedded flex images for materials in the Papervision 3D scene, here is the solution. Create a variable for with the embedded image and the variable for the material.
[Embed(source="assets/earthmap.jpg")]
public var earthMap:Class;
private var moonMaterial:BitmapMaterial;

Create a new BitmapAsset variable cad cast the image class to it.

var earthAsset:BitmapAsset = new earthMap() as BitmapAsset;

Finally assign the new variable as a material.

earthMaterial = new BitmapMaterial(earthAsset.bitmapData);

2009-07-08

Papervision3D

Ok so I have started and the first thing I realised when I looked at the template is that it was doing stuff in 3D so I figured that I probably need to learn how to do that. The template was called Ultra biz papervision 3d flash I figured that Papervision3D is what was doing all the 3D heavy lifting it turns out I was right. I downloaded the swc and tried to work it out, this is what I managed.

To view the source right click the movie and select view source.

2009-07-07

Project Template

A few weeks ago after spending ages trying to make a cross browser Javascript application and ending up with two lots of code one for IE 7 and one for the rest of the browsers, I decided that there must be a better way enter flex.

I spent a week doing the flex in a week and then it was time to come up with an project to see how this flex thing really works. This is where the contest I won came into play I won $100 of templates and got this template so I figured what better way to learn flex that to try and recreate it using flex instead of boring old flex so project template was born, I will update here as I work through it with all source code included.

Out in the Wild

My pet project has just finshed its first test in the wild and from what I can tell things went great. To have a look at the website where you to can ask for information feel free to go to the ultimate iphone and iPod Touch Survey Software for Market Research tool, yeah I know its a long link but i do what I am told.

2009-07-06

Excel Reader Writer (excel not required)

Ok as promised here it is a very simple(1 days work) wrapper for reading and writing excel files using 2007 Office System Driver: Data Connectivity Component. Below is an example function that shows what the class library can do. Remember to include a reference to the library in you project.
public void CorichExcel()
{
    string file = "C:/excel.xls";

    string sheet = "";

    try
    {
        //Gets a liost of sheets from the excel file
        string[] sheets = Corich.Excel.ReaderWriter.GetSheets(file);
        sheet = sheets[0];
    }
    catch(Exception ex)
    {
        MessageBox.Show(ex.Message);
        return;
    }
    
    //Check to see if the sheet exist
    if (Corich.Excel.ReaderWriter.SheetExists(file, sheet))
    {

        //gets a list of colums from the first sheet in the excel file
        string[] columns = Corich.Excel.ReaderWriter.GetColumns(file, sheet);

        //Loads the data in the first excel sheet into a data table
        DataTable data = Corich.Excel.ReaderWriter.Read(file);

        //Writes the data from the first sheet to a new excel file, currently only writes to xlsb files
        Corich.Excel.ReaderWriter.Write("C:\new_file.xlsb", data);

        //Writes the data from the first sheet to a new excel file in the temp directory then opens it, currently only writes to xlsb files
        Corich.Excel.ReaderWriter.WriteToTemp("new_file.xlsb", data, true);
    }

}

You can download the .dll and the source here the code is under the GNU GPL licence it would be nice to point people to my site if you use it.

2008-11-25

Auto Redirect to Login in page on an ASP.NET Website and keep styles

I have been working on an ASP.NET website recently and I ran into a problem where if I automatically redirected to the login page I lost my styles. I found a solution tho and here it is:
<!-- allows access Styles and Images directories-->
 <location path="Styles">
   <system.web>
     <authorization>
       <allow users="?">
     </allow></authorization>
   </system.web>
 </location>
 <location path="Images">
   <system.web>
     <authorization>
       <allow users="?">
     </allow></authorization>
   </system.web>
 </location>

<system.web>
   ...

   <authentication mode="Forms">
     <!-- When a user does not have access redirects to the login-->
     <forms loginUrl="Login.aspx" name="Login">
   </forms></authentication>
   <!-- Blocked access to all undecleared directores/files-->
   <authorization>
     <deny users="?">
   </deny></authorization>


   ...
</system.web>

2007-10-26

Using a custom database for ASP.NET Membership

I needed to use a custom database for my membership and roles in an ASP.NET service it took me a little while to sort out in the web.config so I thought that I would post my web.config here just in case anyone wants to copy it. just replace the words in square brackets with the correct values.
<?xml version="1.0"?>
<configuration >

 <appSettings/ >
 <connectionStrings >
  <add  name="ApplicationConnectionString"
   connectionString="[ConnectionString]"
           providerName="System.Data.SqlClient" / >
  <add name="MembershipConnectionString"
  connectionString="[ConnectionString]"
  providerName="System.Data.SqlClient" / >
 </connectionStrings >

 <system.web >

  <compilation debug="true" / >

  <authentication mode="Forms" / >

  <membership defaultProvider="SqlMembershipProvider"  >
   <providers >
    <clear / >
    <add name="SqlMembershipProvider"
     connectionStringName="MembershipConnectionString"
    applicationName="AssetManagement"
    type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" / >
   </providers >
  </membership >
  <roleManager enabled="true" >
   <providers >
    <clear / >
    <add connectionStringName="MembershipConnectionString"
    applicationName="AssetManagement"
    name="AspNetSqlRoleProvider"
    type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" / >
   </providers >
  </roleManager >
 </system.web >
</configuration >
Oh and to add the tables you need to your database use the following command from the command line replacing the words in square brackets with the correct values;
C:\WINDOWS\Microsoft.NET\Framework\[Framework]\aspnet_regsql.exe –E -S [Server] -d [DatabaseName] -A mr
Here is some more info on aspnet_regsql.exe.

2007-07-23

Good Bye Paid Hosting


I have been paying for web hosting for over 3 years and as of this post I will be paying for hosting no more.

It occured to me a little while ago that the only thing I am really using my paid hosting for is my blog and email. While there are plenty of good blog hosting solutions (blogger.com, wordpress.com), I hadn't however found anyway to manage my email with the same control as paid hosting, that was until I found Google Apps.

What is Google Apps you may ask, well Apps is basically a way to assign google services to your domain name. The services that Apps currently supports are:
Why may you ask should I use google apps when I can just set up a gmail account and have all that anyway?
The answer is pretty simple- all these services are run under your domain name. This means that you can set up users and they will have an email address at your domain (ie pete@yourdomain.com) and a document store at your domain as well.

You can even host your own webpage with Google Pages.

2007-04-02

Gremlin in the System

Gremlin in the SystemThe site is back, I got a really large amount of traffic and my webhost shut down my site so that the rest of the websites on the Server still worked
I have moved the gallery to flickr to make the site work faster lets hope it works.
It would of been nice fot them to tell me that they were planning to shut down the site tho.

2007-02-16

Moved to .Net

I recently moved jobs from PHP development to C# .net and that being so decided it was worth completely giving in and changing my webhost to an ASP.NET host.

I have to say that I am very happy with it I am using community server and it is great I can store file, photos all in one program, I will put some more stuff up about community server at a later date.

2006-12-07

My xbox has its own blog

Ok i know this is old news but I think it is pretty cool anyway, my xbox has its own blog it seems that I have been neglecting it but I do have other things to do.

When you go to the blog you will notice that it has a nice gamer card image, I thought it is nice anyway. I was wondering how they got the gammer tag because I would like to add one to this site (so everyone can see just how much I suck) so I right clicked it and saved the image and found it was from www.mygamercard.net and sure enough anyone can get gamer card images, they even have a whole lot a of different styles (Below is an example of one).