jquery,loops,break,out,.eachRelated issues-Collection of common programming errors


  • MPD
    7 jquery admin-theme
    I have installed jQuery Update but it breaks some core functionality that makes the admin UI a struggle to deal with. Is there a way to keep jQuery Update enabled but disable it when the admin theme is visible?

  • Jamal
    jquery plugin twitter
    I’ve been working on a jQuery plugin for pulling tweets since the v1 endpoints were all closed off and you need oAuth now. This is just the jQuery part but if you want to see the php behind it I’ll be happy to post. But basically, I’d love suggestions, as this is one of the first real plugins i’ve made, i’m really looking for critique on patterns and efficiency. Is there anything I’m doing that can be shorten’d significantly? Is there a feature you think would be cool for me to include?And just

  • Jamal
    javascript jquery datetime plugin twitter
    I’ve built a Twitter plugin recently and was wondering if I could get some feedback on it. There is also a PHP side that grabs the actual tweets and I can post that code if it’s needed.http://jsfiddle.net/cKfDd/;(function ( $, window, document, undefined ) { /************************************* Plugin Functions *************************************/ /*************************************/ Plugin.prototype.init = function () {var params = [ ‘?user=’ + this.options.user,’&limit=’

  • laxman
    php jquery ajax wordpress woocommerce
    I am getting catchable fatal error in bellissima themeforest woocommerce theme.http://www.pursesgalore.com.au/ can anyone help on this?Code:if(!$dst_h) ://can’t resize, so return original url$img_url = $url;$dst_w = $orig_w;$dst_h = $orig_h;————————–line number 1040 ———————–else ://else check if cache existsif(file_exists($destfilename) && getimagesize($destfilename)) {$img_url = “{$upload_url}{$dst_rel_path}-{$suffix}.{$ext}”;} Error: Catchable fatal erro

  • Fran Verona
    php javascript jquery ajax
    I have a PHP file with the following code:<html><head><!– HEAD –><?php require_once ‘Language.php’; ?></head><body><script type=”text/javascript”>$.get(‘step2.php’,function(data){// Do something});</script></body> </html>As you can see, I’m trying to load some content via Ajax call. The problem is that step2.php contains some PHP code:<div class=”step-content table-bordered”><h3><?php echo $Lang->get(‘create_s2_title

  • Tom
    jquery ajax joomla joomla2.5
    Still having problems figuring out how to use Ajax and the Joomla framework together. I’ve created a Joomla component which I can access with:index.php?option=com_mycomponentI’m using Jquery with Ajax in components/com_mycomponent/views/mycomponent/tmpl/default.php:<?php // No direct access to this file defined(‘_JEXEC’) or die(‘Restricted access’); ?> <html> <head><title>Ajax with jQuery Example</title><script language=”javascript” type=”text/javascript” src=”ht

  • Asenar
    javascript php jquery callback
    i have make an php editor with so much effort but i cant print the fatal error. and want to print the fatal error. How to do this. I have code for run the php through eval function here is my jsfiddle – **http://jsfiddle.net/3c7F6/3/** I want to print an fatal error. Please help me to do this.please check the code and give me the suggestion

  • Ulker Ibrahimova
    javascript jquery file-get-contents
    This question already has an answer here:Ways to circumvent the same-origin policy11 answersIs there any way to get full page source of snother different site? Example my site is example.com but i want to get facebook’s page source on example.com. I tired this one: http://phpjs.org/functions/file_get_contents/ And it gives me null. So anyone knows it?function file_get_contents (url, flags, context, offset, maxLen) {// Read the entire file into a string//// version: 906.111// discuss at: http://

  • Mitesh Vora
    jquery html css ellipsis
    I tried looking here Insert ellipsis (…) into HTML tag if content too wide but could not get in chrome to work. I there solution for multiline in all browsers??

  • Ronald Yeung
    javascript jquery ajax json cors
    What I am trying to do is to have a page on the HTTP protocol sending an AJAX call to the same Web server but using HTTPS. Both the requesting page and the AJAX handler are on the same server, having the same domain and port. (I.e., only difference is the protocol.) To illustrate,Fromhttp://www.example.com/index.phpTriggers a jQuery AJAX call tohttps://www.example.com/authenticate.php?user=123&password=456(I am hoping to pass the password through HTTPS to make it encrypted over the Internet.

  • Chris Burton
    php arrays loops foreach
    In my foreach, I see the following error:Fatal error: Cannot use string offset as an array [..] on line 9788. foreach ($response as $result) {89. if($result[‘provider’] == ‘Facebook’) {90. $provider = ‘facebook’;91. }else{92. $provider = ‘twitter’;93. }94. $user = array(95. ‘provider’ => $result[‘provider’],96. ‘id’ => $result[‘uid’],97. ‘name’ => $result[‘info’][‘name’],98. ‘image’ => $r

  • Dinah
    php loops while-loop
    my code-function create_id() { //global $myusername; $part1 = substr(“Piyush”, 0, -4); $part2 = rand (99,99999); $part3 = date(“s”); return $part1.$part2.$part3; }echo create_id(); //this is printing fine.function isUniqueUserID($userIDToCheck) {$sqlcheck = “Select * FROM ruser WHERE userId=’$userIDToCheck’;”; $resource = mysql_query($sqlcheck)or die(mysql_error()); $count = mysql_fetch_assoc($resource); if( count($count) > 0) {return false;} return true; }$userIDVerifie

  • Mr. Czar
    c++ loops vector runtime-error fatal-error
    Currently, I’m trying to make a function that sorts a vector full of fighters in the function sortFighters in the Fighter.cpp file. It all seems to compile correctly; However, when it does run, I get a fatal error in one of the lines of the aformentioned .cpp file. I know exactly what the problem is, and put a comment there accordingly. So, what I’m asking here, is what I might do to fix this problem without adding any other functions and such.Here’s my Fighter.h file:#ifndef FIGHTER_H #define

  • Hosang Jeon
    loops mapreduce hive reduce infinite
    I am using Hive (version 0.11.0) and trying to join two tables. One has 26,286,629 records and the other one has 931 records.This is the query I am trying to run.SELECT * FROM table_1 hapmap a tabl_2 b WHERE a.chrom = b.chrom AND a.start_pos >= b.start_pos AND a.end_pos <= b.end_pos LIMIT 10 ;It looks fine at the first few minutes but if the map and reduce task reached to 100% both, then it starts to reduce again from 0%.2014-02-20 20:38:35,531 Stage-1 map = 100%, reduce = 100%, Cumulat

  • Basit
    jquery ajax jquery-ajax loops response
    i have list of rows that user select and i want to delete them, one by one and show the result in the end.obviously if i just do simple loop and call each time ajax function, but how can i loop and check which one successed and which one failed and when they are all done?how would you do it? what is proper way of doing the bulk editing/deleting?

  • Zach Nicodemous
    php mysql wordpress loops wordpress-loop
    I am trying to find a way to hook several satellite WordPress installations into a centralized installation of WordPress in order to pull post data and custom field meta from two custom post types from the central installation and display this data on the satellite sites.Is there any way to create a database connection to another WordPress database either on the same server, or on a DIFFERENT server, and then use STANDARD WORDPRESS LOOP METHODOLOGY to retrieve and display data from that second W

  • Rohit Jain
    java loops for-loop error-handling iteration
    I have a for loop like so:for (Environment environment : environmentList) { //do stuff }I catch exceptions within the loop, but would like to retry executing the code with objects that receive exceptions. Obviously I can do this with a for loop using a counter and list index, but I was curious if there was any way to do this.Elaboration,for (Environment environment : environmentList) { try{ //do stuff }catch(exception) {} //retry code using current environment }

  • Gennady Vanin Novosibirsk
    c# multithreading loops closures task-parallel-library
    I’m trying to spawn different threads for some processing. I use the for loop index for some logic inside each thread. How can I get the different threads to print 1,2,3,4, 5 in the code below? Each time I run this, I get different numbers as output – 3,3,3,4,6,6 & 2,2,3,5,5,6 etc. I tried using the lock object, but it stil wasn’t doing it correctly. Can anyone help me achive this. I just want to make sure each thread/task gets the right index. Note that each task has been forced to run on a

  • stivlo
    networking loops batch-file windows-xp
    I am trying to write a batch script with a section that ouputs your drive mappings to a text file, so i can restore it later once i wipe out the machine. I came up with this for loop to do it, but its acting differently when its a batch script versus running the command itself.This is the actual line of code:FOR /F “tokens=1,2” %i in (H:\mappings2.dat) do @echo %i %jWhen i copy and paste the command from the script to the command window it works fine. When I run the batch script from a command w

  • pythonian29033
    c arrays loops floating-point numbers
    I’m learning C and found this code on a tutorial and it works fine – but if I try to make a decimal number (like 5.5), it prints a negative one in the following arrays and loops itself. The code is German, sorry for that.#include <stdio.h> #include <locale.h> #include <stdlib.h> #include <math.h> #include “stdafx.h”#define ARBEITER 3 #define TAGE 5 #define ARBEITSKALENDER kalender();int zeitkonto[ARBEITER][TAGE];/* Fehlerausgabe */void error(int n) {printf(“%d (?) Fal

  • Dan D.
    php foreach if-statement break
    if (isset($errors)) { foreach ($errors as $error) { echo $error; } } else {break 2;} // some more codeOutputs:Fatal error: Cannot break/continue 2 levels I tried break 1, it didn’t work either.

  • Vinícius Ferrão
    c clang break
    I’ve an strage behaviour in a simple C code that I’m doing for educational purposes.If I compile it with something lower than -O2 it breaks during link-edition with this output.$ make clang -Wall -march=native -pipe -c -g -D_DEBUG_ main.c clang -Wall -march=native -pipe -c -g -D_DEBUG_ functions.c clang -Wall -o main main.o functions.o Undefined symbols for architecture x86_64:”_getbit”, referenced from:_getValueFromMatrix in functions.o”_setbit”, referenced from:_populateMatrix in functions.o

  • user2817954
    python if-statement for-loop break
    I want the if-statement to break if the condition is met, because currently if it isn’t broken early then I get some mishaps in my code. The problem is, I am not sure where to put the break. When I put it where it is shown here I get “Unexpected indent”, but when I put it back a level I get an error with the else-statement saying “Invalid Syntax”.EDIT: THE IF IS INDENTED. It just didn’t show up in the sites code blocks. I will try and fix it on the site.@duck, what do you think I am trying to do

  • Paul Bellora

  • dontomaso
    php if-statement break
    I need to break an if statement somehow. Here is the codepublic function userData($data) {//checks if user is in the databaseif (self::checkUserExist($data)==false) { $userInfo = array();$userInfo[‘id’] = (isset($data->id)) ? $data->id : break;$userInfo[’email’] = (isset($data->email)) ? $data->email : break;$this->conn->insert($userInfo, $Table); // inserts data!} }The break doesn’t work here. I need to return some kind of error. I could say that the input data is invalid or s

  • user2000809
    objective-c c scope switch-statement break
    Do I always have to break out of a switch statement; is it unsafe to simply have a semicolon ; to exit? switch ( (rand() % 2) ) {case 0:// Do foo;break;case 1:// Do nothing;default:; }

  • AMC
    php parsing syntax-error default break
    I receive this error Parse error: syntax error, unexpected T_DEFAULT in ../../functions.php on line 22Here is functions.php section around line 22(“default” specifically is line 22):<?phpbreak;default : ?>It’s default code from WordPress’ TwentyEleven functions.php, and unfortunately I’m still very much learning PHP so I’m not at all sure why the error is occurring. Any ideas?ETA here is the full functions.phpif ( ! function_exists( ‘twentyeleven_comment’ ) ) : /*** Template for comments a

  • user3206225
    c algorithm loops if-statement break
    i have a problem in c like this: I have a problem in the code below. The problem is this that i doing some addition part after both if conditions break.And that addiion is repeatative while loop until count>0 The problem is if i put braces in for loop then it repeats the the part inside the braces until it’s condition is not false. Buti have to do addition which is like this: We have an array data[i].freq={0,1,2,3,4,5} and data[i].next represents the next member to be added.Suppose i add 0 a

  • Eonil
    javascript debugging runtime break
    How can I break on error?I have a code:throw new Error(“Some error”);And I’m using most recent version of Web Inspector (Webkit) and Firebug(Mozilla). These tools catch and print the error, but does not break. May I don’t know the how to. Please let me know how can I to do these?

  • Triynko
    .net process console-application break
    This is looking like an impossible task. Absolutely nothing I’ve found works. The question is how to cleanly close a console application started with Process.Start that has been started with no console window and without using shell execute: (ProcessStartInfo.CreateNoWindow = true; ProcessStartInfo.UseShellExecute = false;). It is given that the application being started will shut down “cleanly” if it receives a ctrl-c or ctrl-break signal, but there seems to be no way to send it one that wo

  • Matthew Grima
    c# vb.net parameters out
    I’ve got a project in c# which is making use of another project written in vb.net. I am currently able to modify both.I’ve got a method in the VB project like:Public Sub MethodName(ByVal param1 As String, ByRef param2 As String)param2 = param1 + 1End SubI am not able to call this method using the out keyword from C#:public void CallOtherMethod(){string param1 =”test”;string param2;provider.AddTransaction(param1, out param2);}Shouldn’t the ByRef keyword in VB.Net have the capabilities of both “re

  • Klaus Byskov Pedersen
    wpf zoom out
    WPF: What is the best way to implement Zoom In and Zoom Out option for an Image inside ScrollViewer in WPF at runtime and also other alternative methods for the samePlease provide sample code and suggest links where I can find sample code and more info about various ways to Zoom the image.Regards, Anwar

  • amrk7
    garbage-collection heap leak dump out
    Trying to detect memory leak in a webapp.Taken heap dump of the app at the time of crash. using eclipse MAT to parse the dump.The collated info from the parsing leads to these 2 conclusions – Objects occupying more memory dont have GC roots. Essentially whenever GC happens, they get cleaned up. Objects under GC roots occupy significantly less memory. So these may not be the root cause of the memory leak(?).So does this mean there is no leak happening? and the crash happens because of out of mem

  • MarkZar
    java exception system out
    I am new to java, and to make clear of “System.out”, i read relevant java source code, then find something i cannot understand. First the source code of “System.out”:public final static PrintStream out = nullPrintStream(); then i went to nullPrintStreamprivate static PrintStream nullPrintStream() throws NullPointerException { if (currentTimeMillis() > 0) { return null; } throw new NullPointerException(); } My question is: the program may throw a NullPointerException in the function nullPrintS

  • DMCS
    facebook connect out
    I get this error in my apps.Fatal error: Uncaught CurlException: 28: connect() timed out! thrownin /usr/local/www/myappsdomain.com/facebookapp/base_facebook.php online 853How can I fix this? Can anyone help? Thanks.

  • quangtruong1985
    jquery loops break out .each
    I have some html element like these: <table id=”myTable”></table><select name=”mySelect”><option value=”1″>1</option><option value=”2″>2</option><option value=”3″>3</option></select><a href=”javascript:void(0)” onclick=”addToTable()”>Add new</a><script>addToTable = function() {var selected = $(“select[name*=’mySelect’] option:selected”).val();$(‘#myTable’).find(‘tr’).each(function() {if ($(this).attr(‘id’)==selected) {

  • Wonka
    jquery header comments out
    Is it possible to use jQuery to disable/comment out a header file and then later re-enable it, sort of toggle it on/off disable/enable it?

  • AnorZaken
    c# generics out restrictions
    The problem is this: I want a generic function that has an out-parameter of the generic type. Restrict the generic type to ref-type and there is no problem ofcourse. But I wanted a totally unrestricted generic type! No new() or class/struct-restrictions!public class A { }public class B<T> : A {public T t;public B(T i){this.t = t;} }public static class S {public static bool Test<T>(ref A a, out T t){C<T> c = a as C<T>;if(c != null){t = c.t;return true;}elsereturn false;} }

  • stevendesu
    jquery jquery-ui .each
    I’ve got a (hopefully) quick question this time, although it’s been troubling me for a little while now.I’m trying to create a progressively enhanced form so that without javascript enabled (or on devices which do not support javascript) you are still capable of all functionality, but with javascript it’s easier/prettier/more intuitive.As part of this setup I have the following code:$( “.draggable” ).each( function(){$(this).html( $(this).attr(‘title’) ).draggable({revert: “invalid”}); });Each .

  • Eric
    jquery .each xfbml dom-traversal
    I have a big page with a “load more” button at the bottom; each click on “load more” loads more content via AJAX. Part of that content is Facebook like and comment buttons:<div class=”fb-like” data-href=”http://mysite.com/a<?=$x ?>” data-width=”100″ data-layout=”button_count” data-show-faces=”false” data-send=”false”></div> <div class=”fb-comments” data-href=”http://mysite.com/a<?=$x ?>” data-width=”435″></div>After loading the additional content, I can ask Fa

  • mplungjan
    jquery .each
    Answering How to check if value exist in jQuery .data() function(Please no downvotes on the validity of adding a bunch of data values to a form object, not my decision)I created a jsfiddle using eachwhich givesObject {v1: “value11”, v2: “value2”, v3: “value3”, v4: “value4”, v5: “value5”} fiddle.jshell.net:25 Uncaught TypeError: Object #<Object> has no method ‘each’NOTE: If I wrap the object in $(..) it does not work eitherSOLVED USING $.each jsfiddle using $.each$(function() {$(“form[name=

  • vpaterno
    jquery ajax arrays iterate .each
    I’m creating an array by pulling data from a json ajax request. But using that array in another $.each statement is resulting in iteration over each character rather than each value.var setInfo = [];$.ajax({ url: blah,async: false,dataType: ‘json’,success: function{$.each(data.photosets.photoset, function(i,photoinfo) {setInfo.push(photoinfo.id);}) // completed set values look like 1234,5678,etc..holler(); })function holler() { $.each(setInfo, function(index, value) {// using each array value in

  • BenoitD
    jquery function jquery-plugins .each
    I’m new with jquery plugin authoring and wonder how a method in the plugin can call another method inside the same plugin.In the sample code I’m trying to call f2 from f1 but I have a js error because of this.each() in the f2 method.Can you enlighten me ?ThanksEdit : f1() and f2() can be called from outside the plugin $.pluginName(‘f1’) and $.pluginName(‘f2’).What I want is to call f2() after somme code in f1().; (function( $ ){‘use strict’;var pluginName = ‘pluginName’;var defaults = {};var met

  • user
    jquery json getjson .each drawimage
    I get an “Uncaught TypeError” on a drawImage command because the picture’s url isn’t extracted correctly, I assume. The paths of the pictures are correct (their folder is in the same folder as the JavaScript file). How does one refer to individual attributes from a JSON file? Thanks in advance.Here is the JSON:{“characters”: [{“greekName”: “Zeus”,”romanName”: “Jupiter/Jove”,”description”: “”,”picUrl”: “pics/zeus.jpg”},{“greekName”: “Hera”,”romanName”: “Juno”,”description”: “”,”picUrl”: “pics/her

  • Viacheslav
    jquery json .each
    I have a question regarding to Memory Leak and functions $.getJSON and $.each loop. I’m taking data from external JSON file that will be periodically updating. I use 2 functions to iterate data from JSON file and another to display it on the page using 5 Unordered lists. Also I use function for pause these iteration. The problem is that this script taking too much memory and CPU resources. From my understanding the function .remove() doesn’t delete object from memory but only remoes it from DOM

  • Nick G
    jquery post asp-classic multidimensional-array .each
    I have a javascript array created through an eval() that I want to send to a classic asp page, I believe through a .Post() (but am happy to go whatever route is best). I am not aware on how to do this at all and all of my attempts have been futile. If anyone can help me with the below code, it would be greatly appreciated. This is the javascript variable setup:var tempOrders = eval(‘(‘ + ‘[{AccountOverride: {Id:”-9223372036854775808″, Name:””, Number:””, HHID:”-9223372036854775808″, HHName:””

  • Jet Rodriguez
    ruby hash dictionary parameters .each
    This is the error I’m getting. I need to pass a string key to a method that usually accepts string key and string symbol combo Dictionaryis empty when created`can add whole entries with keyword and definitionadd keywords (without definition) (FAILED – 1)Failures:1) Dictionary add keywords (without definition)**Failure/Error: @d.add(‘fish’)NoMethodError:undefined method `each’ for “fish”:String# ./11_dictionary/dictionary.rb:9:in `add’**# ./11_dictionary/dictionary_spec.rb:27:in `block (2 levels)

  • josh
    javascript jquery .each
    I have some code that’s finding the ‘title’ attribute from each child in a form. It pulls out the title just correctly when I run ‘console.log(‘title’). But when i try to apply the code to insert a label before the inner div of the fieldset, it just adds the same title (‘About Me’) to each of them. html<form action=”#” method=”post”><fieldset title=”About Me”><!– Going to convert legends to h4 // can choose the header style element? –><div><label for=”name”>Text I

Web site is in building