prefix

How to rename with prefix/suffix ?

How do I do mv original.filename new.original.filename without retyping the original filename? I would imagine being able to do something like mv -p=new. original.filename or perhaps mv original.filename new.~ or whatever - but I can't see anything like this after looking at man mv / info mv pages. Of course, I could write a shell scri...

Check if string is a prefix of a Javascript RegExp

In Javascript I have defined a regular expression and now a user is typing in a string. I want to tell him if his string still could match the RegExp if he continues typing or if he's already on the wrong way. For instance: var re = /a*b/; "a".isPrefixOf( re ); // true "x".isPrefixOf( re ); // false How could an implementation of isP...

How to split using a prefix character using regular expressions?

I would like to split the example string -- ~Peter~Lois~Chris~Meg~Stewie on the character '~' and have the result be Peter Lois Chris Meg Stewie Using a standard string split function in javascript or C# the first result is of course an empty string. I'd like to avoid having to ignore the first result because the first result may act...

About Trees and Prefix (Polish) Notation?

My MIPS Assembly class required me to read in an expression of unknown size into a Parse Tree. I've never had to deal with trees, so this is how I went around storing values: Lets say the user entered the expression 1 + 3 - 4 (each operand could only be a digit 1-9) My leftmost child node would be the starting point and contain 2 piec...

instance variable/ method argument naming in Objective C

What conventions are people here following for naming of instance variables and method arguments - particularly when method arguments are used to set ivars (instance variables)? In C++ I used to use the m_ prefix for ivars a lot. In C# I followed the convention of disambiguating purely by use of this. for ivars. I've since adopted the e...

How to sort 32bit numbers to find unique entries?

Hi, There is a data set of "file" - name of file, and 32bit number is following after it - something like hash for the file. "file1" 6a9bd9a6 1df3b24b 7ab054dc "file2" 6a9bd54e 1df3b24b 8cd054dc "file3" 6a9bd9a6 7ab054dc How am I going to get unique files so s2 is not a prefix of any other s2 - that means the number is unique. If the...

Prefix search in a radix tree/patricia trie

I'm currently implementing a radix tree/patricia trie (whatever you want to call it). I want to use it for prefix searches in a dictionary on a severely underpowered piece of hardware. It's supposed to work more or less like auto-completion, i. e. showing a list of words that the typed prefix matches. My implementation is based on this ...

Server prefix and rails routes

When i'm starting the server with the path option script/server --path=/myapp while having a route map.route 'foo', :controller => 'bar', :action => 'buzz' then ActionController::Routing::Routes.recognize_path('/myapp/foo') raises an error "No route matched ..." Question: How can i make Rails built-in routing recognize with p...

How to differentiate (when overloading) between prefix and postfix forms of operator++? (C++)

Becuase I've overloaded the operator++ for an iterator class template typename list::iterator& list::iterator::operator++() { //stuff } But when I try to do list::iterator IT; IT++; I get a warning about there being no postifx ++, using prefix form. How can I specifically overload the prefix/postifx forms? ...

RegExp in ActionScript 3: How to exclude a complex prefix?

Hi, AS3 RegExp engine (and ECMAScript based JavaScript) do not support complex "lookbehind" expressions. (lookahead expressions are fully supported.) For example: (?<=<body>)(.*?)(?=<\/body>) will work but; (?<=<body\b[^>]*>)(.*?)(?=<\/body>) will not work in AS3. What I need is to match a complex prefix but exclude it in the ...

Database columns type prefix

I’ve been developing solutions with databases for more than 11 years now, and it seems I’ve “developed” a rather controversial opinion about naming columns in my tables: I always give them a 3 or 4 character type prefix, i.e. intGroupID, nvcTitle, dtmCreated, bitPlayerHater, etc. I’ve worked with several other developers who all absolute...

Grouping in a namespace vs. prefixing Classes

Hi, imagine a situation where you have an application that needs to import data from different sources. For each of these sources exists a seperate model (often not related to the others). So let's say i have my software component X which does all the importing, the namespace is correspondingly X. In X i have all my different parsers a...

[Eclipse] Member variable prefix wrongly added to method name

Hi there, I am using Eclipse to write some Java code and the naming convention that I am following uses an 'm' as a prefix to any member variables for a class. As soon as I write the member variables I like to go to Source -> Generate Getters and Setters. This generates the methods that I require. However, the method and parameter names...

i++ less efficient than ++i, how to show this?

I am trying to show by example that the prefix increment is more efficient than the postfix increment. In theory this makes sense: i++ needs to be able to return the unincremented original value and therefore store it, whereas ++i can return the incremented value without storing the previous value. But is there a good example to show t...

PHP - extract() type

Hello, PHP's extract() function can take on one of several extract_types. But what's the difference between extr_prefix_same and extr_prefix_if_exists? The manual makes it sound like, in either case, new variables will be prefixed if the variable name already exists. Thanks! ...

XSL element with multiple namespace with different prefix

I wanna create an element in my XSL 1.0 with some namespace Just like this: <element xmlns:a = '...' xmlns:b = '...' xmlns = '...' > For some reason I can't use XSL 2.0, with <xsl:namespace> extension, there is only one allowed namespace declared for each element in XSL 1.0,how should I do? Regards, ...

how to wrap (prefix & suffix) all values in a column with a string?

I have a mysql table with about 1000 rows in it. id column 1 apple 2 banana ... etc I need a mysql query (UPDATE) to wrap (prefix & suffix) all values in a column with a specific string, let's say "_", so I am expecting a result: id column 1 _apple_ 2 _banana_ ... etc How to do that? Please, advice. ...

bash: how to change the basename only of a list of files

Hi all, I have a lit of files (which I get from find bla -name "*.so") such as: /bla/a1.so /bla/a2.so /bla/blo/a3.so /bla/blo/a4.so /bla/blo/bli/a5.so and I want to rename them such as it becomes: /bla/liba1.so /bla/liba2.so /bla/blo/liba3.so /bla/blo/liba4.so /bla/blo/bli/liba5.so ... i.e. add the prefix 'lib' to the basename any ...

makefile: how to add a prefix to the basename ?

Hi all, I have a list of file path like that: FILE_PATH := a1.so a2.so bla/a3.so bla/a3.so bla/blo/a4.so.... I need to add a prefix to the basename in order to get: FILE_PATH_PREFIX := liba1.so liba2.so bla/liba3.so bla/liba3.so bla/blo/liba4.so.... any idea ? Cheers dave ...

Space-efficient in-memory structure for sorted text supporting prefix searches

I have a problem: I need space-efficient lookup of file-system data based of file path prefix. Prefix searching of sorted text, in other words. Use a trie, you say, and I thought the same thing. Trouble is, tries are not space-efficient enough, not without other tricks. I have a fair amount of data: about 450M in a plain-text Unix-for...