Search Results

Search found 2558 results on 103 pages for 'significant digits'.

Page 45/103 | < Previous Page | 41 42 43 44 45 46 47 48 49 50 51 52  | Next Page >

  • get last 5 character vb.net

    - by Chocho
    i want to get the last 5 digits/strings from a strings of words. eg: "I will be going to school in 2011!" i am using visual studio.net 2008 and using vb.net. i will like to get "2011!" note, my strings changes, and the last 5 characters can be anything! any ideas. i know visual basic have Right(string, 5); this didn't work for me gave me an error. thanks

    Read the article

  • Fast dot product for a very special case

    - by psihodelia
    Given a vector X of size L, where every scalar element of X is from a binary set {0,1}, it is to find a dot product z=dot(X,Y) if vector Y of size L consists of the integer-valued elements. I suggest, there must exist a very fast way to do it. Let's say we have L=4; X[L]={1, 0, 0, 1}; Y[L]={-4, 2, 1, 0} and we have to find z=X[0]*Y[0] + X[1]*Y[1] + X[2]*Y[2] + X[3]*Y[3] (which in this case will give us -4). It is obvious that X can be represented using binary digits, e.g. an integer type int32 for L=32. Then, all what we have to do is to find a dot product of this integer with an array of 32 integers. Do you have any idea or suggestions how to do it very fast?

    Read the article

  • How to save array of integer numbers in a column in SQL Server 2005

    - by hamed
    I have a table in SQL Server 2005 with the following properties: Users (UserID, Username, Password) where UserID is primary key I want to save an array of integer numbers in the password attribute in the Users table. -------------------- 0 1 2 3 -------------------- 1543 6543 7658 8765 -------------------- I plan to save this into the password column. On the other hand I use pictures instead of texts for password and each picture has a code (4 digit) and a password include 4 picture that produce 16 digit. I want to save these 16 digits (array of Ints) into the Password column please help me. thanks

    Read the article

  • How to output an array's content in columns in BASH.

    - by Arko
    I wanted to display a long list of strings from an array. Right now, my script run through a for loop echoing each value to the standard output: for value in ${values[@]} do echo $value done Yeah, that's pretty ugly! And the one column listing is pretty long too... I was wondering if i can find a command or builtin helping me to display all those values in columns, like the ls command does by default when listing a directory (ls -C). [Update] Losing my brain with column not displaying properly formatted columns, here's more info: The values: $ values=( 01----7 02----7 03-----8 04----7 05-----8 06-----8 07-----8 08-----8 09---6 10----7 11----7 12----7 13----7 14-----8 15-----8 16----7 17----7 18---6 19-----8 20-----8 21-----8) (Notice the first two digits as an index and the last one indicating the string length for readability) The command: echo " ${values[@]/%/$'\n'}" | column The result: Something is going wrong...

    Read the article

  • Regex: How to match a unix datestamp?

    - by Jono
    I'd like to be able to match this entire line (to highlight this sort of thing in vim): Fri Mar 18 14:10:23 ICT 2011. I'm trying to do it by finding a line that contains ICT 20 (first two digits of the year of the year), like this: syntax match myDate /^*ICT 20*$/, but I can't get it working. I'm very new to regex. Basically what I want to say: find a line that contains "ICT 20" and can have anything on either side of it, and match that whole line. Is there an easy way to do this?

    Read the article

  • How to format a string as a telephone number in C#

    - by Brian G
    I have a string "1112224444' it is a telephone number. I want to format as 111-222-4444 before I store it in a file. It is on a datarecord and I would prefer to be able to do this without assigning a new variable. I was thinking: String.Format("{0:###-###-####}", i["MyPhone"].ToString() ); but that does not seem to do the trick. ** UPDATE ** Ok. I went with this solution Convert.ToInt64(i["Customer Phone"]).ToString("###-###-#### ####") Now its gets messed up when the extension is less than 4 digits. It will fill in the numbers from the right. so 1112224444 333 becomes 11-221-244 3334 Any ideas?

    Read the article

  • problem with the programme!!

    - by hopefulLLl
    kindly tell me what is the pblm with this function wont it help me find the sum of digits of a number?? #include<stdio.h> #include(math.h) void main() { int a,i=0,j=10,k,n=0,m; scanf("%d",&a); while((a%j!=0)&&i>=0) { m=pow(10,(i+1)); k=a%m; n=(a-(k*m)-n)/(m/10)+n; j=m*10; i++; } n=n+(n/(m/10)); printf("%d",n); } i know the parenthesis used with math.h are nt right..what else is the pblm..i need to use just while loop..or the for loop!

    Read the article

  • Valid Email Addresses - XSS and SQL Injection

    - by PAAMAYIM_NEKUDOTAYIM
    Since there are so many valid characters for email addresses, are there any valid email addresses that can in themselves be XSS attacks or SQL injections? I couldn't find any information on this on the web. The local-part of the e-mail address may use any of these ASCII characters: Uppercase and lowercase English letters (a–z, A–Z) Digits 0 to 9 Characters ! # $ % & ' * + - / = ? ^ _ ` { | } ~ Character . (dot, period, full stop) provided that it is not the last character, and provided also that it does not appear two or more times consecutively (e.g. [email protected]). http://en.wikipedia.org/wiki/E-mail_address#RFC_specification I'm not asking how to prevent these attacks (I'm already using parametrized queries and HTML purifier), this is more a proof-of-concept. The first thing that came to mind was 'OR [email protected], except that spaces are not allowed. Do all SQL injections require spaces?

    Read the article

  • Switch to BigInteger if necessary

    - by fahdshariff
    I am reading a text file which contains numbers in the range [1, 10^100]. I am then performing a sequence of arithmetic operations on each number. I would like to use a BigInteger only if the number is out of the int/long range. One approach would be to count how many digits there are in the string and switch to BigInteger if there are too many. Otherwise I'd just use primitive arithmetic as it is faster. Is there a better way? Is there any reason why Java could not do this automatically i.e. switch to BigInteger if an int was too small? This way we would not have to worry about overflows.

    Read the article

  • Use JS to add characters into textfield

    - by Thomas
    I want to add a $ symbol before a users entry into a text field without actually submitting the $ when the user clicks submit. Additionally, I need to prohibit the user from entering anything but numerical values in to the text input. I know about the JQuery input mask (http://www.conetrees.com/2009/03/blog/jquery-masked-input-plugin-increase-usability-for-masked-format-input-fields) but this plugin requires you to set the exact number of digits/letters that the user is supposed to enter, which is no good for my current project. Can anyone think of a way to accomplish what I have described above?

    Read the article

  • How do I get the median/mode/range of a column in SQL using Java?

    - by Derek
    I have to get the median, mode and range of test scores from one column in a table but I am unsure how to go about doing that. When you connect to the database using java, you are normally returned a ResultSet that you can make a table or something out of but how do you get particular numbers or digits? Is there an SQL command to get the median/mode/range or will I have to calculate this myself, and how do you pull out numbers from the table in order to be able to calculate the mode/median/range? Thanks.

    Read the article

  • Getting user data from Active Directory using PL/SQL

    - by David Neale
    I had a discussion today regarding an Oracle procedure I wrote some time ago. I wanted to get 7500 user email addresses from Active Directory using PL/SQL. AD will return a maximum of 1000 rows and the LDAP provider used by Oracle will not support paging. Therefore, my solution was to filter on the last two characters of the sAMAccountName (*00,*01,*02...etc.). This results in 126 queries (100 for account names ending in digits, 26 for those ending in a letter...this was sufficient for my AD setup). The person I was speaking to (it was a job interview by the way) said he could have done it a better way, but he would not tell me what that method was. Could anybody hazard a guess at what this method was?

    Read the article

  • extension method phone format with country code as parameter

    - by frenchie
    Hi, I'm writing an extension method called ToPhoneFormat that formats a string of digits to phone numbers. Is it possible to add a parameter to the method that would enable me to call it like this: MyPhoneString.ToPhoneFormat(international code) That way, I could write MyPhoneString.ToPhoneFormat(1); to format a US phone number and MyPhoneString.ToPhoneFormat(33) to format a French phone number. I already wrote the method that does the formatting but I'm wondering how to build the constructor so that it works with a parameter when I'm calling it. Thanks.

    Read the article

  • Regular Expression to return the contents of a HTML tag received as a string of text

    - by Nathan Hernandez
    I have a string in my code that I receive that contains some html tags. It is not part of the HTML page being displayed so I cannot grab the html tag contents using the DOM (i.e. document.getElementById('tag id').firstChild.data); So, for example within the string of text would appear a tag like this: 12 My question is how would I use a regular expression to access the '12' numeric digit in this example? This quantity could be any number of digits (i.e. it is not always a double digit). I have tried some regular expressions, but always end up getting the full span tag returned along with the contents. I only want the '12' in the example above, not the surrounding tag. The id of the tags will always be 'myQty' in the string of text I receive. Thanks in advance for any help!

    Read the article

  • Automatically CONCATENATE text on data entry

    - by Bill T
    I am a newbie and need help. I have a table called "Employees". It has 2 fields [number] and [encode]. I want to automatically take whatever number is entered into [number] and store it in [encode] so that it is preceded by the appropriate amount of 0's to always make 12 digits. Example: user enters '123' into [number], '000000000123' is automatically stored in [encode] user enters '123456789' into [number], '000123456789' is automatically stored in [encode] I think i want to write a trigger to accomplish this. I think that would make it happen at the time of data entry. is that right? The main idea is would be something like this: variable1 = LENGTH [number] variable2 = REPEAT (0,12-variable1) variable3 = CONCATENATE (variable2, [number]) [encode] = variable3 I just don't know enough to make this happen ANY help would be FANTASTIC. I have SQL-SERVER 2005 and both fields are text

    Read the article

  • Why does my regex fail when the number ends in 0?

    - by Russell C.
    This is a really basic regex question but since I can't seem to figure out why the match is failing in certain circumstances I figured I'd post it to see if anyone else can point out what I'm missing. I'm trying to pull out the 2 sets of digits from strings of the form: 12309123098_102938120938120938 1321312_103810312032123 123123123_10983094854905490 38293827_1293120938129308 I'm using the following code to process each string: if($string && $string =~ /^(\d)+_(\d)+$/) { if(IsInteger($1) && IsInteger($2)) { print "success ('$1','$2')"; } else { print "fail"; } } Where the IsInterger() function is as follows: sub IsInteger { my $integer = shift; if($integer && $integer =~ /^\d+$/) { return 1; } return; } This function seems to work most of the time but fails on the following for some reason: 1287123437_1268098784380 1287123437_1267589971660 Any ideas on why these fail while others succeed? Thanks in advance for your help!

    Read the article

  • What's your favorite implementation of producing the fibonacci sequence?

    - by Terry Donaghe
    Best, most creative, most clever, fastest, smallest, written in weirdest language, etc etc. For those not familiar with this staple of programming exam question / interview question, check this out: Fibonacci Sequence at Wikipedia The question would be, write a simple program which will spit out the first n digits of the Fibonacci sequence. So, if n == 12, we produce: 0 1 1 2 3 5 8 13 21 34 55 89 144 Your implementation becomes more interesting when you set n to larger values. How long does it take your implementation to return a 25 digit sequence? How about 100?

    Read the article

  • How can I retrieve the value of a PASTE (copy-pasta) event in a GWT TextBox?

    - by dominicbri7
    Hello fellow SO members, I want to prevent the user from copy-pasting values in my TextBox IF AND ONLY IF the values do not respect a certain condition. For instance, I created a DigitsOnlyTextBox which will be used for phone numbers. I already made it so only Character.isDigit characters can be typed into the box, and the user cannot copy-paste values into it, using : this.sinkEvents(Event.ONPASTE); and public void onBrowserEvent(Event event) { super.onBrowserEvent(event); // Permet d'empêcher le copier-coller, donc d'entrer des caractères non-numériques if (event.getTypeInt() == Event.ONPASTE) { event.stopPropagation(); event.preventDefault(); } } But I'd like to verify if the copy-pasted String is "digits only" and if so, let the event happen (therefore the text added). tl;dr : see title Thank you for your time. Sincerely.

    Read the article

  • jquery form validate not allow space for username field?

    - by python
    I have used http://bassistance.de/jquery-plugins/jquery-plugin-validation/ my form validate : $("#form_person").validate({ rules: { username: { required: true, minlength: 2, maxlength:15 }, password: { required: true, minlength: 2 }, confirm_password: { required: true, minlength: 2, equalTo: "#password" }, email: { required: true, email: true } }, messages: { username: { required: "Please enter a username", maxlength:"max length 15 digits", minlength: "Your username must consist of at least 2 characters" }, password: { required: "Please provide a password", minlength: "Your password must be at least 5 characters long" }, confirm_password: { required: "Please provide a confirm password", minlength: "Your password must be at least 5 characters long", equalTo: "Please enter the same password as above" } }); Anybody help me to validate not allow space on username? thanks

    Read the article

  • Validating a text box value using javascript

    - by swathi
    Hi all, I have a textbox.The user will be entering entering a number in this box.The user should enter two digits followed by a period "." and another digit.It would look something like 22.3 or 00.5 or 01.2. If the textbox is not empty,I want to enforce a function which validates the value entered by the user(and gives them an alert if the value entered is not according to the format mentioned above) .This function needs to be triggered when the textbox loses its focus.I am not sure how to go ahead in writing this function as i am still new to this. Any help would be appreciated.Thanks in advance. p.s This function should be triggered each time there is a change in the value.Like suppose, the user enters a value 22, then when the textbox loses its focus,the javascript function should be triggered giving them an alert asking the user to change it to the accepted format which is 22.0.The function should be triggered again when the textbox loses its focus(after the change has been done).This time there would not be an alert since the user entered it in the right format.

    Read the article

  • Generate a commutative hash based on three sets of numbers?

    - by DarkAmgine
    I need to generate a commutative hash based on three sets of "score" structs. Each score has a "start", an "end" and a "number". Both start and end are usually huge numbers (8-9 digits) but number is just from 1 to 4. I need them to be commutative so the order does not matter. I'm using XOR at the moment but it seems to be giving bad results. Since I'm working with large large datasets, I'd prefer a performance-friendly solution. Any suggestions? Thanks =] public static int getCustomHash(cnvRegion c1, cnvRegion c2, cnvRegion c3) { int part1 = (c1.startLocation * c2.startLocation * c3.startLocation); int part2 = (c1.endLocation * c2.endLocation * c3.endLocation); int part3 = (c1.copyNumber + c2.copyNumber + c3.copyNumber)*23735160; return part1 ^ part2 ^ part3; }

    Read the article

  • Python: How to write data in file in specific format?

    - by sasha
    i have an array called MAC1_Val: MAC1_Val array([ 1.00000000e+00, -1.00000000e+01, -2.06306600e+02, 2.22635749e+02, 1.00000000e+00, 1.00000000e+01, 1.00000000e+01, -2.06306600e+02, 2.22635749e+02, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 1.00000000e+00, -1.08892735e+01, 1.88607749e+01, 1.03153300e+01, -1.78666757e+01, 3.33333333e-07, -3.33333333e-07, -4.21637021e-05, 4.21637021e-05, 9.98844400e-01, -1.73973001e-03, 1.20938900e-03, 1.87742948e-03, -3.33333333e-03, 6.66666667e-03, -3.33333333e-03, -2.64911064e-01, -2.60959501e+01, 2.81614422e+01, 3.33333333e-03, -6.66666667e-03, 3.33333333e-03, 0.00000000e+00, 0.00000000e+00]) and i want to write in file (.txt) values in specific format like this: 1.000000e+00 -1.000000e+01 -2.063066e+02 2.226357e+02 1.000000e+00 1.000000e+01 ....... note that are 6 digits behind floating point any suggestions how to do this? thanks in advance!

    Read the article

  • Error safe/correcting resource identifier

    - by Martin
    The receiver is my website, the sender is the same but the medium is noisy, a user. He will read an alphanumeric code of length 6 and later input the same code to identify a resource. A good use for a error correcting code, I thought, and rather than do the research I thought I'd just put the question out there. Or I might be going about it the wrong way, since the situation is rather like sending a perfect dictionary along with every transmission. The requirements on the code are simply: 6 alphanumeric digits, to start with until I run out, anyway. If the user gets it wrong I should still be able to identify the right resource. No resource is preferable to the wrong one. Easy to code or have free libraries for .net Any suggestions?

    Read the article

  • Python elegant inverse function of int(string,base)

    - by random guy
    python allows conversions from string to integer using any base in the range [2,36] using: int(string,base) im looking for an elegant inverse function that takes an integer and a base and returns a string for example >>> str_base(224,15) 'ee' i have the following solution: def digit_to_char(digit): if digit < 10: return chr(ord('0') + digit) else: return chr(ord('a') + digit - 10) def str_base(number,base): if number < 0: return '-' + str_base(-number,base) else: (d,m) = divmod(number,base) if d: return str_base(d,base) + digit_to_char(m) else: return digit_to_char(m) note: digit_to_char() works for bases <= 169 arbitrarily using ascii characters after 'z' as digits for bases above 36 is there a python builtin, library function, or a more elegant inverse function of int(string,base) ?

    Read the article

  • Perl Regex Mismatch Issue

    - by Russell C.
    This is a really basic regex question but since I can't seem to figure out why the match is failing in certain circumstances I figured I'd post it to see if anyone else can point out what I'm missing. I'm trying to pull out the 2 sets of digits from strings of the form: 12309123098_102938120938120938 1321312_103810312032123 123123123_10983094854905490 38293827_1293120938129308 I'm using the following code to process each string: if($string && $string =~ /^(\d)+_(\d)+$/) { if(IsInteger($1) && IsInteger($2)) { print "success ('$1','$2')"; } else { print "fail"; } } Where the IsInterger() function is as follows: sub IsInteger { my $integer = shift; if($integer && $integer =~ /^\d+$/) { return 1; } return; } This function seems to work most of the time but fails on the following for some reason: 1287123437_1268098784380 1287123437_1267589971660 Any ideas on why these fail while others succeed? Thanks in advance for your help!

    Read the article

< Previous Page | 41 42 43 44 45 46 47 48 49 50 51 52  | Next Page >