Entries:
Comments:
Posts:

Loading User Information from Channel 9

Something went wrong getting user information from Channel 9

Latest Achievement:

Loading User Information from MSDN

Something went wrong getting user information from MSDN

Visual Studio Achievements

Latest Achievement:

Loading Visual Studio Achievements

Something went wrong getting the Visual Studio Achievements

Discussions

spod spod
  • My Lecturer The Linux Zellot

    koorb wrote:
    So I have a Linux zellot as a Compilers Lecturer and for an assignment he wants us to program a compression table algorithm or a program demonstrating several algorithms. Anyway he is adding marks for anybody who use difficult and time consuming programming languages like Haskel, assembler, C etc and so not going to be giving me any extra marks for using VB.Net.

    To try and boost my marks I want to try creating a project using multiple programming languages. Can anybody give me a link to something that could help give me a starting block?


    How about coding directly against the codedom in .net? No one could claim that was easy Smiley, but you could generate IL, VB, C#, C++ and J++ code ( and maybe some others? ) from a single source base which might impress.

    http://www.15seconds.com/issue/020917.htm has an overview but there are many others around

    Don't know if i'd try to do that with a compression algorithm mind you....least you could debug in your language of choice i suppose Smiley

  • SQL Server performance

    Flatliner wrote:
    Too bad if you have a 100 page result set with 100 rows per page. then selecting the last page would create the worlds largest execution plan ever devised.


    well maybe. If you look at the execution plan for simple cases at least ( like the example ), the query essentially resolves to a single right anti-semi join, which can be resolved in a single I/O read pass over the data. This makes sense if you think about what you are really asking - scan past the first n rows, and then return me the next m. Of course you need to get your indexes right and like you say every case is different, but i have seen order of magnitude improvements in commercial applications with this approach...

    Try sticking 1/2 million rows in the table and see how quickly it gives you back rows 300,000 to 300,050 say...

    Can't argue with you about the dynamic sql Smiley...Only good thing is that the inputs are integers and cant easily be exploited by sql injection attacks etc.

  • SQL Server performance

    Temp tables can really hurt you under load, so you may want to prototype and give it a quick perf test. The main problem is that the writes are transactional so backed to the transaction log - which implies synchronous writes to disk.

    Under load, with multiple simultaneous transactions going on this can make you write I/O bound which is nasty on what should be a read only operation.


    How complicated is the paging you need to do? Could you maybe use the select top x in ( select top y ) trick to do it in a query? Of course you;d have to measure to see if this helps, and would need the appropriate indexes...

    ( example if u dont know the trick.. )
    -------------------------------
    create table foo
    ( id int not null identity(1,1) primary key,
    data varchar(20) not null  )
    go

    insert foo( data ) values('a' )
    insert foo( data ) values('b' )
    insert foo( data ) values('c' )
    insert foo( data ) values('d' )
    insert foo( data ) values('e' )
    insert foo( data ) values('f' )
    insert foo( data ) values('g' )
    insert foo( data ) values('h' )
    insert foo( data ) values('i' )
    insert foo( data ) values('j' )

    go
    -- read the second page ( assuming 3 rows per page )
    select top 3 id, data from foo
    where id not in ( select top 3 id from foo order by id)
    order by id

    -- read the third page ( assuming 3 rows per page )
    select top 3 id, data from foo
    where id not in ( select top 6 id from foo order by id)
    order by id
    go

  • WinFX refresh for .NET2.0 RTM

    Hi Gravy

    I haven't got a firm date, but there will definely be a refresh in the same timeframe as the vista client release.

  • Digitial Signitures and Public/​Private key pairs in ​Server/​Client ​Communicati​ons

    Shark_M wrote:

    rheaney wrote: If you want to know more about public/private keys and digital signatures, I suggest you pick up "Invitation to Cryptology" from Amazon (or somewhere else). I takes you through it all, and although its a bit pricey, it does quite a good job of explaining the process in detail.


    thanks , i will look into that

    but in the mean time, can you give me a general idea, as to how private/public keys work? why is the public key public, while the private key private? how is the public key used, and by what side, and what about the client? Is it wise to have public keys?

    what is better than public/private keys? i mean Master Secrete key was old, and public/private keys came after it to replace it, i am woundering if public/private keys are replaced by something newer?

    thanks again


    I'll have a go at explaining this. Not sure how well i'll do Smiley

    Up until the 1970s all encryption was done using symettric key techniques, which is basically where the two people wanting to send secret messages have a shared secret key that only they know., and encrypt and decrypt using the same key ( hence symmettric ).

    The obvious problem here is that the secret key needs to be transferred between the people wanting to exchange messages, and this has to be done out of band from the normal message transfer. It's this key exchange problem that public key cryptography solves, and which was why it was such a significant breakthrough when it was discovered in the late 70s.

    The basic assumption behind public key crypto is that there exist mathematic functions that are one-way; things that are easy to do in one direction, but extremely difficult to do in the other. The canonical example is factoring large numbers ( which forms the basis of the RSA cryptosystem )

    So given a number 1457 say, it is hard for me to tell you what all the factors are. But if i give you the numbers 31 and 47, it is easy for you to multiply those numbers together to get 1457. Obviously this wouldnt fool a computer for long as it could simply try all possible factors, but make the numbers big enough ...

    Once you accept the assumption that factoring is hard, and multiplying is easy you can build a simple crypto system around it. Continuing the toy number example...

    Call 1457 your public key and publish it to the world
    keep 31 secret ( this is your private key ).
    destroy 47

    Now even though everyone can read your public key, they can't derive your private key because factoring 1457 is too hard.
     
    Now with a bit more mathematic trickery you can arrange it so that messages encrypted with the public key can only be decrypted by the private key, and messages encrypted with the private key can only be decryted with the public key. This forms the basis of how all public key crypto systems work ( with different choices of one-way function ).

    So, to encrypt data for someone so that only they can read it i encrypt with their public key ( which i and everyone else knows ), and this guarantees confidentiality since i know only they know their private key and can decrypt it.

    Similarly to sign something, i encrypt it with my private key. Everyone can decrypt this, but because only i know my private key only i could have done the initial encryption. This is what makes digital signatures work  - if you can successfully decrypt a message sent from me, you know no-one has tampered with it on the way. Also i can't easily say that i didn't sign it ( since only i can... ) so you get both integrity and a degree of non-repudiation ( provided you can prove the public key is mine )

    Asymettric crypt doesn't replace symettric crypto, it complements it and helps you solve a wider set of problems. One issue is that assymettric crypto is about 1000x slower than symettric crypto, so you can't use it for bulk operations. A typical use is to establish a shared secret so that we can use symettric crypto to pass a series of messages. A very simple ( and easily attacked ) protocol to do this could be:

    I choose a secret key, and encrypt it in your public key. I now know that only you can decrypt it. I then sign the encrypted package using my private key and send it to you.

    You check the signature on the data, and confirm it comes from me. Then you decrypt the package to get the shared secret key. We can now use this key to bulk encrypt messages.

    It's a big subject though, so this is probably all miles off what you were really after knowing Smiley


  • Frontpage 2000 (XP) Error Code 12163

    This may be way off as i don't know frontpage well at all...

    The error for 12163 is ERROR_INTERNET_DISCONNECTED ( from wininet.h header file ). Stupid one, but IE doesn't think it's working in offline mode for some reason does it? 
     
    Otherwise - it may be that you are using http 1.1 and the isp doesn't support it? You could test this through unchecking the http 1.1 setting at control panel / internet settings / advanced / http.1.1

    other than that best i could suggest is take a netmon trace of the traffic going to the isp and see if anything jumps out at you - my guess would be something that the server returned that forced a client disconnect.

  • Debugging noob..

    make sure you contain the x = new in another pair of braces so it goes out of scope b4 you do the _crtDumpxxx call. Might not report as a leak otherwise?

    Also...make sure its just not the debugger being weird. if you do OutputDebugString("hello") in ur main project does it show up in the debugger ok?

  • Debugging noob..

    Hi manip.

    Does a really simple program like the following show leaks ok for you?

    #include <crtdbg.h>

    int main()
    {
       {
          int * x = new int;
       }
       _CrtDumpMemoryLeaks();
       return 0;
    }

    do external debug viewers show nothing also. sometimes they are better. i like dbgview from www.sysinternals.com for example.

    One other thing to make sure is that you #included crtdebug early on in the process ( before your other headers )...



     

  • Debugging noob..

    oh...sorry, i'm not reading your mail correctly. That is a pain like you say - the half life server exe won't accept debug builds. hmmm....you could maybe ping the valve guys as if this is a legit server extension they maybe have a config for it?

    Not sure what they are using to detect debug builds. maybe you can enable heap checking witrhout triggering the logic? unsure about this though...

    memsnap and vadump will still work against release builds i believe and should be ok as they are external. you could do a release build with pdbs which would give you good symbols etc.

    i'm assuming this is VC++ throughout so may be way off if this is gcc or some such btw.

  • Debugging noob..

    ah cool....

    well you shouldn't need to attach a debugger. Rebuild your dll with the crt debug checking flags on and run a debug viewer. It should spew its output so that dbgview from www.sysinternals.com ( for example ) will show it up.

    Get it to report leaks on exit and they'll probably show up.

    memsnap and vadump dont need a debugger attached either so you might have some luck with them also.