Archive

Archive for the ‘Computers and Internet’ Category

Windows 8 and The Beach

October 27, 2012 Leave a comment

OK, let’s get one thing straight from the off – I am not referring to ‘The Beach’, the well known book-to-film creation by Alex Garland. Incidentally, it was directed by Danny Boyle, the same guy that designed the opening to the London Olympic games – just after completing a film where someone gnaws their arm off in disappointment. I’m sure I’ve heard that somewhere before.

Anyway, not that beach. But I digress, you’re far more interested in the whole Windows 8 thing, eh? Aren’t you? I mean that’s what you searched for when you got here, right? Good – then I’ll begin:

It’s installed. I partitioned away a little side alley of hard disk space to allow me to start up in imageWindows 7 or Windows 8 – a neat little trick which gives me a fancy blue menu with icons (none of this text based rubbish we’ve been used to in the past). Nothing particularly clever required – simply bought Windows 8 online, downloaded it, burned it to a CD (all of which it did without me having to intervene – Windows 7 will burn DVDs; although, I was told that Windows XP and Vista may require additional ISO to DVD burning software for this bit).

Once burned a reboot caused my PC to start from the DVD and after about half an hour I had a dual boot hard disk with Windows 8 unable to connect to the internet. Obviously, had I not bothered to create this state of dualistic preposterousness, the upgrade of my existing Windows 7 would have been a breeze and my network connection intact.

So, having got over feeling somewhat preposterated, I thought I’d try using the thing image(Windows 8 that is). First things first, I connected my Windows login to a Hotmail account which made everything fantastic – I won’t tell you why, I just wrote it down and it was the most tedious sentence I have ever written – so find out for yourself.

I’m playing music, writing software, writing a blog post, browsing Wiki (honestly, I actually ended up reading about Azure Damsel Flies and then the colour Azure blue – the page was so enticingly rendered before me); Skype’s running in the background and from time to time I have asked Google (with my microphone) to search for ‘Penn Treebank tags’. The latter was a pain in the backside – and not just because of my seated position, but, more importantly, because I had to put on an American accent for it to understand me properly.

A fantastic old book ‘I Seem To Be A Verb’ caught my eye during my web travels within Windows 8. I tried to search for more information with Google – but Google insisted I was looking for a book called ‘I seem to be a…’: ‘phone’, ‘fun’, ‘above’, ‘B of A’, ‘availab’ or a myriad of other quite reasonably abstract things (given the content of imagethe book). Apparently, it’s going around that ‘I seem to be an idiot for not typing the request in the first place’. Which, I have to say, I tend to agree with.

It’s by this chap who seemed to be interested in ‘the sustainable planet’ long before it caught on – if you can’t be bothered to do anything else go to Amazon and request it on Kindle – just to annoy them, who knows, they may do it. Remember, if every trim-tab does it the Queen Mary will change direction – or something like that; although I think it’s just wishful thinking.

Anyway – Windows 8, seems pretty good; and this whole ‘mobile technology’ thing that they have going on with their apps is saving memory and processor time something extraordinary (when apps are not imagedirectly in use they pretty much drop down to no CPU usage – so, I guess I’ll use less electricity and I won’t memory-fault – or something) – it’s also seemingly much easier to understand what’s going on without having to resize windows (everything is full screen by default).

Right – must get on as ‘Time is a Jailer’ and with the music on this loud the ‘Sound of the Suburbs’ will be disturbed despite my double glazing (‘Right Through You’). Finally, in Total Contrast to all that: ‘Takes a little time to get it right, Don’t you believe in love at first sight…’; reminds me of a weird pub in Oslo – or does it?  And on that note…

I’ll be utterly bedgasmed in just a few minutes – and no, that has nothing to do with living in Essex – thank goodness; oh and damn, I was planning to go to the beach today and stand on a groin… Maybe next week.

Advertisements

JQuery Isolation

June 28, 2011 Leave a comment

JQuery

Ever wanted to create a control that could be included on third-party websites? One that smartly loaded up all the JavaScript it needed and execute without any noticeable clashes with JavaScript objects on the third parties web page?

Wanted to do all this and use JQuery as well? Then, as you add those script and CSS tags to their head section programmatically and then include your own JavaScript file that relies on JQuery you find…  runtime errors…

And all because the lady loves milk-tray. No she doesn’t. Well she might. But more to the point your JQuery reliant code must be isolated from the JQuery reliant code on your ‘hosts’ page – as they might use a different version, after all. What a nightmare. How the hell are you going to sort that mess out? Surely somebody who knows the internals of JQuery has taken a look at this, you plead to your coffee mug at 3:25am as you stare out into the darkness of night through the rain covered window…

Thankfully they have. It’s here:

https://github.com/quickredfox/jQuery-Quarantine/blob/master/README.md

I updated it (adding my own extension to the namespace) and including my own CSS and js files along the way. The real clever stuff is the redirection of the callbacks – although, for the most part – if you’re happy to add your inconsequential code to the onload callback in the source file itself, you can ignore the callbacks and the interfaces that go with them completely.

Grab the source and start updating – the A-Team in me says: Works for me! Thankfully a 3 hour bout of depression should free me of such mindless idiocy.

The delights of SqlMetal: Multiple ResultSets from a stored procedure

