Search Results

Search found 1523 results on 61 pages for 'assignment'.

Page 4/61 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • "Invalid assignment" error from == operator

    - by Tom
    I was trying to write a simple method: boolean validate(MyObject o) { // propertyA && propertyB are not primitive types. return o.getPropertyA() == null && o.getPropertyB() == null; } And got a strange error on the == null part: Syntax error on token ==. Invalid assignment operator. Maybe my Java is rusty after a season in PLSQL. So I tried a simpler example: Integer i = 4; i == null; // compile error: Syntax error on token ==. Invalid assignment operator. Integer i2 = 4; if (i == null); //No problem How can this be? I'm using jdk160_05. To clarify: I'm not trying to assign anything, just do an && operation between two boolean values. I don't want to do this: if (o.propertyA() == null && o.propertyB() == null) { return true; } else { return false; }

    Read the article

  • Scheme Homework Assignment

    - by user1704677
    In a course I am taking we recently had to learn the programming language Scheme. I get all of the basics, which is pretty much all that we have gone though. I'm just having trouble learning to think in the different way that Scheme consists of. I was given an assignment and really do not even know how to start. I have sat here for a few hours trying to figure out how to even get started, but I'm kind of stumped. For the record, I'm not asking for the code to solve this problem, but more of some thoughts to get me on the right track. Anyway, here is the gist of the assignment... We are given a list of ten numbers that represent a voter's votes. The numbers are -1, 0 or 1. Then we are given a list of lists of Candidates, with a name and then ten numbers corresponding to that candidate's votes. These numbers are also -1 0 and 1. So for example. '(0 0 0 -1 -1 1 0 1 0 -1) '(Adams 0 1 -1 0 1 1 0 -1 -1 0 0) We are asked to implement a function called best_candidates that will take in a list of numbers (Voter) and a list of lists of Candidates. Then we have to compare the votes of the voter against the list of each candidate and return a list of names with the most common votes. So far, I've come up with a few things. I'm just confused on how I will check the values and retain the name of the voter? I guess I'm still stuck in thinking C/Java and it's making this very tough. Any suggestions to help get me started?

    Read the article

  • How can I use Perl's s/// in an expression?

    - by mikeY
    I got a headache looking for this: How do you use s/// in an expression as opposed to an assignment. To clarify what I mean, I'm looking for a perl equivalent of python's re.sub(...) when used in the following context: newstring = re.sub('ab', 'cd', oldstring) The only way I know how to do this in perl so far is: $oldstring =~ s/ab/cd/; $newstring = $oldstring; Note the extra assignment.

    Read the article

  • Using s/// in an expression

    - by mikeY
    I got a headache looking for this: How do you use s/// in an expression as opposed to an assignment. To clarify what I mean, I'm looking for a perl equivalent of python's re.sub(...) when used in the following context: newstring = re.sub('ab', 'cd', oldstring) The only way I know how to do this in perl so far is: $oldstring =~ s/ab/cd/; $newstring = $oldstring; Note the extra assignment.

    Read the article

  • Assignment to LAN queues (qWAN1 & qWAN2) from dual-WAN in pfSense

    - by Kurian
    I need help creating floating rules in pfSense for the following: I have two upper limited download queues qWAN1 and qWAN2 on my LAN interface. Each has its own qACK1, qDefault1 etc. How do I assign all unclassified traffic from WAN1 to LAN->qWAN1->qDefault1 and from WAN2 to LAN->qWAN2->qDefault2. qLink is the one and only default queue on LAN so that I get wire speed to the pfSense host from the LAN.

    Read the article

  • IPv4 private address assignment

    - by helloworld922
    I'm working on a private network which uses static IPv4 addresses as well as DHCP addressing for the physical LAN network. At a previous company I worked at they would assign static addresses in the 10.*.*.* space and all DHCP/LAN addresses were assigned in the 192.168.*.* space. Both of these address spaces are defined in the IPv4 private address space and there were never any internal conflicts. From personal experience at home, school, at work, and pretty much any other machine I've dealt with extensively (Windows and a few Linux distros), the DHCP server would always by default choose an address from the 192.168.*.* address space. Now my question is can I rely on this behavior? Do DHCP servers always by default assign from the 192.168.*.* pool (or any pool other than the 10.*.*.* pool), leaving the 10.*.*.* pool free for private static addressing? If not, under what conditions might a DHCP server choose an address in the 10.*.*.* address space?

    Read the article

  • EMC VNX iSCSI setup - unsure about SP/port assignment

    - by pauska
    We have a new VNX5300 waiting to get configured, and I need to plan out the network infrastructure before the EMC tech arrives. It has 4x1gbit iSCSI per SP (8 ports in total), and I'd like to get the most out of the performance until we jump over to 10gig iSCSI. From what I can read from the docs - the recommendation is to use only two ports per SP, with 1 active and 1 passive. Why is this? It seems kind of pointless to have quad-port i/o-modules and then recommend to not use more than two of them? Also - I'm a bit unsure about the zoning. The best practices guide state that you should separate each port on each SP from each other on different logical networks. Does this mean that I have to create 4 logical networks to be able to use all 8 ports? It also gives the following example: Does this mean that A0 and B0 should sit on the same physical switch aswell? Won't this make all traffic go on one switch (if both A1 and B1 are passive)? Edit: Another brainpuzzle I don't get it - each host (as in server) should not have more iSCSI bandwidth available than the storage processor. What on earth does this matter? If serverA have 1gbit and serverB have 100mbit, then the resulting bandwith between them is 100mbit. How can this result in some kind of oversubscription? Edit4: Wait, what. Active and passive ports? The VNX runs in a ALUA configuration with asymmetrical active/active.. there shouldn't be any passive ports, only preferred ones..

    Read the article

  • University Assignment: Datacenter/Networking Infrastructure for Hosting Company [closed]

    - by TCB13
    My university assigned me to theorizing a data center for an Web Hosting company. The company should provide the following services: Shared WebHosting; Dedicated Servers; VPS (Virtual Private Server); The bandwith (as resquested) is limited to 10 Gbps. Is there any good book / other info I can read (max 100 pages) about how to design a good data center for hosting, what are the best practices and what should be done from a (logical) network perspective, what security policies should be implemented and how the data center should be built (physically)? Thank you ;)

    Read the article

  • Ubuntu 10.04 Windows2003 adding a route for GPO assignment

    - by David Carvalho
    I want the PC's that receive IP from my Ubuntu DHCP3-server to be able to retrieve the GPOs that are on my windows 2003 server. I'm using virtualbox and 3 virtual machines: 1 windows 2003 server 192.168.0.2 with 1 NIC (internal network). 1 ubuntu server 10.04 lts 192.168.0.1 with 1 NIC (internal network) and 3 aliases 192.168.21.0, 192.168.22.0, 192.168.100.0 1 Windows XP machine with 3 NIC's (internal network).

    Read the article

  • Cannot acess the new cloned server even after new IP address assignment

    - by tough
    I was able to clone a Ubuntu 10.04 server residing in Cloud. It appeared that I was not getting some IP for the new VM so I followed some of these: # cd /etc/udev/rules.d # cp 70-persistent-net.rules /root/ # rm 70-persistent-net.rules # reboot I didn't follow the later commands as I was unable to see two eth MACs as available in the referenced site. After this I am able to see some the IP for it, and is different form the original IP, I have added new IP to DNS server. Now when I try to access it with its assigned(new) domain it is directed to the old server. I can see both the VMs running with different IP. Where I might have gone wrong, I am new to this admin thing.

    Read the article

  • Variable Assignment for arguments with a for loop

    - by RainbowDashDC
    Alright, so, I've searched quite a bit on how to do this but I've given up as I simply couldn't find anything. So, I have a code (below); it's main purpose is to get 9 arguments and assign them as a variable-- ignore the echo's and pipping. My question is: How can I simplfy this with a for loop or such so it doesn't take as much code, and if possible, have more than 9 arguments aswell set pkg1=%1 set pkg2=%2 set pkg3=%3 set pkg4=%4 set pkg5=%5 set pkg6=%6 set pkg7=%7 set pkg8=%8 set pkg9=%9 IF DEFINED pkg1 (echo %1.ini 1> %WINGET_TEMP%\args.rdc 2>nul) IF DEFINED pkg2 (echo %2.ini 1>> %WINGET_TEMP%\args.rdc 2>nul) IF DEFINED pkg3 (echo %3.ini 1>> %WINGET_TEMP%\args.rdc 2>nul) IF DEFINED pkg4 (echo %4.ini 1>> %WINGET_TEMP%\args.rdc 2>nul) IF DEFINED pkg5 (echo %5.ini 1>> %WINGET_TEMP%\args.rdc 2>nul) IF DEFINED pkg6 (echo %6.ini 1>> %WINGET_TEMP%\args.rdc 2>nul) IF DEFINED pkg7 (echo %7.ini 1>> %WINGET_TEMP%\args.rdc 2>nul) IF DEFINED pkg8 (echo %8.ini 1>> %WINGET_TEMP%\args.rdc 2>nul) IF DEFINED pkg9 (echo %9.ini 1>> %WINGET_TEMP%\args.rdc 2>nul)

    Read the article

  • Pull/push student assignment files from computer lab computers (Windows 7)

    - by mkstreet
    I have a computer lab with about 35 PC's all running Windows 7. The students do their work and save it on the D-drive in a particular folder such as a folder with the same name as the computer's name (e.g. LABPC001). I'd like a centralized way to pull all these folders in to the teacher's computer in the lab to check the assignments. It would be best if this didn't involve using an external website (e.g. Dropbox). I would also like to be able to distribute (send) files to the students in these same folders. I've seen software applications that do this but they cost about US$1000 which is far beyond our means. Suggestions for free, or almost free, best ways to set this up?

    Read the article

  • IP assignment in small network

    - by nooneon
    What is the best way to assign IPs in your opinion? I've got ~100 PCs, some servers and see three ways to assign IPs: Static IPs for every PC/server Static IP reservation by MAC-address in DHCP Dynamic IPs via DHCP. Of course, you can combine them, i.e. dynamic for PCs, static for servers. But, again, what is the best way? How do you do that?

    Read the article

  • Ubuntu - executable file - variable assignment throwing error on script run

    - by newcoder
    I am trying to run a small script - test - on ubuntu box. It is as follows: var1 = bash var2 = /home/test/directory ... ... <some more variable assignments and then program operations here> ... ... Now every time I run it, then it throws errors: root@localhost#/opt/test /opt/test: line 1: var1: command not found /opt/test: line 3: var2: command not found ... ... more similar errors ... Can someone help me understand what is wrong in this script? Many thanks.

    Read the article

  • UML assignment question

    - by waitinforatrain
    Hi guys, Sorry, I know this is a very lame question to ask and not of any use to anyone else. I have an assignment in UML due tomorrow and I don't even know the basics (all-nighter ahead!). I'm not looking for a walkthrough, I simply want your opinion on something. The assignment is as follows (you only need to skim over it!): ============= Gourmet Surprise (GS) is a small catering firm with five employees. During a typical weekend, GS caters fifteen events with twenty to fifty people each. The business has grown rapidly over the past year and the owner wants to install a new computer system for managing the ordering and buying process. GS has a set of ten standard menus. When potential customers call, the receptionist describes the menus to them. If the customer decides to book an event (dinner, lunch, picnic, finger food etc.), the receptionist records the customer information (e.g., name, address, phone number, etc.) and the information about the event (e.g., place, date, time, which one of the standard menus, total price) on a contract. The customer is then faxed a copy of the contract and must sign and return it along with a deposit (often a credit card or by check) before the event is officially booked. The remaining money is collected when the catering is delivered. Sometimes, the customer wants something special (e.g., birthday cake). In this case, the receptionist takes the information and gives it to the owner who determines the cost; the receptionist then calls the customer back with the price information. Sometimes the customer accepts the price, other times, the customer requests some changes that have to go back to the owner for a new cost estimate. Each week, the owner looks through the events scheduled for that weekend and orders the supplies (e.g., plates) and food (e.g., bread, chicken) needed to make them. The owner would like to use the system for marketing as well. It should be able to track how customers learned about GS, and identify repeat customers, so that GS can mail special offers to them. The owner also wants to track the events on which GS sent a contract, but the customer never signed the contract and actually booked a GS. Exercise: Create an activity diagram and a use case model (complete with a set of detail use case descriptions) for the above system. Produce an initial domain model (class diagram) based on these descriptions. Elaborate the use cases into sequence diagrams, and include any state diagrams necessary. Finally use the information from these dynamic models to expand the domain model into a full application model. ============= In your opinion, do you think this question is asking me to come up with a package for an online ordering system to replace the system described above, or to create UML diagrams that facilitate the existing telephone-based system?

    Read the article

  • Access Violation Using memcpy or Assignment to an Array in a Struct

    - by Synetech inc.
    Hi, I wrote a program last night that worked just fine but when I refactored it today to make it more extensible, I ended up with a problem. The original version had a hard-coded array of bytes. After some processing, some bytes were written into the array and then some more processing was done. To avoid hard-coding the pattern, I put the array in a structure so that I could add some related data and create an array of them. However now, I cannot write to the array in the structure. Here’s a pseudo-code example: main() { char pattern[]="\x32\x33\x12\x13\xba\xbb"; PrintData(pattern); pattern[2]='\x65'; PrintData(pattern); } That one works but this one does not: struct ENTRY { char* pattern; int somenum; }; main() { ENTRY Entries[] = { {"\x32\x33\x12\x13\xba\xbb\x9a\xbc", 44} , {"\x12\x34\x56\x78", 555} }; PrintData(Entries[0].pattern); Entries[0].pattern[2]='\x65'; //0xC0000005 exception!!! :( PrintData(Entries[0].pattern); } The second version causes an access violation exception on the assignment. I’m sure it’s because the second version allocates memory differently, but I’m starting to get a headache trying to figure out what’s what or how to get fix this. (I’m currently working around it by dynamically allocating a buffer of the same size as the pattern array, copying the pattern to the new buffer, making the changes to the buffer, using the buffer in the place of the pattern array, and then trying to remember to free the—temporary—buffer.) (Specifically, the original version cast the pattern array—+offset—to a DWORD* and assigned a DWORD constant to it to overwrite the four target bytes. The new version cannot do that since the length of the source is unknown—may not be four bytes—so it uses memcpy instead. I’ve checked and re-checked and have made sure that the pointers to memcpy are correct, but I still get an access violation. I use memcpy instead of str(n)cpy because I am using plain chars (as an array of bytes), not Unicode chars and ignoring the null-terminator. Using an assignment as above causes the same problem.) Any ideas? Thanks a lot.

    Read the article

  • Destructuring assignment problem

    - by Eli Grey
    Why does for ([] in iterable); work fine but [void 0 for ([] in iterable)] throw a syntax error for invalid left-hand assignment? For example, I would expect the following code to work, but it doesn't (the assertion isn't even done due to the syntax error): let (i = 0, iterable = (i for (i in [1, 2, 3, 4]))) { for ([] in iterable) i++; console.assertNotGreater([void 0 for ([] in iterable)].length, i); }

    Read the article

  • Destructuring assignment in generator expressions and array comprehensions

    - by Eli Grey
    Why does for ([] in object); work fine but [void 0 for ([] in object)] or (void 0 for ([] in object)) throw a syntax error for invalid left-hand assignment? For example, I would expect the following code to work, but it doesn't (the assertion isn't even done due to the syntax error): let ( i = 0, arr = [1, 2, 3, 4], gen = (i for (i in arr) if (arr.hasOwnProperty(i)) ) { for ([] in gen) i++; console.assertEquals([void 0 for ([] in gen)].length, i); }

    Read the article

  • Inserting Records in Ascending Order function- C homework assignment

    - by Aaron McRuer
    Good day, Stack Overflow. I have a homework assignment that I'm working on this weekend that I'm having a bit of a problem with. We have a struct "Record" (which contains information about cars for a dealership) that gets placed in a particular spot in a linked list according to 1) its make and 2) according to its model year. This is done when initially building the list, when a "int insertRecordInAscendingOrder" function is called in Main. In "insertRecordInAscendingOrder", a third function, "createRecord" is called, where the linked list is created. The function then goes to the function "compareCars" to determine what elements get put where. Depending on the value returned by this function, insertRecordInAscendingOrder then places the record where it belongs. The list is then printed out. There's more to the assignment, but I'll cross that bridge when I come to it. Ideally, and for the assignment to be considered correct, the linked list must be ordered as: Chevrolet 2012 25 Chevrolet 2013 10 Ford 2010 5 Ford 2011 3 Ford 2012 15 Honda 2011 9 Honda 2012 3 Honda 2013 12 Toyota 2009 2 Toyota 2011 7 Toyota 2013 20 from the a text file that has the data ordered the following way: Ford 2012 15 Ford 2011 3 Ford 2010 5 Toyota 2011 7 Toyota 2012 20 Toyota 2009 2 Honda 2011 9 Honda 2012 3 Honda 2013 12 Chevrolet 2013 10 Chevrolet 2012 25 Notice that the alphabetical order of the "make" field takes precedence, then, the model year is arranged from oldest to newest. However, the program produces this as the final list: Chevrolet 2012 25 Chevrolet 2013 10 Honda 2011 9 Honda 2012 3 Honda 2013 12 Toyota 2009 2 Toyota 2011 7 Toyota 2012 20 Ford 2010 5 Ford 2011 3 Ford 2012 15 I sat down with a grad student and tried to work out all of this yesterday, but we just couldn't figure out why it was kicking the Ford nodes down to the end of the list. Here's the code. As you'll notice, I included a printList call at each instance of the insertion of a node. This way, you can see just what is happening when the nodes are being put in "order". It is in ANSI C99. All function calls must be made as they are specified, so unfortunately, there's no real way of getting around this problem by creating a more efficient algorithm. #include <stdio.h> #include <stdlib.h> #include <string.h> #define MAX_LINE 50 #define MAX_MAKE 20 typedef struct record { char *make; int year; int stock; struct record *next; } Record; int compareCars(Record *car1, Record *car2); void printList(Record *head); Record* createRecord(char *make, int year, int stock); int insertRecordInAscendingOrder(Record **head, char *make, int year, int stock); int main(int argc, char **argv) { FILE *inFile = NULL; char line[MAX_LINE + 1]; char *make, *yearStr, *stockStr; int year, stock, len; Record* headRecord = NULL; /*Input and file diagnostics*/ if (argc!=2) { printf ("Filename not provided.\n"); return 1; } if((inFile=fopen(argv[1], "r"))==NULL) { printf("Can't open the file\n"); return 2; } /*obtain values for linked list*/ while (fgets(line, MAX_LINE, inFile)) { make = strtok(line, " "); yearStr = strtok(NULL, " "); stockStr = strtok(NULL, " "); year = atoi(yearStr); stock = atoi(stockStr); insertRecordInAscendingOrder(&headRecord,make, year, stock); } printf("The original list in ascending order: \n"); printList(headRecord); } /*use strcmp to compare two makes*/ int compareCars(Record *car1, Record *car2) { int compStrResult; compStrResult = strcmp(car1->make, car2->make); int compYearResult = 0; if(car1->year > car2->year) { compYearResult = 1; } else if(car1->year == car2->year) { compYearResult = 0; } else { compYearResult = -1; } if(compStrResult == 0 ) { if(compYearResult == 1) { return 1; } else if(compYearResult == -1) { return -1; } else { return compStrResult; } } else if(compStrResult == 1) { return 1; } else { return -1; } } int insertRecordInAscendingOrder(Record **head, char *make, int year, int stock) { Record *previous = *head; Record *newRecord = createRecord(make, year, stock); Record *current = *head; int compResult; if(*head == NULL) { *head = newRecord; printf("Head is null, list was empty\n"); printList(*head); return 1; } else if ( compareCars(newRecord, *head)==-1) { *head = newRecord; (*head)->next = current; printf("New record was less than the head, replacing\n"); printList(*head); return 1; } else { printf("standard case, searching and inserting\n"); previous = *head; while ( current != NULL &&(compareCars(newRecord, current)==1)) { printList(*head); previous = current; current = current->next; } printList(*head); previous->next = newRecord; previous->next->next = current; } return 1; } /*creates records from info passed in from main via insertRecordInAscendingOrder.*/ Record* createRecord(char *make, int year, int stock) { printf("CreateRecord\n"); Record *theRecord; int len; if(!make) { return NULL; } theRecord = malloc(sizeof(Record)); if(!theRecord) { printf("Unable to allocate memory for the structure.\n"); return NULL; } theRecord->year = year; theRecord->stock = stock; len = strlen(make); theRecord->make = malloc(len + 1); strncpy(theRecord->make, make, len); theRecord->make[len] = '\0'; theRecord->next=NULL; return theRecord; } /*prints list. lists print.*/ void printList(Record *head) { int i; int j = 50; Record *aRecord; aRecord = head; for(i = 0; i < j; i++) { printf("-"); } printf("\n"); printf("%20s%20s%10s\n", "Make", "Year", "Stock"); for(i = 0; i < j; i++) { printf("-"); } printf("\n"); while(aRecord != NULL) { printf("%20s%20d%10d\n", aRecord->make, aRecord->year, aRecord->stock); aRecord = aRecord->next; } printf("\n"); } The text file you'll need for a command line argument can be saved under any name you like; here are the contents you'll need: Ford 2012 15 Ford 2011 3 Ford 2010 5 Toyota 2011 7 Toyota 2012 20 Toyota 2009 2 Honda 2011 9 Honda 2012 3 Honda 2013 12 Chevrolet 2013 10 Chevrolet 2012 25 Thanks in advance for your help. I shall continue to plow away at it myself.

    Read the article

  • Calling assignment operator in copy constructor

    - by stas
    Are there some drawbacks of such implementation of copy-constructor? Foo::Foo(const Foo& i_foo) { *this = i_foo; } As I remember, it was recommend in some book to call copy constructor from assignment operator and use well-known swap trick, but I don't remember, why...

    Read the article

  • Can't modify constant item in scalar assignment

    - by joe
    sub new { my $class = shift; my $ldap_obj = Net::LDAP->new( 'test.company.com' ) or die "$@"; my $self = { _ldap = $ldap_obj, _dn ='dc=users,dc=ldap,dc=company,dc=com', _dn_login = 'dc=login,dc=ldap,dc=company,dc=com', _description ='company', }; # Print all the values just for clarification. bless $self, $class; return $self; } what is wrong on this code : i got this error Can't modify constant item in scalar assignment at Core.pm line 12, near "$ldap_obj,"

    Read the article

  • Variable assignment in bash

    - by Werner
    Hi, this is probably a very stupid question; in a bash script, given the output of, for instance; awk '{print $7}' temp it gives 0.54546 I would like to give this to a variable, so I tried: read ENE <<< $(awk '{print $7}' temp) but I get Syntax error: redirection unexpected Could you tell me why, and what is the easiest way to do this assignment? Thanks

    Read the article

  • Java Clock Assignment

    - by Mike S
    For my assignment we are suppose to make a clock. We need variables of hours, minutes, and seconds and methods like setHours/getHours, setMinutes/getMinutes, setSeconds/getSeconds. Now the parts of the assignment that I am having trouble on is that we need a addClock() method to make the sum of two clock objects and a tickDown() method which decrements the clock object and a tick() method that increments a Clock object by one second. Lastly, the part where I am really confused on is, I need to write a main() method in the Clock class to test the functionality of your objects with a separate Tester class with a main() method. Here is what I have so far... public class Clock { private int hr; //store hours private int min; //store minutes private int sec; //store seconds //Default constructor public Clock () { setClock (0, 0, 0); } public Clock (int hours, int minutes, int seconds) { setTimes (hours, minute, seconds); } public void setClock (int hours, int minutes, int seconds) { if(0 <= hours && hours < 24) { hr = hours; } else { hr = 0; } if(0 <= minutes && minutes < 60) { min = minutes; } else { min = 0; } if(0 <= seconds && seconds < 60) { sec = seconds; } else { sec = 0; } } public int getHours ( ) { return hr; } public int getMinutes ( ) { return min; } public int getSeconds ( ) { return sec; } //Method to increment the time by one second //Postcondition: The time is incremented by one second //If the before-increment time is 23:59:59, the time //is reset to 00:00:00 public void tickSeconds ( ) { sec++; if(sec > 59) { sec = 0; tickMinutes ( ); //increment minutes } } public void tickMinutes() { min++; If (min > 59) { min = 0; tickHours(); //increment hours } } public void tickHours() { hr++; If (hr > 23) hr = 0; } }

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >