Search Results

Search found 11735 results on 470 pages for 'global variables'.

Page 11/470 | < Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >

  • When are static class variables initialized during runtime?

    - by Jake
    Hi, I have the following: class Thing { static Thing PREDEFINED; type _private; Thing() { _private = initial_val; } } Thing Thing::PREDEFINED = redefined_val; in global scope, i have this Thing mything = Thing::PREDEFINED; but it does not have the desired effect. mything is still initial_value and there were no errors too. So, may I ask when is the static class variable initialized during runtime?

    Read the article

  • Pass variables between separate instances of ruby (without writing to a text file or database)

    - by boulder_ruby
    Lets say I'm running a long worker-script in one of several open interactive rails consoles. The script is updating columns in a very, very, very large table of records. I've muted the ActiveRecord logger to speed up the process, and instruct the script to output some record of progress so I know how roughly how long the process is going to take. That is what I am currently doing and it would look something like this: ModelName.all.each_with_index do |r, i| puts i if i % 250 ...runs some process... r.save end Sometimes its two nested arrays running, such that there would be multiple iterators and other things running all at once. Is there a way that I could do something like this and access that variable from a separate rails console? (such that the variable would be overwritten every time the process is run without much slowdown) records = ModelName.all $total = records.count records.each_with_index do |r, i| $i = i ...runs some process... r.save end meanwhile mid-process in other console puts "#{($i/$total * 100).round(2)}% complete" #=> 67.43% complete I know passing global variables from one separate instance of ruby to the next doesn't work. I also just tried this to no effect as well unix console 1 $X=5 echo {$X} #=> 5 unix console 2 echo {$X} #=> "" Lastly, I also know using global variables like this is a major software design pattern no-no. I think that's reasonable, but I'd still like to know how to break that rule if I'd like. Writing to a text file obviously would work. So would writing to a separate database table or something. That's not a bad idea. But the really cool trick would be sharing a variable between two instances without writing to a text file or database column. What would this be called anyway? Tunneling? I don't quite know how to tag this question. Maybe bad-idea is one of them. But honestly design-patterns isn't what this question is about.

    Read the article

  • Oracle Applications Global User Experience

    - by ultan o'broin
    Today, we're launching Oracle's first ever blog for global user experience (UX) applications issues. We'll be talking about how we design and develop applications for global use, looking at the cultural factors, internationalization (I18n), localization (L10n) and language used for a start. We will also discuss how we study and work with real users so that our customers have applications that allow them to be productive regardless of where they are located in the world. In addition, we will inform you about any globally-related events we know about, and about product features, development frameworks, tools, information and relevant to our worldwide customers. Also, of course, we hope to hear from you, too. If you have anything you want to know about our global user experience, a localization you'd like, or cultural feature you think would be useful, then let us know. If you have any tips or guidelines you'd like to share in this space, then this blog is for you too! As far as global user experience is concerned, you don't have to be lost in translation. Hence the name of the blog!

    Read the article

  • Oracle Global HR Cloud Implementation Training Can Help Meet Your Business Needs

    - by HCM-Oracle
    By Jim Vonick A key goal for the deployment of your Oracle Global HR Cloud applications is to accelerate the implementation and adoption of your applications, so that your business can start realizing all of the benefits that this rich solution offers.    Implementation team members need to have the skills and knowledge to ensure a smooth, rapid and successful implementation of your applications. During set-up, you want to optimize the configuration to best meet your business needs. In order to do this you need to understand the foundation and configuration options of your applications, so that decisions can be made during set-up that best align with your business.  To that end product level implementation training is recommended for Oracle Global HR Cloud deployments. Training For Implementation Team Members and Consultants Fusion Applications: HCM Security: Learn how to implement security for Oracle Fusion HCM applications by creating and customizing roles. You'll learn how to create security profiles to restrict data access, provision roles to users, create and manage user accounts, and verify security setup. Fusion Applications: HCM Global Human Resources: Learn how to set up your enterprise and workforce structures, how to perform functional tasks, and how to configure security for Global Human Resources data. Fusion Applications: HCM Compensation: Learn how to implement, configure, and use Oracle Fusion Compensation to manage base pay, individual compensation, workforce compensation, and total compensation statements. Fusion Applications: HCM Benefits: This course teaches you to implement, configure and manage Oracle Fusion Benefits, including how to implement benefit plans and programs.  Fusion Applications: HCM Payroll Implementation (US): This course provides implementation training for payroll managers or payroll administrators. Learn how to process payroll to ensure accurate setup results.  Learn More: See all Fusion HCM Training Jim Vonick is a Senior Product Manager with Oracle University focusing on training for Oracle Applications and Industry Solutions.

    Read the article

  • How to Global onRouteRequest directly to onBadRequest?

    - by virtualeyes
    EDIT Came up with this to sanitize URI date params prior to passing off to Play router val ymdMatcher = "\\d{8}".r // matcher for yyyyMMdd URI param val ymdFormat = org.joda.time.format.DateTimeFormat.forPattern("yyyyMMdd") def ymd2Date(ymd: String) = ymdFormat.parseDateTime(ymd) override def onRouteRequest(r: RequestHeader): Option[Handler] = { import play.api.i18n.Messages ymdMatcher.findFirstIn(r.uri) map{ ymd=> try { ymd2Date( ymd); super.onRouteRequest(r) } catch { case e:Exception => // kick to "bad" action handler on invalid date Some(controllers.Application.bad(Messages("bad.date.format"))) } } getOrElse(super.onRouteRequest(r)) } ORIGINAL Let's say I want to return a BadRequest result type for all /foo URIs: override def onBadRequest(r: RequestHeader, error: String) = { BadRequest("Bad Request: " + error) } override def onRouteRequest(r: RequestHeader): Option[Handler] = { if(r.uri.startsWith("/foo") onBadRequest("go away") else super.onRouteRequest(r) } Of course does not work, since the expected return type is Option[play.api.mvc.Handler] What's the idiomatic way to deal with this, create a default Application controller method to handle filtered bad requests? Ideally, since I know in onRouteRequest that /foo is in fact a BadRequest, I'd like to call onBadRequest directly. Should note that this is a contrived example, am actually verifying a URI yyyyMMdd date param, and BadRequest-ing if it does not parse to a JodaTime instance -- basically a catch-all filter to sanitize a given date param rather than handling on every single controller method call, not to mention, avoiding cluttering up application log with useless stack traces re: invalid date parse conversions (have several MBs of these junk trace entries accruing daily due to users pointlessly manipulating the uri date in attempts to get at paid subscriber content)

    Read the article

  • Show alert message box from the Global.asax (on Application_Error event)

    - by Albert
    Normally I just redirect to a custom error page in on the Application_Error event, but I have a specific error for which I'd like to display an alert message while the user is still on the page which triggers the error. How can I make this happen? I'm open to a modalpopup or any other type of error message, I just want to ensure the user stays on the page where they encounter the error. Thank for any ideas.

    Read the article

  • Compile redeclaration error of global variable in C++, but not in C.

    - by coelhudo
    Suppose that I have those three files: a.h //a.h header #include <stdio.h> int int_variable; void a_f() { printf("int_variable: %d\n", int_variable) int_variable++; } b.h //b.h header #include <stdio.h> int int_variable; void b_f() { printf("int_variable: %d\n", int_variable) int_variable++; } main.c //main.c #include "a.h" #include "b.h" int main() { a_f(); b_f(); return 0; } Why compiling in C++ generates redefinition error, but in C doesn't? I am C++ developer, then in C++ makes sense to me, but why in C this is not an error? When I executed the C generated code, the output was: int variable: 0 int variable: 1 Thanks

    Read the article

  • Storing Requested URL in Global.asax without Session State in ASP.NET

    - by Mark Richman
    I have a complex URL rewriting scheme which breaks the built in Forms Authentication ReturnUrl mechanism. I would like to grab the requested URL for later redirection away from my login.aspx. I can get this URL in Application_BeginRequest via HttpContext.Current.Request.AppRelativeCurrentExecutionFilePath. However, Session state is not available in Application_BeginRequest. How can I store this URL prior to ASP.NET redirecting me to login.aspx?

    Read the article

  • Make object available within php functions without passing them or making them global

    - by Matt
    Hey all, This requirement is just for simplicity for developers and beautiful code. I'm building a template system and I really would just like an object variable to simply be there in all functions. Here's some code: Librarian.php: $class = "slideshow"; $function = "basic"; $args = array(...); $librarian = $this; // I WOULD LIKE THIS TO BE PRESENT IN CALLED FUNCTION ... return call_user_func($class.'::'.$function, $args); ... Slideshow.php: public static function basic($args) { echo $librarian; // "Librarian Object" } Thanks! Matt Mueller

    Read the article

  • How do I pass session variables from one domain to another in PHP

    - by Dave
    Hi everyone, I have encountered a situation where I need to pass $_SESSION variables from one domain to an iFrame page from another domain. I have spent the last 16 days trying various methods to no avail. I think that the only logical way would be to encode the variables in the url that calls the iFrame and decode them in th iFrame page. I am not sure how to go about this and I am looking for any samples, assistance etc that I can find. Thanks for any and all suggestions. Here is an example of what I am trying to do... Example: <!-- Note only using hidden as I didn't want to build the form at test phase--> <form name="test" method="post" action="iframe_test.php"> <input type="submit" name="Submit" /> <input type="hidden" name="fName" value="abc" /> <input type="hidden" name="lName" value="def" /> <input type="hidden" name="address1" value="ghi" /> <input type="hidden" name="address2" value="jkl" /> <input type="hidden" name="country" value="mno" /> <input type="hidden" name="postal_code" value="pqr" /> <input type="hidden" name="city" value="stu" /> <input type="hidden" name="retUrl" value="vwx"> <input type="hidden" name="decUrl" value="yz"> So from here I am hitting the iframe_test.php and doing the following: PHP Code: function StripSpecChar($val) { return (preg_replace('/[^a-zA-Z0-9" "-.@\:\/_]/','', $val)); } foreach ($_POST as $key => $val) { $_SESSION[$key] = StripSpecChar($val); } and I get a session array that looks like this: Code: Array ( [fName] => abc [lName] => def [address1] => ghi [address2] => jkl [country] => mno [postal_code] => pqr [city] => stu [retUrl] => vwx [decUrl] => yz ) Still all good so far....call the iFrame Code: <body> Some page stuff here <div align="center"><span class="style1"><strong>This is the iFrame Page</strong></span> </div> <div align="center"> <iframe src="https://www.other_domain.org/iframe/reserve.php" width="500" height="350" frameBorder="0"></iframe> </div> </body> So HOW do I take... $_SESSION['fName']['abc']; $_SESSION['lName']['def']; $_SESSION['address1']['ghi']; $_SESSION['address2']['jkl']; $_SESSION['country']['mno']; $_SESSION['postal_code']['pqr']; $_SESSION['city']['stu']; $_SESSION['retUrl']['vwx']; $_SESSION['decUrl']['yz']; and turn it into the encoded url that I am looking for? Further once that is done how to I get the session vars back as session vars on that new domain iFrame page...

    Read the article

  • global static boolean pointer causes segmentation fault using pthread

    - by asksw0rder
    New to pthread programming, and stuck on this error when working on a C++&C mixed code. What I have done is to call the c code in the thread created by the c++ code. There is a static boolean pointer used in the thread and should got free when the thread finishes. However I noticed that every time when the program processed into the c function, the value of the boolean pointer would be changed and the segmentation fault then happened due to the free(). Detail code is as follows: static bool *is_center; // omit other codes in between ... void streamCluster( PStream* stream) { // some code here ... while(1){ // some code here ... is_center = (bool*)calloc(points.num,sizeof(bool)); // start the parallel thread here. // the c code is invoked in this function. localSearch(&points,kmin, kmax,&kfinal); // parallel free(is_center); } And the function using parallel is as follows (my c code is invoked in each thread): void localSearch( Points* points, long kmin, long kmax, long* kfinal ) { pthread_barrier_t barrier; pthread_t* threads = new pthread_t[nproc]; pkmedian_arg_t* arg = new pkmedian_arg_t[nproc]; pthread_barrier_init(&barrier,NULL,nproc); for( int i = 0; i < nproc; i++ ) { arg[i].points = points; arg[i].kmin = kmin; arg[i].kmax = kmax; arg[i].pid = i; arg[i].kfinal = kfinal; arg[i].barrier = &barrier; pthread_create(threads+i,NULL,localSearchSub,(void*)&arg[i]); } for ( int i = 0; i < nproc; i++) { pthread_join(threads[i],NULL); } delete[] threads; delete[] arg; pthread_barrier_destroy(&barrier); } Finally the function calling my c code: void* localSearchSub(void* arg_) { // omit some initialize code... // my code begin_papi_thread(&eventSet); // Processing k-means, omit codes. // is_center value will be updated correctly // my code end_papi_thread(&eventSet); // when jumping into this, error happens return NULL; } And from gdb, what I have got for the is_center is: Breakpoint 2, localSearchSub (arg_=0x600000000000bc40) at streamcluster.cpp:1711 1711 end_papi_thread(&eventSet); (gdb) s Hardware watchpoint 1: is_center Old value = (bool *) 0x600000000000bba0 New value = (bool *) 0xa93f3 0x400000000000d8d1 in localSearchSub (arg_=0x600000000000bc40) at streamcluster.cpp:1711 1711 end_papi_thread(&eventSet); Any suggestions? Thanks in advance!

    Read the article

  • Objective-C global array of ints not working as expected

    - by Fran
    In my MyConstants.h file... I have: int abc[3]; In my matching MyConstants.m file... I have: extern int abc[3] = {11, 22, 33}; In each of my other *.m files... I have #import "MyConstants.h" Inside 1 of my viewDidLoad{} methods, I have: extern int abc[]; NSLog(@"abc = (%d) (%d)", abc[1], sizeof(abc)/sizeof(int)); Why does it display "abc = (0) (3)" instead of "abc = (22) (3)"? How do I make this work as expected?

    Read the article

  • Fire just once a Thread in Asp.net WebSite Global.asax

    - by Luís Custódio
    I've a legacy application using Asp.Net WebSite (winforms...) and I need run a background thread that collect periodically some files. But this thread must run just one time! My problem start when I put a method in Application_Start: void Application_Start(object sender, EventArgs e) { SetConnection(); SetNHibernate(); SetNinject(); SetExportThread(); } So I start my application on Visual Studio and three threads start to run. I need some singleton? or something?

    Read the article

  • R data frame select by global variable

    - by Matt
    I'm not sure how to do this without getting an error. Here is a simplified example of my problem. Say I have this data frame DF a b c d 1 2 3 4 2 3 4 5 3 4 5 6 Then I have a variable x <- min(c(1,2,3)) Now I want do do the following y <- DF[a == x] But when I try to refer to some variable like "x" I get an error because R is looking for a column "x" in my data frame. I get the "undefined columns selected" error How can I do what I am trying to do in R?

    Read the article

  • Modifying a global variable from <a href>

    - by a_m0d
    I have created some code to popup a confirm dialog if a user tries to leave a page without saving their changes. However, I don't want the confirmation dialog to popup if the user has clicked the "Save" button. I have some code at the top of my file which looks like this: var confirmClose = false; window.onbeforeunload = function(evt) { if (confirmClose == true) { message = "There are unsaved changes on this page. Are you sure you wish to leave?"; if (typeof evt == 'undefined') { evt = window.event; } if (evt) { evt.returnValue = message; } return message; } } Further down on the page I have a link which looks like this: <a href="javascript:confirmClose=false;$('#stockForm').submit()" title="Save" class="button positive" id="stockFormSubmit">Save</a> However, this doesn't seem to work - it doesn't seem to change the value of confirmClose, and changing it to window.confirmClose didn't help either. What am I doing wrong here?

    Read the article

  • Inline function and global variable issue in Javascript

    - by Natim
    I have some code here : http://bitbucket.org/natim/lo53_tp1/src/tip/part3/camions/medias/js/tracking.js That I use to draw some information about trucks direction. The problem come from a function defined in a for loop like this one : ... for(i = 0; i < nb_trucks; i++) { ... contentString = '<div id="content">'+ trucks[i]['name'] + '</div>'; current_window = new google.maps.InfoWindow({ content: contentString }); infosWindow.push(current_window); current_marker = new google.maps.Marker({ map: map, position: new google.maps.LatLng(trucks[i]['end']['lat'], trucks[i]['end']['lon']), draggable: false, title: trucks[i]['name'] }); markers.push(current_marker); google.maps.event.addListener(current_marker, 'click', function() { current_window.open(map, current_marker); }); } In this code, you can see the last block google.maps.event.addListener(current_marker, 'click', function() { current_window.open(map, current_marker); }); And my problem is that current_marker in the addListener parameters is different from the one inside the function. The current_window and the current_marker inside the function is overide at each loop turn. How can I get it right ? Thanks

    Read the article

  • Global javascript variable not accessible in jquery change event

    - by Dan
    I have to be missing something simple, but I'm really not sure what. I'm not a JS veteran, so this may be an easy answer - sure hope so :). I have a button that, when clicked, gets JSON data. When a drop-down is changed, I check to see if there is data, if there is, I want to clear it out as the drop-down indicates what data to retrieve when the button is clicked The Code: var selected, $locDialog; var locations = []; $(function() { // Save the selected Name selected = $("#selected option:selected").val(); // Setup Dialog for Locations $locDialog = $('#location-dialog').dialog({ autoOpen: false }); // If user changes the selected // 1. Prompt for confirmation // 2. If users confirms, clear data $('#selected').change(function() { if (locations) { var confirmed = confirm("Oh Rly?"); if (confirmed) { // Clear data var locations; } } }); // When user clicks "Location" Button.. $('.loc-select button').click(function() { if (!locations) { $.getJSON("/Controller/JSONAction", { selectedId: selected, pageNum: 1, pageSize: 100 }, function(data) { locations = data; $.each(locations, function(index, loc) { var $tr = $('<tr/>') .append($('<td/>') .append('<input type="checkbox" name="TEST-'+index+'" value="'+loc.Id+'"/>')) .append('<td>' + loc.Name + '</td>'); $("#location-dialog table tbody").append($tr); }); }); } $locDialog.dialog('open'); return false; }); }); Here's the thing, Inside the .click(...) callback, I can see locations is []. Now, when I am in the .change(...) callback, I see locations is undefined. Any help/insight, as always, is appreciated!

    Read the article

  • Global variables in java

    - by zachary
    I want to make a class in java that is assessable to all other classes in my project. I created this in the default package and now it cannot be seen. What is the best way to do this in java?

    Read the article

  • dirname(__FILE__) VS setting global variable to directories

    - by SAFAD
    what are the pros and cons of using this : $globals['server_url'] = dirname(__FILE__); $globals['mainfiles'] = dirname(__FILE__).'/main'; and the pros and cons of using this : $globals['server_url'] = '/srv/www/htdocs/somwhere/'; $globals['mainfiles'] = '/srv/www/htdocs/somwhere/main'; And what do you suggest. by the way: these are set in config.php file which is called by other files as well, to stop directory conflicts when including files we use it like this : require_once($globals['server_url'].'/test.php');

    Read the article

  • Problem with Global Array in PHP

    - by Suezy
    Hi guys,, need some help pls.. i have a PHP code here that lets a user send a message to multiple recipients using the "phonebook" (from database) as the main list. I used an array to temporarily hold all the desired recipients for the current user. So I have a two box, with each for displaying. The user will clicks the name from the phonebook lisy and clicks "Add" button to add on the temporary list on the other select box. The problem is, whenever I use the "onChange" function in javascript; the array accepts only one recipients, and when I try to add, it replaces the first one. :( Here is my code: $recipients = array(); // How do I place the array here? function reload_page(){ i=document.maillinglist.firstletter.selectedIndex; this.location='./group_msg.php?firstletter='+document.maillinglist.firstletter.options[i].value; } function add(){ } $conn = pg_connect("host=localhost user=sa dbname=messaging"); if(isset($_GET['firstletter'])){ $letter=$_GET['firstletter']; } else { $letter='a';} print ""; print "GROUP MESSAGE"; print ""; print ""; print ""; print ""; for($chr_loop=97;$chr_loop<=122;$chr_loop++){ $alphabet = chr($chr_loop); # Displays list of users arranged by letters - this works fine if($alphabet==$letter){ print "\t\t<option value='$alphabet' selected>-------------------- $alphabet --------------------</option>\n"; } else { print "\t\t<option value='$alphabet'>-------------------- $alphabet --------------------</option>\n";} } print ""; print "<td><select style='width:210px' name=\"non_members[]\" size=10 width=200>"; $sql = "select name from test_phonebook where name like '$letter%';"; $result = pg_query($conn, $sql); # Display users from phonebook using the letter chosen while($row = pg_fetch_assoc($result)){ $my_name = $row['name']; print "<option width=200 value=\"$my_name\">$my_name</option>"; } print "</td>"; print "</select>"; print "<td><input type=submit name=add value=\"->>\" onClick=\"add()\"><br><input type=submit name=del value=\"<<-\"></td>"; print "<td><select name=\"members[]\" style='width:210px' size=10>"; # Display temporary recipients - problem: ONLY DISPLAYS ONE VALUE while (list ($key, $val) = each ($recipients)) { echo "$key -> $val <br>"; print "<option width=200 value=\"$val\">$val</option>"; } print "</select></table></form>"; My aim here, is to place all recipients that the user desires to an array, without losing the previous value added.

    Read the article

< Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >