Beta
×

Welcome to the Slashdot Beta site -- learn more here. Use the link in the footer or click here to return to the Classic version of Slashdot.

Thank you!

Before you choose to head back to the Classic look of the site, we'd appreciate it if you share your thoughts on the Beta; your feedback is what drives our ongoing development.

Beta is different and we value you taking the time to try it out. Please take a look at the changes we've made in Beta and  learn more about it. Thanks for reading, and for making the site better!

Comments

top

Visual Studio vs. Eclipse: a Programmer's Comparison

MemeRot Re:Spoiled by Visual Studio (543 comments)

Intellisense *almost* works flawlessly. The times when it doesn't show properties that I know exist drive me bananas.

The unit testing changes from VS 2010 to VS 2012 were quite confusing and a big step down in usability. Wasn't even at an ok level until update 2.

about a year ago
top

Visual Studio vs. Eclipse: a Programmer's Comparison

MemeRot Re:Getters and setters (543 comments)

Depends on your context a bit. When dealing with automatically binding form fields to a view model like with an MVC .net project the convenience and speed pay off handsomely, even at the cost of having to have your form fields and properties identically named.

about a year ago
top

Visual Studio vs. Eclipse: a Programmer's Comparison

MemeRot Re:Getters and setters (543 comments)

The syntactic overhead in C# is at least lighter than Java/C++. It's just Foo.Bar == 'something' or Foo.Bar = 'thing', you just have to declare Bar with a {get; set; }

about a year ago
top

Visual Studio vs. Eclipse: a Programmer's Comparison

MemeRot Re:TLDR: It's a flaw of the language (543 comments)

No good reason I shouldn't be able to shoot laser beams out of my eyes either. But I can neither change how an attribute is accessed in Java/.Net nor shoot laser beams out of my eyes.

about a year ago
top

Visual Studio vs. Eclipse: a Programmer's Comparison

MemeRot Re:Getters and setters (543 comments)

About the only thing a getter and setter offers is an advantage of doing something before / after accessing the variable for a read / write operation... which breaks the objected oriented mentality.

How does it do that? A form might pass over [date] [time] [timezone] and my object might have [utc_datetime]. The setters for date, time, and timezone set private variables that i don't care about individually. And my getter for utc_datetime will stick date and time together, then look at the timezone and the date and figure out what amount of hours to add or subtract, and return the utc_datetime. But only in cases where the calling code actually ends up requesting it. Otherwise that calculation can be skipped.

about a year ago
top

Visual Studio vs. Eclipse: a Programmer's Comparison

MemeRot Re:Biggest Visual Studio defect: Runs on Windows (543 comments)

There is a product by a company called Xamarin that lets you write C# and compile it for many platforms - iOS, Android, Mac, and Windows. You can either develop in their IDE, or treat their product as a plugin to Studio.

There's also Mono. The ServiceStack web services framework is completely portable between windows and mono on linux.

