Search Results

Search found 401 results on 17 pages for 'captain phoenix'.

Page 4/17 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Linked list recursive reverse

    - by Phoenix
    I was looking at the code below from stanford library: void recursiveReverse(struct node** head_ref) { struct node* first; struct node* rest; /* empty list */ if (*head_ref == NULL) return; /* suppose first = {1, 2, 3}, rest = {2, 3} */ first = *head_ref; rest = first->next; /* List has only one node */ if (rest == NULL) return; /* put the first element on the end of the list */ recursiveReverse(&rest); first->next->next = first; /* tricky step -- see the diagram */ first->next = NULL; /* fix the head pointer */ *head_ref = rest; } What I don't understand is in the last recursive step for e.g if list is 1-2-3-4 Now for the last recursive step first will be 1 and rest will be 2. So if you set *head_ref = rest .. that makes the head of the list 2 ?? Can someone please explain how after reversing the head of the list becomes 4 ??

    Read the article

  • APACHE2.2/WIN2003(32-bit)/PHP: How do I configure Apache to Run Background PHP Processes on Win 2003

    - by Captain Obvious
    I have a script, testforeground.php, that kicks off a background script, testbackground.php, then returns while the background script continues to run until it's finished. Both the foreground and background scripts write to the output file correctly when I run the foreground script from the command line using php-cgi: C:\>php-cgi testforeground.php The above command starts a php-cgi.exe process, then a php-win.exe process, then closes the php-cgi.exe almost immediately, while the php-win.exe continues until it's finished. The same script runs correctly but does not have permission to write to the output file when I run it from the command line using plain php: C:\>php testforeground.php AND when I run the same script from the browser, instead of php-cgi.exe, a single cmd.exe process opens and closes almost instantly, only the foreground script writes to the output file, and it doesn't appear that the 2nd process starts: http://XXX/testforeground.php Here is the server info: OS: Win 2003 32-bit HTTP: Apache 2.2.11 PHP: 5.2.13 Loaded Modules: core mod_win32 mpm_winnt http_core mod_so mod_actions mod_alias mod_asis mod_auth_basic mod_authn_default mod_authn_file mod_authz_default mod_authz_groupfile mod_authz_host mod_authz_user mod_autoindex mod_cgi mod_dir mod_env mod_include mod_isapi mod_log_config mod_mime mod_negotiation mod_setenvif mod_userdir mod_php5 Here's the foreground script: <?php ini_set("display_errors",1); error_reporting(E_ALL); echo "<pre>loading page</pre>"; function run_background_process() { file_put_contents("0testprocesses.txt","foreground start time = " . time() . "\n"); echo "<pre> foreground start time = " . time() . "</pre>"; $command = "start /B \"{$_SERVER['CMS_PHP_HOMEPATH']}\php-cgi.exe\" {$_SERVER['CMS_HOMEPATH']}/testbackground.php"; $rp = popen($command, 'r'); if(isset($rp)) { pclose($rp); } echo "<pre> foreground end time = " . time() . "</pre>"; file_put_contents("0testprocesses.txt","foreground end time = " . time() . "\n", FILE_APPEND); return true; } echo "<pre>calling run_background_process</pre>"; $output = run_background_process(); echo "<pre>output = $output</pre>"; echo "<pre>end of page</pre>"; ?> And the background script: <?php $start = "background start time = " . time() . "\n"; file_put_contents("0testprocesses.txt",$start, FILE_APPEND); sleep(10); $end = "background end time = " . time() . "\n"; file_put_contents("0testprocesses.txt", $end, FILE_APPEND); ?> I've confirmed that the above scripts work correctly using Apache 2.2.3 on Linux. I'm sure I just need to change some Apache and/or PHP config settings, but I'm not sure which ones. I've been muddling over this for too long already, so any help would be appreciated.

    Read the article

  • Run length encoding

    - by Phoenix
    What is the best we can do with run length encoding. http://en.wikipedia.org/wiki/Run-length_encoding Page suggests the time complexity is O(m*n) where m is the number of time the number repeats .. Is the a more efficient algorithm to do RLE ??

    Read the article

  • A regular expression that will allow a string with only one Capital Letter

    - by Phoenix
    The string should be 6 - 20 characters in length. And it should contain 1 Capital letter. I can do this in code using C# string st = "SomeString" Regex rg = new Regex("[A-Z]"); MatchCollection mc = rg.Matches(st); Console.WriteLine("Total Capital Letters: " + mc.Count); if (mc.Count > 1) { return false; } But what i really want is a Regular expression that will match my string if it only contains one capital. The string can start with a common letter and should have only letters. Thanks In advance. (I did look at some of the other RegEx questions but they did not help).

    Read the article

  • Which Cortex-M3 interrupts can I use for general purpose work?

    - by Captain NedD
    I'd have some code that needs to be run as the result of a particular interrupt going off. I don't want to execute it in the context of the interrupt itself but I also don't want it to execute in thread mode. I would like to run it at a priority that's lower than the high level interrupt that precipitated its running but also a priority that higher than thread level (and some other interrupts as well). I think I need to use one of the other interrupt handlers. Which ones are the best to use and what the best way to invoke them? At the moment I'm planning on just using the interrupt handlers for some peripherals that I'm not using and invoking them by setting bits directly through the NVIC but I was hoping there's a better, more official way. Thanks,

    Read the article

  • Accessing the MSP and PSP registers of the Cortex-M3 in C/C++ code using Keil's µVision

    - by Captain NedD
    I need to access the MSP and PSP registers (the main and process stack registers) of the Cortex-M3 processor. I'm writing in C/C++. The µVision and associated compiler doesn't let you do inline assembly for this Thumb-2 only core (and I'm not sure that'd be such a good idea anyway). I need to do this so that I can extract the immediate value of an svc instruction regardless of whether it was executed while in thread or handler mode. Thanks,

    Read the article

  • StackOverflowError occured as using java.util.regex.Matcher

    - by Captain Kidd
    Hi guys I try to catch text by Regular Expression. I list codes as follows. Pattern p=Pattern.compile("<@a>(?:.|\\s)+?</@a>"); Matcher m = p.matcher(fileContents.toString()); while(m.find()) { //Error will be thrown at this point System.out.println(m.group()); } If the length of text I want to catch is too long, system will throw me a StackOverflowError. Otherwise, the codes work well. Please help me how to solve this problem.

    Read the article

  • Real-time Multiplayer Movement - Flash ActionScript 3 (AS3) - Flash Media Server

    - by Wild Phoenix
    Dear All, I am creating a simple game, where I would like more than one player to be able to connect and play. With regards to a single player game, I am more than comfortable with the coding. I cannot seem to figure out how to connect up more than one player and update their screens when the each player moves. So far I have the players connecting, but I still need to be able update the SharedObject when a player moves, then push it out to the other players. I have searched high and low for a good tutorial / source code to review. Code So Far A tutorial i found so far listened for a click as it was a mouse based movement, then this told the SHaredObject to tell the client (and the others) to update that clients movement. However all of my movement is listend and acted on in the playership class.

    Read the article

  • Writing String.trim() in C

    - by Phoenix
    Hi guys, I was writing the String trim method in c and this is the code I came up with. I think it does the job of eliminating leading and trailing whitespaces however, I wish the code could be cleaner. Can you suggest improvements. void trim(char *String) { int i=0;j=0; char c,lastc; while(String[i]) { c=String[i]; if(c!=' ') { String[j]=c; j++; } else if(lastc!= ' ') { String[j]=c; j++; } lastc = c; i++; } Does this code look clean ??

    Read the article

  • OutOfMemoryException, stack size is huge, large number of threads

    - by Captain Comic
    Hello, I was profiling my .net windows service. I was trying to discover OutOfMemoryException and discovered that my stack size is huge and is growing because the the number of threads keeps growing. Each thread gets 1024 KB on Windows x64 machine. Thus when my app has 754 threads the stack size would be 772 MB. The problem for me is that i don't know where these thread come from. Initially my app has a very limited number of threads and they keep growing with time. I have two suspicions - either these threads are created by WCF or by database connection. My application uses both WCF and datasets. Also I tried to profile my app in Ants do Trace i can see large number of System.ServiceModel.Channels.ClientReliableDuplexSessionChannel and this number is increasing with time. I can see thousands of these objects created. So what I want to know is who is creating threads (tools to discover, profilers) and if it is WCF who is creating these threads.

    Read the article

  • display records which exist in file2 but not in file1

    - by Phoenix
    log file1 contains records of customers(name,id,date) who visited yesterday log file2 contains records of customers(name,id,date) who visited today How would you display customers who visited yesterday but not today? Constraint is: Don't use auxiliary data structure because file contains millions of records. [So, no hashes] Is there a way to do this using Unix commands ??

    Read the article

  • Where to start learning open-gl es

    - by Captain Kidd
    Hi everybody, I decide to learn OPEN-GL ES for IPHONE development, but I know nothing about graphics programing. So I've some questions. 1 I know OPEN-GL ES is a series of open standard API. IPHONE still use these standard API or apple define it's own API for OPENGL ES? 2 Before I start to learn OPEN-GL ES, I think I should be familiar with OPEN-GL. Am I right?

    Read the article

  • Javascript Input type

    - by Phoenix
    Hi All, In javascript we use input type = file .. to open up a file browser pop-up .. is there a way to limit access to folders .. I want to select a folder then ftp all the files in the folder .. so i need access upto only the folder level and not file level .. i guess it would be tedious to go an manually select every file from the folder and then ftp .. is there a way to do that.. Also, how can i set the file-browser pop-up window path to a default one ?

    Read the article

  • How to do run length encoding?

    - by Phoenix
    I have a long string for example it could be "aaaaaabbccc". Need to represent it as "a6b2c3". What's the best way to do this ? I could do this in linear time by comparing characters and incrementing counts and then replacing the counts in the array, using two indexes in one pass. Can you guys think of a better way than this? Are any of the encoding techniques going to work here ?

    Read the article

  • How to validate a ComboBox programatically?

    - by PhOeNiX
    How can i validate a ComboBox for null entry? My combobox is in a model as i am generating it dynamically. Now what i want is that when the the columns are generated dynamically, the border of combobox should be red as no value is selected and once the value is selected the border shud become normal. The following is my combobox in model : DataGridTemplateColumn dataGridComboBoxTemplateColumnObj = new DataGridTemplateColumn(); dataGridComboBoxTemplateColumnObj.Header = column.Header; FrameworkElementFactory comboBoxFactory = new FrameworkElementFactory(typeof(ComboBox)); Binding bindingItemSourceObj = new Binding(column.ItemsSourcePropertyName); comboBoxFactory.SetValue(ComboBox.HorizontalAlignmentProperty, HorizontalAlignment.Stretch); comboBoxFactory.SetValue(ComboBox.ItemsSourceProperty, bindingItemSourceObj); comboBoxFactory.SetValue(ComboBox.SelectedValuePathProperty, column.ValuePropertyName); dataGridComboBoxTemplateColumnObj.CellTemplate = new DataTemplate(); dataGridComboBoxTemplateColumnObj.CellTemplate.VisualTree = comboBoxFactory;

    Read the article

  • Graceful DOS Command Error-Handling w/PHP popen()

    - by Captain Obvious
    PHP 5.2.13 on Windows 2003 I am using the DOS Start /B command to launch a background application using the PHP popen() function: popen("start /B {$_SERVER['HOMEPATH']}/{$app}.exe > {$_SERVER['HOMEPATH']}/bg_output.log 2>&1 & echo $!", 'r'); The popen() function launches a cmd.exe process that runs the specified command; however, if the command fails (e.g. the {$app}.exe doesn't exist or is locked in the above example), the cmd.exe process never returns, and PHP hangs indefinitely as a result. Calling the failing DOS command directly using the Command Prompt results in an Error prompt that requires clicking the OK button. I assume this error confirmation requirement is what's preventing the cmd.exe process from returning to PHP both from the Command Prompt (using both CGI and CLI) and the web (using Apache 2.0 handler w/Apache 2.2). Is there a way to configure PHP, Apache, and/or Win 2003 to return the DOS error to the originating call rather than waiting for confirmation?

    Read the article

  • Graceful DOS Command Error-Handling

    - by Captain Obvious
    PHP 5.2.13 on Windows 2003 I am using the DOS Start /B command to launch a background application using the PHP popen() function: popen("start /B {$_SERVER['HOMEPATH']}/{$app}.exe > {$_SERVER['HOMEPATH']}/bg_output.log 2>&1 & echo $!", 'r'); The popen() function launches a cmd.exe process that runs the specified command; however, if the command fails (e.g. the {$app}.exe doesn't exist or is locked in the above example), the cmd.exe process never returns, and PHP hangs indefinitely as a result. Calling the failing DOS command directly using the Command Prompt results in an Error prompt that requires clicking the OK button. I assume this error confirmation requirement is what's preventing the cmd.exe process from returning to PHP both from the Command Prompt (using both CGI and CLI) and the web (using Apache 2.0 handler w/Apache 2.2). Is there a way to write the DOS command or configure the server or cmd.exe app itself to return the DOS error to the originating call rather than waiting for confirmation?

    Read the article

  • Need sorted dictionary designed to find values with keys less or greater than search value

    - by Captain Comic
    Hi I need to have objects sorted by price (decimal) value for fast access. I need to be able to find all objects with price more then A or less than B. I was thinkg about SortedList, but it does not provide a way to find ascending or descending enumerator starting from given key value (say give me all objects with price less than $120). Think of a system that accepts items for sell from users and stores them into that collection. Another users want to find items cheaper than $120. Basically what i need is tree-based collection and functionality to find node that is smaller\greater\equal to provided key. Please advice.

    Read the article

  • Exception of Binding form data to object

    - by Captain Kidd
    I'm practising Spring MVC.But fail to populate command object in Controller when I use spring standard tag. For example: "form:input path="password"" But I perfectly do this with HTML standard tag. Like: "input type="text" name="password"" I wonder the way how to use Spring tag binding data. In addition, I think configuration and coding is right in my sample. protected ModelAndView onSubmit(HttpServletRequest request, HttpServletResponse response, Object command, BindException errors) throws Exception { UserFormBean b = (UserFormBean)command; System.out.println("s"); return super.onSubmit(request, response, command, errors); } <form:form commandName="command" action="/SpringFrame/register.html"> <form:input path="password"/> <!-- <input type="text" name="password"/> --> <input type="submit"/> </form:form>

    Read the article

  • Issue about Tomcat 5.5 "ROOT" directory.

    - by Captain Kidd
    Now I specify a directory name for "appBase" attribute on "{TomcatHome}/config/server.xml". <host appBase="d:/aaa"> <Context docBase="d:/aaa/bbb"> </Context> </host> When I navigate URL to "http://localhost:8080", TOMCAT think "d:/aaa/ROOT" as application directory. I want to know how can I modify this mechanism to make TOMCAT auto search my specified directory. For example: When I input "http://localhost:8080", TOMCAT would search "d:/aaa/{SpecifiedDirectoryName}/"

    Read the article

  • Trying to output a list using class

    - by captain morgan
    Am trying to get the moving average of a price..but i keep getting an attribute error in my Moving_Average class. ('Moving_Average' object has no attribute 'days'). Here is what I have: class Moving_Average: def calculation(self, alist:list,days:int): m = self.days prices = alist[1::2] average = [0]* len(prices) signal = ['']* len(prices) for m in range(0,len(prices)-days+1): average[m+2] = sum(prices[m:m+days])/days if prices[m+2] < average[m+2]: signal[m+2]='SELL' elif prices[m+2] > average[m+2] and prices[m+1] < average[m+1]: signal[m+2]='BUY' else: signal[m+2] ='' return average,signal def print_report(symbol:str,strategy:str): print('SYMBOL: ', symbol) print('STRATEGY: ', strategy) print('Date Closing Strategy Signal') def user(): strategy = ''' Which of the following strategy would you like to use? * Simple Moving Average [S] * Directional Indicator[D] Please enter your choice: ''' if signal_strategy in 'Ss': days = input('Please enter the number of days for the average') days = int(days) strategy = 'Simple Moving Average {}-days'.format(str(days)) m = Moving_Average() ma = m.calculation(gg, days) print(ma) gg is an list that contains date and prices. [2013-10-01,60,2013-10-02,60] The output is supposed to look like: Date Price Average Signal 2013-10-01 60.0 2013-10-02 60.0 60.00 BUY

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >