Search Results

Search found 15137 results on 606 pages for 'global state'.

Page 201/606 | < Previous Page | 197 198 199 200 201 202 203 204 205 206 207 208  | Next Page >

  • How do I stop a page from unloading (navigating away) in JS?

    - by Natalie Downe
    Does anyone know how to stop a page from reloading or navigating away? jQuery(function($) { /* global on unload notification */ warning = true; if(warning) { $(window).bind("unload", function() { if (confirm("Do you want to leave this page") == true) { //they pressed OK alert('ok'); } else { // they pressed Cancel alert('cancel'); return false; } }); } }); I am working on an e-commerce site at the moment, the page that displays your future orders has the ability to alter the quantities of items ordered using +/- buttons. Changing the quantities this way this doesn't actually change the order itself, they have to press confirm and therefore committing a positive action to change the order. However if they have changed the quantities and navigate away from the page I would like to warn them they are doing so in case this is an accident, as the changed quantities will be lost if they navigate away or refresh the page. In the code above I am using a global variable which will be false by default (its only true for testing), when a quantity is changed I will update this variable to be true, and when they confirm the changes I will set it to false. If warning is true and the page is unloaded, I offer them a confirmation box, if they say no they would like to stay on this page I need to stop it from unloading. return false isn't working, it still lets the user navigate away (the alerts are there for debugging only) Any ideas?

    Read the article

  • Ajax response takes time and status is 503

    - by Suresh S
    guys, i have a html page where onclick of a button a ajax request is sent to server , the request calls a jsp page which runs an oracle procedure.The procedure runs the logic and places it in a temp table . once procedure is completed , the values are returned to the client by selecting values from tmp table. as the response is too late . the data is not received at the client side. solution: i tried to run the procedure in a separate thread using a ajax call. when the procedure is completed a global flag is set to indicate that the data is generated. if the response is 500 , a second ajax call invoked by timeout function after 10000 ms . the second call checks the global flag ,if true then reads from table and sends the response. if not again a timeout is set at the client side. this solution is not mature enough. , as the procedure may take long time to respond. please let me know a good solution for this problenm?

    Read the article

  • Why does Perl's strict not let me pass a parameter hash?

    - by Thariama
    I hava a perl subroutine where i would like to pass parameters as a hash (the aim is to include a css depending on the parameter 'iconsize'). I am using the call: get_function_bar_begin('iconsize' => '32'); for the subroutine get_function_bar_begin: use strict; ... sub get_function_bar_begin { my $self = shift; my %template_params = %{ shift || {} }; return $self->render_template('global/bars /tmpl_incl_function_bar_begin.html',%template_params); } Why does this yield the error message: Error executing run mode 'start': undef error - Can't use string ("iconsize") as a HASH ref while "strict refs" in use at CheckBar.pm at line 334 Am i doing something wrong here? Is there an other way to submit my data ('iconsize') as a hash? (i am still new to Perl) EDIT: Solution which worked for me. I didn't change the call, but my function: sub get_function_bar_begin { my $self = shift; my $paramref = shift; my %params = (ref($paramref) eq 'HASH') ? %$paramref : (); my $iconsize = $params{'iconsize'} || ''; return $self->render_template('global/bars/tmpl_incl_function_bar_begin.html', { 'iconsize' => $iconsize, } ); }

    Read the article

  • What does the Kernel Virtual Memory of each process contain?

    - by claws
    When say 3 programs (executables) are loaded into memory the layout might look something like this: I've following questions: Is the concept of Virtual Memory limited to user processes? Because, I am wondering where does the Operating System Kernel, Drivers live? How is its memory layout? I know its operating system specific make your choice (windows/linux). They say, on a 32 bit machine in a 4GB address space. Half of it (or more recently 1GB) is occupied by kernel. I can see in this diagram that "Kernel Virtual memory" is occupying 0xc0000000 - 0xffffffff (= 1 GB). Are they talking about this? or is it something else? Just want to confirm. What exactly does the Kernel Virtual Memory of each of these processes contain? What is its layout? When we do IPC we talk about shared memory. I don't see any memory shared between these processes. Where does it live? Resources (files, registries in windows) are global to all processes. So, the resource/file handle table must be in some global space. Which area would that be in? Where can I know more about this kernel side stuff.

    Read the article

  • Who needs singletons?

    - by sexyprout
    Imagine you access your MySQL database via PDO. You got some functions, and in these functions, you need to access the database. The first thing I thought of is global, like: $db = new PDO('mysql:host=127.0.0.1;dbname=toto', 'root', 'pwd'); function some_function() { global $db; $db->query('...'); } But it's considered as a bad practice. So, after a little search, I ended up with the Singleton pattern, which "applies to situations in which there needs to be a single instance of a class." According to the example of the manual, we should do this: class Database { private static $instance, $db; private function __construct(){} static function singleton() { if(!isset(self::$instance)) self::$instance = new __CLASS__; return self:$instance; } function get() { if(!isset(self::$db)) self::$db = new PDO('mysql:host=127.0.0.1;dbname=toto', 'user', 'pwd') return self::$db; } } function some_function() { $db = Database::singleton(); $db->get()->query('...'); } some_function(); But I just can't understand why you need that big class when you can do it merely with: class Database { private static $db; private function __construct(){} static function get() { if(!isset(self::$rand)) self::$db = new PDO('mysql:host=127.0.0.1;dbname=toto', 'user', 'pwd'); return self::$db; } } function some_function() { Database::get()->query('...'); } some_function(); This last one works perfectly and I don't need to worry about $db anymore. But maybe I'm forgetting something. So, who's wrong, who's right?

    Read the article

  • Adding Variables to JavaScript in Joomla

    - by Vikram
    Hello friends! This is the script I am using to display an accordion in my Joomla site: <?php defined('JPATH_BASE') or die(); gantry_import('core.gantryfeature'); class GantryFeatureAccordion extends GantryFeature { var $_feature_name = 'accordion'; function init() { global $gantry; if ($this->get('enabled')) { $gantry->addScript('accordion.js'); $gantry->addInlineScript($this->_accordion()); } } function render($position="") { ob_start(); ?> <div id="accordion"> <dl> <?php foreach (glob("templates/rt_gantry_j15/features/accordion/*.php") as $filename) {include($filename);} ?> </dl> </div> <?php return ob_get_clean(); } function _accordion() { global $gantry; $js = " jQuery.noConflict(); (function($){ $(document).ready(function () { $('#accordion').easyAccordion({ slideNum: true, autoStart: true, slideInterval: 4000 }); }); })(jQuery); "; return $js; } } I want to call these three values in the templateDetails.XML file as a user input. slideNum: true, autoStart: true, slideInterval: 4000 Like this in the templateDetails.xml file: <param name="accordion" type="chain" label="ACCORDION" description="ACCORDION_DESC"> <param name="slideNum" type="text" default="true" label="Offset Y" class="text-short" /> <param name="autoStart" type="text" default="true" label="Offset Y" class="text-short" /> <param name="autoStart" type="text" default="4000" label="Offset Y" class="text-short" /> </param> How can I do so? What will be the exact syntax for the same. I am very new to programming ans specially to JavaScript. Kindly help.

    Read the article

  • Declaring an enum within a class

    - by bporter
    In the following code snippet, the Color enum is declared within the Car class in order to limit the scope of the enum and to try not to "pollute" the global namespace. class Car { public: enum Color { RED, BLUE, WHITE }; void SetColor( Car::Color color ) { _color = color; } Car::Color GetColor() const { return _color; } private: Car::Color _color; }; (1) Is this a good way to limit the scope of the Color enum? Or, should I declare it outside of the Car class, but possibly within its own namespace or struct? I just came across this article today, which advocates the latter and discusses some nice points about enums: http://gamesfromwithin.com/stupid-c-tricks-2-better-enums. (2) In this example, when working within the class, is it best to code the enum as Car::Color, or would just Color suffice? (I assume the former is better, just in case there is another Color enum declared in the global namespace. That way, at least, we are explicit about the enum to we are referring.) Thanks in advance for any input on this.

    Read the article

  • Where to add an overloaded operator for the tr1::array?

    - by phlipsy
    Since I need to add an operator& for the std::tr1::array<bool, N> I wrote the following lines template<std::size_t N> std::tr1::array<bool, N> operator& (const std::tr1::array<bool, N>& a, const std::tr1::array<bool, N>& b) { std::tr1::array<bool, N> result; std::transform(a.begin(), a.end(), b.begin(), result.begin(), std::logical_and<bool>()); return result; } Now I don't know in which namespace I've to put this function. I considered the std namespace as a restricted area. Only total specialization and overloaded function templates are allowed to be added by the user. Putting it into the global namespace isn't "allowed" either in order to prevent pollution of the global namespace and clashes with other declarations. And finally putting this function into the namespace of the project doesn't work since the compiler won't find it there. What had I best do? I don't want to write a new array class putted into the project namespace. Because in this case the compiler would find the right namespace via argument dependent name lookup. Or is this the only possible way because writing a new operator for existing classes means extending their interfaces and this isn't allowed either for standard classes?

    Read the article

  • C++ Declaring an enum within a class

    - by bporter
    In the following code snippet, the Color enum is declared within the Car class in order to limit the scope of the enum and to try not to "pollute" the global namespace. class Car { public: enum Color { RED, BLUE, WHITE }; void SetColor( Car::Color color ) { _color = color; } Car::Color GetColor() const { return _color; } private: Car::Color _color; }; (1) Is this a good way to limit the scope of the Color enum? Or, should I declare it outside of the Car class, but possibly within its own namespace or struct? I just came across this article today, which advocates the latter and discusses some nice points about enums: http://gamesfromwithin.com/stupid-c-tricks-2-better-enums. (2) In this example, when working within the class, is it best to code the enum as Car::Color, or would just Color suffice? (I assume the former is better, just in case there is another Color enum declared in the global namespace. That way, at least, we are explicit about the enum to we are referring.) Thanks in advance for any input on this.

    Read the article

  • python list Index out of range error

    - by dman762000
    I am working on a python tetris game that my proffessor assigned for the final project of a concepts of programming class. I have got just about everything he wanted to work on it at this point but I am having a slight problem with one part of it. Whenever I start moving pieces left and right I keep getting "index out of range error". This only happens when it is up against a piece. Here are the culprits that are giving me grief. def clearRight(block=None): global board, activeBlock, stackedBlocks isClear = True if(block == None): block = activeBlock if(block != None): for square in block['squares']: row = square[1] col = square[0]+1 if(col >= 0 and stackedBlocks[row][col] !=None): isClear=False return isClear def clearLeft(block=None): global board, activeBlock, stackedBlocks isClear = True if(block == None): block = activeBlock if(block != None): for square in block['squares']: row = square[1] col = square[0]-1 if(col >= 0 and stackedBlocks[row][col] !=None): isClear=False return isClear I am not looking to get anyone to fix it for me, I'm only looking for tips on how to fix it myself. Thanks in advance for any help that is given.

    Read the article

  • PHP Multiple navigation highlights

    - by Blackbird
    I'm using this piece of code below to highlight the "active" menu item on my global navigation. <?php $path = $_SERVER['PHP_SELF']; $page = basename($path); $page = basename($path, '.php'); ?> <ul id="nav"> <li class="home"><a href="index.php">Home</a></li> <li <?php if ($page == 'search') { ?>class="active"<?php } ?>><a href="#">Search</a></li> <li <?php if ($page == 'help') { ?>class="active"<?php } ?>><a href="help.php">Help</a></li> </ul> All works great but, on a couple of pages, I have a second sub menu (sidebar menu) within a global page. I basically need to add a OR type statement into the php somehow, but I haven't a clue a how. Example of what i mean: <li <?php if ($page == 'help') OR ($page == 'help-overview') OR ($page == 'help-cat-1') { ?>class="active"<?php } ?>><a href="#">Search</a></li> Thanks!

    Read the article

  • How to delete ProgIDs from other user accounts when uninstalling from Windows?

    - by Mordachai
    I've been investigating "how should a modern windows c++ application register its file types" with Windows (see http://stackoverflow.com/questions/2828637/c-how-do-i-correctly-register-and-unregister-file-type-associations-for-our-ap). And having combed through the various MSDN articles on the subject, the summary appears to be as follows: The installer (elevated) should register the global ProgID HKLM\Software\Classes\my-app.my-doc[.version] (e.g. HKLM\Software\Classes\TextPad.text) The installer also configures default associations for its document types (e.g. .myext) and points this to the aforementioned global ProgID in HKLM. NOTE: a user interface should be provided here to allow the user to either accept all default associations, or to customize which associations should be set. The application, running standard (unelevated), should provide a UI for allowing the current user to set their personal associations as is available in the installer, except that these associations are stored in HKCU\Software\Classes (per user, not per machine). The UN-installer is then responsible for deleting all registered ProgIDs (but should leave the actual file associations alone, as Windows is smart enough to handle associations pointing to missing ProgIDs, and this is the specified desired behavior by MSDN). So that schema sounds reasonable to me, except when I consider #4: How does an uninstaller, running elevated for a given user account, delete any per-user ProgIDs created in step #3 for other users? As I understand things, even in elevated mode, an uninstaller cannot go into another user's registry hive and delete items? Or can it? Does it have to load each given user hive first? What are the rules here? Thanks for any insight you might have to offer! EDIT: See below for the solution (My question was founded in confusion)

    Read the article

  • Return REF CURSOR to procedure generated data

    - by ThaDon
    I need to write a sproc which performs some INSERTs on a table, and compile a list of "statuses" for each row based on how well the INSERT went. Each row will be inserted within a loop, the loop iterates over a cursor that supplies some values for the INSERT statement. What I need to return is a resultset which looks like this: FIELDS_FROM_ROW_BEING_INSERTED.., STATUS VARCHAR2 The STATUS is determined by how the INSERT went. For instance, if the INSERT caused a DUP_VAL_ON_INDEX exception indicating there was a duplicate row, I'd set the STATUS to "Dupe". If all went well, I'd set it to "SUCCESS" and proceed to the next row. By the end of it all, I'd have a resultset of N rows, where N is the number of insert statements performed and each row contains some identifying info for the row being inserted, along with the "STATUS" of the insertion Since there is no table in my DB to store the values I'd like to pass back to the user, I'm wondering how I can return the info back? Temporary table? Seems in Oracle temporary tables are "global", not sure I would want a global table, are there any temporary tables that get dropped after a session is done?

    Read the article

  • How to calculate the current index?

    - by niko
    Hi, I have written an algorithm which iteratively solves the problem. The first iteration consists of 6 steps and all the following iterations consist of 5 steps (first step is skipped). What I want to calculate is the current (local) step in the iteration from current global step. For example if there are 41 steps in total which means there are 8 iterations: indices from 1 to 6 belong to 1st iteration indices from 7 to 11 belong to second iteration ... For calculating the current iteration I have written the following code: if(currentStep <= 6) iteration = 1; else iteration = floor((currentStep - 7)/5) + 2; end The problem remains in calculating local steps. in first iteration the performed steps are: 1, 2, 3, 4, 5, 6 in all the following iterations the performing steps are 2, 3, 4, 5, 6 So what has to be done is to transform the array of global steps [1 2 3 4 5 6 7 8 9 10 11 12 13 ... 41] into array of local steps [1 2 3 4 5 6 2 3 4 5 6 2 3 ... 6]. I would appreciate if anyone could help in finding the solution to a given problem. Thank you!

    Read the article

  • twitter streaming api instead of search api

    - by user1711576
    I am using twitters search API to view all the tweets that use a particular hashtag I want to view. However, I want to use the stream function, so, I only get recent ones, and so, I can then store them. <?php global $total, $hashtag; $hashtag = $_POST['hash']; $total = 0; function getTweets($hash_tag, $page) { global $total, $hashtag; $url = 'http://search.twitter.com/search.json?q='.urlencode($hash_tag).'&'; $url .= 'page='.$page; $ch = curl_init($url); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, TRUE); $json = curl_exec ($ch); curl_close ($ch); echo "<pre>"; $json_decode = json_decode($json); print_r($json_decode->results); $json_decode = json_decode($json); $total += count($json_decode->results); if($json_decode->next_page){ $temp = explode("&",$json_decode->next_page); $p = explode("=",$temp[0]); getTweets($hashtag,$p[1]); } } getTweets($hashtag,1); echo $total; ?> The above code is what I have been using to search for the tweets I want. What do I need to do to change it so I can stream the tweets instead? I know I would have to use the stream url https://api.twitter.com/1.1/search/tweets.json , but what do I need to change after that is where I don't know what to do. Obviously, I know I'll need to write the database sql but I want to just capture the stream first and view it. How would I do this? Is the code I have been using not any good for just capturing the stream?

    Read the article

  • Django templatetag "order of processing"

    - by Jason Persampieri
    I am trying to write a set of template tags that allow you to easily specify js and css files from within the template files themselves. Something along the lines of {% requires global.css %}, and later in the request, {% get_required_css %}. I have this mostly working, but there are a couple of issues. We'll start with the 'timing' issues. Each template tag is made up of two steps, call/init and render. Every call/init happens before any render procedure is called. In order to guarantee that all of the files are queued before the {% get_required_css %} is rendered, I need to build my list of required files in the call/init procedures themselves. So, I need to collect all of the files into one bundle per request. The context dict is obviously the place for this, but unfortunately, the call/init doesn't have access to the context variable. Is this making sense? Anyone see a way around this (without resorting to a hack-y global request object)? Another possibility to store these in a local dict but they would still need to be tied to the request somehow... possibly some sort of {% start_requires %} tag? But I have no clue how to make that work either.

    Read the article

  • how can i make sure to get the server response correctly when i invoke the server with QNetworkReque

    - by noname
    I wrote the server site call in Qt, but i haven't get the server response for every server invoking. I have to use the server reply to continue the program flow. The request is correctly reached to server and server do reply.The server is also on my machine. Here is the code how i make the server site call; QNetworkAccessManager nam1 = new QNetworkAccessManager(this); qnetmg=nam1; QObject::connect(nam1, SIGNAL(finished(QNetworkReply*)),this,SLOT(finishedGettingMarker(QNetworkReply*))); QString strurl="http://localhost:8080/ServerWeb"; QUrl url(strurl); QNetworkRequest preq(url); QNetworkReply* reply = nam1->get(preq); qreply=reply; Inside finisedGettingMarker slot, i have already eliminate for QNetworkReply-error case and i used one global variable for QNetworkAccessManager;"qnetmg" and one global variable for QNetworkReply;"qreply". And also i make qnetmg.disconnect(this,0); and qreply.abort(); inside that slot method. But the problem is i haven't got the response for every server invoking time. If anyone who know the way to solve it , please reply me. This situation happened only in Opera. Thanks in advance.

    Read the article

  • Passing an arbritrary JavaScript object in Xul

    - by Tom Brito
    I'm following this example to pass an object to a window, but when it as an argument it's with "undefined" value. This is my first window (obs. dump is the way to print to console when debug options are turned on): <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <!DOCTYPE window SYSTEM "chrome://XulWindowArgTest/locale/XulWindowArgTest.dtd"> <window id="windowID" width="400" height="300" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <script> <![CDATA[ function onClickMe(event) { dump("begin\n"); try { var args = { param1: true, param2: 42 }; args.wrappedJSObject = args; var watcher = Components.classes["@mozilla.org/embedcomp/window-watcher;1"].getService(Components.interfaces.nsIWindowWatcher); watcher.openWindow(null, "chrome://XulWindowArgTest/content/about.xul", "windowName", "chrome", args); } catch (e) { dump("error: " + e + "\n"); } dump("end\n"); } ]]> </script> <button label="Click me !" oncommand="onClickMe();" /> </window> and my second window: <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <!DOCTYPE window SYSTEM "chrome://XulWindowArgTest/locale/XulWindowArgTest.dtd"> <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" onload="onload()"> <script> <![CDATA[ function onload() { dump('arg = ' + window.arguments[0].wrappedJSObject + "\n"); } ]]> </script> <label value="test" /> </window> when the second window loads, it calls the onload and prints: arg = undefined Any idea how to fix it?

    Read the article

  • Is it better for class data to be passed internally or accessed directly?

    - by AaronSzy
    Example: // access fields directly private void doThis() { return doSomeWork(this.data); } // receive data as an argument private void doThis(data) { return doSomeWork(data); } The first option is coupled to the value in this.data while the second option avoids this coupling. I feel like the second option is always better. It promotes loose coupling WITHIN the class. Accessing global class data willy-nilly throughout just seems like a bad idea. Obviously this class data needs to be accessed directly at some point. However, if accesses, to this global class data can be eliminated by parameter passing, it seems that this is always preferable. The second example has the advantage of working with any data of the proper type, whereas the first is bound to working with the just class data. Even if you don't NEED the additional flexibility, it seems nice to leave it as an option. I just don't see any advantage in accessing member data directly from private methods as in the first example. Whats the best practice here? I've referenced code complete, but was not able to find anything on this particular issue.

    Read the article

  • Using classes for the first time,help in debugging

    - by kaushik
    here is post my code:this is no the entire code but enough to explain my doubt.please discard any code line which u find irrelavent enter code here saving_tree={} isLeaf=False class tree: global saving_tree rootNode=None lispTree=None def __init__(self,x): file=x string=file.readlines() #print string self.lispTree=S_expression(string) self.rootNode=BinaryDecisionNode(0,'Root',self.lispTree) class BinaryDecisionNode: global saving_tree def __init__(self,ind,name,lispTree,parent=None): self.parent=parent nodes=lispTree.getNodes(ind) print nodes self.isLeaf=(nodes[0]==1) nodes=nodes[1]#Nodes are stored self.name=name self.children=[] if self.isLeaf: #Leaf Node print nodes #Set the leaf data self.attribute=nodes print "LeafNode is ",nodes else: #Set the question self.attribute=lispTree.getString(nodes[0]) self.attribute=self.attribute.split() print "Question: ",self.attribute,self.name tree={} tree={str(self.name):self.attribute} saving_tree=tree #Add the children for i in range(1,len(nodes)):#Since node 0 is a question # print "Adding child ",nodes[i]," who has ",len(nodes)-1," siblings" self.children.append(BinaryDecisionNode(nodes[i],self.name+str(i),lispTree,self)) print saving_tree i wanted to save some data in saving_tree{},which i have declared previously and want to use that saving tree in the another function outside the class.when i asked to print saving_tree it printing but,only for that instance.i want the saving_tree{} to have the data to store data of all instance and access it outside. when i asked for print saving_tree outside the class it prints empty{}.. please tell me the required modification to get my required output and use saving_tree{} outside the class..

    Read the article

  • Security benefits from a second opinion, are there flaws in my plan to hash & salt user passwords vi

    - by Tchalvak
    Here is my plan, and goals: Overall Goals: Security with a certain amount of simplicity & database-to-database transferrability, 'cause I'm no expert and could mess it up and I don't want to have to ask a lot of users to reset their passwords. Easy to wipe the passwords for publishing a "wiped" databased of test data. (e.g. I'd like to be able to use a postgresql statement to simply reset all passwords to something simple so that testers can use that testing data for themselves). Plan: Hashing the passwords Account creation records the original email that an account is created with, forever. A global salt is used, e.g. "90fb16b6901dfceb73781ba4d8585f0503ac9391". An account specific salt, the original email the account was created with, is used, e.g. "[email protected]". The users's password is used, e.g. "password123" (I'll be warning against weak passwords in the signup form) The combination of the global salt, account specific salt, and password is hashed via some hashing method in postgresql (haven't been able to find documentation for hashing functions in postgresql, but being able to use sha-2 or something like that would be nice if I could find it). The hash gets stored in the database. Recovering an account To change their password, they have to go through standard password reset (and that reset email gets sent to the original email as well as the most recent account email that they have set). Flaws? Are there any flaws with this that I need to address? And are there best practices to doing hashing fully within postgresql?

    Read the article

  • Beginner error in CUDA

    - by Dimitri
    Hi folks, first all i want to wish you a merry christmas. I am writing a small program in CUDA and i have the following errors : contraste.cu(167): error: calling a host function from a __device__/__global__ function is not allowed I don't understand why. Can you please help me and show me my errors. It seems that my program is correct. Here is a the bunch of code causing the problems : __global__ void kernel_contraste(float power, unsigned char tab_in[], unsigned char tab_out[], int nbl, int nbc) { int x = threadIdx.x; printf("I am the thread %d\n", x); } Part of my main program : unsigned char *dimg, *dimg_res; ..... cudaMalloc((void **)dimg, h * w * sizeof(char)); cudaMemcpy(dimg, r.data, h*w*sizeof(char), cudaMemcpyHostToDevice); cudaMalloc((void **)dimg_res, h*w*sizeof(char)); dim3 nbThreadparBloc(256); dim3 numblocs(1); kernel_contraste<<<numblocs, nbThreadparBloc >>>(puissance, dimg, dimg_res, h, w); cudaThreadSynchronize(); ..... cudaFree(dimg); cudaFree(dimg_res); The line 167 is the line where i call the printf in function kernel_contraste. For information, this program takes an image as an input( a sun Rasterfile ) and a power then it calculates the contraste of that image. Thanks !!

    Read the article

  • problem with include in PHP

    - by EquinoX
    I have a php file called Route.php which is located on: /var/www/api/src/fra/custom/Action and the file I want to include is in: /var/www/api/src/fra/custom/ So what I have inside route php is an absolute path to the two php file I want to include: <?php include '/var/www/api/src/frapi/custom/myneighborlists.php'; include '/var/www/api/src/frapi/custom/mynodes.php'; ............ ........... ?> These two file has an array of large amount of size that I want to use in Route.php. When I do vardump($global) it just returns NULL. What am I missing here? UPDATE: I did an echo on the included file and it prints something, so therefore it is included.. however I can't get access that array... when I do a vardump on the array, it just returns NULL! I did add a global $myarray inside the function in which I want to access the array from the other php file Sample myneighborlists.php: <?php $myarray = array( 1=> array(3351=>179), 2=> array(3264=>172, 3471=>139), 3=> array(3467=>226), 4=> array(3309=>211, 3469=>227), 5=> array(3315=>364, 3316=>144, 3469=>153), 6=> array(3305=>273, 3309=>171), 7=> array(3267=>624, 3354=>465, 3424=>411, 3437=>632), 8=> array(3302=>655, 3467=>212), 9=> array(3305=>216, 3306=>148, 3465=>505), 10=> array(3271=>273, 3472=>254), 11=> array(3347=>273, 3468=>262), 12=> array(3310=>237, 3315=>237)); ?>

    Read the article

  • How to get values from SQL query made by php?

    - by Ole Jak
    So I made a query like this global $connection; $query = "SELECT * FROM streams "; $streams_set = mysql_query($query, $connection); confirm_query($streams_set); in my DB there are filds ID, UID, SID, TIME (all INT type exept time) So I am triing to print query relult into form <form> <select class="multiselect" multiple="multiple" name="SIDs"> <?php global $connection; $query = "SELECT * FROM streams "; $streams_set = mysql_query($query, $connection); confirm_query($streams_set); $streams_count = mysql_num_rows($streams_set); for ($count=1; $count <= $streams_count; $count++) { echo "<option value=\"{$count}\""; echo ">{$count}</option>"; } ?> </select> <br/> <input type="submit" value="Submit Form"/> </form> How to print out as "option" "values" SID's from my sql query?

    Read the article

  • Common block usage in Fortran

    - by Crystal
    I'm new to Fortran and just doing some simple things for work. And as a new programmer in general, not sure exactly how this works, so excuse me if my explanation or notation is not the best. At the top of the .F file there are common declarations. The person explaining it to me said think of it like a struct in C, and that they are global. Also in that same .F file, they have it declared with what type. So it's something like: COMMON SOMEVAR INTEGER*2 SOMEVAR And then when I actually see it being used in some other file, they declare local variables, (e.g. SOMEVAR_LOCAL) and depending on the condition, they set SOMEVAR_LOCAL = 1 or 0. Then there is another conditional later down the line that will say something like IF (SOMEVAR_LOCAL. eq. 1) SOMEVAR(PARAM) = 1; (Again I apologize if this is not proper Fortran, but I don't have access to the code right now). So it seems to me that there is a "struct" like variable called SOMEVAR that is of some length (2 bytes of data?), then there is a local variable that is used as a flag so that later down the line, the global struct SOMEVAR can be set to that value. But because there is (PARAM), it's like an array for that particular instance? Thanks. Sorry for my bad explanation, but hopefully you will understand what I am asking.

    Read the article

< Previous Page | 197 198 199 200 201 202 203 204 205 206 207 208  | Next Page >