A common metod is the following (called namespacing) - It created an encapsulated scope by immediately executing your function and returning the essential parts you need into your variable:
var yourNamespace = (function(window, undefined){
/* private code:*/
...
I'm sure it's speed up a lot of things since there is so much magic and everything is already there. The thing is when you don't know how everything works at first hand, it's hard (well I find it hard).
I need to append some query parameters to my API URL. The consumer of my API would pass me this optional structure called as APIParameters, which contain 5 optionals, one array of strings and rest strings
Lets assume the following:
let baseURL = "baseURL"
let path = "path"
This is the final ...
I don't understand why my program isn't working. I had asked help in stackoverflow and people recommended me going here and ask for help instead. I have an error called :'NoneType' object is not iterable. I also want if there are errors in my program that prevent my program from running. Thanks
...
@nhgrif I think any time Monday would be fine. Mind you, just one dude's opinion, Sunday is probably fine too. Sundays are just usually really slow here
You can not make an NSTimer work like this while your application is in the background. NSTimer's are not "real-time mechanisms". From the official documentation:
Timers work in conjunction with run loops. To use a timer effectively, you should be aware of how run loops operate—see NSRunLoo...
But, the docs help me get the flange extender on to the toilet waste pipe, so, now I aint' gonna get shit on the floor... that has to be a good thing, right?
@sᴉɔuɐɹɥԀ Same here, it's about 11:30 here in Minnesota. I've been here for about 2 1/2hrs trying to figure out why the hell classes aren't being added to my project namespace in visual sudio.
@rolfl I'm more than happy to let the landlord take care of all this "shit" (figuratively and literally speaking)... Never been home owner, not sure I really want to either
@EthanBierlein Ah, I'm in Indiana so +1 hour from you
@Hosch250 I'm creating a new class file encapsulated in my program's namespace, yet I still can't access that class. It's not like it's private or anything either.
@Hosch250 It is also in the same directory as all my other source files.
I was reading about the MIDI spec and I challenged myself to implement a function to convert an int32 to a variable length quantity uint32.
I didn't look it up or anything so there might be a way more efficient or tricky way to get the same result, but as far as doing what I set out to accomplis...
I work in IT compliance and one of my main duties is ensuring the integrity of employee network accounts. Partial VBA script as currently used is shown below:
Public Function validateHireDate(hireDate as String)
If Not IsDate(hireDate) Or isNull(hireDate) Then
validateHireDate = "In...
@Hosch250 I understand that I would have been a duplicate, but it's not exactly something that you can just search in google. Especially if someone is a beginner.
i try to migrate the options custom binding for a JQM select to the latest JQM and knockout versions, but im struggling with this fiddle:
this is the old working version (not written by me):
http://jsfiddle.net/nHNzL/41/
and this is the new actual version:
http://jsfiddle.net/nHNzL/40/
the o...
This is router I created for use, however, I wish to refactor this code and make this more robust. I would really appreciate anyone who can:
Point out how to make this code more robust, clean and flexible.
Point out where code can be refactored and possibly how.
Point out how the code could be ...
I've the following javascript code
var globalConfiguration = null;
function loadFile(filePath) {
}
function onLoadPage() {
}
function getConfiguration() {
}
function process() {
}
I want to use IIFE to encolose all my functions in a closure to avoid cluttering the global name space,so I...
I think this is a better place for this than Stack Overflow...
I'm not sure what is the best way to handle css when I have two uses of a class where the difference is one floats left and the other right.
An example:
img.screenshot{
width:100px;
height:110px;
padding:5px;
}
Do I do this:
img....
I'm going through the Udacity Intro to HTML and CSS course at the moment, and one of the exercises is to convert this mockup to HTML and CSS.
I did the following, and it looks ok-ish:
HTML:
<!DOCTYPE html>
<html>
<head>
<title>Jane Doette / Front-end Ninja</title>
<link rel="stylesheet" hr...
I created a simple react todo-like application(github). There are several questions/problem:
How do I separate logic from components(methods such removeHandler etc)?
Should the top component have state?
Where should I place the logic of validation?
Looking forward for any advice about react a...
Lints and Hints: What tools are available for checking and correcting the conventions, style and common errors in my language (lint tools), and are there tools that can automatically fix them (hint tools)?
This is a follow-up to a comment posted on Is there a place for automated code reviews?
...
I had to make a POC for Spring oauth2 with redis store for tokens. I started with the sparklr2 (with tonr2) sample app from here.
Cloned the project and added a CacheTokenStore, CacheTokenConfig.java and properties
Instead of talking to redis directly, decided to use SpringCache. But since it w...
@tgkprog It belongs on CR, but... few people know Spring very well around here. @Marc-Andre and I know it quite well (and maybe @janos?) However, I don't know what these terms are in your code: POC, redis, sparklr2, tonr2. Because of this it becomes hard to understand what your code actually does. Try to structure your question better, and describe better what it does.
There are a couple of micro-optimizations to be made. They probably won't give you the boost you're looking for, but it's worth trying.
First, you can explicitly define the return type. When you don't define one, the compiler defines it as a Variant type, which incurs a lot of overheard compare...
@tgkprog As an example of a question that is much easier to review, because of a lot of description and context provided, and being well-structured, see this:
Even though it's the first time I'm writing something this "big", it feels like I know C# quite good. It's been nice to learn LINQ also and I am very impressed by the features, and perhaps I have overused it here (if it's possible to do that).
SudokuFactory: Contains static methods to create so...
I installed
Visual Studio 2015 RC
Visual Studio 2015 RC SDK
.NET Compiler Platform SDK Templates
.NET Compiler Platform Syntax Visualizer
However when I now try to create a "Diagnostic with Code Fix" I receive this error:
A problem was encountered creating the sub project. The imported p...
All of the other answers make two assumptions: 1) The user is writing a Cocoa or Cocoa Touch application (in which we wouldn't write code in `main.m` 2) The user is some sort of Java expert just trying to get some Objective-C basics down.
But the way I see it, he's asking about writing in main.m, so he's just writing a simple console application (this part probably requires Objective-C knowledge, but it's pretty obvious if you've written 1 console application and 1 non-console application in Objective-C)
And he's asking about creating global variables so that all his methods can access it instead of asking a question about passing data around, so he's not an expert in any OOP language.
So my answer explains how to do what he's asking... then explains how he should be doing it.
I created the levenshtein-distance tag without knowing there was already an edit-distance out there. Can we make the one I created a synonym of the existing tag?
This will ensure any future users are using the correct tag. If we burn the one I just created, it will just get created again. It may...
Any Linux users around...? Python 3.4.0 was in Ubuntu 14.04 by default, but I want to upgrade it to Python 3.4.3, I thought it would be as easy as sudo apt-get install python3, but appareantly it's already up to date?
I wrote a small script that finds the solution to the cracker barrel peg game / triangle game. Gist link:
https://gist.github.com/blah73/170bdde88bee434657aa
"""A small script that finds the solution to
the cracker barrel peg game / triangle game.
Instructions along with one of the game's solut...
Some disclaimers: 1) all of the above is derived from pure code review. 2) The reason I'm commenting is that I found your code an excellent starting point for my own implementation, so I wanted to reciprocate with feedback which should be useful to future readers. — Marko Topolnik33 secs ago
.net has an impressive wiki, but no where does it actually say what it is to be used for.
I most often see this tag used in conjunction with one of the .Net languages or in lieu of one. It doesn't seem to serve a purpose at all, because we all know that c#, vb.net, and f# all run on top of the ...
@EthanBierlein There's many things Java has over C# as well. I don't want to go into that debate (again) is just a little friendly-joke over here. Each one prefers his own language.
and there's a reason that question is "closed as primarily opinion-based"
@PhilipAllgaier This particular question would be just as bad on Code Review. It's not even clear whether or not the code works. If it does not work, it is entirely off-topic for CR. — Simon André Forsberg21 secs ago
Well, this could be an odd question. But I found no solution for this.
First of all, I have written all my styles in scss. In my theme, I want to keep color variations settings. Where site admin can select his/her own colors.
I'm going to distribute the theme, so there should be problem if thei...
I wrote a basic Minesweeper game for practice. It consist 3 classes: Main - only as luncher, Cell - controling behavior of single cell, Board - coordinating behavior of cells.
The hardest part for me, was a determaning the value of sigle cells (how many mines is around it), and fireing a chain ...
You can find a developer who can do it fast & cheap, but it won't be good. You can find a developer who can do it fast & good, but it won't be cheap. You can find a developer who can do it cheap & good, but it won't be fast.