thoughtcoder 167 Junior Poster

That's not a C# question have a nice day.

thoughtcoder 167 Junior Poster

base-64 encode it. base-96 (or whatever) encode it. encode it into unicode characters.

thoughtcoder 167 Junior Poster

They're aware. If it's anything like most sites, not a whole lot goes on in the employees only area/mod lounge/whatever its called anyway. (Although the site I adminned only has 100,000 members and this one has 5x that, so I'd imagine this one has a larger staff).

Only a third of the members can speak English and of them the average is too dumb to follow the link from the email, so the number's not really that big.

thoughtcoder 167 Junior Poster

I fail to understand why this thread is named what it is. No one's interested in Rashakil Fol anymore I guess.

I am very interested in him.* He is the reason I joined this forum.

You should unban him! I bet you are just jealous of the size of his Young modulus.

* Not in the way in which I am interested in Serkan.

Nick Evan commented: It's kinda funny how much the two of you have in common. It's like you're one and the same person ;) +17
iamthwee commented: I would agree with niek_e's observation. +19
thoughtcoder 167 Junior Poster

You could use code tags in your messages.

thoughtcoder 167 Junior Poster

It's hard to understand what you're trying to do with all that unindented code.

thoughtcoder 167 Junior Poster

What? So you're saying something different than what you wrote -- not that linked lists are useless but that one is already written for you. Too bad it's the bad of linked list, the mutable kind.

thoughtcoder 167 Junior Poster

Too bad they are still teaching these prehistoric methods.
Since Generics were introduced, link lists are pretty much useless in the real world.

This is a very wrong thing to say. Generics is a feature orthogonal to the question of what data structure to use for collections of things.

thoughtcoder 167 Junior Poster

Well I guess if you're Turkish then you can't be blamed for inheriting some of its stalker culture.

jephthah commented: aha +8
thoughtcoder 167 Junior Poster

I learned Sendur is an azerbaijani-originated name, are you azerbaijani? So where did your ancestors come from?

serkan sendur commented: this has nothing to do with my question to Dani +0
scru commented: It sure is funny though. +6
thoughtcoder 167 Junior Poster

Top-posting?

thoughtcoder 167 Junior Poster

The language versions are called C# 2 and C# 3. It's perfectly fine to start with C# 2.

thoughtcoder 167 Junior Poster

The same way you normally stop scanning bar codes?

thoughtcoder 167 Junior Poster

Let's learn some ways to write code more efficiently. If your code is hastily edited and cut for the sake of an example or you can't use things you've never learned and such, you don't need to reply back explaining yourself.
...

const string file = "File.TXT";

            // don't declare variables and assign them with values,
            // only to overwrite those values later.  How can you
            // stand it?
            string first = cBoxFirst.Text;
            string last = cBoxSecond.Text;

            // your stream reading code looked good, but note
            // you have this function available:
            string[] array = File.ReadAllLines(file);

            // note that you could have used
            // string[] array = nList.ToArray();
            // in your previous code.

            // you probably would want to sort your array here...

            int fIndex = Array.BinarySearch(array, first);
            int lIndex = Array.BinarySearch(array, last);

Also, make sure you read the documentation (http://msdn.microsoft.com/en-us/library/y15ef976.aspx) and see where negative numbers might be returned -- like when the string is not found.

thoughtcoder 167 Junior Poster

Is your array sorted? Binary search only works when the array is sorted. The contents of "File.TXT" would have to be sorted for it to work.

thoughtcoder 167 Junior Poster

So the question is: How to detect when last character found? You surely know how to do that? Well then, finding the recursive function that outputs them in reverse order is a simple matter of mentally stimulating exploration! Good luck!

thoughtcoder 167 Junior Poster

This is not a C++ question? This certainly isn't a compiler question...

thoughtcoder 167 Junior Poster

And why are you asking a question like this in the wrong thread.

thoughtcoder 167 Junior Poster

Well... when do you want it to terminate?

thoughtcoder 167 Junior Poster

Ok, the only problem with that is that it is (i believe) not a usual way to do this. I might forget that the project used functions for conversion, and if someone else did need to use libraries written by me, they might not even think about the possibility that functions were used for conversion. Am I right?

No. I would expect people to use plain old functions. There are large downsides to explicit conversion operators -- mainly that using them makes it hard to identify the places where you're using run-time casts, because they look the same. Implicit conversion operators make it difficult to read code outside of the IDE. Which we do at my workplace, in code reviews and when we don't want to open up a file from another branch in a whole new IDE instance. Using plain old functions, calling them with x.ToBar() or Bar.FromFoo(x) or possibly new Bar(x) doesn't have either disadvantage. Since using plain old functions reduces the probability of making an error, it makes sense to use them.

On the other hand, there might be advantages to using the TypeConverter framework that I'm not familiar with. But converting between equivalent types isn't exactly a hard problem.

thoughtcoder 167 Junior Poster

Why? What would you suggest instead?

Functions.

thoughtcoder 167 Junior Poster

I'm pretty sure the only way is to define an implicit conversion operator:
http://msdn.microsoft.com/en-us/library/z5z9kes2.aspx

Of course, it should be stressed: "Use it to enable implicit conversions between a user-defined type and another type, if the conversion is guaranteed not to cause a loss of data."

In fact, I think you shouldn't use implicit or explicit type conversion operators at all.

thoughtcoder 167 Junior Poster

The differences explained there are a pedantic wikipedian classification system. Hashes, checksums, and cryptographic hashes are all the same thing and are all designed for the same general purpose. The only difference between a "good hash function" and a "good checksum function" and such is that different traits are valued more intensely.

thoughtcoder 167 Junior Poster

Use reads.

> reads " 234 blah" :: [(Integer, String)]
[(234," blah")]
> reads "blah" :: [(Integer, String)]
[]

It returns a list of the different ways the desired thing can be parsed. For all standard types, this list is of length 1 or 0.

thoughtcoder 167 Junior Poster

Um, yes, it is a hash. Is hash not a synonym of checksum?

thoughtcoder 167 Junior Poster

I normally program in Java and Haskell to me seems completely alien and weird.

That's because it is. I normally program in Haskell and Java seems deficient and limiting. I don't think you really get a benefit out of learning Haskell until you learn more about type classes. But the benefit is huge.

All I want to do is read the contents of a file into a big string

Note that there is a function, readFile :: FilePath -> IO String , that does the opening and closing for you.

then be able to do stuff with that string ... Apparently I cannot convert an IO String to a String? But then how am I ever going to be able to use the functions I have written that need an input String?

He he he he he he he.

If I want to read a file and pass it to a function that needs a String, it's as simple as this:

countSpaces :: String -> Int
countSpaces s = length (filter (== ' ') s)

countSpacesInFile :: String -> IO Int
countSpacesInFile fileName = do
  text <- readFile fileName
  return (countSpaces text)

-- our program counts the number of spaces in input.txt
main :: IO ()
main = do
  n <- countSpacesInFile "input.txt"
  print n

In fact, you were already doing that, no? You were reading the contents of the file and passing it to the function storeReadFile, which happened to be doing nothing to it.

thoughtcoder 167 Junior Poster

C++ doesn't have automatic memory management, which is a very big deal. This means it takes a lot of knowledge to use the language efficiently. The language might be tolerable to people who have this knowledge, but not to those who lack it.