Monday, March 01, 2010 #

Setting App.Config attributes at Design Time in C#

The App.Config file can be created by changing the Project, Properties..., Settings.

Sometimes the App.Config file seems to bear no resemblance to what is in the settings.

Deleting the App.Config file and adding an empty one does not cause the settings to disappear nor does the App.Config file get automatically regenerated.

To regenerate the App.Config file from the settings one of the settings needs to be changed and the project then needs to be rebuilt.

The best approach I have found is to:

  • Delete App.Config
  • Add New App.config
  • Go to Project, Properties..., Settings and change one setting
  • Rebuild project

 

Project will now have an App.Config file which reflects the Project, Properties..., Settings

 

A good post on Settings is http://geekswithblogs.net/akraus1/articles/64871.aspx

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Posted On Monday, March 01, 2010 7:26 PM | Feedback (0)

Thursday, February 18, 2010 #

.NET DEVELOPMENT WITH ODAC 11.1.0.7.20



I've installed .NET DEVELOPMENT WITH ODAC 11.1.0.7.20 and apart from having to reboot my machine once it looks very good.

I can use a sophisticated set of tools to look at an Oracle database.

Works in VS2008 but doesn't recognise VS2010

http://www.oracle.com/technology/tech/dotnet/col/odac_11.1.0.7.20_data_sheet.pdf

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Posted On Thursday, February 18, 2010 9:05 PM | Feedback (0)

Friday, February 12, 2010 #

Setting App.Config attributes at Run-time in C#

Manipulating app.config attributes at run time in C# appears to be simple. However most of the samples I've looked at don't work or are impenetrable.

Simply in app.config file at design time add some userSettings either manually or through the design window

 

   <userSettings>
        <WindowsFormsApplication1.Properties.Settings>
            <setting name="MyMachine" serializeAs="String">
                <value>zaxcc1Machine</value>
            </setting>
            <setting name="MyMessage" serializeAs="String">
                <value>Helpme</value>
            </setting>
            <setting name="MySubText" serializeAs="String">
                <value>Imintrouble </value>
            </setting>
        </WindowsFormsApplication1.Properties.Settings>
    </userSettings>

 

Then use these values by using Properties.Settings.Default object. Note this must be prefixed by the application name

 

//Using app.config settings
txtIPMachine.Text=WindowsFormsApplication1.Properties.Settings.Default.MyMachine;
txtMessage.Text=WindowsFormsApplication1.Properties.Settings.Default.MyMessage;
txtSubtext.Text=WindowsFormsApplication1.Properties.Settings.Default.MySubText;

 

To change these settings make assignments to them 

WindowsFormsApplication1.Properties.Settings.Default.MyMachine=txtIPMachine.Text;
WindowsFormsApplication1.Properties.Settings.Default.MyMessage=txtMessage.Text;
WindowsFormsApplication1.Properties.Settings.Default.MySubText=txtSubtext.Text;

 

However to persist these changes which will change the associated .exe.config file another statement is required:

//Now persist these changes
WindowsFormsApplication1.Properties.Settings.Default.Save();

 

Only UserSetting (as opposed to AppSetting) changes are persistable at runtime.

 

Now that all looks really promising except that it doesn't actually put the persisted user settings in the appname.exe.config. Instead it puts these in a hidden file for the user in their documents and settings (something like this)

C:\Documents and Settings\FredBloggs\Local Settings\Application Data\Company\MyApp.exe_Url_ywmpcb12duakrunjye5nrdb4hhsecogv\1.2.0.7

The file is always called user.config

This will contain the xml for user settings from above and could be manually altered and will be read in at startup but it's clearly designed not to be. It's obviously also designed to allow different users to have different persisted settings.

   <userSettings>
        <WindowsFormsApplication1.Properties.Settings>
            <setting name="MyMachine" serializeAs="String">
                <value>zaxcc1Machine</value>
            </setting>
            <setting name="MyMessage" serializeAs="String">
                <value>Helpme</value>
            </setting>
            <setting name="MySubText" serializeAs="String">
                <value>Imintrouble </value>
            </setting>
        </WindowsFormsApplication1.Properties.Settings>
    </userSettings>

All I really wanted was a way of persisting some settings when the application is in use and I wanted that in the same folder as the exe. It doesn't really do that but I can live with it.

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Posted On Friday, February 12, 2010 12:05 PM | Feedback (0)

Tuesday, February 02, 2010 #

CSS Stylesheets in ASP.Net

I've not done a great deal in ASP.Net and I've never done anything with Style Sheets.

They are however really simple as long as you remember a couple of things.

Create the css file and add it to your project in Visual Studio. Then drag it to the aspx page (in design view). This will add the lines to the aspx page

