The Big Programming Thread - Page 656
Forum Index > General Forum |
Thread Rules 1. This is not a "do my homework for me" thread. If you have specific questions, ask, but don't post an assignment or homework problem and expect an exact solution. 2. No recruiting for your cockamamie projects (you won't replace facebook with 3 dudes you found on the internet and $20) 3. If you can't articulate why a language is bad, don't start slinging shit about it. Just remember that nothing is worse than making CSS IE6 compatible. 4. Use [code] tags to format code blocks. | ||
bangsholt
Denmark138 Posts
| ||
Shield
Bulgaria4824 Posts
It doesn't work at all even if it's wcout. Could it be because of my Windows font? If yes, isn't there a more cross-platform solution? I don't know how C# does it but no problems with its encoding at all. | ||
Manit0u
Poland17048 Posts
On August 05 2015 03:15 darkness wrote: Guys how are you even supposed to print that?
It doesn't work at all even if it's wcout. Could it be because of my Windows font? If yes, isn't there a more cross-platform solution? I don't know how C# does it but no problems with its encoding at all. Are you doing this in Windows terminal? This might help. Or possibly this. Also, I wouldn't use U16TEXT for that, U8TEXT (which should be standard cout since it's utf-8 by default, at least on Linux) or WTEXT should do the trick for you. Edit: Getting cyrillic to work according to MSDN.
| ||
Ropid
Germany3557 Posts
#include <iostream> The terminal treats text as UTF-8 for most people nowadays, so it will display correctly. Again, I only know this for Linux: Wide-char needs configuration before it works right. The thing with wide-char strings is that they need to be converted to char* for output. You need to configure a locale for this to work right. The default locale is "C" and can only do ASCII and the special characters from the wide-char string will get dropped. To make the program use the user's real locale is this: #include <iostream> You can't mix cout and wcout use. It leads to undefined behavior and the wchar stuff won't work (at least that's what happens here for me). I think this is POSIX, so it might be the same rules on Windows? | ||
Nesserev
Belgium2760 Posts
| ||
Djagulingu
Germany3605 Posts
| ||
Manit0u
Poland17048 Posts
On August 06 2015 16:00 Djagulingu wrote: Can anyone tell me some other sites like DZone? It doesn't seem like a very good site... Have you tried slashdot yet? | ||
Djagulingu
Germany3605 Posts
| ||
Manit0u
Poland17048 Posts
On August 08 2015 21:42 Djagulingu wrote: I just got out of a php programming interview where I got 3 questions out of 4. And i don't know shit about php. I fucking nailed it. Do you remember the questions? | ||
Djagulingu
Germany3605 Posts
They gave me this huge fucking ass project and asked me to: 1- Fix a table which is just plain html table as a string in php code, elements are obtained from a sql query, table is generated in a method using a fucking awful lot of for each-es. That was the question I couldn't solve. 2- Remove autocomplete from an element of a search form. Element was given autocomplete off as seen in "inspect element" and autocomplete exception in the php code. I removed the exception. 3- Add another field in the search form in #2. Copy-paste another field and change the name of the field. Easy. 4- There is a table in which you can select multiple rows, table showing sales totals, there is a button called SUM, takes the sales amount in usd, sums it and adds it in the table. Question is to implement another button, doing exactly what SUM button does, but without converting to usd. Table has sales amount, sales amount in usd columns seperately. Button makes an ajax call to another php page, I go there, copy the code, paste it right below, do some edits and BA-BAM. | ||
Manit0u
Poland17048 Posts
On August 09 2015 09:13 Djagulingu wrote: 1- Fix a table which is just plain html table as a string in php code, elements are obtained from a sql query, table is generated in a method using a fucking awful lot of for each-es. That was the question I couldn't solve. When I see HTML being constructed as a string inside of PHP I want to murder people | ||
Mindcrime
United States6899 Posts
On August 09 2015 11:31 Manit0u wrote: When I see HTML being constructed as a string inside of PHP I want to murder people What about when you see it done outside of PHP? I'm responsible for an automated report that goes out to multiple business analysts daily that does basically this... but with VB.NET. Maintaining it definitely makes me want to murder people. | ||
Djagulingu
Germany3605 Posts
On August 09 2015 11:31 Manit0u wrote: When I see HTML being constructed as a string inside of PHP I want to murder people The dude, who happens to be the boss of the 25-people startup I went to the quiz for, said before the start of the quiz these exact words: "As you would guess, nobody ever constructs html tables as a string inside php, but this code is written this way just to see how good the attendant's debugging skills are". Well, facing a huge fuckin ass string of tds, trs and shit with no debugging tools besides echo and console.log. I wanted to kill the guy and rape his corpse just to show my frustration. | ||
Birdie
New Zealand4438 Posts
On August 09 2015 11:31 Manit0u wrote: When I see HTML being constructed as a string inside of PHP I want to murder people As someone who has only dabbled in PHP and HTML (and have formed HTML using echos) how should you construct tables and so on in a PHP view without using PHP to construct the HTML in a string? | ||
Nerchio
Poland2633 Posts
| ||
Manit0u
Poland17048 Posts
On August 09 2015 18:23 Birdie wrote: As someone who has only dabbled in PHP and HTML (and have formed HTML using echos) how should you construct tables and so on in a PHP view without using PHP to construct the HTML in a string? You mean something like that?
Or constructing the entire table as a string inside of backend php code and then echoing the entire table? Above stuff would be acceptable if not for the existence of templating engines which keep your views free of PHP (you can read up on Twig or Blade if you want). Nowadays you do it so that your pages are html, not php (even though you write in php). I'm not even sure I wrote a working code above... All I write now is stuff like that (same thing as above, but using modern standards and Twig):
It's much easier to work with for the front-end people too. You can check out more here | ||
Sufficiency
Canada23833 Posts
| ||
tofucake
Hyrule18778 Posts
that'll dump the output from firstprogram into your script, then your script can do whatever it does and output its own thing | ||
Sufficiency
Canada23833 Posts
On August 09 2015 23:20 tofucake wrote: firstprogram > script.py that'll dump the output from firstprogram into your script, then your script can do whatever it does and output its own thing That will just overwrite my script The best I can think of right now is:
This works. But for some strange reason, the following doesn't work too well because there are considerable lags:
| ||
Manit0u
Poland17048 Posts
On August 09 2015 23:27 Sufficiency wrote: That will just overwrite my script The best I can think of right now is:
This works. But for some strange reason, the following doesn't work too well because there are considerable lags:
https://docs.python.org/2/library/subprocess.html | ||
| ||