889 Posted Topics
Re: If you look at your declaration of _list, it is a List of type list2 objects. This means that all objects added to the list must be of type list2 or inherit from type list2. The list1 type inherits from the List<int> type, so it can't be added to the … | |
Re: Hi kara1990 and welcome to DaniWeb, Can you show us what you have attempted so far and let us know where you are having problems? We will attempt to help you if we know what's wrong but need to see some effort on your part. | |
Re: You can use the lock keyword for this. The basic idea is that you lock a private constant object whenever you read or write from the shared variable. Like this: public class MyMultiThread { private const Object lockObject = new Object(); private int sharedVariable; public MyMultiThread() { WriteSharedVariable(0); } public … | |
Re: You can use pointer types in C# however they are rarely needed. Check out [msdn's article](http://msdn.microsoft.com/en-us/library/y31yhkeb%28v=vs.80%29.aspx) on pointer types in C#. | |
![]() | Re: You can obtain the client IP address with the following call: string clientConnection = ((IPEndPoint)tcpClient.Client.RemoteEndPoint).Address.ToString(); where `tcpClient` is your TCPClient object. |
Re: Have you tested the Convert.ToDouble function against the Double.TryParse function? I'm not sure if it's faster, but it is generally the preferred approach as it handles exceptions for you. EDIT: There is also a TryParse static function for each of the other "primitive" types (Int32, Decimal, Byte etc). | |
Re: Yes you can delete the guest, see MSDN's explanation of a [SQL Delete](http://msdn.microsoft.com/en-us/library/ms189835.aspx) statement. You need to set the parameters for your update function, see the [SqlCommand.CreateParameter](http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlcommand.createparameter.aspx) function. | |
Re: Something like the following query should get you close: -- need a count of the objects by description and transaction SELECT Description.Name, COUNT(Item.Name) AS count, COUNT(Transaction.Type) AS [under repair] FROM Description -- describe the relationship between the tables by joining INNER JOIN Item ON Description.DeID = Item.DeID INNER JOIN Transaction … | |
Re: Your method example creates a new instance of the myClass class EACH TIME it is called, and stores the value of the parameters in its own instance variables. This is thread-safe. I'm not sure that ALL static methods are thread-safe though. It is possible to access static global variables that … | |
Re: Hi Sivapatham and welcome to DaniWeb, A very simple algorithm for this would be: [code=php] for( $i = 0; $i < $n; $i++ ) // if $n is number of teams { for( $j = $n-1; $j > $i; $j-- ) { // teams for this match have id's = … | |
Re: So what do you get back instead? You will need to read from the response stream and deserialize the returned JSON into a list using whatever DataContract is being returned to you. Also, you can check the `response.StatusCode` to see whether the response is a successful response (ie `HttpStatusCode.OK`) or … | |
Re: http://www.go4expert.com/forums/showthread.php?t=4382 | |
Re: Looks like an encoding issue. Do you know what encoding the HTTP response is in? Something like this will read the response in UTF8 encoding: using (var reader = new StreamReader(errorResponse.GetResponseStream(), Encoding.UTF8)) { string error = reader.ReadToEnd(); Console.WriteLine(error); } | |
Re: [QUOTE=masijade;500410]change from show() to setVisible(true) .... and find a better tutorial, that one's outdated.[/QUOTE] Masijade's right here - find a tutorial on swing rather than awt as the swing packages have mostly overtaken the functionality of the awt packages. | |
Re: Make sure that line 7 (and all lines for that matter) in your csv don't have more than 19 commas. That will give you 20 values in a csv file. This line in a csv file: 1,,2,,3 actually has 5 values, it's just that 2 of the values are null/blank. ![]() | |
Re: You can use a WriteLine() to describe what you want the user to enter, then wait for their response using ReadLine(). You will need to make sure that the user has entered a number. | |
Re: `Thread.Abort()` or `Thread.Join()` are the two simplest ways of ceasing a thread from running. What issue do you have with `Thread.Abort()`? | |
Re: Actually I think that loop is linear, so it should be O(n). | |
Re: Remove the dbo. from the INSERT query. It thinks you are trying to call your procedure recursively rather than insert directly to the table Transactions. BTW naming is important in a database, and TRANSACTION is a special SQL word. Try using a more descriptive name for the procedure, such as … | |
Re: Hi weajane01 and welcome to DaniWeb :) Your deletion query has the following where clause: `WHERE id=$id AND course=$course` Can you confirm that the tblstudent table in your database has a primary key on the id and course field? Any other fields in the table must be included in the … | |
Re: You can use a ParameterizedThreadStart delegate like so: Thread workerThread = new Thread(new ParameterizedThreadStart(LongRunningOperation); workerThread.Start(a, b); However note that the parameters a and b are passed as objects, not as int's so you will need to cast them inside your method. public static Double LongRunningOperation(object a, object b) { if … | |
Re: You are probably better off having a single table in your database that just contains the votes of each user on each item being rated. This way you can ensure that each voter can only vote once for something. In order to calculate the total score, number of votes and … | |
Re: Hi king000000 and welcome to DaniWeb :) The play method should either: Start playing a track if the player is not already playing; OR Do nothing if the player is already playing. The stop method should either: Stop playing the track if the player is playing; OR Do nothing if … | |
Re: You can use the RANK function to do this. [Here](http://msdn.microsoft.com/en-us/library/ms176102.aspx) is a link to MSDN's description of the function, and [here](http://www.databasejournal.com/features/mssql/article.php/3661461/New-Ranking-Functions-within-SQL-Server-2005.htm) is an excellent article that has some examples of its use. Something like this will work for you, you may need to change the order to get the way … | |
Hi Dani and other administrators/moderators, I have had little time recently to contribute to the site, but I noticed tonight that the number of members is fast approaching the 1 million mark - at the time of this post it is 952,959 members. At the current rate of new member … | |
Re: Hi wjperdue and welcome to DaniWeb You have two where statements which is incorrect. What you need is a single where statement, with extra conditions OR'ed or AND'ed together, so: WHERE HD_TICKET.HD_QUEUE_ID="6" AND HD_TICKET.CREATED BETWEEN [Start Date] AND [End Date] GROUP BY (HD_PRIORITY.NAME) should be better. Change the first AND … | |
Re: If InsuranceDetails can be null, you need to use a LEFT JOIN to join your tables together. SELECT ipd.InPatientID, ipd.Fname+' ' +ipd.LName as 'Patient Name' , -- this line is dangerous if name(s) can be null ipd.Gender, ipd.BirthDate, ipd.AccType as 'Account Type', ipd.Minor, ipg.GFName+' ' +ipg.GLName as 'Guardian name', -- … | |
Re: This exception indicates that you have made a call that requires a filepath, and you have specified one that is too long for it to handle. Can you post a short snippet of the code surrounding where the error is thrown, or the stack trace message for the error? Try … | |
Re: Not sure if this is your only problem, but I noticed this line straight away: int zoom=50/100; So zoom = 0 which means that newWidth and newHeight both equal 0 too, so you are trying to create a Rectangle 0x0 and draw the image in that space. You see what … | |
Re: Probably not an urgent one but thought I'd point it out anyway, all of my old, deleted PM's are back and set to unread. Luckily I only have 27 to go through (27 in 4.5 years, can it be so few??). Also, I can't see anywhere to delete them? | |
Re: 1. You could create your own Add method that passes through to the collection: public void Add(object item) { this.Items.Add(item); } 2. The CheckListBox.ObjectCollection that is returned by the Items property is a public non-sealed class so in theory you can extend it: public class MyCheckListBox : CheckListBox { public … | |
Re: If you want to mutate the string parameter you must declare it var in the procedure's signature: procedure TMainForm.Show(var s: String); But a better method would probably be to declare a local variable string to handle your error line, so: procedure TMainForm.Show(s: string); var n, n2, n3: integer; arTemp: TMyArray; … | |
Re: This reply may have come too late, but if you draw a graph of the execution of the function will produce 11 edges, 9 nodes and 1 exit point. First we step into a loop (looks like a triangle of nodes in the graph). The middle of the loop provides … | |
Re: Try Application.Close() or Environment.Exit(int) methods. this.Close() closes the form but doesn't shut down the application. | |
Re: The args parameter to the Main function is a list of command line parameters. If I run the following command from a cmd prompt: MyApplication.exe -e 5 Then args[0] will be set to "-e" and args[1] will be set to "5". Note that the arguments are strings already (since args … | |
Re: Ok so your aggregate functions are anything appearing in the SELECT part of the statement that SUM, COUNT, AVG, MAX, MIN etc etc over one or more columns. For example, in your SQL query: [code] select orders.orderid,orders.customerid,orders.orderdate,orders.shipcity,orders.shipcountry, orderdetails.unitprice,orderdetails.quantity, SUM(orderdetails.unitprice*orderdetails.quantity )as total from orders inner join orderdetails on orders.orderid=orderdetails.orderid group by … | |
Re: Most likely `data` is null. Can your method `App.getGenericData` return null and if so in what situation? Try wrapping the for-loop into an if-statement that reads `if (data != null)` and step through the code with the debugger to see what happens. | |
Re: You need the reference to prjform to be global in the class calling the mouse click method. Example: [code] Project1.Form1 prjform = null; private void mouseClkbtn_Click(object sender, EventArgs e) { if (btnLatch.Text == "Latch Enable") // might be safer to use if (prjform == null) instead { prjform = new … | |
Re: Transactions are very important in SQL. They provide a way of reverting previous steps of a multi-step operation on the database that causes changes should an error occur. Imagine this simple, common scenario. You want to represent a sale of items as a header (containing the date and time of … | |
Re: I believe a minimal instance of MSSQL Server is installed with VS2008. You can download the express version of MSSQL Server though. [URL="http://www.microsoft.com/sqlserver/en/us/editions/express.aspx"]Here[/URL] is a link to MSSQL 2008 R2 Server, you can google for MSSQL 2010/2012 Express versions if you prefer. | |
Re: [URL="http://www.digitalcoding.com/Code-Snippets/C-Sharp/C-Code-Snippet-Insert-Update-Image-To-SQL-Server.html"]Here[/URL] is a sample of how to insert/update image data. The sample code uses SqlClient instead of OleDB, but it should be a similar process. Your algorithm should be: 1. Read image file into MemoryStream using the Image.Save function. 2. Convert the MemoryStream to a byte[] using Stream.ToArray function. 3. … | |
Re: Hi tommyarcher and welcome to DaniWeb :) Are you sure you want to use a stored procedure? Your sample looks like a simple query rather than a SP, which is defined like so: CREATE PROCEDURE SelectVendors ( @VCode INT ) AS SELECT [V_NAME], [V_PHONE], [V_STATE] FROM [VENDOR] WHERE ([V_CODE] = … | |
Re: The SetResolution function accepts to float's as parameters, you are passing to int's. To fix your error you need to pass like so: [code] back.SetResolution(300.0F, 300.0F); [/code] | |
Re: Hi Libran, To help debug your code, try adding some println statements to gain a better understanding of what is going on. Please see my comments below. import java.util.*; import java.io.*; public class FranchiseManagementSystem { private BufferedReader br; private String[] str; public FranchiseManagementSystem() throws Exception { br = new BufferedReader(new … | |
Re: Once you have created the Customers table, you can't create it again unless you DROP TABLE first. You can use an ALTER TABLE query to alter the column structure of a table without losing data. Each INSERT statement can only accept one set of VALUES. You need to write three … | |
Re: JavaScript is a scripting language used most commonly to handle events in a web page. JSON is not a programming language at all, it is more like XML in that it represents data in a structured manner. While you may use one or both of these in your project, I … | |
Re: One important use of overriding the ToString method in your classes is for consistency in the display of information in your views. It is far easier to override the ToString method than to remember the format used in each view for your class. Say for example that I have a … | |
Re: Is your web app a WCF service? If so, you can just configure your client to connect to the base HTTP endpoint address and it should all hook up so long as the service implements the same operation contract as the client is after. If it's not a WCF service, … |
The End.