Search Results

Search found 287 results on 12 pages for 'nano he'.

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

  • Generating Fibonacci Numbers Using variable-Length Arrays Code Compiler Error.

    - by Nano HE
    Compile error in vs2010(Win32 Console Application Template) for the code below. How can I fix it. unsigned long long int Fibonacci[numFibs]; // error occurred here error C2057: expected constant expression error C2466: cannot allocate an array of constant size 0 error C2133: 'Fibonacci' : unknown size Complete code attached(It's a sample code from programming In c -3E book. No any modify) int main() { int i, numFibs; printf("How may Fibonacci numbers do you want (between 1 to 75)? "); scanf("%i", &numFibs); if ( numFibs < 1 || numFibs > 75){ printf("Bad number, sorry!\n"); return 1; } unsigned long long int Fibonacci[numFibs]; Fibonacci[0] = 0; // by definition Fibonacci[1] = 1; // ditto for ( i = 2; i < numFibs; ++i) Fibonacci[i] = Fibonacci[i-2] + Fibonacci[i-1]; for ( i = 0; i < numFibs; ++i) printf("%11u",Fibonacci[i]); printf("\n"); return 0; }

    Read the article

  • What's the "Find Result" Control Visual Studio Integrated?

    - by Nano HE
    Hi, I am developing a simple Windows Application in C# and Visual Studio 2005. I need a search result control - just like visual studio integrated by itself. After I double click each line to trigger the individual event. I tried multi-line textBox Control, but whole the box can only support one click event. thank you.

    Read the article

  • Path String Concatenation Question.

    - by Nano HE
    Hi. Please see my code below. ifstream myLibFile ("libs//%s" , line); // Compile failed here ??? I want to combine the path string and open the related file again. #include <iostream> #include <fstream> #include <string> using namespace std; int main () { string line; ifstream myfile ("libs//Config.txt"); // There are several file names listed in the COnfig.txt file line by line. if (myfile.is_open()) { while (! myfile.eof() ) { getline (myfile,line); cout << line << endl; // Read details lib files based on the each line file name. string libFileLine; ifstream myLibFile ("libs//%s" , line); // Compile failed here ??? if (myLibFile.is_open()) { while (! myLibFile.eof() ) { cout<< "success\n"; } myLibFile.close(); } } myfile.close(); } else cout << "Unable to open file"; return 0; } Assume my [Config.txt] include the content below. And all the *.txt files located in libs folder. file1.txt file2.txt file3.txt

    Read the article

  • How can I assign pointer member with long string?

    - by Nano HE
    Hi, When I did the practice below to erase my pointer member and assign new value to it. (*pMyPointer).member.erase(); (*pMyPointer).member.assign("Hello"); // Successfully Than I tried more... (*pMyPointer).member.erase(); (*pMyPointer).member.assign("Long Multi Lines Format String"); // How to? If the long multi lines string can't quote by double quoter, how to handle it. Thank you.

    Read the article

  • Question on Split usage in Perl

    - by Nano HE
    Hello. I wrote an small script to use Split() as this, use strict; use warnings; use Data::Dumper; my $fh = \*DATA; while(my $line = <$fh>) { my @values = split(':', $line); foreach my $val (@values) { print "$val\n"; } } __DATA__ 1 : Hello World String10 : NO : A1B2,B3 11 : Hello World String11 : YES : A11B2,B3,B14,B25 A1B2,B3 and A11B2,B3 are characters form like Only One Letter A and One or Two Number 2, 3, 14,25 etc then concatenated with Only One Letter B and one or two Numbers like 2, 3, 14,25. etc Now out put as this 1 Hello World String10 NO A1B2,B3 11 Hello World String11 YES A11B2,B3,B14,B25 How can I hold the last array member from @values and made concatenation and out put as this. 1 Hello World String1 NO A1B2,A1B3 11 Hello World String11 YES A11B2,A11B3,A11B14,A11B25 Appreciated for your comments and replies. [update] My out put need the concatenation followed the rule. A and one or two numbers and joined by B and one or two numbers split by ,

    Read the article

  • How can I ignore the block content reading in Perl.

    - by Nano HE
    Hello. I plan to ignore the block content which include the start line of "MaterializeU4()" with the subroutin() read_block below. But failed. # Read a constant definition block from a file handle. # void return when there is no data left in the file. # Otherwise return an array ref containing lines to in the block. sub read_block { my $fh = shift; my @lines; my $block_started = 0; while( my $line = <$fh> ) { # how to correct my code below? I don't need the 2nd block content. $block_started++ if ( ($line =~ /^(status)/) && (index($line, "MaterializeU4") != 0) ) ; if( $block_started ) { last if $line =~ /^\s*$/; push @lines, $line; } } return \@lines if @lines; return; } Data as below: __DATA__ status DynTest = <dynamic 100> vid = 10002 name = "DynTest" units = "" status VIDNAME9000 = <U4 MaterializeU4()> vid = 9000 name = "VIDNAME9000" units = "degC" status DynTest = <U1 100> vid = 100 name = "Hello" units = "" Output: <StatusVariables> <SVID logicalName="DynTest" type="L" value="100" vid="10002" name="DynTest" units=""></SVID> <SVID logicalName="VIDNAME9000" type="L" value="MaterializeU4()" vid="9000" name="VIDNAME9000" units="degC"></SVID> <SVID logicalName="DynTest" type="L" value="100" vid="100" name="Hello" units=""></SVID> </StatusVariables> [Updated] I print the value of index($line, "MaterializeU4"), it output 25. Then I updated the code as below $block_started++ if ( ($line =~ /^(status)/) && (index($line, "MaterializeU4") != 25) Now it works. Any comments are welcome about my practice. Thank you.

    Read the article

  • How can I skip some block content while reading in Perl.

    - by Nano HE
    Hello. I plan to skip the block content which include the start line of "MaterializeU4()" with the subroutin() read_block below. But failed. # Read a constant definition block from a file handle. # void return when there is no data left in the file. # Otherwise return an array ref containing lines to in the block. sub read_block { my $fh = shift; my @lines; my $block_started = 0; while( my $line = <$fh> ) { # how to correct my code below? I don't need the 2nd block content. $block_started++ if ( ($line =~ /^(status)/) && (index($line, "MaterializeU4") != 0) ) ; if( $block_started ) { last if $line =~ /^\s*$/; push @lines, $line; } } return \@lines if @lines; return; } Data as below: __DATA__ status DynTest = <dynamic 100> vid = 10002 name = "DynTest" units = "" status VIDNAME9000 = <U4 MaterializeU4()> vid = 9000 name = "VIDNAME9000" units = "degC" status DynTest = <U1 100> vid = 100 name = "Hello" units = "" Output: <StatusVariables> <SVID logicalName="DynTest" type="L" value="100" vid="10002" name="DynTest" units=""></SVID> <SVID logicalName="VIDNAME9000" type="L" value="MaterializeU4()" vid="9000" name="VIDNAME9000" units="degC"></SVID> <SVID logicalName="DynTest" type="L" value="100" vid="100" name="Hello" units=""></SVID> </StatusVariables> [Updated] I print the value of index($line, "MaterializeU4"), it output 25. Then I updated the code as below $block_started++ if ( ($line =~ /^(status)/) && (index($line, "MaterializeU4") != 25) Now it works. Any comments are welcome about my practice. Thank you.

    Read the article

  • List<MyClass*> & array question

    - by Nano HE
    Hi, Assuming a definition like this, list<MyCommand*> subList ... MyCommand* pCmd = (MyCommand*)(m_treeSM.GetItemData(node)); I tried these statements below, but failed. pCmd->subList[2] (pCmd->subList)[2] How can I get the array member values(such as subList[2]). I want to replace the value of subList[2] with other same type value. Thank you.

    Read the article

  • What would be the simplest way to deal with a text file using JSP?

    - by Nano Taboada
    First and foremost I should acknowledge that I have no experience at all using Java ServerPages, but I'm positive about achieving this task if you guys help me out a bit since it doesn't seem like something difficult for a seasoned JSP programmer. Anyway the thing is, there's an actual running JSP application within a *NIX box which I somewhat administer with kind of good permissions. The idea is to create a new but dead simple JSP page to control some Korn Shell scripts I've got running there. So the goal is to make some sort of HTML form that will be writing some kind of scriptStatus.on / scriptStatus.off file: #!usr/bin/ksh # coolScript.sh # This is my cool script that is being launched by cron every 10 minutes. if [ -e scriptStatus.off ] then # monitor disabled else # monitor enabled fi which then can be checked for existence within the running script, therefore allowing to easily activate / deactivate it without actually have do deal with cron. Please let me know if all this does make any sense and don't hesitate to ask as much questions as needed. Thanks much in advance!

    Read the article

  • How to wrtie a XML License Line in C#?

    - by Nano HE
    My want to write a XML file as this: <?xml version="1.0" encoding="UTF-8"?> <Equipment xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <License licenseId="" licensePath="" /> Some piece of my code attached here // Create a new file in D:\\ and set the encoding to UTF-8 XmlTextWriter textWriter = new XmlTextWriter("D:\\books.xml", System.Text.Encoding.UTF8); // Format automatically textWriter.Formatting = Formatting.Indented; // Opens the document textWriter.WriteStartDocument(); // Write the namespace declaration. textWriter.WriteStartElement("books", null); // Write the genre attribute. textWriter.WriteAttributeString("xmlns", "xsd", null, "http://www.w3.org/2001/XMLSchema"); textWriter.WriteAttributeString("xmlns", "xsi", null, "http://www.w3.org/2001/XMLSchema-instance"); And now I need to write the License Line below in C# <License licenseId="" licensePath="" /> But I don't know how to move on for I found the Line ended with the special / .Thank you.

    Read the article

  • How to get attribute value using SelectSingleNode in C#?

    - by Nano HE
    Hello. I am parsing a xml document, I need find out the gid (an attribute) value (3810). Based on SelectSingleNode(). I found it is not easy to find the attribute name and it's value. Can I use this method or I must switch to other way. Attached my code. How can I use book obj to get the attribute value3810 for gid. Thank you. My test.xml file as below <?xml version="1.0"?> <root> <VersionInfo date="2007-11-28" version="1.0.0.2"/> <Attributes> <AttrDir name="EFEM" DirID="1"> <AttrDir name="Aligner" DirID="2"> <AttrDir name="SequenceID" DirID="3"> <AttrObj text="Slot01" gid="3810" unit="" scale="1"/> <AttrObjCount value="1"/> </AttrDir> </AttrDir> </AttrDir> </Attributes> </root> I wrote the test.cs as below public class Sample { public static void Main() { XmlDocument doc = new XmlDocument(); doc.Load("test.xml"); XmlNode book; XmlNode root = doc.DocumentElement; book = root.SelectSingleNode("Attributes[AttrDir[@name='EFEM']/AttrDir[@name='Aligner']/AttrDir[@name='SequenceID']/AttrObj[@text='Slot01']]"); Console.WriteLine("Display the modified XML document...."); doc.Save(Console.Out); } }

    Read the article

  • Any testing suggestions on replace a 3rd-party production?

    - by Nano HE
    It's a complex 3rd-party DLL. Phase 1 for My project already finished. I need find a good way to integrate testing with both my DLLs and 3rd-party DLL. Now I need to replace the 3rd-party DLL with some of my my small DLLs step by step. All the interface member are same names. How to disable some of the 3rd-party DLL reference and enable related my small DLL? Thank you.

    Read the article

  • How can I change the default startup directory for cmd.exe?

    - by Nano HE
    Hi. My Procedure last day as below Click Start, Run and type Regedit.exe Navigate to the following branch: HKEY_CURRENT_USER \ Software \ Microsoft \ Command Processor In the right-pane, double-click Autorun and set the startup folder path as its data, preceded by “CD /d “. If Autorun value is missing, you need to create one, of type REG_EXPAND_SZ or REG_SZ in the above location. Example: To set the startup directory to D:\learning\perl, set the Autorun value data to CD /d D:\learning\perl Then I clicked Start, run and type cmd. It successfully. I could do perl practice more conveniently now. But today, I find when I try to build my Visual Studio 2005 solution which included some Pre-build event Command like this: perl.exe MyAppVersion.pl perl.exe AttrScan.pl It doesn't work. Show error: can't find the path. I check the environment variable setting and find the variable-path and it's value-c:\perl\bin\; still exist. Finially, I try to removed the Regedit.exe configuration "Autorun" value and test again. The issue fixed. I only changed the default startup directory for cmd.exe command. Why the pre-build event perl command was impacted? (I am using winxp and activePerl 5.8)

    Read the article

  • Deploying locally compiled binaries on server

    - by nano
    Hi, I have a Zen based VPS server that runs on a dual-core AMD Opteron 64-bit machine. I have some locally developed C++ based daemons that I would want to deploy in that machine. My local machine is an Intel core 2 duo laptop. Can I execute binaries compiled from source code on my machine directly on the above mentioned server? I am a newbie in this area. Would be great if someone could throw light on the standard practices in this kind of situation. Thanks in advance

    Read the article

  • How to get the substring in C#?

    - by Nano HE
    Hi, I can get the first three characters with the function below. However, how can I get the output of the last five characters (Three) with Substring() function. Or other string function will be used? Thank you. static void Main() { string input = "OneTwoThree"; // Get first three characters string sub = input.Substring(0, 3); Console.WriteLine("Substring: {0}", sub); // Output One. }

    Read the article

  • How to read a XML format file to memory in C#?

    - by Nano HE
    // .net 2.0 and vs2005 used. I find some code below. I am not sure I can extended the sample code or not? thank you. if (radioButton.Checked) { MemoryStream ms=new MemoryStream(); byte[] data=ASCIIEncoding.ASCII.GetBytes(textBox1.Text); ms.Write(data,0,data.Length); reader = new XmlTextReader(ms); //some procesing code ms.Close(); reader.Close(); } BTW, Could you please help me to do some dissection about the line below. byte[] data=ASCIIEncoding.ASCII.GetBytes(textBox1.Text);

    Read the article

  • How do I split Chinese characters one by one?

    - by Nano HE
    If there is no special character(such as white space, : etc) between firstname and lastname. Then how to split the Chinese characters below. use strict; use warnings; use Data::Dumper; my $fh = \*DATA; my $fname; # ??; my $lname; # ? ; while(my $name = <$fh>) { $name =~ ??? ; print $fname"/n"; print $lname; } __DATA__ ??? Output ?? ?

    Read the article

  • Fatal error: Allowed memory size exhausted...

    - by Nano HE
    HI, I upload my php testing script to online vps server just now. The script used to parse a big size XML file(about 4M, 7000Lines). But my IE explorer show the online error message below. Fatal error: Allowed memory size of 16777216 bytes exhausted (tried to allocate 77 bytes) in /var/www/test/result/index.php on line 26 I am sure I already tested the php script on localhost successfully. Is there any configuration need be enable/modify on my VPS? Such as php.ini or some setting for apache server? I just verified there are about 200M memory usage are avaliable for my VPS. How can I fix this? ...... function startElementHandler ($parser,$name,$attrib){ global $usercount; global $userdata; global $state; // Line #26; //Debug //print "name is: ".$name."\n"; switch ($name) { case $name=="_ID" : { $userdata[$usercount]["first"] = $attrib["FIRST"]; $userdata[$usercount]["last"] = $attrib["LAST"]; $userdata[$usercount]["nick"] = $attrib["NICK"]; $userdata[$usercount]["title"] = $attrib["TITLE"]; break; } ...... default : {$state=$name;break;} } }

    Read the article

  • What's the best way to match a query to a set of keywords?

    - by Ryan Detzel
    Pretty much what you would assume Google does. Advertisers come in and big on keywords, lets say "ipod", "ipod nano", "ipod 60GB", "used ipod", etc. Then we have a query, "I want to buy an ipod nano" or "best place to buy used ipods" what kind of algorithms and systems are used to match those queries to the keyword set. I would imagine that some of those keyword sets are huge, 100k keywords made up of one or more actual words. on top of that queries can be 1-n words as well. Any thoughts, links to wikipedia I can start reading? From what I know already I would use some stemmed hash in disk(CDB?) and a bloom filter to check to see if I should even go to disk.

    Read the article

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