Blog Archives

The First Step of Many

Lock-iconIt has been a while since I have posted anything.  And now, I will post about a topic very near to my heart and certainly an area I know a great deal about, more so than I believe anyone the Australian Government is seeking “guidance” from with regards to the retention of metadata.

First things first, metadata is descriptive data.  Databases and spreadsheets all contain forms of metadata from the schema (layout) of the tables and fields, columns and rows to people who wrote it, the time editing and other data.  Such data is used many times with indexing services, it is able to read some of this metadata and also search on this data.

image

This is just the tip of the iceberg, this document I am showing the properties of has this metadata attached (I will look into this data as well shortly) but any computer to computer communication requires metadata.  Most of it harmless and of little importance but in reality it is a symptom of the Internet we setup for ourselves and now so heavily rely on that changing, at its core, the way networking hardware communicate together would surely cause an outage on such a scale, we would not be willing to do it.

That said, the issue is not so much that data is collected, each hardware will have logs of varying levels capturing the data which can, with little effort personally identify you.  A number 162.162.162.162, is your address on the web.  This address is allocated to you by your ISP and ISP has a log of which account was allocated this IP (Internet Protocol) Address.  This address, that web sites also have is resolved through a DNS (Domain Name Server) which translates the name, http://www.websitename.com to 185.185.185.185 and it routes it around the web finding that address and once found the data is this returned to the address that asked for it, you.

All of this data, is kept, there are flagged sites that when ISPs detect you have gone to one of these flagged sites your details, date, time, IP address and so on are sent to authorities.  But, normal use is merely logged.  The laws in Australia force the ISPs and telecommunication companies to retain this data and provide it to one of the policing bodies like the AFP (Australia Federal Police) or any of the state counterparts, ASIO and ASIS (ASIO is international, ASIS is domestic) even bodies like the CCC (Corruption and Crime Commission).  All of them can request without warrant this data from the various companies who collect it providing it forms part of a legitimate investigation.  They don’t need to be looking for terrorists or potential jihadists, in fact the AFP has requested much of this data around government leaking of data because in Australia it is against the law to leak information even if considered in the best interesting of the people it is still illegal.

If they are getting access to this data now, why the bother?  Well the law has made it easier to get.  There is a judge who oversees granting approval (I am not sure if that is who it is or not) but they are appointed by the PM of the day and has now judicial oversight it is also now illegal to state if any permission to seek data was made if it was made or not.  This is what should be ringing alarm bells everywhere, we have one person, who says “yes” or “no” as to whom can get the data which can personally identify you and where you have gone not to mention that don’t report to anyone they are not an independent or need to be, there doesn’t need to be bipartisanship with the government or opposition as it is just the Prime Minister who appoints them and any case they look into, it is against the law to even report about it. 

This is an issue as massive one since we might be looking at merely the descriptive data of our activities on the internet but this can tell a lot about a person, and information in a political world is capital and a lot of it as well.  So don’t be surprised if the laws are used for less than the predefined reasons such as policing and counter-terrorism.

How can one get away with hiding themselves on the internet?  How can I stops anyone knowing where I have been?  Well if you communicate through the internet it is a difficult one to hide your footprints.  Using a TOR browser1 will help remove your source location when browsing the regular web.  But one of the metadata elements that is collected is what browser you are using so they will now that using that browser will mean you are hiding details but since it will take more efforts to locate you it isn’t needed. 

But this post isn’t about using TOR or other mechanisms to avoid detection as the only way to not have data on the internet collected is to stay off it.  Using the technology of old will help, traditional letters, dead drops and location marking, meeting face to face.  If you need to get information out and to other people find a way that doesn’t involve communication through media.  Or use heavy traffic and generic areas, high traffic twitter posts as long as mentions were done, using aliased accounts internet cafes and cash will hide it (but understand using an internet cafe to access an account will compromise the account as often they have key loggers so they would be one use only. 

We are heading backwards in terms of privacy in this country and which opposition is going to be strong enough to stand up for it when we have the fuel being tipped constantly on the fire of cafe sieges and regular people heading over to Syria and Iraq to fight for ISIL and anyone who stands up for their privacy is on the terrorists side.  That I should be OK with prying eyes looking at where I have been as long as I have done nothing wrong, but I don’t like it when laws come in like this as all it takes is for someone with an agenda beyond that of terrorism like saving the kids from pornography and we have a brand new spying going on.

 

  1. TOR Browsers are used to get access to what is called the Deep Web.  An area of the internet that is not indexed on your usual search engines like Google or Bing.  The reason for this is they use a different protocol header, normal web uses http or https but the deep web uses often tor.  Using these protocols tells the browser to go to certain routers on the web to find the data as the usual routers will not know where to redirect your traffic to.

Brand loyalty in the PC World

Hardware-Chip-iconWe have seen it in so many areas of life.  Coke v Pepsi, PlayStation v XBOX (Nintendo is as Nintendo does as are their fans).  Like footy teams we pick it, we stick to it and we will hopefully never let our belief waver that we have picked the wrong side by providing any number of logical and very much unorthodox arguments over the choice of one said team over another.

I was looking at PC part prices as I wanton to do and I saw a special for an AMD Radeon card.  If someone was close to me they would have heard me mumble I will never buy and AMD card again.  It dawned on me on this loyalty and if I was rightly justified in my belief.  I have used AMD hardware before, so I believe I have a valid reason for not wanting to go down that path again.  Though to the fan boys out there it would seem petty and because I wasn’t going to show it love, then I deserve not have have the love returned.

Why no AMD?  I have used three AMD devices in the, a CPU from the old days and 2 video cards, one being a desktop the other being a laptop.  Back in the days with the CPU, PC parts were VERY expensive and one was looking for the next upgrade without the least expense.  I was looking to upgrade my current Intel 486 DX2-66 this lead me to the AMD Am5x86 chip. 

It sat into the slot on my motherboard, which was handy, didn’t need to worry upgrading that part, it gave Pentium performance and was cheaper than Pentium which at that time was having Floating Point issues and also required a different motherboard than I had.

Why did Intel name their new processor the Pentium instead of 586?  Because on a Pentium when you add 100 to 486 you get 585.99999999999999. 

So I did it.  I drop what little cash I had, put the chip in, using careful levering of the old chip out and the new one in.  I turned it on, I knew at worst I would have to re-install my Operating system, which was Windows 95 at the time but I was hoping for it to work.  And…

It did, until…

I am wanton to rebuild my PC from time to time, by that I mean, perform a clean install.  There are a couple of reasons one being I find that a clean machine is a lean and mean machine, the other is also about backing up and making sure I have access to all my data offline, since I am often performing a low-level format of the disk during this process.  Must scrub clean all that nasty pornography so the police don’t find it.

So, I decided that this day was the day I needed to perform my re-install.  Found all the disks, Windows 3.11, MS DOS 6.22 and my Windows 95 upgrade disc, I got it and Office 95 for free, I still have the box of Windows 95 Smile yes cool and nerdy.

The path was, Install DOS, Install Win95, when prompted for upgrade use the Windows 3.11 disk when prompted.  All was good, install DOS, first problem.  DOS installer wasn’t working as expected.  These were also the days when the Internet was not common on all PCs and I did have it on my Windows 95 machine but, well it was not even running DOS yet so no good.  One just had to plod through the issues and get it working.

I will not go through this problem but suffice to say, 3 days later I got Windows 95 running.  Phew.  First time I had issues.  Before with my old Intel chip, I had done 2 re-installs without issue.  So, this put me off.  There was also a problem my friend had with a Cyrix Processor.  So, since I had no issues with Intel CPUs, I have stuck with them.

Intel 486DX2-66, Pentium II, Pentium III, Pentium 4 HT, Pentium Core2 Quad, i7, I have not has issues with any of these processors and my first foray into overclocking happened in the Pentium III when I overclocked my Pentium III from 450MHz to 550MHz a 22% gain in performance not too bad.

My next test into AMD was the AMD Radeon 5770HD with 1GB of DDR5 VRAM, it was a great bang for buck card with the research I had done.  Lots of recommendations on it.  It wasn’t too expensive and it was a considerable bump in performance from my NVIDIA 9400GT.  When I got this there were a couple of games I played regularly, in that I mean I come back to them frequently, I still do now, so any system I have needs to run these games.  One is The Movies, by Lionhead Studios, Age Of Empires II by Ensemble Studios and Knights of the Old Republic by BioWare. 

The Movies gave me hope since it would come up with an ATI logo when starting which meant that ATI supplied them cards and it did.  Age of Empires, it is solid and works, I can even run it in a Virtual Machine.  Knights of the Old Republic was the issue.  Upon looking around the internet, there were workarounds for this issue, it related to the OpenGL drivers for the ATI Cards.  I needed to copy the OpenGL driver into same folder as the game. 

That was strike 2, I shouldn’t need to do that.  I didn’t have to do that on my NVIDIA card why should I on an AMD one.  So, one last chance to impress.  Not long after that I was in the market for a laptop.  I saw in the paper a sale on, I went there, my Wife didn’t want to come in happy doing word puzzles in the car, I went in and game out with a brand spanking new HP DV7 laptop.  It was faster than my Intel Core2Quad at home as it had an i7 in the guts as well as an Intel 3000 HD video card and an AMD 6770M 1GB DDR5 chips as well.

It was a nice machine, nice and quick, I upgraded the HDD in it as there were 2x 750GB 5400rpm drives in it, I made them 7200rpm drives.  Performance wise it is nice, I can overclock it, it gets a little warm but I use it mainly for playing SWTOR while I am away from home and it did the job until a driver update from HP went awry and SWTOR stopped playing.  Putting this at a driver issue from HP I though I would go get the Mobility driver from AMD…. NO.  I can’t do that as I need to download the verification tool, which I did and it told me it isn’t compatible.  Thankfully, I was able to get SWTOR running again, I rollback the driver and it worked, but performance (which was the reason for me upgrading) was terrible.

One might think this is HPs fault, and that is what AMD say.  We let companies use our hardware but we are not responsible for the way they are implemented or the drivers they supply.  The other issue is also they do not provide a fall back either.  Which is poor service on AMDs part.

HP Driver Release – 2011-11-18 , Version 8.882.2.3000

AMD Driver Release – 2013-12-18, Version 13.12

Yes a large difference between the driver versions.  Now NVIDIA devices in notebooks, work with NVIDIA drivers, no issues.  But to Install Reference Drivers, Install New drivers, re-install reference drivers, update driver from Device Manager.  To do this just to get the driver working and at proper performance it bad not only from HP but also from AMD who simple washed their hands of the matter.

Strike 3 Thumbs down

So, this experience has put me squarely into NVIDIAs camp and Intel’s camp and I might pay more for it but I haven’t had issues.  I have also maintained loyalty on Seagate drivers as I have had some issues with WD devices.  Strange how these problems can create loyalty in one brand or another.

The Conservative Nature of VB (Part 4) – Use Before Assignment

vb-179

Number 4, in my series regarding the Visual Basic warning settings.  This one is an interesting one but comes from a long held problem from the days of old in Visual Basic.  Using a variable before anything has been assigned to it.  In languages like C# and C++ variables need to be assigned before they can be used, in C# if you have some simple code;

int myNumber;
if (myNumber == null)
	Console.WriteLine("My number is null.");

There will be an error reporting the use of an unassigned variable.  Why?  Often it is the way the items are created in memory.  The application will request an address for the Integer (4 bytes) to store the value that will be aliased by myNumber.  You get the address space and it contains what WAS at that address, it could be nothing it might not be.

I am aware that int types are not nullable.  But it is an example only.

But in VB, this is a different kettle of fish.  All intrincic types are assigned a value when it is created.  Take the following code;

Dim myNumber As Integer
If myNumber = 0 Then
	Console.WriteLine("My number is 0")
Else
	Console.WriteLine("My number is " & myNumber.ToString())
End If

Fairly simple as far as a VB application is concerned.  But if you open the the assembly of the application, you will notice;

mov	dword ptr [ebp-40h],0

This says, move the value 0 into a double word (32bits) pointing to the ebp (display the registers to see the value of this)minus 40H.  So, without performing any initialisation at all, I was able to declare the value and the compiler was able to pre-initialise it for me.

So a note, if you were to enter the above VB code into your VB application, set the value of the warning to match this;

image

But you might noticed no warning comes about regarding numeric types these include integral and floating point numbers.  In VB it seems that the gods have decreed

In Visual Basic whence a number variable has been declared, thus forth it shall be initialised with 0, and it is good.

So understanding this means that you don’t need to initialise these numeric data types.  But SHOULD you?  It is good programming practice to intiialise all variables before use because you can come unstuck quickly when using types that aren’t initialised.

Dim myList As List(Of Integer)

If myList.Count > 0 Then
	Console.WriteLine("There are items")
End If

So the above code, looks OK, but I am getting a warning telling me the use of an uninitialised variable could result in an error.  And in this instance, it will.

image

Well one might say that is poor coding since I didn’t catch the exception, but this is another conundrum of development should I make sure I catch all errors, or prevent errors from happening, which will be the subject of my next post.

Errors happen, but this error could have been prevented with one simple keyword.

Dim myList As New List(Of Integer)()

If myList.Count = 0 Then
	Console.WriteLine("There are NO items")
End If

New.  The code executes as intended and the warning goes away.  This is a handy item to have turned on, simply because it will allow you to know where there is the possibility of errors creeping into your code if the initialisation of this is dependant on the user. 

NOTE Just a quick note this will also look at variables that are passed by reference that has not been assigned.  These variables might be used as return values from calling procedures due to the reference being passed, but it still might be used before that, and the reference is unknown at compile time and therefore checks like that can’t be done until run time.

Another note, yeah I know.  This is one that I might recommend as an Error setting. The other languages, like C# and C++ will not compile if there are uninitialised variables, therefore it might be good to have VB not compile if it finds these errors too.  Though the main difference is the numeric types in VB are initialised, C# and C++ they are not.

An Occasion to Share

vb-179

This is such an occasion I felt i needed to share this.  I have finally, though banging my head on the desk questioning why someone did this in a particular way I have ridded myself of the crap warnings, errors and information presented to me.

I could have turned a blind eye to this and turned the warning off for things like assumed objects and use of obsolete methods, non-CLS compliance member names and the list could go on.  But through my eventual progress I have fixed them.  The code, is better than it was when I received it.

By no means is this perfect, I have never claimed to write perfect code,  My code can be at times not the cleanest in some regards but it is always well documented and it is efficient to the point without sacrificing readability.  There is much to do, I am converting each of the pages to be within the HTML5 standard, include all the XML documents with all components, more properly document the code (which means replacing the wonderful titbits I see like;

'ReportID is unnecessary and should be removed
    Public Sub BuildReport _
	(
		ByRef dsReportDefinition As ReportDefinitionDataSet, _
		Optional ByVal ReportID As Integer = -1
	)

This is what I deal with, someone has commented it, but ReportID is still there, though, this is not a used feature of the application but it is an example of these comments throughout the application.

So I will continue to plough through all of the remaining clean up items on my list, improve scalability, efficiency from an application performance and a user using it and provide and application I am proud of, which I am thus far considering what I have achieved in such a short space of time.

image

I should bask in this glory for the moment Smile.

The Conservative Nature of VB (Part 3) – Implicit Type

vb-179

Number 3 in my series of posts about VB having these options that enable certain warnings from telling the programming something isn’t quite right with the code, or supress them.  These aren’t errors in preventing the application from working, but errors might happen depending on the state of variables or, it is just a hangover from the origins of Visual Basic.

I am looking into the Implicit Type warning.  This is really a hangover from the days of VB yore.  Previously VB, including ASP would not be as strongly typed as the languages of today, evening Visual Basic 6 you could still declare variables without providing a data type

image

Dim myVariant

Yes, just like that.  It would be created as a Variant which has a massive overhead in comparisons to other data types.  So, why can I still do this in VB now.  Well, the reason is unknown, possibly because of the conversion process.  Applications converted from VB 6 or before to the new .NET version of VB, they might have thousands even more variables that have been declared that way.  These no way to determine the physical data type so they were just created as Objects, which  were the base class type for all data types in .NET

Are their issues with using Objects over the others, yes.  The main issue is an Object in Visual Basic version 7 or greater are not compatible with Objects from Version 6 or less.  So, accessing interop COM objects you can’t pass object variables.

A performance hit as you incur a penalty for late binding.  Since if any method calls occur a look up to the object needs to be done to verify validity.

Widening is done to aide in the prevention of Overflow Exceptions, but there is an additional performance hit to box and unbox values types to the inherent reference Object type.

So, having this warning come up and say we have found variables you haven’t explicitly given a type we will make them all Objects, well you should go and fix them.  It isn’t always clear what it might be, but sometimes providing and incorrect variable will cause an error in telling you that it can’t convert from this type into the type you provided. 

Dim ReasonId = CInt(dlMain.SelectedValue)

This is a crude example but it is there for me to show how you can determine the data type needed if it isn’t straight forward, which I know the above example is.

I have updated with an unlikely data type;

Dim ReasonId As DataView = CInt(dlMain.SelectedValue)

Doing this has now caused an error in the code telling me it can’t convert one type to another.

image

So, this tells me that it can’t be converted to this and it tells you the type it needs to be.  Update the code and everything will be OK.

Dim ReasonId As Integer = CInt(dlMain.SelectedValue)

Most of the time it is easy to tell but if using LINQ and other more complex types or collections (including the generics collection) then it isn’t as cut and dry.

Should you turn this option on to show a Warning or an Error.  Well this depends on the project and also the programmer.  Me, I am one who wants to fix this, and I am currently working on a project that has a LOT of these in it.  Even for data types where they immediately initialise the variable.

Dim myVariable = True

This in my understanding is silly.  Does it take that much effort to include As Boolean into the code.  So, in my learned opinion all variables should be declared with a data types and should be turned on as an Error  and converting older applications, turn it on as a Warning, as you can slowly go through and fix all the issues.

New Alien Game

PS3%20JoystickSega has announced a new Alien game.  We desperately need a really good Alien game, but I am afraid this will not be it.  A couple of things to note here is the change is it a story of Ripley’s daughter.

I love Alien and Aliens, Alien3 is OK with outstanding performances from Charles Dance, Charles S Dutton and of course Sigourney Weaver.  Alien Resurrection, to me Ron Pearlman makes that film better than it really is, but Ron Pearlman is one of those actors who had something to every scene he is in.

Talk of an Alien 5, not sure, Alien V Predator, interesting concept, the best hunters in the world going after the most difficult prey, but they seemed to lose something in the translation and I won’t go into Alien V Predator 2.

This might explain a lot more about the history or Ripley’s daughter, but she got married, not sure when she got married, but interestingly I find that surely, records of her looking for her, coming across Xenomorphs, she had to survive, to get married if after and return to Little Shoot, Wisconsin to get cremated, 2 years before Aliens was set..

Now, unlike Star Wars there is no specific lore regarding the world.  They create Alien games to make money, but they fail to realise they would make more money if they made a really good game.  I am not one to shy away things that are different from the Lore setup previously, even if it breaks some of it to a point but provides reasons for it. 

An example of this was Alien3, the egg that was supposed to be there, it impregnated Ripley with a Queen as we have seen, but there are a couple of questions NEVER answered by the film, the Queen lays eggs from an egg sack, we saw that physically.  Bishop could have brought an egg on board since Carter gave him instructions to keep specimens.

Both living specimens were destroyed, we saw Hudson kill one and Vasquez also kill one.  So, the only face huggers were the ones being laid by the Queen.  The fact that there were two as well, since the dog was also impregnated so, we need to find two eggs, not just one.  But, in Alien3, they overlooked that part, and just had them there. 

So, having Ripley’s daughter come and look for Ripley not is only going against what has been stated before in the Movies it is a futile exercise in reality.  The Nostromo was blown up not too far away from LV-426, the shuttle, with Ripley aboard was jettisoned and then, it floated right through the core worlds and as Carter said “It was blind luck that a deep salvage team found you…” so, if it was blind luck that a team, specifically looking for salvage came across this, we know already that her daughter doesn’t find her since it takes 57 years of floating in space for her to be found. 

So, the story now is barely holding onto anything that looks like a thread and now they want us to believe that Ripley’s daughter, Amanda will now come across the Xenomorphs which so far at this stage, considering it is only a few years after Ripley went missing (I think Amanda is in her 20s) so we knew the state of LV-426, 57 years after the events of Alien.

If they make a good game, then all might be forgiven, if they provide a good reason and plausible reason for Amanda to be confronted with Aliens when the only Eggs we know of are on LV-426 and Carter was the one who requested someone check out the coordinates that Ripley told him about.

Let us hope, this will be the Alien game we have all deserved and not the dream of one what we have seen with so many trailers for Alien games in the past.

fb-image

Alien Isolation will be available Late 2014 for PC, PlayStation (3 & 4) and XBOX (360 & ONE).

Beat the Heat

Hardware-Chip-icon

Last night was a strange, it was about 12 months ago, nearly to the day that I upgraded my PC. Intel Core i7 (mine is the 3770K) with 32GB G.Skill DDR3 RAM, GTX760 OC Video Card, Sabertooth Z77 Motherboard all siting inside a Silverstone Raven RV03 case.  The weather was hot last time I did this and now, I bought a new part for this computer and it is reaching 43°C (109.4°F & 316°K) so it seems about right that I am doing it again with hot temperatures coming around.

But it is the hot temperatures is why I am getting this particular part.  Backstory – I like to play games, which I am sure many of you might know, I play them on my PC and I live in Australia.  These combinations mean, my PC runs a little on the warm side as the ambient temperatures are often hotter, and in summer it is more the case with the ambient temperature even higher than normal.  Suffice to say, playing games I then see a warning (by games I mean, SWTOR) telling me the CPU is over 70°C (158°F & 343.15°K), this from my understanding is hot.  Hot, it is the temperature at which if a Barista made my coffee and the milk hit that temperature I would return it as it would be burnt.  But these 70°C temps were going to get worse when the air outside the case was hotter than it was when I was first reading these temperatures.

If you run your CPU at high temperatures constantly it will reduce its life span.  CPUs will not run forever and the more stress they are p[physically put under then it will shorten their lives.  Also a note to understand something about the way CPUs are made.

CPUs are made on wafer of semiconductor material (usually Silicon crystal).  This material, when made can be of varying quality.  The better the quality the better the ability to withstand higher temperatures.  The wafers that perform the best go into Intel’s best CPUs their Extreme Editions, ones that weren’t quite as good start making up the lower end processors.  I say weren’t so good is to state that it couldn’t cope at the higher end of the spectrum but did well at lower ends, so they can run it at a lower speed and it will perform very well.

The K CPUs, the ones capable of overclocking use a better wafer than a normal unlocked CPU.  Meaning my 3770K has a better wafer than the stock 3770, simply because they have designated this to be overclockable and must still be stable if it is overclocked (to a point, which I am sure Intel will not tell us which point this is).  But, if they fill their quota of top line and they have wafers that are considered top left over they would go and make the next one down and the next one down and so on.

So, what were my options?  I had very good airflow into my case, I had 6 fans on the case alone, 2 exhaust and 4 intake.  But my CPU was still hit 70°C+, which I thought was hot.  Is, well, Intel don’t say what is too hot, hot enough for the CPU to begin throttling.  But it is wise to push the CPU to its maximum safe temperature just to find where it will throttle, unless you have the ability possibly not, I have seen that the i7 will go has high as 100°C before it will internally throttle, so, if this is a mark of the CPU causing itself to cool down by reducing the load, 70°C is not too bad, but it means my overclocking ability is limited.

So, I could add a massive heat-sink and fan to the CPU like this.  But this seemed very gaudy to me and if you look at where my CPU sits on my motherboard there isn’t a lot of room as that Thermal Amour as they call it, comes up high around the edges and might prevent it from working, or fitting.  So I decided to go for liquid cooling, it works for the car which gets far hotter than any CPU so why not use the same technology that has been around for ages, but this time for a new application.  So time to hit the internet.  There are lots of different systems around.  Closed loop, refillable, double radiators, different liquids coolants, all so much.  Intel released one, which I thought was not too bad, but then in the end I decided to go with;

When I was looking at this, it crossed my mind a couple of times and the Corsair Link software was what caught my eye.  Plugs into a USB header on the motherboard and then enable you to control the speed of the fans based on certain parameters.

I then dropped the cash on the Corsair H80i.  I felt this could do the job, provided that ability for me to control the fan speeds (therefore the cooling) and enabled me to help overclock the CPU a little more than I have.

So, I get home (sorry for the no unboxing video, why do people want to show the unboxing, when this this become something that people want to see, anyway, I digress).  So, I looked at the radiator, the 2 fans, the pump and brackets and I felt I have bit of more than I could chew.

So I removed the rear exhaust fan and find that when I attached both fans to the radiator, I do not have the room as the motherboard gets in the way.  I looked more into it, the top exhaust fan, starting to run into the CPU which means the curving of the pipes is a little higher than I would like, which means more pressure on the joints.  I had to leave it be.  Come back after dinner.

I think more, remove one of the HUGE intake fans at the bottom of the case.  There is room there for the Radiator and fans, it lines up nicely with the CPU and there are holes there for attaching it.  I decide to have my dinner.  My youngest has decided to help, he inserted some various screwdriver heads between the memory slots, though a circuit tested would look good stuck into the PCIe x16 slot.  So with the all cards removed, some fans disconnected I decided to unplug the bottom fan (after removing the various additions added by my son.

BUT, looking more and more at this change is making me uncomfortable.  Simply put, I am losing one of the massive fans, which I am sure pull a lot of air and direct it to the CPU (currently).  I have no other place to put it (the fan that is).   After more looking at the situation and thinking more, I realised that I could not fit, anywhere in its entirety, both fans and the radiator.  I was starting to look at this situation as needing more than more to solve it.  Not wanting to give up, I realised that I could mount it in an unorthodox way, and looking more into it I realised the top exhaust fan, could be removed, have the radiator and one fan on the inside and then mount the second fan on the outside of the case. 

I proceeded to do this, checking the direction of the fan flow, since it talks about better cooling is with air intake.  So I did this, both aligned correctly I also took the grill that prevented fat fingers getting into the fan blades onto the outside fan, attached that to the radiator.

Attached the back plate to the underside of the motherboard.  I then screwed this in (mind you I don’t have big hands but there wasn’t a lot of space for me to screw these in), but I managed.  I removed the CPUs heat sink and fan and realised a possible reason for the high heat, there was some small areas where air could sit between the CPU and the base of the heat sink. 

Air isn’t a great conductor of hear, so what can happen is the heat in those pockets gets far hotter than the rest, this heat is transferred into the heat sink but also back to the processor.  For this transfer to happen it needs very high temperatures.  So it is a bad cycle.  So, I applied the pump to the top of the CPU, attached to mounting bracket and screwed it down, making sure I work on opposite corners.   One thing I didn’t realise was just how big, or think it was.  The pictures are deceptive and though it tells you the thickness of it, you can perform some calculations to determine its size, but nothing beats seeing physically how big it is.  This is the size of it, on the side.  Fans are black radiator is grey.

image

 

This is as accurate as I can get it for the screen.  Based on a typical 96 pixels/inch for screen resolution, those running a higher DPI would not see this accuracy of this.

image

Same with this this is it front on.  So, you can see the space.  So if you are looking into water cooling, understand the size of the rans and radiator in the images is deceptive.  And this is a single radiator those with doubles I am sure take up more room.  But as with me, I didn’t have enough room all inside the case, but, a mix between inside and outside I was able to get it in.

I plugged everything back in, turned it on, it worked.  Surprised smile

NOTE.  Water coolers will NEVER cool the CPU down to anything below ambient air temperature.  Why, because the air being sucked through the radiator is at this temperature and it cannot therefore cool the liquid down to below that temperature.  If you want colder cooling you will need to look into Phase Change cooling  This is a silly name, certainly meant to sound way cooler than it is.  This operates like an air conditioner, the difference here is instead of blowing cold air out, it uses the same process but in an enclosed loop.  It uses a combination of pressure and heat transferral to change the refrigerant (the liquid) into a gas then back to a liquid.  It is called Phase change as it is meant to describe the phase change from liquid to gas.

So I ran up a game, but I couldn’t run up a game that I have seen the 70°C warning (as they were down with a patch) so I still tried a game, Lord of the Rings Online.  Considering the ambient air temperature inside the house which was about 35°C, the fact that I managed to get a max of 50°C from it means it is working.

I have not taken the time to set up my temperature profiles yet.  But also note the link on the site for the software (and you need to download it.  If you are running Windows 8 or 8.1, don’t get it, instead use the following link.

Corsair Link Software Update BETA Version 2.5.5145

This takes you to their forum page with a download for the software.  The version of the software on their site, Corsair Link Installer RC v2.4.5110 will not work with Windows 8.  Please do not download this, use the beta version from the link above.

Cooling

A note on cooling in general.  NEVER let anyone person tell you that the stock CPU fan is no good.  All tests carried out in the labs in the CPU makers are done using the stock CPU fan and heat sink.  If you do not plan to overclock, or cause your CPU to run at 100% for a long time chances are you will not need anything more than the stock CPU heat sink and fan.

Well if you think your CPU is running hot you can get applications that enable you to read the temperature of the CPU you can download some software called CoreTemp and for GPU you can use GPU-Z .  The CoreTemp will provide information about the CPU and will provide a per Core temperature reading.  It will also show the MAX temp of the CPU before throttling will occur. 

Laptops will always be hotter than Desktops, but that are also harder to cool down.  Cooling pads help as it enables the air under the laptop to remain cooler, sucking in cooler air will result in a cooler inside.  But you will know if things get heated since the air from the CPU and GPU (if available) will be blowing out and those vents can be hot to touch. 

Without adding extra features like water/liquid cooling or additional fans look at what you have.  If you have only 2 fans, CPU and power supply then maybe an extra one can help.  But it will do nothing if the airflow is restricted.  Keep it off the floor (hot air rises so you don’t want it too high), but high enough not to suck in the crap from the floor like dust.

imageIf you only have a CPU fan then there is a way that you can help keep it cooler (but you sacrifice noise by doing so, and potentially battery life (if a laptop).

Go into power settings, Control Panel | System and Security | Power Options.  Then the active plan (the one selected radio button), click Change plan settings and the following dialog will be displayed.

Under Processor power management you can set the cooling or the power state (Max or Min values of how much processing power to use, self throttling)

Active cooling will keep the fan running at max to cool the processor.

Passive will keep the fan at a lower speed and will speed it up as the load increases.  If the load doesn’t increase the fan won’t. 

Self Throttling, it is the max state, setting it to a % of total.  If you set it to 75% it is a total CPU.  If you have a 4 core CPU, it will not disable 1 core and have the others max at 100%, if you set it at 75% it will run all cores at that value.

Disabling Cores – Silly if you ask me, but possible and from the BIOS.  I would not recommend this, but if you system is running hot and you want to make sure that it doesn’t break before its time, then this might help (especially if you don’t need the power), only surfing the web or looking at emails.  Watching HD movies you need the grunt, leave the cores alone.

Cleaning

Cleaning you PC out will help, dust can block airflow and prevent the maximum cooling to happen.  This is prevalent on the CPU heat sink, if you suck in dust it will land on the CPU as the fan blows onto the heat sink.  If that is starting to crude up; as you can see with this stop Intel CPU fan and heat sink, the dust is blocking up the gaps between the fins of the heat sink.  This prevents the air circulating through the fins and cooling down the CPU.

This one might need to have the fan removed to be cleaned, but you can get air kits that help the process, make sure a protective mask is used as this dust will go everywhere. 

Filters can help decrease the dust inside PCs, and not restrict airflow.  very fine netting used for curtain sheer to diffuse the light coming from windows is good if fine enough.  A test,. blow through it, if it is too hard to blow through then your fans will unable to suck air throughout it. 

To find out where air is coming into your case, use a tissue.  Hold it against open areas, or areas that have access and hold it gently to the corner.  If it is drawn into the case, then air is coming in.  The more visible the movement the greater the airflow.  The greatest airflow should benefit from using that filter type material.

Regular cleaning can help massively with the cooling ability of your PC and if it is running cooling it will last longer. 

Fans on the case can help, adding a fan to the inside of the case (if room) can bring cooler air into the case or push it out.  But, if air is getting pushed into the case then it needs to be pushed out of the case, either through vents or sucked out by fans.

So, Cool PCs are Clean PCs and Clean PCs are cool.  But, more air flow, colder air, all of them help, but there is lots you can do without spending money.

CLS Compliance? Whaaa?

vb-179What does this mean?  Why do I see this within some of my applications?  How do I fix this or how do I stop the message from showing.  I will get a little technical in my explanation before I answer those questions.

CLS is a Common Language specification, a document that specifies how multiple programming languages need to work to create a common byte-code.  We have been using .NET for so long, gotten used to the fact that manage applications work, write components in VB and you can use them in C# or C++ or other language that uses the CLS.

So, you write an application in your favourite (managed) language and the compiler will convert that application into IL or MSIL as it is called.  This is the byte-code, it is a common language specification that is JITed (or Compiled Just In Time, JIT), like Java.   This code is then converted into platform specific code to execute the application.  The purpose of it, but the real reality of it has not been seen in too many places is, if there was a full .NET Framework for Linux and Mac these applications created on Windows could execute there.  The code is not platform specific, the MSIL is converted into the object code for execution on that platform.

So, where does this fit in with the CLS problem?  Simple, the code that is created by the compiler is CLS compliant.  Meaning you can use it in other languages that compile for the MSIL.  This means following some rules that might not be common to all languages.

IF and this is a BIG IF, IF you do not plan on writing ANY components outside of VB then, in the AssemblyInfo.vb  file you can removed the line of code;

<Assembly: CLSCompliant(True)> 

Or, set it to False.  This means the rules for this assembly are ignored and warnings about CLS compliance will not be seen.  This is an assembly level attribute, and care should be taken to turn it off.

Often in VB, when creating classes we use the following for property declaration;

Public Class MySuperClass
    Private _tempValue As Integer
    Public Property TempValue() As String
        Get
            Return _tempValue
        End Get
        Set(value As String)
            _tempValue = value
        End Set
    End Property

End Class

Simple class definition, the temp variable, prefixed with an _ (underscore) because VB is not case sensitive.  In case sensitive languages you can distinguish them as;

public class Class1
    {
        private int tempValue;
        public int TempValue 
        {   get { return tempValue; } 
            set
            {
                tempValue=  value;   
            }
        }
    }

Since tempValue is different to TempValue in case sensitive code.  Both of these are CLS compliant code, both can be accessed from other CLS languages if required.

But a change to either of these to show

protected int tempValue;

or

Protected _tempValue As Integer

and suddenly both classes are not CLS compliant cannot be called by each other.  C# does not allow prefixed underscores (_) for use with variables and VB is not case sensitive and therefore there is not difference between tempValue and TempValue.

There are the following rules you should follow when making code CLS Compliant, which are as follows.

NOTE:  A note on the rules MOST of these pertain to publically exposed interfaces.  These are the areas that other languages can access if they import your class for use in their code.  If it can’t be accessed outside your application then use any/all of these.  But if you break one of them on public interfaces then you code can’t be considered CLS compliant.

NOTE 2: The default behaviour of the compilers is not to check for CLS Compliance and will allow you to break any of these rules.  Also note.  Unless All Warnings as errors is selected, then the application will compile happily and everything will work, until you try and access it from another CLS compliant language.

  1. Unsigned types should not be included in publically exposed interfaces.  So, ULong, UInt and o on are not CLS Compliant, why?  Possibly due to there being platforms that might not support unsigned numbers in certain types.  I am unsure why really, but it is part of the rule set.
  2. Unsafe types like pointer are a big no, no with public interfaces.  Why VB doesn’t support pointers directly but there is a CLS compliant structure called IntPtr which is CLS Compliant.  So if you use *pointers in C++/C#  and need to use them in VB then you will need to convert them to IntPtr (UIntPtr is not CLS Compliant, see rule 1.)
    int myVar = 25;
    int foo;
    
    foo = *myVar
    If (foo == myVar)
    {
    	myVar = 100;
    }
    

    This code shows the problems and this becomes a problem in VB.  Foo is not assigned the value 25, it is assigned the memory address of myVar so when the check happens, they will not be equal.

  3. It should NOT be case sensitive.  Simply put, anything that could be accessed outside the language you are writing in, can’t differ by only case.
    Dim tempValue as Integer
    Dim TEMPValue as Integer
    

    These are the same variable in VB and would cause an error in the compiler, but;

    int tempValue;
    int TEMPValue;
    

    Both are different in C++ but this isn’t CLS compliant and there would be complaints with this in non-case senstive languages.  There is MANY an argument that can be had with developers over real languages v toy languages and case sensitivity.

  4. Operators cannot be overloaded.  If in your class you are overriding an Operator like = or >= then you can only create one method. 
  5. Overloaded methods can’t differ by simply out or ref.  These are C# keywords which mean the same thing.  In VB, ByRef is the one name.   So;
    public int TempOut(int name, out int myMember)
    {
    	myMember = name;
       if (name > 0)
       		return name;
       	return 0;
    }
    
    public int TempOut(int name, ref int myMember)
    {
       myMember = name;
    	return name;
    }
    

    Might look different they are the same.  The difference is this breaks the compiler and and error will be given to you.  It is a rule for CLS Compliance but it is also a rule in C# and VB (though VB has only the one keyword to mean the same thing)

  6. Publically exposed members starting with an underscore (_).  We have seen this one above.  _ is used mainly in VB to provide a differentiating mechanism between private and public properties.  But in VB, an understand is still valid on public members.  But using them means your code is not CLS compliant and will not work with other languages.
  7. This one is a funny one, but, ONLY members that are CLSCompliant can be abstract.  Mmm, I don’t really understand this, but strangely you can create, by default a class without any mention of CLSCompliant and the assembly not stipulated as CLSCompliant will quiet happily take abstract members, but specify an Assembly to be CLSComplaint and a class and then specify that a Member is not CLSCompliant then it complains. 

There are other rules, dealing with arrays, constructors, enumerations and other things but the main languages, by that I say (C#, C++ (managed) and VB) support these rules by default, in most cases, there are exceptions as always but you can check out the full specification here, if you want more information.  I am happy to expand these at anytime if more information is required.

The Conservative Nature of VB (Part 2) – Late Binding

vb-179

I am now going to go into the next part of looking configuration of the warning options for the compiler.  In the previous post I spoke about the warning configurations and specifically the one for implicit conversion.

Late binding has been a stable of Visual Basic since the early days and in ASP it was the only way one could create objects.  Now in the old days late binding provided an ability to create instances of objects using a text value.

What is Late Binding?  It is the nature of binding the object to the instance at the very last possible moment, before execution.  Early Binding, the compile knows about the object, its methods and members and it can resolve this, perform optimisation if needed.  But Late Binding, the compiler only sees text, it knows it can’t do anything with it until it is run and the process of calling the COM process invokes this and verifies if the component exists.

Even if the object specified is incorrect, you will not know about it until an instance is being created.  Then in the examples I am using, if you get the class wrong you will then see an “Cannot create ActiveX component.” error, which once again I am sure most VB programmers has seen in their life.

Dim myObject = CreateObject("Scripting.FileSystemObject")

This is the example I am talking about.  I am sure most VB programmers who have been programming in VB since before .NET would be familiar with this syntax.  But putting this code in doesn’t cause anything happen.

So, this configuration item enables the environment/compiler to report on occurrences of late binding and report them to you.  But there is one instance it can’t report to you which I will get to.

Take the following code;

Dim myObject As Object = CreateObject("Scripting.FileSystemObject")

For Each tempName As Object In myObject.Drives
	Console.WriteLine(tempName.DriveLetter)
Next

Fairly simple code, if you have used the file system object before you would recognise this. 

image

That code, with late binding Warnings on, will display the following warnings.  Note, there is also an implicit conversion happening but I have turned off these being reported.

image

The message displays as such.  Late bound resolution, runtime errors could occur.  Thankfully in this instance they don’t happen and if in a console application it will simply write the driver letters to the console window.   But what about;

Dim myObject As Object = CreateObject("Scripting.FileSystemObject")

For Each tempName As Object In myObject.Drives
	Console.WriteLine(tempName.Name)
Next

Doesn’t look out of place, getting the drives putting the name to the console.  But Name isn’t a valid member of the Drive object.  So, the compiler tells me there is a problem with the resolution and an error could occur.  Run it and ;

Unhandled Exception: System.MissingMemberException: Public member ‘Name’ on type ‘Drive’ not found.

Yes, not a lot we can do other than fix it.  So, should I have it as an error or a warning.  Well for one, I would say you could turn it off as in my opinion we shouldn’t be late binding.  There is only a small number of instances where late binding is acceptable, scripting when objects have no type and for application add-ins where they are written for applications and are loaded using a binding reference stored as text.  But even in the latter scenario there are other ways to do this as well.

So my recommendation is, get out of any habit you have of late binding and import your objects, add references to COM components using interop.  There should be no late binding references in there.  If unsure, switch all other warning options to None except Late Binding and see what comes up. 

NOTE: The IDE has some wonderful features, one of which is IntelliSense.  Late binding removes this feature create a new Console application and put in the code from listing 2 (I have realised I do not name my listings, mmm, maybe I should.).  If you remove DriveLetter and the period and put a . down, you will see one thing, a drop down that contains the available members for Object.

Imports Scripting

Module Module1

    Sub Main()

        Dim myObject As New FileSystemObject()

        For Each tempName As Drive In myObject.Drives
            Console.WriteLine(tempName.DriveLetter)
        Next

    End Sub

End Module

Now, using the same project add a reference to the COM component Microsoft Scripting Runtime.  Include the import statement and using the code above, and you will see the drop down menu from tempName shows a great many more things.

image

The dropdown on the left is the Drive drop down members, the one on the right is the Object.  Not only that, you get the nice help as well.

image

So, this helps as you know it returns a string and is ReadOnly.  Handy.  I know which one I would prefer.

The Conservative Nature of VB (Part 1) – Implicit Conversion

vb-179I have been spending the last few days, long days, fixing code I have inherited.  I have posted on here about the problems with bad coding which I have seen a great deal in this application.  That said I am wanting to convey the beauty and danger of Visual Basic as a language and how bad programming can creep in because VB just simply looks at it and determines it knows what is going on.

So, thankfully you can look at the way VB is looking at your code and the way in which it can report back issues.  The warnings configuration within the compile options are the area.  These options are for all warning that the compiler would tell you is a warning, but from here you can choose to ignore them, display them still as a warning or make them throw an error to prevent your application from compiling (and subsequently you will need to fix before a build is done.).

image

Above is the compile options for Visual Basic in a Visual Studio 2012 project.  To get to the compile options, Right Click the Visual Basic Project, Click Properties.  Click the Compile tab, you will then see this list of items.

These are warnings that you can turn on and off in the IDE, none will prevent the application from compiling but could cause, dependant on circumstances, cause an exception at runtime.

If they could cause an exception at run time why not simply make them errors.  Simple, if all of these items were errors in the compiler, I would be still trying to get the application to compile possible have several deep gouges in my head as I would have banged it repeatedly on the desk.  So for one I am glad I have this option.  But at the same time it can hide bad coding practises.  Of which I will look at each option provide an example and provide my opinion on it.

BIG FAT NOTE – If you turn any of these options to Error, they will be treated as errors and your project won’t build.  You have been warned.

Implicit Conversion

When you perform various abilities and functions on variables in your code.  When you look at the following code it will make more sense.

Dim x As String = "Hello"
Dim y As Integer = 5

x &= " " & y
Console.WriteLine(x)

x = y
Console.WriteLine(x)

See line 10.  This is the implicit conversion.  Converting an integer into a string, this doesn’t seem like an issue and under default circumstances it isn’t, change the Implicit Conversion from None to Error or Warning and you will see the message come up about;

Error    1    Implicit conversion from ‘Integer’ to ‘String’.   
Module1.vb    10    13    ConsoleApplication5

Is this wrong or bad?  No, but there could be other forms of implicit conversion that might fail.

Dim x As String = "Hello"
Dim y As Integer = 5

x &= " " & y
Console.WriteLine(x)

y = x
Console.WriteLine(y)

In the above example, there has been one small change made, I have made y = x.  This comes up as the same error.  Now in the instance of x = y, it will never fail.  An integer will always convert safely into a string.  BUT, when converting a string into an integer, this could very well fail at runtime, and in fact this current code would.

This is what happens when you run the following.

Unhandled Exception: System.InvalidCastException: Conversion from string “Hello 5” to type ‘Integer’ is not valid. —> System.FormatException: Input string was  not in a correct format.
   at Microsoft.VisualBasic.CompilerServices.Conversions.ParseDouble(String Value, NumberFormatInfo NumberFormat)
   at Microsoft.VisualBasic.CompilerServices.Conversions.ToInteger(String Value)

   — End of inner exception stack trace —
   at Microsoft.VisualBasic.CompilerServices.Conversions.ToInteger(String Value)

   at ConsoleApplication5.Module1.Main() in c:\users\m1roge\documents\visual studio 2012\Projects\ConsoleApplication5\ConsoleApplication5\Module1.vb:line 10

This shows what happens, certainly straight exception dumps are never a good thing.  But what you can see is, it is trying to perform a couple of conversions, it is trying to see if it will convert to a Double and then to an Integer.  Turning this on as a warning at least highlights the problem and you can deal with it as you see fit.  A way around it is to make sure you code the conversion properly

Dim x As String = "Hello"
Dim y As Integer = 5

x &= " " & y
Console.WriteLine(x)

If Integer.TryParse(x, y) Then
    y = x
End If
Console.WriteLine(y)

The above shows this is the correct way to do it, but that is a lot of extra code to write if you know, without a doubt that x will always be convertible to a number.  But don’t just see this as an issue between strings and integers, this very same error will popup for converting from one type into another (beyond the intrinsic types).

My recommendation with these is take them as they come.  When you are creating your own classes make cure you use the Override the default conversion operators if you are needing to convert these classes, use the intrinsic converters , CInt, CStr, CDbl and so on, see Type Conversion @MSDN for more information, you can use the Convert class, but the data types like Integer, Double they have static members like Parse and TryParse which enable checking the conversion before performing it, Try Parse will put the result into one of the parameters as a reference type, but if fails it will put 0 in there (so if you need the value that is in there, be careful.

NOTE – Because VB supports an Object type which is a reference type, some of the time is not a reason to use it simply because you don’t want to deal with conversion issues when it comes to certain types.   VB treats this different to the way other languages that use the CLR type Object.  So use it when you need to not because you want to fix issues.