Search Results

Search found 9667 results on 387 pages for 'parallel loop'.

Page 17/387 | < Previous Page | 13 14 15 16 17 18 19 20 21 22 23 24  | Next Page >

  • collect string in loop and printout all the string outside loop

    - by user1508163
    I'm newbie here and there is some question that I want have some lesson from you guys. For example: #include <stdio.h> #include<stdlib.h> #include<ctype.h> void main() { char name[51],selection; do { printf("Enter name: "); fflush(stdin); gets(name); printf("Enter another name?(Y/N)"); scanf("%c",&selection); selection=toupper(selection); }while (selection=='Y'); //I want to printout the entered name here but dunno the coding printf("END\n"); system("pause"); } As I know when the loops perform will overwrite the variable then how I perform a coding that will printout all the name user entered? I have already ask my tutor and he is ask me to use pointer, can anyone guide me in this case?

    Read the article

  • How to "get" a reliable parallel port on a laptop without a PCMCIA slot?

    - by ldigas
    Usb-Parallel port (for an old, but reliable matrix printer that has its special use) connections (cables) are unreliable. They sometimes work, sometimes don't - and since I installed Windows 7 I can't get neither of my old ones to work properly. PCMCIA is usually considered (and it is) a much more reliable solution, but unfortunatelly, none of my new laptops has a PCMCIA slot. So, all ideas are welcomed. What should I do? I'm open to all suggestions as long as you have some experience that they work more reliably than USB-Parallel cables and their wicked drivers.

    Read the article

  • Can a shell loop do this?

    - by helpwithshell
    Ive seen loops to unzip all zip files in a directory, however, before I run this, I would rather make sure what Im about to run will work right: for i in dir; do cd $i; unzip '*.zip'; rm -rf *.zip; cd ..; done Basically I want it to look at the output of "dir" see all the folders, for each directory cd into it, unzip all the zip archives, then remove them, then cd back and do it again until theres no more. Is this something I should do in a single command or should I consider doing this in perl?

    Read the article

  • Python for loop question

    - by Joe Dunk
    I was wondering how to achieve the following in python: for( int i = 0; cond...; i++) if cond... i++; //to skip an run-through I tried this with no luck. for i in range(whatever): if cond... : i += 1

    Read the article

  • C++ - my loop keeps on adding up to 0

    - by user1756913
    so far here's my code #include <iostream> using namespace std; int main () { int num1 = 0; int num2 = 0; int sum = 0; for(num2 = num1; num1 <= num2; num1 +=2) sum += num1; num1 = num1 / 2 == 0? num1 : num1 + 1; num2 = num2 / 2 == 0? num2 : num2 - 1; cout << "Enter the First Number:" << endl; cin >> num1; cout << "Enter the Second Number:" << endl; cin >> num2; cout << "Total Sum: " << sum << endl; } //end for but the sum keeps on adding up to 0 :/ here's the problem. Create a program that displays the sum of the even numbers between and including two numbers entered by the user. In other words, if the user enters an even number, that number should be included in the sum. For example, if the user enters the integers 2 and 7, the sum is 12 (2 + 4 + 6). If the user enters the integers 2 and 8, the sum is 20 (2 + 4 + 6 + 8 ). Display an error message if the first integer entered by the user is greater than the second integer.

    Read the article

  • Nested for-loop, searching files

    - by user2961510
    I have two files: filetest.txt ============ SSISPACKAGE1.dtsx SSISPACKAGE2.dtsx SSISPACKAGE3.dtsx SSISPACKAGE4.dtsx SSISPACKAGE5.dtsx SSISPACKAGE6.dtsx SSISPACKAGE7.dtsx SSISPACKAGE8.dtsx filetest2.txt ============= \\central_test_server\SSIS_Packages\Daily.bat \\central_test_server\SSIS_Packages\Weekly.bat \\central_test_server\SSIS_Packages\Monthly.bat \\central_test_server\SSIS_Packages\Quarterly.bat \\central_test_server\SSIS_Packages\SemiAnnually.bat \\central_test_server\SSIS_Packages\Annually.bat What I need is to cycle through filetest.txt, then search the files identified in filetest2.txt for the filename and output to a file the results. I am trying to identify in well over 100 bat files where each of about 100 SSIS Packages are running. I'm doing this in Windows batch, have tried about 20 various approaches without success - any help would be greatly appreciated.

    Read the article

  • Java for-loop problem

    - by Dan
    OK so here's my code: http://so.pastebin.com/9swaiuRy The problem is that I am trying to make certain tiles blocked so the player cannot walk on them. However, it's only reading the FIRST tile which is board[0][0] and everything else is not checked.... What am I doing wrong? :( Thank you.

    Read the article

  • how to change a while sql query loop into an array loop

    - by Mac Taylor
    hey guys i record number of queries of my website and in page the below script runs , 40 extra queries added to page . how can I change this sql connection into a propper and light one function tree_set($index) { //global $menu; Remove this. $q=mysql_query("select id,name,parent from cats where parent='$index'"); if(mysql_num_rows($q) === 0) { return; } // User $tree instead of the $menu global as this way there shouldn't be any data duplication $tree = $index > 0 ? '<ul>' : ''; // If we are on index 0 then we don't need the enclosing ul while($arr=mysql_fetch_assoc($q)) { $subFileCount=mysql_query("select id,name,parent from cats where parent='{$arr['id']}'"); if(mysql_num_rows($subFileCount) > 0) { $class = 'folder'; } else { $class = 'file'; } $tree .= '<li>'; $tree .= '<span class="'.$class.'">'.$arr['name'].'</span>'; $tree .=tree_set("".$arr['id'].""); $tree .= '</li>'."\n"; } $tree .= $index > 0 ? '</ul>' : ''; // If we are on index 0 then we don't need the enclosing ul return $tree; } i heard , this can be done by changing it into an array , but i don't know how to do so thanks in advance

    Read the article

  • MySQL – How to Write Loop in MySQL

    - by Pinal Dave
    Since, I have written courses on MySQL, I quite often get emails about MySQL courses. Here is the question, which I have received quite often. “How do I loop queries in MySQL?” Well, currently MySQL does not allow to write loops with the help of ad-hoc SQL. You have to write stored procedure (routine) for the same. Here is the example, how we can create a procedure in MySQL which will look over the code. In this example I have used SELECT 1 statement and looped over it. In reality you can put there any code and loop over it. This procedure accepts one parameter which is the number of the count the loop will iterate itself. delimiter // CREATE PROCEDURE doiterate(p1 INT) BEGIN label1: LOOP SET p1 = p1 - 1; IF p1 > 0 THEN SELECT 1; ITERATE label1; END IF; LEAVE label1; END LOOP label1; END// delimiter ; CALL doiterate(100); You can also use WHILE to loop as well, we will see that in future blog posts. Reference: Pinal Dave (http://blog.sqlauthority.com)Filed under: MySQL, PostADay, SQL, SQL Authority, SQL Query, SQL Tips and Tricks, T SQL

    Read the article

  • Design help with parallel process

    - by brazc0re
    I am re-factoring some code and an having an issue with retrieving data from two parallel processes. I have an application that sends packets back and forth via different mediums (ex: RS232, TCP/IP, etc). The jist if of this question is that there are two parallel processes going on. I hope the picture below displays what is going on better than I can word it: SetupRS232() class creates a new instance of the SerialPort by: SerialPort serialPort = new SerialPort(); My question is, what is the best way that the Communicator() class, which sends out the packet via the respective medium, get access to the SerialPort object from the SetupRS232 class? I can do it with a Singleton but have heard that they are generally not the best design to go by. I am trying to follow SRP but I do feel like I am doing something wrong here. Communicator() will need to go out of it's way to get access to SetupRS232() to get access to the SerialPort class. I actually haven't found a way to even get access to it. Would designing each medium class, for example, SetupRS232(), SetupTCPIP, as a singleton be the best way to approach this problem?

    Read the article

  • Parallel.Foreach loop creating multiple db connections throws connection errors?

    - by shawn.mek
    Login failed. The login is from an untrusted domain and cannot be used with Windows authentication I wanted to get my code running in parallel, so I changed my foreach loop to a parallel foreach loop. It seemed simple enough. Each loop connects to the database, looks up some stuff, performs some logic, adds some stuff, closes the connection. But I get the above error? I'm using my local sql server and entity framework (each loop uses it's own context). Is there some problem with connecting multiple times using the same local login or something? How did I get around this? I have (before trying to covert to a parallel.foreach loop) split my list of objects that I am foreach looping through into four groups (separate csv files) and run four concurrent instances of my program (which ran faster overall than just one, thus the idea for parallel). So it seems connecting to the db shouldn't be a problem? Any ideas? EDIT: Here's before var gtgGenerator = new CustomGtgGenerator(); var connectionString = ConfigurationManager.ConnectionStrings["BioEntities"].ConnectionString; var allAccessionsFromObs = _GetAccessionListFromDataFiles(collectionId); ForEach(cloneIdAndAccessions in allAccessionsFromObs) DoWork(gtgGenerator, taxonId, organismId, cloneIdAndAccessions, connectionString)); after var gtgGenerator = new CustomGtgGenerator(); var connectionString = ConfigurationManager.ConnectionStrings["BioEntities"].ConnectionString; var allAccessionsFromObs = _GetAccessionListFromDataFiles(collectionId); Parallel.ForEach(allAccessionsFromObs, cloneIdAndAccessions => DoWork(gtgGenerator, taxonId, organismId, cloneIdAndAccessions, connectionString)); Inside the DoWork I use the BioEntities using (var bioEntities = new BioEntities(connectionString)) {...}

    Read the article

  • "Parallel Programming Talk" show

    Over at the Intel Software Network Aaron Tersteeg runs a "Parallel Programming Talk" audio show on which I was invited as a guest (for the 55th episode) to talk about Microsoft's parallelism offerings in Visual Studio 2010. The call started at 7:45AM, so if my voice sounds croaky to you, now you know why ;)Check out the 20-minute chat (and related hyperlinks) on Aaron's blog. Comments about this post welcome at the original blog.

    Read the article

  • ODI 12c - Parallel Table Load

    - by David Allan
    In this post we will look at the ODI 12c capability of parallel table load from the aspect of the mapping developer and the knowledge module developer - two quite different viewpoints. This is about parallel table loading which isn't to be confused with loading multiple targets per se. It supports the ability for ODI mappings to be executed concurrently especially if there is an overlap of the datastores that they access, so any temporary resources created may be uniquely constructed by ODI. Temporary objects can be anything basically - common examples are staging tables, indexes, views, directories - anything in the ETL to help the data integration flow do its job. In ODI 11g users found a few workarounds (such as changing the technology prefixes - see here) to build unique temporary names but it was more of a challenge in error cases. ODI 12c mappings by default operate exactly as they did in ODI 11g with respect to these temporary names (this is also true for upgraded interfaces and scenarios) but can be configured to support the uniqueness capabilities. We will look at this feature from two aspects; that of a mapping developer and that of a developer (of procedures or KMs). 1. Firstly as a Mapping Developer..... 1.1 Control when uniqueness is enabled A new property is available to set unique name generation on/off. When unique names have been enabled for a mapping, all temporary names used by the collection and integration objects will be generated using unique names. This property is presented as a check-box in the Property Inspector for a deployment specification. 1.2 Handle cleanup after successful execution Provided that all temporary objects that are created have a corresponding drop statement then all of the temporary objects should be removed during a successful execution. This should be the case with the KMs developed by Oracle. 1.3 Handle cleanup after unsuccessful execution If an execution failed in ODI 11g then temporary tables would have been left around and cleaned up in the subsequent run. In ODI 12c, KM tasks can now have a cleanup-type task which is executed even after a failure in the main tasks. These cleanup tasks will be executed even on failure if the property 'Remove Temporary Objects on Error' is set. If the agent was to crash and not be able to execute this task, then there is an ODI tool (OdiRemoveTemporaryObjects here) you can invoke to cleanup the tables - it supports date ranges and the like. That's all there is to it from the aspect of the mapping developer it's much, much simpler and straightforward. You can now execute the same mapping concurrently or execute many mappings using the same resource concurrently without worrying about conflict.  2. Secondly as a Procedure or KM Developer..... In the ODI Operator the executed code shows the actual name that is generated - you can also see the runtime code prior to execution (introduced in 11.1.1.7), for example below in the code type I selected 'Pre-executed Code' this lets you see the code about to be processed and you can also see the executed code (which is the default view). References to the collection (C$) and integration (I$) names will be automatically made unique by using the odiRef APIs - these objects will have unique names whenever concurrency has been enabled for a particular mapping deployment specification. It's also possible to use name uniqueness functions in procedures and your own KMs. 2.1 New uniqueness tags  You can also make your own temporary objects have unique names by explicitly including either %UNIQUE_STEP_TAG or %UNIQUE_SESSION_TAG in the name passed to calls to the odiRef APIs. Such names would always include the unique tag regardless of the concurrency setting. To illustrate, let's look at the getObjectName() method. At <% expansion time, this API will append %UNIQUE_STEP_TAG to the object name for collection and integration tables. The name parameter passed to this API may contain  %UNIQUE_STEP_TAG or %UNIQUE_SESSION_TAG. This API always generates to the <? version of getObjectName() At execution time this API will replace the unique tag macros with a string that is unique to the current execution scope. The returned name will conform to the name-length restriction for the target technology, and its pattern for the unique tag. Any necessary truncation will be performed against the initial name for the object and any other fixed text that may have been specified. Examples are:- <?=odiRef.getObjectName("L", "%COL_PRFEMP%UNIQUE_STEP_TAG", "D")?> SCOTT.C$_EABH7QI1BR1EQI3M76PG9SIMBQQ <?=odiRef.getObjectName("L", "EMP%UNIQUE_STEP_TAG_AE", "D")?> SCOTT.EMPAO96Q2JEKO0FTHQP77TMSAIOSR_ Methods which have this kind of support include getFrom, getTableName, getTable, getObjectShortName and getTemporaryIndex. There are APIs for retrieving this tag info also, the getInfo API has been extended with the following properties (the UNIQUE* properties can also be used in ODI procedures); UNIQUE_STEP_TAG - Returns the unique value for the current step scope, e.g. 5rvmd8hOIy7OU2o1FhsF61 Note that this will be a different value for each loop-iteration when the step is in a loop. UNIQUE_SESSION_TAG - Returns the unique value for the current session scope, e.g. 6N38vXLrgjwUwT5MseHHY9 IS_CONCURRENT - Returns info about the current mapping, will return 0 or 1 (only in % phase) GUID_SRC_SET - Returns the UUID for the current source set/execution unit (only in % phase) The getPop API has been extended with the IS_CONCURRENT property which returns info about an mapping, will return 0 or 1.  2.2 Additional APIs Some new APIs are provided including getFormattedName which will allow KM developers to construct a name from fixed-text or ODI symbols that can be optionally truncate to a max length and use a specific encoding for the unique tag. It has syntax getFormattedName(String pName[, String pTechnologyCode]) This API is available at both the % and the ? phase.  The format string can contain the ODI prefixes that are available for getObjectName(), e.g. %INT_PRF, %COL_PRF, %ERR_PRF, %IDX_PRF alongwith %UNIQUE_STEP_TAG or %UNIQUE_SESSION_TAG. The latter tags will be expanded into a unique string according to the specified technology. Calls to this API within the same execution context are guaranteed to return the same unique name provided that the same parameters are passed to the call. e.g. <%=odiRef.getFormattedName("%COL_PRFMY_TABLE%UNIQUE_STEP_TAG_AE", "ORACLE")%> <?=odiRef.getFormattedName("%COL_PRFMY_TABLE%UNIQUE_STEP_TAG_AE", "ORACLE")?> C$_MY_TAB7wDiBe80vBog1auacS1xB_AE <?=odiRef.getFormattedName("%COL_PRFMY_TABLE%UNIQUE_STEP_TAG.log", "FILE")?> C2_MY_TAB7wDiBe80vBog1auacS1xB.log 2.3 Name length generation  As part of name generation, the length of the generated name will be compared with the maximum length for the target technology and truncation may need to be applied. When a unique tag is included in the generated string it is important that uniqueness is not compromised by truncation of the unique tag. When a unique tag is NOT part of the generated name, the name will be truncated by removing characters from the end - this is the existing 11g algorithm. When a unique tag is included, the algorithm will first truncate the <postfix> and if necessary  the <prefix>. It is recommended that users will ensure there is sufficient uniqueness in the <prefix> section to ensure uniqueness of the final resultant name. SUMMARY To summarize, ODI 12c make it much simpler to utilize mappings in concurrent cases and provides APIs for helping developing any procedures or custom knowledge modules in such a way they can be used in highly concurrent, parallel scenarios. 

    Read the article

  • Using the Parallel class to make multithreading easy

    - by thycotic
    Kevin has posted about the Parallel class and how to use it to easily do multiple operations at once without radically changing the structure of your code.  Very neat stuff.   Jonathan Cogley is the CEO of Thycotic Software, an agile software services and product development company based in Washington DC.  Secret Server is our flagship enterprise password vault.

    Read the article

  • Parallel Data Warehouse

    - by jchang
    The Microsoft Parallel Data Warehouse diagram was somewhat difficult to understand in terms of the functionality of each subsystem in relation to the configuration of its components. So now that HP has provided a detailed list of the PDW components , the diagram below shows the PDW subsystems with component configuration (InfiniBand, FC, and network connections not shown). Observe that there are three different ProLiant server models, the DL360 G7, DL370 G6 and the DL380 G7, in five different configurations...(read more)

    Read the article

  • Parallel Tasks in .NET 3.0

    Provide a mechanism to execute a list of tasks in parallel on multiple threads and communicate back to the calling thread useful state such as exceptions, timeouts and successful task completion.

    Read the article

  • deciding between subprocess, multiprocesser and thread in Python?

    - by user248237
    I'd like to parallelize my Python program so that it can make use of multiple processors on the machine that it runs on. My parallelization is very simple, in that all the parallel "threads" of the program are independent and write their output to separate files. I don't need the threads to exchange information but it is imperative that I know when the threads finish since some steps of my pipeline depend on their output. Portability is important, in that I'd like this to run on any Python version on Mac, Linux and Windows. Given these constraints, which is the most appropriate Python module for implementing this? I am tryign to decide between thread, subprocess and multiprocessing, which all seem to provide related functionality. Any thoughts on this? I'd like the simplest solution that's portable. Thanks.

    Read the article

  • Parallelizing some LINQ to XML

    - by Lol coder
    How can I make this code run in parallel? List<Crop> crops = new List<Crop>(); //Get up to 10 pages of data. for (int i = 1; i < 10; i++) { //i is basically used for paging. XDocument document = XDocument.Load(string.Format(url, i)); crops.AddRange(from c in document.Descendants("CropType") select new Crop { //The data here. }); }

    Read the article

  • how to change the while loop condition depending on stuff?

    - by linkcool
    by this question what i mean is that if, by example, someone's username is "bob" then the while loop condition will be ($i < 10), and if the username is something else then the while loop condition will be ($i 10) if($username == "bob") { //make this while loop condition: ($i < 10) // it means: while($i <10){ so stuff} } else { //make the while loop condition: ($i >10) }

    Read the article

  • how ot change the while loop condition depending on stuff?

    - by linkcool
    by this question what i mean is that if, by example, someone's username is "bob" then the while loop condition will be ($i < 10), and if the username is something else then the while loop condition will be ($i 10) if($username == "bob") { //make this while loop condition: ($i < 10) // it means: while($i <10){ so stuff} } else { //make the while loop condition: ($i >10) }

    Read the article

  • In ParallelPython, a method of an object ( object.func() ) fails to manipulate a variable of an object ( object.value )

    - by mehmet.ali.anil
    With parallelpython, I am trying to convert my old serial code to parallel, which heavily relies on objects that have methods that change that object's variables. A stripped example in which I omit the syntax in favor of simplicity: class Network: self.adjacency_matrix = [ ... ] self.state = [ ... ] self.equilibria = [ ... ] ... def populate_equilibria(self): # this function takes every possible value that self.state can be in # runs the boolean dynamical system # and writes an integer within self.equilibria for each self.state # doesn't return anything I call this method as: Code: j1 = jobserver.submit(net2.populate_equilibria,(),(),("numpy as num")) The job is sumbitted, and I know that a long computation takes place, so I speculate that my code is ran. The problem is, i am new to parallelpython , I was expecting that, when the method is called, the variable net2.equilibria would be written accordingly, and I would get a revised object (net2) . That is how my code works, independent objects with methods that act upon the object's variables. Rather, though the computation is apparent, and reasonably timed, the variable net2.equilibria remains unchanged. As if PP only takes the function and the object, computes it elsewhere, but never returns the object, so I am left with the old one. What do I miss? Thanks in advance.

    Read the article

  • Would this method work to scale out SQL queries?

    - by David
    I have a database containing a single huge table. At the moment a query can take anything from 10 to 20 minutes and I need that to go down to 10 seconds. I have spent months trying different products like GridSQL. GridSQL works fine, but is using its own parser which does not have all the needed features. I have also optimized my database in various ways without getting the speedup I need. I have a theory on how one could scale out queries, meaning that I utilize several nodes to run a single query in parallel. The idea is to take an incoming SQL query and simply run it exactly like it is on all the nodes. When the results are returned to a coordinator node, the same query is run on the union of the resultsets. I realize that an aggregate function like average need to be rewritten into a count and sum to the nodes and that the coordinator divides the sum of the sums with the sum of the counts to get the average. What kinds of problems could not easily be solved using this model. I believe one issue would be the count distinct function. Edit: I am getting so many nice suggestions, but none have addressed the method.

    Read the article

< Previous Page | 13 14 15 16 17 18 19 20 21 22 23 24  | Next Page >