Rocamadour

​Rocamadour, or the Rock of Amadour is a town church and fortress built into the edge of a cliff.  It’s reliquary attracted pilgrims in previous centuries, and it has the Stations of the Cross set on a path winding from the church to the top of the cliff.

Posted in Uncategorized

Above or Below the Line. Senate candidate chaos.

At the coming election, forty different parties are fielding 97 candidates in Victoria for the Senate.  Twelve will be elected.  Is it worth using preferential voting, or do you vote above the line and trust that the party you’ve chosen distributes preferences in the same way that you would?  I discovered that changes in the “political landscape” have happened between now and when the preferences were allocated by my favoured party and aren’t to my liking any more.

But it’s not hard to make a mistake writing in the 97 numbers and rendering your vote informal, so the decision to use one method over another needs a bit of thought.  Regardless, the mainstream media only seem to be interested in the Red Party and the Blue Party, so unless you’re voting for them you need to so some digging to find out who’s who.  So I dug.

I went to: http://www.aec.gov.au/election/vic/wills.htm to get the Senate candidates for Victoria.  Then I looked up each of the parties’ policies and distilled them into a couple of lines.  I glossed over the four major parties.  What I found appears at the end of this article.

This (occasionally tongue-in-cheek) analysis takes the candidate’s and parties’ policies at face value and discounts things like front parties and politicians’ remarkable ability to tell porkies for the sake of getting elected, but you have to start somewhere.  For the parties whose policies interested me, I used this web page http://www.aec.gov.au/election/vic/gvt.htm and Microsoft Excel to work out which way their preferences flowed to winkle out a few front parties and to get a feel for how the parties that I liked were directing their preferences.

This gave me a rough idea of how I would like direct preferences in the Senate, but it’s still a monster task. Luckily there are websites that will let you create your own how-to-vote card.

Cluey Voter lets you rate each of the parties on a five-point scale and creates a first draft of the how-to-vote card which you can manually edit before printing.  I wanted something a bit more precise.

I used a combination of Below the Line to set up a first draft by selecting the preferences of my preferred particular party and I transferred them by hand to senate.io, then I rearranged preferences by party, and printed a PDF of the how-to-vote card.  I would have used senate.io for the whole job if I could have pre-loaded it, because it’s easier to rearrange than Below the Line and tells you when you have a formal vote.

I’ll still have to transfer the preferences onto my ballot paper at the polling place, but it will be much easier than trying to remember the position of 97 numbers.

But before you vote below the line, think of the people at the Australian Electoral Commission who are counting the vote.  After my father voted below the line in early voting, he told a friend who works for the AEC.  The AEC worker’s response:  “You bastard!”

The parties nominating for the 2013 Senate election.

Animal Justice Party : Single issue party. Pro: vegetarianism, protection of Australian animals, being kind to animals Anti: International trade in animals, using animals for sport, exhibition and entertainment, animal research and experimentation

Australian Christians: Anti: Same-sex marriage, prostitution, Drugs, alcohol, tobacco,  assisted suicide, abortion Pro: Stay-at-home mums, bible, religious schools, public transport, renewable energy, internet censorship

Australian Democrats: Still around. Broadly developed policies.  Pro: social equality, multiculturalism, renewable energy, balanced industrial relations

Australian Fishing and Lifestyle Party: Single issue party – Access to Australian fisheries for commercial and recreational fishing

Australian Independents: Lower taxes, budget surplus, high-speed rail, regional and rural rail, support small business, increase childcare, support the disables and carers, seniors, increased funding for health, housing affordability, less poverty and homelessness.

Australian Labor Party: The current government.  You may be familiar with them.

Australian Motoring Enthusiast Party: Woolly statement of policies – Anti Green, preferenced “radical extremist parties” last, Greens next last behind , preferenced Labour and Liberal third last, split other parties after Labour/Liberal, before AMEP

Australian Republicans: Single issue party – Establishment of an Australian republic, with a bill of rights and a review of the system of government, secular-humanism, no emissions trading scheme, zero net migration

Australian Voice Party: Food security, Illegal immigrants, Small business, housing affordability

Bank Reform Party: Single issue party – Regulation of consumer banking interest rates

Building Australia Party: Sell the ABC, Reduce superannuation for politicians, protect the building industry, housing affordability

Bullet Train For Australia: Single issue party – Create a high speed train network for Australia

Citizens Electoral Council: Followers of Lyndon Larouche’s policies.  Pro: Protectionism, nationalization of oil and gas, state infrastructure construction, creation of government owned banks. Anti: Privatisation, drug liberalization

Country Alliance: Policies for rural citizens.  Pro: fishing, hunting, logging, water entitlements Anti: carbon tax, poker machines, public asset sales

DLP Democratic Labour: “To establish, under Almighty God, the political, legal, social and economic foundations for a just, free and democratic society and for a self-reliant and secure Australia.”  Favoured by the Roman Catholic church

Drug Law Reform: Single-issue party – Decriminalization of illicit drugs, royal commission into illicit drugs

Family First: Anti: Same-sex marriage.  Pro: families.  Policies are largely motherhood statements.

Greens: That obstructionist mob in the Senate

Help End Marijuana Prohibition (HEMP) Party: Single issue party – Re-legalize and regulate cannabis/hemp for personal, medical and industrial use

Katter’s Australian Party: Pro: Christian values, national economic self-sufficiency and sovereignty,  Security of national food, mineral resources and land, home ownership, banking control  Anti: same-sex marriage

Liberal: You know who they are

Liberal Democrats: President also the president of the Stop the Greens Party.  Pro: assisted suicide, small government, balanced budget, legalized cannabis, free trade, gay marriage.  Anti: foreign aid

Nationals: In bed with the Liberals

No Carbon Tax Climate Sceptics: Single issue party – No carbon tax.  ‘Climate science is far from “settled”‘.  Ok, they believe science is a matter of opinion rather than fact.

One Nation: Pro: Assisted suicide, enhanced personal identification documents, industry protection, home ownership, citizens initiated referenda, limits on foreign investment Anti: Multiculturalism, refugee arriving on boats

Palmer United Party: Started by mining magnate Clive Palmer.  Pro: Nationalism, mining, wealth distribution to the region that generates it. Anti: political lobbyists, carbon tax, boat arrivals

Pirate Party: Pro: Digital privacy, copyright and patent reform, renewable energy, gay marriage, drug liberalization, assisted suicide

Rise Up Australia Party: Evangelical Christian, socially conservative Anti: Homosexuality, abortion, multiculturalism

Secular Party of Australia: Pro: gay marriage, assisted suicide, a citizen’s bill of rights, intellectual property rights  Anti: internet censorship

Senator Online: “SOL policies are not predetermined nor set”.  Senators vote in line with votes received online.

Sex Party: Pro: drug decriminalisation, church taxation, abortion rights, assisted suicide, same-sex marriage, data privacy, uniform censorship, secular education, equal rights, paid parental leave

Shooters and Fishers: Single issue party – Rights to own and use firearms, rights for recreational fishing, 4WD access to state parks

Smokers Rights: Single issue party – Lower cigarette taxes, repeal bans on smoking in public places, abolish tobacco plain packaging

Socialist Equality Party: Jobs for all, guaranteed living wage, free health, free education, right to housing, nationalise banks and major corporations, clean and safe environment

Stable Population Party: Single issue party – Population of Australia to be 23-26 million through to 2050

Stop CSG: Single issue party- “Protect communities and farmland from invasive coal seam gas mining by pressuring government to ban CSG”

Stop The Greens: President also president of Liberal Democrats. Aka Outdoor recreation party.  Pro: 4WD rights, fishing, shooting, hunting, forestry, motoring

Wikileaks Party: The free flow of information, reform of media policy, internet privacy and freedom, whistleblower protection, expose collusions between Australian state and military-industrial complex.

