Is there any method in java to generate random number (integer, byte or float). please tell me if any i need it in my program. if possible please give full example. thanks.

Member Avatar
Member Avatar
+1 forum 12

Hi, guys I am working on vb project, which will save client database. I've done the coding of ADD, NEW, SAVE, EDIT button. Now, I am stuck at DELETE button. When I delete any particular client then I want my client_id (it's a column in my access database) should get updated (like if I have five clients in database and if I delete 3rd client, then the client_id should start from 1,2,3,4; not like 1,2,4,5) I am using ADODB and Ms-access at backend, please help!!!!! for DELETE, I've done following coding: [CODE]Private Sub cmdDelete_Click() If rs.State = 1 Then rs.Close …

Member Avatar
Member Avatar
+0 forum 11

#include<iostream.h> #include<stdlib.h> #include<conio.h> void main() { clrscr(); //char serial[]="EXAMS"; //int number[]={69,66,67,68}; randomize(); char planets[][10]={"Mercury","Venus","earth","Mars"}; //cout<<number[random(1)]; for(int i=0;i<4;i++) cout<<"::"<<planets[sizeof(char)+random(3)-1]; getch(); } How to calculate the output for it. Options: 1::venus::mercury::mars::earth 2::earth::mercury::venus::earth:: 3::mercury::earth::mercury::earth 4::mars::mercury::venus::earth

Member Avatar
Member Avatar
+0 forum 2

This program challenge was given to me by my Professor for extra credit. He said it includes some programming that we haven't learned yet in our C++ class. Messed up... Ideally I would love if someone would do this for me, but we all know that's not happening. lol Anyways...could anybody offer an idea of what I would do/use? [COLOR="Green"]"Write a program that will convert Roman numerals to Arabic numbers or Arabic numbers to Roman numerals. Your program should prompt the user to select the type of conversion they would like to perform, Roman to Arabic or Arabic to Roman, …

Member Avatar
Member Avatar
+0 forum 14

One of the most, if not THE most, beautiful formulas in math, is from Euler: ![Euler_e_pi_i.png](/attachments/large/1/b32f45540a27b3efc328d14c60ee286c.png "align-center") It combines in it a relation between the number **e**, the number **Pi** and the complex number **i**, plus the basic math symbols 1, +, = and zero. Is that not amazing? More info on this formula can be found [here](https://en.wikipedia.org/wiki/Euler's_formula). The Complex type in C# is available as of .NET v4.0 and lives in the System.Numerics namespace. As this type is not used on a regular basis it is not included as reference in every project by default. So you have to …

Member Avatar
Member Avatar
+1 forum 7

Hi all, I need to obtain the fractional part of a double. AFAIK C# and .NET has no such function. Have a few options here:(x is a double) `x - (int)x` `x - Math.Truncate(x)` Convert to a string and extract the fraction... Perhaps someone knows other options? Which should I choose or does it not matter that much? Thanks in advance for some answers. :)

Member Avatar
Member Avatar
+0 forum 6

Needed a func to convert base 2 into 10, and back. Found the referenced code in this func for moving between three bases, and generalized it to between bases 2 and 62, and all in between. Upconvert a number, then down convert, then upconvert again. Go wild, have fun.

Member Avatar
+0 forum 0

Hi my friends! Here is a wrong code, Wrong and I don't know why. My purpose is to make a **sieve of Erasthotene**. I make an unique function with many inner loops. But the execution **don't go cross the lines** I illustrate this with the help of printing the different steps of the script. If someone can poiint out some **error** or lack of understanding, he is welcome an I am grateful! HERE IS THE CODE: from math import sqrt def holeofStrainer(): bigList = [False, False] + [True]*100 print("line 4 - bigList : ", bigList) for num in range(2, 101): …

Member Avatar
+0 forum 0

Hello, i was wondering if i could get an opinion on the following code as it is giving me a headache: int counter = 498853097; int k = 0; clock_t start, end; float seconds1,seconds2; start = clock(); for (int i = 0; i < counter; i++) { k++; } end = clock(); seconds2 = (float)(end - start) / CLOCKS_PER_SEC; start = clock(); for (int i = 0; i < counter; i++); end = clock(); seconds1 = (float)(end - start) / CLOCKS_PER_SEC; printf("\n Time 2 [%f] - Time 1 [%f] = %f",seconds2,seconds1,seconds2-seconds1); It's the exact same repetition twice, except one of …

Member Avatar
Member Avatar
+0 forum 2

Hello everyone i have a little problem over here im making share button so i want to update the database on the column 'isShared' with value `1` so here is my code but it doesnt work, all the time is showing me `Already shared ticket!` Here is the code: if(isset($_POST['share'])) { $user = getUserData('kladilnica', 'Username'); $shared1 = getUserData('kladilnica', 'isShared'); $sql = "SELECT `isShared` FROM kladilnica WHERE Username='".$user."'"; $result = $conn->query($sql); while($row = $result->fetch_assoc()) { $shared = $row["isShared"]; if($shared == 1){ echo "<b>Already shared ticket!</b>"; } else if($shared == 0){ echo "<b>Ticket shared succesfully.</b>"; } } } Btw if someone knows …

Member Avatar
Member Avatar
+0 forum 13

Hello. I have a list like this: mylist = [7, "+", 2, "+", 1] I want to take them out of the list inorder to run the operation and get the real result; something like this: result = 7 + 2 + 1 So the result variable will be set to 10. How can i do that?!

Member Avatar
Member Avatar
+0 forum 5

I need to output the smallest number that is entered. I can't seem to figure out how to do it though. Thanks in advance. small.cpp #include <iostream> #include <algorithm> #include "arrayListType.h" using namespace std; int main() { arrayListType<int> intList(100); // int min(int first, int last); int counter; int number; cout<< "Enter 5 integers: "; for (counter = 0; counter < 5; counter++) // Use of for loop to enter intListinsertat { cin >> number; intList.insertAt(counter, number); } cout << endl; cout << "The list you entered is: "; intList.print(); cout << "The smallest number is: "; intList.print(); cout << endl; …

Member Avatar
Member Avatar
+0 forum 11

Hello everyone i want to make a random number generator and also to check the numbers, and if that number exist in the database than to generate other number... thank you :)

