I think that's due to the fact that, in the function loadExamsyou have a statement var avg = avgArr[i].sAvg / avgArr[i].sCfu; which will shadow your function definition (since it's in a more inner scope). Rename to variable to something else (or the function). As a best practice, define your variables...
javascript,arrays,null,max,undefined
testArr.reduce(function(a,b){ if (isNaN(a) || a === null || a === '') a = -Infinity; if (isNaN(b) || b === null || b === '') b = -Infinity; return Math.max(a,b) }, -Infinity); ...
You have two function, DJ and BlankDisplay (nevermind the use of caps) that both take arguments of al and rl, but second function doesn't make use of al, or rl. Then in this code: <button id="DJ" onclick="DJ(al, rl) you pass in the variables al and rl into the function call...
Test existence of key with isset: if (isset($_GET['page']) && $_GET['page'] == basename(__FILE__) ) { ^^ ...
According to your relationship definition there can be many attachments, that means the relation will return a collection of models. You can either get only the first one: @if($attachment = $post->attachments()->first()) {{ $attachment->name }} @endif Or loop over all attachments @foreach($post->attachments as $attachment) {{ $attachment->name }} @endforeach ...
java,swing,types,jframe,undefined
With this: JFrame CBallMaze = new JFrame("Title");, you're creating a JFrame variable and assigning it a JFrame object, and then expecting it to have CBallMaze behaviors, something that isn't going to happen. Instead, you will want to create a CBallMaze object and assign it to a CBallMaze variable. So change...
batch-file,if-statement,undefined
IF NOT DEFINED only checks for the definition of a variable. In your case it will always be true because someone it entering a value. To accomplish what you want, you need to place this line at the bottom of your script: GOTO commandbach This will essentially create an endless...
"Best" is a fairly subjective term, so let's throw some objective criteria at it: Which is faster? In a way that you'll notice in the real world, neither. But if you really want to know, measure your specific code on the engines you want to support. Which is easier to...
I just took a look at the zip file. There are MEX wrappers in the maxflow directory that are written where MATLAB calls these functions which are written in C, but are runnable in MATLAB. These MEX wrappers need to be compiled using a compiler that is compatible for your...
jquery,function,undefined,getscript
readCookie is undefined because readCookie is not global; it is visible only within the document.ready function scope in mymy.js. Make the function global by removing the document.ready wrapper....
This is a feature of how variable scoping works in PHP. Inside your groenteCheck() function, you need a line at the top like: function groenteCheck() { global $komkommer, $plu_komkommer ... // rest of function variables } More information on how scope works in PHP can be found in the manual....
You have to change this: (Because NULL and empty string is not the same) $function = (isset($function) ? $function : null); to this: $function = (isset($function) ? $function : ""); //^^ See here Also you have to change your if statement to this, so you check if the key exists...
Sorry, but you aren't going to be able to use .data() with bar or line charts with a reasonable amount of effort, because dc.js uses .data() internally and in this case you would have to call d3.stack yourself in order to create the data it is expecting. Instead, I suggest...
It is not a built-in function. You need to install the Optimization toolbox.
node.js,error-handling,null,undefined,code-readability
Use if(err). It is designed to be used in this fashion. Node-style callbacks are supposed to set the error to a non-falsy value only in case of actual error. You won't find any sane example of setting err to '' or 0 to signify error. Just like YlinaGreed has noted,...
Please read "How to Write Go Code". Don't use /src in your GOPATH. Packages are located in $GOPATH/src. For build or install you need to have your files in a package directory. For go run, you need to supply all files as argument. But, you should almost always use go...
php,magento,debugging,undefined
In both of those functions (addFilter, OrderbyAdd), the offending bit of code is here if ($deal instanceof Sm_Deal_Model_Deal){ $deal = $deal->getId(); } The only variables available in a function are The function parameters ($filterName,$filtervalue,$condition and $orderName,$ordervalue), respectively. Variables defined in the function Any global variables The variable $deal is none...
It appears that you are using Python 2, in which input attempts to evaluate what the user types as though it were a Python statement. You should instead use raw_input, which does not.
Use simple if (isset($_POST['key'])): $player = isset($_POST['player']) ? $_POST['player'] : ''; $age = isset($_POST['age']) ? $_POST['age'] : ''; $data = isset($_POST['data']) ? $_POST['data'] : ''; Or better, but every value to some 'refix': <input name="Data['player']"/> and in php just do: if (isset($_POST['Data'])) { $player = $_POST['Data']['player']; /* ... */ }...
requirejs,undefined,marionette,circular-dependency
You should review your shim configuration to remove all those shims that you've put in for modules that actually use define. For instance, jQuery uses define and thus does not need a shim. The same is true of Marionette. I've just installed it with Bower and found this towards the...
jquery,dom,undefined,console.log
Remove # in <div id="#app">. It should be <div id="app">. If you want to keep it, use this selector $( "[id=#app]" ) instead of $( "#app" )....
javascript,arrays,object,undefined
spc_indx[i] = spaces; should be spc_indx[spaces] = i; ...
You don't have a route for userinfos. try adding in your config/routes.rb: resources :userinfos I hope this help....
php,html,undefined,isset,notice
Let me outline the errors in your code. You have two form elements bearing the same name, "file"; that's a conflict. <input type="file" name="file" id="file"> ^^^^^^^^^^^ and <input type="submit" value="submit" name="file"> ^^^^^^^^^^^ Then your conditional statement if(isset($_POST["submit"])) is based on a submit button being named "submit"; it doesn't exist, so...
javascript,arrays,variables,undefined
First off, it's important to note that this is not an array, it's an object definition. An array can be defined as: [ "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAyAAAAJYCAYAAACadoJwAAAgAElEQ…ACCCCAAAIIIICAvwIEIP760zoCCCCAAAIIIIAAAoES+P992sgQ2E6rdwAAAABJRU5ErkJggg==", "splash.png", 1024, 768, 1969, 1477, 800, 600, -585, -406 ] Which is doesn't the keys, like "data": (which can also be expressed as data:) It seems...
angularjs,constructor,typescript,undefined,this
Config functions aren't classes and shouldn't be written as such. Angular is invoking them without new and thus this will be undefined (or, God help you, window in non-strict mode). It doesn't really make sense to use a class here as there's no instance to be kept around. If you...
You are reading the variable $count in the expression $count + 1. On the first iteration of the while loop, the variable isn't assigned yet, and that causes your error. You cannot read/use a variable that is not defined yet. The solution is simple: Initialize $count to 0 before the...
php,arrays,variables,undefined
$propertyName is a string not an array, so to get the array using a string as it's name you need to disambiguate using curly braces { }: var_dump( $test->{$propertyName}["A"] ); ...
node.js,undefined,handler,referenceerror
You say that's the first line of your code. The problem is that you do not define the handler variable. It should be a function that responds to a request event. Since it is optional, you can (if you wish) leave it out entirely and add handlers for events later...
javascript,undefined,empty-string
Your check for the property [p] will return false even in the cases you care about (empty string or false). Instead of if (container[p]), you should use if (container.hasOwnProperty(p)).
For now, without submiting, the key 'rating' does not exists in $_POST array, hence the notice. Just change the order if you want this action after submit: if (isset($_POST['submit'])) { $rating = mysql_real_escape_string($_POST['rating']); $rate = "INSERT INTO cms_rating (rating, p_id) VALUE ('$rating', '$id')"; $con->query($rate); } else { ?> <form action=""...
javascript,node.js,object,undefined,response
You could take advantage of the && operator to do: a.someotherKey = { id: r.otherKey && r.otherKey.id || "" } && will return the second value if both are true, and false if one (or both) is false....
Your code was never working well. It is bad written. The reason you did not see errors, in your old server is that you had lower error reporting or the whole error reporting was turned off. When you are developing something you should always develop with turned on error reporting,...
I was about to copy&paste your code snippet from above into http://3v4l.org/ to prove you wrong ;) – and syntax highlighting there shows, that you have an invisible character between is_ and bool (in the line you marked with the // Fatal error comment). Pasting it into Notepad++ and viewing...
javascript,html,random,undefined
You ve declared the variable twice in different scopes. function StartSpin(){ ... var cone; var ctwo; var cthree; ... if(one == 1){var cone = "Ace";} // here remove var, otherwise JS will scope it to the IF. if(two == 1){var ctwo = "Ace";} if(three == 1){var cthree = "Ace";} ......
run assigns empty arrays to hour, db and wb. These are variables which are locally scoped to the run function. It then calls getData and passes those arrays as arguments. Inside getData new local variables (also named hour, db and wb) are declared and are assigned the three empty arrays...
php,codeigniter,variables,model-view-controller,undefined
You have to pass the $data variable in the view method. Take a look at this: public function edit_news_form() { $this->load->model('users_model'); $id = $this->uri->segment(3); $result=$this->users_model->get_id($id); $data['content']=$result; $this->load->view('edit_news_form', $data); } ...
php,variables,undefined,php-include
Strictly speaking, all you need is to change <?php include ("$v"); ?> to <?php include $_GET['v']; ?> A couple things to note here: URL parameters become items in the $_GET array, not independent variables. include doesn't need parenthesis. It's not wrong to include them, but it's not necessary. See the...
jquery,validation,tinymce,undefined
You can load this script on all pages but you need a way to detect whether TinyMCE is active. You can do it by calling the following function and if true, execute tinyMCE.triggerSave(); function isTinyMCEActive() { is_tinyMCE_active = false; if (typeof(tinyMCE) != "undefined") { if (tinyMCE.activeEditor == null || tinyMCE.activeEditor.isHidden()...
methods,controller,undefined,each
there is no @post variable in groups_controller's 'show' action. may be you need something in show action like: @posts = Post.where(group_id: @group.id) And also when you render a partial from another folder, you have to pass the value of the instance variable (correct me if I am wrong). e.g <%=...
Since test() doesn't know who is abc, that msg NameError: global name 'abc' is not defined you see should happen when you invoke b.test() (calling b.abc() is fine), change it to: class a: def abc(self): print "haha" def test(self): self.abc() # abc() b = a() b.abc() # 'haha' is printed...
javascript,angularjs,events,select,undefined
found the solution guys. In my service, I had this: function CPSIAService($q, Restangular) { var deferred = $q.defer(); var CPSIAService = {}; CPSIAService.getProductsByCategory = function(params) { //original call // var response = Restangular.one('compliance/products/by/category',params); var response = Restangular.one('products.json'); //params from category would go here response.getList().then(function(data) { deferred.resolve(data); }); return deferred.promise; };...
javascript,jquery,null,undefined,chain
Use $.toggleClass() instead: $(".element").doSomething().toggleClass("special-class",condition).doSomethingElse(); As ruakh mentioned it, there is a difference. If condition is falsy, it will actually remove the class if it was present before. With your logic, the class can only be added, not removed....
php,codeigniter,variables,view,undefined
Ok, it is working perfectly. Take a look at my screen shots and try emulate. My Controller My View (Code) And finally the result on the screen. If it is still not working, make sure you have you are running Codeigniter in htdocs on a Lampp or Xampp stack....
These three lines contain your answer: lea 0x1(%rax),%edx mov %edx,-0x4(%rbp) mov %eax,-0x4(%rbp) The increment operation isn't skipped. lea is the increment, taking the value from %rax and storing the incremented value in %edx. %edx is stored but then overwritten by the next line which uses the original value from %eax....
I came across this same issue myself maybe my solution will help you out. Check your /app/assets/stylesheets/application.scss file for "bootstrap-spockets". Commenting this out solved it for me.
javascript,class,properties,prototype,undefined
You're binding is wrong. // Set keyboard KeyboardJS.on('left', this.onKeyboardLeftDown, this.onKeyboardLeftUp); this.onKeyboardLeftDown and this.onKeyboardLeftUp are called without the correct context to fix this do something like: KeyboardJS.on('left', this.onKeyboardLeftDown.bind(Game), this.onKeyboardLeftUp.bind(Game)); I would not recommend using bind() - for browser compatibility, but you can use something like lodash's bind or an bind "emulator"...
JSON_ENCODE returns string. Learn more about JSON_ENCODE You should convert that JsonArrayString to JsonArray $.get('file.php') .done(function(data) { var arrayObj = JSON.parse(data); $.each(arrayObj , function(key, value) { console.log(value.code); }); }); ...
ruby-on-rails,ruby,devise,undefined
Found the issue: I had a line in my config that said config.force_ssl = true. Commented it out and it worked! Considered deleting my question, but thought that maybe someone else might run into this sometime. –
There is not much to prove. There is simply a rule (which can't be explained or broken down into anything smaller) that case statements which try to match undefined against a constructor result in undefined. Once you accept this rule, we can observe undefined ++ ys = { by definition...
javascript,php,function,undefined
You are mixing php with javascript here. Php will never be able to execute your mod10 function because it's written in JS. Plain answer: Recode your mod10 function in php.
javascript,jquery,syntax,undefined
The Script element should not be a self closing tag. <script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"/> to <script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> ...
.live() has been deprecated since jQuery v.1.7, so you need to use .on() instead
The alwaysOnTop property was introduced in JavaFX 8 update 20. So you are probably using an earlier version. Update to the latest JavaFX version and it should recognize the method.
ruby-on-rails,methods,undefined
find_by_sql returning an array and salt_masterkey method belongs to specific record. You should try @user.first.salt_masterkey
ios,swift,undefined,viewcontroller
Rather than prepareForSegue you can directly call viewController from storyboard and pass the data declare variable in the file you want to pass the data and #import the header file in which you want to pass the data. #import "file.h" file *data = [[file alloc]init]; data.index = add_index; then navigate...
javascript,jquery,html,twitter-bootstrap,undefined
You have a data attribute that looks like #sc1.1423423 note the period, then you do some getting and use a variable and you end up with $('#sc1.1423423') Note how that matches an element with the ID sc1 and the class 1423423 To make it work in jQuery the period has...
From what I understood, the problem is, that on some pages you don't create the global myVarible variable at all. For such case checks myVarible !== undefined and typeof myVarible !== "undefined" are not equal. The difference is, that only typeof operator can handle non-existing references to names (e.g. variables)....
querySelectorAll() expects a string as parameter to evaluate as a CSS selector. You can't concat a HtmlDivElement with a string, this is your first problem. The second one is that the querySelectorAll() returns a NodeList as you can see on the console. The problem is that the list is empty....
you can test function existing or not with window['myFunctionName'] !== 'undefined' or in case of a property this['myPropertyName'] !== 'undefined' ...
In both your examples, the properties have not been "formally declared". You have to assign something, even if what you do is undefined: function MyObject() { this.m = undefined; } var sampleMyObject = new MyObject(); console.log(sampleMyObject.m); // undefined console.log(sampleMyObject.hasOwnProperty('m')); // true console.log('m' in sampleMyObject); // true From MDN: Undeclared variables...
It's because the code is asynchronous and when you call console.log outside of the http request not yet finshed so the array[0] is undefined.
java,types,arguments,undefined,operator-keyword
Two points to make in response to this. Firstly, your for loop can use the array size directly (employeeName.length) rather than referring to the scanner object (the error is caused by you comparing a scanner to an int). Secondly, 'c' style arrays are used much less in Java than in...
Never get involved in a land war in Asia. Never go against a Sicilian when death is on the line. Never confuse a controller spec and a feature spec. Controller specs make assumptions about their prerequisites--feature specs don't. You have confused the two, a common mistake. You should never...
javascript,php,json,xmlhttprequest,undefined
Yeeeez I'm an idiot, I wrote this.reponseText instead of this.responseText. Sorry for troubles...
python,if-statement,undefined,nameerror
Well, your variable seats_total will be defined only for user_seating == 'economy' or user_seating == 'business'. For the third case, no such variable is defined. To define "seats_total outside of the if-elif-else statements" just set it to zero for example, or some default value.
jquery,variables,global-variables,undefined
Simply use il++. $(document).ready(function(){ var il = 1 ; $("#btn1").click(function(){ $("p").append(" <b>Appended text</b>."); }); $("#btn2").click(function(){ $("ol").append("<li>Appended item " + il + " </li>"); il++; }); }); ...
javascript,performance,comparison,undefined,typeof
It makes absolutely no useful difference either way in this case. The typeof operator returns a string indicating the type of the unevaluated operand. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof We know it is always going to be a string, and it will only be that of a few predefined values, so there is no...
android,eclipse,undefined,telephonymanager,cellinfo
Check your project.properties file and look at the target you are building against. It should look something like this: target=Google Inc.:Google APIs:17 This is an old project I had on hand which was building for API 17 (with Google APIs.) You can also go into the Project properties and check...
The github api seems to respond differently based on response type (JSONP vs JSON). For json, it responds [...]. For jsonp, it responds {data:[...], meta:{...}}. I suggest just adding: data = data.length ? data : data.data; to the first line of your callback....
javascript,jquery,meteor,undefined
You can turn the event.target object into a jQuery object and then use selectors on it to get its parent using jQuery.parent(), like so: var $target = $(event.currentTarget); var $parent = $target.parent(); // gets you the `a` tag as a jQuery object var parentId = $parent.attr('id'); var parentTalkmate = $parent.attr('name')...
javascript,jquery,html,undefined
The problem is that you're doing a runat="server" which makes the server change the ID. An example of this new ID could be something like MainContent_txtText, you can determine what the server is changing the ID to by right-clicking the textbox and clicking Inspect to inspect the element. Chrome has...
You are correct; the Standard does not impose any requirements at all on what this code might do. If this was a multiple-choice question that required you to choose a specific defined answer, then — whoever wrote the question doesn't understand C as well as you do. Keep that in...
You have to import this class: import java.util.Random; Check if you are importing the correct Random class....
The array you're looping looks like this: Array ( [0] => Array ( [mstatus] => 1 [mhearingnum] => first [mminutes] => adakjaflafjlarjkelfkalfkd;la ) [1] => Array ( [mhearingnum] => second [mminutes] => ) [2] => Array ( [mhearingnum] => third [mminutes] => ) ) Only the sub array at the...
javascript,arrays,for-loop,undefined
The issue is that you're setting al to positions.length and then looping to al + 1. Remember, javascript arrays are 0 based. Take for example an array of size 4, like: var myArray = [1,2,3,4]; You are setting al = myArray.length, which is 4 and then looping to the first...
Assuming document.getElementById('filegroup') is a form input of some type, the value will return a empty string when there is no value. Try: var value1 = document.getElementById('filegroup').value; var value2 = document.getElementById('new_filegroup').value; if(value1 && value2) { // checks both values have something alert("Both values have something") } if(value1 || value2) { //...
your function dump_props(obj, obj_name) expects a second obj_name param. But you are calling it just passing one param: dump_props(car); So, the second one will be undefined. I guess this is what you want: var car = { make: "Ford", model: "Mustang" }; function dump_props(obj, obj_name) { var result = "";...
codeigniter,variables,model-view-controller,undefined
Q: use Correct naming structure for CI? Which version do u use? Filename models/user_model.php Examples (for demo purpose) <?php class User_model extends CI_Model { // example one function get_all_pages() { $query = $this->db->query("SELECT Title FROM news")->result_array(); return ( is_array($query) && sizeof($query) > 0 ? $query : FALSE); } // example...
javascript,angularjs,undefined,angular-http
You can put your POST $http call inside a function and call it in the .success of the GET. var itemNumber; $http.get(URLtoServer + 'serialNumber/' + $stateParams.serialNumber + '/?format=json').success(function(dataSerialNumber){ itemNumber = dataSerialNumber.id; console.log(itemNumber); item.number = itemNumber; doPostCallNow(); //Calling the POST }).error(function(){ //code }); function doPostCallNow(){ var postPromise = $http.post(URLtoServer + 'problem/',...
javascript,jquery,html,arrays,undefined
Your argument has to be evaluated as a key of your pages object. Try: function viewPage(page) { var html = pages[page]; alert(html); } When you use pages.page it looks for the key 'page'. Wheras when you do pages[page] it evaluates your page argument to whatever it equals, and looks for...
Create a variable to store your prepared statement then execute that. $connection = MYSQLDatabase::getInstance()->getConnection(); $statement = $connection->prepare("INSERT INTO users etc etc......."); $insertArray = $statement->execute(array( ":username" => $_POST["username"] )); ...
extjs,get,undefined,return-value
The createTreePaketExist will be called during component initialisation, it's unlikely the textfields are actually rendered or even initialised properly at this point, best to use the listeners. You could use refs in your controller to get a reference to these fields automatically or you could listen to the afterrender event...
function,codeigniter,undefined,fatal-error
In your views: <?php $CI = & get_instance(); echo anchor("resetPasswordController/delete_news/".$CI->ecrypt($content1['id']), '<i class="fa fa-trash-o fa-fw"></i>Delete','id="actions"', array ('onClick' => "return confirm('Are you sure you want to delete?')"));?> Update solution: Base64 return a string that have = at the last, this may cause problem so you can replace it function ecrypt($str) { $result...
ruby-on-rails,ruby,variables,undefined,local
You need to use partial: when you pass locals to a partial as follows: <%= render partial: 'post', locals: { post: post, user: @user} %> I hope this will help you....
Put session_start() at the top of PHP script. <?php session_start(); // your script goes here ...
json,3d,three.js,undefined,blender
In my experience so far with the exporter, you have to be very careful which boxes you tick! This length error is usually because you are either not exporting the vertexes, or exporting the scene rather the object....
javascript,local-storage,undefined,javascript-objects
My assumption is that you are trying to stringify a complex object, probably something like a DOM object or another built-in API's object. What happens is that JSON.stringify will strip the object out of all methods, and this includes internal setters and getters, and you remain with an empty (or...
javascript,jquery,undefined,href,attr
When you call showForm(e), the context(this) is not the anchor object inside showForm it is the window object. So you can just pass the function reference as the click handler $qqPopupCTA.on('click', showForm); $qqPopupCTA = $('.qqPopupCTA'); function showForm(e) { e.preventDefault(); var targetPageUrl = $(this).attr('href'); alert(targetPageUrl) // do stuff } $qqPopupCTA.on('click', showForm);...
ruby-on-rails,ruby,undefined,nested-attributes,cocoon
Answer to Your Specific Problem: In your index action you have: @quantified = Result.all.order("date_value") Calling .all before .order is the cause of your error. In Rails ActiveRecord, the .all command immediately triggers a fetch of items from the database. Since database IO fetching commands like .where and .order exist to...
Your problem is that passing arguments to functions in C++ defaults to being by value. A consequence of this is that changes to the value of an argument are local to the function. So, given your edited code Menu* Content::CreateItem() { Menu* menuPointer = new Menu; //initialize values return menuPointer;...
php,mysql,variables,mysqli,undefined
Here is how to do it with pdo, mysqli, and mysql MYSQLI $con=mysqli_connect("localhost","username","password","dbname"); $sql="SELECT sub_category FROM sub_category WHERE main_category_id = 2"; $result=mysqli_query($con,$sql); $new_array = array(); while ($row = mysqli_fetch_array($result,MYSQLI_ASSOC)){ $new_array[] = $row; } print_r($new_array); mysqli_free_result($result); mysqli_close($con); MYSQL mysql_connect("localhost","username","password"); mysql_select_db("dbname"); $result = mysql_query("SELECT sub_category FROM sub_category...
angularjs,undefined,firebase,angularfire,controllers
Checkout your $scope.firstname model, that's where the issue is. make sure it's not a null value and properly defined.
typescript,undefined,extending
That's because the lambda syntax you are using keeps the this value to the external this, by using a variable called _this, as you can see in the playground: http://past.is/wxBJm Since the lambda is not in a class, it is bound to the "this" that is global, here the window...
You are using input function in python2, it should be raw_input() instead. ppp=raw_input('Enter a, or b. or exit to exit') Check this answer for more information...