Search Results

Search found 45581 results on 1824 pages for 'value objects'.

Page 14/1824 | < Previous Page | 10 11 12 13 14 15 16 17 18 19 20 21  | Next Page >

  • Java: How can a constructor return a value?

    - by HH
    $ cat Const.java public class Const { String Const(String hello) { return hello; } public static void main(String[] args) { System.out.println(new Const("Hello!")); } } $ javac Const.java Const.java:7: cannot find symbol symbol : constructor Const(java.lang.String) location: class Const System.out.println(new Const("Hello!")); ^ 1 error

    Read the article

  • How to change the value of value in BASH ??

    - by debugger
    Hello All, Let's say i have the Following, Vegetable=Potato ( Kind of vegetable that i have ) Potato=3 ( quantity available ) If i wanna know how many vegetables i have (from a script where i have access only to variable Vegetable), i do the following: Quantity=${!Vegetable} But let's say i take one Potato then i want to update the quantity, i should be able to do the following: ${Vegetable}=$(expr ${!Vegetable} - 1) It does not work !! Any clues to realize this Thanks

    Read the article

  • Memory management with Objective-C Distributed Objects: my temporary instances live forever!

    - by jkp
    I'm playing with Objective-C Distributed Objects and I'm having some problems understanding how memory management works under the system. The example given below illustrates my problem: Protocol.h #import <Foundation/Foundation.h> @protocol DOServer - (byref id)createTarget; @end Server.m #import <Foundation/Foundation.h> #import "Protocol.h" @interface DOTarget : NSObject @end @interface DOServer : NSObject < DOServer > @end @implementation DOTarget - (id)init { if ((self = [super init])) { NSLog(@"Target created"); } return self; } - (void)dealloc { NSLog(@"Target destroyed"); [super dealloc]; } @end @implementation DOServer - (byref id)createTarget { return [[[DOTarget alloc] init] autorelease]; } @end int main() { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; DOServer *server = [[DOServer alloc] init]; NSConnection *connection = [[NSConnection new] autorelease]; [connection setRootObject:server]; if ([connection registerName:@"test-server"] == NO) { NSLog(@"Failed to vend server object"); } else [[NSRunLoop currentRunLoop] run]; [pool drain]; return 0; } Client.m #import <Foundation/Foundation.h> #import "Protocol.h" int main() { unsigned i = 0; for (; i < 3; i ++) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; id server = [NSConnection rootProxyForConnectionWithRegisteredName:@"test-server" host:nil]; [server setProtocolForProxy:@protocol(DOServer)]; NSLog(@"Created target: %@", [server createTarget]); [[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:1.0]]; [pool drain]; } return 0; } The issue is that any remote objects created by the root proxy are not released when their proxy counterparts in the client go out of scope. According to the documentation: When an object’s remote proxy is deallocated, a message is sent back to the receiver to notify it that the local object is no longer shared over the connection. I would therefore expect that as each DOTarget goes out of scope (each time around the loop) it's remote counterpart would be dellocated, since there is no other reference to it being held on the remote side of the connection. In reality this does not happen: the temporary objects are only deallocate when the client application quits, or more accurately, when the connection is invalidated. I can force the temporary objects on the remote side to be deallocated by explicitly invalidating the NSConnection object I'm using each time around the loop and creating a new one but somehow this just feels wrong. Is this the correct behaviour from DO? Should all temporary objects live as long as the connection that created them? Are connections therefore to be treated as temporary objects which should be opened and closed with each series of requests against the server? Any insights would be appreciated.

    Read the article

  • Setting the initial value of a property when using DataContractSerializer

    - by Eric
    If I am serializing and later deserializing a class using DataContractSerializer how can I control the initial values of properties that were not serialized? Consider the Person class below. Its data contract is set to serialize the FirstName and LastName properties but not the IsNew property. I want IsNew to initialize to TRUE whether a new Person is being instantiate as a new instance or being deserialized from a file. This is easy to do through the constructor, but as I understand it DataContractSerializer does not call the constructor as they could require parameters. [DataContract(Name="Person")] public class Person { [DataMember(Name="FirstName")] public string FirstName { get; set; } [DataMember(Name = "LastName")] public string LastName { get; set; } public bool IsNew { get; set; } public Person(string first, string last) { this.FirstName = first; this.LastName = last; this.IsNew = true; } }

    Read the article

  • Value object or not for 3d points ?

    - by Stefano Borini
    I need to develop a geometry library in python, describing points, lines and planes in 3d space, and various geometry operations. Related to my previous question. The main issue in the design is if these entities should have identity or not. I was wondering if there's a similar library out there (developed in another language) to take inspiration from, what is the chosen design, and in particular the reason for one choice vs. the other.

    Read the article

  • SQL Server 2005 Create Table with Column Default value range

    - by Matt
    Trying to finish up some homework and ran into a issue for creating tables. How do you declare a column default for a range of numbers. Its reads: "Column Building (default to 1 but can be 1-10)" I can't seem to find ...or know where to look for this information. CREATE TABLE tblDepartment ( Department_ID int NOT NULL IDENTITY, Department_Name varchar(255) NOT NULL, Division_Name varchar(255) NOT NULL, City varchar(255) default 'spokane' NOT NULL, Building int default 1 NOT NULL, Phone varchar(255) ) I tried Building int default 1 Between 1 AND 10 NOT NULL, that didn't work out I tried Building int default 1-10, the table was created but I don't think its correct.

    Read the article

  • save the input value in a 2dimentsion array

    - by arash
    hi friends,how can i save the number that user enter in textbox in a 2 dimension array? for example: i have this numbers in textbox:45,78 and now i want to save 45,32 like this: array[0,0]=45 and array[0,1]=78 how can i do that?thanks,so much edited: oh,when i entered 1,2,3,4,5,6,7,8,9 in textbox and it takes [2,2]=56 private void button10_Click(object sender, EventArgs e) { int matrixDimention = 2; int[,] intValues = new int[matrixDimention + 1, matrixDimention + 1]; string[] splitValues = textBox9.Text.Split(','); for (int i = 0; i < splitValues.Length; i++) intValues[i % (matrixDimention + 1), i % (matrixDimention + 1)] = Convert.ToInt32(splitValues[i]); string a=intValues[2,2].ToString(); MessageBox.Show(a); } when i take: string a=intValues[2,1].ToString(); it shows 0

    Read the article

  • default value for a static property

    - by Blitzz
    I like c#, but why can I do : public static bool Initialized { private set; get; } or this : public static bool Initialized = false; but not a mix of both in one line ? I just need to set access level to my variable (private set), and I need it set at false on startup. I wouldn't like to make that boring private _Initialized variable, which would be returned by the getter of the public Initialized var. I like my code to be beautiful. (NB: my variable is static, it can't be initialized in the constructor). Thanks

    Read the article

  • .click() callback references local variable from the calling method instead of copying by value

    - by Eric Freese
    The following jQuery Javascript code is included on an otherwise empty page. $(function() { for (var i = 0; i < 10; i++) { element = $('<div>' + i + '</div>'); element.click(function() { alert(i); }); $('body').append(element); } }); The desired behavior is that this code should generate 10 div elements numbered from 0 to 9. When you click on a div element, an alert popup will show the number of the div element you clicked on (i.e. if a user clicks on the div element labeled '4', the alert popup should show the number 4). The alert popup instead shows the number 10 regardless of which div element is clicked on. How can I modify this code to make it behave in the desired way?

    Read the article

  • how to use database name as a value

    - by user316833
    I have more than 1000 access databases with the same table names.Each database has a unique name. In each database, I want to add column to one existing table and populate that new column (all rows in the table would be the same) with the database name. I found the example below - How can I alter this to give the new column the name of the database. ALTER TABLE TestTable ADD NewColumn INT; UPDATE TestTable SET NewColumn = 0;

    Read the article

  • PHP delete script, return to 'viewsubjects.php?classroom_id=NO VALUE'

    - by Derek
    Hi, As the title states... I am deleting a 'subject' from a 'classroom' I view classrooms, then can click on a classroom to view the subject for that classroom. So the link where I am viewing subjects looks like: viewsubjects.php?classroom=23 When the user selects the delete button (in a row) to remove a subject from a class, I simply want the user to be redirected back to the list of subjects for the classroom (exactly where they were before!!) So I though this is simply a case of calling up the classroom ID within my delete script. Here is what I have: EDIT: corrected spelling mistake in code (this was not the problem) $subject_id = $_GET['subject_id']; $classroom_id = $_GET['classroom_id']; $sql = "DELETE FROM subjects WHERE subject_id=".$subject_id; $result = mysql_query($sql, $connection) or die("MySQL Error: ".mysql_error()); header("Location: viewsubjects.php?classroom_id=".$classroom_id); exit(); The subject is being removed from the DB, but when I am redirected back the URI is displaying with an empty classroom ID like: viewsubjects.php?classroom_id= Is there a way to carry the classroom ID through successfully through the delete script so it can be displayed after, allowing the user to be redirected back to the page? Thanks for any help!

    Read the article

  • Should I convert data arrays to objects in PHP in a CouchDB/Ajax app?

    - by karlthorwald
    I find myself converting between array and object all the time in PHP application that uses couchDB and Ajax. Of course I am also converting objects to JSON and back (for sometimes couchdb but mostly Ajax), but this is not so much disturbing my workflow. At the present I have php objects that are returned by the CouchDB modules I use and on the other hand I have the old habbit to return arrays like array("error"="not found","data"=$dataObj) from my functions. This leads to a mixed occurence of real php objects and nested arrays and I cast with (object) or (array) if necessary. The worst thing is that I know more or less by heart what a function returns, but not what type (array or object), so I often run into type errors. My plan is now to always cast arrays to objects before returning from a function. Of course this implies a lot of refactoring. Is this the right way to go? What about the conversion overhead? Other ideas or tips?

    Read the article

  • php, how to get a array varible value ?

    - by NovaYear
    $lang['profil_basic_medeni'] = array( 1 => 'Bekâr', 2 => 'Evli', 3 => 'Nisanli', 4 => 'Iliskide', 5 => 'Ayrilmis', 6 => 'Bosanmis' ); $lang['profil_basic_sac'] = array( 1 => 'Normal', 2 => 'Kisa', 3 => 'Orta', 4 => 'Uzun', 5 => 'Fönlü', 6 => 'Saçsiz (Dazlak)', 7 => 'Karisik/Daginik', 8 => 'Her Zaman Bol Jöleli :)' ); function sGetVAL($item,$valno) { $sonuc = $lang[$item][$valno]; return $sonuc; } $tempVAL1 = sGetVAL('profil_basic_medeni','3'); // return null //or $tempVAL2 = sGetVAL('profil_basic_sac','7'); // return null $tempVAL1 or $tempVAL2 always return null. why ? how to fix function sGetVAL ???

    Read the article

  • Creating metadata value relationships

    - by kyle.hatlestad
    I was recently asked an question about an interesting use case. They wanted content to be submitted into UCM with a particular ID in a custom metadata field. But they wanted that ID to be translated during submission into an employee name in another metadata field upon submission. My initial thought was that this could be done with a dependent choice list (DCL). One option list field driving the choices in another. But this didn't work in this case for a couple of reasons. First, the number of IDs could potentially be very large. So making that into a drop-down list would not be practical. The preference would be for that field to simply be a text field to type in the ID. Secondly, data could be submitted through different methods other then the web-based check-in form. And without an interface to select the DCL choices, the system needed a way to determine and populate the name field. So instead I went the approach of having the value of the ID field drive the value of the Name field using the derived field approach in my rule. In looking at it though, it was easy to simply copy the value of the ID field into the Name field...but to have it look up and translate the value proved to be the tricky part. So here is the approach I took... First I created my two metadata fields as standard text fields in the Configuration Manager applet. Next I create a table that stores the relationship between the IDs and Names. I then create a View into that table and set the column to the EmployeeID. I now create a new Application Field and set it as an option list using the View I created in the previous step. The reason I create it as an Application field is because I don't need to display the field or store a value in it. I simply need to make use of the option list in the next step... Finally, I create a Rule in which I select the Employee Name field and turn on the 'Is derived field' checkbox. I edit the derived value and add a new condition. Because the option list is a Application field and not an Information field, I can't use the Compute button. Instead, I insert this line directly in the Value field: @getFieldViewValue("EmployeeMapping",#active.xEmployeeID, "EmployeeName") The "EmployeeMapping" parameter designates that the value should be pulled from the EmployeeMapping Application field that I had created in the previous step. The #active.xEmployeeID field is the ID value that should be pulled from what the user entered. "EmployeeName" is the column name in the table which has the value which corresponds to the ID. The extracted name then becomes the value within our Employee Name field. That's it. You can then add additional Rules to make the Name field read-only/hidden on the check-in page and such.

    Read the article

  • comparing value with array value problem Javascript

    - by Java starter
    This code is what I use now, it dos not work when I trie to use an array to compate values. If anybody has any idea of why, please respond. <html> <head> <script type-'text/javascript'> function hovedFunksjon() { //alert("test av funksjon fungerte"); //alert(passordLager); window.open("index10.html","Window1","menubar=no,width=430,height=360,toolbar=no"); } function inArray(array, value) { for (var i = 0; i < array.length; i++) { if (array[i] == value) return true; } return false; } function spørOmPassord() { var passordLager = ["pass0","pass1","pass2"]; window.passordInput = prompt("password");//Ved å bruke "window." skaper man en global variabel //if (passordInput == passordLager[0] || passordLager[1] || passordLager[2]) if (inArray(passordLager,passorInput) ) { hovedFunksjon(); } else { alert("Feil passord"); //href="javascript:self.close()">close window } } function changeBackgroundColor() { //document.bgColor="#CC9900"; //document.bgColor="YELLOW" document.bgColor="BLACK" } </script> </head> <body> <script type-'text/javascript'> changeBackgroundColor(); </script> <div align="center"> <form> <input type = "button" value = "Logg inn" onclick="spørOmPassord()"> </form> </div> </body> </html>

    Read the article

  • Developing Schema Compare for Oracle (Part 3): Ghost Objects

    - by Simon Cooper
    In the previous blog post, I covered how we solved the problem of dependencies between objects and between schemas. However, that isn’t the end of the issue. The dependencies algorithm I described works when you’re querying live databases and you can get dependencies for a particular schema direct from the server, and that’s all well and good. To throw a (rather large) spanner in the works, Schema Compare also has the concept of a snapshot, which is a read-only compressed XML representation of a selection of schemas that can be compared in the same way as a live database. This can be useful for keeping historical records or a baseline of a database schema, or comparing a schema on a computer that doesn’t have direct access to the database. So, how do snapshots interact with dependencies? Inter-database dependencies don't pose an issue as we store the dependencies in the snapshot. However, comparing a snapshot to a live database with cross-schema dependencies does cause a problem; what if the live database has a dependency to an object that does not exist in the snapshot? Take a basic example schema, where you’re only populating SchemaA: SOURCE   TARGET (using snapshot) CREATE TABLE SchemaA.Table1 ( Col1 NUMBER REFERENCES SchemaB.Table1(col1));   CREATE TABLE SchemaA.Table1 ( Col1 VARCHAR2(100)); CREATE TABLE SchemaB.Table1 ( Col1 NUMBER PRIMARY KEY);   CREATE TABLE SchemaB.Table1 ( Col1 VARCHAR2(100)); In this case, we want to generate a sync script to synchronize SchemaA.Table1 on the database represented by the snapshot. When taking a snapshot, database dependencies are followed, but because you’re not comparing it to anything at the time, the comparison dependencies algorithm described in my last post cannot be used. So, as you only take a snapshot of SchemaA on the target database, SchemaB.Table1 will not be in the snapshot. If this snapshot is then used to compare against the above source schema, SchemaB.Table1 will be included in the source, but the object will not be found in the target snapshot. This is the same problem that was solved with comparison dependencies, but here we cannot use the comparison dependencies algorithm as the snapshot has not got any information on SchemaB! We've now hit quite a big problem - we’re trying to include SchemaB.Table1 in the target, but we simply do not know the status of this object on the database the snapshot was taken from; whether it exists in the database at all, whether it’s the same as the target, whether it’s different... What can we do about this sorry state of affairs? Well, not a lot, it would seem. We can’t query the original database, as it may not be accessible, and we cannot assume any default state as it could be wrong and break the script (and we currently do not have a roll-back mechanism for failed synchronizes). The only way to fix this properly is for the user to go right back to the start and re-create the snapshot, explicitly including the schemas of these 'ghost' objects. So, the only thing we can do is flag up dependent ghost objects in the UI, and ask the user what we should do with it – assume it doesn’t exist, assume it’s the same as the target, or specify a definition for it. Unfortunately, such functionality didn’t make the cut for v1 of Schema Compare (as this is very much an edge case for a non-critical piece of functionality), so we simply flag the ghost objects up in the sync wizard as unsyncable, and let the user sort out what’s going on and edit the sync script as appropriate. There are some things that we do do to alleviate somewhat this rather unhappy situation; if a user creates a snapshot from the source or target of a database comparison, we include all the objects registered from the database, not just the ones in the schemas originally selected for comparison. This includes any extra dependent objects registered through the comparison dependencies algorithm. If the user then compares the resulting snapshot against the same database they were comparing against when it was created, the extra dependencies will be included in the snapshot as required and everything will be good. Fortunately, this problem will come up quite rarely, and only when the user uses snapshots and tries to sync objects with unknown cross-schema dependencies. However, the solution is not an easy one, and lead to some difficult architecture and design decisions within the product. And all this pain follows from the simple decision to allow schema pre-filtering! Next: why adding a column to a table isn't as easy as you would think...

    Read the article

  • My IIS server won't serve SSL sites to some browsers

    - by sbleon
    (Update: This is now cross-posted at http://stackoverflow.com/questions/3355000. This is the more appropriate forum, but StackOverflow gets a lot more traffic.) I've got an IIS 6.0 server that won't serve pages over SSL to some browsers. In Webkit-based browsers on OS X 10.6, I can't load pages at all. In MSIE 8 on Windows XP SP3, I can load pages, but it will sometimes hang downloading images or sending POSTs. Working: Firefox 3.6 (OS X + Windows) Chrome (Windows) Partially Working: MSIE 8 (works sometimes, but hangs up, especially on POSTs) Not Working: Chrome 5 (OS X) Safari 5 (OS X) Mobile Safari (iOS 4) On OS X (the easiest platform for me to test on), Chrome and Firefox both negotiate the same TLS Cipher, but Chrome hangs on or after the post-negotiation handshake. Chrome packet capture (via ssldump): 1 1 0.0485 (0.0485) C>S Handshake ClientHello Version 3.1 cipher suites Unknown value 0xc00a Unknown value 0xc009 Unknown value 0xc007 Unknown value 0xc008 Unknown value 0xc013 Unknown value 0xc014 Unknown value 0xc011 Unknown value 0xc012 Unknown value 0xc004 Unknown value 0xc005 Unknown value 0xc002 Unknown value 0xc003 Unknown value 0xc00e Unknown value 0xc00f Unknown value 0xc00c Unknown value 0xc00d Unknown value 0x2f TLS_RSA_WITH_RC4_128_SHA TLS_RSA_WITH_RC4_128_MD5 Unknown value 0x35 TLS_RSA_WITH_3DES_EDE_CBC_SHA Unknown value 0x32 Unknown value 0x33 Unknown value 0x38 Unknown value 0x39 TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA compression methods NULL 1 2 0.3106 (0.2620) S>C Handshake ServerHello Version 3.1 session_id[32]= bb 0e 00 00 7a 7e 07 50 5e 78 48 cf 43 5a f7 4d d2 ed 72 8f ff 1d 9e 74 66 74 03 b3 bb 92 8d eb cipherSuite TLS_RSA_WITH_RC4_128_MD5 compressionMethod NULL Certificate ServerHelloDone 1 3 0.3196 (0.0090) C>S Handshake ClientKeyExchange 1 4 0.3197 (0.0000) C>S ChangeCipherSpec 1 5 0.3197 (0.0000) C>S Handshake [hang, no more data transmitted] Firefox packet capture: 1 1 0.0485 (0.0485) C>S Handshake ClientHello Version 3.1 resume [32]= 14 03 00 00 4e 28 de aa da 7a 25 87 25 32 f3 a7 ae 4c 2d a0 e4 57 cc dd d7 0e d7 82 19 f7 8f b9 cipher suites Unknown value 0xff Unknown value 0xc00a Unknown value 0xc014 Unknown value 0x88 Unknown value 0x87 Unknown value 0x39 Unknown value 0x38 Unknown value 0xc00f Unknown value 0xc005 Unknown value 0x84 Unknown value 0x35 Unknown value 0xc007 Unknown value 0xc009 Unknown value 0xc011 Unknown value 0xc013 Unknown value 0x45 Unknown value 0x44 Unknown value 0x33 Unknown value 0x32 Unknown value 0xc00c Unknown value 0xc00e Unknown value 0xc002 Unknown value 0xc004 Unknown value 0x96 Unknown value 0x41 TLS_RSA_WITH_RC4_128_MD5 TLS_RSA_WITH_RC4_128_SHA Unknown value 0x2f Unknown value 0xc008 Unknown value 0xc012 TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA Unknown value 0xc00d Unknown value 0xc003 Unknown value 0xfeff TLS_RSA_WITH_3DES_EDE_CBC_SHA compression methods NULL 1 2 0.0983 (0.0497) S>C Handshake ServerHello Version 3.1 session_id[32]= 14 03 00 00 4e 28 de aa da 7a 25 87 25 32 f3 a7 ae 4c 2d a0 e4 57 cc dd d7 0e d7 82 19 f7 8f b9 cipherSuite TLS_RSA_WITH_RC4_128_MD5 compressionMethod NULL 1 3 0.0983 (0.0000) S>C ChangeCipherSpec 1 4 0.0983 (0.0000) S>C Handshake 1 5 0.1019 (0.0035) C>S ChangeCipherSpec 1 6 0.1019 (0.0000) C>S Handshake 1 7 0.1019 (0.0000) C>S application_data 1 8 0.2460 (0.1440) S>C application_data 1 9 0.3108 (0.0648) S>C application_data 1 10 0.3650 (0.0542) S>C application_data 1 11 0.4188 (0.0537) S>C application_data 1 12 0.4580 (0.0392) S>C application_data 1 13 0.4831 (0.0251) S>C application_data [etc] Update: Here's a Wireshark capture from the server end. What's going on with those two much-delayed RST packets? Is that just IIS terminating what it perceives as a non-responsive connection? 19 10.129450 67.249.xxx.xxx 10.100.xxx.xx TCP 50653 > https [SYN] Seq=0 Win=65535 Len=0 MSS=1460 WS=3 TSV=699250189 TSER=0 20 10.129517 10.100.xxx.xx 67.249.xxx.xxx TCP https > 50653 [SYN, ACK] Seq=0 Ack=1 Win=16384 Len=0 MSS=1460 WS=0 TSV=0 TSER=0 21 10.168596 67.249.xxx.xxx 10.100.xxx.xx TCP 50653 > https [ACK] Seq=1 Ack=1 Win=524280 Len=0 TSV=699250189 TSER=0 22 10.172950 67.249.xxx.xxx 10.100.xxx.xx TLSv1 Client Hello 23 10.173267 10.100.xxx.xx 67.249.xxx.xxx TCP [TCP segment of a reassembled PDU] 24 10.173297 10.100.xxx.xx 67.249.xxx.xxx TCP [TCP segment of a reassembled PDU] 25 10.385180 67.249.xxx.xxx 10.100.xxx.xx TCP 50653 > https [ACK] Seq=148 Ack=2897 Win=524280 Len=0 TSV=699250191 TSER=163006 26 10.385235 10.100.xxx.xx 67.249.xxx.xxx TLSv1 Server Hello, Certificate, Server Hello Done 27 10.424682 67.249.xxx.xxx 10.100.xxx.xx TCP 50653 > https [ACK] Seq=148 Ack=4215 Win=524280 Len=0 TSV=699250192 TSER=163008 28 10.435245 67.249.xxx.xxx 10.100.xxx.xx TLSv1 Client Key Exchange 29 10.438522 67.249.xxx.xxx 10.100.xxx.xx TLSv1 Change Cipher Spec 30 10.438553 10.100.xxx.xx 67.249.xxx.xxx TCP https > 50653 [ACK] Seq=4215 Ack=421 Win=65115 Len=0 TSV=163008 TSER=699250192 31 10.449036 67.249.xxx.xxx 10.100.xxx.xx TLSv1 Encrypted Handshake Message 32 10.580652 10.100.xxx.xx 67.249.xxx.xxx TCP https > 50653 [ACK] Seq=4215 Ack=458 Win=65078 Len=0 TSV=163010 TSER=699250192 7312 57.315338 10.100.xxx.xx 67.249.xxx.xxx TCP https > 50644 [RST, ACK] Seq=1 Ack=1 Win=0 Len=0 19531 142.316425 10.100.xxx.xx 67.249.xxx.xxx TCP https > 50653 [RST, ACK] Seq=4215 Ack=458 Win=0 Len=0

    Read the article

  • How to calculate new velocities between resting objects (AABB) after accelerations?

    - by Tiedye
    lately I have been trying to create a 2D platformer engine in C++ with Direct2D. The problem I am currently having is getting objects that are resting against each other to interact correctly after accelerations like gravity have been applied to them. Right now I can detect collisions and respond to them correctly (I think) and when objects collide they remember what other objects they're resting against so objects can be pushed by other objects (note that there is no bounce in any collisions so when objects collide they are guaranteed to become resting until something else happens). Every time the simulation advances, the acceleration for objects is applied to their velocities (for example vx += ax * t, where t is time elapsed since last advancement). After these accelerations are applied, I want to check if any objects that are resting against each other are moving at different speeds than their counterparts (as different objects can have different accelerations) and depending on that difference either unlink the two objects so they are no longer resting, or even out their velocities so they are moving at the same speed once again. I am having trouble creating an algorithm that can do this across many resting objects. Here's a diagram to help explain my problem

    Read the article

  • I am trying to figure out the best way to understand how to cache domain objects

    - by Brett Ryan
    I've always done this wrong, I'm sure a lot of others have too, hold a reference via a map and write through to DB etc.. I need to do this right, and I just don't know how to go about it. I know how I want my objects to be cached but not sure on how to achieve it. What complicates things is that I need to do this for a legacy system where the DB can change without notice to my application. So in the context of a web application, let's say I have a WidgetService which has several methods: Widget getWidget(); Collection<Widget> getAllWidgets(); Collection<Widget> getWidgetsByCategory(String categoryCode); Collection<Widget> getWidgetsByContainer(Integer parentContainer); Collection<Widget> getWidgetsByStatus(String status); Given this, I could decide to cache by method signature, i.e. getWidgetsByCategory("AA") would have a single cache entry, or I could cache widgets individually, which would be difficult I believe; OR, a call to any method would then first cache ALL widgets with a call to getAllWidgets() but getAllWidgets() would produce caches that match all the keys for the other method invocations. For example, take the following untested theoretical code. Collection<Widget> getAllWidgets() { Entity entity = cache.get("ALL_WIDGETS"); Collection<Widget> res; if (entity == null) { res = loadCache(); } else { res = (Collection<Widget>) entity.getValue(); } return res } Collection<Widget> loadCache() { // Get widgets from underlying DB Collection<Widget> res = db.getAllWidgets(); cache.put("ALL_WIDGETS", res); Map<String, List<Widget>> byCat = new HashMap<>(); for (Widget w : res) { // cache by different types of method calls, i.e. by category if (!byCat.containsKey(widget.getCategory()) { byCat.put(widget.getCategory(), new ArrayList<Widget>); } byCat.get(widget.getCatgory(), widget); } cacheCategories(byCat); return res; } Collection<Widget> getWidgetsByCategory(String categoryCode) { CategoryCacheKey key = new CategoryCacheKey(categoryCode); Entity ent = cache.get(key); if (entity == null) { loadCache(); } ent = cache.get(key); return ent == null ? Collections.emptyList() : (Collection<Widget>)ent.getValue(); } NOTE: I have not worked with a cache manager, the above code illustrates cache as some object that may hold caches by key/value pairs, though it's not modelled on any specific implementation. Using this I have the benefit of being able to cache all objects in the different ways they will be called with only single objects on the heap, whereas if I were to cache the method call invocation via say Spring It would (I believe) cache multiple copies of the objects. I really wish to try and understand the best ways to cache domain objects before I go down the wrong path and make it harder for myself later. I have read the documentation on the Ehcache website and found various articles of interest, but nothing to give a good solid technique. Since I'm working with an ERP system, some DB calls are very complicated, not that the DB is slow, but the business representation of the domain objects makes it very clumsy, coupled with the fact that there are actually 11 different DB's where information can be contained that this application is consolidating in a single view, this makes caching quite important.

    Read the article

  • Multiplying field value with retreived value jQuery

    - by Efe
    I pull product price from another page. Then I multiply it with quantity entered in the quantity input field. The problem is, if I forget to enter quantity value before I pull product price data or if I change the quantity field later, the final total price is not updated. I hope I clearly explained it. javascript: $('#AddProduct').click(function() { var i = 0; var adding = $(+(i++)+'<div class="row'+(i)+'"><div class="column width50"><input type="text" id="PRODUCTNAME" name="PRODUCTNAME'+(i)+'" value="" class="width98" /><input type="hidden" class="PRODUCTID" name="PRODUCTID" /><input type="hidden" class="UNITPRICE" name="UNITPRICE'+(i)+'" /><small>Search Products</small></div><div class="column width20"><input type="text" class="UNITQUANTITY" name="UNITQUANTITY'+(i)+'" value="" class="width98" /><small>Quantity</small></div><div class="column width30"><span class="prices">Unit Price:<span class="UNITPRICE"></span><br />Total Price:<span class="TOTALPRICE"></span><br /><a href="#" id="RemoveProduct(".row'+(i)+'");">Remove</a></span></div>'); $('#OrderProducts').append(adding); adding.find("#PRODUCTNAME").autocomplete("orders.cs.asp?Process=ListProducts", { selectFirst: false }).result(function(event, data, formatted) { if (data) { adding.find(".UNITPRICE").html(data[1]); adding.find(".PRODUCTID").val(data[2]); adding.find(".TOTALPRICE").html(data[1] * $('.UNITQUANTITY').val()); } }); return false; }); $('#RemoveProduct').click(function() { $().remove(); return false; }); my html: <fieldset> <h2>Order Items</h2> <div id="OrderProducts"> <a href="#" id="AddProduct"><img src="icons/add.png" alt="Add" /></a> </div> </fieldset> edit Now I totaly messed it up. Removing a row is not working anymore as well... Test link: http://refinethetaste.com/html/cp/?Section=orders&Process=AddOrder#

    Read the article

  • ControlTemplate with "Control.IsMouseOver" Value="True" and "Control.IsMouseOver" Value="False">

    - by Vinjamuri
    In my WPF control, I have below code. If I don't have a trigger with false, I can see the my storyboard, but if I have both ture and false triggers, I don't see any thing. How to fix this? Appreciate your help! <Trigger Property="Control.IsMouseOver" Value="True"> <StoryBoard> Image with Opacity 1 </StoryBoard> </Trigger> <Trigger Property="Control.IsMouseOver" Value="False"> <StoryBoard> Image with Opacity 0 </StoryBoard> </Trigger>

    Read the article

  • How do you set a double value to a "non-value"

    - by Ankur
    I have two double data elements in an object. Sometimes they are set with a proper value and sometimes not. When the form field from which they values are received is not filled I want to set them to some value that tells me, during the rest of the code that the form fields were left empty. I can't set the values to null as that gives an error, is there some way I can make them 'Undefined'. PS. Not only am I not sure that this is possible, it might not also make sense. But if there is some best practice for such a situation I would be keen to hear it.

    Read the article

  • How best to look up objects by label?

    - by dsollen
    I am writing the server backed by a pre-written API. I'm going to get a number of strings representing ports, signals, paths, etc etc etc. I need to look up the object associated with a given label, these objects are all in memory (no sql magic to do this for me). My question is, how best do I associate a given unique label with the mutable object it represents? I have enough objects that looking through every signal or every port to find the one that matches is possible, but may be slightly too slow. To be honest the direct 'look at every object' method is probably good enough for so small a body of objects and anything else is premature optimization, but I still am curious what the proper solution would be if I thought my signals were going to grow a bit larger. As I see it there are two options available. First would be to to create a 'store' that is a simple map between object and label. I could have it so that every time I call addObject the object is automatically saved into a hashmap or the like. This works, but relies on my properly adding and deleting each object so the map doesn't grow indefinitely. The biggest issue to me is that this involves having some hidden static map in my ModelObject class that just feels...wrong somehow. The other option is to have some method that can interpret the labels. All of these labels are derived from the underlying objects. So I can look at the signal label, for instance, and say "these 20 characters are the port" to figure out what port I need. This would allow me to quickly figure out what I need. However, if the label method is changed the translateLabelToObject method needs to be updated as well or everything breaks. Which solution is cleaner, or possibly a cleaner solution than either of above? For the record I'm working with sufficient number of variables to make direct comparison a little slow, but not enough to be concerned about memory overhead, written in java. All objects that have labels I need to look up extend the same parent class.

    Read the article

  • Change xml attribute in foreach statement c#

    - by user1913479
    I need to save XML-attribute value in a database, using information if checkbox is checked. If checkbox is checked, the attribute value is "TRUE", otherwise it's false. When I use foreach statement, the last enumerated value is usually assigned. Here is the part of my code: XmlAttribute xmlAttribute = xmlDoc.CreateAttribute("BooleanValue"); foreach (string value in list) //list is a List<object> { XmlNode xmlNode = xmlDoc.CreateNode(XmlNodeType.Element, "VALUE", ""); if (checkBox1.Checked || checkBox2.Checked || checkBox3.Checked) xmlAttribute.Value = "TRUE"; if (!checkBox1.Checked || !checkBox2.Checked || !checkBox3.Checked) xmlAttribute.Value = "FALSE"; xmlNode.Attributes.Append(xmlAttribute); xmlNode.InnerText = val; childNode.AppendChild(xmlNode); } When I run my application, I get an XML attribute xmlAttribute "FALSE" value anyway. What I need to have: I need to have the following XML: <ROOT><NODE><VALUE ATTRIBUTE="TRUE">Value 1</VALUE></NODE> <NODE><VALUE ATTRIBUTE="TRUE">Value 2</VALUE></NODE> <NODE><VALUE ATTRIBUTE="FALSE">Value 3</VALUE></NODE> <NODE><VALUE ATTRIBUTE="FALSE">Value 4</VALUE></NODE> <NODE><VALUE ATTRIBUTE="TRUE">Value 5</VALUE></NODE> <NODE><VALUE ATTRIBUTE="FALSE">Value 6</VALUE></NODE> </ROOT> What I actually get: <ROOT><NODE><VALUE ATTRIBUTE="FALSE">Value 1</VALUE></NODE> <NODE><VALUE ATTRIBUTE="FALSE">Value 2</VALUE></NODE> <NODE><VALUE ATTRIBUTE="FALSE">Value 3</VALUE></NODE> <NODE><VALUE ATTRIBUTE="FALSE">Value 4</VALUE></NODE> <NODE><VALUE ATTRIBUTE="FALSE">Value 5</VALUE></NODE> <NODE><VALUE ATTRIBUTE="FALSE">Value 6</VALUE></NODE> </ROOT> Because in C# FALSE value is stayed at last position in foreach loop The question is: how do I do to assign the correct values of my attribute. Thanks

    Read the article

< Previous Page | 10 11 12 13 14 15 16 17 18 19 20 21  | Next Page >