Member Avatar
Member Avatar
+0 forum 2

i have a database table with fields mobno1 and mobno2, first i would like store all the values of field mobno1 into var1 and field mobno2 into var2 by using comma seperator and pdo. my code is as follows. $pdo = Database::connect(); $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $sql = "SELECT mobno1,mobno2 FROM custreg"; $q = $pdo->prepare($sql); $q->execute(); $data = $q->fetch(PDO::FETCH_ASSOC); $mobile_number1=$data['mobno1']; $mobile_number2=$data['mobno2']; Database::disconnect(); $message = urlencode($tempmsg); // Prepare data for POST request $data = "user=".$cpuser."&password=".$cppass."&mobiles=".$mobile_number1.",".$mobile_number2."&sms=".$message."&senderid=".$cpsender; // Send the POST request with cURL $ch = curl_init('http://msg.sendsms.com/sendsms.jsp'); //note https for SSL curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $output = curl_exec($ch); //This is …

Member Avatar
Member Avatar
+0 forum 6

Hi. so i have a div/form like this: ![957d3e17b3579941c6bf92e594745d43](/attachments/large/4/957d3e17b3579941c6bf92e594745d43.jpg "957d3e17b3579941c6bf92e594745d43") depending on the drop down value chosen that number of forms will appear like if value 2 chosen then 2 forms will appear if 4 then 4. the code is this: $("select[name=children]").on("change", function(){ var num_forms = $(this).val(); var form = div.clone(); var target = $("#the-child-form"); for(var i = 0; i < num_forms; i++) { var clones = form.clone(); clones.show(); clones.prependTo(target); } }); the thing with the code is that say for example value 1 was chosen by accident but u wanted to choose 2 so now u choose 2 but …

Member Avatar
Member Avatar
+0 forum 1

Hi, so i have an input text `<input type="text" name="numguest" id="number-of-guests">` and a button `Okay`. When a number say, 4 is entered into that text box and clicked okay, 4 of this text box `<input type="text" name="guest-name[]" placeholder="Guest Name" id="text-gname">` will appear. i tried: $("#okay").on("click", function(){ var num_of_guests = $("#number-of-guests").val(); alert(num_of_guests); var input_text = $("#text-gname").clone(); var target = $(".guests-tbody"); for(var i = 0; i < num_of_guests; i++) { var clone = input_text.clone(); clone.attr('id','style', ''); target.append(clone); Hide(); } }); but nothing seems to be happening except fot the alert and Hide function. TIA

Member Avatar
Member Avatar
+0 forum 3

Hello. I am a complete newbit to Python. I am trying to read a text file (which is actually an svg file) and add a line to the text file. I would also like to remove certain text from the file. I am trying to edit some of the tags in the file. Here is the code that I have so far. I have only figured out how to read the file and append to it. But I don't know how to do actual edits. def main(): f = open("F01.svg", "r") if f.mode == 'r': fl = f.readlines() for x …

Member Avatar
Member Avatar
+0 forum 2