<head runat="server">
    <title></title>
    <link href="StyleSheet1.css" rel="stylesheet" type="text/css" />
</head>

Then when designing the css classes use the wizard by right-clicking in the class and selecting build style:

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Posted On Tuesday, February 02, 2010 9:53 PM | Feedback (0)

Saturday, January 23, 2010 #

My Videography has moved to another blog

I've moved all my posts on Videography to my other blog.

http://www.belugaconsultancy.blogspot.com/

I'm keeping this for more technical programming blog posts. It's mostly for my own consumption but happy if it helps anyone else.

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Posted On Saturday, January 23, 2010 6:31 AM | Feedback (0)

LinQ to Objects and Gridview in ASP.Net

I've gathered some data into an object and then done a Linq to that object using code a bit like this:

    //Linq query
     var q = from c in objFlist.Items
             orderby c.Surname
             select c;

     List<clsFileInfo> listOfItems = q.ToList<clsFileInfo>();


      GridView2.DataSource = q;
      GridView2.DataBind();

 

That works fine as long as I let the Gridview organise itself from the data automatically.

To make it more polished I wanted to lay out the columns in the Gridview and add template columns etc. To do this I configured the grid (from it's Gridview Tasks box) to have a Linq to objects datasource with my object as the datasource. This then allows me to add and edit columns and organise it as I want. So far so good. But when I try and run it I get this error:

Both DataSource and DataSourceID are defined on 'GridView2'.  Remove one definition.

 

I've fixed this by inserting the following lines of code in but it seems there should be a better way.

      GridView2.DataSource = null;
      GridView2.DataSourceID = null;   

      GridView2.DataSource = q;
      GridView2.DataBind();

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Posted On Saturday, January 23, 2010 4:26 AM | Feedback (0)

Tuesday, January 19, 2010 #

Videography Nearly Live

Using YouTube you can upload files to an email address as an attachment. It is quite simple to do this directly from my Nokia N95.

I have GMail as my email option in messaging. I can do this in three different ways:

1.Take the video and then opt for send as a message. After that I choose the YouTube upload email address.

2.Go to the gallery and choose the send option. Choose YouTube upload address.

3.Go to message. Choose YouTube upload as recipient. Select Insert, Video clip.

 

To avoid huge accidental data bills I am operating my phone offline in Wifi mode during this upload.

 

This allows me to use all the features of the phones Video camera and also upload much better quality files...

 The subject matter is not very interesting in this video 

 

 

My Live Output is here

 

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Posted On Tuesday, January 19, 2010 1:34 PM | Feedback (0)

Videography Live and Edited

So as well as having my live Bambuser TV channel I am now playing around with the videos I've streamed and uploading them on YouTube. Everything has been shot with my Nokia N95 I'm downloading the .flv files from Bambuser converting with Emicsoft FLV conterter http://www.emicsoft.com/ to .avi and then just editing a bit with Windows Movie Maker before uploading to YouTube:

 

 

My Live Output is here

 

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Posted On Tuesday, January 19, 2010 9:19 AM | Feedback (0)

Monday, January 11, 2010 #

My Own Live TV Channel

I've been playing with streaming live video from my 3G mobile phone which is on the 3 Network in the UK. It's not a very up to date phone. It's a Nokia N95 but it is Wifi enabled.

So far I've tried two services but and I like Bambuser best. This allows my streamed broadcast to be seen live and then automatically saves it for later viewing.

Here are some of my sample broadcasts:

 

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Posted On Monday, January 11, 2010 8:48 AM | Feedback (0)

Tuesday, January 05, 2010 #

Silverlight 4 OOB (Out Of Browser) Application

I was trying to create and run my first Silverlight OOB (Out of Browser) application. It all seems very simple to set up but then it still runs in a browser.

I found the solution but it doesn't seem at all obvious to me.

To set as an OOB application. Choose  Enable running application out of browser as below.

 


 

Then click on the button Out-of-browser settings...

 

I selected bottom two check boxes.

Now I would have thought I'd click run at design time and I would get my application running in a window.

No it doesn't do that it runs in a browser!?!

 

What you have to do now is right mouse click on the browser window and select from the popup menu:

Install Silverlight Application onto this computer

 

 

This then allows me to install the App on the Desktop and I can run it from there as I wanted Out of Browser

 

 

Now all I suppose I need to do is write a useful application.

 

 

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Posted On Tuesday, January 05, 2010 12:01 PM | Feedback (1)

Copyright © BelugaNeil

Design by Bartosz Brzezinski

Design by Phil Haack Based On A Design By Bartosz Brzezinski