Hello, In a label, I am displaying the number of characters left in a textbox. Once the user goes into negative characters remaining, the label text turns red. If they try to submit the form, an alert message will popup letting them know they have exceeding the limit of characters. I am not sure how to store the state(text and color) of the label so that after the button click, when the page reloads, it will go back to what it was. Everytime it reloads, it goes back to "500 Characters Remaining" - which is the limit I am setting. …

Member Avatar
Member Avatar
+0 forum 2

Hello, I am trying to incorporate Javascript with ASP. I want to display in the Label how many characters the client has remaining in the textbox. The Label is not changing at all - any ideas? <script type="text/javascript"> function CheckCharCount(textBox, maxLength) { var charCount = maxLength - texBox.value.length; document.getElementById("lblCharCount").innerText = "; if (charCount >= 0) { //within limit - display in black document.getElementById("lblCharCount").style.color = "black"; } else { //negative chars - display in red document.getElementById("lblCharCount").style.color = "red"; } } </script> <form runat="server"> <div> <asp:Label ID="lblCharCount" runat="server">500 Characters Remaining</asp:Label> <asp:TextBox ID="textBox" runat="server" Height="53px" TextMode="MultiLine" onkeyup="CheckCharCounter(this, 500)"/> </div> </form> Thanks, Brittany

Member Avatar
Member Avatar
+0 forum 1

Hello, I am trying to enlarge the font-size of an ASP:ListItem object using CSS. I have tried a few different ways - but it is not rendering. Any ideas on what would cause the ListItem to not pick up the CSS? **First try:** CSSClass="radioButtonList" under asp:RadioButtonList <style type="text/css"> .radioButtonList { font-size:10em; } .indenting { padding-left: 40px; } </style> <asp:RadioButtonList ID="RequestOptions" CSSClass="radioButtonList" runat="server"> <asp:ListItem Value="0">Hello World<br/><span class="indenting">World</span></asp:ListItem> <asp:ListItem Value="1">Hello Again<br/><span class="indenting">Again</span></asp:ListItem> </asp:RadioButtonList> **Second try:** CSSClass="radioButtonList" under asp:ListItem <style type="text/css"> .radioButtonList { font-size:10em; } .indenting { padding-left: 40px; } </style> <asp:RadioButtonList ID="RequestOptions" runat="server"> <asp:ListItem Value="0" CSSClass="radioButtonList">Hello World<br/><span class="indenting">World</span></asp:ListItem> <asp:ListItem Value="1" CSSClass="radioButtonList">Hello Again<br/><span …

Member Avatar
Member Avatar
+0 forum 5

Hey, I am writing a program that takes the size of an nxn matrix [A], randomly creates that matrix, as well as an nx1 matrix [S], multiplies them together to create [A]*[S]=[B]. Then, using Gaussian Elimination, I use matrix [A] and [B] to find [x] such that [A]*[x]=[B]. I can see that I am not going about my algorithm the right way for this, and if anyone has some insight on what may be going wrong, I would appreciate it. I can tell based on the fact that [x] and [S] are not even a smidge close to each other. …

Member Avatar
Member Avatar
+0 forum 3

I've made a Matrix class that contains arrays, however I'd like to inherit the array class if possible. I've done some searching online and can't find any solid information on this. Does anyone know if I can even inherit this class? If so, do you have a good site with some reference info I can bookmark? If anyone may have any other ideas on a container class to inherit for a Matrix class, feel free to share :) Thanks, Miss VavaZoom

Member Avatar
Member Avatar
+0 forum 6

I have a Matrix class and I am trying to overload the multiplication sign. It compiles without error and runs, however it does not display the matrix like it should. So I want to make sure the error is not in my overload operation. [CODE] public static Matrix operator *(Matrix lhs, Matrix rhs) { Matrix temp = new Matrix(); temp.matrix = new double[rhs.getRow(), rhs.getCol()]; for (int i = 0; i < lhs.getRow(); i++) { for (int j = 0; j < lhs.getCol(); j++) { temp.matrix[i,0] += lhs.matrix[i,j] * rhs.matrix[j,0]; } } return temp; }[/CODE] This is my display function, so …

Member Avatar
Member Avatar
+0 forum 9