Group AJ –  Independent, Bob Nicholls: Pro: Same sex marriage, abortion rights, assisted suicide, equal opportunity

Group T – Independent, Joseph Toscano: Medical practitioner,  broadcaster and anarchist

Ungrouped – Darrel S Morrison: Independent centre left

Ungrouped –  Lyn Gunter : Bushfire recovery

Posted in Uncategorized | Tagged , ,

Dynamic Data Websites

Dynamic Data Websites generate web pages at run time, enabling CRUD operations.

DataContext

  • Forms the basis of the database access layer in the website
  • Defines a connection to a physical database and provides an object model of the database
  • Objects map to database tables
  • Object model properties map to database fields
  • Provided using LINQ to SQL classes (DBML file) or ADO.NET Entity Data Model (EDMX file)
  • The data context is registered in global.asax:
      DefaultModel.RegisterContext(
        typeof(PlaneBusTrainModel.PlaneBusTrainEntities), 
        new ContextConfiguration() { ScaffoldAllTables = true });
      

Templates

Page Templates

  • Provide a framework for each type of page to be dynamically generated:
    • List.aspx
    • Edit.aspx
    • Details.aspx
    • ListDetails.aspx
  • Can be customised

Field Templates

  • Render appearance and functionality of data context properties
  • Implemented as a user control, inheriting from FieldTemplateUserControl
  • Display and edit field templates exist for each data type.  The edit field templates include a text box and RequiredField, RegularExpression, Dynamic and Custome validators.
  • Can be edited to change their behaviour
  • New controls use metadata to specify which properties in a data model use the control

Entity Templates

  • User controls used by page templates for displaying and editing data

Partial Class Metadata

  • Data Context (EDMX/DBML files) classes are constructed as partial classes
  • This allows extension of the classes, enabling customisation of database fields are presentation validation
  • The extension classes are defined in the App_Code folder as partial classes with the same names as the Data Context classes
  • Create a Metadata class inside the new partial class file
  • Each of the properties to be modified should be declared as objects and decorated with metadata classes:
    • MetadataType: Associates the data context class with the metadata class
    • Presentation:
      • Display: Name, column order, etc.
      • Editable
      • UIHint: Custom field user control
      • DisplayFormat
      • ScaffoldTable: Whether a table should be shown as a dynamic page
      • ScaffoldColumn: Whether the column should be shown in a dynamic page
    • Key: Sets a field as a unique key for a collection of objectsAssociation: Marks a property as a data relationship (e.g. foreign key)
    • Validation:
      • EnumDataType
      • DataType: Field’s data type
      • StringLength
      • Required
      • Range
      • RegularExpression
      • CustomValidation: Custom method

Dynamic data routing

  • Pages are constructed dynamically, so web page addresses don’t exist until runtime.
  • Dynamic data routing specifies URI formats for navigation to each table’s CRUD pages
  • ASP.NET Routing engine parses the URIs and instantiates the appropriate web page template populated with selected data
  • Default format is table/action.aspx
  • e.g. http://website/products/Edit.aspx?ProductID=1
  • In Global.asax:
    • DynamicDataRoute class is instantiated and added to the RouteTable.Routes collection
 routes.Add(
  new DynamicDataRoute("{table}/{action}.aspx") {
    Constraints = new RouteValueDictionary(
      new { action = "List|Details|Edit|Insert" }),
    Model = DefaultModel
});
Posted in ASP.NET, LINQ

Entity Framework Metadata and Connection strings

Entity Framework metadata is stored in a projects edmx file.

The file contains the following metadata sections:

Metadata section Purpose xml element resource name extension
Storage Models Describes the data store objects imported into the entity model <edmx: Storage Models> ssdl
Conceptual Models Describes the presentation to the programming layer of the data model <edmx: Conceptual Models> csdl
Mappings The mapping from the data store to the EDM conceptual schema <edmx: Mappings> msl

When the application is compiled each metadata item is supplied to the application as embedded resources or files on the disc.

Files

