- Strength to Increase Rep
- +0
- Strength to Decrease Rep
- -0
- Upvotes Received
- 18
- Posts with Upvotes
- 18
- Upvoting Members
- 14
- Downvotes Received
- 0
- Posts with Downvotes
- 0
- Downvoting Members
- 0
77 Posted Topics
Re: Try using the [icode]:not()[/icode] selector. [code=Javascript] $("img:not([alt])").attr("alt", "some text"); [/code] | |
Re: Is the file that you are trying to open from the code already open in Excel application? I think Excel locks open files and only allows them to be opened in read-only mode while the first instance is open. | |
Re: Why will simply assigning the return value to a known variable not work in your case? Is there a unique reason you need to create a named dict inside the function? Usually, you know what you are passing into the function, so it should be feasibile to assign the return … | |
Re: Commit is a method on the connection object. Try [icode]connection.commit()[/icode] | |
Re: What do you mean by "rotate"? Do you want it to change to some other text in the browser while the user is looking at the page? | |
| |
Re: Try processing the file line-by-line. You can use System.IO.StreamReader.ReadLine() method to read the next line. [code=c#] StreamReader reader = new StreamReader(file); string line = null; while ((line = reader.ReadLine()) != null) { if (Regex.IsMatch(line, searchText, RegexOptions.IgnoreCase)) { //TODO: append line to the output here } } [/code] | |
Re: You can run a whole query that produces a scalar result and have it be returned and one column in the result set. [code=sql] select account_id, firstname, lastname, case when exists(select * from flag_table where account_id = account_table.account_id and flag = 'EV1') then 1 else 0 end EV1, case when … | |
Re: If your data has be in text files, do what SgtMe suggested. Alternatively, look into [icode]sqlite3[/icode] python module. It would allow you to create a real database and run sql statements against it to add, modify, and delete records. | |
Re: Check the documentation on [icode]os.path.split[/icode]. I think it returns a tuple [icode](name, extension)[/icode]. [code=python] for fileInArchive in archive.infoiter(): extension = os.path.split(fileInArchive.filename)[1] if extension == "txt": print "This is a text file" [/code] | |
Re: I don't think its feasible to run FileSystemWatcher from a web application. All the callback methods are gone once the page finished processing a web request. The FileSystemWatcher will continue to run in a separate process after your page finished, but will not be able to call any of your … | |
Re: Try the following (if "S_TaskDueDate" is in your $_GET array): [code=php] $WADbSearch1->addComparisonFromEdit("TaskDueDate",uk_to_us_date($_GET["S_TaskDueDate"]),"AND","=",2); [/code] | |
Re: This is a syntax error. Why don't you use a hashtable or an array to hold values related to "the name of the day and a number"? I don't really understand what you are trying to do, so I can't really give you any sample code. | |
Re: [code=python] class Customer(object): def __init__(self, name): self.name = name self.items = {} def gettotal(self): tot = 0 for price in self.items.values(): tot += price return tot def main(): print "Enter 'quit' when being asked for customer's name to quit the program" print "Enter 'done' when being asked for item name … | |
Re: I think its more reliable to use the onclick event handler. [code=html] <!-- The goal is to create the following HTML. --> <a href="#" onclick="addHours('dayDiv'); return false;">Add Hours</a> [/code] [code=javascript] var link = document.createElement("a"); link.setAttribute("href", "#"); link.onclick = function() { addHours('dayDiv'); return false; }; link.innerHTML = "Add Hours"; [/code] Hope … | |
Re: [code=javascript] function periodic() { // do something usefull } // schedule a function to run every 5 minutes setInterval(periodic, 5*60*1000); [/code] | |
Re: [code=html] <html> <head> <script type="text/javascript"> function makeTable() { var html = "<table border=1><tr><th>Name</th></tr><tr><td>Gene</td></tr></table>"; document.getElementById("target").innerHTML = html; } </script> </head> <body> <div id="target"></div> <input type="button" onclick="makeTable();" value="Create Table" /> </body> </html> [/code] NOTE: The code was not tested. | |
Re: You can probably use web server logs to get all requests the web server handled. Then you can analyze those logs (there are tools that do that) and get the number of distinct IP addresses... If that is not what you want, you will need to implement the counting yourself. | |
Re: You were getting error on line 19 because you are trying to add an array (variable a) to a HashSet of Strings. Thats why a String is expected, but you are giving it an array. Change it to [icode]if (!s.add(a[i]))[/icode]. Anyway, using [icode]Scanner.nextLine()[/icode] allows users to enter multiple words per … | |
Re: I don't think its possible. The client-side code must know the URL to which to send the request. You can assign the URL to a javascript variable, the variable could be loaded in another .js file, and then you can substitute that variable for the raw URL when calling the … | |
Re: Try settings the default title in the master page. Then try using the Pre_Render event of the page that needs a different title to overwrite the default title. I think for this to work you need to have your <head> element marked as runat="server". And maybe the title element too. … | |
Re: Here is the javascript code that can send redirect to another page. [code=javascript] var anotherpage = "another.html"; window.location.href = anotherpage; [/code] In your case, while the alert box is visible, no other javascript is executed on the page. This means that you don't need to know when the user clicks … | |
Re: You can produce the total of selected items in Javascript, without sending anything to the server or using the database for that. Of course, when the user will submit the form to purchase selected components, your PHP script will have to calculate the final price and store needed info in … | |
Re: I am not good with VB.NET, so please fix any errors you might encounter. Also, substitute your SQL statement and connection string. [code=VB] 'Declare variables Dim connString as String Dim conn as OdbcConnection Dim cmd as OdbcCommand Dim prm as OdbcParameter Private Sub MainForm_Load(ByVal sender as Object, ByVal e as … | |
Re: [code=java] int[] groups = {10, 23, 29}; public String toString() { String buffer = ""; for (int i=0; i < groups.length; ++i) buffer += i + "(" + groups[i] + ") "; return buffer.trim(); } [/code] | |
Re: When you are reading a file, the API maintains a file pointer which points to where you are in the file. You can think of this as the position of the cursor. When you call [icode]ReadToEnd()[/icode], the data is read from the current position to the end of the file. … | |
Re: If you want any help, you are going to have to post the HTML generated by your aspx page and let everyone know what version of IE you have. If someone is able to recreate the problem, they might be able to help. | |
Re: You need to create an instance of the Currency object before using it and calling its methods. The way you have it done, you are trying to call a static method of the Currency class in the very last line of posted code (and it probably gives you an error … | |
Re: You are generating one [icode]<span id='username_label'>[/icode] for each textarea. Then, when you run [icode]document.getElementById('username_label')[/icode], it returns only the first instance of the element with the given id. You have to assign a different id to all span elements if you want to be able to identify them uniquely. You do … | |
Re: [code=javascript] function Empty() { var element = document.getElementById('file_input'); var sValue = element.value; if (sValue == "") { alert("ERROR: Project Image Should be Uploaded!"); element.focus(); return false; } return true; } [/code] [code=html] <input type="file" name="fileField" id="file_input" /> <input type="submit" value="Send" name="Submit" onclick="return Empty();" /> [/code] | |
Re: [code] <html> <head> <script type="text/javascript"> function showHint(str) { // Remove this because you want to allow empty string //if (str.length == 0) //{ // document.getElementById("txtHint").innerHTML = ""; // return; //} if (window.XMLHttpRequest) xmlhttp = new XMLHttpRequest(); else xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState == 4 && … | |
Re: Unchecked checkbox: [code=HTML] <input type="checkbox" /> [/code] Checked checkbox: [code=HTML] <input type="checkbox" checked="checked" /> [/code] | |
Re: Try the following code: [code=python] import string # this function returns a set of distinct words from a file def readwords(filename): res = set() f = open(filename, 'r') # iterate over lines for line in f: line = line.replace('-', ' ') words = line.split() # iterate over words of each … | |
Re: How are your primary keys generated? Are you using some SQL code to get a new primary key value? Something like [icode]select max(id) from table[/icode]? Take a look at [icode]identity[/icode] columns in SqlServer. It will generate a unique number for you and the database guarantees that even if two records … | |
Re: Here is the general idea of how you can save some values to a file and read them in later. [code=Java] public class Settings { public String s1; public int i1, i2, i3; } public void writeSettings(Settings s, String fileName) { PrintWriter w = new PrintWriter(fileName); w.println(s.s1); w.println(s.i1); w.println(s.i2); w.println(s.i3); … | |
Re: The only way that I know to put an image inside a plain textbox is to set the image as the background of the textbox. Then you can handle the focus event on the textbox and remove the background image. You can also handle the blur event to put the … | |
Re: Each page can periodically poll the server/database for new messages. You can use AJAX calls for that. When a new message is detected, you can use javascript to display the "new message" notification to the user. When a user opens the page, the page should remember who opened it. Say … | |
Re: Here is one idea of how you can get this done. You can add a `LastRequest` field to your `members` table that will hold the timestamp of the last request made by the member. You can set it up as an integer field and store the current time in second … | |
Re: You should know the permissions for the current user when the page loads. Now, the easiest thing to do to make the page read-only is to hide the "Save" button or whichever button causes the data to be saved. [code=C#] if (!canEdit) btnSave.Visible = false; [/code] Another way is to … | |
Re: Using jQuery javascript library: [code=PHP] <?php // filename: files.php $files = get_uploaded_files(); $i = 1; foreach ($files as $f) { echo "$i) $f<br>"; $i++; } ?> [/code] [code=HTML] <html> <head> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript"> function getfiles() { var url = "files.php?t=" + (new Date()).getTime(); //kill browser cache // send … | |
Re: The second option suggested by Manuz should also work. All you have to do is, instead of the "More Updates" button, call a javascript function that does the AJAX call and updates your page. This would be the same function as you would call when the "More Updates" button was … | |
Re: Here is one approach. Assuming the data file is not very big, you can read the whole thing into memory and manipulate it from there. Otherwise, you may want to read just the second column from the csv file to produce the menu. [code=Python] import csv data = [] #array … | |
Re: Here is what your code does: 1) Reads the first line from fn reader in the outer while loop. [icode]while ((s1 = fn.readLine()) != null)[/icode] 2) Reads all lines from the pn reader in the inner while loop (during the first iteration of the outer while loop). [icode]while ((s2 = … | |
Re: Any non-abstract child class [B]must[/B] implement [B]all inherited[/B] abstract methods. You are getting the error because the doL class inherited 4 abstract methods from [ICODE]AbstractDatabase[/ICODE] class, but implemented only 2 of them. Because of inheritance, to the compiler it looks like the [ICODE]doL[/ICODE] class still has 2 abstract methods. I … | |
Re: The problem is likely to be with the SQL provider installed on the server. It may be the case that SQL provider does not support updating of recordsets. As a workaround, you can simply execute an INSERT statement against the connection and then do [icode]Rs.Open "SELECT * FROM news", Cn, … | |
Re: What you could do is periodically poll the database for list of existing names and use javascript to manipulate HTML in a webpage to display those names. I suggest using some javascript library that simplifies making AJAX requests and DOM manipulation. One such library is the excellent jQuery. That is … | |
Re: The following code has not been tested very well and lacks input validation. Generics are not used as I am not sure which Java version you have. [code=Java] import java.util.*; class Student { public String name, phone; public int id, age; public String toString() { return "Student " + name … | |
Re: That usually means that the parsing failed. Make sure that what you are trying to parse can actually be parsed into a double. [code] Console.WriteLine(System.Text.Encoding.ASCII.GetString(downBuffer, 0, bytesSize)); [/code] | |
Re: You should never update (or touch) the GUI from a non-GUI thread. You can consider the GUI thread to be the same thread on which you called app.MainLoop(). Your calcolo method executes on a different thread, not on your GUI thread. Therefore, you should not touch the GUI elements inside … | |
Re: [URL="http://en.wikipedia.org/wiki/Interpolation_search"]http://en.wikipedia.org/wiki/Interpolation_search[/URL] explains what it is and gives an example in Java. |
The End.