My game uses configuration files in JSON format. One of them is used for setting up keyboard bindings, and it looks like this:
{
"Escape": "Exit",
"S": "MoveDown",
"A": "MoveLeft",
"D": "MoveRight",
"W": "MoveUp"
}
In the Main method of the Program class (my composition roo...
@amon - I am mostly OK with the wiki rampage, with the conditions that the tag is already being used on CR, there is no wiki text at all yet, and that the copy/paste is checked for working links, and other basics first
@syb0rg FYI: UTF-8 uses up to six bytes of encoding – four bytes are needed for the basic multilingual plane, but there is more. Also, UTF-16 is not a fixed-width encoding, and uses four or eight bytes.
I have rewritten the script in another fashion. Beware all you code is almost exactly the same.
A number of personal preferences I would like to share, that I thought while reading your code but which I did fix in my own code in all cases.
I like (foo === false) better then (! foo) or foo (!==...
I say good night, then go brush my teeth, then check in again, then check on the cat, then check in again, then climb in to bed, keep reading a bit, maybe answer something, then it's suddenly 2am, and I really go to bed.
@RonniSkansing I think it would be a better review if your answer explained the design decisions your rewrite has made (extracting methods), and why. Also don't think you need to rewrite the OP's code in every answer, a couple of useful points/observations (like the comment you made on the question) can be a fine answer, too :)
@Mat'sMug thanks for the feedback. It was also a getting abit tiresome writting the code, the function was so loaded i kept segregating and it was not even enough
I would have like to added a couple parsers / converters more so she/he could seen the ideal behind it.
@RonniSkansing I think it was worth the +1 I gave it. One of the things we are trying to encourage is lots of answers for questions. If you have some things to say, that add value, then you can just say the parts that count... otherwise reviews can take a really long time.
Similar: How was programming done 20 years ago?
OOP is quite fashionable nowadays, having its roots in Simula 67 in the 1960s, and later made popular by Smalltalk and C++. We have DRY, SOLID, many books about design patterns in the object-oriented world.
But what were the main principles in pr...
This is probably subjective but I'm wondering what the best/most used practices are when it comes to if/else if/else statements in Java regarding the following:
often times I'll see something like this:
if (someCondition == true) {
//do this
}
Other times I see stuff like:
if (someCondit...
I'm making a Backbone-Marionette app with a file structure that matches restful verbs as much as possible. It looks something like this:
+ backbone
+ apps
+ student
+ show
+ list
+ new
+ lesson
+ show
+ new
+ edit
If for example the student show co...
> Continual abuse of the system which causes multiple reversals can lead to a suspension, but the review process for such a suspension is completely manual. No automated flags are ever generated for this behavior, though moderators do have access to some statistics that can help fight repeat offenders.
What is voting fraud?
Voting fraud is when a single user continually voting (up or down) on many of your posts within a short period of time. This is not considered normal behavior and the system will not allow it. If it continues to happen between two certain IP addresses (voting each other up)...
One immediate change I'd make is how you're handling errors. While try-catch blocks are extremely common in other programming languages, I actually don't see them al that very often in Objective-C.
That doesn't mean we won't have errors. It just means error handling is typically handled differ...
I don't know about other languages, but most of the time, with Objective-C, you can just point to Apple's own stuff as the correct example of how to do something.
But with that said... Apple really, really, really hates MVC.
So, my boss has been a little grumpy over the past 2 days. Yesterday morning I mentioned that I could scan QRCodes easily.. and now... he's changing the desktop software to use QRCodes instead of Code39...
And then at lunch, after he had been messing with QRCode stuff all morning, I had found a bug in a trigger on a table in the database... and he spent the rest of yesterday afternoon and all day today unraveling it all and trying to fix it....
But the database is really complicated... and over the past 10 years, lots of people have had their hands in writing the triggers/stored procedures/etc... and some of those people were certainly morons.
@nhgrif - in my meager experience, getting anything apple to talk to anything not-apple is 'really fun', and the next most 'really-fun' think is getting anything apple to talk to anything else apple.
Apple and communication are not words that go together often
The library I'm using to talk to SQL server can't return NULLs, can't return varchar/text longer than 256 characters, and I don't have any way of putting a timeout on the query, only on the connection attempt.
I'm wrapping pretty much everything in ISNULLs, and if I get data overflow, then I just requery a new table where row 1 is the first 256 chars, row 2 is 257-512, etc.
How can I optimize my following code.
It works like a charm but I think it is too long and I'm sure it could be optimized.
If I have another form, I ll need to copy paste some line from my PHP code and it ll be quickly overkill.
Thanks.
--
JS:
<script>
$(document).ready(function() {
$('...
@nhgrif I'm done.... this is interesting, but, it makes me realize that apple stuff is not for me... what you gain in 'UX' is more than lost in compatibility and functionality
I can't even get iTunes to work the way it should... there's no ways I'm going to fight with compatibility layer issues on stuff that was solved last century
Well, talking with SQL Server is the only problem I've run into actually.
lol
If it weren't for the fact that I'm writing an app to work with an existing program and existing databases, I'd start by using MySQL, and I'm pretty sure iOS has some better ways of talking to MySQL.
I play with 'big' systems in my day job, and small systems for fun ... there would be no reason for me to hit apple stuff at work, and I have made a personal policy not to buy anything apple if it requires iTunes.... which, as it happens, is a useful measure of all things apple
With iOS7, Apple introduced AVCaptureMetadataOutputObjects, which is used for scanning barcodes. If you check out the web for how to scan barcodes in iOS, almost everyone is talking about ZBarSDK. And before iOS7, this was definitely the way to go. But as of iOS7, ZBarSDK has a pretty nasty me...
With iOS7, Apple introduced AVCaptureMetadataOutputObjects, which is used for scanning barcodes. If you check out the web for how to scan barcodes in iOS, almost everyone is talking about ZBarSDK. And before iOS7, this was definitely the way to go. But as of iOS7, ZBarSDK has a pretty nasty me...
This was one of the first directives I made when learning Angular. I'm revisited it since learning karma/jasmine testing. It is an Angular version of Dave Rupert's FitText.
When I first started out with Angular I didn't like the idea of 'unnecessary' wrapping elements being created by directives...
I have code which gets data from a POST request (request.form dict), compares with corresponding attribute in object accident and does some action. The code looks needlessly verbose. How can I optimize it?
if accident.status == 1:
if request.form.get('reason') \
and request.form['re...
I'm taking most of this from the OP's code, where he uses a 2D C-style array (as a global variable). Those are the sizes he uses, but I suppose I should adjust them.