Salaries



  • @CPound said:

    On top of that, I was recently tested to have an IQ of 130. And I'm not talking about some online IQ test. I took the real deal. (How many of you in this forum can say you have an IQ above 70?)


    People that need to include references to their IQ in an argument are quite sad. Your IQ is not relevant to the conversation at all.

    How do you think Godel's Incompleteness Theorem would have been received if it consisted simply of the statement, "I have an incredibly high IQ. Quod erat demonstrandum."

    Now, continuing to deal with this great IQ test you took. There are two possibilities here:
    1. You actually took an honest to goodness IQ test. OR
    2. You are lying about having taken an IQ test.

    Either situation reveals quite a bit about your personality. In the first, you're frightened and weak-willed and are ever mindful of wanting to prove yourself. You're the guy that has to constantly yell, "I'm smart! I'm smart!" to people, rather than just being intelligent. This first option also flies in the face of the philosophy you're spouting. (I use the word philosophy very loosely.) Your whole schtick is that, for instance, the bridge question is invalid because it doesn't relate directly to a real world problem (leaving aside that it does). Similarly, it can easily be argued, that the IQ of a person has nothing to do with real world problems. Why would you take a test to prove something that has no consequence?

    The second option above is more clear-cut. You've lost all hopes of thinking that even you're correct in what you're saying and so have taken up lying.

    In either of the above, it is clear that you are a troll. You have consistently lied and said foolish things here. It is time to stop. Take your bat, ball, and glove and go home - never to return swine.

    sincerely,
    Richard Nixon



  • It's not that I'm being evasive,

    Yes it is.

    I just refuse to answer stupid questions.

    You've deemed everything to be "stupid" or a "trick".  That's evasive.

    Sure, I can do the math problems. I aced all my CS calculus classes (Calculus I-III) and thought they were no-brainers. On top of that, I was recently tested to have an IQ of 130. And I'm not talking about some online IQ test. I took the real deal. (How many of you in this forum can say you have an IQ above 70?)

    (a) @_@
    (b) What are you, twelve or something?
    (c) @_@
    (d) only 130?
    (e) @_@

    I'm not trying to be insulting, I'm just letting you know that I can do the math. It's just that I choose not to.

    And this is why people think you're an incompetent.

    It's insulting to me to be asked that type of math question because it doesn't give me enough options.

    I'm sorry?

    The string builder question had a great many options, but you dismiss that.  The bridge question is at the other end of the scale yet you dismiss that too?

    In the real business world, we have to come up with creative solutions for our customers on the fly.

    Nonsense.  Your customers don't stand behind you peering over your shoulder as you write a program.

    That means you have to think "outside the box".

    @_@

    And quickly. No real-life customer is going to ask you the lantern/bridge question. That's complete trivia. A typical customer request could be "Make my VB.NET application with MS Access backend run across four servers with no performance loss to the end user. Oh, and make it enterprise." Keep in mind you can't choose another backend. That's the type of quick, creative-thinking we have to do on our job. Just out of curiosity, how would you handle this customer request? (I'm smiling right now, thinking about all the wacky "inside the box" ideas you guys will give me.)

    I wouldn't.  Because "make it run on four servers" is not the actual demand.  "Make it run on four servers" is someone's opinion of what the technical solution is.  What is the *problem* that you are wanting solved?  If your customers are requesting that kind of thing from you then your customers need educating; they need to learn how to ask the right questions.  My employers pay me for my technical expertise.  If they from their position of technical ignorance try to determine the implementation of what I do then the project is doomed from the outset.

     



  • @CPound said:

    A typical customer request could be "Make my VB.NET application with MS Access backend run across four servers with no performance loss to the end user. Oh, and make it enterprise." Keep in mind you can't choose another backend. That's the type of quick, creative-thinking we have to do on our job. Just out of curiosity, how would you handle this customer request? (I'm smiling right now, thinking about all the wacky "inside the box" ideas you guys will give me.)

    Load balancing with MS Access sounds very odd, but I'll try to play your little game anyway. Let's just assume your customer insists on using MS Access and will not accept Oracle, MS SQL Server, DB2, Sybase or anything else any sane person would use for this task. Let's further assume your customer is rich enough to pay so much money that we are willing to do it, despite the obvious moronism of such a setup.

    The first step would be to identify which tables are, from the perspective of the web servers, read only. This are likely many of the tables, e.g. the product catalogue. I would create a "database" with these tables and copy it to every of the four servers. Therefore, since most actions in the web application are most likely read only, there is no performance loss. A second database contains the tables which are written by the web application and must be shared, e.g. the actual inventory table. This database is placed on the strongest machine and shared between those four servers. If necessary, there can be a third database with tables which are written by the web app, but don't need to be shared, e.g. logging. Each server keeps his own copy of this database; they are merged later when necessary. To make the application "Enterprise" lol, the smallest and  most unimportant table is replicated using XML and SOAP, so it's very enterprisy.



  • I agree with ammoQ and DrPizza on this one, which is what I alluded to in my post above.  The way CPound stated the problem makes it sound like his organization is a bunch of "yes" men doing exactly what the customer says (he states nothing about having a conversation about alternate solutions).  This is a dangerous situation if the customer doesn't fully understand the consequences of their technical decisions.  Load balancing/failover clustering with an Access backend is far from the ideal and is risky in terms of stability, data integrity, and performance. 

    CPound keep in mind your company's reputation is on the line with every solution you develop.  If your customer demands this type of idiocy as a long term solution, perhaps it is best to end the relationship.  The immediate gains of this contract may not outweigh the risk to your company's reputation and ability to win further business opportunities.

    Larry



  • @lpope187 said:

    If your customer demands this type of idiocy as a long term solution, perhaps it is best to end the relationship.  The immediate gains of this contract may not outweigh the risk to your company's reputation and ability to win further business opportunities.
    I'm impressed. You got it. This is exactly what happened. The relationship was ended as soon as we discovered the client was opposed to alternative solutions. We did not even waste time coming up with Access solutions. We knew it wouldn't work at the outset. A lot of you wouldn't have considered bailing out a solution, because it is definitely "oustide the box" thinking. Good job Larry.



  • @CPound said:

    @DrPizza said:
    In other words, you try to
    be evasive instead of acknowledging that there are limits to your
    ability.
    It's not that I'm being evasive, I just refuse to
    answer stupid questions. Sure, I can do the math problems. I aced all
    my CS calculus classes (Calculus I-III) and thought they were
    no-brainers. On top of that, I was recently tested to have an IQ of
    130. And I'm not talking about some online IQ test. I took the real
    deal. (How many of you in this forum can say you have an IQ above 70?)
    I'm not trying to be insulting, I'm just letting you know that I can do
    the math. It's just that I choose not to. It's insulting to me to be
    asked that type of math question because it doesn't give me enough
    options. In the real business world, we have to come up with creative
    solutions for our customers on the fly. That means you have to think
    "outside the box". And quickly. No real-life customer is going to ask
    you the lantern/bridge question. That's complete trivia. A
    typical customer request could be "Make my VB.NET application with MS
    Access backend run across four servers with no performance loss to the
    end user. Oh, and make it enterprise." Keep in mind you can't choose another backend.
    That's the type of quick, creative-thinking we have to do on our job.
    Just out of curiosity, how would you handle this customer request? (I'm
    smiling right now, thinking about all the wacky "inside the box" ideas
    you guys will give me.)




    not that it matters a single bit, but I took a real IQ test (like
    yours) and got over 150 (believe it or don't I don't care).  then again, I don't go straight from the
    test and get on my favorite online forums and use that number to try to
    win arguments.  also, a lot of CS problems are very
    confining.  for instance, taking finding a min spanning
    tree.  there is a very well known algorithm to find it given a set
    of vertices that relies on the correctness of a certain truth. 
    you can't levitate between points or blow up edges either. 
    Another thing is about your obsession with "inside/outside the
    box."  Part of the thing that makes code good is that it is easily
    maintanable and extendable.  that means that crazy off the wall
    solutions often aren't good code because it takes forever to figure out
    what is going on.  "the box" in computer science has been
    developed by geniouses like Dijkstra and many of the ideas inside it
    are damn good if not optimal.   for instance, try sorting
    numbers outside the box better than other people who use known
    algorithms.  you can't because the current techniques have been
    proven to be optimal. 



  • @CPound said:

    The relationship was ended as soon as we discovered the client was opposed to alternative solutions. We did not even waste time coming up with Access solutions. We knew it wouldn't work at the outset. A lot of you wouldn't have considered bailing out a solution, because it is definitely "oustide the box" thinking.

    Usually it's not up to the developers to decide on that. In many cases, management has already signed the contract and it's up to the developers to fullfill it. Either you (try to) do it or you quit your job. Depending on your private situation and the job market, the later might not even be an option.



  • @tster said:

    Another thing is about your obsession with "inside/outside the
    box."  Part of the thing that makes code good is that it is easily
    maintanable and extendable.  that means that crazy off the wall
    solutions often aren't good code because it takes forever to figure out
    what is going on.  "the box" in computer science has been
    developed by geniouses like Dijkstra and many of the ideas inside it
    are damn good if not optimal.   for instance, try sorting
    numbers outside the box better than other people who use known
    algorithms.  you can't because the current techniques have been
    proven to be optimal. 


    I do not completely agree with that, for at least two reasons.
    Reason one: The algorithms developed by Dijkstra, Knuth etc. are optimal for the general case, but in a specific case, I know more about the circumstances. For example, in many cases, I know the keys that will be put into a hashtable. My home-brew hash algorithm might be inferior in the general case, but in my specific case, it's possible that it beats the best universal hash algorithms.
    Reason two: Thinking outside the box is a dirty job, but someone has to do it. Most who try will fail, but some will succeed and they might become the founders of the next disruptive paradigm shift.



  • @tster said:

    also, a lot of CS problems are very
    confining.  for instance, taking finding a min spanning
    tree.  there is a very well known algorithm to find it given a set
    of vertices that relies on the correctness of a certain truth. 
    you can't levitate between points or blow up edges either. 
    Another thing is about your obsession with "inside/outside the
    box."  Part of the thing that makes code good is that it is easily
    maintanable and extendable.  that means that crazy off the wall
    solutions often aren't good code because it takes forever to figure out
    what is going on.  "the box" in computer science has been
    developed by geniouses like Dijkstra and many of the ideas inside it
    are damn good if not optimal.   for instance, try sorting
    numbers outside the box better than other people who use known
    algorithms.  you can't because the current techniques have been
    proven to be optimal. 


    I'm going to have to nitpick this a bit, not because I fully disagree, but because I believe it needs clarification.  Many of our commonly used algorithms haven't been proven to be optimal, but it's still very hard to find better solutions.  Without becoming too technical, take string-searching;  The well-known BMH algorithm had tuning made to it for efficiency as recently as 1991.  We don't know if it's the optimal.  We also don't know if P=NP [an example of a problem where we see this can be found in (Coder Challenge)->(Electorial College)], which makes a large classification of problems hard to solve.  Someone does need to think 'outside the box' to find better solutions.

    I agree completely that off-the-wall solutions aren't necessarily good.  Programming is far closer to architecture than painting; and originality for it's own sake and despite the feelings of most Randists, is generally far from optimal.  Building a skyscraper out of aged Gouda would be original, but probably not a good idea.  There are still plenty of choices to be made in the design of that building; that you are limited by minor niggles like practicality, efficiency and maintainability, does not limit your problem space enough to matter.

    CPound, I would agree with you insofar earlier as to say that I would prefer to give a customer a solution rather than no solution, but I'd rather spend the time giving them a good solution rather than any solution.

    I don't mind learning a bit more math or CS to do it.  Hell, I enjoy it.  Your disdain for the science behind those solutions is something I see daily... and generally by those who can't understand it, and believe that databases are some type of mysticism they can duplicate in a few lines of VBScript, and that any problem can be solved by throwing more technology [generally hardware] at a problem.  We laugh at those people here.  If, as you claim, you can understand it, and are simply trolling, please do so elsewhere.  If you honestly believe what you are professing, please don't resort to ad-hominem attacks, as that that antagonizes the people you're attempting to have a rational conversation with.



  • @CPound said:

    I aced all my CS calculus classes (Calculus I-III) and thought they were no-brainers.

    Wait, so these were college classes while you were doing a comp sci program?  Ahh, it sounds like you did get a bit of exposure to those academic things.  But you didn't remember what a linked list was.  Hmm.

    @lpope187 said:

    It also does not perform very well in multiuser environment (everybody is essentially accessing a 200Mb file over the network). 

    Ohhhhkay, gotcha.  And everyone seems to be using the same app?  If that's the case then I'd want to know if "no changes to the back end" meant "no changes to the application code" as well. 

    If we were allowed to change the app code, then it seems  like if you absolutely had to do it, you'd want to build some intermediate (proxy) layer to sit between the Access file and the client machines (doesn't sound like they are 'servers' at all).   The layer could be a web service, but doesn't have to be, pick whatever remoting-esque technology you like that VB can make use of.   Build the intermediate layer to broker communication with the access file.  All of the apps access the layer, only the layer actually talks to the access file.   Then you change the VB app to talk to the layer and not access directly.  

    If the app was reasonably well designed, then there's just a 'data layer' you'd have to swap out.  If it was poorly designed, then there's a bunch of "select * from" in there and you could probably even write a little code-generator that scanned the access structure and create the access classes for you.  If it were a .NET language, you could even just return a DataTable/DataSet and your client code wouldn't even have to change much, but you just said 'VB', so probably not. 

    That intermediate layer would also give you an access point you could build a 'dashboard' off of if you wanted to be able to monitor the performance of your new system; you can use it to cache commonly requested data, and if the company had any desire to support new applications or reporting, etc., it can talk to the new proxy layer and not have to incur any of the design problems of the VB app.

    The trick comes in writing the rules for controlling access to the access data and maintaining locking, etc., which depends a lot on how they want to use the app, and whether 4 is the limit, or if it's 4 with the intent of going to 40.   Could be simple, could get hairy, depending on the usage patterns.

    It's mostly 'academic' though because although a rough prototype might only take a week to build, you could sink a LOT of time into the details...enough that it eventually would have been cheaper just to buy an SQL Server Standard License ($7K), migrate the data, and then change the app to talk to SQL.    

    So, in the end, I'd probably have ended up having the customer decide not to go with me (since my solution would probably cost more than they want).  CPound and I would have had the same result, but I'd have explained why, given options...and if they really were desperate and said "We don't care if it costs $50K, just get it done!", then woo hoo.   

    But, I still don't know any more about Access than I did before, and so take the 5 minute analysis of the problem for what it is. :)   

    -cw



  • @CodeWhisperer said:

    If we were allowed to change the app code, then it seems  like if you absolutely had to do it, you'd want to build some intermediate (proxy) layer to sit between the Access file and the client machines (doesn't sound like they are 'servers' at all).   The layer could be a web service, but doesn't have to be, pick whatever remoting-esque technology you like that VB can make use of.   Build the intermediate layer to broker communication with the access file.  All of the apps access the layer, only the layer actually talks to the access file.   Then you change the VB app to talk to the layer and not access directly.  



    This proposal sounds much like "reinventing the wheel". Anyway, a transaction monitor on top of an Access database sounds like a fancy system architecture. Reminds me of V'Ger from the first Star Trek movie.



  • @ammoQ said:


    This proposal sounds much like "reinventing the wheel". Anyway, a transaction monitor on top of an Access database sounds like a fancy system architecture. Reminds me of V'Ger from the first Star Trek movie.

    Hey, never said it was the best solution, just _a_ solution; which is more than our friend CPound was willing to offer.  Personally, if the customer had been that obstreperous about changing platforms, I'd have gone to the MS company store, bought a copy of SQL Server ($50 I think for the Standard edition) and 'donated' it to them.  :)  

    -cw



  • I've had almost exactly the Access problem at work, because of limitations of a vendor product,  company policies, and the need for a local-only backup database.  I didn't need any of the info updated in realtime across systems, and the reason I needed the backup databases was to handle network problems.  [And it saved our... bottom lines... when Katrina hit]

    After a bit of experimenting, I ended up using a modified version of ammoQ's 3-db option.  CodeWhisperer's solution wouldn't have worked there because it was written specifically because of network problems.



  • @CodeWhisperer said:

    It's mostly 'academic' though because although a rough prototype might only take a week to build, you could sink a LOT of time into the details...enough that it eventually would have been cheaper just to buy an SQL Server Standard License ($7K), migrate the data, and then change the app to talk to SQL.


    I guess technically, you could use Access as the proxy agent itself.  Do a database upsize to SQL Server which will do most of the data migration for you.  Then setup the Access database to link directly to SQL. Your architecture would be VB app -> Access -> SQL.  You could replicate the Access database across four servers without all the hassle of partitioning the database and/or building a transaction wrapper.  You probably wouldn't have to change much of the DAL code either since it's isolated from the real database.

    It's definitely a WTF and probably violates the no backend change rule, but at least you can tell the customer you didn't replace Access - just supplemented it with additional horsepower.

    Larry



  • The relationship was ended as soon as we discovered the client was opposed to alternative solutions. We did not even waste time coming up with Access solutions. We knew it wouldn't work at the outset. A lot of you wouldn't have considered bailing out a solution, because it is definitely "oustide the box" thinking.

    There wasn't actually enough information to suggest that, as I didn't know the working relationship between the people making the demands and the putative implementers of those demands.  In my line of work my customers are principally employees of the company I work for (sometimes external customers directly, but mostly internal demands from the financial and business analysts), which means that "walk away" isn't a very useful approach; "work with the customer to get to the heart of the business problem and form an appropriate technical solution", however, is.  In previous employment, we were a consultant, so "walk away" was indeed a viable option.

    Unless of course the customer can (a) provide a sound rationale as to why it must be built in such a way (b) provide suitable compensation.



  • @CodeWhisperer said:

    Hey, never said it was the best solution, just a solution; which is more than our friend CPound was willing to offer.  Personally, if the customer had been that obstreperous about changing platforms, I'd have gone to the MS company store, bought a copy of SQL Server ($50 I think for the Standard edition) and 'donated' it to them.  :)
    If you really knew anything about enterprise solutions, then you would know it's not as easy as spending $50 for SQL Server Standard Edition. A lot of people in this forum have been calling me a troll and saying that I'm full of BS. But this last comment from you makes me really doubt your qualifications CW.



  • @Richard Nixon said:

    In either of the above, it is clear that you are a troll.
    Why do I have to be a troll? Is it because I state things that don't rest well with the masses? Is it because I disagree with some of you? At least I acknowledge people when they make valid points.@Richard Nixon said:
    You have consistently lied
    I "lied"? I agree I exaggerated on some of my posts to make a point. But everybody does that. Even you. And it would be stupid of me to give you exact scenarios because many people I know (former/current employers) read theDailyWTF. But rest assured, there are morsels of truth in most of what I say. It comes from several years of being in this industry. A lot of this stuff you just can't make up.@Richard Nixon said:
    and said foolish things here.
    You really had a problem with the IQ thing, huh? That must really tick you off that I scored a high IQ. Personally I don't care if you think I lied about it or not. It's just funny to me that it annoys you so much. You must have scored low.



  • @CPound said:

    @CodeWhisperer said:
    Hey, never said it was the best solution, just _a_ solution; which is more than our friend CPound was willing to offer.  Personally, if the customer had been that obstreperous about changing platforms, I'd have gone to the MS company store, bought a copy of SQL Server ($50 I think for the Standard edition) and 'donated' it to them.  :)
    If you really knew anything about enterprise solutions, then you would know it's not as easy as spending $50 for SQL Server Standard Edition. A lot of people in this forum have been calling me a troll and saying that I'm full of BS. But this last comment from you makes me really doubt your qualifications CW.

    Ohhhh no.  I've lost your trust.   How ever will I rebuild my shattered ego?    Did you see me saying that I didn't know anything about Access...or the little smiley face after my suggestion to just  buy them SQL?  Sheesh.  Loosen that tie, fuddy duddy.

    -cw

     



  • @tster said:

    not that it matters a single bit, but I took a real IQ test (like
    yours) and got over 150 (believe it or don't I don't care).
    Now look who's fibbing! If I had said I had gotten a 150 you would say you got a 170. And people call me a troll and a liar!



  • @CodeWhisperer said:

    Ohhhh no.  I've lost your trust.   How ever will I rebuild my shattered ego?    Did you see me saying that I didn't know anything about Access...or the little smiley face after my suggestion to just  buy them SQL?  Sheesh.  Loosen that tie, fuddy duddy.
    Grrrr!



  • @CPound said:

    @tster said:
    not that it matters a single bit, but I took a real IQ test (like
    yours) and got over 150 (believe it or don't I don't care).
    Now look who's fibbing! If I had said I had gotten a 150 you would say you got a 170. And people call me a troll and a liar!


    Like I said, you don't have to believe me.  I don't get my grins from people on the internet thinking I'm smart.  looks like noone here has your trust.



  • @CodeWhisperer said:

    Since everyone seemed to like the interview questions section that punctuated the tirades, here's one from a "programming challenge" that one company uses to screen applicants:

    Design and implement a class or set of functions to work with the following encoding of a fixed-point number. [...]

    No takers at all? Hmm, should a different thread for these be started, or should they go into the Coder Challenge?

    -cw



  • @CodeWhisperer said:

    @CodeWhisperer said:
    Since everyone seemed to like the interview questions section that punctuated the tirades, here's one from a "programming challenge" that one company uses to screen applicants:

    Design and implement a class or set of functions to work with the following encoding of a fixed-point number. [...]

    No takers at all? Hmm, should a different thread for these be started, or should they go into the Coder Challenge?

    -cw



    This example is too simple, sounds too much like 'doing a highschool kid's homework'


  • @CPound said:

    @CodeWhisperer said:
    Hey, never said it was the best solution, just a solution; which is more than our friend CPound was willing to offer.  Personally, if the customer had been that obstreperous about changing platforms, I'd have gone to the MS company store, bought a copy of SQL Server ($50 I think for the Standard edition) and 'donated' it to them.  :)
    If you really knew anything about enterprise solutions, then you would know it's not as easy as spending $50 for SQL Server Standard Edition. A lot of people in this forum have been calling me a troll and saying that I'm full of BS. But this last comment from you makes me really doubt your qualifications CW.



  • @ammoQ said:

    @CodeWhisperer said:
    @CodeWhisperer said:
    Since everyone seemed to like the interview questions section that punctuated the tirades, here's one from a "programming challenge" that one company uses to screen applicants:

    Design and implement a class or set of functions to work with the following encoding of a fixed-point number. [...]

    No takers at all? Hmm, should a different thread for these be started, or should they go into the Coder Challenge?

    -cw



    This example is too simple, sounds too much like 'doing a highschool kid's homework'


    OK kid, here's your homework (scnr):
    Disclaimer: I'm a Java programmer, this is C#, so don't be surprised if the style of this C# program is too java-eske.

    (edit) 2nd Disclaimer: There's room for improvement, e.g. getting rid of those magic numbers, making the number of integer/fraction digits variable etc. One might consider keeping the whole packed numer as-is instead of separating integer and fraction part.


    // created by ammoQ on 05.06.2006 at 09:24
    

    using System;
    using System.Text;

    public class FixedPointNumber {
    private int fraction;
    private int integer;
    private bool negative;

    public FixedPointNumber(double v) {
    	if (v<0) {
    		negative = true;
    		v=-v;
    	}
    	else {
    		negative = false;
    	}
    	
    	integer = (int)v;
    	fraction = ((int)(v*0x8000)) & 0x7fff;
    }
    
    // from packed value
    public FixedPointNumber(uint v) {
    	if ((v&(1<<31))>0) {
    		negative=true;
    	}
    	integer = (int) ((v>>15)&0xffff);
    	fraction = (int) (v&0x7fff);
    }
    
    public double ToDouble() {
    	double v = integer + ((double) fraction)/0x8000;
    	return negative?-v:v;
    }
    
    // output as a base2 number
    // to ouput as a base10 double, use ToDouble ;-)
    public override string ToString() {
    	StringBuilder sb = new StringBuilder();
    	if (negative) sb.Append('-');
    	for (int i=0x8000;i>0;i=i>>1) {
    		if ((integer&i)>0)
    			sb.Append('1');
    		else
    			sb.Append('0');
    	}
    	sb.Append('.');
    	for (int i=0x4000;i>0;i=i>>1) {
    		if ((fraction&i)>0)
    			sb.Append('1');
    		else
    			sb.Append('0');
    	}
    	
    	return sb.ToString();		
    }
    
    public static void Main() {
    	FixedPointNumber n = new FixedPointNumber(1.0);
    	Console.WriteLine(n.ToString()+" "+n.ToDouble());
    	n = new FixedPointNumber(-1.0);
    	Console.WriteLine(n.ToString()+" "+n.ToDouble());
    	n = new FixedPointNumber(2.0);
    	Console.WriteLine(n.ToString()+" "+n.ToDouble());
    	n = new FixedPointNumber(-2.5);
    	Console.WriteLine(n.ToString()+" "+n.ToDouble());
    	n = new FixedPointNumber(0x80017000);
    	Console.WriteLine(n.ToString()+" "+n.ToDouble());
    }
    

    }



  • @CPound said:

    @CodeWhisperer said:
    Hey, never said it was the best solution, just a solution; which is more than our friend CPound was willing to offer.  Personally, if the customer had been that obstreperous about changing platforms, I'd have gone to the MS company store, bought a copy of SQL Server ($50 I think for the Standard edition) and 'donated' it to them.  :)
    If you really knew anything about enterprise solutions, then you would know it's not as easy as spending $50 for SQL Server Standard Edition. A lot of people in this forum have been calling me a troll and saying that I'm full of BS. But this last comment from you makes me really doubt your qualifications CW.

    It seems that the Developer Edition is $50, not the Standard Edition.

    Anyway, for an enterprise solution you'd certainly need the Enterprise Edition. How could you not know that, CW?



  • @CPound said:

    @Richard Nixon said:
    In either of the above, it is clear that you are a troll.
    Why do I have to be a troll? Is it because I state things that don't rest well with the masses? Is it because I disagree with some of you? At least I acknowledge people when they make valid points.@Richard Nixon said:
    You have consistently lied
    I "lied"? I agree I exaggerated on some of my posts to make a point. But everybody does that. Even you. And it would be stupid of me to give you exact scenarios because many people I know (former/current employers) read theDailyWTF. But rest assured, there are morsels of truth in most of what I say. It comes from several years of being in this industry. A lot of this stuff you just can't make up.@Richard Nixon said:
    and said foolish things here.
    You really had a problem with the IQ thing, huh? That must really tick you off that I scored a high IQ. Personally I don't care if you think I lied about it or not. It's just funny to me that it annoys you so much. You must have scored low.


    You missed my point if you think I've wasted my time taking an IQ test.

    But then again, you just don't seem to get a lot of things. When I called you a troll, I was assuming that you were purposefully not getting the point in order to annoy people and incite replies. It's also possible that you're just that foolish.

    Either way, I think everyone should just ignore you.

    sincerely,
    Richard Nixon



  • @TDC said:

    It seems that the Developer Edition is $50, not the Standard Edition.
    Anyway, for an enterprise solution you'd certainly need the Enterprise Edition. How could you not know that, CW?

    Err... ?  I don't know what questions to take seriously here any more. :)  

     

    @AmmoQ said:

    // created by ammoQ on 05.06.2006 at 09:24

    I think the answer they were looking for used a single 32-bit int to hold the value in memory, but maybe the problem description was vague on that point.

    -cw



  • @CodeWhisperer said:

    @TDC said:

    It seems that the Developer Edition is $50, not the Standard Edition.
    Anyway, for an enterprise solution you'd certainly need the Enterprise Edition. How could you not know that, CW?

    Err... ?  I don't know what questions to take seriously here any more. :)

    I thought it was obvious that mine wasn't serious. :)
    But I do wonder how the "enterprise" solution would look like.


  • @CodeWhisperer said:

    I think the answer they were looking for used a single 32-bit int to hold the value in memory, but maybe the problem description was vague on that point.



    OK...


    // created by ammoQ on 05.06.2006 at 19:24

    using System;
    using System.Text;

    public class FixedPointNumber {
        private uint theNumber;
       
        public FixedPointNumber(double v) {
            uint sign=0;
           
            if (v<0) {
                sign=0x80000000;
                v=-v;
            }
           
            theNumber = sign|(uint)(v*0x8000);
        }
       
        // from packed value
        public FixedPointNumber(uint v) {
            theNumber = v;
        }
       
        public double ToDouble() {
            double v = ((double) (theNumber&0x7fffffff))/0x8000;
            return theNumber>0x7fffffff?-v:v;
        }
       
        // output as a base2 number
        // to ouput as a base10 double, use ToDouble ;-)
        public override string ToString() {
            StringBuilder sb = new StringBuilder();
            if (theNumber>0x7fffffff) sb.Append('-');
            for (int i=0x40000000;i>0x4000;i=i>>1) {
                if ((theNumber&i)>0)
                    sb.Append('1');
                else
                    sb.Append('0');
            }
            sb.Append('.');
            for (int i=0x4000;i>0;i=i>>1) {
                if ((theNumber&i)>0)
                    sb.Append('1');
                else
                    sb.Append('0');
            }
           
            return sb.ToString();       
        }
       
        public static void Main() {
            FixedPointNumber n = new FixedPointNumber(1.0);
            Console.WriteLine(n.ToString()+" "+n.ToDouble());
            n = new FixedPointNumber(-1.0);
            Console.WriteLine(n.ToString()+" "+n.ToDouble());
            n = new FixedPointNumber(2.0);
            Console.WriteLine(n.ToString()+" "+n.ToDouble());
            n = new FixedPointNumber(-2.5);
            Console.WriteLine(n.ToString()+" "+n.ToDouble());
            n = new FixedPointNumber(0x80017000);
            Console.WriteLine(n.ToString()+" "+n.ToDouble());
        }
    }       
           



  • @ammoQ said:

    @CodeWhisperer said:

    I think the answer they were looking for used a single 32-bit int to hold the value in memory, but maybe the problem description was vague on that point.



    OK...

    // created by ammoQ on 05.06.2006 at 19:24

    [...]

    LOL, well you didn't have to do that right away.   This looks about right, I think.  My version is a little longer, but has a few other functions (like GetBinaryString(), GetHexString()) and does some over/underflow checking, but none of that was part of the problem description.

    One useful .NET feature that I didn't know about until I was doing this problem: 

    int i = 75;
    string s = Convert.ToString(i, 2);    // radix = 2, also accepts 8, 10 & 16
    Console.WriteLine(s);

    Outputs ->  "1001011"   

    Then you can .PadLeft(32, '0') to fill out to 32 bits.

    -cw



  • @CodeWhisperer said:

    One useful .NET feature that I didn't know about until I was doing this problem: 

    int i = 75;
    string s = Convert.ToString(i, 2);    // radix = 2, also accepts 8, 10 & 16
    Console.WriteLine(s);

    Outputs ->  "1001011"   

    Then you can .PadLeft(32, '0') to fill out to 32 bits.

    Thanks for the tip, that's definitely gonna come in handy in my current project dealing with Active Directory GUIDs and SIDs.  Hell, I just recently figured out you could use .toString() to format dates.  Damn those wonderful third-party controls from ComponentOne that do all the formatting for you.  You really miss them when you don't have them.

    Larry




  • it better take radix of more than 2, 8, 10 and 16!



  • @tster said:

    it better take radix of more than 2, 8, 10 and 16!

    Sadly not.  Not sure why.  I built my own base-34 version a year or two back, it wasn't terribly difficult and wouldn't have been hard to generalize. 

    Maybe because there'd be debate about whether or not O or I should be included in higher radices?   But in that case you could build a converter that also took an 'alphabet' of letters to work from that would let people choose.   >shrug<  At least it does binary.

    -cw



  • @CodeWhisperer said:

    Sadly not.  Not sure why.  I built my own base-34 version a year or two back, it wasn't terribly difficult and wouldn't have been hard to generalize. 

    Maybe because there'd be debate about whether or not O or I should be included in higher radices?   But in that case you could build a converter that also took an 'alphabet' of letters to work from that would let people choose.   >shrug<  At least it does binary.

    It should at least take radix up to 65536 so we can finally use all those unicode characters.  Think about all the screen space we can save by representing 2,578,376,368 as ƏŊ. 

    Larry


  • @lpope187 said:

    @CodeWhisperer said:

    Sadly not.  Not sure why.  I built my own base-34 version a year or two back, it wasn't terribly difficult and wouldn't have been hard to generalize. 

    Maybe because there'd be debate about whether or not O or I should be included in higher radices?   But in that case you could build a converter that also took an 'alphabet' of letters to work from that would let people choose.   >shrug<  At least it does binary.

    It should at least take radix up to 65536 so we can finally use all those unicode characters.  Think about all the screen space we can save by representing 2,578,376,368 as ƏŊ. 

    Larry


    unicode makes me poke my own eyes out. 


  • @lpope187 said:

    @CodeWhisperer said:

    Sadly not.  Not sure why.  I built my own base-34 version a year or two back, it wasn't terribly difficult and wouldn't have been hard to generalize. 

    Maybe because there'd be debate about whether or not O or I should be included in higher radices?   But in that case you could build a converter that also took an 'alphabet' of letters to work from that would let people choose.   >shrug<  At least it does binary.

    It should at least take radix up to 65536 so we can finally use all those unicode characters.  Think about all the screen space we can save by representing 2,578,376,368 as ƏŊ. 

    Larry


    I think I'd lose my coworker's respect if I'd started to write numbers like ☼♪☺☺♫☻☻☻. They might think I needed a vacation.


  • @dhromed said:

    I think I'd lose my coworker's respect if I'd started to write numbers like ☼♪☺☺♫☻☻☻. They might think I needed a vacation.

    On the plus side, they'd never know when you were coming back.

    -cw



  • I'll be home when black men and white men sing together under the sun.

    I just had a vision of a base 2 pocket calculator.



  • @dhromed said:

    I'll be home when black men and white men sing together under the sun.

    I just had a vision of a base 2 pocket calculator.



  • @dhromed said:

    I'll be home when black men and white men sing together under the sun.

    I just had a vision of a base 2 pocket calculator.

    Take the Windows calculator, go to the View menu entry, select scientific, then choose Binary.  :)  

    I've got a base-1 calculator right here:  >opens up hand to reveal some rocks<   It doesn't go very high though...

    -cw



  • @CodeWhisperer said:

    @dhromed said:

    I'll be home when black men and white men sing together under the sun.

    I just had a vision of a base 2 pocket calculator.

    Take the Windows calculator, go to the View menu entry, select scientific, then choose Binary.  :)  

    I've got a base-1 calculator right here:  >opens up hand to reveal some rocks<   It doesn't go very high though...

    -cw

    (edited)

    My original reply was too mean spirited(not to either of you).

    You could use the fingers on one or both hands, depending on how many pockets you have free.  Although, in a tight situation, rocks can be thrown at an agressor with minimal training.



  • @CodeWhisperer said:

    @ammoQ said:
    @CodeWhisperer said:

    I think the answer they were looking for used a single 32-bit int to hold the value in memory, but maybe the problem description was vague on that point.



    OK...

    // created by ammoQ on 05.06.2006 at 19:24

    [...]

    LOL, well you didn't have to do that right away.   This looks about right, I think.  My version is a little longer, but has a few other functions (like GetBinaryString(), GetHexString()) and does some over/underflow checking, but none of that was part of the problem description.

    One useful .NET feature that I didn't know about until I was doing this problem: 

    int i = 75;
    string s = Convert.ToString(i, 2);    // radix = 2, also accepts 8, 10 & 16
    Console.WriteLine(s);

    Outputs ->  "1001011"   

    Then you can .PadLeft(32, '0') to fill out to 32 bits.

    -cw

    This is one of the things I'm coming to appreciate most about .net - the way a lot of common problems have elegant one liners to solve them.  When I tried to manipulate files for the first time, I was thinking, "this is ridiculous.  It takes pages of code to read all the lines from a file"... then I discovered File.ReadAllLines(), and life got simpler again.<FONT color=#008080 size=4>

    </FONT>


  • @Oscar L said:

    This is one of the things I'm coming to appreciate most about .net - the way a lot of common problems have elegant one liners to solve them.  When I tried to manipulate files for the first time, I was thinking, "this is ridiculous.  It takes pages of code to read all the lines from a file"... then I discovered File.ReadAllLines(), and life got simpler again.<font color="#008080" size="4"></font>



    [user@linux ]$ ./myfile > ./myprogram

    or alternatively

    char *monsterBuffer = calloc (sizeOfFile, sizeof (char));
    fgets(monsterBuffer,  sizeOfFile, FileStream);



  • @tster said:


    char *monsterBuffer = calloc (sizeOfFile, sizeof (char));
    fgets(monsterBuffer,  sizeOfFile, FileStream);


    fgets reads only to the first LF...

    This is what I use:

    char *readfile( char *name ) {
            int fd;
            struct stat buf;
            char *str;

            fd = open(name, O_RDONLY);

            if (fd<0) {
                    return NULL;
            }

            if ( fstat(fd, &buf) < 0 ) {
                    return NULL;
            }

            str = malloc(buf.st_size + 1);
            if (!str) {
                    close(fd);
                    return NULL;
            }

            str[read(fd, str, buf.st_size)] = '\0';

            close(fd);
            return str;
    }



    Note that this reads the whole file into one big string. The file is supposed to be some kind of text file.



  • @ammoQ said:

    Note that this reads the whole file into one big string.

    That's the point of the function, it breaks it up into strings for you:

    string[] arrayOfLines = File.ReadAllLines( filePath );

    I often end up working with really big data sets and got used to just doing it a line at a time:

    StreamReader sr = new StreamReader( filePath );

    string line;
    while ( (line = sr.ReadLine() != null )
    {
        // handle the line
    }

    sr.Close();   // can't forget to close it!

     



  • @CodeWhisperer said:

    @ammoQ said:

    Note that this reads the whole file into one big string.

    That's the point of the function, it breaks it up into strings for you:

    string[] arrayOfLines = File.ReadAllLines( filePath );

    I often end up working with really big data sets and got used to just doing it a line at a time:

    StreamReader sr = new StreamReader( filePath );

    string line;
    while ( (line = sr.ReadLine() != null )
    {
        // handle the line
    }

    sr.Close();   // can't forget to close it!


    That syntax looks a lot like the C++ version, except cleaner.  I pretty often forget about the getline friend function and try the member function, then stare at it for 5 minutes trying to remember what I'm doing wrong.  One of those legacy things that just can't be fixed.

    ifstream input_file(file_path);
    string line;
    while(getline(inputfile, line))
    {
        //do something with line, probably involving convoluted regexes.
    }
    //forget to close it.


  • oops...   I didn't mean fgets().... I mean read(). 
    however if you wanted to break it up into an array of strings then
    fgets would do it for you.



  • @CodeWhisperer said:

    @ammoQ said:

    Note that this reads the whole file into one big string.

    That's the point of the function, it breaks it up into strings for you:



    [code]
    #!/usr/local/bin/ruby -w
    # Read all lines into an array
    all_lines = File.readlines("some.file")

    # Read line by line
    File.foreach("some.file") do |line|
    # process line
    end
    [/code]

    Can't be bothered to do the "read in blocks of n lines" thing, it's about 7 lines of code.

    Simon

Log in to reply