|
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. |
On July 25 2013 05:44 tofucake wrote: There are a bunch of php websocket libraries. socketo.me is probably the most well known. And even without that PHP still supports sockets (I made a bnet bot in php+ajax almost a decade ago).
Yea I know I already realized that and removed that part.
On July 25 2013 05:43 fdsdfg wrote:
Isn't google chat (chat from the gmail web interface) done using ajax?
Just did a quick check doesn't look like ajax, or at least the firebug console doesn't show any ajax request that could be related to it. Yea, they use long polling or httpstreaming for it: http://stackoverflow.com/questions/2440135/is-long-polling-the-most-efficient-way-to-create-a-web-real-time-app/2440150#2440150 They arguably uses "Ajax", but not the same way how OP does
|
On July 25 2013 05:28 fdsdfg wrote:Show nested quote +On July 25 2013 05:12 czaku wrote:On July 25 2013 04:54 tofucake wrote:On July 25 2013 04:32 czaku wrote: Hi guys, i'd need some help from you, a couple of questions to be answered. A friend of mine has a project to do during holidays. She needs to low level format whole HDD (this means filling each byte with 0x0). And now it begins. It cannot show any dialog, so calling system("format c:/") is not an option. I've seen some codes in C++ but i'd prefer it to be C as i have it in school (basically whole theory covered so i only need experience and research) so i can understand your tips better. Is it even possible in C? In C++ i can try using CreateFile() and then ReadFile(), WriteFile() with HDD. But then i thought of bad sectors and it snared me. Any tips where i can start? Why? It's a project to pass the next semester from programming and she is not interested in learning it. So she asked for my help. Basically you show the teacher code, explain how it works and you passed. On July 25 2013 05:00 fdsdfg wrote:On July 25 2013 04:32 czaku wrote: Hi guys, i'd need some help from you, a couple of questions to be answered. A friend of mine has a project to do during holidays. She needs to low level format whole HDD (this means filling each byte with 0x0). And now it begins. It cannot show any dialog, so calling system("format c:/") is not an option. I've seen some codes in C++ but i'd prefer it to be C as i have it in school (basically whole theory covered so i only need experience and research) so i can understand your tips better. Is it even possible in C? In C++ i can try using CreateFile() and then ReadFile(), WriteFile() with HDD. But then i thought of bad sectors and it snared me. Any tips where i can start? Just write a 1-line batch file that calls format and throws the output away. You're reinventing the wheel if you try to write a new format utility for no reason. The problem is it has to be in C/C++ and i prefer C at the moment. You're asking for help on writing your friend's school project for her? She should fail if she can't learn the stuff. Programmers work on teams, and I wouldn't wish a useless teammate on any fellow programmer, which is what you're trying to inflict.
i too enjoy moralizing instead of shutting up when i am unable to answer.
|
On July 25 2013 05:02 LukeNukeEm wrote:Hi, I have a question for the c++-gurus: given template<class T = void> class foo { };
int main(void) { foo<> foo1; foo<int> foo2; } and that I am lazy, is there a way to make foo foo1; foo<int> foo2; legal? I know i can do this namespace detail { template<class T = void> class foo { }; } using foo = detail::foo<>;
int main(void) { foo foo1; detail::foo<int> foo2; } , but now i have to write detail:: for every class with a non-default template parameter. Is there any magic available to make this work, perhaps with template aliases?
I am afraid there isn't, but I do not really get your "problem". Writing "<>" is too much work? I find it helpful that the compiler makes one aware of which classes are actually templated.
|
I've got a question from a relative today what a programmer is supposed to do when it comes to "domain requirements", e.g. it's required from you to create software that will be used in (say) architecture development or any other non-computer field really. The problem is you're a software engineer not an architect, physician or whatever.
What I answered was that the contractor of the project (or the manager) should be responsible to teach/give enough material to programmers to fullfill application requirements. However, is this what's done in practice? Am I close to truth?
Edit: The purpose of the question was that he thinks everyone should understand everything even if it's just a little bit.
|
Hi. I am a relatively junior level programmer (2 years professional experience) who just got an actual programming job (UI Programmer) in the game industry. I was wondering if there was anyone else on the forums who works in the industry?
Edit: DM me, let's be friends!
|
On July 25 2013 05:55 nunez wrote:Show nested quote +On July 25 2013 05:28 fdsdfg wrote:On July 25 2013 05:12 czaku wrote:On July 25 2013 04:54 tofucake wrote:On July 25 2013 04:32 czaku wrote: Hi guys, i'd need some help from you, a couple of questions to be answered. A friend of mine has a project to do during holidays. She needs to low level format whole HDD (this means filling each byte with 0x0). And now it begins. It cannot show any dialog, so calling system("format c:/") is not an option. I've seen some codes in C++ but i'd prefer it to be C as i have it in school (basically whole theory covered so i only need experience and research) so i can understand your tips better. Is it even possible in C? In C++ i can try using CreateFile() and then ReadFile(), WriteFile() with HDD. But then i thought of bad sectors and it snared me. Any tips where i can start? Why? It's a project to pass the next semester from programming and she is not interested in learning it. So she asked for my help. Basically you show the teacher code, explain how it works and you passed. On July 25 2013 05:00 fdsdfg wrote:On July 25 2013 04:32 czaku wrote: Hi guys, i'd need some help from you, a couple of questions to be answered. A friend of mine has a project to do during holidays. She needs to low level format whole HDD (this means filling each byte with 0x0). And now it begins. It cannot show any dialog, so calling system("format c:/") is not an option. I've seen some codes in C++ but i'd prefer it to be C as i have it in school (basically whole theory covered so i only need experience and research) so i can understand your tips better. Is it even possible in C? In C++ i can try using CreateFile() and then ReadFile(), WriteFile() with HDD. But then i thought of bad sectors and it snared me. Any tips where i can start? Just write a 1-line batch file that calls format and throws the output away. You're reinventing the wheel if you try to write a new format utility for no reason. The problem is it has to be in C/C++ and i prefer C at the moment. You're asking for help on writing your friend's school project for her? She should fail if she can't learn the stuff. Programmers work on teams, and I wouldn't wish a useless teammate on any fellow programmer, which is what you're trying to inflict. i too enjoy moralizing instead of shutting up when i am unable to answer.
If he asked for $20 and you didn't send him $20, would it be right to assume that you don't have $20 to your name?
|
On July 25 2013 06:16 darkness wrote: I've got a question from a relative today what a programmer is supposed to do when it comes to "domain requirements", e.g. it's required from you to create software that will be used in (say) architecture development or any other non-computer field really. The problem is you're a software engineer not an architect, physician or whatever.
What I answered was that the contractor of the project (or the manager) should be responsible to teach/give enough material to programmers to fullfill application requirements. However, is this what's done in practice? Am I close to truth?
Edit: The purpose of the question was that he thinks everyone should understand everything even if it's just a little bit.
Probably not a bad idea to understand the industry in which your code will be running. In particular, there are script compliance rules for certain industries which require obnoxious certifications in order to have use your code. Check out MISRA for automotive, for example. http://en.wikipedia.org/wiki/MISRA_C In this sense, an 'industry panel of experts' has strict rules regarding what features of the language you can use, and how you should use them. It even has rules about benign features, like whitespace. Some certifications require some really strange stuff, like a clean desk, and showing up on time to work as part of the software requirements. I guess it makes sense that if you control the programmer's level of reliability, then his code ought to be more reliable as well. I figure that in pratice, there have been very few software bugs in certified environments, like automotive, space, trains, medical, architecture, etc...
+ Show Spoiler +Probably worth noting that code that is to specifications is usually 10x harder to debug than hacked together garbage from a jr. dev  .
|
On July 25 2013 07:20 RoyGBiv_13 wrote:Show nested quote +On July 25 2013 06:16 darkness wrote: I've got a question from a relative today what a programmer is supposed to do when it comes to "domain requirements", e.g. it's required from you to create software that will be used in (say) architecture development or any other non-computer field really. The problem is you're a software engineer not an architect, physician or whatever.
What I answered was that the contractor of the project (or the manager) should be responsible to teach/give enough material to programmers to fullfill application requirements. However, is this what's done in practice? Am I close to truth?
Edit: The purpose of the question was that he thinks everyone should understand everything even if it's just a little bit. Probably not a bad idea to understand the industry in which your code will be running. In particular, there are script compliance rules for certain industries which require obnoxious certifications in order to have use your code. Check out MISRA for automotive, for example. http://en.wikipedia.org/wiki/MISRA_C In this sense, an 'industry panel of experts' has strict rules regarding what features of the language you can use, and how you should use them. It even has rules about benign features, like whitespace. Some certifications require some really strange stuff, like a clean desk, and showing up on time to work as part of the software requirements. I guess it makes sense that if you control the programmer's level of reliability, then his code ought to be more reliable as well. I figure that in pratice, there have been very few software bugs in certified environments, like automotive, space, trains, medical, architecture, etc... + Show Spoiler +Probably worth noting that code that is to specifications is usually 10x harder to debug than hacked together garbage from a jr. dev  .
That MISRA stuff is interesting. Especially this:
Avoiding using functions and constructs that are prone to failure, for example, malloc may fail.
What do they use instead of malloc? Is there even an alternative to it for dynamic memory assuming they need one?
Plus, this seems like underestimating malloc imho. You can always:
if (variable != NULL) { ... } else { printf("Screw you\n"); }
|
|
|
On July 25 2013 05:12 czaku wrote:Show nested quote +On July 25 2013 05:00 fdsdfg wrote:On July 25 2013 04:32 czaku wrote: Hi guys, i'd need some help from you, a couple of questions to be answered. A friend of mine has a project to do during holidays. She needs to low level format whole HDD (this means filling each byte with 0x0). And now it begins. It cannot show any dialog, so calling system("format c:/") is not an option. I've seen some codes in C++ but i'd prefer it to be C as i have it in school (basically whole theory covered so i only need experience and research) so i can understand your tips better. Is it even possible in C? In C++ i can try using CreateFile() and then ReadFile(), WriteFile() with HDD. But then i thought of bad sectors and it snared me. Any tips where i can start? Just write a 1-line batch file that calls format and throws the output away. You're reinventing the wheel if you try to write a new format utility for no reason. The problem is it has to be in C/C++ and i prefer C at the moment.
You can run command line inside C++ using system() I think.
On July 25 2013 08:05 darkness wrote:That MISRA stuff is interesting. Especially this: Show nested quote +Avoiding using functions and constructs that are prone to failure, for example, malloc may fail. What do they use instead of malloc? Is there even an alternative to it for dynamic memory assuming they need one? Plus, this seems like underestimating malloc imho. You can always:
Maybe they prefer if you used realloc and calloc? No clue :d
On July 25 2013 02:11 tec27 wrote:Show nested quote +On July 24 2013 18:33 WolfintheSheep wrote:On July 24 2013 17:52 tec27 wrote:On July 24 2013 17:29 Blisse wrote: Programmers aren't Product Managers. Product Managers talk with higher-ups and Architects who may or may not communicate with Senior Developers before reaching decisions in what designs/implementation details are used in the product - way before you actually have a project to work on. Assuming you're not in very new start-ups, because for most programmers you'll be joining several years in and hopping right into their chosen language. Programmers rarely make real important implementation decisions unless there's a huge issue and/or oversight found. Whatever company you work at sounds incredibly dysfunctional and you should seek new employment ASAPly It sounds to me like you don't have much working experience in the field. Most companies anywhere work like this. Architecture and frameworks are chosen by cost evaluation, programming languages are chosen based on software compatibility or legacy code, and projects are always set before programmers and low-level designers have heard anything except rumours. And believe me, if you think that's dysfunctional, a company where programmers use whatever they want is several magnitudes worse. So you think a company where PM's are deciding what technology you'll use and "Solution Architects" (who are clearly, in his example, *not* anyone actually touching the code) are making decisions from on high which you have no actual say in makes for a good place to work? I'm not trying to insult the company, I'm just trying to give advice. If you work at a place that does that, they're treating you like shit and you can do better. If you want to be treated like shit, then have at it
Well, Solution Architects need to touch the code in order to know what it can and cannot do. Not sure where you got the idea that they knew nothing about coding, most of them were previous programmers and moved up? You have a say in what you do. It's just your say is not relevant unless the architect completely missed something in the design requirements.
On July 25 2013 02:55 tec27 wrote: Decent programmers are not going to say "I like python" and think that's a good reason for choosing it for a project. If your company doesn't trust you to be able to pick the right tool for the job, they think you're a moron and unless you actually believe you are a moron, you should find a new job. Its really not that difficult.
There are plenty of companies that will treat you like shit, I'm not arguing that they don't exist. I'm just saying that if you have any self-respect and desire to actually work effectively, you shouldn't work for them.
Do your companies actually allow you to pick your tools for the job? I'm not sure what kid of jobs we're describing here because I really don't think it's the same set. I'm not aware of jobs where you're given "arbitrary project" as a programmer and then management is like, "do it", and then you do it in whatever way you want. For the most part I would've thought sometime somewhere in management they've received design requirements from the customer and then they consulted with a consultant/architect on what can and cannot be done (who may consult with you if he/she requires), then they delegate the task to you and your programming team. Not sure what hierarchical system you're describing though.
Anyways, the way you describe this is like you're looking down on code monkeys, and while they're pretty bad, that's a huge reality of the profession and you shouldn't be an asshole about people who have to program in those environments and have yet to figure out they don't belong.
|
On July 25 2013 07:08 fdsdfg wrote:Show nested quote +On July 25 2013 05:55 nunez wrote:On July 25 2013 05:28 fdsdfg wrote:On July 25 2013 05:12 czaku wrote:On July 25 2013 04:54 tofucake wrote:On July 25 2013 04:32 czaku wrote: Hi guys, i'd need some help from you, a couple of questions to be answered. A friend of mine has a project to do during holidays. She needs to low level format whole HDD (this means filling each byte with 0x0). And now it begins. It cannot show any dialog, so calling system("format c:/") is not an option. I've seen some codes in C++ but i'd prefer it to be C as i have it in school (basically whole theory covered so i only need experience and research) so i can understand your tips better. Is it even possible in C? In C++ i can try using CreateFile() and then ReadFile(), WriteFile() with HDD. But then i thought of bad sectors and it snared me. Any tips where i can start? Why? It's a project to pass the next semester from programming and she is not interested in learning it. So she asked for my help. Basically you show the teacher code, explain how it works and you passed. On July 25 2013 05:00 fdsdfg wrote:On July 25 2013 04:32 czaku wrote: Hi guys, i'd need some help from you, a couple of questions to be answered. A friend of mine has a project to do during holidays. She needs to low level format whole HDD (this means filling each byte with 0x0). And now it begins. It cannot show any dialog, so calling system("format c:/") is not an option. I've seen some codes in C++ but i'd prefer it to be C as i have it in school (basically whole theory covered so i only need experience and research) so i can understand your tips better. Is it even possible in C? In C++ i can try using CreateFile() and then ReadFile(), WriteFile() with HDD. But then i thought of bad sectors and it snared me. Any tips where i can start? Just write a 1-line batch file that calls format and throws the output away. You're reinventing the wheel if you try to write a new format utility for no reason. The problem is it has to be in C/C++ and i prefer C at the moment. You're asking for help on writing your friend's school project for her? She should fail if she can't learn the stuff. Programmers work on teams, and I wouldn't wish a useless teammate on any fellow programmer, which is what you're trying to inflict. i too enjoy moralizing instead of shutting up when i am unable to answer. If he asked for $20 and you didn't send him $20, would it be right to assume that you don't have $20 to your name? depends on context.
|
On July 25 2013 08:24 Blisse wrote:
Do your companies actually allow you to pick your tools for the job? I'm not sure what kid of jobs we're describing here because I really don't think it's the same set. I'm not aware of jobs where you're given "arbitrary project" as a programmer and then management is like, "do it", and then you do it in whatever way you want. For the most part I would've thought sometime somewhere in management they've received design requirements from the customer and then they consulted with a consultant/architect on what can and cannot be done (who may consult with you if he/she requires), then they delegate the task to you and your programming team. Not sure what hierarchical system you're describing though.
Anyways, the way you describe this is like you're looking down on code monkeys, and while they're pretty bad, that's a huge reality of the profession and you shouldn't be an asshole about people who have to program in those environments and have yet to figure out they don't belong.
I think it depends on various factors including:
1. Size of team 2. Who came up with the project 3. Culture of organization (related to first 2)
If the team is going to be large and a "higher up" came up with the project, it is unlikely you will have much choice on something as core as the programming language or major tools that affect others. If on the other hand it is a smaller project, or you/your manager came up with the project idea yourselves and got it approved, then you could make almost any decision and as long as you can justify it, then go for it.
|
On July 25 2013 06:22 1handsomE wrote: Hi. I am a relatively junior level programmer (2 years professional experience) who just got an actual programming job (UI Programmer) in the game industry. I was wondering if there was anyone else on the forums who works in the industry?
Edit: DM me, let's be friends!
oh damn nice job. I want to get into UI programming maybe UX design, though design doesn't really fit into programming. congrats.
|
On July 25 2013 06:22 1handsomE wrote: Hi. I am a relatively junior level programmer (2 years professional experience) who just got an actual programming job (UI Programmer) in the game industry. I was wondering if there was anyone else on the forums who works in the industry?
Edit: DM me, let's be friends!
Hia, yeah, I also do UI programming for Ubisoft . Good luck in the field!
|
On July 25 2013 08:05 darkness wrote: What do they use instead of malloc? Is there even an alternative to it for dynamic memory assuming they need one?
Read up on the code they use on Mars. You don't use dynamic memory.
|
A php related question.
I'm working on some old code written by someone who I can't really get a hold of anymore. Is there a reason why these two blocks of code work differently in php? I just started dabbling with php within the last month.
$sql = "select achievement from achievement_list"; $sql = $sql." where achievement_id = "; echo "$sql<br>";
This echos "select achievement from achievement_list where achievement_id = "
$sql = "select achievement from achievement_list where achievement_id = "; echo "$sql<br>";
This echos nothing.
Another possibly somewhat related thing was trying this (this code is the same block as the first, except there's a value 1 at the end)
$sql = "select achievement from achievement_list"; $sql = $sql." where achievement_id = 1"; echo "$sql<br>";
This echos "select achievement from achievement_list where achievement_id = " missing the 1.
I realize the first two queries don't actually do anything. With a quick glance from anyone experienced with php, is this something obvious I am missing or there may be more than meets the eye and I would need to investigate deeper?
My actual end goal was to end up doing something like
$sql = "select achievement from achievement_list"; $sql = $sql." where achievement_id = $achievementsel"; echo "$sql<br>";
which I was trying to pass it some selection menu's value when the form was submitted. But it wasn't working, so I simplified the query and then ended up with the weird situations above.
|
Hyrule19173 Posts
|
Alright thanks. At least I know it is supposed to work.
|
Let me rewrite this to the simplest way possible.
$sql = "select achievement from achievement_list"; $sql = $sql." where achievement_id = 1";
//$sql = $sql." where achievement_id = ".$achievementsel;
$sql = "select achievement from achievement_list"; //$sql = $sql." where achievement_id = ".$achievementsel; $sql = $sql." where achievement_id = 1";
These two chunks of code, are not doing the same thing for me and I have no idea why.
+ Show Spoiler [frustration x1000000000000] + //$sql = "select achievement from achievement_list"; //$sql = $sql." where achievement_id = ".$achievementsel; //$sql = $sql." where achievement_id = 1";
$sql = "select achievement from achievement_list where achievement_id = 1"; echo "$sql<br>";
$sql = "select achievement from achievement_list where achievement_id = 1";
//$sql = "select achievement from achievement_list"; //$sql = $sql." where achievement_id = ".$achievementsel; //$sql = $sql." where achievement_id = 1";
echo "$sql<br>";
The first chunk of code prints "select achievement from achievement_list where achievement_id = 1". Second does nothing. For the record, the code after these lines just perform the query using $sql.
Wow this is so inconsistent, I don't even know what is going on anymore.
|
The comments and line breaks shouldn't affect anything. It looks like it is supposed to pull "achievementse1" from some form or something where the user inputs that value. I can't really tell what else is supposed to be going on with what you have shown.
|
|
|
|
|
|