Search Results

Search found 258 results on 11 pages for 'substitution'.

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

  • def constrainedMatchPair(firstMatch,secondMatch,length):

    - by smart
    matches of a key string in a target string, where one of the elements of the key string is replaced by a different element. For example, if we want to match ATGC against ATGACATGCACAAGTATGCAT, we know there is an exact match starting at 5 and a second one starting at 15. However, there is another match starting at 0, in which the element A is substituted for C in the key, that is we match ATGC against the target. Similarly, the key ATTA matches this target starting at 0, if we allow a substitution of G for the second T in the key string. consider the following steps. First, break the key string into two parts (where one of the parts could be an empty string). Let's call them key1 and key2. For each part, use your function from Problem 2 to find the starting points of possible matches, that is, invoke starts1 = subStringMatchExact(target,key1) and starts2 = subStringMatchExact(target,key2) The result of these two invocations should be two tuples, each indicating the starting points of matches of the two parts (key1 and key2) of the key string in the target. For example, if we consider the key ATGC, we could consider matching A and GC against a target, like ATGACATGCA (in which case we would get as locations of matches for A the tuple (0, 3, 5, 9) and as locations of matches for GC the tuple (7,). Of course, we would want to search over all possible choices of substrings with a missing element: the empty string and TGC; A and GC; AT and C; and ATG and the empty string. Note that we can use your solution for Problem 2 to find these values. Once we have the locations of starting points for matches of the two substrings, we need to decide which combinations of a match from the first substring and a match of the second substring are correct. There is an easy test for this. Suppose that the index for the starting point of the match of the first substring is n (which would be an element of starts1), and that the length of the first substring is m. Then if k is an element of starts2, denoting the index of the starting point of a match of the second substring, there is a valid match with one substitution starting at n, if n+m+1 = k, since this means that the second substring match starts one element beyond the end of the first substring. finally the question is Write a function, called constrainedMatchPair which takes three arguments: a tuple representing starting points for the first substring, a tuple representing starting points for the second substring, and the length of the first substring. The function should return a tuple of all members (call it n) of the first tuple for which there is an element in the second tuple (call it k) such that n+m+1 = k, where m is the length of the first substring.

    Read the article

  • Is there a more modern regexp handler for Open Object Rexx

    - by Brent.Longborough
    The regular expression class (rxregexp.dll) that comes with ooRexx (I'm on 4.0.0) is relatively low on function compared, say, with Python's re module (even at 2.5.2). It appears to have no assertions, no facilities for group extraction, or for substitution. Greedy or lazy matching is a global pattern option, rather than flagged by an additional "?". Basically, a pre-PCRE regular expression engine. Does anyone know if anything with more up-to-date function is available?

    Read the article

  • What does this mean?

    - by LeonixSolutions
    I found this in some code examples while googling : $sql = 'INSERT INTO users (username,passwordHash) VALUES (?,?)'; it's new to me, but I would guess that it a substitution method and equivalent to $sql = "INSERT INTO users (username,passwordHash) VALUES ($username,$passwordHash)";` or $sql = 'INSERT INTO users (username,passwordHash) VALUES (' . $username . ',' . $passwordHash . ')';` would that be correct? Is it an actual PHP syntax, or was he just trying to simplify his example?

    Read the article

  • How to learn open source library API without good documentation

    - by Turtle
    I am recently working on the open source library openmetaverse which is designed as an open source substitution of second life viewer. I think the problem is that it is not well documented. Sometimes, I just misunderstand the API when I really used it in real program which is very annoying because sometimes you need to write many code. But how to make sure the API just acts the way you expected? So what is your way to learn new API without good documentation?

    Read the article

  • Perl ENV variable contains newline and tab

    - by Michael
    Say I have an environment variable myvar myvar=\tapple\n when the following command will print out this variable perl -e 'print "$ENV{myvar}"' I will literally have \tapple\n, however, I want those control chars to be evaluated and not escaped. How would I achieve it? In the real world $ENV residing in substitution, but I hope the answer will cover that.

    Read the article

  • How can I interpolate literal \t and \n in Perl strings?

    - by Michael
    Say I have an environment variable myvar: myvar=\tapple\n When the following command will print out this variable perl -e 'print "$ENV{myvar}"' I will literally have \tapple\n, however, I want those control chars to be evaluated and not escaped. How would I achieve it? In the real world $ENV residing in substitution, but I hope the answer will cover that.

    Read the article

  • Convert numbers to enumeration of strings in bash

    - by User1
    Using bash, I have a list of strings that I want to use to replace an int. Here's an example: day1=Monday day2=Tuesday day3=Wednesday day4=Thursday day5=Friday day6=Saturday day7=Sunday If I have an int, $dow, to represent the day of the week, how do I print the actual string? I tried this: echo ${day`echo $dow`} but get error of "bad substitution". How do I make this work? Note: I can change the $day variables to a list or something.

    Read the article

  • Remove control M from a text file in C

    - by Werner
    Hi, ist is possible? What would be the easiest way? I tried to compare in the input string character to character so if(char([i]=="^M") char[i]="" but it does not work. By the way, if I were able to check it, what is the wistes substitution? to "" ? Thanks

    Read the article

  • difference between #define and enum{} in C

    - by guest
    when should one use enum {BUFFER = 1234}; over #define BUFFER 1234 ? what are the advantages enum brings compared to #define? i know, that #define is just simple text substitution and enum names the constant somehow. but why would one need that at all?

    Read the article

  • Text Expander broken upon Snow Leopard Upgrade

    - by bLee
    I've been using Text Expander for years. However, I found out today it doesn't work on my newly upgraded (to Snow Leopard) Macbook Pro anymore. I know that there are a lot of applications that are not compatible with Snow Leopard, and developers around the world are working on them to work again on our beautiful macs. My questions are: 1. Is TextExpander supposed to NOT work on Snow Leopard? 2. What is a good substitution to replace TextExpander? or any updates from TextExpander developers?

    Read the article

  • How to add missing fonts to Adobe Illustrator?

    - by WilliamKF
    When opening an Adobe Acrobat PDF document on Mac OS X Lion to edit in Adobe Illustrator CS6, I got the message: The font Helvetica-Narrow-Bold is missing. Affected text will be displayed using a substitute font. The font QuickTypePi is missing. Affected text will be displayed using a substitute font. How can I provide the missing fonts so that no substitution occurs and upon return to Adobe Acrobat Pro X the original fonts will remain after any edits in Illustrator? Or, since the message talks about their display, will the font remain unchanged upon return to Adobe Acrobat?

    Read the article

  • How do I replicate autohotkey hotstrings in Chrome OS

    - by IThink
    Google gave me a Cr-48 about a month ago. I like it. Its simple and powerful. The temptation to fuss and muss has been removed. However, one of the things I miss a lot is hotstrings that I set up in autohotkey. So for instance typing "asap" will autoexpand to "as soon as possible" no matter what software I am in. I cannot do that in Chrome OS. Google Docs has something under toolspreferencesautomatic substitution but that is only specific to Google Docs. I want to have hotstrings everywhere.

    Read the article

  • Search and replace global modifier

    - by mrucci
    Is there any reason why non-global/first-occurrence substitution is the default in many text editing programs (vim, sed, perl, etc.)? I am talking about the /g flag of search and replace commands like: :s/pan/focaccia/g # in vim sed 's/sfortuna/fortuna/g' # with sed that will substitute every occurrence of the search pattern with the replacement string. After (not too) many years of vim and sed usage I still did not find any use case for non-global substitutions. Is there some valid historical reason? Or it is because it is? Thanks.

    Read the article

  • Can't escape single quotes in shell

    - by user13743
    I'm trying to make a command to do a perl substitution on a batch of php files in a directory. The string I want to replace has single quotes in it, and I can't get it to properly escape the in shell. I tried echoing the string with unescaped quotes, to see what perl would be getting: echo 's/require_once('include.constants.php');/require_once('include.constants.php');require_once("./functions/include.session.inc.php");/g' and it doesn't have the single-quotes in the result: s/require_once\(include.constants.php\);/require_once\(include.constants.php\);require_once\("\./functions/include\.session\.inc\.php"\);/g However, when I try to escape the single quotes: echo 's/require_once\(\'include\.constants\.php\'\);/require_once\(\'include\.constants\.php\'\);require_once\("\./functions/include\.session\.inc\.php"\);/g' I get the prompt to complete the command: > What I want it to parse to is this: What am I doing wrong? s/require_once\('include.constants.php'\);/require_once\('include.constants.php'\);require_once\("\./functions/include\.session\.inc\.php"\);/g

    Read the article

  • Scripted printer configuration changes

    - by David Steven
    I've got about a dozen Windows XP machines that I need to make a couple specific printer configuration changes to. The printer is "virtual" printer for an electronic delivery service. I'd like to not have to visit each machine individually. I already have the means to execute commands remotely on the machines, I just can't seem to find away to adjust these settings via command line or script. Specifically I need to be able to make the following changes: 1) As an admin user: - Device Settings - Font Substitution Table/Courier New - Change to "Courier" 2) As a specific* user: - Printer Preferences - Paper/Quality - Advanced - Change Graphic/Print Quality to "600 x 600" - Change Document Options/Printer Features/Graphics Mode to "HP-GL/2" *This change is a per user configuration, unless there's some way to make it once. In this situation I only really need it for a specific (different) user on each machine.

    Read the article

  • Excel IP address and subnet to network and inverse mask [closed]

    - by Steve Dailey
    We need a script, marco or something in excel where we can take list like below interface Vlan100 ip address 192.168.1.3 255.255.255.0 interface Vlan101 ip address 192.168.2.3 255.255.255.128 interface Vlan102 ip address 192.168.2.130 255.255.255.128 interface Vlan103 ip address 192.168.3.3 255.255.255.240 etc... and produce a list like below ospf 1 undo silent-interface Vlan-interface100 undo silent-interface Vlan-interface101 undo silent-interface Vlan-interface102 undo silent-interface Vlan-interface103 area 0.0.0.0 network 192.168.1.0 0.0.0.255 network 192.168.2.0 0.0.0.127 network 192.168.2.128 0.0.0.127 network 192.168.3.0 0.0.0.15 so it will need to take an ip address/subnet mask and convert them to network number/inverse mask. I believe I can handle the Vlan manipulation with a substitution so no need to spend time on that.

    Read the article

  • VM Build XML file fails to validate against OVF 1.0 schema

    - by siddharthgod
    For our product, we were trying to generate VM / vApp build XML from java code. For this purpose, we were using XML Beans. When we tried to generate JAVA classes for OVF envelope for 0.9 (ovf-envelope.xsd in schemas/ovf) it was successful. However these schemas does not allow us to add IPassignment section which is available in OVF 1.0. When we tried to compile 1.0 schema (ovfenv-vmware.xsd in schemas/ovf1.0.0e/vmware folder), we get validation errors. When we loaded this schema in schema editor we could see some validation errors. First error we saw was following: When we loaded ovfenv-vmware.xsd in XMLspy we could see following validation error in dsp8027.xsd - "cos-nonambig: makes the content model non-deterministic against . Possible causes: name equality, overlapping occurrence or substitution groups." Same error was also thrown by xmlbean while generating java classes from ovfenv-vmware.xsd. Is there any workaround for this problem?

    Read the article

  • How to search unique dynamic data in a sheet and then copy relevent row in diffrent sheet?

    - by Hemant
    I am getting data from internet (DataFrom Web) In sheet1. Then I disperse that data in to three sheets based on three unique text. Like a,b and c. Rows are copied to sheet a,b and c sheets depending on text (a,b,c) they have. All the rows have one unique text (like url) by which they can be searched. I have added static data corresponding to the row. The problem is when ever internet data is changed (row addition/substitution or randomized). My static data loses its connection with the original row for which it was written. I want to search the data based on one unique key and put it to its original place where it used to be with static data.

    Read the article

  • Vim - select text highlighted by search?

    - by GorillaSandwich
    In vim, I often perform searches to hop to a word or phrase instead of navigating there with h/j/k/l. Then I hit n to hop between occurrences. Say I've got this text: Time flies like an arrow; fruit flies like a banana. - Groucho Marx I type /an arrow and hit enter. That phrase is highlighted, and I jump to it. Now I want to visually select that text, maybe to change it or delete it. (Yes, I'm aware of the :s substitution command.) Since my cursor is at the letter "a" at the beginning of "an arrow," I can hit v, then press e a couple of times to highlight the entire phrase. But I have a feeling there's a shorter and more semantic way. After all, I've already specified the text I'm interested in. How might I compose a command to say "visually select the current search selection?"

    Read the article

  • Misbehavior in regular expression in VIM

    - by poissonbreaker
    I am having a problem with a regular expression on vim. I have a pattern as follows: http:\/\/\(\w\+\.\?\)\+ [matches http://(AS MANY WORDS FOLLOWED BY DOT OR NOT ENCOUNTERS) e.g. http://wd1.wd2.com] I have a text as follows: http://wd1.wd2.com/wd3 I am trying to make this substitution on it: s/\(http:\/\/\)\(\w\+\.\?\)\+/\1wd4.wd5.com and the result is http://wd4.wd5.com /wd3 (Notice the white space inserted at the end of the replacement) How can I avoid having this inserted space? I am afraid is a bug in the regexp engine but I am not sure.

    Read the article

  • How to Use USER_DEFINED Activity in OWB Process Flow

    - by Jinggen He
    Process Flow is a very important component of Oracle Warehouse Builder. With Process Flow, we can create and control the ETL process by setting all kinds of activities in a well-constructed flow. In Oracle Warehouse Builder 11gR2, there are 28 kinds of activities, which fall into three categories: Control activities, OWB specific activities and Utility activities. For more information about Process Flow activities, please refer to OWB online doc. Most of those activities are pre-defined for some specific use. For example, the Mapping activity allows execution an OWB mapping in Process Flow and the FTP activity allows an interaction between the local host and a remote FTP server. Besides those activities for specific purposes, the User Defined activity enables you to incorporate into a Process Flow an activity that is not defined within Warehouse Builder. So the User Defined activity brings flexibility and extensibility to Process Flow. In this article, we will take an amazing tour of using the User Defined activity. Let's start. Enable execution of User Defined activity Let's start this section from creating a very simple Process Flow, which contains a Start activity, a User Defined activity and an End Success activity. Leave all parameters of activity USER_DEFINED unchanged except that we enter /tmp/test.sh into the Value column of the COMMAND parameter. Then let's create the shell script test.sh in /tmp directory. Here is the content of /tmp/test.sh (this article is demonstrating a scenario in Linux system, and /tmp/test.sh is a Bash shell script): echo Hello World! > /tmp/test.txt Note: don't forget to grant the execution privilege on /tmp/test.sh to OS Oracle user. For simplicity, we just use the following command. chmod +x /tmp/test.sh OK, it's so simple that we’ve almost done it. Now deploy the Process Flow and run it. For a newly installed OWB, we will come across an error saying "RPE-02248: For security reasons, activity operator Shell has been disabled by the DBA". See below. That's because, by default, the User Defined activity is DISABLED. Configuration about this can be found in <ORACLE_HOME>/owb/bin/admin/Runtime.properties: property.RuntimePlatform.0.NativeExecution.Shell.security_constraint=DISABLED The property can be set to three different values: NATIVE_JAVA, SCHEDULER and DISBALED. Where NATIVE_JAVA uses the Java 'Runtime.exec' interface, SCHEDULER uses a DBMS Scheduler external job submitted by the Control Center repository owner which is executed by the default operating system user configured by the DBA. DISABLED prevents execution via these operators. We enable the execution of User Defined activity by setting: property.RuntimePlatform.0.NativeExecution.Shell.security_constraint= NATIVE_JAVA Restart the Control Center service for the change of setting to take effect. cd <ORACLE_HOME>/owb/rtp/sql sqlplus OWBSYS/<password of OWBSYS> @stop_service.sql sqlplus OWBSYS/<password of OWBSYS> @start_service.sql And then run the Process Flow again. We will see that the Process Flow completes successfully. The execution of /tmp/test.sh successfully generated a file /tmp/test.txt, containing the line Hello World!. Pass parameters to User Defined Activity The Process Flow created in the above section has a drawback: the User Defined activity doesn't accept any information from OWB nor does it give any meaningful results back to OWB. That's to say, it lacks interaction. Maybe, sometimes such a Process Flow can fulfill the business requirement. But for most of the time, we need to get the User Defined activity executed according to some information prior to that step. In this section, we will see how to pass parameters to the User Defined activity and pass them into the to-be-executed shell script. First, let's see how to pass parameters to the script. The User Defined activity has an input parameter named PARAMETER_LIST. This is a list of parameters that will be passed to the command. Parameters are separated from one another by a token. The token is taken as the first character on the PARAMETER_LIST string, and the string must also end in that token. Warehouse Builder recommends the '?' character, but any character can be used. For example, to pass 'abc,' 'def,' and 'ghi' you can use the following equivalent: ?abc?def?ghi? or !abc!def!ghi! or |abc|def|ghi| If the token character or '\' needs to be included as part of the parameter, then it must be preceded with '\'. For example '\\'. If '\' is the token character, then '/' becomes the escape character. Let's configure the PARAMETER_LIST parameter as below: And modify the shell script /tmp/test.sh as below: echo $1 is saying hello to $2! > /tmp/test.txt Re-deploy the Process Flow and run it. We will see that the generated /tmp/test.txt contains the following line: Bob is saying hello to Alice! In the example above, the parameters passed into the shell script are static. This case is not so useful because: instead of passing parameters, we can directly write the value of the parameters in the shell script. To make the case more meaningful, we can pass two dynamic parameters, that are obtained from the previous activity, to the shell script. Prepare the Process Flow as below: The Mapping activity MAPPING_1 has two output parameters: FROM_USER, TO_USER. The User Defined activity has two input parameters: FROM_USER, TO_USER. All the four parameters are of String type. Additionally, the Process Flow has two string variables: VARIABLE_FOR_FROM_USER, VARIABLE_FOR_TO_USER. Through VARIABLE_FOR_FROM_USER, the input parameter FROM_USER of USER_DEFINED gets value from output parameter FROM_USER of MAPPING_1. We achieve this by binding both parameters to VARIABLE_FOR_FROM_USER. See the two figures below. In the same way, through VARIABLE_FOR_TO_USER, the input parameter TO_USER of USER_DEFINED gets value from output parameter TO_USER of MAPPING_1. Also, we need to change the PARAMETER_LIST of the User Defined activity like below: Now, the shell script is getting input from the Mapping activity dynamically. Deploy the Process Flow and all of its necessary dependees then run the Process Flow. We see that the generated /tmp/test.txt contains the following line: USER B is saying hello to USER A! 'USER B' and 'USER A' are two outputs of the Mapping execution. Write the shell script within Oracle Warehouse Builder In the previous section, the shell script is located in the /tmp directory. But sometimes, when the shell script is small, or for the sake of maintaining consistency, you may want to keep the shell script inside Oracle Warehouse Builder. We can achieve this by configuring these three parameters of a User Defined activity properly: COMMAND: Set the path of interpreter, by which the shell script will be interpreted. PARAMETER_LIST: Set it blank. SCRIPT: Enter the shell script content. Note that in Linux the shell script content is passed into the interpreter as standard input at runtime. About how to actually pass parameters to the shell script, we can utilize variable substitutions. As in the following figure, ${FROM_USER} will be replaced by the value of the FROM_USER input parameter of the User Defined activity. So will the ${TO_USER} symbol. Besides the custom substitution variables, OWB also provide some system pre-defined substitution variables. You can refer to the online document for that. Deploy the Process Flow and run it. We see that the generated /tmp/test.txt contains the following line: USER B is saying hello to USER A! Leverage the return value of User Defined activity All of the previous sections are connecting the User Defined activity to END_SUCCESS with an unconditional transition. But what should we do if we want different subsequent activities for different shell script execution results? 1.  The simplest way is to add three simple-conditioned out-going transitions for the User Defined activity just like the figure below. In the figure, to simplify the scenario, we connect the User Defined activity to three End activities. Basically, if the shell script ends successfully, the whole Process Flow will end at END_SUCCESS, otherwise, the whole Process Flow will end at END_ERROR (in our case, ending at END_WARNING seldom happens). In the real world, we can add more complex and meaningful subsequent business logic. 2.  Or we can utilize complex conditions to work with different results of the User Defined activity. Previously, in our script, we only have this line: echo ${FROM_USER} is saying hello to ${TO_USER}! > /tmp/test.txt We can add more logic in it and return different values accordingly. echo ${FROM_USER} is saying hello to ${TO_USER}! > /tmp/test.txt if CONDITION_1 ; then ...... exit 0 fi if CONDITION_2 ; then ...... exit 2 fi if CONDITION_3 ; then ...... exit 3 fi After that we can leverage the result by checking RESULT_CODE in condition expression of those out-going transitions. Let's suppose that we have the Process Flow as the following graph (SUB_PROCESS_n stands for more different further processes): We can set complex condition for the transition from USER_DEFINED to SUB_PROCESS_1 like this: Other transitions can be set in the same way. Note that, in our shell script, we return 0, 2 and 3, but not 1. As in Linux system, if the shell script comes across a system error like IO error, the return value will be 1. We can explicitly handle such a return value. Summary Let's summarize what has been discussed in this article: How to create a Process Flow with a User Defined activity in it How to pass parameters from the prior activity to the User Defined activity and finally into the shell script How to write the shell script within Oracle Warehouse Builder How to do variable substitutions How to let the User Defined activity return different values and in what way can we leverage

    Read the article

  • Thoughts on my new template language?

    - by Ralph
    Let's start with an example: using "html5" using "extratags" html { head { title "Ordering Notice" jsinclude "jquery.js" } body { h1 "Ordering Notice" p "Dear @name," p "Thanks for placing your order with @company. It's scheduled to ship on {@ship_date|dateformat}." p "Here are the items you've ordered:" table { tr { th "name" th "price" } for(@item in @item_list) { tr { td @item.name td @item.price } } } if(@ordered_warranty) p "Your warranty information will be included in the packaging." p(class="footer") { "Sincerely," br @company } } } The "using" keyword indicates which tags to use. "html5" might include all the html5 standard tags, but your tags names wouldn't have to be based on their HTML counter-parts at all if you didn't want to. The "extratags" library for example might add an extra tag, called "jsinclude" which gets replaced with something like <script type="text/javascript" src="@content"></script> Tags can be optionally be followed by an opening brace. They will automatically be closed as the closing brace. If no brace is used, they will be closed after taking on element. Variables are prefixed with the @ symbol. They may be used inside double-quoted strings. I think I'll use single-quotes to indicate "no variable substitution" like PHP does. Filter functions can be applied to variables like @variable|filter. Arguments can be passed to the filter @variable|filter:@arg1,arg2="y" Attributes can be passed to tags by including them in (), like p(class="classname"). Some questions: Which symbol should I use to prefix variables? @ (like Razor), $ (like PHP), or something else? Should the @ symbol be necessary in "for" and "if" statements? It's kind of implied that those are variables. Tags and controls (like if,for) presently have the exact same syntax. Should I do something to differentiate the two? If so, what? Do you like the attribute syntax? (round brackets) I'll add more questions in a few minutes, once I get some feedback.

    Read the article

  • A good substitute for ASMX web service methods, but not a general handler

    - by Saeed Neamati
    The best thing I like about ASP.NET MVC, is that you can directly call a server method (called action), from the client. This is so convenient, and so straightforward, that I really like to implement such a model in ASP.NET WebForms too. However, in ASP.NET WebForms, to call a server method from the client, you should either use Page Methods, or Web Services, both of which use SOAP as their communication protocol (though JSON can also be used). There is also another substitution, which is using Generic Handlers. The problem with them however is that, a separate Generic Handler should be written for each server method. In other words, each Generic Handler works like a simple method. Is there anyway else to imitate MVC model in ASP.NET WebForms? Please note that I can't change to MVC platform right now, cause the project at our hand is a big project and we don't have required resources and time to change our platform. What we seek, is a simple MVC model implementation for our AJAX calls. A problem that we have with Web Services, is the known problem of SoapException, and we're not interested in creating custom SoapExctensions.

    Read the article

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