May 17, 2011 5 comments

Ever wanted to return multiple result-sets from a stored procedure using Linq to SQL? Well I have and, like you if you’re reading this, I found that the default settings in Visual Studio generated code did not allow it. The problem was that the code generated only returned the first result set from the stored procedure. I.e:

SELECT * FROM USERS
SELECT * FROM ROLES

Gave me an IEnumerable return value. Now this just wasn’t good enough; so without further ado here’s the simple code to create a database entities ‘later’ using SqlMetal (a Microsoft authored tool supplied with both Visual Studio 2008 and 2010). First of all, the easiest way to start this tool (as with all Visual Studio tools) is to open the command window within the Tools sub-menu in the Visual Studio section of the Start menu.

Once in try this:

SqlMetal /server:. /database:MyDb /code:”DalEntities.cs” /sprocs /namespace:DalEntities /pluralize /serialization:Unidirectional

…and you’ll find that magically the usual dbml style generated code is produced and placed in DalEntities.cs – in this particular case with all the Stored Procedures included also.

What’s more, as previously said, the tool supports multiple result-sets to be returned from stored procedures. As shown below:

[global::System.Data.Linq.Mapping.FunctionAttribute(Name="dbo.TestStoredProcedure1")]
[global::System.Data.Linq.Mapping.ResultTypeAttribute(typeof(TestStoredProcedure1Result1))]
[global::System.Data.Linq.Mapping.ResultTypeAttribute(typeof(TestStoredProcedure1Result2))]
public IMultipleResults TestStoredProcedure1()
{
	IExecuteResult result = this.ExecuteMethodCall(this, ((MethodInfo)(MethodInfo.GetCurrentMethod())));
	return ((IMultipleResults)(result.ReturnValue));
}

It’s like magic, I tell ye!  Have fun!

Loading an assembly from a specific directory (i.e. when not in GAC)

March 20, 2011 Leave a comment

C# Post HeaderJust like dynamically loading DLLs with C# – at last!

You do not have to put an assembly that an application must use at runtime in the bin folder of the application. You can put the assembly in any folder on the system, and then you can refer to the assembly at runtime.

My preference – which requires no configuration during installation – is to use method 3; just find your current executable’s folder and calculate a relative path from there – ensuring that, even when the app is copied using a standard file copy, it still works on the new server (shedding any deployment requirements with regard to this). See here:

http://support.microsoft.com/kb/837908

Categories: C#

JQuery – Scroll up Headline Display

October 18, 2010 Leave a comment

JQueryA really simple newsfeed scrolling display – at time of writing only displays one item at a time, but the author intends to write a multi-item display version before long: http://www.learningjquery.com/2006/10/scroll-up-headline-reader

Just in case the original source disappears here’s the code from that page:

HTML:

   1:  <div id="scrollup">
2: <div class="headline"> ... </div>
3: <div class="headline"> ... </div>
4: <div class="headline"> ... </div>
5: <div class="headline"> ... </div>
6: </div>

CSS:

   1:  #scrollup {
2: position: relative;
3: overflow: hidden;
4: border: 1px solid #000;
5: height: 200px;
6: width: 200px
7: }
8: .headline {
9: position: absolute;
10: top: 210px;
11: left: 5px;
12: height: 195px;
13: width:190px;
14: }
 
Javascript:
   1:  var headline_count;
2: var headline_interval;
3: var old_headline = 0;
4: var current_headline = 0;
5: $(document).ready(function(){
6: headline_count = $("div.headline").size();
7: $("div.headline:eq("+current_headline+")").css('top', '5px');
8:
9: headline_interval = setInterval(headline_rotate,5000);
10: $('#scrollup').hover(function() {
11: clearInterval(headline_interval);
12: }, function() {
13: headline_interval = setInterval(headline_rotate,5000);
14: headline_rotate();
15: });
16: });
17: function headline_rotate() {
18: current_headline = (old_headline + 1) % headline_count;
19: $("div.headline:eq(" + old_headline + ")")
20: .animate({top: -205},"slow", function() {
21: $(this).css('top', '210px');
22: });
23: $("div.headline:eq(" + current_headline + ")")
24: .animate({top: 5},"slow");
25: old_headline = current_headline;
26: }

MS Reporting Services Error

October 4, 2010 Leave a comment

I’ve had an issue, a couple of times now, with Reporting Services when emailing attachments (this can occur with automatic distribution of Team Foundation Server system reports). It is a known issue with RS. The fix requires administrative access to Active Directory – which I rarely have as a contract developer.

Here’s the MS help on it:

http://support.microsoft.com/default.aspx?scid=kb;en-us;842423

…and here’s the log file entry they refer to (from problem logs I have seen in the past):

Read more…

JQuery Multiple Selection Drop Down List…

June 26, 2009 Leave a comment

JQueryNot wanting to appear too geeky at this late stage in the day – but…  This is bloody fantastic! …or, perhaps I should say – this has been implemented to the highest professional standards.  Quite simply spiffing stuff. Change a select tag into a proper drop down list that looks as good as the real thing and works in all browsers.

Here it is in all it’s glory (with inline examples of the thing working – and source code links):

http://dropdown-check-list.googlecode.com/svn/trunk/demo.html

%d bloggers like this: