Search Results

Search found 4451 results on 179 pages for 'split brain'.

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

  • Using the Script Component as a Conditional Split

    This is a quick walk through on how you can use the Script Component to perform Conditional Split like behaviour, splitting your data across multiple outputs. We will use C# code to decide what does flows to which output, rather than the expression syntax of the Conditional Split transformation. Start by setting up the source. For my example the source is a list of SQL objects from sys.objects, just a quick way to get some data: SELECT type, name FROM sys.objects type name S syssoftobjrefs F FK_Message_Page U Conference IT queue_messages_23007163 Shown above is a small sample of the data you could expect to see. Once you have setup your source, add the Script Component, selecting Transformation when prompted for the type, and connect it up to the source. Now open the component, but don’t dive into the script just yet. First we need to select some columns. Select the Input Columns page and then select the columns we want to uses as part of our filter logic. You don’t need to choose columns that you may want later, this is just the columns used in the script itself. Next we need to add our outputs. Select the Inputs and Outputs page.You get one by default, but we need to add some more, it wouldn’t be much of a split otherwise. For this example we’ll add just one more. Click the Add Output button, and you’ll see a new output is added. Now we need to set some properties, so make sure our new Output 1 is selected. In the properties grid change the SynchronousInputID property to be our input Input 0, and  change the ExclusionGroup property to 1. Now select Ouput 0 and change the ExclusionGroup property to 2. This value itself isn’t important, provided each output has a different value other than zero. By setting this property on both outputs it allows us to split the data down one or the other, making each exclusive. If we left it to 0, that output would get all the rows. It can be a useful feature allowing you to copy selected rows to one output whilst retraining the full set of data in the other. Now we can go back to the Script page and start writing some code. For the example we will do a very simple test, if the value of the type column is U, for user table, then it goes down the first output, otherwise it ends up in the other. This mimics the exclusive behaviour of the conditional split transformation. public override void Input0_ProcessInputRow(Input0Buffer Row) { // Filter all user tables to the first output, // the remaining objects down the other if (Row.type.Trim() == "U") { Row.DirectRowToOutput0(); } else { Row.DirectRowToOutput1(); } } The code itself is very simple, a basic if clause that determines which of the DirectRowToOutput methods we call, there is one for each output. Of course you could write a lot more code to implement some very complex logic, but the final direction is still just a method call. If we now close the script component, we can hook up the outputs and test the package. Your numbers will vary depending on the sample database but as you can see we have clearly split out input data into two outputs. As a final tip, when adding the outputs I would normally rename them, changing the Name in the Properties grid. This means the generated methods follow the pattern as do the path label shown on the design surface, making everything that much easier to recognise.

    Read the article

  • Split a text file by its entries

    - by Alexx Hardt
    Hi, I'm trying to analyze an enormous text file (1.6GB), whose data lines look like this: 20090118025859 -2.400000 78.100000 1023.200000 0.000000 20090118025900 -2.500000 78.100000 1023.200000 0.000000 20090118025901 -2.400000 78.100000 1023.200000 0.000000 I don't even know how many lines there are. But I'm trying to split the file by date. The left number is a time stamp (these lines are from 2009, January 18th). How can I split this file into pieces according to the date? Everything I know would be to grep file '20090118*' > data20090118.dat , but there sure is a way to do all the dates at once, right? The number of entries per date differ, so using split with a constant number won't work. Thanks in advance, Alex

    Read the article

  • Break a string into parts, returning all characters

    - by Benjamin
    I want to break a string according to the following rules: all consecutive alpha-numeric chars, plus the dot (.) must be treated as one part all other consecutive chars must be treated as one part consecutive combinations of 1 and 2 must be treated as different parts no whitespace must be returned For example this string: Method(hierarchy.of.properties) = ? Should return this array: Array ( [0] => Method [1] => ( [2] => hierarchy.of.properties [3] => ) [4] => = [5] => ? ) I was unsuccessful with preg_split(), as AFAIK it cannot treat the pattern as an element to be returned. Any idea for a simple way to do this?

    Read the article

  • Complex string split in Java

    - by c0mrade
    Consider the following String : 5|12345|value1|value2|value3|value4+5|777|value1|value2|value3|value4?5|777|value1|value2|value3|value4+ Here is how I want to split string, split it with + so I get this result : myArray[0] = "5|12345|value1|value2|value3|value4"; myArray[1] = "5|777|value1|value2|value3|value4?5|777|value1|value2|value3|value4"; if string has doesn't contain char "?" split it with "|" and continue to part II, if string does contain "?" split it and for each part split it with "|" and continue to part II. Here is part II : myObject.setAttribute1(newString[0]); ... myObject.setAttribute4(newString[3]); Here what I've got so far : private static String input = "5|12345|value1|value2|value3|value4+5|777|value1|value2|value3|value4?5|777|value1|value2|value3|value4+"; public void mapObject(String input){ String[] myArray = null; if (input.contains("+")) { myArray = input.split("+"); } else { myArray = new String[1]; myArray[0] = input; } for (int i = 0; i < myArray.length; i++) { String[] secondaryArray = null; String[] myObjectAttribute = null; if (myArray[i].contains("?")) { secondaryArray = temporaryString.myArray[i].split("?"); for (String string : secondaryArray) { myObjectAttribute = string.split("\\|"); } } else { myObjectAttribute = myArray[i].toString().split("\\|"); } myObject.setAttribute1(myObjectAttribute[0]); ... myObject.setAttribute4(myObjectAttribute[3]); System.out.println(myObject.toString()); } Problem : When I split myArray, going trough for with myArray[0], everything set up nice as it should. Then comes the myArray[1], its split into two parts then the second part overrides the value of the first(how do I know that?). I've overridden toString() method of myObject, when I finish I print the set values so I know that it overrides it, does anybody know how can I fix this?

    Read the article

  • Help with strange memory behavior. Looking for leaks both in my brain and in my code.

    - by BastiBechtold
    I spent the last few days trying to find memory leaks in a program we are developing. First of all, I tried using some leak detectors. After fixing a few issues, they do not find any leaks any more. However, I am also monitoring my application using perfmon.exe. Performance Monitor reports that 'Private Bytes' and 'Working Set - Private' are steadily rising when the app is used. To me, this suggests that the program is using more and more memory the longer it runs. Internal resources seem to be stable however, so this sounds like leaking to me. The program is loading a DLL at runtime. I suspect that these leaks or whatever they are occur in that library and get purged when the library is unloaded, hence they won't get picked up by the leak detectors. I used both DevPartner BoundsChecker and Virtual Leak Detector to look for memory leaks. Both supposedly catch leaks in DLLs. Also, the memory consumption is increasing in steps and those steps roughly, but not exactly, coincide with certain GUI actions I perform in the application. If these were errors in our code, they should get triggered every single time the actions are performed and not just most of the time. Whenever I am confronted with so much strangeness, I begin to question my basic assumptions. So I turn to you, who know everything, for suggestions. Is there a flaw in my assumptions? Do you have an idea of how to go about troubleshooting a problem like this? Edit: I am currently using Microsoft Visual C++ (x86) on Windows 7 64. Edit2: I just used IBM Purify to hunt for leaks. First of all, it lists a full 30% of the program as leaked memory. This can not be true. I guess it is identifying the whole DLL as leaked or something like that. However, if I search for new leaks every few actions, it reports leaks that correspond with the size increase reported by Performance Monitor. This could be a lead to a leak. Sadly, I am only using the trial version of Purify, so it won't show me the actual location of those leaks. (These leaks only show up at runtime. When the program exits, there are no leaks whatsoever reported by any tool.)

    Read the article

  • Split a big folder (and its contents) into several small new folders ?

    - by David
    Hello, By luck do you know a software on Windows (Vista) which can easily split a big folder (and its contents) into several small new folders ? notes: the new small folders should be independent the "file splitter" that I have already tested don't do alas the "folder splitter" job ! ;( Example : I have a main big folder C:\big\ (size: about 3Go) The result I need : C:\big01\ (size: about 200MB) C:\big02\ (size: about 200MB) etc... Thanks in advance ;)

    Read the article

  • Proxmox drbd configuration split brain [on hold]

    - by AudioDan
    I am planning a proxmox HA configuration with two Dell R710 machines (dual 6 core processors in each) with enterprise level drive raid arrays. I would be using DRBD with a quorum disk on a third machine. I would dedicate two 1GB nics on each server to the DRBD communications. We would have approximately 12 to 14 Virtual Machines running on this pair of servers. The proxmox manual recommends creating two DRBD resources - one for the Virtual Machines that normally run on ServerA and one for the Virtual Machines that normally run on ServerB. This is because of the Primary/Primary state in which this configuration runs. If both servers have VMs talking to the same DRBD resource and a split brain situation occurs, there is potential for data corruption that must be resolved. While I understand it would take more effort to create new virtual machines, can anybody foresee any potential problems with running a separate DRBD resource for each VM instead? Does anyone have experience running a setup that way and has it worked well? It seems to me that would allow more flexibility in moving machines back and forth.

    Read the article

  • How to split a string with negative numbers using ActionScript 3.0

    - by inzombiak
    I'm having trouble loading my level. I'm using Ogmo to create my level then I import it. I have no problem converting 0's and 1's into an Array, but I can't figure out how to do the same for -1's. It separates the "-" and the "1". Any help would be great. I've posted my code and the XML files below levelXML = new XML(e.target.data); playerX = int(levelXML.Entities.Player.@x); playerY = int(levelXML.Entities.Player.@y); levelGrid = levelXML.Grid; levelGrid = levelGrid.split("\n").join(""); levelTiles = levelXML.Tiles; levelTiles = levelTiles.split("\n").join(""); levelTiles = levelTiles.split(",").join(""); tileArray = levelTiles.split(""); gridArray = levelGrid.split(""); for(i = 0; i <= 34; i++) { levelArray[i] = new Array(); for(j = 0; j <= 34; j++) { if(tileArray[j*35 + i] == 0) { gridArray[j*35+i] = -1; } var currentSymbol = gridArray[j*35+i]; levelArray[i][j] = currentSymbol; if(gridArray[j*35 + i] == 1) { wall = new Wall; addChild(wall); wall.x = i*20 + 10; wall.y = j*20 + 10; } else if(gridArray[j*35 + i] == -1) { pellet = new Pellet; addChild(pellet); pellet.x = i*20 + 10; pellet.y = j*20 + 10; } } } I know the code is very dirty, but I needed a quick fix. Grid exportMode="Bitstring" 11111111111111111111111111111111111 10000000000000000011000000000000001 10000000000000000011000000000000001 10011111001111110011001111110011001 10011111001111110011001111110011001 10011111001111110011001111110011001 10000000000000000000000000000000001 10000000000000000000000000000000001 10011111001100111111100110011111001 10011111001100000100000110011111001 10000000001100000100000110000000001 10000000001111100100111110000000001 11111111001111100100111110011111111 00000001001111100100111110010000000 00000001001100000000000110010000000 11111111001100000000000110011111111 00000000000000111111100000000000000 00000000000000100000100000000000000 11111111001100100000100110011111111 00000001001100111111100110010000000 00000001001100000000000110010000000 11111111001100111111100110011111111 10000000000000000100000000000000001 10000000000000000100000000000000001 10011111001111100100111110011111001 10000011000000000000000000011000001 10000011000000000000000000011000001 11110011001100111111100110011001111 11110011001100111111100110011001111 10000000001100000100000110000000001 10000000001100000100000110000000001 10011111111111100100111111111111001 10000000000000000000000000000000001 10000000000000000000000000000000001 11111111111111111111111111111111111 Tiles tileset="Tiles" exportMode="CSV"-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,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,-1,-1,0,-1 -1,-1,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1 -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1

    Read the article

  • Java split xml file

    - by CC
    Hi all, I'm working on a piece of code to split files. I want to split flat file (that's ok, it is working fine) and xml file. The idea is to split based of a number of files to split: I have a file, and I want to split it in x files (x is a parameters). I'm doing the split by taking the size of the file and spliting the size by the number of files to split. Then, mysolution was to use a BufferedReader and to use it like while ((n = reader.read(buffer, 0, buffer.length)) != -1) { { The main problem is that for the xml file I cannot just split it, but I have to split it based on a block delimited by a start xml tag and end xml tag: <start tag> bla bla xml stuff </end tag> So I cannot cut a block at the middle. So if when I'm at the half of a block, is the size of my new file is greater than my max, I will have to read until the end of the tag, and then, to start a next file. The problem is that I have all sort of cases, and is a bit difficult to search the end tag. - the block reads a text until the middle of the end tag - the block reads a text until the end of the end tag, and no more other caracter after - etc and in the same time to have a loop and read the next block. Some times the end of a block concatenated with the start of the next one, I have the end xml tag. I hope you get the idea. My question is, does anyone have some algorithm that does that more accurate and who i treating all special cases ? The idea is to split the file as quickly as possible. Thanks alot.

    Read the article

  • AnyConnect SSL VPN split tunneling for a single website?

    - by Daniel Lucas
    We have a Cisco ASA 5510. We use split tunneling for AnyConnect SSL VPN clients. All internal addresses are tunnelled. Everything else is routed through the client's own internet connection. We use a SaaS service that only responds to requests when they come from one of our own public IP addresses. Because of this, VPN users are unable to access it currently. Is there a way to specify that a specific website should be tunneled and all others should not? NOTE: Worst case we will use a web bookmark on the clientless portal to tranlate through our network, but I'd like to see if the above is possible first.

    Read the article

  • How to split audio into multiple channels from optical S/PDIF or 1/8"?

    - by Josh M.
    I have a motherboard which has an optical S/PDIF output or 1/8". I'd like to "split" that signal into the appropriate channels so that I can then connect that to the wires behind my car's headunit which, in turn, run to the amp. The factory Bose amp just takes a single connector with a million wires running out of it, so that's why I would need to separate the signal into separate channels. On the other end there are four RCA connectors: front left, front right, rear left, rear right. The sub-woofer signal does not require an additional connection. Edit: Revised to include S/PDIF or 1/8".

    Read the article

  • How do I comperes and split files with terminal

    - by Levan
    So what I wanted to do. comperes(7zip) and split 600MB folder into 199MB parts but sadly when I tried to do this task with archive manager it gave me an error, but I know that if I use terminal it will work. I looked this up in askubuntu and found out about this commend 7z a -v5m -mx0 ubuntu.7z I understand that v5m will split it to 5 mb parts and -mx0 means that it will not comperes it but I want it to comperes so what should I write instead of this -mx0 pleas note: I am using .7zip because I most probably will use this file on windows pc thank you in advanced

    Read the article

  • Split large file, have arbitrary start index number

    - by nEJC
    I do a lot of file manipulation on my system and in one particular batch job I end up with around 16 Gb file. I need to prepare this data into smaller chunks for another process. I split it into 10k lines per file and numeric index, padded to 5 digits split -a 5 -d -l 10000 large_input_file /out_path/out. This way I end up with files named out.00000 out.00001 ... The problem is that this way indexing always starts with 0. Is there a way to set it to arbitrary starting index? man reveals nothing ...

    Read the article

  • Split Texture2D Across Line

    - by Simie
    Background I'm using a texture as a damage map represented by an array of floats for displaying damage effects on a space ship in a process. An upside of this is being able to 'slice' ships in half, using an input damage map with a line down the middle, as shown in the diagram below. Question However, I'm encountering problems separating this split ship into two different entities. I would like to be able to split the image down the 'damage line', in a process similar to this: I don't have much idea where to start detecting the red line above. Any advice would be welcome.

    Read the article

  • Notification of low DHCP pool in split scope setup

    - by JJBladester
    In Windows Server 2008 R2, it is possible to read the Event Viewer for EventID 1020 which is an indication that the DHCP pool is running low on addresses. What if I have two DHCP servers in my domain that use an 80/20 split scope to take a /24 pool of DHCP-allocated IP addresses and split it amongst the two servers according to this Technet Article? In this case, since the scope is split, how can I tell if the total DHCP pool, which is split amongst the two DHCP servers, is beginning to run low on address space?

    Read the article

  • Split string on non-alphanumerics in PHP? Is it possible with php's native function?

    - by Jehanzeb.Malik
    I was trying to split a string on non-alphanumeric characters or simple put I want to split words. The approach that immediately came to my mind is to use regular expressions. Example: $string = 'php_php-php php'; $splitArr = preg_split('/[^a-z0-9]/i', $string); But there are two problems that I see with this approach. It is not a native php function, and is totally dependent on the PCRE Library running on server. An equally important problem is that what if I have punctuation in a word Example: $string = 'U.S.A-men's-vote'; $splitArr = preg_split('/[^a-z0-9]/i', $string); Now this will spilt the string as [{U}{S}{A}{men}{s}{vote}] But I want it as [{U.S.A}{men's}{vote}] So my question is that: How can we split them according to words? Is there a possibility to do it with php native function or in some other way where we are not dependent? Regards

    Read the article

  • Can you use zero-width matching regex in String split?

    - by polygenelubricants
    System.out.println( Arrays.deepToString( "abc<def>ghi".split("(?:<)|(?:>)") ) ); This prints [abc, def, ghi], as if I had split on "<|>". I want it to print [abc, <def>, ghi]. Is there a way to work some regex magic to accomplish what I want here? Perhaps a simpler example: System.out.println( Arrays.deepToString( "Hello! Oh my!! Good bye!!".split("(?:!+)") ) ); This prints [Hello, Oh my, Good bye]. I want it to print [Hello!, Oh my!!, Good bye!!]. `.

    Read the article

  • java - how to split string in to multiple parts?

    - by Ewen
    I have a string that contains a value "firstword second third", and an ArrayList. I want to split the whole string in to by spaces and add the splitted strings in to the ArrayList. For example,"firstword second third" can be split to three separate strings and added three times in to the ArrayList. "1 2 3 4" can be splitted in to 4 strings and added 4 times in to the ArrayList. See the code below: public void separateAndAdd(String notseparated) { for(int i=0;i<canBeSepartedinto(notseparated);i++{ //what should i put here in order to split the string via spaces? thearray.add(separatedstring); } } public int canBeSeparatedinto(String string) //what do i put here to find out the amount of spaces inside the string? return .... } Please leave a comment if you dont get what I mean or I should fix some errors in this post. Thanks for your time!

    Read the article

  • CSM shadow errors when models are split

    - by KaiserJohaan
    I'm getting closer to fixing CSM, but there seems to be one more issue at hand. At certain angles, the models will be caught/split between two shadow map cascades, like below. first depth split second depth split - here you can see the model is caught between the splits How does one fix this? Increase the overlapping boundaries between the splits? Or is the frustrum erronous? CameraFrustrum CalculateCameraFrustrum(const float fovDegrees, const float aspectRatio, const float minDist, const float maxDist, const Mat4& cameraViewMatrix, Mat4& outFrustrumMat) { CameraFrustrum ret = { Vec4(1.0f, -1.0f, 0.0f, 1.0f), Vec4(1.0f, 1.0f, 0.0f, 1.0f), Vec4(-1.0f, 1.0f, 0.0f, 1.0f), Vec4(-1.0f, -1.0f, 0.0f, 1.0f), Vec4(1.0f, -1.0f, 1.0f, 1.0f), Vec4(1.0f, 1.0f, 1.0f, 1.0f), Vec4(-1.0f, 1.0f, 1.0f, 1.0f), Vec4(-1.0f, -1.0f, 1.0f, 1.0f), }; const Mat4 perspectiveMatrix = PerspectiveMatrixFov(fovDegrees, aspectRatio, minDist, maxDist); const Mat4 invMVP = glm::inverse(perspectiveMatrix * cameraViewMatrix); outFrustrumMat = invMVP; for (Vec4& corner : ret) { corner = invMVP * corner; corner /= corner.w; } return ret; } Mat4 CreateDirLightVPMatrix(const CameraFrustrum& cameraFrustrum, const Vec3& lightDir) { Mat4 lightViewMatrix = glm::lookAt(Vec3(0.0f), -glm::normalize(lightDir), Vec3(0.0f, -1.0f, 0.0f)); Vec4 transf = lightViewMatrix * cameraFrustrum[0]; float maxZ = transf.z, minZ = transf.z; float maxX = transf.x, minX = transf.x; float maxY = transf.y, minY = transf.y; for (uint32_t i = 1; i < 8; i++) { transf = lightViewMatrix * cameraFrustrum[i]; if (transf.z > maxZ) maxZ = transf.z; if (transf.z < minZ) minZ = transf.z; if (transf.x > maxX) maxX = transf.x; if (transf.x < minX) minX = transf.x; if (transf.y > maxY) maxY = transf.y; if (transf.y < minY) minY = transf.y; } Mat4 viewMatrix(lightViewMatrix); viewMatrix[3][0] = -(minX + maxX) * 0.5f; viewMatrix[3][1] = -(minY + maxY) * 0.5f; viewMatrix[3][2] = -(minZ + maxZ) * 0.5f; viewMatrix[0][3] = 0.0f; viewMatrix[1][3] = 0.0f; viewMatrix[2][3] = 0.0f; viewMatrix[3][3] = 1.0f; Vec3 halfExtents((maxX - minX) * 0.5, (maxY - minY) * 0.5, (maxZ - minZ) * 0.5); return OrthographicMatrix(-halfExtents.x, halfExtents.x, halfExtents.y, -halfExtents.y, halfExtents.z, -halfExtents.z) * viewMatrix; }

    Read the article

  • GNU Screen: Combining split-regions and full-screen sessions

    - by scrrr
    Let's say I have three sessions: 0, 1 and 2 I'm on session 0 and I press CTRL-A S to split the screen. Then I select session 1 for the bottom split region, while 0 is in the upper. Can I switch to session 2 and have it display in full-screen while 0 and 1 remain split? If I CTRL-A n to other sessions in a split screen it only changes the split-region. I want some sessions to be full-screen though. Is that possible?

    Read the article

  • split a textfile after each n matches to a new file using sed or awk

    - by ozz
    i tried to split a file in parts of n matches each. The file is just one line and the seperator is '<br>' foo<br>bar<br>.....<br> I just want to split the file in parts, where each file has 100 datasets (text plus <br>)( normaly 100 datasets, but at the end maybe less) I already played around with this ... split-file-in-2-with-sed and this split-one-file-into-multiple-files-based-on-pattern sed.exe -e "^.*.<br>{0,100}/g" < original.txt > first_half.txt The split do not work an the result is only 1 file instead of many.

    Read the article

  • Delphi - How do I split a string into an array of strings based on a delimiter?

    - by Ryan
    Hello all, I'm trying to find a Delphi function that will split an input string into an array of strings based on a delimiter. I've found a lot on Google, but all seem to have their own issues and I haven't been able to get any of them to work. I just need to split a string like: "word:doc,txt,docx" into an array based on ':'. The result would be ['word', 'doc,txt,docx']. Does anyone have a function that they know works? Thank you

    Read the article

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