Search Results

Search found 11238 results on 450 pages for 'miserable variable'.

Page 50/450 | < Previous Page | 46 47 48 49 50 51 52 53 54 55 56 57  | Next Page >

  • Cheapest way of binding local variable to closure

    - by mmotorny
    I believe following to be a cheapest way of binding local variable to closure: void ByRValueReference(A&& a) { } std::function<void ()> CreateClosureByRValueReference() { A a; std::function<void ()> f = std::bind(&ByRValueReference, std::move(a)); // !!! return f; } However, it does not compile under Clang 3.1: error: no viable conversion from '__bind<void (*)(A &&), A>' to 'std::function<void ()>' and gcc 4.6.1: /usr/include/c++/4.6/functional:1778:2: error: no match for call to ‘(std::_Bind<void (*(A))(A&&)>) ()’ Am I violating the standard or it's just broken standard libraries?

    Read the article

  • VB.NET template instance - passing a variable data type

    - by FerretallicA
    As the title suggests, I'm tyring to pass a variable data type to a template class. Something like this: frmExample = New LookupForm(Of Models.MyClass) 'Works fine Dim SelectedType As Type = InstanceOfMyClass.GetType() 'Works fine repoGeneric = New Repositories.Repository(Of SelectedType) 'Ba-bow! repoGeneric = New Repositories.Repository(Of InstanceOfMyClass.GetType()) 'Ba-bow! I'm assuming it's something to do with the template being processed at compile time but even if I'm off the mark there, it wouldn't solve my problem anyway. I can't find any relevant information on using Reflection to instance template classes either. (How) can I create an instance of a dynamically typed repository at runtime?

    Read the article

  • PHP Variable to JQuery function?

    - by grolle
    Hi, I need a relative path in this function: $(function() { $("#searchbox").autocomplete({ minLength : 2, source : function (request, response){ $.ajax({ url : "http://linux/project/index.php/main/search/", dataType : "json", data : { key : request.term}, type : "POST", success : function(data){ response($.map(data, function(item) { return { label: item.original_name, value: item.original_name, id : item.project_id+"/"+item.folder_id+"/"+item.id } })) } }) }, select : function(event, ui) { document.location.href = "http://linux/project/index.php/projects/loaddocument/"+ui.item.id; } }); }); How can I use a PHP Variable path to replace http://linux/project in the function above? Best regards ...

    Read the article

  • gMaps suddenly stopped working : Can't find variable: G_NORMAL_MAP

    - by Luca
    hello! i inject a map on my div called "concessionario-map" with GMap, a jquery plugin. Gmap everything works fine until this morning. now the debugger says: ReferenceError: Can't find variable: G_NORMAL_MAP i just search on google and i read some similar situation, but i dont find a case like mine. please, can you help me? thanks a lot in advance :) (full code) $.getJSON("http://maps.google.com/maps/geo?q="+loc+"&key=ABQIAAAAgDXoBEgIn38xaRBBqo6ygxTDjF32IQ1zA0BVcGSuGouGRvo0kRRKiyipbCniJWSso2scatdz36K-Mg&sensor=false&output=json&callback=?",function(data, textStatus) { long = data.Placemark[0].Point.coordinates[0]; lat = data.Placemark[0].Point.coordinates[1]; console.log(data); $('#concessionario-map').gMap( { scrollwheel: false, latitude: lat, longitude: long, zoom: 15, markers: [{ latitude: lat, longitude: long }], icon: { image: "files/images/gmap_pin_orange.png", shadow: "files/images/gmap_pin_orange_shadow.png", iconsize: [26, 46], shadowsize: [28, 48], iconanchor: [12,46], infowindowanchor: [12, 0] } }) });

    Read the article

  • Creating a Variable of Present Date Minus a Past Timestamp

    - by John
    Hello, In the code below, "created" is a field in a MySQL table. This field is of the type "timestamp" and the default is set to "CURRENT_TIMESTAMP" of whenever a given row is created. In the query below, I would like to create a new variable that equals the present date minus the timestamp of "created", rounded off to units of days. I would like the present date to be whenever the query is run. How could I do this? Thanks in advance, John $sqlStr = "SELECT l.loginid, l.username, l.created, ...

    Read the article

  • How can I create variable variables in ActionScript

    - by Daniel Angel
    I'm doing this mcomp7d101.onRelease = function() { getURL("javascript:Compartir("+id7d101+");"); } mcomp7d102.onRelease = function() { getURL("javascript:Compartir("+id7d101+");"); } mcomp7d103.onRelease = function() { getURL("javascript:Compartir("+id7d101+");"); } mcomp7d150.onRelease = function() { getURL("javascript:Compartir("+id7d101+");"); } you get the idea :) How can I use a for loop to do something like: for(ii = 101; ii < 150; ii++) { mcomp7d+ii.onRelease = function() { getURL("javascript:Compartir("+id7d+ii);"); } } I'm getting a syntax error. It seems that I can't create variable variables in compiled languages.

    Read the article

  • Global javascript variable inside ready

    - by w0rldart
    Which is the right way of declaring a global javascript variable? The way I'm trying it, doesn't work $(document).ready(function() { var intro; if ($('.intro_check').is(':checked')) { intro = true; $('.intro').wrap('<div class="disabled"></div>'); }; $('.intro_check').change(function(){ if(this.checked) { intro = false; $('.enabled').removeClass('enabled').addClass('disabled'); } else { intro = true; if($('.intro').exists()) { $('.disabled').removeClass('disabled').addClass('enabled'); } else { $('.intro').wrap('<div class="disabled"></div>'); } } }); }); console.log(intro);

    Read the article

  • STL member variable initalization issue with windows API

    - by Django
    I am creating a windows app that uses a vector of stings as a member variable. For some reason, I can compile but when it tries to get at any of the vectors members is crashes. the error is 0xC0000005: Access violation reading location 0xcdcdcdd9. in the member function of the vector class. this is the size() function where it breaks. size_type capacity() const { // return current length of allocated storage return (this->_Myend - this->_Myfirst); } I am using visual studios 2010. thank you Django

    Read the article

  • how to use variable from runscript command

    - by poe
    I get some text from a web page 5,19 € 3,50 € I want to split this text after "€". for that I'm using this command runScript|javascript{var prices = storedVars['price'].split("€"); document.write(prices[0]); document.write(prices[1])}; after done that try this command getEval|alert(storedVars['prices[0]']) the answer is that prices is undefined. what is the problem here? how can I get this variable from a runScript command? thanks for helping me!

    Read the article

  • Variable collation with MySQL stored function?

    - by Chad Johnson
    I want to do something like this in a stored procedure: IF case_sensitive = FALSE THEN SET search_collation = "utf8_unicode_ci"; ELSE SET search_collation = "utf8_bin"; END IF; INSERT INTO TABLE1 (field1, field2) SELECT * FROM TABLE 2 WHERE some_field LIKE '%rarf%' collate search_collation; However, when I do this, I get ERROR 1273 (HY000): Unknown collation: 'search_collation' Also, if I do what's suggested at http://stackoverflow.com/questions/1680850/mysql-stored-procedures-use-a-variable-as-the-database-name-in-a-cursor-declara/2070021#2070021 I get Dynamic SQL is not allowed in stored function or trigger How can I use a dynamic collation?

    Read the article

  • C++ class initialisation containing class variable initialization

    - by Phil Hannent
    I noticed some code of a colleague today that initialized class variables in the initialization. However it was causing a warning, he says because of the order they are in. My question is why is it better to do variable initialization where it currently is and not within the curly brackets? DiagramScene::DiagramScene( int slideNo, QRectF screenRect, MainWindow* parent ) : QGraphicsScene( screenRect, parent ), myParent( parent ), slideUndoImageCurrentIndex(-1), nextGroupID(0), m_undoInProgress(false), m_deleteItemOnNextUndo(0) line(0), path(0) { /* Setup default brush for background */ scDetail->bgBrush.setStyle(Qt::SolidPattern); scDetail->bgBrush.setColor(Qt::white); setBackgroundBrush(scDetail->bgBrush); }

    Read the article

  • How do i plot a vertical axis with variable intervals (Flex Charts or any other)

    - by satish
    How do i plot a vertical axis with variable intervals? on a Flex Chart. I want to plot a data set that has values from 0.1 to 800. When I use a standard Numerical Axis, I have to define a interval. I tried using Log-Axis, but I am not sure how to plot the point values. Looks like something in lines of semi-log axis would be better. A axis with initial values in Numerical, but later shifting gears to a Log-Axis. Any ideas or pointers to implement this in Flex?

    Read the article

  • Python scope problems only when _assigning_ to a variable

    - by wallacoloo
    So I'm having a very strange error right now. I found where it happens, and here's the simplest code that can reproduce it. def parse_ops(str_in): c_type = "operator" def c_dat_check_type(t): print c_type #c_type = t c_dat_check_type("number") >>> parse_ops("12+a*2.5") If you run it as-is, it prints "operator". But if you uncomment that line, it gives an error: Traceback (most recent call last): File "<pyshell#212>", line 1, in <module> parse_ops("12+a*2.5") File "<pyshell#211>", line 7, in parse_ops c_dat_check_type("number") File "<pyshell#211>", line 4, in c_dat_check_type print c_type UnboundLocalError: local variable 'c_type' referenced before assignment Notice the error occurs on the line that worked just fine before. Any ideas what causes this and how I can fix this? I'm using Python 2.6.1.

    Read the article

  • Check variable if explode-able in PHP

    - by ZaneDeFazio
    Not sure if there is a way to check a variable if it is explode-able or not... I have a database of city names some are one word cities and some are multiple word cities EX: Chicago, Los Angeles I keep getting an error when use "implode" when a city name is one word, so I tried using "count" and using an if statement... not having any luck $citi = explode(' ', $row['city']); $count = count($citi); if ($count > 1) { $city = implode('+', $citi); } else { $city = $citi; }

    Read the article

  • (Wordpress) Global variable to detect pagination?

    - by Gnee
    I am showing 6 posts on one page. On the 7th post, pagination occurs on so on. goal: If there is more than one page (page 1, 2, 3, etc..), JavaScript is to add a specific div element. If there are only 6 posts or less, no pagination occurs, no div element is added. The number of posts to show: $showposts = get_query_var('showposts'); The current post number I can keep track of: $post_count++; Problem is I can keep track of posts 1-6 but how to tell if if it goes over to 7 and starts pagination? I thought there was a global variable that returns if pagination occurs, but I can't seem to find it. (I know there is global to detect pagination via <!--nextpage--> but so far I can't find it's equivalent for index.php).

    Read the article

  • How do I write a scheme macro that defines a variable and also gets the name of that variable as a s

    - by Jason Baker
    This is mostly a follow-up to this question. I decided to just keep YAGNI in mind and created a global variable (libpython). I set it to #f initially, then set! it when init is called. I added a function that should handle checking if that value has been initialized: (define (get-cpyfunc name type) (lambda args (if libpython (apply (get-ffi-obj name libpython type) args) (error "Call init before using any Python C functions")))) So now here's what I want to do. I want to define a macro that will take the following: (define-cpyfunc Py_Initialize (_fun -> _void)) And convert it into this: (define Py_Initialize (get-cpyfunc "Py_Initialize" (_fun -> _void))) I've been reading through the macro documentation to try figuring this out, but I can't seem to figure out a way to make it work. Can anyone help me with this (or at least give me a general idea of what the macro would look like)? Or is there a way to do this without macros?

    Read the article

  • Casting to global variable from LPVOID - C

    - by Jamie Keeling
    I am trying to cast data to a struct from a parameter passed into my method, I need the data to be passed to a global variable as it is needed elsewhere in my application. I have tried the following but I get errors saying that diceResult is an undeclared identifier Here is the code itself: //Structure to hold dice data typedef struct diceData { int dice1; int dice2; }; struct diceResult; DWORD WINAPI UnpackDiceData(LPVOID sentData) { //Unpack data struct diceData unpackedData = *((struct diceData*)sentData); diceResult.dice1 = unpackedData.dice1; diceResult.dice2 = unpackedData.dice2; } I don't understand why it won't recognise it being there when it's clearly global.

    Read the article

  • F# replace ref variable with something fun

    - by Stephen Swensen
    I have the following F# functions which makes use of a ref variable to seed and keep track of a running total, something tells me this isn't in the spirit of fp or even particular clear on its own. I'd like some direction on the clearest (possible fp, but if an imperative approach is clearer I'd be open to that) way to express this in F#. Note that selectItem implements a random weighted selection algorithm. type WeightedItem(id: int, weight: int) = member self.id = id member self.weight = weight let selectItem (items: WeightedItem list) (rand:System.Random) = let totalWeight = List.sumBy (fun (item: WeightedItem) -> item.weight) items let selection = rand.Next(totalWeight) + 1 let runningWeight = ref 0 List.find (fun (item: WeightedItem) -> runningWeight := !runningWeight + item.weight !runningWeight >= selection) items let items = [new WeightedItem(1,100); new WeightedItem(2,50); new WeightedItem(3,25)] let selection = selectItem items (new System.Random())

    Read the article

  • help, stuck with logic variable comparison loop, javascript

    - by Jamex
    I have an input text box for search of input, the id of the text box is: id="search". if a user enters 'cat' at first and hit search. In the function, I get the value 'cat' by using the syntax: var input = document.getElementById("search").value; After that, the user enter 'dog' in the search box and hit search using the same function. The function would assign 'dog' to the input variable. How would I compare the current value (dog) to the previously entered value (cat)? I have tried to assign the original input with a statement, something like var orig = input; but that would only overwrite the original input with the new input. What is the logical approach to this problem.

    Read the article

  • mysqli query not working when variable inserted

    - by Freelancer
    Hi Everyone, I need an extra pair of eyes! I have a super-simple query: $result = $mysqli->query("SELECT post_id FROM blog_posts WHERE post_uri = 'the-test-post' LIMIT 1"); $row = $result->fetch_array(); and this gives me the post_id. However, if I insert a variable for post_uri, the result is empty. Ways I tried of which none worked: $result = $mysqli->query("SELECT post_id FROM blog_posts WHERE post_uri = '".$post_uri."' LIMIT 1"); $result = $mysqli->query("SELECT post_id FROM blog_posts WHERE post_uri = ".$post_uri." LIMIT 1"); $result = $mysqli->query("SELECT post_id FROM blog_posts WHERE post_uri = $post_uri LIMIT 1"); I have similar query on another page working just right, so that confuses me even more. Help appreciated.

    Read the article

  • Panel data with binary dependent variable in R

    - by Abiel
    Is it possible to do regressions in R using a panel data set with a binary dependent variable? I am familiar with using glm for logit and probit and plm for panel data, but am not sure how to combine the two. Are there any existing code examples? Thank you. EDIT It would also be helpful if I could figure out how to extract the matrix that plm() is using when it does a regression. For instance, you could use plm to do fixed effects, or you could create a matrix with the appropriate dummy variables and then run that through glm(). In a case like this, however, it is annoying to generate the dummies yourself and it would be easier to have plm do it for you. Abiel

    Read the article

  • passing variable to a batch file

    - by sushant
    i am calling a batch file for xcopy. i have the path of the file to b copied in variable a. my code is: dim shell,z z="for.bat " & a & " " & b & " " & c set shell=createobject("wscript.shell") shell.Run z, 1, true where for.bat is: for %%f in (%1,%2,%3) do xcopy %%f D:\shipment\ /e when 'a' has small path like D:\flexcube, it works. but if i put some big path, say: D:\flexcube1\New Folder\New Folder\New Folder\New Folder\New Folder\New Folder\New Folder\New Folder\New Folder\New Folder\New Folder it does not work. is their some length restriction on %1 type variables or is this some other problem? any help is really appreciated.

    Read the article

  • url or content as a variable in the header of the page

    - by Scorpion King
    I am designing a site where external links form various are being shown on my page. I am using $url=$_GET['url']; $website_data = file_get_contents($url); echo $website_data; so essentially a user would click on a hyperlink which is something like www.test.com/display_page.php?url=http://www.xyz.com/article/2.jpg My page, list_of_images.php, typically has a list of images with href for each image as above on the page and when any image is clicked it would go to display_page.php, which would show our banner on the top of this page, some text and then this image beneath that. This image could be from any website. I am currently sending the url directly and grabbing it using GET. I understand that users/hackers can actually do some coding and send commands for the url variable and could break the server or do something harmful and so i would like to avoid this method or sending the url directly in the header. what is the alternate approach for this problem?

    Read the article

  • How do I return a variable from $.post() in jQuery? Closure variable?

    - by James Bao
    I am having trouble passing data retrieved from a $.post() function to use in other places in my code. I want to save the data as a variable and use it outside of the post() function. This is my code: var last_update = function() { $.post('/--/feed', {func:'latest', who:$.defaults.login}, function($j){ _j = JSON.parse($j); alert(_j.text); // This one works }); } alert(_j.text); // This one doesn't }; last_update(); //run the function Please help!

    Read the article

  • php session variable

    - by Idealflip
    Hi Everyone, my session variable seems to keep dropping its array values. What could I be doing wrong? Is it my object? if(isset($_SESSION['locations'])){ $_SESSION['locations']->listItems($_POST['companyLocation']); echo "session exists"; }else{ $_SESSION['locations'] = new Location(); $_SESSION['locations']->listItems($_POST['companyLocation']); echo "session does not exist"; } class Location { function listItems($location){ $array; $array[] = $location; print_r($array); }

    Read the article

< Previous Page | 46 47 48 49 50 51 52 53 54 55 56 57  | Next Page >