qid
int64
1
74.7M
question
stringlengths
15
58.3k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
4
30.2k
response_k
stringlengths
11
36.5k
75,078
EDIT : Sorry, my question clearly wasn't clear. I don't want to report attempted server attacks internally; we already have systems that log. record and report that activity. What I was keen to do was to report the attacks to the perpetrator's ISP or somesuch. Original question: Our sites are immune to SQL Injection (AFAIK!), but of course we still get targeted regularly. Is there some way I could automate reporting of attempted attacks - reverse DNS lookup etc.? Although I guess its only worthwhile if, overall, it would be doing the community a favour. Ditto I suppose for all the other attacks we see - probing for wide-open BBS, MySQL, PHPAdmin, etc.
2009/10/16
[ "https://serverfault.com/questions/75078", "https://serverfault.com", "https://serverfault.com/users/23154/" ]
Donate your logs to [SANS](http://isc.sans.org/howto.html)! They have a client for most firewalls that will pull the logs and send them to the DShield database.
Most ISPs have an abuse@ispname.com email address for reporting such things.. If you can revers lookup the ISP name from the IP I would send the info there.
75,078
EDIT : Sorry, my question clearly wasn't clear. I don't want to report attempted server attacks internally; we already have systems that log. record and report that activity. What I was keen to do was to report the attacks to the perpetrator's ISP or somesuch. Original question: Our sites are immune to SQL Injection (AFAIK!), but of course we still get targeted regularly. Is there some way I could automate reporting of attempted attacks - reverse DNS lookup etc.? Although I guess its only worthwhile if, overall, it would be doing the community a favour. Ditto I suppose for all the other attacks we see - probing for wide-open BBS, MySQL, PHPAdmin, etc.
2009/10/16
[ "https://serverfault.com/questions/75078", "https://serverfault.com", "https://serverfault.com/users/23154/" ]
Either everyone else understood something else or I did, but from what I can understand you are trying to report the people attempting SQL injections to their ISPs. This will usually be a dead end, and you're better off just blocking the users attempting the attacks, as most machines performing attacks are not usually owned by the 'hacker', and instead they could be compromised machines, or someone abusing a website which offers free vulnerability scans or something similar.
Most ISPs have an abuse@ispname.com email address for reporting such things.. If you can revers lookup the ISP name from the IP I would send the info there.
7,925
I'm designing a robot and I'm looking to use mainly I2C to control different sensors and stuff. I'm now looking into motors, specifically [this motor](http://www.sparkfun.com/products/9697). However all of the ESCs I have seen use a PWM interface. I'm wondering if there are any ESCs which use I2C, or if anyone knows of an easy way I could implement one myself? I've already seen a couple of application notes which provide reference implementations of an ESC on an AVR ([AVR444](http://www.atmel.com/dyn/resources/prod_documents/doc8012.pdf) and [AVR493](http://www.efo.ru/ftp/pub/atmel/_AVR_MCUs_8bit/_Technical_Library/appnotes/pdf_avr/AVR493.pdf)) but they are old and use IAR so id rather not re-impliment them. I'm wondering if anyone has an already functional implementation?
2010/12/16
[ "https://electronics.stackexchange.com/questions/7925", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/81/" ]
To create one you could use a low power uC like a the msp430. It would be fairly cheap to build. Most of the msp430 value line chips have I2C or SPI built in. you would have to look up how to drive the brushless motor and those 2 links could give you a good start.
Another vote for using a low power uC! I would suggest a small PIC - it would be easy to write some software to convert I2C to PWM outputs as these devices have good built peripheral options. The advantage is you can also implement a local control loop by measuring feedback from the A/D port of actual position or velocity and use the I2C as a setpoint with a small PI or PID control loop. And presto you have a closed loop controller!!
7,925
I'm designing a robot and I'm looking to use mainly I2C to control different sensors and stuff. I'm now looking into motors, specifically [this motor](http://www.sparkfun.com/products/9697). However all of the ESCs I have seen use a PWM interface. I'm wondering if there are any ESCs which use I2C, or if anyone knows of an easy way I could implement one myself? I've already seen a couple of application notes which provide reference implementations of an ESC on an AVR ([AVR444](http://www.atmel.com/dyn/resources/prod_documents/doc8012.pdf) and [AVR493](http://www.efo.ru/ftp/pub/atmel/_AVR_MCUs_8bit/_Technical_Library/appnotes/pdf_avr/AVR493.pdf)) but they are old and use IAR so id rather not re-impliment them. I'm wondering if anyone has an already functional implementation?
2010/12/16
[ "https://electronics.stackexchange.com/questions/7925", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/81/" ]
To create one you could use a low power uC like a the msp430. It would be fairly cheap to build. Most of the msp430 value line chips have I2C or SPI built in. you would have to look up how to drive the brushless motor and those 2 links could give you a good start.
Use an MSP430 as an I2C slave. I just used the standard I2C code that you can download on the TI wiki. It doesn't work for MSPGCC though and you need to use a chip that supports I2C, such as an MSP430F2013 (which you can get free samples of). [Check out the sample code here](https://gist.github.com/745942) or you can download all the samples at <http://processors.wiki.ti.com/index.php/MSP430_LaunchPad_(MSP-EXP430G2)?DCMP=launchpad&HQS=Other+OT+launchpadwiki#Download_all_MSP430G2xx_code_examples> Just set the PWM duty to whatever byte you receive from the master.
7,925
I'm designing a robot and I'm looking to use mainly I2C to control different sensors and stuff. I'm now looking into motors, specifically [this motor](http://www.sparkfun.com/products/9697). However all of the ESCs I have seen use a PWM interface. I'm wondering if there are any ESCs which use I2C, or if anyone knows of an easy way I could implement one myself? I've already seen a couple of application notes which provide reference implementations of an ESC on an AVR ([AVR444](http://www.atmel.com/dyn/resources/prod_documents/doc8012.pdf) and [AVR493](http://www.efo.ru/ftp/pub/atmel/_AVR_MCUs_8bit/_Technical_Library/appnotes/pdf_avr/AVR493.pdf)) but they are old and use IAR so id rather not re-impliment them. I'm wondering if anyone has an already functional implementation?
2010/12/16
[ "https://electronics.stackexchange.com/questions/7925", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/81/" ]
To create one you could use a low power uC like a the msp430. It would be fairly cheap to build. Most of the msp430 value line chips have I2C or SPI built in. you would have to look up how to drive the brushless motor and those 2 links could give you a good start.
There is a similar question [here](https://electronics.stackexchange.com/questions/8027/implementing-my-own-esc). This was my answer: > > Here is an introduction to electronic speed control systems: <http://www.stefanv.com/electronics/escprimer.html> > > > Actual design depends on the type of motor you want to drive. A 300A high-torque gear motor is much different from those tiny featherweight propeller motors. At the heavy-duty end of the scale (300A) is something like this: [Open Source Motor Control](http://www.robotpower.com/products/osmc_info.html). All designs are online and there are a few articles explaining what the heck is going on. At the other end of the scale are small prop motors, like those in the [MikroKopter](http://www.mikrokopter.com/ucwiki/en/BrushlessCtrl). > > > The motor you chose is sold with an ESC [here](http://www.rcecho.com/tekmodel-4300-kv-9t-brushless-motor-35a-program-esc.html). This controller is designed for 35A continuous, 190A peak, so dinky designs won't cut it. The [OSMC](http://www.robotpower.com/products/osmc_info.html) page has several designs that would probably do it as well, but I believe they are all PWM input. Even the smallest and cheapest of microcontrollers should be able to handle I2C to PWM conversion (e.g.: ATtiny family).
7,925
I'm designing a robot and I'm looking to use mainly I2C to control different sensors and stuff. I'm now looking into motors, specifically [this motor](http://www.sparkfun.com/products/9697). However all of the ESCs I have seen use a PWM interface. I'm wondering if there are any ESCs which use I2C, or if anyone knows of an easy way I could implement one myself? I've already seen a couple of application notes which provide reference implementations of an ESC on an AVR ([AVR444](http://www.atmel.com/dyn/resources/prod_documents/doc8012.pdf) and [AVR493](http://www.efo.ru/ftp/pub/atmel/_AVR_MCUs_8bit/_Technical_Library/appnotes/pdf_avr/AVR493.pdf)) but they are old and use IAR so id rather not re-impliment them. I'm wondering if anyone has an already functional implementation?
2010/12/16
[ "https://electronics.stackexchange.com/questions/7925", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/81/" ]
To create one you could use a low power uC like a the msp430. It would be fairly cheap to build. Most of the msp430 value line chips have I2C or SPI built in. you would have to look up how to drive the brushless motor and those 2 links could give you a good start.
Hi not to be particular but too many people are stating that any uC can generate PWM signals. That is true but almost all ESCs require PPM signals like what are used to drive servos. There is a big (big enough to damage an ESC) difference.
7,925
I'm designing a robot and I'm looking to use mainly I2C to control different sensors and stuff. I'm now looking into motors, specifically [this motor](http://www.sparkfun.com/products/9697). However all of the ESCs I have seen use a PWM interface. I'm wondering if there are any ESCs which use I2C, or if anyone knows of an easy way I could implement one myself? I've already seen a couple of application notes which provide reference implementations of an ESC on an AVR ([AVR444](http://www.atmel.com/dyn/resources/prod_documents/doc8012.pdf) and [AVR493](http://www.efo.ru/ftp/pub/atmel/_AVR_MCUs_8bit/_Technical_Library/appnotes/pdf_avr/AVR493.pdf)) but they are old and use IAR so id rather not re-impliment them. I'm wondering if anyone has an already functional implementation?
2010/12/16
[ "https://electronics.stackexchange.com/questions/7925", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/81/" ]
Use an MSP430 as an I2C slave. I just used the standard I2C code that you can download on the TI wiki. It doesn't work for MSPGCC though and you need to use a chip that supports I2C, such as an MSP430F2013 (which you can get free samples of). [Check out the sample code here](https://gist.github.com/745942) or you can download all the samples at <http://processors.wiki.ti.com/index.php/MSP430_LaunchPad_(MSP-EXP430G2)?DCMP=launchpad&HQS=Other+OT+launchpadwiki#Download_all_MSP430G2xx_code_examples> Just set the PWM duty to whatever byte you receive from the master.
Another vote for using a low power uC! I would suggest a small PIC - it would be easy to write some software to convert I2C to PWM outputs as these devices have good built peripheral options. The advantage is you can also implement a local control loop by measuring feedback from the A/D port of actual position or velocity and use the I2C as a setpoint with a small PI or PID control loop. And presto you have a closed loop controller!!
7,925
I'm designing a robot and I'm looking to use mainly I2C to control different sensors and stuff. I'm now looking into motors, specifically [this motor](http://www.sparkfun.com/products/9697). However all of the ESCs I have seen use a PWM interface. I'm wondering if there are any ESCs which use I2C, or if anyone knows of an easy way I could implement one myself? I've already seen a couple of application notes which provide reference implementations of an ESC on an AVR ([AVR444](http://www.atmel.com/dyn/resources/prod_documents/doc8012.pdf) and [AVR493](http://www.efo.ru/ftp/pub/atmel/_AVR_MCUs_8bit/_Technical_Library/appnotes/pdf_avr/AVR493.pdf)) but they are old and use IAR so id rather not re-impliment them. I'm wondering if anyone has an already functional implementation?
2010/12/16
[ "https://electronics.stackexchange.com/questions/7925", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/81/" ]
Hi not to be particular but too many people are stating that any uC can generate PWM signals. That is true but almost all ESCs require PPM signals like what are used to drive servos. There is a big (big enough to damage an ESC) difference.
Another vote for using a low power uC! I would suggest a small PIC - it would be easy to write some software to convert I2C to PWM outputs as these devices have good built peripheral options. The advantage is you can also implement a local control loop by measuring feedback from the A/D port of actual position or velocity and use the I2C as a setpoint with a small PI or PID control loop. And presto you have a closed loop controller!!
7,925
I'm designing a robot and I'm looking to use mainly I2C to control different sensors and stuff. I'm now looking into motors, specifically [this motor](http://www.sparkfun.com/products/9697). However all of the ESCs I have seen use a PWM interface. I'm wondering if there are any ESCs which use I2C, or if anyone knows of an easy way I could implement one myself? I've already seen a couple of application notes which provide reference implementations of an ESC on an AVR ([AVR444](http://www.atmel.com/dyn/resources/prod_documents/doc8012.pdf) and [AVR493](http://www.efo.ru/ftp/pub/atmel/_AVR_MCUs_8bit/_Technical_Library/appnotes/pdf_avr/AVR493.pdf)) but they are old and use IAR so id rather not re-impliment them. I'm wondering if anyone has an already functional implementation?
2010/12/16
[ "https://electronics.stackexchange.com/questions/7925", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/81/" ]
Use an MSP430 as an I2C slave. I just used the standard I2C code that you can download on the TI wiki. It doesn't work for MSPGCC though and you need to use a chip that supports I2C, such as an MSP430F2013 (which you can get free samples of). [Check out the sample code here](https://gist.github.com/745942) or you can download all the samples at <http://processors.wiki.ti.com/index.php/MSP430_LaunchPad_(MSP-EXP430G2)?DCMP=launchpad&HQS=Other+OT+launchpadwiki#Download_all_MSP430G2xx_code_examples> Just set the PWM duty to whatever byte you receive from the master.
There is a similar question [here](https://electronics.stackexchange.com/questions/8027/implementing-my-own-esc). This was my answer: > > Here is an introduction to electronic speed control systems: <http://www.stefanv.com/electronics/escprimer.html> > > > Actual design depends on the type of motor you want to drive. A 300A high-torque gear motor is much different from those tiny featherweight propeller motors. At the heavy-duty end of the scale (300A) is something like this: [Open Source Motor Control](http://www.robotpower.com/products/osmc_info.html). All designs are online and there are a few articles explaining what the heck is going on. At the other end of the scale are small prop motors, like those in the [MikroKopter](http://www.mikrokopter.com/ucwiki/en/BrushlessCtrl). > > > The motor you chose is sold with an ESC [here](http://www.rcecho.com/tekmodel-4300-kv-9t-brushless-motor-35a-program-esc.html). This controller is designed for 35A continuous, 190A peak, so dinky designs won't cut it. The [OSMC](http://www.robotpower.com/products/osmc_info.html) page has several designs that would probably do it as well, but I believe they are all PWM input. Even the smallest and cheapest of microcontrollers should be able to handle I2C to PWM conversion (e.g.: ATtiny family).
7,925
I'm designing a robot and I'm looking to use mainly I2C to control different sensors and stuff. I'm now looking into motors, specifically [this motor](http://www.sparkfun.com/products/9697). However all of the ESCs I have seen use a PWM interface. I'm wondering if there are any ESCs which use I2C, or if anyone knows of an easy way I could implement one myself? I've already seen a couple of application notes which provide reference implementations of an ESC on an AVR ([AVR444](http://www.atmel.com/dyn/resources/prod_documents/doc8012.pdf) and [AVR493](http://www.efo.ru/ftp/pub/atmel/_AVR_MCUs_8bit/_Technical_Library/appnotes/pdf_avr/AVR493.pdf)) but they are old and use IAR so id rather not re-impliment them. I'm wondering if anyone has an already functional implementation?
2010/12/16
[ "https://electronics.stackexchange.com/questions/7925", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/81/" ]
Hi not to be particular but too many people are stating that any uC can generate PWM signals. That is true but almost all ESCs require PPM signals like what are used to drive servos. There is a big (big enough to damage an ESC) difference.
There is a similar question [here](https://electronics.stackexchange.com/questions/8027/implementing-my-own-esc). This was my answer: > > Here is an introduction to electronic speed control systems: <http://www.stefanv.com/electronics/escprimer.html> > > > Actual design depends on the type of motor you want to drive. A 300A high-torque gear motor is much different from those tiny featherweight propeller motors. At the heavy-duty end of the scale (300A) is something like this: [Open Source Motor Control](http://www.robotpower.com/products/osmc_info.html). All designs are online and there are a few articles explaining what the heck is going on. At the other end of the scale are small prop motors, like those in the [MikroKopter](http://www.mikrokopter.com/ucwiki/en/BrushlessCtrl). > > > The motor you chose is sold with an ESC [here](http://www.rcecho.com/tekmodel-4300-kv-9t-brushless-motor-35a-program-esc.html). This controller is designed for 35A continuous, 190A peak, so dinky designs won't cut it. The [OSMC](http://www.robotpower.com/products/osmc_info.html) page has several designs that would probably do it as well, but I believe they are all PWM input. Even the smallest and cheapest of microcontrollers should be able to handle I2C to PWM conversion (e.g.: ATtiny family).
70,285,234
If I refresh the page when I'm logged in, the Guard redirects me to the login page. Is there a way for redirecting to the login page only if the user truly log out? I am using frontend as angular (version: 12.2.13)and backend as firebase. auth.guard.ts ``` import { Injectable } from "@angular/core"; import { ActivatedRouteSnapshot, CanActivate, Router, RouterStateSnapshot } from "@angular/router"; import { AuthService } from "./auth.service"; @Injectable() export class AuthGuard implements CanActivate { constructor(private authService: AuthService, private router: Router){} canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot){ if(this.authService.isAuth()){ return true; } else { this.router.navigate(['/auth']); } } } ```
2021/12/09
[ "https://Stackoverflow.com/questions/70285234", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17632514/" ]
You are already doing it correctly. for example: ``` lst_keywords_physics_dict = {'a': 1, 'b': 2} for k in lst_keywords_physics_dict.keys(): if len(k) == 1: lst_keywords_physics_dict.pop(k) break ``` So, what was the issue you were facing? , I can modify the answer accordingly.
#We can use this method in python 3 to delete the keys when iterating throug the dictionary without getting the error regarding changing size of dictionary. ``` for k in list(lst_keywords_physics_dict.keys()): if (len(k)<3): lst_keywords_physics_dict.pop(k) ```
40,335,515
Is it possible to change the color a button with a label using a random generator? For ex.. Label "A" is the title/color dictator and will notify "Button 1 and Button 2" what colors they will generate to be randomly.
2016/10/31
[ "https://Stackoverflow.com/questions/40335515", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4490046/" ]
Use strtok\_r(). It's the same behaviour as strtok, but allow you to work with multiple strings "simultaneously". ``` char *strtok_r(char *str, const char *delim, char **saveptr); ``` > > The strtok\_r() function is a reentrant version strtok(). The saveptr argument is a pointer to a char \* variable that is used internally by strtok\_r() in order to maintain context between successive calls that parse the same string. > > > On the first call to strtok\_r(), str should point to the string to be parsed, and the value of saveptr is ignored. In subsequent calls, str should be NULL, and saveptr should be unchanged since the previous call. > > > Different strings may be parsed concurrently using sequences of calls to strtok\_r() that specify different saveptr arguments. > > > Source: Linux man [strtok\_r](http://man7.org/linux/man-pages/man3/strtok_r.3.html)
Your function `getmask()` invokes undefined behavior: * you copy the string argument into a local array `x`; * you parse that with `strtok()` which returns a pointer into the same local array `x`. * you return this pointer `mask` to the caller. This pointer becomes invalid as soon as you exit this function. You should instead return a pointer to an allocated copy of this array so it remains valid after you return to the caller. Futhermore, you should indeed avoid using `strtok()` because it is not reentrant: as you noticed, you cannot implement nested parsers with this function. Other functions are available for parsing strings: * `strchr()` locates a character in a string ; * `strstr()` locates a substring in a string ; * `strspn()` matches a set of characters at the beginning of a string ; * `strcspn()` matches the complement of a set of characters at the beginning of a string ; * you can also parse the string by hand, testing characters in a loop. Here is an example: ``` #include <stdlib.h> #include <string.h> char *getmask(const char *s) { /* allocate a copy of the mask part * the mask starts after the first '/' * and stops at the first space or another '/' */ len - 0; s = strchr(s, '/'); if (s != NULL) { s++; len = strcspn(s, "/ \t\r\n"); } /* allocate space for the mask string */ char *mask = malloc(len + 1); if (mask != NULL) { /* copy the mask string */ memcpy(mask, s, len); mask[len] = '\0'; } return mask; } ``` The function is cumbersome but very precise. It behaves almost the same as what you intended with `strtok()`, the only difference is the handling of multiple consecutive `/` bytes which `strtok()` would skip and `strchr()` does not. Here is an alternative with `sscanf()`: ``` #include <stdlib.h> #include <string.h> char *getmask(const char *s) { char mask[256]; /* skip characters different from /, then skip slashes, then * copy characters until another / or whitespace */ if (sscanf(s, "%*[^/]%*[/]%255[^/ \t\n]", mask) != 1) { *mask = '\0'; } return strdup(mask); /* POSIX function to allocate a copy of a string */ } ``` It is much simpler, but fails if the string starts with `/`. `strdup()` is a very useful function to allocate a copy of a string. It is available on POSIX compliant systems. It you do not have it, it can be easily implemented as: ``` #include <stdlib.h> #include <string.h> char *strdup(const char *s) { char *p = malloc(strlen(s)); if (p != NULL) { strcpy(p, s); } return p; } ``` Strings allocated by `getmask()` should be freed by `free()` when no longer needed. You can use similar methods to parse your input string into ip/mask address pairs before calling `getmask()`. You could also provide a destination buffer to `getmask()` to avoid the complexities of memory management: ``` char *getmask(char *dest, size_t size, const char *s) { if (dest != NULL && size > 0) { char mask[256]; /* skip characters different from /, then skip slashes, then * copy characters until another / or whitespace * dest cannot be used directly because size cannot be passed * sscanf easily */ *dest = '\0'; if (sscanf(s, "%*[^/]%*[/]%255[^/ \t\n]", mask) != 1) { strncat(dest, mask, size - 1); } } return dest; } ``` Parsing is tricky because you must be careful to handle all cases. The specifications are usually not precise enough so implementors must make choices for special cases. The tools provided by the C library for parsing are old and clunky, especially `strtok()`, `sscanf()`. Be careful when using these, even experienced programmers get bitten by their side effects and shortcomings.
40,335,515
Is it possible to change the color a button with a label using a random generator? For ex.. Label "A" is the title/color dictator and will notify "Button 1 and Button 2" what colors they will generate to be randomly.
2016/10/31
[ "https://Stackoverflow.com/questions/40335515", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4490046/" ]
Use strtok\_r(). It's the same behaviour as strtok, but allow you to work with multiple strings "simultaneously". ``` char *strtok_r(char *str, const char *delim, char **saveptr); ``` > > The strtok\_r() function is a reentrant version strtok(). The saveptr argument is a pointer to a char \* variable that is used internally by strtok\_r() in order to maintain context between successive calls that parse the same string. > > > On the first call to strtok\_r(), str should point to the string to be parsed, and the value of saveptr is ignored. In subsequent calls, str should be NULL, and saveptr should be unchanged since the previous call. > > > Different strings may be parsed concurrently using sequences of calls to strtok\_r() that specify different saveptr arguments. > > > Source: Linux man [strtok\_r](http://man7.org/linux/man-pages/man3/strtok_r.3.html)
`strtok()` cannot be used on comma separated strings if there are null values there e.g. "one,two,,four,five,,,eight". Using `strtok(token,",")` will return "one", "two","four"... where you might have thought an null string "" would be returned after"two". This caught me out when trying to parse the output from a GPS receiver. Instead use `strsep()` which is thread safe like `strtok_r()` but will return zero-length strings i.e. "one","two","","four"... in the example earlier. `strsep()` might not be in some runtime libraries, but you can find implementations by searching online.
52,283
I am intentionally not specifying a country for the following as I am interested in answers for different countries. Lets say that instead of global warming we would have global cooling - the ice caps grow, seas shrink and with them a lot of land is uncovered. Who owns the new land uncovered in such a scenario?
2020/06/12
[ "https://law.stackexchange.com/questions/52283", "https://law.stackexchange.com", "https://law.stackexchange.com/users/31951/" ]
We don't have to imagine shrinking seas. New land is created all the time by volcanoes. The answer is that the ownership of the new land depends on the circumstances. It may become part of an adjacent parcel, depending on how the deed is written. More than one landowner might have a reasonable claim, in which case there will be a dispute and perhaps a court action. There may be no landowner with a valid claim, in which case the land would pass to the government. There may even be multiple governments disputing each other's claims. This actually happens, of course, and can lead to anything from insignificant diplomatic wrangling to war.
New land is not only created by volcanoes, but also manmade, for example by the dutch, or it appears almost by itself at the north sea coast of Germany, especialyl around coast protection constructions around some of the islands. Who owns the land? In the case of the german north sea coast, it is owned by the commune (or rather: Bundesland) and automatically part of the Nationalpark Wattenmeer that was formative in making it. The rules about the national park regulate that this land can't become private property as long as it is part of the national park. Private landowners can't make claims on the national park, but they can request to buy the land from the commune, which then has to request to take that part out of the national park from the authorities above it... it's a long process, but it happens.
52,283
I am intentionally not specifying a country for the following as I am interested in answers for different countries. Lets say that instead of global warming we would have global cooling - the ice caps grow, seas shrink and with them a lot of land is uncovered. Who owns the new land uncovered in such a scenario?
2020/06/12
[ "https://law.stackexchange.com/questions/52283", "https://law.stackexchange.com", "https://law.stackexchange.com/users/31951/" ]
We don't have to imagine shrinking seas. New land is created all the time by volcanoes. The answer is that the ownership of the new land depends on the circumstances. It may become part of an adjacent parcel, depending on how the deed is written. More than one landowner might have a reasonable claim, in which case there will be a dispute and perhaps a court action. There may be no landowner with a valid claim, in which case the land would pass to the government. There may even be multiple governments disputing each other's claims. This actually happens, of course, and can lead to anything from insignificant diplomatic wrangling to war.
In the United States, this is a non-issue because US constitutional law doesn't care about "land", i.e. dry dirt, it cares about territory. The standard interpretation is that "federal lands" are owned by the citizens of the US, but held in trust by the US government. Congress has the authority to sell, buy, lease or give away federal lands. Indian tribal lands are a slightly more complicated matter: that is not federal land, that is the land of the particular tribe, held in trust by the US government. If a lake dries up and becomes "land", the ownership question is based on ownership of the territory. It might be state land if a lake in a state park dries up; it might be my uncle's land if the lake on my uncle's farm dries up. The complicated question is, what if the oceans dry up (never mind the obvious problem with that hypothetical): what are the boundaries of each nation? In principle, any nation can declare anything to be "their rightful territory". International law recognizes a number of distances for various purposes, the outermost being about 400 miles (the continental shelf). If Russia claims such new land and defends that claim, Russia owns it; if the US does, likewise.
52,283
I am intentionally not specifying a country for the following as I am interested in answers for different countries. Lets say that instead of global warming we would have global cooling - the ice caps grow, seas shrink and with them a lot of land is uncovered. Who owns the new land uncovered in such a scenario?
2020/06/12
[ "https://law.stackexchange.com/questions/52283", "https://law.stackexchange.com", "https://law.stackexchange.com/users/31951/" ]
New land is not only created by volcanoes, but also manmade, for example by the dutch, or it appears almost by itself at the north sea coast of Germany, especialyl around coast protection constructions around some of the islands. Who owns the land? In the case of the german north sea coast, it is owned by the commune (or rather: Bundesland) and automatically part of the Nationalpark Wattenmeer that was formative in making it. The rules about the national park regulate that this land can't become private property as long as it is part of the national park. Private landowners can't make claims on the national park, but they can request to buy the land from the commune, which then has to request to take that part out of the national park from the authorities above it... it's a long process, but it happens.
In the United States, this is a non-issue because US constitutional law doesn't care about "land", i.e. dry dirt, it cares about territory. The standard interpretation is that "federal lands" are owned by the citizens of the US, but held in trust by the US government. Congress has the authority to sell, buy, lease or give away federal lands. Indian tribal lands are a slightly more complicated matter: that is not federal land, that is the land of the particular tribe, held in trust by the US government. If a lake dries up and becomes "land", the ownership question is based on ownership of the territory. It might be state land if a lake in a state park dries up; it might be my uncle's land if the lake on my uncle's farm dries up. The complicated question is, what if the oceans dry up (never mind the obvious problem with that hypothetical): what are the boundaries of each nation? In principle, any nation can declare anything to be "their rightful territory". International law recognizes a number of distances for various purposes, the outermost being about 400 miles (the continental shelf). If Russia claims such new land and defends that claim, Russia owns it; if the US does, likewise.
29,586,667
I'm testing react-native PushNotificationIOS. <http://facebook.github.io/react-native/docs/pushnotificationios.html#content> I bind event like below in `componentWillMount` function ``` PushNotificationIOS.addEventListener('notification', this._onNotification); ``` and I send push notification from server to device. It doesn't catch push notification. I only can received push notification below object c code ``` (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo { } ``` `PushNotificationIOS` can listen with `RCTDeviceEventEmitter` call. but notification from server can't listen. Does anyone know this problem?
2015/04/12
[ "https://Stackoverflow.com/questions/29586667", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4778806/" ]
Push notifications don't work out of the box and this is not documented on the React Native docs. There are a few things you need to add to your project first in order to wire up notifications. I found this information from an open issue on github <https://github.com/facebook/react-native/pull/1979#issue-94795697>. You basically need to wire the notifications manually in AppDelegate.m and call the corresponding methods from the RCTPushNotificationManager so the PushNotificationsIOS class can handle them from your javascript code. 1. add RCTPushNotification to your project (and also link binaries in build settings). 2. add this header to Header Search Paths: `$(SRCROOT)/node_modules/react-native/Libraries/**` 3. add this code to AppDelegate.m: --- ``` #import "RCTPushNotificationManager.h" - (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error { [RCTPushNotificationManager application:application didFailToRegisterForRemoteNotificationsWithError:error]; } - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken { [RCTPushNotificationManager application:application didRegisterForRemoteNotificationsWithDeviceToken:deviceToken]; } - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)notification { [RCTPushNotificationManager application:application didReceiveRemoteNotification:notification]; } ```
I found this too so wrote a replacement module to handle receiving push notifications - <https://github.com/darylrowland/react-native-remote-push>
1,364,361
Having seen the answers coming out of questions like [this one](https://stackoverflow.com/questions/1163393/best-scala-imitation-of-groovys-safe-dereference-operator "this one") involving horror shows like trying to catch the NPE and dredge the mangled name out of the stack trace, I am asking this question so I can answer it. Comments or further improvements welcome.
2009/09/01
[ "https://Stackoverflow.com/questions/1364361", "https://Stackoverflow.com", "https://Stackoverflow.com/users/89872/" ]
Like so: ``` case class ?:[T](x: T) { def apply(): T = x def apply[U >: Null](f: T => U): ?:[U] = if (x == null) ?:[U](null) else ?:[U](f(x)) } ``` And in action: ``` scala> val x = ?:("hel")(_ + "lo ")(_ * 2)(_ + "world")() x: java.lang.String = hello hello world scala> val x = ?:("hel")(_ + "lo ")(_ => (null: String))(_ + "world")() x: java.lang.String = null ```
Added `orElse` ```scala case class ?:[T](x: T) { def apply(): T = x def apply[U >: Null](f: T => U): ?:[U] = if (x == null) ?:[U](null) else ?:[U](f(x)) def orElse(y: T): T = if (x == null) y else x } ``` ```scala scala> val x = ?:(obj)(_.subField)(_.subSubField).orElse("not found") x: java.lang.String = not found ``` Or if you prefer named syntax as opposed to operator syntax ```scala case class CoalesceNull[T](x: T) { def apply(): T = x def apply[U >: Null](f: T => U): CoalesceNull[U] = if (x == null) CoalesceNull[U](null) else CoalesceNull[U](f(x)) def orElse(y: T): T = if (x == null) y else x } ``` ```scala scala> val x = CoalesceNull(obj)(_.subField)(_.subSubField).orElse("not found") x: java.lang.String = not found ``` More examples ```scala case class Obj[T](field: T) test("last null") { val obj: Obj[Obj[Obj[Obj[String]]]] = Obj(Obj(Obj(Obj(null)))) val res0 = CoalesceNull(obj)(_.field)(_.field)(_.field)(_.field)() res0 should === (null) val res1 = CoalesceNull(obj)(_.field)(_.field)(_.field)(_.field).orElse("not found") res1 should === ("not found") } test("first null") { val obj: Obj[Obj[Obj[Obj[String]]]] = null val res0 = CoalesceNull(obj)(_.field)(_.field)(_.field)(_.field)() res0 should === (null) val res1 = CoalesceNull(obj)(_.field)(_.field)(_.field)(_.field).orElse("not found") res1 should === ("not found") } test("middle null") { val obj: Obj[Obj[Obj[Obj[String]]]] = Obj(Obj(null)) val res0 = CoalesceNull(obj)(_.field)(_.field)(_.field)(_.field)() res0 should === (null) val res1 = CoalesceNull(obj)(_.field)(_.field)(_.field)(_.field).orElse("not found") res1 should === ("not found") } test("not null") { val obj: Obj[Obj[Obj[Obj[String]]]] = Obj(Obj(Obj(Obj("something")))) val res0 = CoalesceNull(obj)(_.field)(_.field)(_.field)(_.field)() res0 should === ("something") val res1 = CoalesceNull(obj)(_.field)(_.field)(_.field)(_.field).orElse("not found") res1 should === ("something") } } ```
12,423,716
I'm working on a drawing application which requires high levels of accuracy, and I'm wondering which of the major browser platforms (including the HTML Canvas element, and Flash) give the best sub-pixel layout accuracy, both for drawn elements (rectangles in the Canvas or Flash, absolutely positioned DIVs in the browser), and for text. There are a number of posts related to this, both on this site and others, (see list at bottom), but many are quite old, and none summarises the current situation. My understanding is that Flash has native support for sub-pixel positioning, using twips to position objects to one twentieth of a pixel, and that when the TextLayoutFramework is used, this accuracy also extends to text. There is at least one report, however, that this doesn't work properly in Chrome. Can anyone confirm this? My understanding of the situation in the browsers is that Firefox 14+ supports sub-pixel positioning for text and drawn elements, both in page layout and within the Canvas, but I haven't been able to ascertain how accurate this is. I understand Chrome (as of v21) does not support sub-pixel positioning at all. I understand IE9 doesn't support sub-pixel positioning, but it appears from the MS blog post linked below that IE10 will. I don't know if there's any Mac/PC variance in this, and I don't know also if the accuracy of Flash varies between platforms and/or browsers. I understand a summary question like this may provoke some debate, but I believe this is specific enough for people to provide useful answers, and hope that this thread can be a reference for the state of positioning accuracy up to now. Some references: <http://blogs.msdn.com/b/ie/archive/2012/02/17/sub-pixel-rendering-and-the-css-object-model.aspx> [Sub-pixel rendering in Chrome Canvas](https://stackoverflow.com/questions/6720977/sub-pixel-rendering-in-chrome-canvas) <http://johnblackburne.blogspot.co.uk/2011/11/twips.html> <http://ejohn.org/blog/sub-pixel-problems-in-css/> [Sub Pixel CSS positioning](https://stackoverflow.com/questions/3103252/sub-pixel-css-positioning) <https://productforums.google.com/forum/?fromgroups=#!topic/chrome/pRt3tiVIkSI>
2012/09/14
[ "https://Stackoverflow.com/questions/12423716", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1014822/" ]
Currently, you can expect the best rounding and sub-pixel support to come from Mozilla with IE as the runner up. IE might end up being more fine tuned, but their release cycles are so long that Mozilla is likely to stay ahead of them. As far as doing sub-pixel layout, you may be chasing a wisp, because the sub-pixel advantage improves anti-aliasing issues, not screen location accuracy. Your image will never be more accurate than 1 pixel from the true position, regardless of sub-pixel support. The reason why some browsers don't zoom properly has nothing to do with sub-pixel support, it is because they are not remembering the exact position and rounding correctly. In other words, they are prematurely rounding the position and that causes the image to be mis-aligned.
**Short answer:** No. It is NOT possible/documented. And even if determined experimentally, it is NOT guaranteed to remain the same in future. **Long answer:** At sub-pixel accuracies, there is a lot of variance among Browsers/OS/HW about how the input is captured/rendered. With h/w acceleration being enabled on most modern browsers, there are a large number variations in rendering across different PCs running different browsers on different operating systems. So much so that, it is possible to even identify every unique user by the slightly different [**variations in the rendered output of a common sample**](http://cseweb.ucsd.edu/~hovav/dist/canvas.pdf). Rather than worrying about the discrepancies in the underlying frameworks, How about designing the UI of your drawing application to be independent of those problems. Couple of methods i can think of right now are: 1. Allow editing the image at zoomed/magnified levels. 2. Design a snap-to-grid method for elements. **Update:** The "zoom" operation would your custom implementation and NOT a feature of the underlying frameworks. So if you need sub-pixel accuracy to the order of 1/10th of a pixel, one would need to have a 10x\_zoom() implemented as part of you web-app which would render the data from 1st pixel --> 10x10pixels at (0,0), 2nd pixel --> 10x10pixels starting from (11,11). This way one would have a very magnified view of the data, but the framework is blissfully unaware of all this and renders accurate to the onscreen-pixel(which in our case now is 1/10th of the image pixel). Also an important thing to note that this operation would consume a lot of memory if done for the entire image at once. Hence doing this for ONLY the visible part of the image in a "zoom-window" would be faster and a less memory intensive process. Once implemented in your drawing web-app the sub-pixel inaccuracies in the frameworks might not turn out to be a problem for the user as he can always switch into these modes and provide accurate input.
20,459,074
I want to know that, How offset works in WPF in GradientStop ``` <Grid.Background> <LinearGradientBrush> <GradientStopCollection> <GradientStop Color="Black" Offset="0" /> <GradientStop Color="Red" Offset="1" /> </GradientStopCollection> </LinearGradientBrush> </Grid.Background> ```
2013/12/08
[ "https://Stackoverflow.com/questions/20459074", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2875566/" ]
you are comparing the pointer value, which is different you need to use [`strcmp`](http://en.cppreference.com/w/cpp/string/byte/strcmp) to compare c string. or use [`std::string`](http://en.cppreference.com/w/cpp/string/basic_string) ``` if (strcmp(val, file_data) == 0) { cout<<"Matched"<<endl; } else { cout<<"Not Matched"<<endl; } ``` or ``` if (std::string(val) == std::string(file_data)) { cout<<"Matched"<<endl; } else { cout<<"Not Matched"<<endl; } ```
The `==` test compares the addresses `val` and `file_data`. Instead of `==`, to compare the contents of the character arrays use the function `strcmp()`.
20,459,074
I want to know that, How offset works in WPF in GradientStop ``` <Grid.Background> <LinearGradientBrush> <GradientStopCollection> <GradientStop Color="Black" Offset="0" /> <GradientStop Color="Red" Offset="1" /> </GradientStopCollection> </LinearGradientBrush> </Grid.Background> ```
2013/12/08
[ "https://Stackoverflow.com/questions/20459074", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2875566/" ]
you are comparing the pointer value, which is different you need to use [`strcmp`](http://en.cppreference.com/w/cpp/string/byte/strcmp) to compare c string. or use [`std::string`](http://en.cppreference.com/w/cpp/string/basic_string) ``` if (strcmp(val, file_data) == 0) { cout<<"Matched"<<endl; } else { cout<<"Not Matched"<<endl; } ``` or ``` if (std::string(val) == std::string(file_data)) { cout<<"Matched"<<endl; } else { cout<<"Not Matched"<<endl; } ```
character arrays have no the comparision operator. So instead of comparing arrays theirself you are comparing addresses of first elements of the arrays.
20,459,074
I want to know that, How offset works in WPF in GradientStop ``` <Grid.Background> <LinearGradientBrush> <GradientStopCollection> <GradientStop Color="Black" Offset="0" /> <GradientStop Color="Red" Offset="1" /> </GradientStopCollection> </LinearGradientBrush> </Grid.Background> ```
2013/12/08
[ "https://Stackoverflow.com/questions/20459074", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2875566/" ]
you are comparing the pointer value, which is different you need to use [`strcmp`](http://en.cppreference.com/w/cpp/string/byte/strcmp) to compare c string. or use [`std::string`](http://en.cppreference.com/w/cpp/string/basic_string) ``` if (strcmp(val, file_data) == 0) { cout<<"Matched"<<endl; } else { cout<<"Not Matched"<<endl; } ``` or ``` if (std::string(val) == std::string(file_data)) { cout<<"Matched"<<endl; } else { cout<<"Not Matched"<<endl; } ```
The given code, ``` char file_data[10]; std::ifstream file_read ("D:\\myfile.txt"); cout<<"Enter the number to search"<<endl; char val[10]; cin>>val; while(!file_read.eof()) { file_read>>file_data; cout<<file_data<<endl; } if (val == file_data) { cout<<"Matched"<<endl; } else { cout<<"Not Matched"<<endl; } } ``` looks like this after running it through AStyle: ``` char file_data[10]; std::ifstream file_read ("D:\\myfile.txt"); cout<<"Enter the number to search"<<endl; char val[10]; cin>>val; while(!file_read.eof()) { file_read>>file_data; cout<<file_data<<endl; } if (val == file_data) { cout<<"Matched"<<endl; } else { cout<<"Not Matched"<<endl; } } ``` So, since the checking is done *after* the loop, checking only the *last* item read by the loop, even if you got the string comparison itself correct your program would not work. The comparison doesn't work because, as others (rushing in) have already noted, you're comparing pointers, not strings. To compare strings, use **`std::string`** instead of character arrays. --- Minor correction: instead of ``` while(!file_read.eof()) ``` write ``` while(!file_read.fail()) ``` or just ``` while(file_read) ``` which calls `fail` for you (negating the result). But doing this you would *also* have to check for success/failure of the input operation. And the common idiom is to do that directly: ``` while( file_read>>file_data ) ```
20,459,074
I want to know that, How offset works in WPF in GradientStop ``` <Grid.Background> <LinearGradientBrush> <GradientStopCollection> <GradientStop Color="Black" Offset="0" /> <GradientStop Color="Red" Offset="1" /> </GradientStopCollection> </LinearGradientBrush> </Grid.Background> ```
2013/12/08
[ "https://Stackoverflow.com/questions/20459074", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2875566/" ]
you are comparing the pointer value, which is different you need to use [`strcmp`](http://en.cppreference.com/w/cpp/string/byte/strcmp) to compare c string. or use [`std::string`](http://en.cppreference.com/w/cpp/string/basic_string) ``` if (strcmp(val, file_data) == 0) { cout<<"Matched"<<endl; } else { cout<<"Not Matched"<<endl; } ``` or ``` if (std::string(val) == std::string(file_data)) { cout<<"Matched"<<endl; } else { cout<<"Not Matched"<<endl; } ```
The == operator will simply compare the address. You will need to use strcmp function.
20,459,074
I want to know that, How offset works in WPF in GradientStop ``` <Grid.Background> <LinearGradientBrush> <GradientStopCollection> <GradientStop Color="Black" Offset="0" /> <GradientStop Color="Red" Offset="1" /> </GradientStopCollection> </LinearGradientBrush> </Grid.Background> ```
2013/12/08
[ "https://Stackoverflow.com/questions/20459074", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2875566/" ]
The `==` test compares the addresses `val` and `file_data`. Instead of `==`, to compare the contents of the character arrays use the function `strcmp()`.
character arrays have no the comparision operator. So instead of comparing arrays theirself you are comparing addresses of first elements of the arrays.
20,459,074
I want to know that, How offset works in WPF in GradientStop ``` <Grid.Background> <LinearGradientBrush> <GradientStopCollection> <GradientStop Color="Black" Offset="0" /> <GradientStop Color="Red" Offset="1" /> </GradientStopCollection> </LinearGradientBrush> </Grid.Background> ```
2013/12/08
[ "https://Stackoverflow.com/questions/20459074", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2875566/" ]
The given code, ``` char file_data[10]; std::ifstream file_read ("D:\\myfile.txt"); cout<<"Enter the number to search"<<endl; char val[10]; cin>>val; while(!file_read.eof()) { file_read>>file_data; cout<<file_data<<endl; } if (val == file_data) { cout<<"Matched"<<endl; } else { cout<<"Not Matched"<<endl; } } ``` looks like this after running it through AStyle: ``` char file_data[10]; std::ifstream file_read ("D:\\myfile.txt"); cout<<"Enter the number to search"<<endl; char val[10]; cin>>val; while(!file_read.eof()) { file_read>>file_data; cout<<file_data<<endl; } if (val == file_data) { cout<<"Matched"<<endl; } else { cout<<"Not Matched"<<endl; } } ``` So, since the checking is done *after* the loop, checking only the *last* item read by the loop, even if you got the string comparison itself correct your program would not work. The comparison doesn't work because, as others (rushing in) have already noted, you're comparing pointers, not strings. To compare strings, use **`std::string`** instead of character arrays. --- Minor correction: instead of ``` while(!file_read.eof()) ``` write ``` while(!file_read.fail()) ``` or just ``` while(file_read) ``` which calls `fail` for you (negating the result). But doing this you would *also* have to check for success/failure of the input operation. And the common idiom is to do that directly: ``` while( file_read>>file_data ) ```
character arrays have no the comparision operator. So instead of comparing arrays theirself you are comparing addresses of first elements of the arrays.
20,459,074
I want to know that, How offset works in WPF in GradientStop ``` <Grid.Background> <LinearGradientBrush> <GradientStopCollection> <GradientStop Color="Black" Offset="0" /> <GradientStop Color="Red" Offset="1" /> </GradientStopCollection> </LinearGradientBrush> </Grid.Background> ```
2013/12/08
[ "https://Stackoverflow.com/questions/20459074", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2875566/" ]
The == operator will simply compare the address. You will need to use strcmp function.
character arrays have no the comparision operator. So instead of comparing arrays theirself you are comparing addresses of first elements of the arrays.
20,275,467
Hi everybody my problem is the following: I want to write a testunit for a class i have written. For this I have the following Junit code: ``` 1 package ts; 2 import ts.TransitionSystem; 3 import ts.ConcreteTransitionSystem; 4 import java.util.Set; 5 import java.util.HashSet; 6 import java.util.HashMap; 7 8 import org.junit.Test; 9 public class TransitionSystemTest { 10 11 @Test 12 public void addInitialTest () { 13 TransitionSystem ts = new ConcreteTransitionSystem(); 14 ts.addInitialState("test"); 15 assertTrue(ts._initialStates.contains("test")); 16 assertTrue(ts._states.get("s0").isEmpty()); 17 } 18 19 } ``` my class looks as follows: ``` 1 package ts; 2 3 import java.util.Set; 4 import java.util.HashSet; 5 import java.util.HashMap; 6 import ts.TransitionSystem; 7 8 public class ConcreteTransitionSystem implements TransitionSystem { 9 Set<String> aps; 10 HashMap<String, Set<String>> _states; 11 Set<String> _initialStates; 12 13 public void addInitialState(String s0) { 14 Set<String> sucessors = new HashSet<String>(); 15 this._states.put(s0, sucessors); 16 this._initialStates.add(s0); 17 } 18 } ``` and the error it get is the following: ``` TransitionSystemTest.java:15: error: cannot find symbol [javac] assertTrue(ts._initialStates.contains("test")); [javac] ^ [javac] symbol: variable _initialStates [javac] location: variable ts of type TransitionSystem ``` and ``` TransitionSystemTest.java:16: error: cannot find symbol [javac] assertTrue(ts._states.get("s0").isEmpty()); [javac] ^ [javac] symbol: variable _states [javac] location: variable ts of type TransitionSystem ``` I cannot figure out the problem. Any ideas?
2013/11/28
[ "https://Stackoverflow.com/questions/20275467", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2251084/" ]
It's basic member scoping. ConcreteTransitionSystem.\_initialStates and \_states are default or package level visibility. If you want to access them in this fashion, you could make them public or add getters (I'd recommend the latter). More here <http://docs.oracle.com/javase/tutorial/java/javaOO/accesscontrol.html>
Because the compiler thinks the variable ts has the type "TransitionSystem". You can change the code to: ``` ConcreteTransitionSystem ts = new ConcreteTransitionSystem(); ```
20,275,467
Hi everybody my problem is the following: I want to write a testunit for a class i have written. For this I have the following Junit code: ``` 1 package ts; 2 import ts.TransitionSystem; 3 import ts.ConcreteTransitionSystem; 4 import java.util.Set; 5 import java.util.HashSet; 6 import java.util.HashMap; 7 8 import org.junit.Test; 9 public class TransitionSystemTest { 10 11 @Test 12 public void addInitialTest () { 13 TransitionSystem ts = new ConcreteTransitionSystem(); 14 ts.addInitialState("test"); 15 assertTrue(ts._initialStates.contains("test")); 16 assertTrue(ts._states.get("s0").isEmpty()); 17 } 18 19 } ``` my class looks as follows: ``` 1 package ts; 2 3 import java.util.Set; 4 import java.util.HashSet; 5 import java.util.HashMap; 6 import ts.TransitionSystem; 7 8 public class ConcreteTransitionSystem implements TransitionSystem { 9 Set<String> aps; 10 HashMap<String, Set<String>> _states; 11 Set<String> _initialStates; 12 13 public void addInitialState(String s0) { 14 Set<String> sucessors = new HashSet<String>(); 15 this._states.put(s0, sucessors); 16 this._initialStates.add(s0); 17 } 18 } ``` and the error it get is the following: ``` TransitionSystemTest.java:15: error: cannot find symbol [javac] assertTrue(ts._initialStates.contains("test")); [javac] ^ [javac] symbol: variable _initialStates [javac] location: variable ts of type TransitionSystem ``` and ``` TransitionSystemTest.java:16: error: cannot find symbol [javac] assertTrue(ts._states.get("s0").isEmpty()); [javac] ^ [javac] symbol: variable _states [javac] location: variable ts of type TransitionSystem ``` I cannot figure out the problem. Any ideas?
2013/11/28
[ "https://Stackoverflow.com/questions/20275467", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2251084/" ]
Your initial problem is, that you attempt to access the classes internal variables via the `TransitionSystem` interface - you will of course have only access to the methods (and possibly constants) defined in your interface. This is really a good thing, as it separates the public contract (the interface) from the implementing class! And thus you should rethink your unit tests to use only the interface methods as well! The interface (along with wanted behaviour defined in some requirements document) defines the contract of the implementing class to the outer world, and anything you cannot test by its interface is just that: internal implementation detail of the implementing class).
Because the compiler thinks the variable ts has the type "TransitionSystem". You can change the code to: ``` ConcreteTransitionSystem ts = new ConcreteTransitionSystem(); ```
57,849,569
I have a React component named "Badge" returning some Text that is styled bold. ``` render() { return ( <div> <Text weight={'bold'}> {this.props.label} </Text> </div> ) ``` Now, I use "Badge" in another component named "Card".   Because in Badge component all Text is styled bold, the whole sentence is bold as well: ``` return ( <div> <Badge lable={'This part of the sentence is ' + 'normal font style' + ' and the rest is bold.'}></Badge> </div> ) ``` Now, I would like to style the items in this element differently: I want to remove the bold style from 'normal font style' - only for this single part of the string. I already tried this way, but it doesn't work: ``` <Badge label={'This part of the sentence is ' + <span class=”normalText”>'normal font style'</span> + ' and the rest is bold.'}></Badge> ``` As an absolute beginner, this problem is driving me crazy. Any ideas how to solve this?
2019/09/09
[ "https://Stackoverflow.com/questions/57849569", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9209492/" ]
If you want to pass the `text` with `html` tag then you have to pass all the text/tags in `html` form. Check below code. ``` import React, { Component } from 'react'; import ReactDOM,{ render } from 'react-dom'; import Badge from './Badge'; import './style.css'; class App extends React.Component { render() { return ( <div> <Badge label="test" /><br/> <Badge label={'This part of the sentence is ' + 'normal font style' + ' and the rest is bold.'} /><br/> <Badge label={<> <span>This part of the sentence is</span> <span className="normalText">'normal font style'</span> <span> and the rest is bold.</span> </>} /> </div> ); } } render(<App />, document.getElementById('root')); ``` I have created small demo for you. <https://stackblitz.com/edit/react-rvuqv6> Hope this will work for you!
The more appropriate system is take label value as badge's children. to declare Badge component code like this example: ``` const Badge = props => { return ( <div className={`badge-class`}> <Text weight={'bold'}> {props.children} </Text> </div> ) } ``` and now call the component like this ``` return ( <div> <Badge> This part of the sentence is <span className={`normal-texts`}>normal font style</span> and the rest is bold. </Badge> </div> ) ``` with this you can pass any type children on Badge component, text, image etc.
24,170,402
We have run into a strange bug that we're having problems debugging. We have a MDI workspace that uses Microsoft CAB, DevExpress components, and .Net 3.5. If users open two windows in the workspace that each contain a `UserControl` bound to two separate data models, then minimize both of them, the first window to minimize is getting it's bound fields cleared when the second one minimizes. The `.Equals` and `.GetHashCode` methods of the data model have been overridden so that both data models are considered equal. If we change that so they are unique, we do not get this behavior. Here's some example pseudocode showing the problem ``` var a = new MyWindow(); a.DataModel = new SomeClass(123); a.ShowInMdiWorkspace(); var b = new MyWindow(); b.DataModel = new SomeClass(123); b.ShowInMdiWorksace(); a.Minimize(); // If SomeClass.GetHashCode() is overwritten to consider two objects // as equal based on the value passed in, then the data bindings for A // get cleared on this call. If SomeClass.GetHashCode is unique, then // this problem does not happen. b.Minimize(); ``` Here's the Call Stack when the second window gets minimized: ![enter image description here](https://i.stack.imgur.com/xjDm8.png) At the `EndEditSession()` call in the stack trace above, it is calling `EndEditSession` for the *second* window minimized, while by the time the Stack Trace gets past the `[External Code]` to the OnChange breakpoint I have set, it is firing the change method in the *first* window. `EndEditSession()` is something custom we have implemented which looks something like this ``` protected void EndEditSession() { IBindingValue bv = null; if (_bindingValues == null) return; if (_data != null) { foreach (KeyValuePair<string, IBindingValue> kvp in _bindingValues) { bv = kvp.Value; if (bv.IsBindable) ((PropertyManager)bv.Component.BindingContext[_data]).EndCurrentEdit(); } } } ``` `_bindingValues` gets populated when the UserControl initializes its data bindings. The key fields are the name of the bound control, and the value fields are a custom object which stores the control itself, its name, its bound value, and default value. `bv.Component` returns the control that the binding is set on, which in the case of my testing is a customized DevExpress `LookupEdit` `_data` contains the data model for the `UserControl`, and I can verify that it is set to the instance for the second window. My original thought was that the `BindingContext` was shared so the wrong `PropertyManager` was being returned, however I have verified that the `.BindingContext` for the two forms and controls are separate. Is it possible that having two separate copies of a `UserControl` bound to two separate instances of a data model would get its bindings mixed up when the `GetHashCode` method has been overridden so that the two objects are considered equal? I am not very familiar with the inner workings of the WinForms binding system, or with exactly how CAB's MDI workspace gets managed. My theory is that when the first window minimizes, it is unloading the controls to save on memory, then when the second window minimizes the internal hash table that manages the bindings is incorrectly getting confused and running an update to take data from the first minimized window (which is now blank) and updating its datasource. There are plenty of holes in this theory, however its the only thing I can think of.
2014/06/11
[ "https://Stackoverflow.com/questions/24170402", "https://Stackoverflow.com", "https://Stackoverflow.com/users/302677/" ]
I don't know the internal workings the WinForm widget, but it seems that since you've encountered an issue with **overriding** equals that you'd be better off **working around**. **If you need to evaluate equality for your own purposes:** An approach is to provide your own method to evaluate equality, rather than changing the default behavior. **If your intention is to change how the widget treats the objects:** An approach is to make a static object factory for your class. The factory could maintain a collection of all of the objects created using weak references. Weak references allow the GC to collect the objects. The factory can then check the collection of previously created objects. If a match is found then return the existing one. If not then create it. This way rather than having two different objects that evaluate two equal (override equals) you'd have a single object with two references that is equal (same memory). Hopefully one of these other approaches will solve your problem.
`BindingContext` object are not sharing its fields and properties with any other `BindingContext` because its fields and properties are not static. But, it is possible to have one `BindingContext` object for several controls. In the first case if several controls have the same parent and have not their own `BindingContext` then `BindingContext` property of this controls will return `Control.Parent(.Parent...).BindingContext` object. In the second case there are can be something like this: ``` var bindingContext = new BindingContext(); var a = new SomeControl(); var b = new SomeControl(); a.BindingContext = bindingContext; b.BindingContext = bindingContext; ``` In the third case `BindingContext` can be overwritten in such a way. I don't know what is going on in your case, so I can only recommend to do something like this before initializing data bindings: ``` var a = new SomeControl(); var b = new SomeControl(); a.BindingContext = new BindingContext(); b.BindingContext = new BindingContext(); ``` If this does not solve your problem then you need to check the populating of your `_bindingValues` object. It is possible that during the populating of this object it is populated with wrong values.
3,771,831
I have 2 Windows 2008 R2 x64 servers NLB, ARR with shared configuration. I have the application files in a network share. ASP.net pages (.aspx) come up fine but no css,images,js work. I also have a .htm file shows css and images just fine. In the iis log I do see a 401.3 message. So it seems to be permissions but not sure what else to configure permissions wise. I read similiar issues at: [MVC + IIS7 = CSS Issue](https://stackoverflow.com/questions/353726/mvc-iis7-css-issue#354938) <https://serverfault.com/questions/70050/adding-a-virtual-directory-iis-7-5-windows-7-ultimate-x64/130322#130322> <https://serverfault.com/questions/126978/iis-7-5-401-3-access-denied> I tried the suggested solutions - none seems to work (unless I missed something). Any advice is greatly appreciated!
2010/09/22
[ "https://Stackoverflow.com/questions/3771831", "https://Stackoverflow.com", "https://Stackoverflow.com/users/331884/" ]
For future solution-searchers having the same or similar problem... I had the same (or similar) problem with my little asp web app. But used this solution, which worked instantly: > > The solution for me was to install the “Static Content” support for IIS. > > > 1. Go to “Turn Windows features on or off” > 2. Select Internet Information Services > 3. Select World Wide Web Services > 4. And check Static Content > > > Source: <http://www.dailycomputersolutions.com/blog/index.php/2010/04/23/iis-not-showing-images-and-css/>
For me, the issue was with this part of my web.config: ``` <authentication mode="Forms"> <forms timeout="2880" loginUrl="/Home?expired=true" requireSSL="false" protection="All" cookieless="UseCookies" /> </authentication> ``` I had to change requireSSL from true to false when running under local host without https. Boom, CSS and images showed up.
3,771,831
I have 2 Windows 2008 R2 x64 servers NLB, ARR with shared configuration. I have the application files in a network share. ASP.net pages (.aspx) come up fine but no css,images,js work. I also have a .htm file shows css and images just fine. In the iis log I do see a 401.3 message. So it seems to be permissions but not sure what else to configure permissions wise. I read similiar issues at: [MVC + IIS7 = CSS Issue](https://stackoverflow.com/questions/353726/mvc-iis7-css-issue#354938) <https://serverfault.com/questions/70050/adding-a-virtual-directory-iis-7-5-windows-7-ultimate-x64/130322#130322> <https://serverfault.com/questions/126978/iis-7-5-401-3-access-denied> I tried the suggested solutions - none seems to work (unless I missed something). Any advice is greatly appreciated!
2010/09/22
[ "https://Stackoverflow.com/questions/3771831", "https://Stackoverflow.com", "https://Stackoverflow.com/users/331884/" ]
In my case, I had the `<staticContent>` tag in the `web.config` file. I had to comment it, run the project (then all css, js, images loaded), uncomment it and run the project again, somehow it worked...
I forgot the permissions. <https://serverfault.com/a/260778/30695> Had to add `IIS_IUSRS` with read permissions.
3,771,831
I have 2 Windows 2008 R2 x64 servers NLB, ARR with shared configuration. I have the application files in a network share. ASP.net pages (.aspx) come up fine but no css,images,js work. I also have a .htm file shows css and images just fine. In the iis log I do see a 401.3 message. So it seems to be permissions but not sure what else to configure permissions wise. I read similiar issues at: [MVC + IIS7 = CSS Issue](https://stackoverflow.com/questions/353726/mvc-iis7-css-issue#354938) <https://serverfault.com/questions/70050/adding-a-virtual-directory-iis-7-5-windows-7-ultimate-x64/130322#130322> <https://serverfault.com/questions/126978/iis-7-5-401-3-access-denied> I tried the suggested solutions - none seems to work (unless I missed something). Any advice is greatly appreciated!
2010/09/22
[ "https://Stackoverflow.com/questions/3771831", "https://Stackoverflow.com", "https://Stackoverflow.com/users/331884/" ]
In addition to Authentication and all the other issues mentioned above, check your web application's Handler Mappings in IIS. The culprit could be a catch-all \* handler hijacking your .css and .js requests. In my case I recently installed ColdFusion on one of our servers and that added managed handlers to IIS making all the requests to asset files to throw a 500 Internal Server Error. I disabled that handler and everything went back to normal.
For me, the issue was with this part of my web.config: ``` <authentication mode="Forms"> <forms timeout="2880" loginUrl="/Home?expired=true" requireSSL="false" protection="All" cookieless="UseCookies" /> </authentication> ``` I had to change requireSSL from true to false when running under local host without https. Boom, CSS and images showed up.
3,771,831
I have 2 Windows 2008 R2 x64 servers NLB, ARR with shared configuration. I have the application files in a network share. ASP.net pages (.aspx) come up fine but no css,images,js work. I also have a .htm file shows css and images just fine. In the iis log I do see a 401.3 message. So it seems to be permissions but not sure what else to configure permissions wise. I read similiar issues at: [MVC + IIS7 = CSS Issue](https://stackoverflow.com/questions/353726/mvc-iis7-css-issue#354938) <https://serverfault.com/questions/70050/adding-a-virtual-directory-iis-7-5-windows-7-ultimate-x64/130322#130322> <https://serverfault.com/questions/126978/iis-7-5-401-3-access-denied> I tried the suggested solutions - none seems to work (unless I missed something). Any advice is greatly appreciated!
2010/09/22
[ "https://Stackoverflow.com/questions/3771831", "https://Stackoverflow.com", "https://Stackoverflow.com/users/331884/" ]
For future solution-searchers having the same or similar problem... I had the same (or similar) problem with my little asp web app. But used this solution, which worked instantly: > > The solution for me was to install the “Static Content” support for IIS. > > > 1. Go to “Turn Windows features on or off” > 2. Select Internet Information Services > 3. Select World Wide Web Services > 4. And check Static Content > > > Source: <http://www.dailycomputersolutions.com/blog/index.php/2010/04/23/iis-not-showing-images-and-css/>
I forgot the permissions. <https://serverfault.com/a/260778/30695> Had to add `IIS_IUSRS` with read permissions.
3,771,831
I have 2 Windows 2008 R2 x64 servers NLB, ARR with shared configuration. I have the application files in a network share. ASP.net pages (.aspx) come up fine but no css,images,js work. I also have a .htm file shows css and images just fine. In the iis log I do see a 401.3 message. So it seems to be permissions but not sure what else to configure permissions wise. I read similiar issues at: [MVC + IIS7 = CSS Issue](https://stackoverflow.com/questions/353726/mvc-iis7-css-issue#354938) <https://serverfault.com/questions/70050/adding-a-virtual-directory-iis-7-5-windows-7-ultimate-x64/130322#130322> <https://serverfault.com/questions/126978/iis-7-5-401-3-access-denied> I tried the suggested solutions - none seems to work (unless I missed something). Any advice is greatly appreciated!
2010/09/22
[ "https://Stackoverflow.com/questions/3771831", "https://Stackoverflow.com", "https://Stackoverflow.com/users/331884/" ]
Okay here's what I did to resolve my issue. 1. Since my app files are in a file share the Anonymous user account couldn't access them. This is because by default IUSR account is used for Anoymous user. In IIS->Site->Authentication set Anonymous Authentication to Application Pool Identity if you have created a custom app pool OR you can specify an account. 2. C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\caspol.exe -m -ag 1 -url "file:////\computername\sharename\*" FullTrust -exclusive on
In addition to Authentication and all the other issues mentioned above, check your web application's Handler Mappings in IIS. The culprit could be a catch-all \* handler hijacking your .css and .js requests. In my case I recently installed ColdFusion on one of our servers and that added managed handlers to IIS making all the requests to asset files to throw a 500 Internal Server Error. I disabled that handler and everything went back to normal.
3,771,831
I have 2 Windows 2008 R2 x64 servers NLB, ARR with shared configuration. I have the application files in a network share. ASP.net pages (.aspx) come up fine but no css,images,js work. I also have a .htm file shows css and images just fine. In the iis log I do see a 401.3 message. So it seems to be permissions but not sure what else to configure permissions wise. I read similiar issues at: [MVC + IIS7 = CSS Issue](https://stackoverflow.com/questions/353726/mvc-iis7-css-issue#354938) <https://serverfault.com/questions/70050/adding-a-virtual-directory-iis-7-5-windows-7-ultimate-x64/130322#130322> <https://serverfault.com/questions/126978/iis-7-5-401-3-access-denied> I tried the suggested solutions - none seems to work (unless I missed something). Any advice is greatly appreciated!
2010/09/22
[ "https://Stackoverflow.com/questions/3771831", "https://Stackoverflow.com", "https://Stackoverflow.com/users/331884/" ]
For future solution-searchers having the same or similar problem... I had the same (or similar) problem with my little asp web app. But used this solution, which worked instantly: > > The solution for me was to install the “Static Content” support for IIS. > > > 1. Go to “Turn Windows features on or off” > 2. Select Internet Information Services > 3. Select World Wide Web Services > 4. And check Static Content > > > Source: <http://www.dailycomputersolutions.com/blog/index.php/2010/04/23/iis-not-showing-images-and-css/>
In addition to Authentication and all the other issues mentioned above, check your web application's Handler Mappings in IIS. The culprit could be a catch-all \* handler hijacking your .css and .js requests. In my case I recently installed ColdFusion on one of our servers and that added managed handlers to IIS making all the requests to asset files to throw a 500 Internal Server Error. I disabled that handler and everything went back to normal.
3,771,831
I have 2 Windows 2008 R2 x64 servers NLB, ARR with shared configuration. I have the application files in a network share. ASP.net pages (.aspx) come up fine but no css,images,js work. I also have a .htm file shows css and images just fine. In the iis log I do see a 401.3 message. So it seems to be permissions but not sure what else to configure permissions wise. I read similiar issues at: [MVC + IIS7 = CSS Issue](https://stackoverflow.com/questions/353726/mvc-iis7-css-issue#354938) <https://serverfault.com/questions/70050/adding-a-virtual-directory-iis-7-5-windows-7-ultimate-x64/130322#130322> <https://serverfault.com/questions/126978/iis-7-5-401-3-access-denied> I tried the suggested solutions - none seems to work (unless I missed something). Any advice is greatly appreciated!
2010/09/22
[ "https://Stackoverflow.com/questions/3771831", "https://Stackoverflow.com", "https://Stackoverflow.com/users/331884/" ]
In my case, I had the `<staticContent>` tag in the `web.config` file. I had to comment it, run the project (then all css, js, images loaded), uncomment it and run the project again, somehow it worked...
For me, the issue was with this part of my web.config: ``` <authentication mode="Forms"> <forms timeout="2880" loginUrl="/Home?expired=true" requireSSL="false" protection="All" cookieless="UseCookies" /> </authentication> ``` I had to change requireSSL from true to false when running under local host without https. Boom, CSS and images showed up.
3,771,831
I have 2 Windows 2008 R2 x64 servers NLB, ARR with shared configuration. I have the application files in a network share. ASP.net pages (.aspx) come up fine but no css,images,js work. I also have a .htm file shows css and images just fine. In the iis log I do see a 401.3 message. So it seems to be permissions but not sure what else to configure permissions wise. I read similiar issues at: [MVC + IIS7 = CSS Issue](https://stackoverflow.com/questions/353726/mvc-iis7-css-issue#354938) <https://serverfault.com/questions/70050/adding-a-virtual-directory-iis-7-5-windows-7-ultimate-x64/130322#130322> <https://serverfault.com/questions/126978/iis-7-5-401-3-access-denied> I tried the suggested solutions - none seems to work (unless I missed something). Any advice is greatly appreciated!
2010/09/22
[ "https://Stackoverflow.com/questions/3771831", "https://Stackoverflow.com", "https://Stackoverflow.com/users/331884/" ]
Okay here's what I did to resolve my issue. 1. Since my app files are in a file share the Anonymous user account couldn't access them. This is because by default IUSR account is used for Anoymous user. In IIS->Site->Authentication set Anonymous Authentication to Application Pool Identity if you have created a custom app pool OR you can specify an account. 2. C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\caspol.exe -m -ag 1 -url "file:////\computername\sharename\*" FullTrust -exclusive on
In my case, I had the `<staticContent>` tag in the `web.config` file. I had to comment it, run the project (then all css, js, images loaded), uncomment it and run the project again, somehow it worked...
3,771,831
I have 2 Windows 2008 R2 x64 servers NLB, ARR with shared configuration. I have the application files in a network share. ASP.net pages (.aspx) come up fine but no css,images,js work. I also have a .htm file shows css and images just fine. In the iis log I do see a 401.3 message. So it seems to be permissions but not sure what else to configure permissions wise. I read similiar issues at: [MVC + IIS7 = CSS Issue](https://stackoverflow.com/questions/353726/mvc-iis7-css-issue#354938) <https://serverfault.com/questions/70050/adding-a-virtual-directory-iis-7-5-windows-7-ultimate-x64/130322#130322> <https://serverfault.com/questions/126978/iis-7-5-401-3-access-denied> I tried the suggested solutions - none seems to work (unless I missed something). Any advice is greatly appreciated!
2010/09/22
[ "https://Stackoverflow.com/questions/3771831", "https://Stackoverflow.com", "https://Stackoverflow.com/users/331884/" ]
Okay here's what I did to resolve my issue. 1. Since my app files are in a file share the Anonymous user account couldn't access them. This is because by default IUSR account is used for Anoymous user. In IIS->Site->Authentication set Anonymous Authentication to Application Pool Identity if you have created a custom app pool OR you can specify an account. 2. C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\caspol.exe -m -ag 1 -url "file:////\computername\sharename\*" FullTrust -exclusive on
For me, the issue was with this part of my web.config: ``` <authentication mode="Forms"> <forms timeout="2880" loginUrl="/Home?expired=true" requireSSL="false" protection="All" cookieless="UseCookies" /> </authentication> ``` I had to change requireSSL from true to false when running under local host without https. Boom, CSS and images showed up.
3,771,831
I have 2 Windows 2008 R2 x64 servers NLB, ARR with shared configuration. I have the application files in a network share. ASP.net pages (.aspx) come up fine but no css,images,js work. I also have a .htm file shows css and images just fine. In the iis log I do see a 401.3 message. So it seems to be permissions but not sure what else to configure permissions wise. I read similiar issues at: [MVC + IIS7 = CSS Issue](https://stackoverflow.com/questions/353726/mvc-iis7-css-issue#354938) <https://serverfault.com/questions/70050/adding-a-virtual-directory-iis-7-5-windows-7-ultimate-x64/130322#130322> <https://serverfault.com/questions/126978/iis-7-5-401-3-access-denied> I tried the suggested solutions - none seems to work (unless I missed something). Any advice is greatly appreciated!
2010/09/22
[ "https://Stackoverflow.com/questions/3771831", "https://Stackoverflow.com", "https://Stackoverflow.com/users/331884/" ]
Okay here's what I did to resolve my issue. 1. Since my app files are in a file share the Anonymous user account couldn't access them. This is because by default IUSR account is used for Anoymous user. In IIS->Site->Authentication set Anonymous Authentication to Application Pool Identity if you have created a custom app pool OR you can specify an account. 2. C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\caspol.exe -m -ag 1 -url "file:////\computername\sharename\*" FullTrust -exclusive on
For future solution-searchers having the same or similar problem... I had the same (or similar) problem with my little asp web app. But used this solution, which worked instantly: > > The solution for me was to install the “Static Content” support for IIS. > > > 1. Go to “Turn Windows features on or off” > 2. Select Internet Information Services > 3. Select World Wide Web Services > 4. And check Static Content > > > Source: <http://www.dailycomputersolutions.com/blog/index.php/2010/04/23/iis-not-showing-images-and-css/>
50,180,144
I have a question regarding recursive/cumulative addition of a particular column for example: Click on example How do I write this in SAS code which generates cumalitive addition with respect to column. Please help me with this. Thank you in Advance [Example](https://i.stack.imgur.com/N68Lp.png)
2018/05/04
[ "https://Stackoverflow.com/questions/50180144", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7222586/" ]
use sum statement ``` data have; input val; datalines; 1 2 3 ; data want; set have; newval+val; run; ```
Using `Retain` functionality. You can reuse the code below as basis for any iterative/cumulative calculations. ``` data have; input A; datalines; 1 2 3 ; run; data want; set have; Retain B; /* If condition to initialize B only once, _N_ is the current row number */ if _N_= 1 then B=0; B=B+A; /* put statement will print the table in the log */ put _all_; run; ``` Output: ``` A=1 B=1 _N_=1 A=2 B=3 _N_=2 A=3 B=6 _N_=3 ```
33,931,201
I am looking for a simplest way to parse disks in zpool. A list of disks in space separated format. For example below output shows zpool information. Is there any command to get list of physical disks only? ``` # zpool status pool pool: pool state: ONLINE scan: none requested config: NAME STATE READ WRITE CKSUM pool ONLINE 0 0 0 c2d44s2 ONLINE 0 0 0 c2d45s2 ONLINE 0 0 0 c2d46s2 ONLINE 0 0 0 errors: No known data errors ```
2015/11/26
[ "https://Stackoverflow.com/questions/33931201", "https://Stackoverflow.com", "https://Stackoverflow.com/users/934363/" ]
This should work although it might need some fixes for complex `zpool status` output : ``` # cat parsezs awk ' NF != 5 {next} $1 == "NAME" {getline;show=1;next} $1 ~ "mirror" {next} $1 ~ "raidz" {next} $1 ~ "replacing" {next} $1 ~ "error" {next} show == 1 {printf("%s ",$1)} END {printf("\n")}' # zpool status pool | parsezs c2d44s2 c2d45s2 c2d46s2 ```
This will also work and shows you the pool name too. Note that you need `nawk`, which is a more modern version of Awk on Solaris: ``` zpool status | nawk 'BEGIN{Disp=0}{if($1=="pool:") {if(Disp!=0) print ""; else Disp = 1; printf("%s ",$2)} ; if($1~"^c[0-9]") printf("%s ",$1)}END{print ""}' ``` The `Disp` variable is just to tidy up the output. This is a typcal result: ``` js_data_san c0t6006016049B13A00B337B4F7F1DDE411d0 c0t6006016093003B0022E5A8A8C833E711d0 rpool c0t5000CCA07D07C764d0 c0t5000CCA07D07C514d0 s10patchchk-ospool c0t6006016093003B00B488CFCF10D8E611d0 vmware_ds_nfs01 c0t6006016049B13A005AE1A9648112E511d0 ``` So in that example `rpool` and `js_data_san` each has two devices. It doesn't indicate if they are mirrored or concatenated, but that would be easy to change in the script.
18,496,011
I have a main activity which is showing/hiding a bunch of fragments. There is a login activity at the very start that logs the user in. When the user presses home or the multi-tasking button, the app should start a timer that (after the timer runs out) automatically logs the user out. This could be when the user returns to the app (and timer has run out -> logout) or while in the app and has done nothing. What exactly gets called when the user presses home/multi-tasking button in terms of the fragment's lifestyle methods? In my quick tests, it seems that the first fragment in the fragment manager's onPause is called everytime no matter the fragment on screen when the user exits out. How can i go about this?
2013/08/28
[ "https://Stackoverflow.com/questions/18496011", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1191353/" ]
Please have a look at this **tutorial** about the Fragment-Lifecycle: > > <http://developer.android.com/reference/android/app/Fragment.html#Lifecycle> > > > It explains the lifecycle of the Fragment with respect to its **Activity**. When the user presses the **home-button** for example: **onPause()** - fragment is no longer interacting with the user either because its **activity is being paused** or a fragment operation is modifying it in the activity.
The methods called on the fragment's lifecycle are the same that the activity's. You can check the complete set of methods that are called right here: [Fragments](http://developer.android.com/guide/components/fragments.html)
92,619
[Project Euler problem 1](https://projecteuler.net/problem=1) says: > > Find the sum of all the multiples of 3 or 5 below 1000. > > > I have written a program that will return the sum of the multiples of *any* list of positive integers. So for example if I wanted to know the sum of every integer that was a multiple of 3 and 5 that is less than 10 I would add 3,5,6, and 9 to get 23. My function can do this for any number of positive integers, between any range that starts from 1. ``` # Function to return sum of multiples that are within a certain range def MultiplesSum(multiple, end, start=1): mSum = 0 naturals = range(start, end) offset = -start if start == 0: raise ZeroDivisionError('Cannot start with the number 0') for num in multiple: for i in naturals: if i % num == 0 and naturals[i+offset] != 0: # print mSum,"+", i,"=",i+mSum mSum += i naturals[i+offset] = 0 i += 1 return mSum problem1 = MultiplesSum([3,5,2], 16) print problem1 # prints 88 ```
2015/06/04
[ "https://codereview.stackexchange.com/questions/92619", "https://codereview.stackexchange.com", "https://codereview.stackexchange.com/users/57863/" ]
### Simpler implementation You don't need `naturals` at all, and `offset` either. You could make the outer loop iterate over the `range(start, end)`, and for each value check if it can be divided by any one of `nums`, and add to the sum. ``` msum = 0 for i in range(start, end): for num in nums: if i % num == 0: msum += i break return msum ``` ### API The interface of your function is not intuitive: * The range start parameter goes after the range end parameter. That's not intuitive. Consider how Python's `range` works: + With one arg, the first arg is the end of the range + With two args, the first arg is the start, the second is the end of the range. It's natural that wayI suggest to follow that example * The first arg is called "multiple", singular. It's not a multiple. It's a collection of numbers. So `nums` would be a better name, and it would make it easier for readers to understand how to use this function ### Input validation In this part: > > > ``` > if start == 0: > raise ZeroDivisionError('Cannot start with the number 0') > > ``` > > The zero division error is inappropriate. You did not divide by zero, and it won't make sense for callers to catch this exception and handle it. In other languages this should be an `IllegalArgumentException`, in Python `ValueError` would be more appropriate. The real problem is not division by zero, but inappropriate use of the function. But then, why is `start=0` inappropriate? I see nothing wrong with that. What would be wrong is having 0 in `nums`. That's what you should validate instead. ### Coding style The recommended practice is to use `snake_case` for function names, not `CamelCase`. See more coding style recommendations in [PEP8](http://www.python.org/dev/peps/pep-0008/).
One big problem I see with your code is that you're using `range` to construct a data structure with the entire range of possible numbers in it. This could lead to huge memory requirements if `start` is far from `end`. A better choice would be to put the multiples you've already used into a `dict` ([dictionary](https://docs.python.org/2/tutorial/datastructures.html#dictionaries)). It's also suboptimal to check every single natural number between `start` and `end` for divisibility. `for ... in ...` is a useful tool, but it's not always applicable. This is one instance where using a counter would be preferable, since you could just add `num` to the counter each time and not have to check (you'd of course have to do the modulo once in order to get the right starting point).
92,619
[Project Euler problem 1](https://projecteuler.net/problem=1) says: > > Find the sum of all the multiples of 3 or 5 below 1000. > > > I have written a program that will return the sum of the multiples of *any* list of positive integers. So for example if I wanted to know the sum of every integer that was a multiple of 3 and 5 that is less than 10 I would add 3,5,6, and 9 to get 23. My function can do this for any number of positive integers, between any range that starts from 1. ``` # Function to return sum of multiples that are within a certain range def MultiplesSum(multiple, end, start=1): mSum = 0 naturals = range(start, end) offset = -start if start == 0: raise ZeroDivisionError('Cannot start with the number 0') for num in multiple: for i in naturals: if i % num == 0 and naturals[i+offset] != 0: # print mSum,"+", i,"=",i+mSum mSum += i naturals[i+offset] = 0 i += 1 return mSum problem1 = MultiplesSum([3,5,2], 16) print problem1 # prints 88 ```
2015/06/04
[ "https://codereview.stackexchange.com/questions/92619", "https://codereview.stackexchange.com", "https://codereview.stackexchange.com/users/57863/" ]
If there are \$m\$ numbers in `multiple` and \$n\$ numbers in the range from `start` to `end`, then the function in the original post takes \$O(mn)\$. There's an alternative algorithm, using the [inclusion–exclusion principle](http://en.wikipedia.org/wiki/Inclusion%E2%80%93exclusion_principle), that takes \$O(m2^m)\$, which is faster when \$2^m < n\$. ``` from fractions import gcd from functools import reduce from itertools import combinations def lcm(seq): """Return the lowest common multiple of the numbers in the sequence.""" return reduce(lambda a, b: a * b // gcd(a, b), seq) def sum_multiples(numbers, start, stop): """Return the sum of all values between start (inclusive) and stop (exclusive) that are multiples of any values in the sequence numbers. """ result, sign = 0, 1 for i in range(1, len(numbers) + 1): for c in combinations(numbers, i): m = lcm(c) a = (start + m - 1) // m n = (stop + m - 1) // m - a result += sign * (a * n + (n - 1) * n // 2) * m sign = -sign return result ```
One big problem I see with your code is that you're using `range` to construct a data structure with the entire range of possible numbers in it. This could lead to huge memory requirements if `start` is far from `end`. A better choice would be to put the multiples you've already used into a `dict` ([dictionary](https://docs.python.org/2/tutorial/datastructures.html#dictionaries)). It's also suboptimal to check every single natural number between `start` and `end` for divisibility. `for ... in ...` is a useful tool, but it's not always applicable. This is one instance where using a counter would be preferable, since you could just add `num` to the counter each time and not have to check (you'd of course have to do the modulo once in order to get the right starting point).
92,619
[Project Euler problem 1](https://projecteuler.net/problem=1) says: > > Find the sum of all the multiples of 3 or 5 below 1000. > > > I have written a program that will return the sum of the multiples of *any* list of positive integers. So for example if I wanted to know the sum of every integer that was a multiple of 3 and 5 that is less than 10 I would add 3,5,6, and 9 to get 23. My function can do this for any number of positive integers, between any range that starts from 1. ``` # Function to return sum of multiples that are within a certain range def MultiplesSum(multiple, end, start=1): mSum = 0 naturals = range(start, end) offset = -start if start == 0: raise ZeroDivisionError('Cannot start with the number 0') for num in multiple: for i in naturals: if i % num == 0 and naturals[i+offset] != 0: # print mSum,"+", i,"=",i+mSum mSum += i naturals[i+offset] = 0 i += 1 return mSum problem1 = MultiplesSum([3,5,2], 16) print problem1 # prints 88 ```
2015/06/04
[ "https://codereview.stackexchange.com/questions/92619", "https://codereview.stackexchange.com", "https://codereview.stackexchange.com/users/57863/" ]
One big problem I see with your code is that you're using `range` to construct a data structure with the entire range of possible numbers in it. This could lead to huge memory requirements if `start` is far from `end`. A better choice would be to put the multiples you've already used into a `dict` ([dictionary](https://docs.python.org/2/tutorial/datastructures.html#dictionaries)). It's also suboptimal to check every single natural number between `start` and `end` for divisibility. `for ... in ...` is a useful tool, but it's not always applicable. This is one instance where using a counter would be preferable, since you could just add `num` to the counter each time and not have to check (you'd of course have to do the modulo once in order to get the right starting point).
I would suggest a simpler solution because Python is 'battery-included': ``` def multiple_sum(start, end, step): return sum(range(start + (start % step), end, step)) ``` This makes use of (fast) built-ins and reads like pseudocode.
92,619
[Project Euler problem 1](https://projecteuler.net/problem=1) says: > > Find the sum of all the multiples of 3 or 5 below 1000. > > > I have written a program that will return the sum of the multiples of *any* list of positive integers. So for example if I wanted to know the sum of every integer that was a multiple of 3 and 5 that is less than 10 I would add 3,5,6, and 9 to get 23. My function can do this for any number of positive integers, between any range that starts from 1. ``` # Function to return sum of multiples that are within a certain range def MultiplesSum(multiple, end, start=1): mSum = 0 naturals = range(start, end) offset = -start if start == 0: raise ZeroDivisionError('Cannot start with the number 0') for num in multiple: for i in naturals: if i % num == 0 and naturals[i+offset] != 0: # print mSum,"+", i,"=",i+mSum mSum += i naturals[i+offset] = 0 i += 1 return mSum problem1 = MultiplesSum([3,5,2], 16) print problem1 # prints 88 ```
2015/06/04
[ "https://codereview.stackexchange.com/questions/92619", "https://codereview.stackexchange.com", "https://codereview.stackexchange.com/users/57863/" ]
### Simpler implementation You don't need `naturals` at all, and `offset` either. You could make the outer loop iterate over the `range(start, end)`, and for each value check if it can be divided by any one of `nums`, and add to the sum. ``` msum = 0 for i in range(start, end): for num in nums: if i % num == 0: msum += i break return msum ``` ### API The interface of your function is not intuitive: * The range start parameter goes after the range end parameter. That's not intuitive. Consider how Python's `range` works: + With one arg, the first arg is the end of the range + With two args, the first arg is the start, the second is the end of the range. It's natural that wayI suggest to follow that example * The first arg is called "multiple", singular. It's not a multiple. It's a collection of numbers. So `nums` would be a better name, and it would make it easier for readers to understand how to use this function ### Input validation In this part: > > > ``` > if start == 0: > raise ZeroDivisionError('Cannot start with the number 0') > > ``` > > The zero division error is inappropriate. You did not divide by zero, and it won't make sense for callers to catch this exception and handle it. In other languages this should be an `IllegalArgumentException`, in Python `ValueError` would be more appropriate. The real problem is not division by zero, but inappropriate use of the function. But then, why is `start=0` inappropriate? I see nothing wrong with that. What would be wrong is having 0 in `nums`. That's what you should validate instead. ### Coding style The recommended practice is to use `snake_case` for function names, not `CamelCase`. See more coding style recommendations in [PEP8](http://www.python.org/dev/peps/pep-0008/).
If there are \$m\$ numbers in `multiple` and \$n\$ numbers in the range from `start` to `end`, then the function in the original post takes \$O(mn)\$. There's an alternative algorithm, using the [inclusion–exclusion principle](http://en.wikipedia.org/wiki/Inclusion%E2%80%93exclusion_principle), that takes \$O(m2^m)\$, which is faster when \$2^m < n\$. ``` from fractions import gcd from functools import reduce from itertools import combinations def lcm(seq): """Return the lowest common multiple of the numbers in the sequence.""" return reduce(lambda a, b: a * b // gcd(a, b), seq) def sum_multiples(numbers, start, stop): """Return the sum of all values between start (inclusive) and stop (exclusive) that are multiples of any values in the sequence numbers. """ result, sign = 0, 1 for i in range(1, len(numbers) + 1): for c in combinations(numbers, i): m = lcm(c) a = (start + m - 1) // m n = (stop + m - 1) // m - a result += sign * (a * n + (n - 1) * n // 2) * m sign = -sign return result ```
92,619
[Project Euler problem 1](https://projecteuler.net/problem=1) says: > > Find the sum of all the multiples of 3 or 5 below 1000. > > > I have written a program that will return the sum of the multiples of *any* list of positive integers. So for example if I wanted to know the sum of every integer that was a multiple of 3 and 5 that is less than 10 I would add 3,5,6, and 9 to get 23. My function can do this for any number of positive integers, between any range that starts from 1. ``` # Function to return sum of multiples that are within a certain range def MultiplesSum(multiple, end, start=1): mSum = 0 naturals = range(start, end) offset = -start if start == 0: raise ZeroDivisionError('Cannot start with the number 0') for num in multiple: for i in naturals: if i % num == 0 and naturals[i+offset] != 0: # print mSum,"+", i,"=",i+mSum mSum += i naturals[i+offset] = 0 i += 1 return mSum problem1 = MultiplesSum([3,5,2], 16) print problem1 # prints 88 ```
2015/06/04
[ "https://codereview.stackexchange.com/questions/92619", "https://codereview.stackexchange.com", "https://codereview.stackexchange.com/users/57863/" ]
### Simpler implementation You don't need `naturals` at all, and `offset` either. You could make the outer loop iterate over the `range(start, end)`, and for each value check if it can be divided by any one of `nums`, and add to the sum. ``` msum = 0 for i in range(start, end): for num in nums: if i % num == 0: msum += i break return msum ``` ### API The interface of your function is not intuitive: * The range start parameter goes after the range end parameter. That's not intuitive. Consider how Python's `range` works: + With one arg, the first arg is the end of the range + With two args, the first arg is the start, the second is the end of the range. It's natural that wayI suggest to follow that example * The first arg is called "multiple", singular. It's not a multiple. It's a collection of numbers. So `nums` would be a better name, and it would make it easier for readers to understand how to use this function ### Input validation In this part: > > > ``` > if start == 0: > raise ZeroDivisionError('Cannot start with the number 0') > > ``` > > The zero division error is inappropriate. You did not divide by zero, and it won't make sense for callers to catch this exception and handle it. In other languages this should be an `IllegalArgumentException`, in Python `ValueError` would be more appropriate. The real problem is not division by zero, but inappropriate use of the function. But then, why is `start=0` inappropriate? I see nothing wrong with that. What would be wrong is having 0 in `nums`. That's what you should validate instead. ### Coding style The recommended practice is to use `snake_case` for function names, not `CamelCase`. See more coding style recommendations in [PEP8](http://www.python.org/dev/peps/pep-0008/).
I would suggest a simpler solution because Python is 'battery-included': ``` def multiple_sum(start, end, step): return sum(range(start + (start % step), end, step)) ``` This makes use of (fast) built-ins and reads like pseudocode.
92,619
[Project Euler problem 1](https://projecteuler.net/problem=1) says: > > Find the sum of all the multiples of 3 or 5 below 1000. > > > I have written a program that will return the sum of the multiples of *any* list of positive integers. So for example if I wanted to know the sum of every integer that was a multiple of 3 and 5 that is less than 10 I would add 3,5,6, and 9 to get 23. My function can do this for any number of positive integers, between any range that starts from 1. ``` # Function to return sum of multiples that are within a certain range def MultiplesSum(multiple, end, start=1): mSum = 0 naturals = range(start, end) offset = -start if start == 0: raise ZeroDivisionError('Cannot start with the number 0') for num in multiple: for i in naturals: if i % num == 0 and naturals[i+offset] != 0: # print mSum,"+", i,"=",i+mSum mSum += i naturals[i+offset] = 0 i += 1 return mSum problem1 = MultiplesSum([3,5,2], 16) print problem1 # prints 88 ```
2015/06/04
[ "https://codereview.stackexchange.com/questions/92619", "https://codereview.stackexchange.com", "https://codereview.stackexchange.com/users/57863/" ]
If there are \$m\$ numbers in `multiple` and \$n\$ numbers in the range from `start` to `end`, then the function in the original post takes \$O(mn)\$. There's an alternative algorithm, using the [inclusion–exclusion principle](http://en.wikipedia.org/wiki/Inclusion%E2%80%93exclusion_principle), that takes \$O(m2^m)\$, which is faster when \$2^m < n\$. ``` from fractions import gcd from functools import reduce from itertools import combinations def lcm(seq): """Return the lowest common multiple of the numbers in the sequence.""" return reduce(lambda a, b: a * b // gcd(a, b), seq) def sum_multiples(numbers, start, stop): """Return the sum of all values between start (inclusive) and stop (exclusive) that are multiples of any values in the sequence numbers. """ result, sign = 0, 1 for i in range(1, len(numbers) + 1): for c in combinations(numbers, i): m = lcm(c) a = (start + m - 1) // m n = (stop + m - 1) // m - a result += sign * (a * n + (n - 1) * n // 2) * m sign = -sign return result ```
I would suggest a simpler solution because Python is 'battery-included': ``` def multiple_sum(start, end, step): return sum(range(start + (start % step), end, step)) ``` This makes use of (fast) built-ins and reads like pseudocode.
4,773,982
I've got a sample code from MSDN and I've found code syntax I've never seen before: ``` namespace Mvc3RemoteVal.Controllers { public class HomeController : Controller { IUserDB _repository; #if InMemDB public HomeController() : this(InMemoryDB.Instance) { } #else public HomeController() : this(new EF_UserRepository()) { } #endif public HomeController(IUserDB repository) { _repository = repository; } [...] } ``` What are those `#if`, `#else`, `#endif`? And what is `#if InMemDB`? What is `InMemDB`? A variable?
2011/01/23
[ "https://Stackoverflow.com/questions/4773982", "https://Stackoverflow.com", "https://Stackoverflow.com/users/257234/" ]
Those are called [preprocessor directives](http://msdn.microsoft.com/en-us/library/ed8yd1ha.aspx) and exist since .NET 1.0. They allow you to define different compilation directives such as `InMemDB` and the compiler will evaluate or not the block if this variable has been defined. The documentation of the [#if directive](http://msdn.microsoft.com/en-us/library/4y6tbswk.aspx) provides a more in-depth overview. In order to define a variable you could use the [/define](http://msdn.microsoft.com/en-us/library/0feaad6z.aspx) compiler option or use the *Conditional compilation symbols* in the *Build* tab of the properties of the project in Visual Studio: ![alt text](https://i.stack.imgur.com/l9SFL.png)
These are not new features for Framework 4 this are features you can use for development stage and testing: you can declare: ``` #Define something ``` and then ``` #if something ``` all the code that is in that "if" will be executed. all the code that isn't, won't.
12,937,977
Is latest spring 3 framework compatible with apache tomcat application server - version 6.0.14? Also can what is the best version of hibernate i can use along with latest version of spring. Is it fine to use configuration xml file in the spring 3 application setup instead of @configuration annotation in the code ? Please share your thoughts. Thanks
2012/10/17
[ "https://Stackoverflow.com/questions/12937977", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1197338/" ]
Yes - Spring 3 will work fine with version 6.0.14 of Tomcat. hibernate 4.1.7 should work fine. Yes you can use an XML configuration rather than annotations, I've used both in Spring an Tomcat an it works fine. To be honest, I find I prefer the annotations simply by the fact the XML tends to erode quite quickly and isn't touched for months after initial creation.
*spring 3 framework compatible with apache tomcat 6* **yes.** *best version of hibernate* **4, the latest and greatest.** *Is it fine to use configuration xml file* **yes** (tomcat is not a full blown application server btw, that would be jboss glassfish et al)
24,638,834
I'm trying to run some tests, seven to be specific, I've created my xml file and all and it works correctly, my test file has a package which has the seven tests in it, so the thing is, when the xml file is executed it opens a new browser window for each test (in case you were wondering, I do have the driver quit and close functions, they are at the @afterTest annotation) and I don't want that, what I need is just to get one browser open at all times, e.g. after finishing test one, close that browser because for the second test a second browser is open, what I'll like to get is to close each browser after each test is finished, is it a way to achieve that? Here is my pom file: http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 ``` <groupId>com.enterprise.automation</groupId> <artifactId>enterpriseAutomation</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>jar</packaging> <name>barcoAutomation</name> <url>http://maven.apache.org</url> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <!-- added --> <suiteFile>src/test/resources/barcoColor.xml</suiteFile> </properties> <dependencies> <dependency> <groupId>org.testng</groupId> <artifactId>testng</artifactId> <version>6.8</version> <!-- <classifier>jdk17</classifier> --> </dependency> <dependency> <groupId>org.uncommons</groupId> <artifactId>reportng</artifactId> <version>1.1.2</version> </dependency> <dependency> <groupId>org.seleniumhq.selenium</groupId> <artifactId>selenium-java</artifactId> <version>2.42.2</version> </dependency> <dependency> <groupId>org.apache.poi</groupId> <artifactId>poi</artifactId> <version>3.10-FINAL</version> </dependency> <dependency> <groupId>org.apache.poi</groupId> <artifactId>poi-ooxml</artifactId> <version>3.10-FINAL</version> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.16</version> <configuration> <suiteXmlFiles> <suiteXmlFile>src/test/resources/myTestsFile.xml</suiteXmlFile> </suiteXmlFiles> </configuration> </plugin> </plugins> <resources> <resource> <directory>src/test/resources/</directory> </resource> </resources> </build> ``` EDIT: the reason i don't want the seven browsers opened is because we are testing a SPA which has a lot of javascript and it consumes a bit too much pc resources, so if more than one browser are opened the computer performance drops I also saw the "-1", if you could tell how to improve the question details I'll appreciate it Thanks
2014/07/08
[ "https://Stackoverflow.com/questions/24638834", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3010145/" ]
Instead of `@AfterTest` and `@BeforeTest` use `@BeforeSuite` and `@AfterSuite` Create a BaseTest class containing @BeforeSuite and @AfterSuite. ``` public class BaseTest{ static WebDriver driver; @BeforeSuite public void start() { driver = new FFDriver(); driver.get(url); } @AfterSuite public void end() { driver.close(); driver.quit(); } } ``` Create Test classes. ``` public class Test1{ static WebDriver driver; @Test public void test1() { driver = BaseTest.driver; //code goes here } } public class Test2{ static WebDriver driver; @Test public void test2() { driver = BaseTest.driver; //code goes here } } ``` Modify testNG xml file as follows. ``` <suite name="Regression Testing" parallel="classes"> <test verbose="2" name="Test1"> <classes> <class name="BaseTest"/> <class name="Test1"/> </classes> </test> <test verbose="2" name="Test2"> <classes> <class name="Test2"/> </classes> </test> </suite> ``` The @BeforeSuite is run first followed by Test1, Test2 and @AfterSuite. Driver instance is obtained in each Test class by setting driver as static in BaseTest. Let me know if this helps you.
As far as I understand, if you say you want "to get is to close each browser after each test is finished", you need to use @AfterMethod and @BeforeMethod. This would ensure that after every @Test runs, the browser gets closed. With @AfterTest, this would happen just once - note Test in @AfterTest maps to `<test>` in the testng xml and does not map to @Test in your code. @AfterSuite would just close your browser once in the entire execution, which would mean if you wanted a clean session on each @Test, that won't happen. If you do not want a clean session, then @Before/@AfterSuite would work as well.
47,090
Consider a rectangular cross sectional beam for instance with dimensions a = 1 mm and b = 1 mm, fixed at one end and transverse force at the other. I will get the maximum stress at the farthest away point from the neutral axis. Now, if I decrease the dimensions to a = 0.5 mm and b = 0.5 mm, then we know that the maximum stress at the farthest away point from neutral axis will increase. But my question is does this increase in stress happens because the tensile force (or the compressive force) at the farthest away point has increased, or is it solely due to the fact that I have decreased the cross sectional area of the beam?
2021/09/10
[ "https://engineering.stackexchange.com/questions/47090", "https://engineering.stackexchange.com", "https://engineering.stackexchange.com/users/30547/" ]
It is actually more complicated than that. * the magnitude of the stress increases 8 fold * the tensile forces increase so that they generate the counteracting bending moment. --- When you decrease the cross-section from 1mm x 1mm to 0.5mm x 0.5m, the cross-sectional area decreases to 1/4 of the original but * the second moment of area decreases by $ \left(\frac{1}{2}\right)^4= \frac{1}{16} $(i.e. $I\_{new} = \frac{I\_0}{16}$ and * the section modulus decreases by $\frac{1}{8}$ (ie. $W\_{new} = \frac{W\_0}{8}$) The maximum stress due to bending is given from: $$\sigma\_b = \frac{M}{W}$$ So the ratio of the original (0) and the (new) will be $$\frac{\sigma\_{b,new}}{\sigma\_{b,0}} = \frac{\frac{M}{W\_{new}}}{\frac{M}{W\_{0}}}$$ $$\frac{\sigma\_{b,new}}{\sigma\_{b,0}} = \frac{W\_{0}}{W\_{new}}=8$$ So by reducing by half both dimensions, the stresses due bending increase 8 fold. --- why do the tensile forces increase ---------------------------------- The tensile (and compressive) forces during bending increase so that their combined effect generates the required bending moment to counteract the bending moment from the external loads. [![enter image description here](https://i.stack.imgur.com/hXVYs.png)](https://i.stack.imgur.com/hXVYs.png) **Figure (source [a builders engineer](http://www.abuildersengineer.com/2014/06/beams-section-modulus.html)** The above illustration shows in (1) a section with a bending moment M is presented. Notice that the resulting normal forces are such that they counteract M. The idea is that: * the displacement changes linearly with the distance from the neutral center. * A force at a distance from the neutral axis ($F\_i$) develops that is proportional to the displacement * Each force ($F\_i$) produces a moment $M\_i$ * The integral of all the moment over the cross-section should be equal to M $$M= \sum M\_i$$ Figures 2 and 3 show what happens to the tensile forces when the cross-section is reoriented.
Section properties in a fluxural member play a dual role as opposed to members in simple tension or compression. in a tension member stress increases jist because there are less fibers to share the load. But in a beam's reduction in section has dual effect of rediucing the second area moment which weakens the beam's bending resistance and also the fact that now there is less fibers to share the load. reducing the height by half reduces the I, 2nd area moment by 1/4 and reducing the width by half reduces the the srea by half. so 8 times load on th ultimate fiber.
50,626,223
i am fairly new to React and this is my first project with Redux. I get some data and set it in the state-tree. When my reducer `ADD_PRODUCTS_TO_CART` runs, my `Products->render()` runs, but `Product->render()` does not, despite having a key. Here is a gist, it was the most basic i could boil it down to. Hope it makes sense, i've included a file that represents the state of the tree, so you can see the data structure. <https://gist.github.com/hoodweb/e4005e4f1fc95682d4dd9bf87b81fe39> **TLDR:** Basically the stock decrements in the statetree, but is not rendered. What am i doing wrong? **Update:** I have put in `console.log()` in all render methods, to see what is called. When i decrease the stock of my product, the product is not called. This is most likely due to the `.map(() => <Product/>)` i am doing. I tried changing my `key={}` property to include the stock like this: `.map((obj) => <Product key={obj.ID.toString() + obj.Stock.toString()} data={obj} />)` Which seems to work. But I do know how stable this is. **Update2:** It seems that if i take my `data={}` property at put it into seperate properties like this `<Product key={obj.ID} stock={obj.Stock} title={obj.Title} price={obj.Price} beforePrice={obj.BeforePrice}` it works. So that is my solution for now.
2018/05/31
[ "https://Stackoverflow.com/questions/50626223", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7744500/" ]
In `render` function of `Product` you got: ``` if (data.Variations) { //TODO: Variation logic return false; } ``` Because in `data` you got `Variations` param, it goes through this scope (beacause `Variations` is not `null` or `undefined`) and returns null instead of rendering component. remove `return false` and your code should work fine.
Like @kiarashws said, whenever you `return false` in your `render()` method, it doesn't render. Make sure to not render only when you don't want to. Is commonly see code like this: ``` render() { if (props.shouldNotRender) return null or false; return <div> ... </div> } ```
28,507,978
I want to format my output of a Java program so that I can see "how deep" the recursion is. How to do it? It is really important not to get lost in my recursion tree. Example output (trivial recursion function for counting the nth number from 0): ``` This is the first recursive call. Input value: 3. This is the second recursive call. Input value: 2. This is the 3rd recursive call. Input value: 1. Output value : 1. This is again the second recursive call. Input value: 2. Output value : 1 + 1. This is again the first recursive call. Input value: 3. Output value : 1 + 1 + 1. ```
2015/02/13
[ "https://Stackoverflow.com/questions/28507978", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4280359/" ]
You can use a variable (like `level`) that represents how deep you are. It starts at 1 and it increments at each recursive call. ``` public static void main(String[] args) { function(3, 1); } public static String function(int input, int level) { String tab = ""; for (int i = 0; i < level - 1; i++) { tab += "\t"; } System.out.println(tab + "This is the " + level + " recursive call. Input value: " + input); if (input == 1) { System.out.println(tab + "Output value: 1"); return "1"; } String output = function(input - 1, level + 1); System.out.println(tab + "This is again the " + level + " recursive call. Input value: " + input); System.out.println(tab + "Output value: " + output + " + 1"); return output + " + 1"; } ```
Well, if you're using System.out.println, than you should be able to use "\tThis is the..." to indent the line on most java output windows. I don't understand if this is what you're asking for though. If you don't know which recursion you're in, than you'd have to crawl Thread.currentThread().getStackTrace(). ``` String s = ""; while(numRecursions --> 0) s += "\t"; System.out.println(s + "Something something something") ``` Again, if you don't have a numRecursions variable than you'd have to do something like this ``` int numRecursions = 0; void a(){ int temp = ++ numRecursions; String s = ""; while(temp --> 0) s += "\t"; System.out.println(s + "This is a recursion level"); //code numRecursions--; } ```
28,507,978
I want to format my output of a Java program so that I can see "how deep" the recursion is. How to do it? It is really important not to get lost in my recursion tree. Example output (trivial recursion function for counting the nth number from 0): ``` This is the first recursive call. Input value: 3. This is the second recursive call. Input value: 2. This is the 3rd recursive call. Input value: 1. Output value : 1. This is again the second recursive call. Input value: 2. Output value : 1 + 1. This is again the first recursive call. Input value: 3. Output value : 1 + 1 + 1. ```
2015/02/13
[ "https://Stackoverflow.com/questions/28507978", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4280359/" ]
You can use a variable (like `level`) that represents how deep you are. It starts at 1 and it increments at each recursive call. ``` public static void main(String[] args) { function(3, 1); } public static String function(int input, int level) { String tab = ""; for (int i = 0; i < level - 1; i++) { tab += "\t"; } System.out.println(tab + "This is the " + level + " recursive call. Input value: " + input); if (input == 1) { System.out.println(tab + "Output value: 1"); return "1"; } String output = function(input - 1, level + 1); System.out.println(tab + "This is again the " + level + " recursive call. Input value: " + input); System.out.println(tab + "Output value: " + output + " + 1"); return output + " + 1"; } ```
In your output function include a prefix string argument. Every time you call your function pass in prefix + " ". Example: ``` public void output(String prefix){ // Whenever you print, start with prefix System.out.println(prefix + ...); // When you call your recursive method String childPrefix = prefix+" "; output(childPrefix); } ```
44,533,925
I'm trying to switch from MacVim to VSCode and I use [VSCode Vim](https://github.com/VSCodeVim/Vim) extension. The most annoying thing I found so far is: if I search with `/` command - I can't disable a highlighting of search results. Could you pls help me to find a way how to hide search result highlighting after I've done with search?
2017/06/14
[ "https://Stackoverflow.com/questions/44533925", "https://Stackoverflow.com", "https://Stackoverflow.com/users/797346/" ]
I've found an answer: in `settings.json` ``` "vim.normalModeKeyBindingsNonRecursive": [ { "before":["<C-n>"], "after":[], "commands": [ { "command": ":nohl" } ] } ] ```
Alternately, you can also just set `vim.hlsearch` to false.
44,533,925
I'm trying to switch from MacVim to VSCode and I use [VSCode Vim](https://github.com/VSCodeVim/Vim) extension. The most annoying thing I found so far is: if I search with `/` command - I can't disable a highlighting of search results. Could you pls help me to find a way how to hide search result highlighting after I've done with search?
2017/06/14
[ "https://Stackoverflow.com/questions/44533925", "https://Stackoverflow.com", "https://Stackoverflow.com/users/797346/" ]
I've found an answer: in `settings.json` ``` "vim.normalModeKeyBindingsNonRecursive": [ { "before":["<C-n>"], "after":[], "commands": [ { "command": ":nohl" } ] } ] ```
You can also just bind it to escape, which isn't bound to anything in normal mode. ``` "vim.normalModeKeyBindingsNonRecursive": [ { "before": [ "<Esc>" ], "commands": [ ":nohl" ], } ] ```
44,533,925
I'm trying to switch from MacVim to VSCode and I use [VSCode Vim](https://github.com/VSCodeVim/Vim) extension. The most annoying thing I found so far is: if I search with `/` command - I can't disable a highlighting of search results. Could you pls help me to find a way how to hide search result highlighting after I've done with search?
2017/06/14
[ "https://Stackoverflow.com/questions/44533925", "https://Stackoverflow.com", "https://Stackoverflow.com/users/797346/" ]
Alternately, you can also just set `vim.hlsearch` to false.
You can also just bind it to escape, which isn't bound to anything in normal mode. ``` "vim.normalModeKeyBindingsNonRecursive": [ { "before": [ "<Esc>" ], "commands": [ ":nohl" ], } ] ```
42,254,095
I have 2 entities in which totally 12 properties are there of 3 variations of min, max and average of some particular type of fields. Hence I refactored the 2 entities into 3 entities making the 3rd entity as 'Values' which contains 3 properties i.e min, max and average. And reduced the 12 properties into 4 relationships. Here's a replica of my models as an example in the image below. [![enter image description here](https://i.stack.imgur.com/4RAnK.png)](https://i.stack.imgur.com/4RAnK.png) As you can see I have one-to-one unidirectional relationship with the 3rd entity. However Xcode keeps on complaining about 'Inverse' relationship. [![enter image description here](https://i.stack.imgur.com/6rSjI.png)](https://i.stack.imgur.com/6rSjI.png) As per me I can add 4 relationships in 'Values' and update all to become 'inverse', however this doesn't seem to be the right solution as when the second entity gets tied to the 'Values', it will have additional 3 nil relationships and whereas in case of first it will have 1 additional nil relationship. Both of these are unnecessary. Refactoring 'Values' and splitting it into two similar entities also is not a good solution either I believe. Hence can anyone suggest me what is the right approach or best practice to solve this problem. Let me know if I'm unclear anywhere while describing my issue.
2017/02/15
[ "https://Stackoverflow.com/questions/42254095", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3113797/" ]
Based on your description, I would undo the refactoring and go back to using properties instead of relationships. You're adding complexity for no real benefit, and the `Values` entity is (as you're finding) too generic to really be useful or meaningful. This refactoring isn't serving any useful purpose; don't fix it, revert it.
You should look into [Weak Relationships (Fetched Properties)](https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/CoreData/HowManagedObjectsarerelated.html#//apple_ref/doc/uid/TP40001075-CH17-SW13) for how to manage relationships correctly and the solution for your error code. > > Most object relationships are inherently bidirectional. If a > Department has a to-many relationship to the Employees who work in a > Department, there is an inverse relationship from an Employee to the > Department that is to-one. **The major exception is a fetched property, > which represents a weak one-way relationship—there is no relationship > from the destination to the source.** > > > Also, if you want to make things easier, you should look into (if possible) avoid 3 objects and have a single object, or two objects, with the [propertiesToFetch](https://developer.apple.com/reference/coredata/nsfetchrequest/1506851-propertiestofetch) of the `NSFetchRequest` in mind. This way you can fetch your `Entity` , keep the properties in a single `Entity`, **but only fetch the properties you want** and avoid the overhead and memory consumption of fetching properties you are not going to use. Whichever fits your needs, you have the options. GL
9,418,499
Lets say a table like this (just for illustration): ``` KEY VALUE 1 A 2 A 3 B 4 C 5 A 6 B 7 C 8 A 9 C ``` I need a **SINGLE SQL** to get the key of the 3th (or less) occurrence for EACH value? ``` VALUE KEY A 5 (more than 3 occurrences, so it gets the 3th occurrence) B 6 (only 2 occurrences, so it gets the last one) C 9 ``` **Update: Oracle 10g**
2012/02/23
[ "https://Stackoverflow.com/questions/9418499", "https://Stackoverflow.com", "https://Stackoverflow.com/users/112670/" ]
I suspect there is a simpler way to write this without needing 3 layers of nesting. But this should work. ``` SQL> ed Wrote file afiedt.buf 1 with x as ( 2 select 1 key, 'A' val from dual union all 3 select 2, 'A' from dual union all 4 select 3, 'B' from dual union all 5 select 4, 'C' from dual union all 6 select 5, 'A' from dual union all 7 select 6, 'B' from dual union all 8 select 7, 'C' from dual union all 9 select 8, 'A' from dual union all 10 select 9, 'C' from dual) 11 select key, 12 val 13 from (select key, 14 val, 15 rnk, 16 max(rnk) over (partition by val) max_rnk 17 from (select key, 18 val, 19 rank() over (partition by val order by key) rnk 20 from x 21 ) 22 where rnk <= 3 23 ) 24* where rnk = max_rnk SQL> / KEY V ---------- - 5 A 6 B 9 C ```
``` SELECT t1.Value, t1."KEY" FROM (SELECT ROW_NUMBER() OVER (PARTITION BY Value ORDER BY "KEY") AS RowNumber, "KEY", Value FROM MyTable) t1 LEFT JOIN (SELECT ROW_NUMBER() OVER (PARTITION BY Value ORDER BY "KEY") AS RowNumber, "KEY", Value FROM MyTable) t2 ON t2.Value = t1.Value AND t2.RowNumber = t1.RowNumber + 1 WHERE t1.RowNumber = 3 OR (t1.RowNumber IN (1, 2) AND t2."Key" IS NULL) ```
9,950,449
I have an issue where I'm using the Nivo jQuery slider on a HTTPS: site and its javascript seems to be throwing a mixed content error in IE 8. I currently have a forum post up in the Dev7 Studios forum with no response yet. And I've googled for a couple of days on the IE 8 mixed content error. So far, I haven't found a clear fix except for one post where a guy stated that sometimes the "innerHTML" in a jquery file can cause the error. But he didn't really list a clear fix. Does anyone have any insight in to this? Any help or direction appreciated.
2012/03/30
[ "https://Stackoverflow.com/questions/9950449", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1195158/" ]
I ran into the same problem, and have traced it to a bug in IE8. The comments on this page led me to a solution: <http://blogs.msdn.com/b/ieinternals/archive/2009/06/22/https-mixed-content-in-ie8.aspx> This MS dev says: > > Fascinating. This is a race condition. > > > The debugger reports that the following is the URL that is triggering > the prompt: > > > "about:/images/lightview/inner\_slideshow\_play.png" > > > Of course, that URL doesn't actually exist in your markup. It looks > like there's dynamic creation of an IFRAME and injection of content > into that frame. The default URL for an empty frame is about:blank, > which leads to the prompt. > > > As a workaround, using an absolute URL would probably work, or by > initializing the IFRAME with a the SRC of a blank page on your server > (this should also fix the Mixed Content problem with IE6). > > > Normal browsers don't have a problem with URLs for dynamic content that aren't fully qualified, protocol and all. But IE8 *sometimes* drops the ball and instead of putting in the protocol and host, it puts in "about:" in front of your path, and fails to trust that in a https context. I edited nivoslider to qualify the URLs of all the images it draws dynamically. Further development would be needed to allow use of query strings in image URLs. Here's my [edited source](http://pastebin.com/znhGMhjh).
I was having same issue. In the header section I changed the src from `http://"mysite"/jquery.nivo.slider.pack.js` to just `/jquery.nivo.slider.pack.js` and worked.
37,132,999
I want sql query for update a record. For example there are 3 columns in my table - Name , Address, Email and when I update any one column other columns value should be null without set null to them. Like ``` Update tbl_Student set Name = 'XYZ' where id = 1 ``` In above case only Name column should update and other column should update by null. FYI, As there are two many columns that I need to set null that's why I wanted some kind of query to do that. Like - ``` ID ADDRESS NAME EMAIL 1 PARK ROAD JOHN john@gmail.com ``` And I want to update only name and want rest of the fields should be null.Like ``` Update Table SET NAME = 'NICK' WHERE ID = 1 ``` Then updated output should be - ``` ID ADDRESS NAME EMAIL 1 NULL NICK NULL ```
2016/05/10
[ "https://Stackoverflow.com/questions/37132999", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4767485/" ]
Wrapping the $scope.broadcast(); call inside a $scope.$evalAsync works for me: ``` myApp.controller('FirstController', function ($scope, $rootScope) { $scope.myInput = 'Initial data'; $scope.broadcast = function() { console.log ('broadcasting: ' + $scope.myInput); $rootScope.$broadcast('myEvent', $scope.myInput); }; $scope.$evalAsync( function() { $scope.broadcast(); }); }); ``` See: also <https://stackoverflow.com/a/23589271/1288109> See the documentation about $evalAsync at: <https://docs.angularjs.org/api/ng/type/$rootScope.Scope#$evalAsync>
basically the listeners is not ready and myEvent broadcast already so first you should emit the event to controller "FirstController" and then broadcast to the "SecondController" then it will work. Here is the fiddle ``` var myApp = angular.module('myApp',[]); myApp.controller('FirstController', function ($scope, $rootScope) { $scope.myInput = 'Initial data'; $scope.broadcast = function() { console.log ('broadcasting: ' + $scope.myInput); $rootScope.$broadcast('myEvent', $scope.myInput); }; $rootScope.$on("secondready",function(){ $scope.broadcast(); }); }); myApp.controller('SecondController', function ($scope, $rootScope) { $scope.$on('myEvent', function (event, args) { console.log ('myEvent catched - Data: ' + args); $scope.data = args; }); $scope.$emit("secondready"); }); ``` <https://jsfiddle.net/rbdf6xea/> or you can do by setTimeout as well
57,660,213
I need to do something quit simple - I would like to do a one time http request to a static data - I would like to do it either when the application starts or as "lazy-loading", when needed. I would like to send the http request one time and set a variable (member -> property) with the returning results, so I can use that property later on instead of doing another http request. Below is my code - is it the best practice solution ? Any remark\improvement\another way of doing it - would be appreciated. The "lut" is for "lookup table" dat -> the static data. ```js @Injectable({providedIn: 'root'}) export class lutData { _someData : somedataType[] = null; constructor(private lutService : LutService){} //The service is a simple http service public get SomeData() : somedataType[] { if (this._someData){ return this._someData; } else { this.lutService.getSomeLutData().subscribe(result =>{ this._someData = result; return this._someData; }); } } } ``` This is the component that should use the data: I'm using injection, but maybe there's a better way doing it. ```js export class XXX_Component { someData : somedataType[]; constructor(private lookUpData : lutData) { } ngOnInit() { this.setLutData(); } setLutData() { this.someData = this.lookUpData.SomeData; } } ```
2019/08/26
[ "https://Stackoverflow.com/questions/57660213", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6721134/" ]
What I would do is take the best of Observable: ```js @Injectable({providedIn: 'root'}) export class LutData { _someData : somedataType[] = null; constructor(private lutService : LutService){} //The service is a simple http service public someData() : Observable<somedataType[]> { if (this._someData){ return of(this._someData); } else { const req = this.lutService.getSomeLutData(); req.subscribe(data=> this._someData = data); return req; } } } ``` **Component** ```js export class XXX_Component { someData$ : Observable<somedataType[]> = this.lookUpData.someData(); constructor(private lookUpData : LutData) { } } ``` Then in your component template use the async pipe: ```html <div *ngFor="let item of (someData$ | async)"> {{item}} </div> ```
Store data in a service is very good way of making data available for all the components and also maintain the consistency. But calling the http request whenever your project is start or app is render on the device, depend on the use case. It's good, If you need updated data at least once whenever user land on your page like, user\_details, user jwt keys etc. Consider an example, suppose you have a page where you listing pricing/packages details of your services. And these information are not changing very frequently. For this example calling http service at the time of start your project is unnecessary. For this type of application, where your data are not changing very frequently you can call http once and after that store the response in your native storage with some validation roles. So whenever your page is open 1. Look into native storage for the data. 2. If found and pass the validation role. 3. Then store in a service for future use. 4. If not found or not able to pass validation role. 5. Call http request again. 6. Save the response to native storage with same validation role. 7. And also set the response in your service for future use.
32,566,682
how can I set radio button checked by default in Weebly using html and css? I'am trying to do something like this: ``` .wsite-form-radio-container input { checked: "checked"; } ```
2015/09/14
[ "https://Stackoverflow.com/questions/32566682", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5252142/" ]
I don't know what the options are in Weebly, but for the default check you could **use only HTML**. ``` <input type="radio" checked>Blue<br> <input type="radio">Red ``` Notice that I added `checked` to the blue one. This makes it checked by default. To style a checked radio button you could **use CSS**. ``` input:checked { .... } ```
Just add 'checked' to the input tag like this: `<input type="radio" checked>`
12,599,477
The following code causes null-pointer exception during execution. It just said null pointer exception. When I put the hotItem class outside of the function, it works without any problem. Once I put it into the function, it will cause null pointer exception. I just want to know why this would happen and what is the life cycle of the class inside a function. ``` private void getHotItem() { Gson gsonAdapter = new Gson(); class hotItem { private String hotItemPK = ""; } Type hotItemType = new TypeToken<List<hotItem>>(){}.getType(); List<hotItem> hotItemList = new ArrayList<hotItem>(); try { itemAccess.getHotItemList(); itemAccess.start(); itemAccess.join(); hotItemList = gsonAdapter.fromJson(returnData, hotItemType); if(!hotItemList.isEmpty()) { testText.setText(hotItemList.get(0).hotItemPK.toString()); } } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } ```
2012/09/26
[ "https://Stackoverflow.com/questions/12599477", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1699903/" ]
Use a view model that is adapted to the requirements of your view: ``` public class PriceViewModel { public int[] SelectedPriceIds { get; set; } public IEnumerable<SelectListItem> Prices { get; set; } } ``` A ListBoxFor requires 2 properties on your view model: 1. A collection property of a primitive type (`string[]`, `id[]`, `Guid[]`, ...) that will hold the ids of the selected elements 2. An `IEnumerable<SelectListItem>` property that will hold the list of all items and then in the view: ``` @Html.ListBoxFor(x => x.SelectedPriceIds, Model.Prices) ``` Now your controller actions will pass this view model to the view instead of your domain objects which simply are not adapted to what you are trying to achieve. It is inside the controller actions that you will populate this view model from your domain models.
i can select multiple value in your listbox so i will suggest to do this in another type you can use like this below.... you use this js file.. ``` <script type="text/javascript" src="@Url.Content("~/jquery-1.6.4.min.js")"></script> <script type="text/javascript" src="@Url.Content("~/chosen.jquery.js")"></script> <link href="@Url.Content("~/CSS/chosen.css")" rel="stylesheet" type="text/css" /> ``` and this use in your view ``` <script type="text/javascript"> $(document).ready(function() { $('.chzn-select').chosen(); }); </script> @Html.ListBoxFor(model => model.CountryId,Model.Countries, new { @class = "chzn-select",data-placeholder="Choose a Country...", Style = "width: 150px;" }) ``` you just bind your listbox and select your multiple value like this. see more for jquery choosen ... <http://davidwalsh.name/jquery-chosen> ![enter image description here](https://i.stack.imgur.com/eihsr.png) i think this will help you..
56,281,212
My `JFrame` for my program opens up extremely small, I have looked at a couple similar problems and fixes but none have worked so far... [![](https://i.imgur.com/bqqQmfd.png)](https://i.imgur.com/bqqQmfd.png) I am completely stumped with this, usually when I use the jframes it never does this, have I forgotten something simple? ```java /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package pkgfinal.project; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; /** * * @author conor */ public class SolBoard extends javax.swing.JFrame { private final int[][] laysout = { {0,0,1,1,1,0,0}, {0,0,1,1,1,0,0}, {1,1,1,1,1,1,1}, {1,1,1,1,1,1,1}, {1,1,1,1,1,1,1}, {0,0,1,1,1,0,0}, {0,0,1,1,1,0,0,} }; private final javax.swing.JButton[][] Board = new javax.swing.JButton[7][7]; public SolBoard() { initComponents(); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code"> private void initComponents() { for(int i=0;i<7;i++) { for(int j=0;j<7;j++){ if(laysout[i][j]==1) { Board[i][j] = new javax.swing.JButton(); Board[i][j].setText(i + "," + j); Board[i][j].setBounds(j*60 + 10, i*60 + 10, 50, 50 ); Board[i][j].addActionListener((ActionEvent e) -> { javax.swing.JButton button = (javax.swing.JButton) e.getSource(); System.out.println(button.getActionCommand()); }); getContentPane().add(Board[i][j]); } } } getContentPane().add(new javax.swing.JButton("v.1.0")); } /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(Board.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(() -> { new SolBoard().setVisible(true); }); } } ``` It should open to the size of the board (array of buttons)
2019/05/23
[ "https://Stackoverflow.com/questions/56281212", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Try this put this code in your `initComponents()`: ``` this.setVisible(true); this.getContentPane().setSize(400, 400); ``` Or this: ``` this.setPreferredSize(new Dimension(400, 300)); this.pack(); this.setLocationRelativeTo(null); this.setVisible(true); ``` I think that the order matters in this case
In `initComponents()` method write: ``` setSize(400, 400); setVisible(true);//call at the end of initiComponents method ``` then adjust size to your liking. You may also use `setPreferredSize`, `setMinimumSize`, `setMaximumSize` methods or `setExtendedState` to get full screen window. Example of full screen mode: ``` setExtendedState(JFrame.MAXIMIZED_BOTH); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setVisible(true); setUndecorated(true); ```
17,079,816
I have two check boxes in a page.If one check all check box is clicked, the other's check boxes are also enabled with the selected box. **jQuery** ``` $("#box_all").click(function () { $('td input[type=checkbox]').attr('checked', this.checked); }); $("#book_all").click(function () { $('td input[type=checkbox]').attr('checked', this.checked); }); ``` HTML ``` <th><%= check_box_tag "box_all" %></th> <td> <%= hidden_field_tag 'box_id', sd.box.id %> <%= check_box_tag "box_dance_ids[]", bd.id %> </td> <th><%= check_box_tag "book_all" %></th> <td ><%= check_box_tag "book_dance[book_ids][]", @book.id %></td> ``` can any body help me
2013/06/13
[ "https://Stackoverflow.com/questions/17079816", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2289720/" ]
i dont know where you put yours css file sow this are things that have to work ``` 1- <link href="..css/main.css" rel="stylesheet" type="text/css" /> 2- <link href="/css/main.css" rel="stylesheet" type="text/css" /> 3-<link href="../css/main.css" rel="stylesheet" type="text/css" /> ``` if no one of them work there is step 4 the 100% way to do it you just need to drag you css file to yours head and this will automatically buil the right link to css and if this is not helping you need to check all you id"s all css file his is not written right i recommend to start with step 4 it"s 100% way to get write link to your scc
Try this [I assuming css folder on root directory, css file path might be not correct.] ``` <link href="~/css/main.css" rel="stylesheet" type="text/css" /> ``` instead of ``` <link href="css/main.css" rel="stylesheet" type="text/css" /> ``` and place `<!DOCTYPE` before `<html>` tag.
17,079,816
I have two check boxes in a page.If one check all check box is clicked, the other's check boxes are also enabled with the selected box. **jQuery** ``` $("#box_all").click(function () { $('td input[type=checkbox]').attr('checked', this.checked); }); $("#book_all").click(function () { $('td input[type=checkbox]').attr('checked', this.checked); }); ``` HTML ``` <th><%= check_box_tag "box_all" %></th> <td> <%= hidden_field_tag 'box_id', sd.box.id %> <%= check_box_tag "box_dance_ids[]", bd.id %> </td> <th><%= check_box_tag "book_all" %></th> <td ><%= check_box_tag "book_dance[book_ids][]", @book.id %></td> ``` can any body help me
2013/06/13
[ "https://Stackoverflow.com/questions/17079816", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2289720/" ]
When linking to stylesheets in your masterpage, its always good to use the asp.net link instead of html link. This ensures that asp.net will resolve the paths from your root directory. All that you need to do for this is add the attribute `runat="server"`. ``` <link href="~/css/main.css" rel="stylesheet" type="text/css" runat="server"/> ``` Now even if your master page is not in the same directory as the aspx page, the css will get loaded correctly.
Try this [I assuming css folder on root directory, css file path might be not correct.] ``` <link href="~/css/main.css" rel="stylesheet" type="text/css" /> ``` instead of ``` <link href="css/main.css" rel="stylesheet" type="text/css" /> ``` and place `<!DOCTYPE` before `<html>` tag.
17,079,816
I have two check boxes in a page.If one check all check box is clicked, the other's check boxes are also enabled with the selected box. **jQuery** ``` $("#box_all").click(function () { $('td input[type=checkbox]').attr('checked', this.checked); }); $("#book_all").click(function () { $('td input[type=checkbox]').attr('checked', this.checked); }); ``` HTML ``` <th><%= check_box_tag "box_all" %></th> <td> <%= hidden_field_tag 'box_id', sd.box.id %> <%= check_box_tag "box_dance_ids[]", bd.id %> </td> <th><%= check_box_tag "book_all" %></th> <td ><%= check_box_tag "book_dance[book_ids][]", @book.id %></td> ``` can any body help me
2013/06/13
[ "https://Stackoverflow.com/questions/17079816", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2289720/" ]
i dont know where you put yours css file sow this are things that have to work ``` 1- <link href="..css/main.css" rel="stylesheet" type="text/css" /> 2- <link href="/css/main.css" rel="stylesheet" type="text/css" /> 3-<link href="../css/main.css" rel="stylesheet" type="text/css" /> ``` if no one of them work there is step 4 the 100% way to do it you just need to drag you css file to yours head and this will automatically buil the right link to css and if this is not helping you need to check all you id"s all css file his is not written right i recommend to start with step 4 it"s 100% way to get write link to your scc
Your code seems have no error. Only possibility that i can assume is issue in the paths. Use one the following depending on your stylesheet location: ``` / -Site root ~/ -Root directory of the application ``` try adding: ``` runat="server" ``` in your path as well. Good luck!
17,079,816
I have two check boxes in a page.If one check all check box is clicked, the other's check boxes are also enabled with the selected box. **jQuery** ``` $("#box_all").click(function () { $('td input[type=checkbox]').attr('checked', this.checked); }); $("#book_all").click(function () { $('td input[type=checkbox]').attr('checked', this.checked); }); ``` HTML ``` <th><%= check_box_tag "box_all" %></th> <td> <%= hidden_field_tag 'box_id', sd.box.id %> <%= check_box_tag "box_dance_ids[]", bd.id %> </td> <th><%= check_box_tag "book_all" %></th> <td ><%= check_box_tag "book_dance[book_ids][]", @book.id %></td> ``` can any body help me
2013/06/13
[ "https://Stackoverflow.com/questions/17079816", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2289720/" ]
When linking to stylesheets in your masterpage, its always good to use the asp.net link instead of html link. This ensures that asp.net will resolve the paths from your root directory. All that you need to do for this is add the attribute `runat="server"`. ``` <link href="~/css/main.css" rel="stylesheet" type="text/css" runat="server"/> ``` Now even if your master page is not in the same directory as the aspx page, the css will get loaded correctly.
Your code seems have no error. Only possibility that i can assume is issue in the paths. Use one the following depending on your stylesheet location: ``` / -Site root ~/ -Root directory of the application ``` try adding: ``` runat="server" ``` in your path as well. Good luck!
362,244
Let us consider the following function $$F(x) = \sum\_i \frac{a\_i}{x - y\_i}$$ Is it possible to simplify $F(x)$ so that the repeated sum for each value of $x$ can be avoided ?
2013/04/15
[ "https://math.stackexchange.com/questions/362244", "https://math.stackexchange.com", "https://math.stackexchange.com/users/72657/" ]
It is "well-known" that every complex value of the Weierstrass function appears exactly two times (including multiplicities) inside the fundamental parallelogram. Further, this function is even. Therefore the set of solutions consists of two parts: \begin{align} nz=z\;\mathrm{mod}\;\Lambda,\qquad nz=-z\;\mathrm{mod}\;\Lambda. \end{align} Or, in a more explicit form, $$ z=\frac{j\omega\_1+k\omega\_2}{n\pm1},\qquad j,k\in\mathbb{Z}.$$
Does this work? Write \begin{eqnarray\*} \wp (z) &=& \dfrac{1}{z^2} + \sum\_{k=1}^m(2k+1)S\_{2k+2}z^{2k}\\ \wp(nz) &=& \dfrac{1}{(nz)^2} + \sum\_{k=1}^m(2k+1)S\_{2k+2}(nz)^{2k} \end{eqnarray\*} Then look at it term-by-term, \begin{eqnarray\*} \dfrac{1}{z^2}=\dfrac{1}{(nz)^2} \Rightarrow (nz)^2-z^2=0\Rightarrow (n+1)z(n-1)z=0 . \end{eqnarray\*} Similarly, \begin{eqnarray\*} z^{2k}=(nz)^{2k} \Rightarrow (n^{2k}-1)z^2 = 0 \Rightarrow (n^k+1)z(n^k-1)z=0 \end{eqnarray\*} Then write \begin{eqnarray\*} \left( \sum\_{i=0}^{k-1} n^{i} \right)\left( \sum\_{i=0}^{k-1} (-n)^{i} \right) (n+1)z(n-1)z=0. \end{eqnarray\*} Therefore, $z\in \mathbb{C}$ that satisfies $(n\pm 1)z=0$ would satisfy the original equation.
28,297,304
I am developing a RESTful Android app using SyncAdapter. I have watched some screencasts and read some tutorials, but they only address basic dynamics. Before starting to write the code, I would like to try and receive feedback from expert users about concurrency issues. Step 1. The user `U` inserts a new entry `E` into the table `T` of the database. The entry has a column `status = TO_SYNC`. Step 2. Before the entry `E` is synced, `U` decides to modify it. An activity `A` starts for modifying the column values of `E`. Step 3. While the user is modifying the entry, the SyncAdapter starts and sends the entries with `status == TO_SYNC` to the server. For each entry, the `SyncAdapter` sets `status = SYNCED` once it receives a positive answer from the server. Step 4. Let's say that a concurrent access to the same entry `E` causes a conflict: 1. The SyncAdapter reads `E`, sends `E` to the server 2. The activity `A` completes and sets `E` status to `TO_SYNC` 3. The SyncAdapter receives the ok from the server and sets the `status` of `E` to `SYNCED` 4. At this point the new values of `E` will not be synced since the value `TO_SYNC` has been overwritten by the SyncAdapter. My question is: how can I avoid such issue without blocking the entire database with a `begin/end transaction` while syncing (which could take a long time to complete)? Should I fall back on a classical java lock on single entries? Is there a more elegant way?
2015/02/03
[ "https://Stackoverflow.com/questions/28297304", "https://Stackoverflow.com", "https://Stackoverflow.com/users/774133/" ]
Since you are using fadeOut(), the `user-result` element is hidden when the second notification comes. So ``` $("#user-result").html("<font color ='#006600'> Logged in | Redirecting..</font>").show(); $("#user-result").html(data).show().delay( 2500 ).fadeOut( 800 ); ```
Yes, the problem with `fadeout` that hides message container. Before showing new message you have to show container back: ``` $("#user-result").html("<font color ='#006600'> Logged in | Redirecting..</font>").show(); ```
28,297,304
I am developing a RESTful Android app using SyncAdapter. I have watched some screencasts and read some tutorials, but they only address basic dynamics. Before starting to write the code, I would like to try and receive feedback from expert users about concurrency issues. Step 1. The user `U` inserts a new entry `E` into the table `T` of the database. The entry has a column `status = TO_SYNC`. Step 2. Before the entry `E` is synced, `U` decides to modify it. An activity `A` starts for modifying the column values of `E`. Step 3. While the user is modifying the entry, the SyncAdapter starts and sends the entries with `status == TO_SYNC` to the server. For each entry, the `SyncAdapter` sets `status = SYNCED` once it receives a positive answer from the server. Step 4. Let's say that a concurrent access to the same entry `E` causes a conflict: 1. The SyncAdapter reads `E`, sends `E` to the server 2. The activity `A` completes and sets `E` status to `TO_SYNC` 3. The SyncAdapter receives the ok from the server and sets the `status` of `E` to `SYNCED` 4. At this point the new values of `E` will not be synced since the value `TO_SYNC` has been overwritten by the SyncAdapter. My question is: how can I avoid such issue without blocking the entire database with a `begin/end transaction` while syncing (which could take a long time to complete)? Should I fall back on a classical java lock on single entries? Is there a more elegant way?
2015/02/03
[ "https://Stackoverflow.com/questions/28297304", "https://Stackoverflow.com", "https://Stackoverflow.com/users/774133/" ]
Since you are using fadeOut(), the `user-result` element is hidden when the second notification comes. So ``` $("#user-result").html("<font color ='#006600'> Logged in | Redirecting..</font>").show(); $("#user-result").html(data).show().delay( 2500 ).fadeOut( 800 ); ```
once any element fadeout, it wont appear until page reloaded or fadeIn() ``` if(data == 1){ $("#user-result").html("<font color ='#006600'> Logged in | Redirecting..</font>").fadeIn("slow"); setTimeout( function() { window.location.replace("index.php"); }, 1000); } else { $("#user-result").html(data).delay( 2500 ).fadeOut( 800 ); } ``` when data ==1, use fadeIn()
28,297,304
I am developing a RESTful Android app using SyncAdapter. I have watched some screencasts and read some tutorials, but they only address basic dynamics. Before starting to write the code, I would like to try and receive feedback from expert users about concurrency issues. Step 1. The user `U` inserts a new entry `E` into the table `T` of the database. The entry has a column `status = TO_SYNC`. Step 2. Before the entry `E` is synced, `U` decides to modify it. An activity `A` starts for modifying the column values of `E`. Step 3. While the user is modifying the entry, the SyncAdapter starts and sends the entries with `status == TO_SYNC` to the server. For each entry, the `SyncAdapter` sets `status = SYNCED` once it receives a positive answer from the server. Step 4. Let's say that a concurrent access to the same entry `E` causes a conflict: 1. The SyncAdapter reads `E`, sends `E` to the server 2. The activity `A` completes and sets `E` status to `TO_SYNC` 3. The SyncAdapter receives the ok from the server and sets the `status` of `E` to `SYNCED` 4. At this point the new values of `E` will not be synced since the value `TO_SYNC` has been overwritten by the SyncAdapter. My question is: how can I avoid such issue without blocking the entire database with a `begin/end transaction` while syncing (which could take a long time to complete)? Should I fall back on a classical java lock on single entries? Is there a more elegant way?
2015/02/03
[ "https://Stackoverflow.com/questions/28297304", "https://Stackoverflow.com", "https://Stackoverflow.com/users/774133/" ]
Since you are using fadeOut(), the `user-result` element is hidden when the second notification comes. So ``` $("#user-result").html("<font color ='#006600'> Logged in | Redirecting..</font>").show(); $("#user-result").html(data).show().delay( 2500 ).fadeOut( 800 ); ```
You need to use setInterval(function(){}); in order to cycle each time.
28,297,304
I am developing a RESTful Android app using SyncAdapter. I have watched some screencasts and read some tutorials, but they only address basic dynamics. Before starting to write the code, I would like to try and receive feedback from expert users about concurrency issues. Step 1. The user `U` inserts a new entry `E` into the table `T` of the database. The entry has a column `status = TO_SYNC`. Step 2. Before the entry `E` is synced, `U` decides to modify it. An activity `A` starts for modifying the column values of `E`. Step 3. While the user is modifying the entry, the SyncAdapter starts and sends the entries with `status == TO_SYNC` to the server. For each entry, the `SyncAdapter` sets `status = SYNCED` once it receives a positive answer from the server. Step 4. Let's say that a concurrent access to the same entry `E` causes a conflict: 1. The SyncAdapter reads `E`, sends `E` to the server 2. The activity `A` completes and sets `E` status to `TO_SYNC` 3. The SyncAdapter receives the ok from the server and sets the `status` of `E` to `SYNCED` 4. At this point the new values of `E` will not be synced since the value `TO_SYNC` has been overwritten by the SyncAdapter. My question is: how can I avoid such issue without blocking the entire database with a `begin/end transaction` while syncing (which could take a long time to complete)? Should I fall back on a classical java lock on single entries? Is there a more elegant way?
2015/02/03
[ "https://Stackoverflow.com/questions/28297304", "https://Stackoverflow.com", "https://Stackoverflow.com/users/774133/" ]
Yes, the problem with `fadeout` that hides message container. Before showing new message you have to show container back: ``` $("#user-result").html("<font color ='#006600'> Logged in | Redirecting..</font>").show(); ```
once any element fadeout, it wont appear until page reloaded or fadeIn() ``` if(data == 1){ $("#user-result").html("<font color ='#006600'> Logged in | Redirecting..</font>").fadeIn("slow"); setTimeout( function() { window.location.replace("index.php"); }, 1000); } else { $("#user-result").html(data).delay( 2500 ).fadeOut( 800 ); } ``` when data ==1, use fadeIn()
28,297,304
I am developing a RESTful Android app using SyncAdapter. I have watched some screencasts and read some tutorials, but they only address basic dynamics. Before starting to write the code, I would like to try and receive feedback from expert users about concurrency issues. Step 1. The user `U` inserts a new entry `E` into the table `T` of the database. The entry has a column `status = TO_SYNC`. Step 2. Before the entry `E` is synced, `U` decides to modify it. An activity `A` starts for modifying the column values of `E`. Step 3. While the user is modifying the entry, the SyncAdapter starts and sends the entries with `status == TO_SYNC` to the server. For each entry, the `SyncAdapter` sets `status = SYNCED` once it receives a positive answer from the server. Step 4. Let's say that a concurrent access to the same entry `E` causes a conflict: 1. The SyncAdapter reads `E`, sends `E` to the server 2. The activity `A` completes and sets `E` status to `TO_SYNC` 3. The SyncAdapter receives the ok from the server and sets the `status` of `E` to `SYNCED` 4. At this point the new values of `E` will not be synced since the value `TO_SYNC` has been overwritten by the SyncAdapter. My question is: how can I avoid such issue without blocking the entire database with a `begin/end transaction` while syncing (which could take a long time to complete)? Should I fall back on a classical java lock on single entries? Is there a more elegant way?
2015/02/03
[ "https://Stackoverflow.com/questions/28297304", "https://Stackoverflow.com", "https://Stackoverflow.com/users/774133/" ]
Yes, the problem with `fadeout` that hides message container. Before showing new message you have to show container back: ``` $("#user-result").html("<font color ='#006600'> Logged in | Redirecting..</font>").show(); ```
You need to use setInterval(function(){}); in order to cycle each time.
66,044,532
Amazon ECS supports two different types of health checks: * [Target Group health checks](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/service-load-balancing.html) make a configurable network request * [Container health checks](https://aws.amazon.com/about-aws/whats-new/2018/03/amazon-ecs-supports-container-health-checks-and-task-health-mana/) run in the docker container and can be configured to run any shell command that the container supports If both health checks are configured, which one wins? If *either* fails is the Service marked as `UNHEALTHY`? Or *both*? Can I configure one to override the other? I'd very much like the Target Group health status to not cause ECS to continually bounce the service and I was hoping the container Health Check could be used to override it.
2021/02/04
[ "https://Stackoverflow.com/questions/66044532", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2824722/" ]
The AWS documentation is somewhat vague on this topic, but does suggest a high degree of coupling between ALB & ECS when it comes to health checks. i.e. see the [documentation](https://docs.aws.amazon.com/elasticloadbalancing/latest/application/target-group-health-checks.html) for `healthCheckGracePeriodSeconds` and `minimumHealthyPercent` for examples of ECS health check behaviour which is influenced by the presence or absence of a load balancer. The `healthCheckGracePeriodSeconds` may be useful to avoid a failed ALB health check from causing the ECS container to be restarted (during service startup at least): > > The period of time, in seconds, that the Amazon ECS service scheduler should ignore unhealthy Elastic Load Balancing target health checks, container health checks, and Route 53 health checks after a task enters a RUNNING state. This is only valid if your service is configured to use a load balancer. If your service has a load balancer defined and you do not specify a health check grace period value, the default value of 0 is used. > > > If your service's tasks take a while to start and respond to health checks, you can specify a health check grace period of up to 2,147,483,647 seconds during which the ECS service scheduler ignores the health check status. This grace period can prevent the ECS service scheduler from marking tasks as unhealthy and stopping them before they have time to come up. > > >
In my experience, either one will cause your container to be decommissioned. I would say you probably don't need the container health check if you have a target group performing the check.
15,904,800
I am working on a project which fetches the contact list and the user will be able to send an email. Any help or advice will be greatly appreciated. I know it can be done in phone-gap. Thanks in advance.
2013/04/09
[ "https://Stackoverflow.com/questions/15904800", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2262166/" ]
Taking a function is easy... it's just like any other argument. ``` def example(somefunc): somefunc() example(someFunction) example(lambda x: x ** 2) ``` Returning one is a little trickier, but not much. You can return a lambda: ``` def example2(): return lambda x: x + 1 ``` Or you can build an inner function, and return that ``` def example3(): def rf(x): return x + 2 return rf myfunc = example3() myfunc(2) #returns 4 ```
math.sqrt(x) is NOT a (Python) function, math.sqrt is a function. Notice the missing (x). In the same vein, 1/(2 \* math.sqrt(x)) is not a function but (lambda x: 1/(2 \* math.sqrt(x))) is a function. The issue is that ``` a = lambda x: x ``` and ``` b = lambda x: x ``` will yield two different python functions that are equivalent from a mathmatical point of view. So it is not that helpful to test functions for equality. You would need to actually "parse" them in order to find mathmatical derivatives. Parsing the inner definitions is possible but not even close to simple.
3,267,216
If I have an apk can I remove the current signing and some how re-sign it with a different .keystore file and still have the application install? **Update**: I managed to get it to work with Jorgesys' solution and where I messed up before was that I unzipped the .apk then rezipped it after removing the META-INF folder and changed the file extension back into .apk. What I should have done is simply opened it with winzip and delete the folder inside of winzip.
2010/07/16
[ "https://Stackoverflow.com/questions/3267216", "https://Stackoverflow.com", "https://Stackoverflow.com/users/340/" ]
try this > > ### 1) Change the extension of your .apk to .zip > > > ### 2) Open and remove the folder META-INF > > > ### 3) Change the extension to .apk > > > ### 4) Use the jarsigner and zipalign with your new keystore. > > > hope it helps
Signing for release: $1.apk -> $1\_release.apk" GeneralMills&GoogleApps#2012 Step 1: Removing any previous signing Change the extension of your .apk to .zip Open and delete the folder META-INF Change the extension to .apk Or Command: • zip [originalapk] Example: • zip "$1".apk -d Step 2: Signing with release.keystore.. Command: • jarsigner –verbose –keystore [keystorefile] –signedjar [unalignedapk] [originalapk] alias\_name Example: • C:\Program Files\Java\jdk1.6.0\_43\bin> jarsigner -verbose -keystore release.keystore -signedjar "$1"\_unaligned.apk "$1".apk release Step 3: Aligning Command: • zipalign -f 4 [unalignedapk] [releaseapk] Example: • C:\Users\G535940\Downloads\adt-bundle-windows-x86\adt-bundle-windows-x86\sdk\too ls>zipalign -f 4 "$1"\_unaligned.apk "$1"\_release.apk Step 4: Cleaning up Command: • rm 4 [unalignedapk] Example: • rm "$1"\_unaligned.apk Additional Commands might help: 1. To generate new key with keytool keytool -genkey -alias -keystore 2. To list keys keytool -list -keystore Command to generate a keyhash for the Facebook features Command: • keytool -exportcert -alias alias\_name -keystore [keystorefile] | openssl sha1 -binary | openssl base64 Example: • C:\Program Files\Java\jdk1.6.0\_43\bin>keytool -exportcert -alias release -keyst ore release.keystore |opens l sha1 -binary | openssl base64 Note: To sign our apks we have downgraded JDK from 1.7 to 1.6.0\_43 update. Reason: As of JDK 7, the default signing algorithim has changed, requiring you to specify the signature and digest algorithims (-sigalg and -digestalg) when you sign an APK. Command: jarsigner -verbose -sigalg MD5withRSA -digestalg SHA1 -keystore [keystorefile] [originalapk] alias\_name
3,267,216
If I have an apk can I remove the current signing and some how re-sign it with a different .keystore file and still have the application install? **Update**: I managed to get it to work with Jorgesys' solution and where I messed up before was that I unzipped the .apk then rezipped it after removing the META-INF folder and changed the file extension back into .apk. What I should have done is simply opened it with winzip and delete the folder inside of winzip.
2010/07/16
[ "https://Stackoverflow.com/questions/3267216", "https://Stackoverflow.com", "https://Stackoverflow.com/users/340/" ]
try this > > ### 1) Change the extension of your .apk to .zip > > > ### 2) Open and remove the folder META-INF > > > ### 3) Change the extension to .apk > > > ### 4) Use the jarsigner and zipalign with your new keystore. > > > hope it helps
Assuming your keys are stored in `keys.keystore`, you can run: ``` $ keytool -list -keystore keys.keystore Your keystore contains 1 entry your_key_alias, Jan 3, 2013, PrivateKeyEntry, Certificate fingerprint (SHA1): 8C:C3:6A:DC:7E:B6:12:F1:4C:D5:EE:F1:AE:17:FB:90:89:73:50:53 ``` to determine the alias of your key. Then run: ``` zip -d your_app.apk "META-INF/*" jarsigner -verbose -keystore keys.keystore \ -sigalg MD5withRSA -digestalg SHA1 -sigfile CERT \ your_app.apk your_key_alias ``` to re-sign `your_app.apk` with the key named `your_key_alias`. The extra `-sigfile CERT` option seems to be necessary as of JDK 8.
3,267,216
If I have an apk can I remove the current signing and some how re-sign it with a different .keystore file and still have the application install? **Update**: I managed to get it to work with Jorgesys' solution and where I messed up before was that I unzipped the .apk then rezipped it after removing the META-INF folder and changed the file extension back into .apk. What I should have done is simply opened it with winzip and delete the folder inside of winzip.
2010/07/16
[ "https://Stackoverflow.com/questions/3267216", "https://Stackoverflow.com", "https://Stackoverflow.com/users/340/" ]
If you are looking for a quick simple solution, you can use **Google's `apksigner` command line** tool which is available in revision 24.0.3 and higher. > > > ``` > apksigner sign --ks release.jks application.apk > > ``` > > You can find more information about apksigner tool, at the developer Android site. <https://developer.android.com/studio/command-line/apksigner.html> Or, alternatively, you may use an open-source apk-resigner script Open Source apk-resigner script <https://github.com/onbiron/apk-resigner> All you have to do is, download the script and just type: > > > ``` > ./signapk.sh application.apk keystore key-pass alias > > ``` > >
All the solutions above work. Just a note why it didn't work for you when you re-zipped: Some of the files inside the .apk need to remain stored (compression at 0%). This is because Android will use memory mapping (mmap) to read the contents without unpacking into memory. Such files are .ogg and some of the icons.
3,267,216
If I have an apk can I remove the current signing and some how re-sign it with a different .keystore file and still have the application install? **Update**: I managed to get it to work with Jorgesys' solution and where I messed up before was that I unzipped the .apk then rezipped it after removing the META-INF folder and changed the file extension back into .apk. What I should have done is simply opened it with winzip and delete the folder inside of winzip.
2010/07/16
[ "https://Stackoverflow.com/questions/3267216", "https://Stackoverflow.com", "https://Stackoverflow.com/users/340/" ]
Signing for release: $1.apk -> $1\_release.apk" GeneralMills&GoogleApps#2012 Step 1: Removing any previous signing Change the extension of your .apk to .zip Open and delete the folder META-INF Change the extension to .apk Or Command: • zip [originalapk] Example: • zip "$1".apk -d Step 2: Signing with release.keystore.. Command: • jarsigner –verbose –keystore [keystorefile] –signedjar [unalignedapk] [originalapk] alias\_name Example: • C:\Program Files\Java\jdk1.6.0\_43\bin> jarsigner -verbose -keystore release.keystore -signedjar "$1"\_unaligned.apk "$1".apk release Step 3: Aligning Command: • zipalign -f 4 [unalignedapk] [releaseapk] Example: • C:\Users\G535940\Downloads\adt-bundle-windows-x86\adt-bundle-windows-x86\sdk\too ls>zipalign -f 4 "$1"\_unaligned.apk "$1"\_release.apk Step 4: Cleaning up Command: • rm 4 [unalignedapk] Example: • rm "$1"\_unaligned.apk Additional Commands might help: 1. To generate new key with keytool keytool -genkey -alias -keystore 2. To list keys keytool -list -keystore Command to generate a keyhash for the Facebook features Command: • keytool -exportcert -alias alias\_name -keystore [keystorefile] | openssl sha1 -binary | openssl base64 Example: • C:\Program Files\Java\jdk1.6.0\_43\bin>keytool -exportcert -alias release -keyst ore release.keystore |opens l sha1 -binary | openssl base64 Note: To sign our apks we have downgraded JDK from 1.7 to 1.6.0\_43 update. Reason: As of JDK 7, the default signing algorithim has changed, requiring you to specify the signature and digest algorithims (-sigalg and -digestalg) when you sign an APK. Command: jarsigner -verbose -sigalg MD5withRSA -digestalg SHA1 -keystore [keystorefile] [originalapk] alias\_name
All the solutions above work. Just a note why it didn't work for you when you re-zipped: Some of the files inside the .apk need to remain stored (compression at 0%). This is because Android will use memory mapping (mmap) to read the contents without unpacking into memory. Such files are .ogg and some of the icons.
3,267,216
If I have an apk can I remove the current signing and some how re-sign it with a different .keystore file and still have the application install? **Update**: I managed to get it to work with Jorgesys' solution and where I messed up before was that I unzipped the .apk then rezipped it after removing the META-INF folder and changed the file extension back into .apk. What I should have done is simply opened it with winzip and delete the folder inside of winzip.
2010/07/16
[ "https://Stackoverflow.com/questions/3267216", "https://Stackoverflow.com", "https://Stackoverflow.com/users/340/" ]
If you are looking for a quick simple solution, you can use **Google's `apksigner` command line** tool which is available in revision 24.0.3 and higher. > > > ``` > apksigner sign --ks release.jks application.apk > > ``` > > You can find more information about apksigner tool, at the developer Android site. <https://developer.android.com/studio/command-line/apksigner.html> Or, alternatively, you may use an open-source apk-resigner script Open Source apk-resigner script <https://github.com/onbiron/apk-resigner> All you have to do is, download the script and just type: > > > ``` > ./signapk.sh application.apk keystore key-pass alias > > ``` > >
Note if you use [v2 signing schema](https://source.android.com/security/apksigning/v2.html) (which you will automatically if you use build-tools 24.0.3+ in AS) you cannot just remove the META-INF folder from the APK since v2 adds its signing data to a zip meta block. Google's [new apksigner](https://developer.android.com/studio/command-line/apksigner.html) introduced in build-tools 24.03 (Android 7) is however able to resign APKs. You can just repeat the signing command to sign with a new keystore/cert (the old ones will be removed). ``` apksigner sign --ks keystore.jks signed_app.apk ``` --- *Shameless plug: if you want a easier tool that can sign multiple apks and has better log output use: <https://github.com/patrickfav/uber-apk-signer> (uses Google's apksigner.jar in the background)*
3,267,216
If I have an apk can I remove the current signing and some how re-sign it with a different .keystore file and still have the application install? **Update**: I managed to get it to work with Jorgesys' solution and where I messed up before was that I unzipped the .apk then rezipped it after removing the META-INF folder and changed the file extension back into .apk. What I should have done is simply opened it with winzip and delete the folder inside of winzip.
2010/07/16
[ "https://Stackoverflow.com/questions/3267216", "https://Stackoverflow.com", "https://Stackoverflow.com/users/340/" ]
Note if you use [v2 signing schema](https://source.android.com/security/apksigning/v2.html) (which you will automatically if you use build-tools 24.0.3+ in AS) you cannot just remove the META-INF folder from the APK since v2 adds its signing data to a zip meta block. Google's [new apksigner](https://developer.android.com/studio/command-line/apksigner.html) introduced in build-tools 24.03 (Android 7) is however able to resign APKs. You can just repeat the signing command to sign with a new keystore/cert (the old ones will be removed). ``` apksigner sign --ks keystore.jks signed_app.apk ``` --- *Shameless plug: if you want a easier tool that can sign multiple apks and has better log output use: <https://github.com/patrickfav/uber-apk-signer> (uses Google's apksigner.jar in the background)*
``` zip -d my_application.apk META-INF/\* keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 10000 jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore my-release-key.keystore my_application.apk alias_name zipalign -v 4 your_project_name-unaligned.apk your_project_name.apk ```
3,267,216
If I have an apk can I remove the current signing and some how re-sign it with a different .keystore file and still have the application install? **Update**: I managed to get it to work with Jorgesys' solution and where I messed up before was that I unzipped the .apk then rezipped it after removing the META-INF folder and changed the file extension back into .apk. What I should have done is simply opened it with winzip and delete the folder inside of winzip.
2010/07/16
[ "https://Stackoverflow.com/questions/3267216", "https://Stackoverflow.com", "https://Stackoverflow.com/users/340/" ]
Signing for release: $1.apk -> $1\_release.apk" GeneralMills&GoogleApps#2012 Step 1: Removing any previous signing Change the extension of your .apk to .zip Open and delete the folder META-INF Change the extension to .apk Or Command: • zip [originalapk] Example: • zip "$1".apk -d Step 2: Signing with release.keystore.. Command: • jarsigner –verbose –keystore [keystorefile] –signedjar [unalignedapk] [originalapk] alias\_name Example: • C:\Program Files\Java\jdk1.6.0\_43\bin> jarsigner -verbose -keystore release.keystore -signedjar "$1"\_unaligned.apk "$1".apk release Step 3: Aligning Command: • zipalign -f 4 [unalignedapk] [releaseapk] Example: • C:\Users\G535940\Downloads\adt-bundle-windows-x86\adt-bundle-windows-x86\sdk\too ls>zipalign -f 4 "$1"\_unaligned.apk "$1"\_release.apk Step 4: Cleaning up Command: • rm 4 [unalignedapk] Example: • rm "$1"\_unaligned.apk Additional Commands might help: 1. To generate new key with keytool keytool -genkey -alias -keystore 2. To list keys keytool -list -keystore Command to generate a keyhash for the Facebook features Command: • keytool -exportcert -alias alias\_name -keystore [keystorefile] | openssl sha1 -binary | openssl base64 Example: • C:\Program Files\Java\jdk1.6.0\_43\bin>keytool -exportcert -alias release -keyst ore release.keystore |opens l sha1 -binary | openssl base64 Note: To sign our apks we have downgraded JDK from 1.7 to 1.6.0\_43 update. Reason: As of JDK 7, the default signing algorithim has changed, requiring you to specify the signature and digest algorithims (-sigalg and -digestalg) when you sign an APK. Command: jarsigner -verbose -sigalg MD5withRSA -digestalg SHA1 -keystore [keystorefile] [originalapk] alias\_name
Assuming your keys are stored in `keys.keystore`, you can run: ``` $ keytool -list -keystore keys.keystore Your keystore contains 1 entry your_key_alias, Jan 3, 2013, PrivateKeyEntry, Certificate fingerprint (SHA1): 8C:C3:6A:DC:7E:B6:12:F1:4C:D5:EE:F1:AE:17:FB:90:89:73:50:53 ``` to determine the alias of your key. Then run: ``` zip -d your_app.apk "META-INF/*" jarsigner -verbose -keystore keys.keystore \ -sigalg MD5withRSA -digestalg SHA1 -sigfile CERT \ your_app.apk your_key_alias ``` to re-sign `your_app.apk` with the key named `your_key_alias`. The extra `-sigfile CERT` option seems to be necessary as of JDK 8.
3,267,216
If I have an apk can I remove the current signing and some how re-sign it with a different .keystore file and still have the application install? **Update**: I managed to get it to work with Jorgesys' solution and where I messed up before was that I unzipped the .apk then rezipped it after removing the META-INF folder and changed the file extension back into .apk. What I should have done is simply opened it with winzip and delete the folder inside of winzip.
2010/07/16
[ "https://Stackoverflow.com/questions/3267216", "https://Stackoverflow.com", "https://Stackoverflow.com/users/340/" ]
try this > > ### 1) Change the extension of your .apk to .zip > > > ### 2) Open and remove the folder META-INF > > > ### 3) Change the extension to .apk > > > ### 4) Use the jarsigner and zipalign with your new keystore. > > > hope it helps
``` zip -d my_application.apk META-INF/\* keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 10000 jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore my-release-key.keystore my_application.apk alias_name zipalign -v 4 your_project_name-unaligned.apk your_project_name.apk ```
3,267,216
If I have an apk can I remove the current signing and some how re-sign it with a different .keystore file and still have the application install? **Update**: I managed to get it to work with Jorgesys' solution and where I messed up before was that I unzipped the .apk then rezipped it after removing the META-INF folder and changed the file extension back into .apk. What I should have done is simply opened it with winzip and delete the folder inside of winzip.
2010/07/16
[ "https://Stackoverflow.com/questions/3267216", "https://Stackoverflow.com", "https://Stackoverflow.com/users/340/" ]
If you are looking for a quick simple solution, you can use **Google's `apksigner` command line** tool which is available in revision 24.0.3 and higher. > > > ``` > apksigner sign --ks release.jks application.apk > > ``` > > You can find more information about apksigner tool, at the developer Android site. <https://developer.android.com/studio/command-line/apksigner.html> Or, alternatively, you may use an open-source apk-resigner script Open Source apk-resigner script <https://github.com/onbiron/apk-resigner> All you have to do is, download the script and just type: > > > ``` > ./signapk.sh application.apk keystore key-pass alias > > ``` > >
``` zip -d my_application.apk META-INF/\* keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 10000 jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore my-release-key.keystore my_application.apk alias_name zipalign -v 4 your_project_name-unaligned.apk your_project_name.apk ```
3,267,216
If I have an apk can I remove the current signing and some how re-sign it with a different .keystore file and still have the application install? **Update**: I managed to get it to work with Jorgesys' solution and where I messed up before was that I unzipped the .apk then rezipped it after removing the META-INF folder and changed the file extension back into .apk. What I should have done is simply opened it with winzip and delete the folder inside of winzip.
2010/07/16
[ "https://Stackoverflow.com/questions/3267216", "https://Stackoverflow.com", "https://Stackoverflow.com/users/340/" ]
If you are looking for a quick simple solution, you can use **Google's `apksigner` command line** tool which is available in revision 24.0.3 and higher. > > > ``` > apksigner sign --ks release.jks application.apk > > ``` > > You can find more information about apksigner tool, at the developer Android site. <https://developer.android.com/studio/command-line/apksigner.html> Or, alternatively, you may use an open-source apk-resigner script Open Source apk-resigner script <https://github.com/onbiron/apk-resigner> All you have to do is, download the script and just type: > > > ``` > ./signapk.sh application.apk keystore key-pass alias > > ``` > >
Assuming your keys are stored in `keys.keystore`, you can run: ``` $ keytool -list -keystore keys.keystore Your keystore contains 1 entry your_key_alias, Jan 3, 2013, PrivateKeyEntry, Certificate fingerprint (SHA1): 8C:C3:6A:DC:7E:B6:12:F1:4C:D5:EE:F1:AE:17:FB:90:89:73:50:53 ``` to determine the alias of your key. Then run: ``` zip -d your_app.apk "META-INF/*" jarsigner -verbose -keystore keys.keystore \ -sigalg MD5withRSA -digestalg SHA1 -sigfile CERT \ your_app.apk your_key_alias ``` to re-sign `your_app.apk` with the key named `your_key_alias`. The extra `-sigfile CERT` option seems to be necessary as of JDK 8.
1,397,496
A colleague at work has a Kingston 240GB SSD drive which has come out of a now dead computer. We want to be able to recover some data from it (no backups sadly) however the drive won't mount properly. I am using an Anker USB3 external HDD enclosure which I know to be working correctly. The drive has come from an Apple computer, and we are attempting recovery on another MacBook Pro. The drive appears under DiskUtility, however is greyed out. Trying to click `mount` does nothing. FirstAid also fails. **What Have We Tried?** So far, we've run `diskutil repairVolume disk2s2` which gave the following output: ``` Repairing file system Volume is already unmounted Performing fsck_hfs -fy -x /dev/rdisk2s2 Checking Journaled HFS Plus volume Invalid record count Checking extents overflow file Invalid record count The volume could not be verified completely File system check exit code is 8 Restoring the original state found as unmounted Error: -69845: File system verify or repair failed Underlying error: 8: Exec format error ``` We have also run `sudo /sbin/fsck_hfs -yprd /dev/disk2s2` which returned: ``` /dev/rdisk2s2: starting journal_replay(/dev/disk2s2) returned 0 Using cacheBlockSize=32K cacheTotalBlock=65536 cacheSize=2097152K. Executing fsck_hfs (version hfs-407.50.6). ** Checking Journaled HFS Plus volume. hfs_swap_BTNode: invalid forward link (0xFFFFFFFF) hfs_swap_BTNode: invalid backward link (0xFFFFFFFF) hfs_swap_BTNode: invalid node height (255) hfs_swap_BTNode: invalid record count (0xFFFF) Invalid record count (4, 25511) ...repeats similar output... Node 35746's back link is 0x0; expected 0x8c17 disk offset = 0x78f41000, size = 0x2000 Invalid sibling link (4, 35746) Node 35746's forward link is 0x0; expected 0x6489 disk offset = 0x78f41000, size = 0x2000 Invalid node height (4, 35746) Index key doesn't match first node key Invalid index key (4, 35746) ** The volume could not be verified completely. volume check failed with error 7 volume type is pure HFS+ primary MDB is at block 0 0x00 alternate MDB is at block 0 0x00 primary VHB is at block 2 0x02 alternate VHB is at block 467182910 0x1bd8a53e sector size = 512 0x200 VolumeObject flags = 0x07 total sectors for volume = 467182912 0x1bd8a540 total sectors for embedded volume = 0 0x00 CheckForClean - could not get VHB/MDB at block 467182910 CheckHFS returned -1317, fsmodified = 1 ``` **What Next?** I am hopeful that with the drive being recognised, the data is still recoverable. Before looking at paid software such as DiskWarrior, is there anything else that I can try so that I can access the disk or to repair this `record count` problem.
2019/01/23
[ "https://superuser.com/questions/1397496", "https://superuser.com", "https://superuser.com/users/244470/" ]
* Font size: 16 * Standard font, Serif font: *Times New Roman* * Sans-serif font: *Arial* * Fixed-width font: *Consolas*
You don't need to know the original fonts, here's how to do it: First, close Google Chrome, so your changes don't get overwritten. Go to your Google Chrome settings folder, in Ubuntu, i found it in `.config/google-chrome` In this folder, open up the file `Default/Preferences`, Search and replace references to your fonts in the file with the string "Custom". In my case they were all at the end of the file, so it was easy to replace. After this, open up Google Chrome again, and your fonts will be reset.
1,397,496
A colleague at work has a Kingston 240GB SSD drive which has come out of a now dead computer. We want to be able to recover some data from it (no backups sadly) however the drive won't mount properly. I am using an Anker USB3 external HDD enclosure which I know to be working correctly. The drive has come from an Apple computer, and we are attempting recovery on another MacBook Pro. The drive appears under DiskUtility, however is greyed out. Trying to click `mount` does nothing. FirstAid also fails. **What Have We Tried?** So far, we've run `diskutil repairVolume disk2s2` which gave the following output: ``` Repairing file system Volume is already unmounted Performing fsck_hfs -fy -x /dev/rdisk2s2 Checking Journaled HFS Plus volume Invalid record count Checking extents overflow file Invalid record count The volume could not be verified completely File system check exit code is 8 Restoring the original state found as unmounted Error: -69845: File system verify or repair failed Underlying error: 8: Exec format error ``` We have also run `sudo /sbin/fsck_hfs -yprd /dev/disk2s2` which returned: ``` /dev/rdisk2s2: starting journal_replay(/dev/disk2s2) returned 0 Using cacheBlockSize=32K cacheTotalBlock=65536 cacheSize=2097152K. Executing fsck_hfs (version hfs-407.50.6). ** Checking Journaled HFS Plus volume. hfs_swap_BTNode: invalid forward link (0xFFFFFFFF) hfs_swap_BTNode: invalid backward link (0xFFFFFFFF) hfs_swap_BTNode: invalid node height (255) hfs_swap_BTNode: invalid record count (0xFFFF) Invalid record count (4, 25511) ...repeats similar output... Node 35746's back link is 0x0; expected 0x8c17 disk offset = 0x78f41000, size = 0x2000 Invalid sibling link (4, 35746) Node 35746's forward link is 0x0; expected 0x6489 disk offset = 0x78f41000, size = 0x2000 Invalid node height (4, 35746) Index key doesn't match first node key Invalid index key (4, 35746) ** The volume could not be verified completely. volume check failed with error 7 volume type is pure HFS+ primary MDB is at block 0 0x00 alternate MDB is at block 0 0x00 primary VHB is at block 2 0x02 alternate VHB is at block 467182910 0x1bd8a53e sector size = 512 0x200 VolumeObject flags = 0x07 total sectors for volume = 467182912 0x1bd8a540 total sectors for embedded volume = 0 0x00 CheckForClean - could not get VHB/MDB at block 467182910 CheckHFS returned -1317, fsmodified = 1 ``` **What Next?** I am hopeful that with the drive being recognised, the data is still recoverable. Before looking at paid software such as DiskWarrior, is there anything else that I can try so that I can access the disk or to repair this `record count` problem.
2019/01/23
[ "https://superuser.com/questions/1397496", "https://superuser.com", "https://superuser.com/users/244470/" ]
* Font size: 16 * Standard font, Serif font: *Times New Roman* * Sans-serif font: *Arial* * Fixed-width font: *Consolas*
Just open `chrome://settings/fonts` and you will see the `Customize fonts` settings. Note that these settings may be different when you change the default language used to display the Google Chrome UI. [Customize fonts settings page](https://i.stack.imgur.com/XjgNa.png) Reference : <https://www.maketecheasier.com/change-default-font-chrome/>
1,397,496
A colleague at work has a Kingston 240GB SSD drive which has come out of a now dead computer. We want to be able to recover some data from it (no backups sadly) however the drive won't mount properly. I am using an Anker USB3 external HDD enclosure which I know to be working correctly. The drive has come from an Apple computer, and we are attempting recovery on another MacBook Pro. The drive appears under DiskUtility, however is greyed out. Trying to click `mount` does nothing. FirstAid also fails. **What Have We Tried?** So far, we've run `diskutil repairVolume disk2s2` which gave the following output: ``` Repairing file system Volume is already unmounted Performing fsck_hfs -fy -x /dev/rdisk2s2 Checking Journaled HFS Plus volume Invalid record count Checking extents overflow file Invalid record count The volume could not be verified completely File system check exit code is 8 Restoring the original state found as unmounted Error: -69845: File system verify or repair failed Underlying error: 8: Exec format error ``` We have also run `sudo /sbin/fsck_hfs -yprd /dev/disk2s2` which returned: ``` /dev/rdisk2s2: starting journal_replay(/dev/disk2s2) returned 0 Using cacheBlockSize=32K cacheTotalBlock=65536 cacheSize=2097152K. Executing fsck_hfs (version hfs-407.50.6). ** Checking Journaled HFS Plus volume. hfs_swap_BTNode: invalid forward link (0xFFFFFFFF) hfs_swap_BTNode: invalid backward link (0xFFFFFFFF) hfs_swap_BTNode: invalid node height (255) hfs_swap_BTNode: invalid record count (0xFFFF) Invalid record count (4, 25511) ...repeats similar output... Node 35746's back link is 0x0; expected 0x8c17 disk offset = 0x78f41000, size = 0x2000 Invalid sibling link (4, 35746) Node 35746's forward link is 0x0; expected 0x6489 disk offset = 0x78f41000, size = 0x2000 Invalid node height (4, 35746) Index key doesn't match first node key Invalid index key (4, 35746) ** The volume could not be verified completely. volume check failed with error 7 volume type is pure HFS+ primary MDB is at block 0 0x00 alternate MDB is at block 0 0x00 primary VHB is at block 2 0x02 alternate VHB is at block 467182910 0x1bd8a53e sector size = 512 0x200 VolumeObject flags = 0x07 total sectors for volume = 467182912 0x1bd8a540 total sectors for embedded volume = 0 0x00 CheckForClean - could not get VHB/MDB at block 467182910 CheckHFS returned -1317, fsmodified = 1 ``` **What Next?** I am hopeful that with the drive being recognised, the data is still recoverable. Before looking at paid software such as DiskWarrior, is there anything else that I can try so that I can access the disk or to repair this `record count` problem.
2019/01/23
[ "https://superuser.com/questions/1397496", "https://superuser.com", "https://superuser.com/users/244470/" ]
* Font size: 16 * Standard font, Serif font: *Times New Roman* * Sans-serif font: *Arial* * Fixed-width font: *Consolas*
i tried @pragman solution and got the same fonts for all styles, but not defaults :( so i removed the `webkit` option entirely, it was: ``` "webkit": { "webprefs": { "default_fixed_font_size": 13, "default_font_size": 16, "fonts": { "sansserif": { "Zyyy": "Custom" }, "serif": { "Zyyy": "Custom" }, "standard": { "Zyyy": "Custom" } }, "minimum_font_size": 0 } }, ``` my `Preferences` file was too big for vim editor and i got a new file with command-line JSON processor ```bash jq -c "del(.webkit)" Preferences > Preferences.new ```
1,397,496
A colleague at work has a Kingston 240GB SSD drive which has come out of a now dead computer. We want to be able to recover some data from it (no backups sadly) however the drive won't mount properly. I am using an Anker USB3 external HDD enclosure which I know to be working correctly. The drive has come from an Apple computer, and we are attempting recovery on another MacBook Pro. The drive appears under DiskUtility, however is greyed out. Trying to click `mount` does nothing. FirstAid also fails. **What Have We Tried?** So far, we've run `diskutil repairVolume disk2s2` which gave the following output: ``` Repairing file system Volume is already unmounted Performing fsck_hfs -fy -x /dev/rdisk2s2 Checking Journaled HFS Plus volume Invalid record count Checking extents overflow file Invalid record count The volume could not be verified completely File system check exit code is 8 Restoring the original state found as unmounted Error: -69845: File system verify or repair failed Underlying error: 8: Exec format error ``` We have also run `sudo /sbin/fsck_hfs -yprd /dev/disk2s2` which returned: ``` /dev/rdisk2s2: starting journal_replay(/dev/disk2s2) returned 0 Using cacheBlockSize=32K cacheTotalBlock=65536 cacheSize=2097152K. Executing fsck_hfs (version hfs-407.50.6). ** Checking Journaled HFS Plus volume. hfs_swap_BTNode: invalid forward link (0xFFFFFFFF) hfs_swap_BTNode: invalid backward link (0xFFFFFFFF) hfs_swap_BTNode: invalid node height (255) hfs_swap_BTNode: invalid record count (0xFFFF) Invalid record count (4, 25511) ...repeats similar output... Node 35746's back link is 0x0; expected 0x8c17 disk offset = 0x78f41000, size = 0x2000 Invalid sibling link (4, 35746) Node 35746's forward link is 0x0; expected 0x6489 disk offset = 0x78f41000, size = 0x2000 Invalid node height (4, 35746) Index key doesn't match first node key Invalid index key (4, 35746) ** The volume could not be verified completely. volume check failed with error 7 volume type is pure HFS+ primary MDB is at block 0 0x00 alternate MDB is at block 0 0x00 primary VHB is at block 2 0x02 alternate VHB is at block 467182910 0x1bd8a53e sector size = 512 0x200 VolumeObject flags = 0x07 total sectors for volume = 467182912 0x1bd8a540 total sectors for embedded volume = 0 0x00 CheckForClean - could not get VHB/MDB at block 467182910 CheckHFS returned -1317, fsmodified = 1 ``` **What Next?** I am hopeful that with the drive being recognised, the data is still recoverable. Before looking at paid software such as DiskWarrior, is there anything else that I can try so that I can access the disk or to repair this `record count` problem.
2019/01/23
[ "https://superuser.com/questions/1397496", "https://superuser.com", "https://superuser.com/users/244470/" ]
Just open `chrome://settings/fonts` and you will see the `Customize fonts` settings. Note that these settings may be different when you change the default language used to display the Google Chrome UI. [Customize fonts settings page](https://i.stack.imgur.com/XjgNa.png) Reference : <https://www.maketecheasier.com/change-default-font-chrome/>
You don't need to know the original fonts, here's how to do it: First, close Google Chrome, so your changes don't get overwritten. Go to your Google Chrome settings folder, in Ubuntu, i found it in `.config/google-chrome` In this folder, open up the file `Default/Preferences`, Search and replace references to your fonts in the file with the string "Custom". In my case they were all at the end of the file, so it was easy to replace. After this, open up Google Chrome again, and your fonts will be reset.
1,397,496
A colleague at work has a Kingston 240GB SSD drive which has come out of a now dead computer. We want to be able to recover some data from it (no backups sadly) however the drive won't mount properly. I am using an Anker USB3 external HDD enclosure which I know to be working correctly. The drive has come from an Apple computer, and we are attempting recovery on another MacBook Pro. The drive appears under DiskUtility, however is greyed out. Trying to click `mount` does nothing. FirstAid also fails. **What Have We Tried?** So far, we've run `diskutil repairVolume disk2s2` which gave the following output: ``` Repairing file system Volume is already unmounted Performing fsck_hfs -fy -x /dev/rdisk2s2 Checking Journaled HFS Plus volume Invalid record count Checking extents overflow file Invalid record count The volume could not be verified completely File system check exit code is 8 Restoring the original state found as unmounted Error: -69845: File system verify or repair failed Underlying error: 8: Exec format error ``` We have also run `sudo /sbin/fsck_hfs -yprd /dev/disk2s2` which returned: ``` /dev/rdisk2s2: starting journal_replay(/dev/disk2s2) returned 0 Using cacheBlockSize=32K cacheTotalBlock=65536 cacheSize=2097152K. Executing fsck_hfs (version hfs-407.50.6). ** Checking Journaled HFS Plus volume. hfs_swap_BTNode: invalid forward link (0xFFFFFFFF) hfs_swap_BTNode: invalid backward link (0xFFFFFFFF) hfs_swap_BTNode: invalid node height (255) hfs_swap_BTNode: invalid record count (0xFFFF) Invalid record count (4, 25511) ...repeats similar output... Node 35746's back link is 0x0; expected 0x8c17 disk offset = 0x78f41000, size = 0x2000 Invalid sibling link (4, 35746) Node 35746's forward link is 0x0; expected 0x6489 disk offset = 0x78f41000, size = 0x2000 Invalid node height (4, 35746) Index key doesn't match first node key Invalid index key (4, 35746) ** The volume could not be verified completely. volume check failed with error 7 volume type is pure HFS+ primary MDB is at block 0 0x00 alternate MDB is at block 0 0x00 primary VHB is at block 2 0x02 alternate VHB is at block 467182910 0x1bd8a53e sector size = 512 0x200 VolumeObject flags = 0x07 total sectors for volume = 467182912 0x1bd8a540 total sectors for embedded volume = 0 0x00 CheckForClean - could not get VHB/MDB at block 467182910 CheckHFS returned -1317, fsmodified = 1 ``` **What Next?** I am hopeful that with the drive being recognised, the data is still recoverable. Before looking at paid software such as DiskWarrior, is there anything else that I can try so that I can access the disk or to repair this `record count` problem.
2019/01/23
[ "https://superuser.com/questions/1397496", "https://superuser.com", "https://superuser.com/users/244470/" ]
i tried @pragman solution and got the same fonts for all styles, but not defaults :( so i removed the `webkit` option entirely, it was: ``` "webkit": { "webprefs": { "default_fixed_font_size": 13, "default_font_size": 16, "fonts": { "sansserif": { "Zyyy": "Custom" }, "serif": { "Zyyy": "Custom" }, "standard": { "Zyyy": "Custom" } }, "minimum_font_size": 0 } }, ``` my `Preferences` file was too big for vim editor and i got a new file with command-line JSON processor ```bash jq -c "del(.webkit)" Preferences > Preferences.new ```
You don't need to know the original fonts, here's how to do it: First, close Google Chrome, so your changes don't get overwritten. Go to your Google Chrome settings folder, in Ubuntu, i found it in `.config/google-chrome` In this folder, open up the file `Default/Preferences`, Search and replace references to your fonts in the file with the string "Custom". In my case they were all at the end of the file, so it was easy to replace. After this, open up Google Chrome again, and your fonts will be reset.
84,578
> > [![enter image description here](https://i.stack.imgur.com/4rjtu.png)](https://i.stack.imgur.com/4rjtu.png) > > > **Across** > > 1. Having very bad taste > > 4. English elite school > > 8. Shiraz's country > > 9. Russian car > > 10. Body part or storage device > > 12. "Pas" in *faux pas* > > 13. Mall customer > > 15. Baseballer Gehrig > > 16. Following as a consequence > > 21. Diseases, for example > > 23. A type of golf club > > 24. Frozen beverage > > 25. Actor Ayres and others > > 26. A common last name in Pakistan > > > **Down** > > 1. Accompanying dish > > 2. A part of the eye > > 3. Line-walking musician > > 5. London art gallery > > 6. East Germany's border river > > 7. California wine region > > 11. Structural elements that can be Ionic or Doric, for example > > 12. A famous piece of Soviet technology > > 14. A European or a piece of track and field equipment > > 16. Train transport > > 17. A country name on euro coins > > 18. How to take it on Kokomo > > 19. The Seven Year – > > 20. Scottish valley > > 22. Black or Dead, for example > > >
2019/05/31
[ "https://puzzling.stackexchange.com/questions/84578", "https://puzzling.stackexchange.com", "https://puzzling.stackexchange.com/users/41973/" ]
Across: 1. Having very bad taste > > Sick > > > 4. English elite school > > Eton > > > 8. Shiraz's country > > Iran > > > 9. Russian car > > Lada > > > 10. Body part or storage device > > Disc > > > 12. "Pas" in faux pas > > Step > > > 13. Mall customer > > Shopper > > > 15. Baseballer Gehrig > > Lou > > > 16. Following as a consequence > > Resulting > > > 21. Diseases, for example > > Ailments > > > 23. A type of golf club > > Iron > > > 24. Frozen beverage > > Icee > > > 25. Actor Ayres and others > > Lews > > > 26. A common last name in Pakistan > > Khan > > > Down: 1. Accompanying dish > > Side > > > 2. A part of the eye > > Iris > > > 3. Line-walking musician > > Cash > > > 5. London art gallery > > Tate > > > 6. East Germany's border river > > Oder > > > 7. California wine region > > Napa > > > 11. Structural elements that can be Ionic or Doric, for example > > Columns > > > 12. A famous piece of Soviet technology > > Sputnik > > > 14. A European or a piece of track and field equipment > > Pole > > > 16. Train transport > > Rail > > > 17. A country name on euro coins > > Eire > > > 18. How to take it on Kokomo > > Slow > > > 19. The Seven Year – > > Itch > > > 20. Scottish valley > > Glen > > > 22. Black or Dead, for example > > Sea > > >
Partial Answer (combnination of everyone's work with credits) Across: ------- 8: Shiraz's country > > IRAN > > > 9: A Russian Car > > LADA (thanks @Ak19!) > > > 12: "Pas" in faux pas > > STEP > > > 15: Baseballer Gehrig > > LOU > > > Down: ----- 1: Accompanying dish > > SIDE? > > > 2: A part of the eye > > IRIS? > > > 5: London Art gallery > > TATE (thanks, @Ak19!) > > > 6: East Germany's border river > > ODER > > > 7: California Wine region > > NAPA (thanks, @Ak19!) > > >
84,578
> > [![enter image description here](https://i.stack.imgur.com/4rjtu.png)](https://i.stack.imgur.com/4rjtu.png) > > > **Across** > > 1. Having very bad taste > > 4. English elite school > > 8. Shiraz's country > > 9. Russian car > > 10. Body part or storage device > > 12. "Pas" in *faux pas* > > 13. Mall customer > > 15. Baseballer Gehrig > > 16. Following as a consequence > > 21. Diseases, for example > > 23. A type of golf club > > 24. Frozen beverage > > 25. Actor Ayres and others > > 26. A common last name in Pakistan > > > **Down** > > 1. Accompanying dish > > 2. A part of the eye > > 3. Line-walking musician > > 5. London art gallery > > 6. East Germany's border river > > 7. California wine region > > 11. Structural elements that can be Ionic or Doric, for example > > 12. A famous piece of Soviet technology > > 14. A European or a piece of track and field equipment > > 16. Train transport > > 17. A country name on euro coins > > 18. How to take it on Kokomo > > 19. The Seven Year – > > 20. Scottish valley > > 22. Black or Dead, for example > > >
2019/05/31
[ "https://puzzling.stackexchange.com/questions/84578", "https://puzzling.stackexchange.com", "https://puzzling.stackexchange.com/users/41973/" ]
Across: 1. Having very bad taste > > Sick > > > 4. English elite school > > Eton > > > 8. Shiraz's country > > Iran > > > 9. Russian car > > Lada > > > 10. Body part or storage device > > Disc > > > 12. "Pas" in faux pas > > Step > > > 13. Mall customer > > Shopper > > > 15. Baseballer Gehrig > > Lou > > > 16. Following as a consequence > > Resulting > > > 21. Diseases, for example > > Ailments > > > 23. A type of golf club > > Iron > > > 24. Frozen beverage > > Icee > > > 25. Actor Ayres and others > > Lews > > > 26. A common last name in Pakistan > > Khan > > > Down: 1. Accompanying dish > > Side > > > 2. A part of the eye > > Iris > > > 3. Line-walking musician > > Cash > > > 5. London art gallery > > Tate > > > 6. East Germany's border river > > Oder > > > 7. California wine region > > Napa > > > 11. Structural elements that can be Ionic or Doric, for example > > Columns > > > 12. A famous piece of Soviet technology > > Sputnik > > > 14. A European or a piece of track and field equipment > > Pole > > > 16. Train transport > > Rail > > > 17. A country name on euro coins > > Eire > > > 18. How to take it on Kokomo > > Slow > > > 19. The Seven Year – > > Itch > > > 20. Scottish valley > > Glen > > > 22. Black or Dead, for example > > Sea > > >
Partial ACROSS ====== 9: A Russian Car > > Lada? > > > 10: Body part or storage device > > Disk > > > 25. Actor Ayres & others > > Lews > > > 26: A common last name in Pakistan > > Khan > > > DOWN ==== 5: London Art gallery > > Tate > > > 7: California Wine region > > Napa (Thanks OK for confirming) > > > 11. Structural elements that can be Ionic or Doric, for example > > Capital ? not sure (JMP found columns) > > > 16: Train Transport > > Rail > > > 19:The seven year - > > Itch > > > 20:Scottish valley > > Lyon > > >
84,578
> > [![enter image description here](https://i.stack.imgur.com/4rjtu.png)](https://i.stack.imgur.com/4rjtu.png) > > > **Across** > > 1. Having very bad taste > > 4. English elite school > > 8. Shiraz's country > > 9. Russian car > > 10. Body part or storage device > > 12. "Pas" in *faux pas* > > 13. Mall customer > > 15. Baseballer Gehrig > > 16. Following as a consequence > > 21. Diseases, for example > > 23. A type of golf club > > 24. Frozen beverage > > 25. Actor Ayres and others > > 26. A common last name in Pakistan > > > **Down** > > 1. Accompanying dish > > 2. A part of the eye > > 3. Line-walking musician > > 5. London art gallery > > 6. East Germany's border river > > 7. California wine region > > 11. Structural elements that can be Ionic or Doric, for example > > 12. A famous piece of Soviet technology > > 14. A European or a piece of track and field equipment > > 16. Train transport > > 17. A country name on euro coins > > 18. How to take it on Kokomo > > 19. The Seven Year – > > 20. Scottish valley > > 22. Black or Dead, for example > > >
2019/05/31
[ "https://puzzling.stackexchange.com/questions/84578", "https://puzzling.stackexchange.com", "https://puzzling.stackexchange.com/users/41973/" ]
Across: 1. Having very bad taste > > Sick > > > 4. English elite school > > Eton > > > 8. Shiraz's country > > Iran > > > 9. Russian car > > Lada > > > 10. Body part or storage device > > Disc > > > 12. "Pas" in faux pas > > Step > > > 13. Mall customer > > Shopper > > > 15. Baseballer Gehrig > > Lou > > > 16. Following as a consequence > > Resulting > > > 21. Diseases, for example > > Ailments > > > 23. A type of golf club > > Iron > > > 24. Frozen beverage > > Icee > > > 25. Actor Ayres and others > > Lews > > > 26. A common last name in Pakistan > > Khan > > > Down: 1. Accompanying dish > > Side > > > 2. A part of the eye > > Iris > > > 3. Line-walking musician > > Cash > > > 5. London art gallery > > Tate > > > 6. East Germany's border river > > Oder > > > 7. California wine region > > Napa > > > 11. Structural elements that can be Ionic or Doric, for example > > Columns > > > 12. A famous piece of Soviet technology > > Sputnik > > > 14. A European or a piece of track and field equipment > > Pole > > > 16. Train transport > > Rail > > > 17. A country name on euro coins > > Eire > > > 18. How to take it on Kokomo > > Slow > > > 19. The Seven Year – > > Itch > > > 20. Scottish valley > > Glen > > > 22. Black or Dead, for example > > Sea > > >
4 across: > > [ETON](https://www.etoncollege.com/) > > > 11 down > > [COLUMNS](https://en.wikipedia.org/wiki/Column#Orders_of_Columns) > > > 22 down > > SEA > > >
3,047,909
On compilation of the CUDA SDK, I'm getting a nvcc fatal : Unsupported gpu architecture 'compute\_20' My toolkit is 2.3 and on a shared system (i.e cant really upgrade) and the driver version is also 2.3, running on 4 Tesla C1060s If it helps, the problem is being called in radixsort. It appears that a few people online have had this problem but i havent found anywhere that actually gives a solution.
2010/06/15
[ "https://Stackoverflow.com/questions/3047909", "https://Stackoverflow.com", "https://Stackoverflow.com/users/252556/" ]
I believe compute\_20 is targeting Fermi hardware, which you do not have. Also, Cuda 2.3 doesn't support Fermi features or compute\_20. Try using compute\_13 instead.
You are compiling the 3.x SDK with a 2.3 Toolkit, that won't work since as you've now seen compute\_20 is not supported. The simplest solution is to either upgrade your Toolkit or downgrade your SDK. You could try changing the makefile (common.mk in C/common) on Linux or changing the Build Properties on Windows to select only compute\_13, but there may be other problems so it may be simpler to align the SDK/Toolkit versions. Note that if you don't have administrator priviledges then you can install a local version of the Toolkit alongside the SDK but you would need admi to upgrade the driver.
16,086,851
In spreadsheet cell B1, the value is -1200. I want cell B2 to copy the value of B1 and limit (validate?) it to no less than -800. I'm using google docs but can also use excel if those functions are not available in google docs. Edit: If B1 has the value of 2000, B2 should have the value of 2000. If B1 has the value of -2000, B2 should have the value of -800
2013/04/18
[ "https://Stackoverflow.com/questions/16086851", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2295658/" ]
Excel formula would be pretty easy, probably similar in Google Spreadsheets: In B2, put this formula: `=If(B1<-800,-800,B1)` This is saying: If the value in B1 is *less than* -800, then put the value "-800". Otherwise, use the value from B1. This effectively puts a "floor" or a lower bound on the formula.
You don't need any maths here. I'm using Excel but I think it is pretty similar in Google. Suppose that B3 holds floor, no constants in formulae :-) B2 => =if( b1 > $b$3; b1; $b$3) b3 position is fixed so you can copy the expression
16,086,851
In spreadsheet cell B1, the value is -1200. I want cell B2 to copy the value of B1 and limit (validate?) it to no less than -800. I'm using google docs but can also use excel if those functions are not available in google docs. Edit: If B1 has the value of 2000, B2 should have the value of 2000. If B1 has the value of -2000, B2 should have the value of -800
2013/04/18
[ "https://Stackoverflow.com/questions/16086851", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2295658/" ]
Excel & Google Spreadsheets ``` =Max(B1,-800) ```
Excel formula would be pretty easy, probably similar in Google Spreadsheets: In B2, put this formula: `=If(B1<-800,-800,B1)` This is saying: If the value in B1 is *less than* -800, then put the value "-800". Otherwise, use the value from B1. This effectively puts a "floor" or a lower bound on the formula.