Or you can use PyTools (http://pytools.codeplex.com/) to write python.

It's still predominantly used for Windows. But the other opportunities are much more than they used to be.

about a year ago
top

Visual Studio vs. Eclipse: a Programmer's Comparison

MemeRot Re:Getters and setters (543 comments)

Not mentioned in the other responses is the opportunity to use the "resource acquisition is initialization" or "lazy loading" pattern. You may have a field that gets populated by a relatively expensive operation like a database query. So your options are to fill it in during the object initialization. Or to have a get method that will check whether the private variable it exposes has a value yet. If not it goes and fills it in and then returns it. If you access that field in ~50% of your uses of the object you've saved a ton of database queries. The the calling code just uses CompanyConfig.AllowSomeOption freely.

That requires you to actually code that of course. The automatic get/set is just giving you the opportunity to do stuff like that. Once your class has exposed a public int MyField; you really can't come back later and change that. But exposing a public int MyField {get; set;} lets you come back and fill in the get/set logic when needed

about a year ago
top

Visual Studio vs. Eclipse: a Programmer's Comparison

MemeRot Re:Getters and setters (543 comments)

The automated get/set provides the ability to come back later and add your own custom get/set functions. Knowing that 90% of the time you never will. But if you do come back and do it, you have to do the whole shebang - declare your private variable and have the get and set operate on that variable. I believe the need for an explicit common private variable to use in both of them is why you can't leave one as automatic

about a year ago
top

Visual Studio vs. Eclipse: a Programmer's Comparison

MemeRot Getters and setters (543 comments)

"One full-time Java programmer told me that he hasn’t had to manually type in any setters and getters in years, and he has a template from which all his objects are typed in automatically, thanks to the code snippet tools in his favorite editor (which isn’t Eclipse—he uses IntelliJ). Clearly, methods of automated typing seem to be a favorite among a lot of programmers. So why did Visual Studio remove a feature that facilitated this? Who knows."

Let's not mention the fact that in C# you don't need to manually type in all the getter/setter junk, just public int MyField {get; set;}

about a year ago
top

Ask Slashdot: Geek-Centric Magazines Still Published On Paper?

MemeRot Re:Perhaps... (125 comments)

Yes. I have a set of very clever glasses with strips of duct tape over them that block out all the ads while I read magazines.

more than 2 years ago
top

Ask Slashdot: Geek-Centric Magazines Still Published On Paper?

MemeRot Re:Perhaps... (125 comments)

I prefer to keep my electronics out of the bathroom though, where all of my quality magazine reading happens.

more than 2 years ago
top

Plate Readers Abound in DC Area, With Little Regard For Privacy

MemeRot Re:So what? (268 comments)

Are you kidding? It takes a screwdriver and 5 minutes. Pull up next to an innocent car. Swap it's plates with the plates on your stolen car. Now the innocent car sets off the camera warnings. Repeat daily.

more than 2 years ago
top

Plate Readers Abound in DC Area, With Little Regard For Privacy

MemeRot Re:A sad world. (268 comments)

You have to ask yourself if you really want 100% automated, ubiquitous enforcement of every law in existence. How many laws apply to you right now? You really have no way of knowing.

more than 2 years ago
top

Plate Readers Abound in DC Area, With Little Regard For Privacy

MemeRot Re:A sad world. (268 comments)

I've had my plates stolen before. If someone was tracking the criminal who stole my plates and thought they were tracking me, that would be bad for me.

more than 2 years ago
top

Plate Readers Abound in DC Area, With Little Regard For Privacy

MemeRot Re:A sad world. (268 comments)

There is a Constitutional right to privacy that extends beyond the 4th Amendment. If it covers having an abortion, wouldn't it cover something that is actually your right to privacy?

more than 2 years ago
top

Plate Readers Abound in DC Area, With Little Regard For Privacy

MemeRot Re:A sad world. (268 comments)

I will bet that the information in these database is used to obtain search warrants, and used in criminal prosecutions. And I will bet that the security measures on these insular, home grown database systems is woefully insufficient to ensure that it is real data, and not someone just editing the database to get a bogus warrant.

more than 2 years ago
top

Why Are CC Numbers Still So Easy To Find?

MemeRot Re:How much is it a problem? (317 comments)

It is easy for someone who works on a cash register to turn a fraudulent card into cash. They just need to ring up a bogus charge, put that receipt in the cash register, and take out the corresponding amount of cash. How are you going to prove what happened?

more than 7 years ago

Submissions

MemeRot hasn't submitted any stories.

Journals

top

RC4 encryption in tcl 7.6, StoryServer 4

MemeRot MemeRot writes  |  more than 11 years ago [
##
##    INPUTS:        plainText
##
##    RETURNS:    cipherText
##
##    NOTES:        Conversion to Hex values may not
##      have been necessary, but was much easier to debug
##    See references at www.ncat.edu/~grogans and
##    http://www.tillerman.st/ietf/rodney_drafts/draft-kaukonen-cipher-arcfour-01.txt
##
##      This has been tested and found to match RC4, using
##      the perl module, also the public examples.
##      This was written for StoryServer 4.2, which is
##      based on tcl 7.6 (i.e. no binary stream, namespaces)
##
##      Tcl'ers, some of the syntax is slightly different,
##      not very though.
##
##      cypherText is created as a variable with the
##      encrypted string, not returned as the return value
##      from this function.

proc RC4_encrypt {plainText} {
    ## Must set these globally - but its global
    ## TO THIS PROCEDURE only
    global buffer S i enewsKey hexKeyList keyList enewsHex K f c HexVal plainList ccList l resultSet cipherText counter cardLen base64String

    for {set loop 0} {$loop <= 255} {incr loop} {
       append buffer " $loop "
    }

    ## Create a State array consisting of the numbers
    ## 0 through 255
    FOREACH num IN $buffer {
        [array set S [list $num $num]
        NULL]
    }

    ## The cipher key. Guard it.
    ## Put your own key in here, this will resolve to
    ## slashtroll

    set cipherKey [DECODE64 "c2xhc2h0cm9sbA=="]

    ## Its much easier to deal with the algorithm in
    ## hex and decimal than strings, so do that. This
    ## creates a list of the hex values.

        for {set l 0} {$l < [string length [SHOW cipherKey]]} {incr l} {
        scan [string index [SHOW cipherKey] [SHOW l]] %c keyInts
        lappend hexKeyList [format %X $keyInts]
    }

    ## destroy the key so that if there is a stack dump
    ## it is not compromised.
    unset cipherKey

    ## Make the key decimal, expand it to fill 256
    ## places in an array
    FOREACH HexVal IN [SHOW hexKeyList] {
        [scan $HexVal %x KeyStr]
        [lappend keyList $KeyStr]
    }
    set i 0
    for {set loop 1} {$loop <= 32} {incr loop} {
        for {set doubleloop 0} {$doubleloop <= 7} {incr doubleloop} {
            array set cypherHex [list $i [lindex $keyList $doubleloop]]
            incr i
        }
    }
    FOREACH num IN $buffer {
        [array set K [list $num $cypherHex($num)]
        NULL]
    }

    ## Delete more key variables in case of stack dump.
    unset hexKeyList keyList cypherHex

    ## Use the key array to mix the state array into an
    ## encrypting variable array
    set i 0
    set f 0
    FOREACH i IN $buffer {
        [SET f [expr ($f + $S($i) + $K($i)) % 256]]
        [SET tempVal $S($i)]
        [array set S [list $i $S($f)]
        NULL]
        [array set S [list $f $tempVal]
        NULL]
    }

    ## Get rid of the Key array. Now it should not be
    ## feasable for a user to crash the system with
    ## invalid plaintext and derive the key from any
    ## existing variables.
    unset K

    ## Create a hex, then decimal list of the plaintext
    set i 0
    set f 0
    set c 0
    for {set l 0} {$l < [string length $plainText]} {incr l} {
        lappend ccList [string index $plainText $l]
    }
    FOREACH HexVal IN [SHOW ccList] {
        [scan $HexVal %c plainStr]
        [lappend plainList $plainStr]
    }

    ## Encrypt the plaintext by deriving a number from
    ## the encrypting variable array to use and
    ## XOR'ing  it with the value of the plaintext
    FOREACH num IN $plainList {
        [SET i [expr ($i + 1) % 256]]
        [SET f [expr ($f + $S($i)) % 256]]
        [SET tempVal $S($i)]
        [array set S [list $i $S($f)]
        NULL]
        [array set S [list $f $tempVal]
        NULL]
        [SET t [expr ($S($i) + $S($f)) % 256]]
        [SET encrByte $S($t)]
            [array set resultSet [list $c [expr $num ^ $encrByte]]
        incr c
        NULL]
    }
    SET base64String "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
    set counter 0
    set cardLen [array size resultSet]
    FOREACH num IN {1 2 3 4 5 6} {
        [IF {[SHOW counter] != [SHOW cardLen]} {
            [append cipherText [string index $base64String [expr [SHOW resultSet([SHOW counter])] / 4]]]
            [incr counter; NULL]
            [IF {[SHOW counter] != [SHOW cardLen]} {
                [append cipherText [string index $base64String [expr ([SHOW resultSet([expr [SHOW counter] - 1])] % 4) * 16 + ([SHOW resultSet([SHOW counter])] / 16)]]]
                [incr counter; NULL]
                [IF {[SHOW counter] != [SHOW cardLen]} {
                    [append cipherText [string index $base64String [expr ([SHOW resultSet([expr [SHOW counter] - 1])] % 16) * 4 + ([SHOW resultSet([SHOW counter])] / 64)]]]
                    [append cipherText [string index $base64String [expr [SHOW resultSet([SHOW counter])] % 64]]]
                    [incr counter; NULL]
                } ELSE {
                    [append cipherText [string index $base64String [expr ([SHOW resultSet([expr [SHOW counter] - 1])] % 16) * 4]]]
                    [append cipherText "="]
                }]
            } ELSE {
                [append cipherText [string index $base64String [expr ([SHOW resultSet([expr [SHOW counter] - 1])] % 4) * 16]]]
                [append cipherText "=="]
            }]
        }]
    }

    unset buffer S i f c HexVal plainList ccList l resultSet counter cardLen base64String
    return
}]

Slashdot Login

Need an Account?

Forgot your password?

Submission Text Formatting Tips

We support a small subset of HTML, namely these tags:

  • b
  • i
  • p
  • br
  • a
  • ol
  • ul
  • li
  • dl
  • dt
  • dd
  • em
  • strong
  • tt
  • blockquote
  • div
  • quote
  • ecode

"ecode" can be used for code snippets, for example:

<ecode>    while(1) { do_something(); } </ecode>