I want to make a simple macro with #define for returning the smaller of two numbers.
How can i do this in C ? Suggest some ideas, and see if you can make it more obfuscated too.
Hi,
i am wrestling with my regex.
I want to allow only letters and numbers and a dot in a username, and 2 to 20 chars long
I thought of something like this
[0-9a-zA-Z]{2,20}
but then 21 chars is also ok, and that's not what i want
Hi,
I'm trying to get a report done and I have a small problem with the twocolums and the line numbering in listings.
The text is on two columns, the listings can be on the two columns as well.
If I put the number=left, the space between the columns is not sufficient and the text from the first column is written over.
Is there any way to ask the listings to put the line numbers "outside" ?
Thanks
I don't want to have to download and install eclipse on this machine, but for you who do have it, what is the first line on the Eclipse IDE? On the left after you enable line numbers in the left hand column, the first number is?
Hi All,
I need to create a larger file, which would be filled by strings and numbers of a certain length.
Eg File content would be like :
Dougan | 15 | Sapient
Patric | 25 | Patni.
IGHIGH | 10 | IHIUDWHKJDBHKJ
I need an outline as to how I can approach this in either c or c++..
Kindly let me know if more information is needed.
Hi I have a table test as below
NAME
---------
abc1234
XYZ12789
a12X8b78Y9c5Z
I try to find out the count of number of numbers and characters in the string as
select name,length(replace(translate(lower(name),'abcdefghijklmnopqrstuvwxyz',' '),' ','')) as char_count,
length(replace(translate(name,'1234567890',' '),' ','')) as num_count
from test6;
Its executing fine giving the output
NAME CHAR_COUNT NUM_COUNT
abc1234 4 3
XYZ12789 5 3
a12X8b78Y9c5Z 7 6
But my question is there any option by not giving the abcdefghijklmnopqrstuvwxyz
and 1234567890 manually
how does one use code to do this:
produce 15 random numbers that are not in any order, and that only occur once
eg.
1 4, 2, 5, 3, 6, 8, 7, 9, 10, 13, 12, 15, 14, 11
rand() or arc4rand() can repeat some, which is not what im after.
Thanks
Hi,
in C++, using printf I want to print a sequence of number, so I get, from a "for" loop;
1
2
...
9
10
11
and I create files from those numbers. But when I list them using "ls" I get
10
11
1
2
..
so instead of trying to solve the problem using bash, I wonder how could I print;
0001
0002
...
0009
0010
0011
and so on
Thanks
What is the simplest way to calculate the amount of even numbers in a range of unsigned integers?
An example: if range is [0...4] then the answer is 3 (0,2,4)
I'm having hard time to think of any simple way. The only solution I came up involved couple of if-statements. Is there a simple line of code that can do this without if-statements or ternary operators?
I already used some script to implement the shortcuts in my web page
but i was wondering if could be possible to associate some combination not syncronic like Ctrl+X but more like a sequence typing 1..2..3 or any other combination to execute a script...
lets assume this example:
you have a long list with numbers:
you could type 3..5...6, so you can go to the item 356 passing trough the item 3 then 35 then 356
more or less like when you type while selecting a select box
i hope it was clear, id not easy to explain...
I'm writing a .NET application that will make an RPC call to a Java application (via a message queue). The data sent in both directions will be large arrays of floating-point numbers. What is the best way to serialize them to send them across the wire? I'd like something more compact than text, but architecture-independent as the server may not be an x86 machine. The Java application can be changed as needed.
Hello all,
How do I remove numbers from a string using Javascript?
I am not very good with regex at all but I think I can use with replace to achieve the above?
It would actually be great if there was something JQuery offered already to do this?
//Something Like this??
var string = 'All23';
string.replace('REGEX', '');
I appreciate any help on this.
I'm working on a customized calculator, which is working pretty well except that I can't figure out how to get the generated numbers to display commas within the number. For example, it might spit out "450000" when I need it to say "450,000". This thread gives a number of suggestions on how to create a new function to deal with the problem, but I'm rather new to JavaScript and I don't really know how to make such a function interact with what I have now. I'd really appreciate any help as to how to get generated numbers with commas! :)
HTML:
<table id="inputValues">
<tr>
<td>Percentage:</td>
<td><input id="sempPer" type="text"></td>
</tr>
<tr>
<td>Price:</td>
<td><input id="unitPrice" type="text"></td>
</tr>
<tr>
<td colspan="2"><input id="button" type="submit" value="Calculate"></td>
</tr>
</table>
<table id="revenue" class="TFtable">
<tr>
<td class="bold">Market Share</td>
<td class="bold">Partner A</td>
<td class="bold">Partner B</td>
</tr>
<tr>
<td class="bold">1%</td>
<td><span id="moss1"></span></td>
<td><span id="semp1"></span></td>
</tr>
</table>
</form>
JavaScript:
<script>
function calc() {
var z = Number(document.getElementById('sempPer').value);
var x = Number(document.getElementById('unitPrice').value);
var y = z / 100;
var dm1 = .01 * 50000 * x * (1-y);
var se1 = .01 * 50000 * x * y;
document.getElementById("moss1").innerHTML= "$"+Number(dm1).toFixed(2);
document.getElementById("semp1").innerHTML= "$"+Number(se1).toFixed(2);
}
</script>
I have an ordered list in ie7 and the list-style-type decimal is not allowing space on two digit numbers
E.G 1. blah blah, blah
12.blah, blah, blah
anyone know of a answer?
$ch is a character.
I need to convert it into 2 numbers like that (example):
$ch = 'A' => ASCII code: 0x41
=> Binary: 0100 0001
=> {4, 1}
What is the easiest and fastest method to achieve this ?
Hi all
There are a lot of numbers like 200 20.5 329.2...in a file. Now, I need replace every number A with A*0.8. Is there any simple method to replace original value with another based on original value?
Best Regards,
I need a regular expression for a list of numbers in a text box with carriage returns and line feeds, but no other characters.
e.g.
1234
5678
5874
3478
I have this:
Regex(@"\d\r\n${0,}?");
... but it is accepting commas when I paste them into my text box:
e.g.
1234,
5678
5874,
3478
Can someone please tell me what I'm doing wrong?
Thanks
I need to write a recursive function that can add two numbers (x, y), assuming y is not negative. I need to do it using two functions which return x-1 and x+1, and I can't use + or - anywhere in the code. I have no idea how to start, any hints?
Created a UITextField for "Postal Code/ZIP" field with a keyboardType of UIKeyboardTypeDefault. I would like to use the default keyboard but want the numbers & symbols to be shown by default as apposed to letters.
Apple does this when you are entering addresses in the Contacts.app.
Anyone know how to get this accomplished?
How would I print the multiples of a list of given numbers in a merged, sorted list?
I.e.
take 10 (multiples [4,5])
gives
4,5,8,10,12,15,16,20,24,25
I've got it working for lists of size 2 or 1 but I need a more general solution :)
hi, first of all this is not homework!!
my question is from book: Algorithms in C++ third edition by robert sedgewick
question is: there is given array of size n by 2^n(two dimensional) and we should fill it by binary numbers with bits size exactly n or
for example n=5 so result will be
00001
00010
00011
00100
00101
00110
00111
and so on we should put this sequence of bits into arrays please help me
Is there a git command to add differences within a range of line-numbers to the index?
I want to be able to select lines in my editor and run a macro to add any changes in the selection to the index.