I [saw interesting problem](http://www.daniweb.com/software-development/legacy-languages/threads/478323/prolog) of generating spiral of numbers and realized I could reuse [my code for rotation](http://www.daniweb.com/software-development/python/code/371536/rotate-sequences-left-or-right) I posted earlier.

Member Avatar
+3 forum 0

Friends , Is there any way for data alignment in the list box. My code is given below Private Sub TxtFdt_KeyPress(KeyAscii As Integer) Dim L, L1, L2, L3, L4, L5 As Integer Select Case KeyAscii Case vbKeyReturn If TRS.State = adStateOpen Then TRS.Close TRS.Open "SELECT * FROM Tran WHERE Ac = '" & TxtAc.Text & "'" & "and Acno=" & Val(TxtAcno.Text) & "and Tdate>= #" & TxtFdt.Text & "#" & "ORDER by Tdate,Trnno", CN, adOpenStatic, adLockOptimistic If TRS.RecordCount = 0 Then MsgBox "NO TRANSACTION FOR THIS PERIOD !", vbInformation, "PEBBLE" TxtFdt.SetFocus Else TRS.MoveFirst List1.Clear Do Until TRS.EOF L = Len(Left(TRS!Tdate, …

Member Avatar
Member Avatar
+0 forum 2

My Name is Leonard E. Norwood Jr. I'm Undergraduate student from Norfolk State University in Norfolk Virginia. Getting down to the point, my program is supposed to print out a list of pre-set numbers in reversal. I used pointers for this, however, something went wrong so I'm trying my best to trace this program and assume that there is something wrong with one of the for loops that is causing something to happen. This program can compile but nothing is happening, I just need some slight assitance. #include <stdio.h> { int i, j; float ar[5] = {12.75, 18.34, 9.85, 23.78, …

Member Avatar
Member Avatar
+0 forum 6

IS IT POSSIBLE TO PASS AN ARRAY INTO A FUNCTION AND THEN CALCULATE THE PRIME NUMBERS OUT OF THE LIST?

Member Avatar
Member Avatar
+1 forum 2

here i am using fpdf class to generate pdf document, how to print serial numbers in SL.NO. column in sequential order i.e. 1 2 3 4 5 ... so on. <?php include_once('include/dbConnect.inc.php'); require('fpdf.php'); $d=date('d_m_Y'); $agentid=mysql_real_escape_string($_GET['agent']); $agent_name=mysql_real_escape_string($_GET['agentname']); // Query to select an int column $query = "select count(*) as cnt from custreg where magentid = '$agentid'"; $result = mysql_query($query); $cntrow = mysql_fetch_row($result); class PDF extends FPDF { // Page header function Header() { global $agent_name; global $agentid; global $number; // Logo $this->Image('images/logo.png',10,6,30); // Arial bold 15 $this->SetFont('Arial','B',15); // Move to the right $this->Cell(80); // Title $this->Cell(5,1,'Customer Payment Details',0,0,'C'); $this->Cell(10,15,'Agent ID: '.$agentid.' …

Member Avatar
Member Avatar
+0 forum 2

Program Design

Member Avatar
Member Avatar
+0 forum 1

Hi, I need to List a number in a listbox if the number is closer to another number. Eg. Num1 = 98 Num2 =100 If 'num1 is close to num2' Then Listbox1.Items.Add(num1) End If Please Help Me. Thanks.

Member Avatar
Member Avatar
+0 forum 1

I need to find a digit at a specific postion in a number. Example number 652796, user inputs a 4, "2" is displayed. I have the basis for it, but most of the time, the output is incorrect. Not sure what's wrong. #include <iostream> #include <cmath> using std::cout; using std::cin; int main () { int number = 0, digits = 0, position = 0, result = 0; cout << "Enter a number: "; cin >> number; cout << "Enter a digit position:"; cin >> position; if ( 0 == number) { cout << "0"; } while (position-- > 1) { …

Member Avatar
Member Avatar
+0 forum 2

#include <stdio.h> Reverse Number In C Program int main() { int n, reverse = 0; printf("Enter a number to reverse\n"); scanf("%d",&n); while (n != 0) { reverse = reverse * 10; reverse = reverse + n%10; n = n/10; } printf("Reverse of entered number is = %d\n", reverse); return 0; }

Member Avatar
Member Avatar
+0 forum 4

Having subscribed to the mailing list, I got barraged with hundreds (it seemed like) emails every day. Is there any way to cut down on these? It took me over half an hour to delete them all! My mail provider warned me that my account was "dangerously" full. ;)

Member Avatar
Member Avatar
+0 forum 5

I’m trying to create a textbox, where the user enters a number, and the output shows a word representing each digit, each word is in an individual label created by the code, regardless of how many digits are entered. So if the user enters 153, the output will be: one five three I’m not sure how to break the input apart to separate each digit and create a label accordingly to the number of digits entered (e.g. if 3 digit number, create 3 labels). I know that after breaking the input apart, run those separated digits through case select, and …

Member Avatar
Member Avatar
+0 forum 14

I want to make and If statement which will work when a double "credits" is between 1 and 9. But I'm not sure how to. Will If (1 <= credits => 9) Then Work?

Member Avatar
Member Avatar
+0 forum 3

Im having a problem with this. I want to echo out the number of post from every city in N.C Example: Wilmington (24) <--*24 is the number of post. Charlotte (35) Raleigh (15) include "connect.php"; $wil ='Wilmington'; $cnt = mysql_num_rows(mysql_query("SELECT add_city FROM dbAdd WHERE $add_city='$wil' ")); echo $cnt; This is the database. CREATE TABLE `dbAdd` ( `id` BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY , `add_user` TEXT NOT NULL , `add_city` VARCHAR( 100 ) NOT NULL ) ENGINE = MYISAM ;

Member Avatar
Member Avatar
+0 forum 4

The End.