Ektbear's Posts
Nairaland Forum › Ektbear's Profile › Ektbear's Posts
1 2 3 4 5 6 7 8 ... 136 137 138 139 140 141 142 143 144 (of 485 pages)
Perhaps get a large LCD monitor rather than your laptop screen? Also, spend more time reading paper copies of books, rather than on a computer? |
Indeed. Compilers are quite a bit smarter than you give them credit for. The size of the C++ code in which I used a long is 9383 bytes on my system. Using int instead gives me 9383 bytes. So actually didn't waste anything at all for me to use a long rather than an int. It would have hurt for dynamic memory allocation of course. But clearly for static, the compiler optimizes away. And the GNU compilers are probably some of the worst as far as optimization goes...no doubt Intel compilers would even more aggressively optimize. |
lordZOUGA: oh well, wrote that on my phone... Guess I was wrong in converting it to a pointer..I don't think your code works at all. From my investigations, you can't just convert an integer into a string. You'll need to call some library function to do the work for you (e.g., sprintf() or C++ iostreams). Something like this: http://www.cplusplus.com/articles/D9j2Nwbp/ But as I stated earlier, this is a very strange way to solve the problem. If someone asks me for the left-most digit of a 2 digit number, I'd just divide. Not convert to a string first. Same for an arbitrary K digit number. |
lordZOUGA: no, it won't optimize but it will compile. It will set aside space like you specifiedSo compilers are smart enough to recognize that, "hey, this variable actually can fit in smaller amounts of space. Let me use an int instead of the long he specified." So yes, it will optimize. You can probably compile the two different versions and the inspect the file size or assembly code. Likely identical output.. |
lordZOUGA: your code wasted memory.Finally, compilers are smart. It will optimize this away for me...no need to worry about it when writing code. |
Haha. So Ruby evidently does the same perverse thing that C++ does: 12500/1001.9.2-p318 :001 > 12500/10000 => 1 Octave doesn't: octave:1> 12500/10000 ans = 1.2500 Python behaves properly: >>> 12500/10000 1.25 Java does the same thing as C++: bsh % System.out.println(12500/10000); 1 Perverse default behavior, C++, Java, and evidently my beloved Ruby |
Code reusability also doesn't seems so relevant, given that the task at hand is narrowly defined. Plus, the proper generalization would be a function that returns the jth digit of a number. Again, you can do this w/o converting to a string (similar sort of idea). |
lordZOUGA: #include <iostream>This doesn't compile under g++: woo2.cpp: In function ‘int main()’: woo2.cpp:27:45: error: invalid static_cast from type ‘long int’ to type ‘char*’ Moreover, it seems some like a very clunky way of doing it. You are popping off digits from a number. Unnecessary to convert to a string first... |
mkwayisi: Am I missing something? What's up with this casting and long data types. Ain't it as simple as this:So I wasn't aware that C++ actually automatically casts when you do integer divided by integer into an integer. For example, in your example, technically the result is 1.2345. It seems that the default is to just truncate this to the integer 1, not the float 1.2345. As I'm not a C++ programmer, I didn't know a priori what the behavior would be. Hence my initial call to floor(). Your version definitely works too. |
Wait a second. One thing I forgot. Solar cells have a finite lifetime, right? Even if it were possible for you to get enough sunlight per year to break even, won't the increased sunlight shorten the lifespan of the cells? So your costs actually will go up. So even just a raw increase in hours of sunlight/year won't be enough...your costs will go higher since you have to replace the cells more frequently. Heh. So for a variety of reasons, Beaf's proposal is id1iotic. Man. This guy truly didn't do anything thinking at all. Na wa o |
Let us all pray that God will grant Nigeria 10,000 hours of sunlight this next year so that Beaf's business will be able to break even ![]() Aight. I think I'm done for the night. Peace ya'll |
Lord, this has been fun. I have not laughed so hard in some time. Cheap entertainment, this Nairaland ![]() |
All we need to do is to pass a law in Nigeria that mandates that there must be 10,000 hours of sun per year. After this minor obstacle is overcome, then cheap solar electricity for all!!! |
oyb: taking nigeria into the future 2020 here we comeVision 2020 Nigeria: https://upload.wikimedia.org/wikipedia/commons/f/f4/Mwamongu_water_source.jpg |
oyb, so it seems like evidently the place that gets the most sun is the Eastern Sahara. 4300 hours of sunshine per year. NYC evidently is in the neighborhood of 2600? So assuming that NYC is somewhat represenative of the cost in the US, you'd need only ~7,800-10,400 hours of sun per year to start being competitive with other fuel sources. Alas, not only is this ~2X what the sunniest place on earth gets...it (potentially) is more hours than exist in a year ![]() Looks like Beaf's business idea has a minor flaw in it. I hope that he has a backup plan ![]() |
Beaf: Not with stup!d ideas of purifying water with tonnes of electricity when unlike most of the US, the sun is overhead for us 365 days a year (to a buffoon like you though, hours are the only thing that matter). What a clown with an arse for a brain. Don't you look silly now?1 day = 24 hours 1 year = 365 (or 366) days Thus, it makes no difference whether one talks of hours of sunlight per year or days per year. The point is.... Given that a) solar is 3X or 4X as expensive as the competing energy sources b) you effectively need 3X or 4X more hours of sun per year to match the competing fuel sources It is simply physically/mathematically impossible for one to capture 3X or 4X more hours of sun per year than the US gets anywhere in Africa.. |
oyb: naija being what it is - i have multiple responsibilitiesYep. We've got to face this electricity problem squarely. Stop trying to run away or hide from it, like Beaf is doing. |
My ancestors were farmers and hunters. Men who obtained clean drinking water in a manner much like this: https://upload.wikimedia.org/wikipedia/commons/f/f4/Mwamongu_water_source.jpg Perhaps my sister, upon graduating from her Ivy League university in 2016 will be interested in returning to this way of life that her ancestors left so many years ago ![]() |
The funny thing to me oyb is that I was actually very interested in water purification as a kid. I even did a science fair project on it in 4th grade ![]() Spent a lot of time reading about it. Anyway, initially, I thought Beaf was just too dumb to realize that generating electricity from solar is expensive. Now I realize that he is just too dumb to realize that most businesses in the world that are profitable require electricity. His proposal to purify water w/o electricity is cute and all. But so would be a proposal by someone to use oxen and goats for transportation, rather than cars. Most Nigerians are in 2012, and trying to go to 2020. Beaf on the other hand is in 2012, and wants to go back to 1820. |
Beaf: Tell me how much electricity is needed for this na! Unimaginative braindead punk.I guess we just view the world in different ways. I've grown up in a world in which electricity is the lifeblood of business. It is just a basic tool that allows people to do things more efficiently and cheaply. In most of the world (not even just Western world. China, Brazil, etc too), it isn't even something you think about it. If you want to accomplish task X, you need electricity to do it. I'm sure that it is fun and enjoyable for you to think about how to purify water, access the internet, manufacture cars and planes, etc without electricity. But this is not the 1800s. This is 2012. If one is trying to build a successful, legitimate business/society/etc, then at some point you'll need electricity. Who knows, maybe you'll be able to convince some Nigerians abroad to return in Nigeria and pursue your 419 schemes. But for the vast majority, they'll be uninterested. |
Beaf, in the water purification business, you don't always have control over the source of your water. That is kind of the point...the water must be purified. It could be water from a river that might have feces in it. Or toilet water that must be purified and recycled. I.e., the same water that exits your house after you use the toilet, there is a company that purifies this water and makes it fit for use again. At least in the Western world, such companies use lots of electricity to purify the water. While your solar purification proposal is quaint, obviously it is not very practical beyond a niche setting. |
Which kyn 419 be dis |
Oyb, would you like to enter the solar water purification business with Beaf? A very profitable opportunity o! No electricity required! You just bottle the water and stick it out in the sun! Even if the water has dirt, toxins, feces, etc in it, clearly solar will be enough to remove all of that. And no doubt the masses will line up to consume your bottled drink. What say you? |
It is clear that I was wasting my time, talking to an unserious man. See the "business proposal" Beaf has for Nigerians who want to come home! Na wa ooo |
Good Lord. I am laughing so hard right now ![]() |
Na wa o So this is the electricity-less business Beaf wants Nigerians to return from abroad to do in Nigeria: https://upload.wikimedia.org/wikipedia/commons/thumb/f/f4/Mwamongu_water_source.jpg/739px-Mwamongu_water_source.jpg Solar water purification lmfao ![]() |
Beaf:How do I purify water without electricity? Sewage water, water with toxic chemicals, water from the ocean, etc. How on earth do you remove the pollutants w/o electricity? What fuel source are you using? If the sun, then you need some mechanism for capturing the solar energy and removing the muck from it. I.e., a solar cell... |
oyb: maybe beaf has a big plan for manufacturing solar panels locally -Hehe Let's even pretend magically that Nigeria can manufacture solar panels at the same exact price as the US can. Or Europe, etc. You are still faced with the same fundamental issues...you simply are not sucking up enough solar energy to make the panels cost-effective. You have a minor advantage in that you get more hours of sun per year than say North America does. But you don't get 3X or 4X as much sun. Which is what you'd need to be competitive with other fuel sources... This is kind of a simple and obvious point, lol. |
queensmith: has less poverty (relatively) lower unemployment rates and a better standard of living.I don't think that the UK has lower unemployment rates. Does it have lower poverty? Also, how are you defining "standard of living?" The typical standard of living of your average American is higher than that of your typical Brit. Higher income + lower taxes. |
Beaf: That is stupid. You are saying that out of ignorance.What percentage of the cost of purifying the water and producing the final product is electricity? Pick a number. We'll then work from there and I'll give you an estimate of how much more it will cost to use solar, versus using some other energy source. |
Beaf: You are stup!d for saying the bolded. I will floor you even in the field you studied, cos I am damn gifted and you are not.lmaooo. The fields I am involved in are too difficult for your small brain. They require strength in mathematics, for example. Please stick to cheap propoganda on NL. That doesn't require being "gifted"; you are better suited to this. Who cares what the cost of solar energy generation is in the US? Is Nigeria in the US? And do we need to follow their standards?Question. The cost of solar energy generation in the US. Is it a standard set by the government of the USA? Or by the laws of physics? By the fact that there are only 24 hours in a day, and typically roughly ~16 hours a day of usable sunlight?Perhaps we can pass a law in Nigeria that makes every day 75 hours, and for the sun to shine for 60 hours per day. |
oyb: it will be subsidised by the gej administration na. . .roflmao ![]() |
1 2 3 4 5 6 7 8 ... 136 137 138 139 140 141 142 143 144 (of 485 pages)
