Search Results

Search found 6488 results on 260 pages for 'global thermonuclear war'.

Page 99/260 | < Previous Page | 95 96 97 98 99 100 101 102 103 104 105 106  | Next Page >

  • DuplicateKeyException in LINQ, but I've set auto increment and auto sync

    - by Fritos
    I'm getting a DuplicateKeyException error in my C# code. I've set Auto Generated = true, and Auto-Sync = OnInsert in my dbml. I'm not even touching the PK field in any manually written code (as seen below [My primary key field is actually called PK]). using (DeviceExerciseDataDataContext context = new DeviceExerciseDataDataContext()) { foreach(Data tgudData in data.Data) { tgd = new tableData(); tgd.FK = key; tgd.Time = tgudData.TimeStamp; tgd.Calories = Convert.ToInt32(tgudData.Calories); tgd.HeartRate = tgudData.AvgHr; tgd.BenchAngle = tgudData.Angle; tgd.WorkoutTarget = 0; tgd.Reps = tgudData.Reps; context.tableDatas.InsertOnSubmit(tgd); } context.SubmitChanges(); } This is the code for the column in the designer (columns are named PK and FK) [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_PK", AutoSync=AutoSync.OnInsert, DbType="Int NOT NULL", IsPrimaryKey=true, IsDbGenerated=true)] public int PK { get { return this._PK; } set { if ((this._PK != value)) { this.OnPKChanging(value); this.SendPropertyChanging(); this._PK = value; this.SendPropertyChanged("PK"); this.OnPKChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_FK", DbType="Int")] public System.Nullable<int> FK { get { return this._FK; } set { if ((this._FK != value)) { this.OnFKChanging(value); this.SendPropertyChanging(); this._FK = value; this.SendPropertyChanged("FK"); this.OnFKChanged(); } } }

    Read the article

  • How do I export a package symbol to a namespace in Perl?

    - by Mike
    I'm having trouble understanding how to export a package symbol to a namespace. I've followed the documentation almost identically, but it seems to not know about any of the exporting symbols. mod.pm #!/usr/bin/perl package mod; use strict; use warnings; require Exporter; @ISA = qw(Exporter); @EXPORT=qw($a); our $a=(1); 1; test.pl $ cat test.pl #!/usr/bin/perl use mod; print($a); This is the result of running it $ ./test.pl Global symbol "@ISA" requires explicit package name at mod.pm line 10. Global symbol "@EXPORT" requires explicit package name at mod.pm line 11. Compilation failed in require at ./test.pl line 3. BEGIN failed--compilation aborted at ./test.pl line 3. $ perl -version This is perl, v5.8.4 built for sun4-solaris-64int

    Read the article

  • WP7 - correctly timeing out an observable?

    - by Gaz83
    WP7 APP Using an observable from event, I download the lateset weather from a web service. I tested this out on the phone and emulator at home and it works fine. I brought the project with me to work and ran it using the emulator there. Now i'm not sure it its a firewall or what but it doesn't seem to get the weather, it just sits there for ever trying. So it got me thinking that if there was ever to happen on a phone then I need some kind of timeout in that if it can't get the weather in say 10 - 15 seconds then just give up. Here is the example code so far IObservable<IEvent<MyWeather.GetWeatherCompletedEventArgs>> observable = Observable.FromEvent<MyWeather.GetWeatherCompletedEventArgs>(Global.WeatherService, "MyWeather.GetWeatherCompleted").Take(1); observable.Subscribe(w => { if (w.EventArgs.Error == null) { // Do something with the weather } }); Global.WeatherService.GetWeatherAsync(location); How can I get this to time out safely after a given time if nothing is happening?

    Read the article

  • How to get Tkinter to input text and submit with button

    - by Rob
    Hi I was wondering if anybody could help me submit code from the test fields to the login fields from Tkinter import * import tkMessageBox if ( __name__ == "__main__" ): import resources.lib.mechanize as mechanize mechanize # Start Browser br = mechanize.Browser(factory=mechanize.RobustFactory()) # User-Agent (Firefox) br.addheaders = [('User-agent', 'Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.6')] br.open('http://razetheworld.com/wp-login.php?redirect_to=http%3A%2F%2Frazetheworld.com') br.select_form(name="loginform") br['log'] = 'entryWidget_U must enter here' br['pwd'] = 'entryWidget_P must enter here' br.submit(name="wp-submit") print br.geturl() def displayText(): """ Display the Entry text value. """ global entryWidget_U global entryWidget_P if entryWidget_U.get().strip() == "": tkMessageBox.showerror("Tkinter Entry Widget", "Enter a Username") else: tkMessageBox.showinfo("Tkinter Entry Widget", "Text value =" + entryWidget_U.get().strip()) if entryWidget_P.get().strip() == "": tkMessageBox.showerror("Tkinter Entry Widget", "Enter a Password") else: tkMessageBox.showinfo("Tkinter Entry Widget", "Text value =" + entryWidget_P.get().strip()) if __name__ == "__main__": root = Tk() root.title("Tkinter Entry Widget") root["padx"] = 40 root["pady"] = 20 # Create a text frame to hold the text Label and the Entry widget textFrame_U = Frame(root) textFrame_P = Frame(root) #Create a Label in textFrame entryLabel = Label(textFrame_U) entryLabel["text"] = "Enter Username:" entryLabel.pack(side=LEFT) entryLabel = Label(textFrame_P) entryLabel["text"] = "Enter Password:" entryLabel.pack(side=LEFT) # Create an Entry Widget in textFrame entryWidget_U = Entry(textFrame_U) entryWidget_U["width"] = 50 entryWidget_U.pack(side=LEFT) entryWidget_P = Entry(textFrame_P) entryWidget_P["width"] = 50 entryWidget_P.pack(side=LEFT) textFrame_U.pack() textFrame_P.pack() button = Button(root, text="Login", command=#Run br.submit(name="wp-submit")) button.pack() root.mainloop()

    Read the article

  • XSLT - How to select top a to top b

    - by user812241
    how can I extract the first 2 C-Values ('Baby' and 'Cola') where B is 'RED'. Input instance is: <Root> <A> <B>BLACK</B> <C>Apple</C> </A> <A> <B>RED</B> <C>Baby</C> </A> <A> <B>GREEN</B> <C>Sun</C> </A> <A> <B>RED</B> <C>Cola</C> </A> <A> <B>RED</B> <C>Mobile</C> </A> </Root> Output instance must be: <Root> <D>Baby</D> <D>Cola</D> </Root> I thought about the combination of for-each and global variables. But in XSLT it is not possible to change the value for a global variable to break the for-each. I have no idea anymore.

    Read the article

  • How does scope in Javascript work?

    - by Jim
    I can not understand how scoping works in Javascript. E.g. <html> <head> <script>var userName = "George"; </script> </head> <body> ...... <script> document.write('Name = ' + userName); </script> </body> </html> The variable userName is declared in another "section" of a script. As I understand it the browser renders html and executes code in the order it finds it. So how does userName in the second script tag gets resolved? Does it go to a global setting? Anything I declare earlier is global? I noticed the same happens if I do something like: <html> <head> <script> do { var userName = "George"; //bla } while (someCondition); </script> </head> <body> ...... <script> document.write('Name = ' + userName); </script> </body> </html> Even when userName is declared inside {} it is still resolved in the second script. How is that possible?

    Read the article

  • Breaking dependencies when you can't make changes to other files?

    - by codemuncher
    I'm doing some stealth agile development on a project. The lead programmer sees unit testing, refactoring, etc as a waste of resources and there is no way to convince him otherwise. His philosophy is "If it ain't broke don't fix it" and I understand his point of view. He's been working on the project for over a decade and knows the code inside and out. I'm not looking to debate development practices. I'm new to the project and I've been tasked with adding a new feature. I've worked on legacy projects before and used agile development practices with good result but those teams were more receptive to the idea and weren't afraid of making changes to code. I've been told I can use whatever development methodology I want but I have to limit my changes to only those necessary to add the feature. I'm using tdd for the new classes I'm writing but I keep running into road blocks caused by the liberal use of global variables and the high coupling in the classes I need to interact with. Normally I'd start extracting interfaces for these classes and make their dependence on the global variables explicit by injecting them as constructor arguments or public properties. I could argue that the changes are necessary but considering the lead never had to make them I doubt he would see it my way. What techniques can I use to break these dependencies without ruffling the lead developer's feathers? I've made some headway using: Extract Interface (for the new classes I'm creating) Extend and override the wayward classes with test stubs. (luckily most methods are public virtual) But these two can only get me so far.

    Read the article

  • new Stateful session bean instance without calling lookup

    - by kislo_metal
    Scenario: I have @Singleton UserFactory (@Stateless could be) , its method createSession() generating @Stateful UserSession bean by manual lookup. If I am injecting by DI @EJB - i will get same instance during calling fromFactory() method(as it should be) What I want - is to get new instance of UserSession without preforming lookup. Q1: how could I call new instance of @Stateful session bean? Code: @Singleton @Startup @LocalBean public class UserFactory { @EJB private UserSession session; public UserFactory() { } @Schedule(second = "*/1", minute = "*", hour = "*") public void creatingInstances(){ try { InitialContext ctx = new InitialContext(); UserSession session2 = (UserSession) ctx.lookup("java:global/inferno/lic/UserSession"); System.out.println("in singleton UUID " +session2.getSessionUUID()); } catch (NamingException e) { e.printStackTrace(); } } @Schedule(second = "*/1", minute = "*", hour = "*") public void fromFactory(){ System.out.println("in singleton UUID " +session.getSessionUUID()); } public UserSession creatSession(){ UserSession session2 = null; try { InitialContext ctx = new InitialContext(); session2 = (UserSession) ctx.lookup("java:global/inferno/lic/UserSession"); System.out.println("in singleton UUID " +session2.getSessionUUID()); } catch (NamingException e) { e.printStackTrace(); } return session2; } } As I understand, calling of session.getClass().newInstance(); is not a best idea Q2 : is it true? I am using glassfish v3, ejb 3.1.

    Read the article

  • Best way to associate data files with particular tests in RSpec / Ruby

    - by Bill T
    For my RSpec tests I would to automatically associate data files with each test. To clarify, if my tests each require an xml file as input data and then some xpath statements to validate the responses they get back I would like to externalize the xml and xpath as files and have the testing framework easily associate them with the particular test being run by using the unique ID of the test as the file(s) name. I tried to get this behavior but the solution isn't very clean. I wrote a helper method that takes the value of "description" and combines it with FILE to create a unique identifier which is set into a global variable that other utilities can access. The unique identifier is used to associate the data files I need. I have to call this helper method as the first line of every test, which is ugly. If I have an RSpec example that looks like this: describe "Basic functions of this server I'm testing" do it "should give me back a response" do # Sets a global var to: "my_tests_spec.rb_should_give_me_back_a_response" TestHelper::who_am_i __FILE__, description ... end end Is there some better/cleaner/slicker way I can get an unique ID for each test that I could use to associate data files with? Perhaps something build into RSpec I'm unaware of? Thank you, -Bill

    Read the article

  • 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

< Previous Page | 95 96 97 98 99 100 101 102 103 104 105 106  | Next Page >