Monday, March 01, 2010
#
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
Thursday, February 18, 2010
#
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
Friday, February 12, 2010
#
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.
Tuesday, February 02, 2010
#
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:
Saturday, January 23, 2010
#
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.
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();
Tuesday, January 19, 2010
#
Monday, January 11, 2010
#
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:
Tuesday, January 05, 2010
#
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.