I'm working on a project that utilizes producers and consumers for an operating systems class. Each producer and each consumer will be its own thread. The producers will generate records that will be stored in a global buffer, in which the consumer will then access to use the data. I am having a hard time figuring out how to use actual pthreads. My original plan was to create a Producer class and a Consumer class and simulate the threads, but we are told now not to do so. Is there a c++ class for this? Also, for the buffer, I …

Member Avatar
Member Avatar
+0 forum 10

I'm trying to create a random float generator. The float must be 2 decimal places and between the values 0.50 and 999.99. I tried casting rand() to a float below, which didn't work. I'd still like to know the reason this didn't work. [CODE] saleAmount = ((float)rand() % 99950.00 + 50.00 ) / 100.00; [/CODE] To make rand() a float with 2 decimal places, I did the following, which did work. [CODE] saleAmount = rand()*1.01; [/CODE] I've also tried using fmod, however I can't figure out how to get the outcome between the 2 boundaries. Any suggestions or helpful tips? …

Member Avatar
Member Avatar
+0 forum 2

[CODE] #include <iostream> #include <fstream> using namespace std; int main (int argc, char* argv[]) { int length; char * buffer; string searchWord = argv[2]; string compareStr; int searchSize = searchWord.size(); ifstream readFile; readFile.open (argv[1], ios::in ); ofstream writeFile; writeFile.open("newData.txt", ios::out); readFile.seekg (0, ios::end); length = readFile.tellg(); readFile.seekg (0, ios::beg); buffer = new char [length]; while(!readFile.eof()) { readFile.getline(buffer, length); compareStr = ""; for (int i = 0; i < searchSize; ++i) { compareStr += buffer[i]; } if (searchWord.compare(compareStr) == 0) { writeFile << buffer << "\n"; } } readFile.close(); writeFile.close(); delete[] buffer; return 0; } [/CODE] I am running on Windows …

Member Avatar
Member Avatar
+0 forum 5

I am trying to extract data from a 1.5 GB text file. The problem occurs when the program tries to open the large text file. It works perfectly on smaller files. Does anyone know how to successfully open a file of this size? Or, is there a better way to extract the data? The objective is to go line by line, searching for a specific value in the first column of the data text file...and extracting the entire line...writing it to a new file. Here is what I have: [CODE] #include <iostream> #include <fstream> #include <string> using namespace std; const …

Member Avatar
Member Avatar
+0 forum 1

I am trying to extract data from a 1.5 GB text file. The problem occurs when the program tries to open the large text file. It works perfectly on smaller files. Does anyone know how to successfully open a file of this size? Or, is there a better way to extract the data? The objective is to go line by line, searching for a specific value in the first column of the data text file...and extracting the entire line...writing it to a new file. Here is what I have: [CODE] #include <iostream> #include <fstream> #include <string> using namespace std; const …

Member Avatar
+0 forum 0

I've been trying to defrag my local disk C, however it only shows the D drive. Even when I right click on C and get to the defrag via properties it shows D only. Any suggestions?

Member Avatar
Member Avatar
+0 forum 3

I'm having an issue with the elimination portion of my Gaussian Elimination problem. The program crashes while running, I can't figure out what is causing the wrong rows to switch, and why it is not eliminating correctly. [CODE]void Matrix::gaussianElimination() { int i, j, max; for(j = 0; j < N; ++j) { i = j; max = i++; for(max = i++; max < N; max++) while(max < N) { if (fabs(C[i][j]) >= fabs(C[max][j])) ++max; else { i = max++; } } if(C[max][j] == 0) { E = 0; return; } //If p > j: interchange rows p & j if(max …

Member Avatar
Member Avatar
+0 forum 4

Hey...I'm working on a Gaussian elimination problem...my pivot doesn't seem to work correctly...the logic must be wrong. Also, does anyone know why "INFINITY" comes up as some of my random numbers chosen? Thanks in advance for any help! :) [code] Matrix::Matrix():N(0) { //Empty Matrix by default } Matrix::Matrix(int n) { N = n; A = new double * [N]; for(int i = 0; i < N; i++) { A[i] = new double [N]; } s = new double [N]; b = new double [N]; for( int i = 0 ; i < N; ++i){ b[i] = 0.00; } } void …

Member Avatar
Member Avatar
+0 forum 10

The End.