metadata=”C:\dirname | C:\dirname\mapping.msl”

In this case the ssdl and csdl files will be searched for in dirname and mapping.msl will be used as the msl file.

Resources

Naming format: metadata=res://<assemblyFullName>/<resourceName>

If a wildcard (*) is provided for assemblyFullName the entity Framework searches for the resource in this order:

  1. Calling assembly
  2. Referenced assemblies
  3. Assemblies in the application’s bin directory
Posted in ASP.NET, LINQ, SQL

Monitoring an ASP.NET Web Application

Events

WebBaseEvent Base class for all web events
WebManagementEvent Base class for application process information
WebHeartbeatEvent Raises information about application at set intervals
WebRequestEvent Base class containing web request info
WebApplicationLifetimeEvent Significant events, e.g. startup, shutdown
WebBaseErrorEvent Base class for error events
WebErrorEvent Application error information
WebRequestErrorEvent Request data for request errors
WebAuditEvent Base class for audit (security) events
WebSuccessAuditEvent Successful security operation
WebAuthenticationSuccessAuditEvent Successful user authentication
WebFailureAuditEvent Failed security operation
WebAuthenticationFailureAuditEvent Failed user authentication
WebViewStateFailureAuditEvent View state failed to load (tampering)

Event listeners

  • WebEventProvider class
  • EventLogWebEventProvider – Writes events to the event log
  • WmiWebEventProvider – Writes events to Wmi
  • SqlWebEventProvider – Writes events to SQL

	
		
			
				
			</rules
		
	

Event viewers

  • Application event viewer
  • Wmi
  • Sql tables (?)
  • Custom
Posted in ASP.NET, Visual Studio

Tracing

Settings

In web.confing <trace/>

  • ASP.NET web site administration tool has a UI to manipulate these values

enabled true/false Tracing information is captured
pageOutput true/false Displays tracing information directly on the page
localOnly (true) Trace runs only for requests coming from the host computer
  false Trace runs for all requests
traceMode (sortByTime) Events in chronological order
  sortByCategory Events groped by category
requestLimit Numeric (10) The number of records to hold in the trace log
mostRecent true Cache updates holding only the latest results
  (false) Cache stops updating as soon as requestLimit is reach.  Website must be restarted or the cache cleared to resume logging

Page level

<@ Page trace=”true” …/>

Viewing the log

http://server/application/trace.axd

Custom Trace Data

System.Diagnostics.Trace class

Page.Trace

Trace.Write(category, message);

ASP.NET AJAX

Results can be viewed in:

  • Visual Studio output window
  • TextArea with ID=”TraceConsole”
  • Apple Safari or Opera debugging console

Sys.Debug class

assert  
trace Writes a trace message to a console
clearTrace  
traceDump  
fail  
Posted in ASP.NET, Visual Studio

Debugging

Enabling

  • adds debug symbols into the compiled code
  • transmits error information to the web browser

Development environment

Right-click web site, Property Pages, Start Options, ASP.NET checkbox

Web site

web.config


	
		
	

Individual page


VS 2010 Features

Export and import breakpoints

Data Tips – Tooltip-like watch points.  Can be imported and exported

Custom Error Pages

 


	
		
			
		
		

Site-Level

  • mode:
    • On – Site should only display custom errors
    • Remote Only –
    • Off –
  • defaultRedirect indicates the path to a default error page for unhandled exceptions
  • The path of the query string is passed to the page as the named parameter aspxErrorPath

Error-Specific

  • error element redirects to a specific page for the nominated HTTP statusCode

Remote Debugging

Install Visual Studio Remote Debugging Monitor (msvsmon.exe) on server to debug

Set server’s remote debugging security options

Open VS and the solution to be debugged

Debug, Attach To Procees –> Attach to the server running msvsmon

Client Script

Configuration

Internet Explorer: Tolls, Internet Options, Advanced tab, Browsing node, clear Disable Script Debugging (Internet Explorer) check box

Posted in Uncategorized