Hi,
Given a string like String a="- = - - What is your name?";
How to remove the leading equal, dash, space characters, to get the clean text,
"What is your name?"
Thanks.
I have defined an object in 3D space with position, rotation and scale values (all defined as 3D vectors). It also has upwards and forwards direction vectors. When I rotate the object, I need these direction vectors to rotate with it.
Assuming my up vector is (0, 1, 0) and my forwards vector is (0, 0, 1) at zero rotation, how might I achieve this?
What data type should I use for data that can be very short, eg. html link (think twitter), or very long eg. html blog post (think wordpress).
I am thinking if I use varchar(4000), it maybe too short for a html formated blog entry? but if I use text, it will take up more space and is less efficient?
Hi,
I'd like to handle directly 64-bit words on the CUDA platform (eg. uint64_t vars).
I understand, however, that addressing space, registers and the SP architecture are all 32-bit based.
I actually found this to work correctly (on my CUDA cc1.1 card):
__global__ void test64Kernel( uint64_t *word )
{
(*word) <<= 56;
}
but I don't know, for example, how this affects registers usage and the operations per clock cycle count.
I'm trying to read a return delimited file. full of phrases.
I'm trying to put each phrase into a string.
The problem is that when I try to read the file with
fscanf(file,"%50s\n",string);
the string only contains one word. when it bumps with a space it stops reading the string
Hello,
when my user enters data validated as wrong a red circle with a white exclamation mark is shown in the right part of the textbox with the wrong data. The error message is only shown when the user hovers the textbox with wrong data.
Do you think that is a bad User experience ?
I could show the red error message text to the right side of the textboxes if there would still be space...
How can I apply multiple regexs to a single string?
For instance, a user inputs the following into a text area:
red bird
blue cat
black dog
and I want to replace each carriage return with a comma and each space with an underscore so the final string reads as red_bird,blue_cat,black_dog.
I've tried variations in syntax along the lines of the following so far:
function formatTextArea() {
var textString = document.getElementById('userinput').value;
var formatText = textString.replace(
new RegExp( "\\n", "g" ),",",
new RegExp( "\\s", "g"),"_");
alert(formatText);
}
Hello,
I 've got a table field (membername) which contains both the last name and the first name of users. Is it possible to split those into 2 fields (memberfirst - memberlast)? All the records have this format "Firstname Lastname" (without quotes and a space in between).
Hi,
I'm currently working on a listview in winform c#
and everytime I click on an empty space on the listview,
the selected item is lost.
please help
ed
Design an algorithm with min time and space
here is my solution -
assume a array of N elements with 32 bit integers
use a bit array to set the appropriate bits
the array is sorted now
assign even numbers to the first half of the array in ascending order
assign odd numbers to the second half of the array in descending order
any better solution ?
java-me uses the internet connection of the mobile device to implement network api's.
are there any special features in the implementation of tcp/ip protocol stack for mobile devices or the implementation is essentially the same with a little different parameters like buffer space etc.
lets take symbian for example.
In the Java Generic Book, while contrasting the difference between C++ Templates and Java Generic says:
In C++, a problem arises because
without the space denotes the
right-shift operator. Java fixes the
problem by a trick in the grammar.)
What is this trick?
Sometimes when I get an Exception while debugging in Visual Studio, all the code lines in the stack trace belong to the System.. name space. It doesn't display my line of code which was responsible for the exception.
Is there a way to be make the stack trace show more lines or to ignore stack trace from the system namespace? Something like Just-My-Code for stack trace?
Is two (or more) different threads allowed to write to the same memory location in global space in OpenCL? The write is always changing a uchar from 0 to 1 so the outcome should be predictable, but I'm getting erratic results in my program, so I'm wondering if the reason can be that some of the writes fail.
Could it help to declare the buffer write-only and copy it to a read-only buffer afterwards?
I'm trying to find a good metaphor to explain memory allocation, initialization and freeing in c to a non technical audience. I've heard pass-by-reference/value talked about quite well with postal service usage, but not so much for allocation/deallocation.
So for I've thought about using the idea of renting a space might work, but I wonder if the SO crew can provide something better.
Update/Note:
I think what I'm probably looking for is to get the captures of a group in PHP.
Referenced: PCRE regular expressions using named pattern subroutines.
(Read carefully:)
I have a string that contains a variable number of segments (simplified):
$subject = 'AA BB DD '; // could be 'AA BB DD CC EE ' as well
I would like now to match the segments and return them via the matches array:
$pattern = '/^(([a-z]+) )+$/i';
$result = preg_match_all($pattern, $subject, $matches);
This will only return the last match for the capture group 2: DD.
Is there a way that I can retrieve all subpattern captures (AA, BB, DD) with one regex execution? Isn't preg_match_all suitable for this?
This question is a generalization.
Both the $subject and $pattern are simplified. Naturally with such the general list of AA, BB, .. is much more easy to extract with other functions (e.g. explode) or with a variation of the $pattern.
But I'm specifically asking how to return all of the subgroup matches with the preg_...-family of functions.
For a real life case imagine you have multiple (nested) level of a variant amount of subpattern matches.
Example
This is an example in pseudo code to describe a bit of the background. Imagine the following:
Regular definitions of tokens:
CHARS := [a-z]+
PUNCT := [.,!?]
WS := [ ]
$subject get's tokenized based on these. The tokenization is stored inside an array of tokens (type, offset, ...).
That array is then transformed into a string, containing one character per token:
CHARS -> "c"
PUNCT -> "p"
WS -> "s"
So that it's now possible to run regular expressions based on tokens (and not character classes etc.) on the token stream string index. E.g.
regex: (cs)?cp
to express one or more group of chars followed by a punctuation.
As I now can express self-defined tokens as regex, the next step was to build the grammar. This is only an example, this is sort of ABNF style:
words = word | (word space)+ word
word = CHARS+
space = WS
punctuation = PUNCT
If I now compile the grammar for words into a (token) regex I would like to have naturally all subgroup matches of each word.
words = (CHARS+) | ( (CHARS+) WS )+ (CHARS+) # words resolved to tokens
words = (c+)|((c+)s)+c+ # words resolved to regex
I could code until this point. Then I ran into the problem that the sub-group matches did only contain their last match.
So I have the option to either create an automata for the grammar on my own (which I would like to prevent to keep the grammar expressions generic) or to somewhat make preg_match working for me somehow so I can spare that.
That's basically all. Probably now it's understandable why I simplified the question.
Related:
pcrepattern man page
Get repeated matches with preg_match_all()
I want to remove hyphens (-), slashes (/) and white space () from a string name(i) so that I can use it as a structure field name.
This is the ugly way I am currently doing it using the function strrep:
cell2mat(strrep(strrep(strrep(name(i), '-',''),'/',''),' ', ''))
I have also tried other variations, such as:
strrep(name(i),{'-','/'},{'',''});
strrep(name(i),['-','/'],['','']);
What is a more efficient way of doing this?
Hi,
I have installed "Damn Small Linux" on my home computer for doing C development in unix. But the distribution doesn't by default come with the C development environment and I am facing some issues when trying to install the gcc.
Is there any other small Linux distribution which by default has the required packages for the C development. And also I don't want additional software which takes up lot of space but still would like to have the graphical environment.
Thanks
I'm running a small web application with SQL server express (2005) as backend. I can create a backup with a SQL script, however, I'd like to schedule this on a daily basis. As extra option (should-have) I'd like to keep only the last X backups (for space-saving reasons obviously) Any pointers?
[edit] SQL server agent is unavailable in SQL server express...
Hi,
Firstable i want to match if a string has the following format: $abc #xyz or $abc .xyz.
The abc and xyz mean only alphanumeric string.
If it's matched then i need to extract the first $abc and the last #xyz, all that using pure javascript and maybe regex.
The pattern is in the following order:
Dollar Sign
Unlimited alphanumeric string
space
a hash or point
Unlimited alphanumeric string
Thanks in advance for any help.
I have a scheduled task that is very IO intensive (deleting hundreds of thousands of files). For disk space reasons, this job has to be performed reasonably quickly. On win2k8, scheduled tasks always have a low IO priority. Raising the priority of the process did not change the IO priority. Is there any way to get a scheduled task to have a normal IO priority?
I have table that gets dynamically created.
When using jQuery and toggle, everything works. I however get a small visual glitch - it seems the HTML sometimes get selected. How would I disable this on a faulty drag or mouse operation?
Is there a difference in the DOM between text in a cell and 'not text' or buffered space in a td?
Thanks in advance.
Windows has VirtualAlloc, which allows you to reserve a contiguous region of address space, but not actually use any physical memory. Later when you want to use it (or part of it) you call VirtualAlloc again to commit the region of previously reserved pages.
This is actually really useful, but I want to eventually port my application to linux - so I don't want to use it if I can't port it later. Does linux have a way to do this?
The shared library is causing much trouble for me, and disk space is far less expensive than the trouble itself.
How can I convert all shared libs(.dll) to static libs(.lib) and make my programe use them instead of using shared libs?
Note some .dlls are not directly refered to by my programe,e.g. my programe requires libpng,and libpng requires zlib.dll.
Is there a solution that wraps up all these cases?