Search Results

Search found 235 results on 10 pages for 'rachel sparks'.

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

  • How to work with file and streams in php,case: if we open file in Class A and pass open stream to Cl

    - by Rachel
    I have two class, one is Business Logic Class{BLO} and the other one is Data Access Class{DAO} and I have dependency in my BLO class to my Dao class. Basically am opening a csv file to write into it in my BLO class using inside its constructor as I am creating an object of BLO and passing in file from command prompt: Code: $this->fin = fopen($file,'w+') or die('Cannot open file'); Now inside BLO I have one function notifiy, which call has dependency to DAO class and call getCurrentDBSnapshot function from the Dao and passes the open stream so that data gets populated into the stream. Code: Blo Class Constructor: public function __construct($file) { //Open Unica File for parsing. $this->fin = fopen($file,'w+') or die('Cannot open file'); // Initialize the Repository DAO. $this->dao = new Dao('REPO'); } Blo Class method that interacts with Dao Method and call getCurrentDBSnapshot. public function notifiy() { $data = $this->fin; var_dump($data); //resource(9) of type (stream) $outputFile=$this->dao->getCurrentDBSnapshot($data); // So basically am passing in $data which is resource((9) of type (stream) } Dao function: getCurrentDBSnapshot which get current state of Database table. public function getCurrentDBSnapshot($data) { $query = "SELECT * FROM myTable"; //Basically just preparing the query. $stmt = $this->connection->prepare($query); // Execute the statement $stmt->execute(); $header = array(); while ($row=$stmt->fetch(PDO::FETCH_ASSOC)) { if(empty($header)) { // Get the header values from table(columnnames) $header = array_keys($row); // Populate csv file with header information from the mytable fputcsv($data, $header); } // Export every row to a file fputcsv($data, $row); } var_dump($data);//resource(9) of type (stream) return $data; } So basically in am getting back resource(9) of type (stream) from getCurrentDBSnapshot and am storing that stream into $outputFile in Blo class method notify. Now I want to close the file which I opened for writing and so it should be fclose of $outputFile or $data, because in both the cases it gives me: var_dump(fclose($outputFile)) as bool(false) var_dump(fclose($data)) as bool(false) and var_dump($outputFile) as resource(9) of type (Unknown) var_dump($data) as resource(9) of type (Unknown) My question is that if I open file using fopen in class A and if I call class B method from Class A method and pass an open stream, in our case $data, than Class B would perform some work and return back and open stream and so How can I close that open stream in Class A's method or it is ok to keep that stream open and not use fclose ? Would appreciate inputs as am not very sure as how this can be implemented.

    Read the article

  • Adding <span> tags to all text nodes between custom self closing tags.

    - by Rachel
    I have a pair of custom self closing tags s1 and s2 defined in namespace x in my xhtml. For each tag pair s1, s2 having the same id, I want to add span tags to all the text nodes between them. Each s1, s2 tag pair have a unique id. The s1 tag has an attribute 'styleName' which needs to be copied as the class name for the span tags populated for the s1,s2 pair. Within a s1, s2 tag pair, other s1, s2 tags can occur. It is the id attribute of the tags s1 and s2 that help us to find the postion from where we need to start populating the span(for text nodes alone) and the end where we need to stop. In case of common text nodes that is part of the multiple s1, s2 pairs then the span tags needs to be opened and closed appropirately as shown in the sample below. I am not specific with the format of the id populated for the span tag. Along as it is unique it is fine. Can we achive this kind of a solution using XSL. I am using Saxon processor. Sample input: <html xmlns="http://www.w3.org/1999/xhtml" xmlns:x="http://sample.org"> <head> <title>This is my title</title> </head> <body> <h1 align="center">This <x:s1 id="1" styleName="name_1"/>is my <x:s2 id="1" />heading</h1> <p> Sample content <x:s1 id="2" styleName="name_2"/> Some text here. </p> <p> Here you <x:s2 id="2" />go. </p> <p> <x:s1 id="3" styleName="name_3"/>This <x:s1 id="4" styleName="name_4"/>is just a simple text <x:s2 id="4" />Some text here.<x:s2 id="3" /> Some content here. </p> <p> Use this <x:s1 id="5" styleName="name_5"/>space. </p> <p> Indroducing <x:s1 id="6" styleName="name_6"/> more information. </p> <p> Can add some <x:s2 id="6" />more content here. </p> <p> Sample content <x:s2 id="5" />Some text here. Some content here. </p> <p> <x:s1 id="7" styleName="name_7"/>This is a complex data. <x:s1 id="8" styleName="name_8"/>Framing a long sentence to <x:s2 id="7" />accomodate all possible <x:s2 id="8" />scenarios. </p> <p> <x:s1 id="9" styleName="name_9"/>More data can be <x:s1 id="10" styleName="name_10"/>added here. </p> <p> Trying to include here. </p> <p> Modifying <x:s2 id="9" />content <x:s2 id="10" />here. </p> </body> </html> Sample output: <html xmlns="http://www.w3.org/1999/xhtml" xmlns:x="http://sample.org"> <head> <title>This is my title</title> </head> <body> <h1 align="center">This <span id="1_1" class="name_1">is my </span>heading</h1> <p> Sample content <span id="2_1" class="name_2"> Some text here.</span> </p> <p> <span id="2_2" class="name_2">Here you </span>go. </p> <p> <span id="3_1" class="name_3">This <span id="4_1" class="name_4">is just a simple text </span>Some text here.</span> Some content here. </p> <p> Use this <span id="5_1" class="name_5">space.</span> </p> <p> <span id="5_2" class="name_5">Indroducing <span id="6_1" class="name_6"> more information.</span></span> </p> <p> <span id="5_3" class="name_5"><span id="6_2" class="name_6">Can add some </span>more content here.</span> </p> <p> <span id="5_4" class="name_5">Sample content </span>Some text here. Some content here. </p> <p> <span id="7_1" class="name_7">This is a complex data.</span> <span id="8_1" class="name_8"><span id="7_2" class="name_7">Framing a long sentence to </span></span><span id="8_2" class="name_8">accomodate all possible </span>scenarios. </p> <p> <span id="9_1" class="name_9">More data can be <span><span id="10_1" class="name_10"><span id="9_2" class="name_9">added here.</span></span> </p> <p> <span id=10_2 class="name_10"><span id="9_3" class="name_9">Trying to include here.</span></span> </p> <p> <span id=10_3 class="name_10"><span id="9_4" class="name_9">Modifying</span></span><span id="10_4" class="name_10">content </span>here. </p> </body> </html> Thanks.

    Read the article

  • Adding <span> tags to all text nodes between custom self closing tags.

    - by Rachel
    I have a pair of custom self closing tags s1 and s2 defined in namespace x in my xhtml. For each tag pair s1, s2 having the same id, I want to add span tags to all the text nodes between them. Each s1, s2 tag pair have a unique id. The s1 tag has an attribute 'styleName' which needs to be copied as the class name for the span tags populated for the s1,s2 pair. Within a s1, s2 tag pair, other s1, s2 tags can occur. It is the id attribute of the tags s1 and s2 that help us to find the postion from where we need to start populating the span(for text nodes alone) and the end where we need to stop. In case of common text nodes that is part of the multiple s1, s2 pairs then the span tags needs to be opened and closed appropirately as shown in the sample below. I am not specific with the format of the id populated for the span tag. As long as it is unique it is fine. Can we achieve this kind of a solution using XSL. I am looking for a XSL based solution for the same. I am using Saxon java processor for XSL. I am trying to achieve this using XSL 2.0. Please share your ideas on this. EDIT: I have edited my sample input and output to make my question more clear. Sample input: <html xmlns="http://www.w3.org/1999/xhtml" xmlns:x="http://sample.org"> <head> <title>This is my title</title> </head> <body> <h1 align="center">This <x:s1 id="1" styleName="name_1"/>is my <x:s2 id="1" />heading</h1> <p> Sample content <x:s1 id="2" styleName="name_2"/> Some text here. </p> <p> Here you <x:s2 id="2" />go. </p> <p> <x:s1 id="3" styleName="name_3"/>This <x:s1 id="4" styleName="name_4"/>is just a simple text <x:s2 id="4" />Some text here.<x:s2 id="3" /> Some content here. </p> <p> Use this <x:s1 id="5" styleName="name_5"/>space. </p> <p> Indroducing <x:s1 id="6" styleName="name_6"/> more information. </p> <p> Can add some <x:s2 id="6" />more content here. </p> <p> Sample content <x:s2 id="5" />Some text here. Some content here. </p> <p> <x:s1 id="7" styleName="name_7"/>This is a complex data. <x:s1 id="8" styleName="name_8"/>Framing a long sentence to <x:s2 id="7" />accomodate all possible <x:s2 id="8" />scenarios. </p> <p> <x:s1 id="9" styleName="name_9"/>More data can be <x:s1 id="10" styleName="name_10"/>added here. </p> <p> Trying to include here. </p> <p> Modifying <x:s2 id="9" />content <x:s2 id="10" />here. </p> </body> </html> Sample output: <html xmlns="http://www.w3.org/1999/xhtml" xmlns:x="http://sample.org"> <head> <title>This is my title</title> </head> <body> <h1 align="center">This <span id="1_1" class="name_1">is my </span>heading</h1> <p> Sample content <span id="2_1" class="name_2"> Some text here.</span> </p> <p> <span id="2_2" class="name_2">Here you </span>go. </p> <p> <span id="3_1" class="name_3">This <span id="4_1" class="name_4">is just a simple text </span>Some text here.</span> Some content here. </p> <p> Use this <span id="5_1" class="name_5">space.</span> </p> <p> <span id="5_2" class="name_5">Indroducing <span id="6_1" class="name_6"> more information.</span></span> </p> <p> <span id="5_3" class="name_5"><span id="6_2" class="name_6">Can add some </span>more content here.</span> </p> <p> <span id="5_4" class="name_5">Sample content </span>Some text here. Some content here. </p> <p> <span id="7_1" class="name_7">This is a complex data.</span> <span id="8_1" class="name_8"><span id="7_2" class="name_7">Framing a long sentence to </span></span><span id="8_2" class="name_8">accomodate all possible </span>scenarios. </p> <p> <span id="9_1" class="name_9">More data can be <span><span id="10_1" class="name_10"><span id="9_2" class="name_9">added here.</span></span> </p> <p> <span id=10_2 class="name_10"><span id="9_3" class="name_9">Trying to include here.</span></span> </p> <p> <span id=10_3 class="name_10"><span id="9_4" class="name_9">Modifying</span></span><span id="10_4" class="name_10">content </span>here. </p> </body> </html> Thanks.

    Read the article

  • Take Current Snapshot of DB and send it to FTP in same PHP Scripts: Advice Needed

    - by Rachel
    Not sure if I can do it this way. I want to get current snapshot of the database and send it via FTP Server, both of this functionality should be implemented in PHP scripts. Here are the steps I am thinking on right now. In my php scripts(basically am extending an PDO into my Dao class and then preparing the query), $qry = SELECT * FROM MyTablename; $stmt = $this->prepare($qry); $stmt = $this->execute(); Now I will store $stmt in csv file using fputcsv or I will execute the sql command from the script itself and than try to store the result in the $file(csv file) note here that I do not have any csv file with me at this point to basically I will have to create one and let's say its $file, so then $file = fputcsv($stmt); or $file = exec("Select * from MyTablename"); Will this put all records in the file ? If yes, then I will use FTP Functionality to transfer file to the FTP Folder. I am not sure if this approach would work and also have concerns regarding the need of preparing the $qry Any suggestions or different approach advised would be highly appreciated. Thanks !!!

    Read the article

  • Recursively MySQL Query

    - by Rachel
    How can I implement recursive MySQL Queries. I am trying to look for it but resources are not very helpful. Trying to implement similar logic. public function initiateInserts() { //Open Large CSV File(min 100K rows) for parsing. $this->fin = fopen($file,'r') or die('Cannot open file'); //Parsing Large CSV file to get data and initiate insertion into schema. $query = ""; while (($data=fgetcsv($this->fin,5000,";"))!==FALSE) { $query = $query + "INSERT INTO dt_table (id, code, connectid, connectcode) VALUES (" + $data[0] + ", " + $data[1] + ", " + $data[2] + ", " + $data[3] + ")"; } $stmt = $this->prepare($query); // Execute the statement $stmt->execute(); $this->checkForErrors($stmt); } @Author: Numenor Error Message: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '0' at line 1 This Approach inspired to look for an MySQL recursive query approach.

    Read the article

  • I like the way they Design/Architecture it but how do I implement this

    - by Rachel
    Summary: I have different components on homepage and each components shows some promotion to the user. I have Cart as one Component and depending upon content of the cart promotion are show. I have to track user online activities and send that information to Omniture for Report Generation. Now my components are loaded asynchronously basically are loaded when AjaxRequest is fired up and so there is not fix pattern or rather information on when components will appear on the webpages. Now in order to pass information to Omniture I need to call track function on $(document).(ready) and append information for each components(7 parameters are required by Omniture for each component). So in the init:config function of each component am calling Omniture and passing paramters but now no. of Omniture calls is directly proportional to no. of Components on the webpage but this is not acceptable as each call to Omniture is very expensive. Now I am looking for a way where in I can club the information about 7 parameters and than make one Call to Omniture wherein I pass those information. Points to note is that I do not know when the components are loaded and so there is no pre-defined time or no. of components that would be loaded. The thing is am calling track function when document is ready but components are loaded after call to Omniture has been made and so my question is Q: How can I collect the information for all the components and than just make one call to Omniture to send those information ? As mentioned, I do not know when the components are loaded as they are done on the Ajax Request. Hope I am able to explain my challenge and would appreciate if some one can provide from Design/Architect Solutions for the Challenge.

    Read the article

  • WPF - Pausing the UI Thread?

    - by Rachel
    I have a tab control with draggable tabs. When the mouse is released it removes the selected tab from the tabControl and adds it to its new location. My problem is that the TabControl draws itself after removing the tab, and then again when adding the tab so there is a very noticeable flicker that shows the tab behind the tab being moved. Is there a way I can pause the UI thread so the tab control does not redraw until both the Remove and the Insert operations finish? Or perhaps some other alternative way of rearranging the tab items? The Drag/Drop operation exists in a separate code file as an Attached Property

    Read the article

  • PHP getopt Operations

    - by Rachel
    This question is regarding getopt function in php. I need to pass two parameter to the php scripts like php script.php -f filename -t filetype Now depending upon the file type which can be u, c or s I need to do proper operation. I am using switch case for the same: Here is the Code I am using: // Get filename of input file when executing through command line. $file = getopt("f:t:"); Switch case should compare the type of the file which I am passing in from the command line (u, c or i) and accordingly match it and do the operation. switch("I am not sure what should go in there and this is wrong,Please advice") { case `Not sure`: $p->ini(); break; case `Not sure`: $p->iniCon(); break; case `Not sure`: $p->iniImp(); break; } Kindly advise on this !!!

    Read the article

  • Some questions regarding Flex

    - by Rachel
    For what real time scenarios/use cases one should go to Flex Technology ? What real time problems you have solved using Flex Technology ? What real time problems have you faced because of using Flex Technology and what was your work around for that use case ?

    Read the article

  • Unix Interview Question [closed]

    - by Rachel
    I am giving some interviews right now and recently I was asked this questions in Interview and I was not sure of the answer, in your opinion are this kind of questions worthwhile for Interview process and if yes than how would you go about approaching this kind of questions. How to get number of files in directory without using wc ? How to get all files in descending order on size ? What is the significance of ? in file searching ? Would appreciate if you can provide answers for this questions so that I could learn something about them as I am not sure for this questions.

    Read the article

  • How can I store an inventory-like list of numbers?

    - by Rachel
    I've got a list of number that I need to keep track of. The numbers are loosely related, but represent distinctly different items. I'd like to keep a list of the numbers but be able to refer to them by name so that I can call them and use them where needed easily. Kind of like an inventory listing, where the numbers all refer to a part ID and I'd like to call them idPart1, idPart2, idPart3 so their purpose is easily identifiable when they are used. What would be the best way to do this? 1)Define a structure. Say, PartIds. A number of int members will be included, part1, part2 etc. To use, an instance of the structure will be created, values assigned to the members, and the numbers will be used by saying struct.member as needed. 2)Define an enumeration. Use part1, part2 as the enum literals. Store the actual values in a vector or list, each one at the index corresponding to the value of the number's name within the enum. Use the enum literals to retrieve the values, list[enumLit]. 3)Something completely different There's nothing else I need to do with the numbers - just look them up every once in a while. Since there's no processing, I kind of think a new class for them is overkill, but I'm willing to be convinced otherwise. Any suggestions?

    Read the article

  • Unable to execute fetch(PDO::FETCH_ASSOC) and not updating csv file.

    - by Rachel
    // First, prepare the statement, using placeholders $query = "SELECT * FROM tableName"; $stmt = $this->connection->prepare($query); // Execute the statement $stmt->execute(); var_dump($stmt->fetch(PDO::FETCH_ASSOC)); while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) { echo "Hi"; // Export every row to a file fputcsv($data, $row); } Is this correct way to do and if yes than why do I get false value for var_dump and than it does not go into while loop and does not write into csv file. Any suggestions ?

    Read the article

  • How can I fix my program from crashing in C++?

    - by Rachel
    I'm very new to programming and I am trying to write a program that adds and subtracts polynomials. My program sometimes works, but most of the time, it randomly crashes and I have no idea why. It's very buggy and has other problems I'm trying to fix, but I am unable to really get any further coding done since it crashes. I'm completely new here but any help would be greatly appreciated. Here's the code: #include <iostream> #include <cstdlib> using namespace std; int getChoice(void); class Polynomial10 { private: double* coef; int degreePoly; public: Polynomial10(int max); //Constructor for a new Polynomial10 int getDegree(){return degreePoly;}; void print(); //Print the polynomial in standard form void read(); //Read a polynomial from the user void add(const Polynomial10& pol); //Add a polynomial void multc(double factor); //Multiply the poly by scalar void subtract(const Polynomial10& pol); //Subtract polynom }; void Polynomial10::read() { cout << "Enter degree of a polynom between 1 and 10 : "; cin >> degreePoly; cout << "Enter space separated coefficients starting from highest degree" << endl; for (int i = 0; i <= degreePoly; i++) { cin >> coef[i]; } } void Polynomial10::print() { for(int i=0;i<=degreePoly;i++) { if(coef[i] == 0) { cout << ""; } else if(i>=0) { if(coef[i] > 0 && i!=0) { cout<<"+"; } if((coef[i] != 1 && coef[i] != -1) || i == degreePoly) { cout << coef[i]; } if((coef[i] != 1 && coef[i] != -1) && i!=degreePoly ) { cout << "*"; } if (i != degreePoly && coef[i] == -1) { cout << "-"; } if(i != degreePoly) { cout << "x"; } if ((degreePoly - i) != 1 && i != degreePoly) { cout << "^"; cout << degreePoly-i; } } } } void Polynomial10::add(const Polynomial10& pol) { for(int i = 0; i<degreePoly; i++) { int degree = degreePoly; coef[degreePoly-i] += pol.coef[degreePoly-(i+1)]; } } void Polynomial10::subtract(const Polynomial10& pol) { for(int i = 0; i<degreePoly; i++) { coef[degreePoly-i] -= pol.coef[degreePoly-(i+1)]; } } void Polynomial10::multc(double factor) { //int degreePoly=0; //double coef[degreePoly]; cout << "Enter the scalar multiplier : "; cin >> factor; for(int i = 0; i<degreePoly; i++) { coef[i] *= factor; } }; Polynomial10::Polynomial10(int max) { degreePoly=max; coef = new double[degreePoly]; for(int i; i<degreePoly; i++) { coef[i] = 0; } } int main() { int choice; Polynomial10 p1(1),p2(1); cout << endl << "CGS 2421: The Polynomial10 Class" << endl << endl << endl; cout << "0. Quit\n" << "1. Enter polynomial\n" << "2. Print polynomial\n" << "3. Add another polynomial\n" << "4. Subtract another polynomial\n" << "5. Multiply by scalar\n\n"; int choiceFirst = getChoice(); if (choiceFirst != 1) { cout << "Enter a Polynomial first!"; } if (choiceFirst == 1) {choiceFirst = choice;} while(choice != 0) { switch(choice) { case 0: return 0; case 1: p1.read(); break; case 2: p1.print(); break; case 3: p2.read(); p1.add(p2); cout << "Updated Polynomial: "; p1.print(); break; case 4: p2.read(); p1.subtract(p2); cout << "Updated Polynomial: "; p1.print(); break; case 5: p1.multc(10); cout << "Updated Polynomial: "; p1.print(); break; } choice = getChoice(); } return 0; } int getChoice(void) { int c; cout << "\nEnter your choice : "; cin >> c; return c; }

    Read the article

  • Particular Project Types & Job Responsibility in Financial Industry

    - by Rachel
    I want to gain knowledge about types of projects in Financial Industry and how it is like working for Back Office, Middle Office and Front Office of an Financial Firm. I have gone through How do I start programming in Financial Industry and it is really good but am question is mainly aim at: What typical types of Projects we have in Back Office, Middle Office, Front Office or in any other Financial Firms. I have heard about terms like Derivates Trading, Equity Trading, Banking, Money Market and so what are the types of projects in this areas and what would be a good read or resources to learn about different Financial Sectors and its related projects in each of this sectors. I would really appreciate if people who have worked in Financial Industry to share this knowledge.

    Read the article

  • How has RIA technology evolved and what technology stack currently rules this domain?

    - by Rachel
    I am new to RIA and have not been actively involved with this technology in my projects as we using server-side Java, but I want to gain some experience with RIA. My questions are: How has RIA technology evolved and in your opinion? What technology stack currently rules this domain? What are the recommended resources for learning RIA? In general what is the suggested approach for getting started on the RIA journey?

    Read the article

  • How to populate the span tags for all text nodes between specific self closing tags.

    - by Rachel
    I want to populate span tags for all text nodes between the self closing tags s1 and s2 having the same id. Eg. For the input: <a> <b>Some <s1 id="1" />text here</b> <c>Some <s2 id="1"/>more text <s1 id="2"/> here<c/> <d>More data</d> <e>Some <s2 id="2" />more data</e> </a> In the above input i want to enclose every text node between <s1 id="1"/> and <s2 id="1" /> with span tags. Also all the text node between <s1 id="2" /> and <s2 id="2" /> Expected Output: <a> <b>Some <span class="spanClass" id="1a">text here</span></b> <c><span class="spanClass" id="1b">Some </span>more text <span class="spanClass" id="2a"> here</span></c> <d><span class="spanClass" id="2b">More data</span></d> <e><span class="spanClass" id="2c">Some </span>more data</e> </a> I am not concened about the pattern of the id tag populated for the span as along it is unique. If the transformation of the input to the output form requires the list of ids of the s1 , s2 tag pairs say 1, 2 etc i can assume that it in place in any form if required. Hope i am clear. How can this be achieved using XSL? EDIT: The input can have any structure and not exactly the same as seen in the sample input. It can have any number of s1, s2 tag pairs but each pair will have a unique id.Adding another sample input and output pattern for more information. Input: <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>This is my title</title> </head> <body> <h1 align="center">This <s1 id="1" />is my <s2 id="1" />heading</h1> <p> Sample content <s1 id="2" />Some text here. Some content here. </p> <p> Here you <s2 id="2" />go. </p> </body> </html> Desired output: <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>This is my title</title> </head> <body> <h1 align="center">This <span id="1">is my </span>heading</h1> <p> Sample content <span id="2">Some text here. Some content here.</span> </p> <p> <span id="2">Here you </span>go. </p> </body> </html>

    Read the article

  • Improving the performance of XSL

    - by Rachel
    I am using the below XSL 2.0 code to find the ids of the text nodes that contains the list of indices that i give as input. the code works perfectly but in terms for performance it is taking a long time for huge files. Even for huge files if the index values are small then the result is quick in few ms. I am using saxon9he Java processor to execute the XSL. <xsl:variable name="insert-data" as="element(data)*"> <xsl:for-each-group select="doc($insert-file)/insert-data/data" group-by="xsd:integer(@index)"> <xsl:sort select="current-grouping-key()"/> <data index="{current-grouping-key()}" text-id="{generate-id( $main-root/descendant::text()[ sum((preceding::text(), .)/string-length(.)) ge current-grouping-key() ][1] )}"> <xsl:copy-of select="current-group()/node()"/> </data> </xsl:for-each-group> </xsl:variable> In the above solution if the index value is too huge say 270962 then the time taken for the XSL to execute is 83427ms. In huge files if the index value is huge say 4605415, 4605431 it takes several minutes to execute. Seems the computation of the variable "insert-data" takes time though it is a global variable and computed only once. Should the XSL be addessed or the processor? How can i improve the performance of the XSL.

    Read the article

  • How do i select the preceding nodes of a text node starting from a specific node and not the root no

    - by Rachel
    How do i select the preceding nodes of a text node starting from a specific node whose id i know instead of getting the text nodes from the root node? When i invoke the below piece from a template match of text node, I get all the preceding text nodes from the root. I want to modify the above piece of code to select only the text nodes that appear after the node having a specific id say 123. i.e something like //*[@id='123'] <xsl:template match="text()[. is $text-to-split]"> <xsl:variable name="split-index" as="xsd:integer" select="$index - sum(preceding::text()/string-length(.))"/> <xsl:value-of select="substring(., 1, $split-index - 1)"/> <xsl:copy-of select="$new"/> <xsl:value-of select="substring(., $split-index)"/> </xsl:template> <xsl:variable name="text-to-split" as="text()?" select="descendant::text()[sum((preceding::text(), .)/string-length(.)) ge $index][1]"/> How do i include the condition in places where i use preceding::text inorder to select preceding text nodes relative to the specific node's id which i know?

    Read the article

  • How to get database table header information into an CSV File.

    - by Rachel
    I am trying to connect to the database and get current state of a table and update that information into csv file, with below mentioned piece of code, am able to get data information into csv file but am not able to get header information from database table into csv file. So my questions is How can I get Database Table Header information into an CSV File ? $config['database'] = 'sakila'; $config['host'] = 'localhost'; $config['username'] = 'root'; $config['password'] = ''; $d = new PDO('mysql:dbname='.$config['database'].';host='.$config['host'], $config['username'], $config['password']); $query = "SELECT * FROM actor"; $stmt = $d->prepare($query); // Execute the statement $stmt->execute(); var_dump($stmt->fetch(PDO::FETCH_ASSOC)); $data = fopen('file.csv', 'w'); while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) { echo "Hi"; // Export every row to a file fputcsv($data, $row); } Header information meaning: Vehicle Build Model car 2009 Toyota jeep 2007 Mahindra So header information for this would be Vehicle Build Model Any guidance would be highly appreciated.

    Read the article

  • NewBie Question, jQuery: How can we implement if...else logic and call function

    - by Rachel
    I am new to jQuery and so don't mind this question if it sounds stupid but here is something that I am trying to do : I have 3 functions like: AddToCart Function which adds item to the shopping cart: //offer_id is the offer which we are trying to add to cart. addToCart: function(offer_id) { this.submit({action: 'add', 'offer_id': offer_id}, {'app_server_url': this.app_server_url}); }, RemoveFromCart which removes data from the cart //target is link clicked and event is the click event. removeFromCart: function(target, event) { this.uniqueElmt('cart_table').find('.sb_item_remove').unbind('click'); var offer_id = $(target).parent().find('.offer_id').html(); this.submit({action: 'remove', 'offer_id': offer_id, 'next_action': this.config.current_action}, {'app_server_url': this.app_server_url}); }, Get the current state of the cart //return string which represents current state of cart. getCartItems: function() { return this.contents; } Now I am trying to do 3 things: if there is no content in cart and addToCart is called than some action, so basically here we need to check the current state of cart and that is obtained by calling getCartItems and if it is Null and than if addToCart is called than we perform some action if there is content in the cart and addToCart is called than some action,so basically here we need to check the current state of cart and that is obtained by calling getCartItems and check if it is Null or not and than if addToCart is called than we perform some action if we had some content in the cart. if there is content in the cart and removeFromCart is called some action, so basically here we need to check the current state of cart and that is obtained by calling getCartItems and if it is not Null and if removeFromCart is called than we perform some action Pseudocode of what I am trying to do: if there is no content in cart and addToCart is called than $(document).track( { 'module' : 'Omniture', 'event' : 'instant', 'args' : { 'linkTrackVars' : 'products,events', 'linkTrackEvents' : 'scAdd,scOpen', 'linkType' : 'o', 'linkName' : 'Cart : First Product Added' // could be blank, but can include event name as added feature 'svalues' : { 'products' : ';OFFERID1[,;OFFERID2]', 'events' : 'scAdd,scOpen', }, } 'defer' : '0' } ); if there is content in the cart and addToCart is called than $(document).track( { 'module' : 'Omniture', 'event' : 'instant', 'args' : { 'linkTrackVars' : 'products,events', 'linkTrackEvents' : 'scAdd', 'linkType' : 'o', 'linkName' : 'Cart : Product Added' // could be blank, but can include event name as added feature 'svalues' : { 'products' : ';OFFERID1[,;OFFERID2]', 'events' : 'scAdd', }, }, 'defer' : '0' } ); if there is content in the cart and removeFromCart is called $(document).track( { 'module' : 'Omniture', 'event' : 'instant', 'args' : { 'linkTrackVars' : 'products,events', 'linkTrackEvents' : 'scRemove', 'linkType' : 'o', 'linkName' : 'Cart : Product Removed' // could be blank, but can include event name as added feature 'svalues' : { 'products' : ';OFFERID1[,;OFFERID2]', 'events' : 'scRemove', }, } 'defer' : '0' } ); My basic concern is that am complete newbie to jQuery and JavaScript and so am not sure how can I implement if...else logic and how can I call a funtion using jQuery/JavaScript.

    Read the article

  • Trying to Understand PLSQL Function

    - by Rachel
    I am new to PLSQL and I have this huge plsql function which am trying to understand and am having hard time understanding the flow and so I would really appreciate if anyone can run me through the big pieces so that I can understand the flow. Guidance would be highly appreciated. FUNCTION monthly_analysis( REGION_ID_P VARCHAR2, COUNTRY_ID_P VARCHAR2 , SUB_REGION_ID_P VARCHAR2 , CUSTOMER_TYPE_ID_P VARCHAR2 , RECEIVED_FROM_DATE_P VARCHAR2 , RECEIVED_TO_DATE_P VARCHAR2, CUSTOMER_ID_P VARCHAR2 , PRIORITY_ID_P VARCHAR2, WORK_GROUP_ID_P VARCHAR2, CITY_ID_P VARCHAR2, USER_ID_P VARCHAR2 ) RETURN AP_ANALYSIS_REPORT_TAB_TYPE pipelined IS with_sql LONG; e_sql LONG; where_sql LONG; group_by_sql LONG; curent_date Date; v_row AP_ANALYSIS_REPORT_ROW_TYPE := AP_ANALYSIS_REPORT_ROW_TYPE( NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ); TYPE rectyp IS REF CURSOR; -- define weak REF CURSOR type rrc_rectyp rectyp; TYPE recordvar IS RECORD( MONTHS VARCHAR2(100), ORDERBY_MONTHS VARCHAR2(100), REQ_RECEIVED NUMBER(9,2), REQ_STILL_OPEN NUMBER(9,2), REQ_AWAIT_ACCEPTANCE NUMBER(9,2), REQ_WITH_ATT NUMBER(9,2), REQ_CLOSED NUMBER(9,2), REQ_CANCELLED NUMBER(9,2) ); res_rec recordvar; BEGIN select sysdate +substr(to_char(systimestamp, 'tzr'),3,1)/24 into curent_date from dual; where_sql := ' AND 1=1 '; IF COUNTRY_ID_P IS NOT NULL THEN where_sql := where_sql ||' AND x.country_id ='|| COUNTRY_ID_P; END IF; IF SUB_REGION_ID_P IS NOT NULL THEN where_sql := where_sql ||' AND x.SUB_REGION_ID ='|| SUB_REGION_ID_P; END IF; IF CUSTOMER_TYPE_ID_P IS NOT NULL THEN where_sql := where_sql ||' AND x.CUSTOMER_TYPE_ID ='|| CUSTOMER_TYPE_ID_P; END IF; IF RECEIVED_FROM_DATE_P IS NOT NULL THEN where_sql := where_sql||' AND convert_time(received_date, ''GMT'', ''GMT'') >= convert_time(trunc(to_date('''||RECEIVED_FROM_DATE_P||''',''dd/mm/yyyy HH24:MI:SS'')), ''Europe/Paris'', ''GMT'')'; END IF; IF RECEIVED_TO_DATE_P IS NOT NULL THEN where_sql := where_sql||' AND convert_time(received_date, ''GMT'', ''GMT'') <= convert_time(trunc(to_date('''||RECEIVED_TO_DATE_P||''',''dd/mm/yyyy HH24:MI:SS'')), ''Europe/Paris'', ''GMT'')'; END IF; IF CUSTOMER_ID_P IS NOT NULL THEN where_sql := where_sql||' AND x.CUSTOMER_ID in(select CUSTOMER_ID from lk_customer where upper(CUSTOMER_NAME) like upper('''||CUSTOMER_ID_P||'%''))'; END IF; IF PRIORITY_ID_P IS NOT NULL THEN where_sql := where_sql ||' AND x.PRIORITY_ID ='|| PRIORITY_ID_P; END IF; IF WORK_GROUP_ID_P IS NOT NULL THEN where_sql := where_sql ||' AND x.WORKGROUP_ID ='|| WORK_GROUP_ID_P; END IF; IF CITY_ID_P IS NOT NULL THEN where_sql := where_sql ||' AND x.CITY_ID = ' || CITY_ID_P; END IF; group_by_sql := ' group by to_char(convert_time(received_date, ''GMT'', ''Europe/Paris''),''mm/YYYY''),to_char(convert_time(received_date, ''GMT'', ''Europe/Paris''),''yyyy/mm'')'; with_sql := 'with b AS (select cep_work_item_no from ap_main where req_accept_date is null and ecep_ap_utils.f_business_days(received_date,'''||curent_date||''')>30), e AS (select cep_work_item_no from ap_main where status_id=1 and req_accept_date is not null and stage_ID != 10 and stage_Id !=4 and ecep_ap_utils.f_business_days(received_date,'''||curent_date||''')>30), --f AS (select cep_work_item_no from ap_main where received_date is not null), m AS (select cep_work_item_no from ap_main where received_date is not null and status_id=1), n AS (select cep_work_item_no from ap_main where status_id=2), o AS (select cep_work_item_no from ap_main where status_id=3)'; --e_sql := ' SELECT MONTHS, REQ_RECEIVED,REQ_STILL_OPEN, REQ_AWAIT_ACCEPTANCE, REQ_WITH_ATT from ('; --e_sql := with_sql; e_sql := with_sql||' select to_char(convert_time(received_date, ''GMT'', ''Europe/Paris''),''mm/YYYY'') MONTHS, to_char(convert_time(received_date, ''GMT'', ''Europe/Paris''),''yyyy/mm'') ORDERBY_MONTHS, count(x.cep_work_item_no) REQ_RECEIVED, count(m.cep_work_item_no) REQ_STILL_OPEN,count(b.cep_work_item_no) REQ_AWAIT_ACCEPTANCE,count(e.cep_work_item_no) REQ_WITH_ATT, count(n.cep_work_item_no) REQ_CLOSED, count(o.cep_work_item_no) REQ_CANCELLED from emea_main x,m,b,e,n,o where x.cep_work_item_no=m.cep_work_item_no(+) and x.cep_work_item_no = b.cep_work_item_no(+) and x.cep_work_item_no=e.cep_work_item_no(+) and x.cep_work_item_no=n.cep_work_item_no(+) and x.cep_work_item_no=o.cep_work_item_no(+) and x.received_date is not null'; e_sql := e_sql|| where_sql||group_by_sql; OPEN rrc_rectyp FOR e_sql; LOOP FETCH rrc_rectyp INTO res_rec; EXIT WHEN rrc_rectyp%NOTFOUND; v_row.MONTHS := res_rec.MONTHS ; v_row.ORDERBY_MONTHS := res_rec.ORDERBY_MONTHS ; v_row.REQ_RECEIVED := res_rec.REQ_RECEIVED; v_row.REQ_STILL_OPEN := res_rec.REQ_STILL_OPEN; v_row.REQ_AWAIT_ACCEPTANCE := res_rec.REQ_AWAIT_ACCEPTANCE; v_row.REQ_WITH_ATT := res_rec.REQ_WITH_ATT; v_row.REQ_CLOSED := res_rec.REQ_CLOSED; v_row.REQ_CANCELLED := res_rec.REQ_CANCELLED; pipe ROW(v_row); END LOOP; RETURN; END monthly_analysis; And would also appreciate if someone can let me know as to what are the important plsql concepts used here so that I can go ahead and understand them in a better way and some small explanation would go long way. As suggested by dcp, i am trying to use debugger, again I have not used it before and so pardon me, here is what am getting: DECLARE REGION_ID_P VARCHAR2(200); COUNTRY_ID_P VARCHAR2(200); SUB_REGION_ID_P VARCHAR2(200); CUSTOMER_TYPE_ID_P VARCHAR2(200); RECEIVED_FROM_DATE_P VARCHAR2(200); RECEIVED_TO_DATE_P VARCHAR2(200); CUSTOMER_ID_P VARCHAR2(200); PRIORITY_ID_P VARCHAR2(200); WORK_GROUP_ID_P VARCHAR2(200); CITY_ID_P VARCHAR2(200); USER_ID_P VARCHAR2(200); v_Return GECEPDEV.AP_ANALYSIS_REPORT_TAB_TYPE; BEGIN REGION_ID_P := NULL; COUNTRY_ID_P := NULL; SUB_REGION_ID_P := NULL; CUSTOMER_TYPE_ID_P := NULL; RECEIVED_FROM_DATE_P := NULL; RECEIVED_TO_DATE_P := NULL; CUSTOMER_ID_P := NULL; PRIORITY_ID_P := NULL; WORK_GROUP_ID_P := NULL; CITY_ID_P := NULL; USER_ID_P := NULL; v_Return := ECEP_AP_REPORTS.MONTHLY_ANALYSIS( REGION_ID_P => REGION_ID_P, COUNTRY_ID_P => COUNTRY_ID_P, SUB_REGION_ID_P => SUB_REGION_ID_P, CUSTOMER_TYPE_ID_P => CUSTOMER_TYPE_ID_P, RECEIVED_FROM_DATE_P => RECEIVED_FROM_DATE_P, RECEIVED_TO_DATE_P => RECEIVED_TO_DATE_P, CUSTOMER_ID_P => CUSTOMER_ID_P, PRIORITY_ID_P => PRIORITY_ID_P, WORK_GROUP_ID_P => WORK_GROUP_ID_P, CITY_ID_P => CITY_ID_P, USER_ID_P => USER_ID_P ); -- Modify the code to output the variable -- DBMS_OUTPUT.PUT_LINE('v_Return = ' || v_Return); END; Can anyone guide me through this query and its goal ?

    Read the article

  • DOCTYPE declaration getting lost when using XSL

    - by Rachel
    The input to my XSL is an XHTML. After applying the XSL the DOCTYPE declaration that was present in the input XHTML gets lost in the output. Do i have an option to copy/retain the DOCTYPE declaration in the output using XSL. The XSL processor that i am using is SAXON.

    Read the article

  • Git : How to revert bulk commits on multiple repos

    - by Rachel
    To update my multiple repos, I did: git bulk fetch origin git bulk pull origin master Now it appears that some of the functionality which was working initially is not working now and so I want to revert back to previous state of my repos. How can this be done ? I tried doing git reset --soft commit id & git reset --hard commit id for one repos but it is not working. Any suggestions.

    Read the article

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