Please create an account to participate in the Slashdot moderation system

 



Forgot your password?
typodupeerror
×
User Journal

Journal Journal: Installing SQL Server 2005 on Windows Vista

I had problems installing SQL Server 2005 on my new Lenovo T60, which comes with Vista pre-installed. At first I blamed the Purbles. So I used one of the service calls packaged with my MSDN subscription, and they worked out that the culprit was Office Web Components 2003. I don't know whether it was pre-installed with the laptop, or if it was installed as part of Office 2007, but uninstalling it first seemed to do the trick. I had to run right-click and run setup.exe as administrator too, of course. I hope this helps someone!
P.S. I still don't trust those Purbles though.

User Journal

Journal Journal: Progress bars vs. OOP

It occurs to me that progress bars are antithetical to OOP. Displaying a progress bar correctly necessarily needs to go "deep" into any process, while OOP's encapsulation must stop this.

For example, copying a large file as part of a longer process. Using a library "filecopy" routine won't allow you to show progress, unless the library routine raises events for progress... and if it does it is a less efficient routine. If there are multiple versions of filecopy to deal with this then the library is bloated. If you rewrite/shadow the routine then you are violating code-reuse.

User Journal

Journal Journal: The power of Barry compels you!

No link I'm afraid, you'll just need to take my word for this one. Apparently Cityrail were having problems at Sydney's Central Station with street kids loitering around the concourse. Their solution? Playing Barry Manilow songs over the station speakers.

Social engineering as a security measure? Who would have thought?

User Journal

Journal Journal: Pervasive.SQL: ODBC vs OLEDB

Using Pervasive version 8.0 with VS2005, I found that using OLEDB was 4 times slower than ODBC for a simple query. I thought OLEDB was supposed to be faster than ODBC? Anyone else have a similar experience?

I suspect that ODBC being the older tech has less frills...

User Journal

Journal Journal: 012483569AC7BDEF

I worked out the 'confidence' algorithm. On reflection, it is related to permutations and combinations from high-school maths.

recap: each bit represents a comparison, a greater number of successful comparisons is better (i.e. more 1's is better). In this code the most significant bit is the most important comparison.

Public Sub CombinationPattern(ByVal BitCount As Integer, ByRef BitPattern As Generic.List(Of Integer))
    For BitsOn As Integer = 0 To Bitcount
        Call CombinationPattern_Iteration(Bitcount, Bitcount - 1, BitsOn, 0, BitPattern)
    Next BitsOn
End Sub
 
Private Sub CombinationPattern_Iteration(ByVal BitCount As Integer, ByVal TopBitPos As Integer, ByVal BitsOn As Integer, ByVal BaseVal As Integer, ByRef BitPattern As Generic.List(Of Integer))
    If BitsOn = 0 Then
        BitPattern.Add(BaseVal + 0)
    ElseIf BitsOn = 1 Then
        For BitPos As Integer = 0 To TopBitPos
          BitPattern.Add(BaseVal + CInt(2 ^ BitPos))
        Next BitPos
    Else
        For NewTopBitPos As Integer = (BitsOn - 2) To TopBitPos - 1
            Dim NewBaseVal As Integer = BaseVal + CInt(2 ^ (NewTopBitPos + 1))
            Call CombinationPattern_Iteration(BitCount, NewTopBitPos, BitsOn - 1, NewBaseVal, BitPattern)
        Next NewTopBitPos
    End If
End Sub

User Journal

Journal Journal: chkdsk!!

Today I got to use chkdsk again for the first time in about ten years! One of the staff at the hospital had saved a powerpoint presentation to an old floppy disk, which then developed errors. No backup, so chkdsk it was. We managed to recover the Powerpoint presentation! It felt like... 1994!

User Journal

Journal Journal: F7BDE3596AC12480 1

I wonder if there is a short algorithm/series that can generate the following binary sequence (for increasing bit counts, obviously)...

It represents a 'confidence' where each bit represents a particular comparison, and the more successful comparisons, the better. Also, the least significant bit represents the most important comparison (this is so it is easy to add more comparisons at a later date).

  1. 1111 &HF
  2. 0111 &H7
  3. 1011 &HB
  4. 1101 &HD
  5. 1110 &HE
  6. 0011 &H3
  7. 0101 &H5
  8. 1001 &H9
  9. 0110 &H6
  10. 1010 &HA
  11. 1100 &HC
  12. 0001 &H1
  13. 0010 &H2
  14. 0100 &H4
  15. 1000 &H8
  16. 0000 &H0
User Journal

Journal Journal: What's up with itsatrap?

The tagging feature of slashdot seems to show the herd mentality of people. Almost every article at the moment seems to be tagged "itsatrap". I guess people are encouraged by seeing tags that they have put against an article appear. So much so that they put popular tags up even if they aren't appropriate.

User Journal

Journal Journal: In defense of GOTO

I'm amazed at how religious some programmers are about not using the GOTO statement.

I was reading this (quite interesting, actually) article and noticed the author claim the following:

Once you realize this, you also realize that all those objections to the banning of the goto go away--there really is no place for it in well-written code. This may sound like an extreme viewpoint, but speaking as an experienced programmer, the only times I can recall needing a goto in the last 20 years were when using languages that didn't support adequate control constructs (most of which, thankfully, are extinct now). I have never written a goto in C code.

The author later details a piece of code that includes the C equivalent of a

Do
    If Something Then Exit Do
    If SomethingElse Then Exit Do
    etc ...
Loop While False

and then says this about it:

The second interesting feature of the above example routine is the do-once construct. This conforms to the rule for structures which nest: you enter it at the top, and exit it at the bottom. It allows for a linear sequence of any number of steps, any of which can fail, in which all prior steps must have succeeded in order for a given step to be processed.

Oddly, some people who see this construct for the first time tend to react unfavourably. It is a loop construct which is not being used for looping, and a few people don't like that. What can I say? It is a deficiency of the C language that it doesn't offer a construct specifically for this purpose, so reusing the do-construct (and carefully marking it as such right from the beginning, with the /*once*/ comment) is the best I can do. I need a structure for this purpose, and the alternatives that have been suggested to me are even worse. Deal with it!

I hate to break it to you dude, but there IS a structure, and it is called GOTO. A couple of line labels and you would be golden:

SeriesOfChecks:
    If Something Then GOTO SeriesOfChecksExit
    If SomethingElse Then GOTO SeriesOfChecksExit
    etc...
SeriesOfChecksExit:

I believe there is still a place for GOTO in modern programming. The main case where GOTO is useful is a situation as follows:

  • You have a transaction consisting of multiple steps
  • If any step fails, the transaction as a whole fails, and you do not need to perform the subsequent steps
  • Whether or not the transaction fails, some cleanup operations are required

A common example is parsing a file that might be corrupt or in the wrong format.

My belief is that GOTO is a fundamental building block of a programming language. You can replace a lot of structures (e.g. Sub, Function, Do...Loop) with GOTO, but you can't do the reverse.

Sparingly and properly used, GOTO can simplify code and improve readability.

User Journal

Journal Journal: Transubstantiation

After reading the Wikipedia article on "transubstantiation", I realised that any OOP computer programmer would have no trouble understanding the Roman Catholic Church's teachings of it: The Eucharist still implements the "bread" interface, even though the reference changes. I'm not going to post pseudocode for fear of burning in hell :-)

Programming

Journal Journal: First post! 1

As one of the last self-taught professional BASIC programmers, I sometimes wonder why I read Slashdot :-)

Slashdot Top Deals

"If I do not want others to quote me, I do not speak." -- Phil Wayne

Working...