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
253,036
I want to shorten ``` sudo http_proxy="http://proxy:port" apt-get ______ ``` to ``` sudo rep apt-get ________ ``` Is this possible to implement in Ubuntu? ### EDIT: So I added ``` alias rapt-get="http_proxy="10.1.1.26:8080" apt-get" ``` to my `~/.bash_aliases`. I have other working aliases in this file. If I type rapt-get in the terminal, I get: ``` apt 0.8.16~exp12ubuntu10 for amd64 compiled on Apr 20 2012 10:19:39 Usage: apt-get [options] command apt-get [options] install|remove pkg1 [pkg2 ...] apt-get [options] source pkg1 [pkg2 ...] ``` `apt-get` is a simple command line interface for downloading and installing packages. The most frequently used commands are update and install. ### Commands: ``` update - Retrieve new lists of packages upgrade - Perform an upgrade install - Install new packages (pkg is libc6 not libc6.deb) remove - Remove packages autoremove - Remove automatically all unused packages purge - Remove packages and config files source - Download source archives build-dep - Configure build-dependencies for source packages dist-upgrade - Distribution upgrade, see apt-get(8) dselect-upgrade - Follow dselect selections clean - Erase downloaded archive files autoclean - Erase old downloaded archive files check - Verify that there are no broken dependencies changelog - Download and display the changelog for the given package download - Download the binary package into the current directory ``` ### Options: ``` -h This help text. -q Loggable output - no progress indicator -qq No output except for errors -d Download only - do NOT install or unpack archives -s No-act. Perform ordering simulation -y Assume Yes to all queries and do not prompt -f Attempt to correct a system with broken dependencies in place -m Attempt to continue if archives are unlocatable -u Show a list of upgraded packages as well -b Build the source package after fetching it -V Show verbose version numbers -c=? Read this configuration file -o=? Set an arbitrary configuration option, eg -o dir::cache=/tmp See the apt-get(8), sources.list(5) and apt.conf(5) manual pages for more information and options. This APT has Super Cow Powers. Seems to be working. But if i type `sudo rapt-get update`, I get sudo: rapt-get: command not found ``` (Sorry for the formatting issues, I'm on through mobile and can't see the formatting bar)
2013/02/09
[ "https://askubuntu.com/questions/253036", "https://askubuntu.com", "https://askubuntu.com/users/129716/" ]
This depends on your `/etc/sudoers` settings as well. For starters, as pointed out, the *alias* won't even be available within the `sudo` context. However, you could adjust your alias to say: ``` alias rapt-get='http_proxy="10.1.1.26:8080" sudo apt-get' ``` i.e. include the variable that you set for this invocation. If you wanted `sudo` to take this over from the user's context you'll have to edit `/etc/sudoers` in order to add the variable name to the `env_check` or `env_keep` setting. Quoting `man sudoers`: > > By default, the `env_reset` option is enabled. This causes commands to > be executed with a minimal environment containing `TERM`, `PATH`, > `HOME`, `MAIL`, `SHELL`, `LOGNAME`, `USER` and `USERNAME` in addition > to variables from the invoking process permitted by the `env_check` > and `env_keep` options. This is effectively a whitelist for > environment variables. > > >
`~/.bashrc` adds aliases for you, and only you `sudo` runs as root. Even though you may have administrator access, your user is not root. So, add your alias to `~root/.bashrc` (generally this is `/root/.bashrc`). If you'd like to add this alias for all users, add it to `/etc/profile`
256,830
In this case I'm filtering by the tag [tag:css\*], but it's showing this as [css\*] and showing the [css](/questions/tagged/css "show questions tagged 'css'") tag's exerpt. ![Example](https://i.stack.imgur.com/kDkbz.png)
2015/05/20
[ "https://meta.stackexchange.com/questions/256830", "https://meta.stackexchange.com", "https://meta.stackexchange.com/users/211113/" ]
I am worried that changing the title in the browser will actually obfuscate the title that much, we can't make sense of the actually question opened any more. If you have opened a few tabs, which is that `1-800 SPAM` post? I don't think the obfuscation of the question itself is useful, since that is only visible to 10K users anyway that willingly open that specific question though a link.
Unlike with a deleted answer, people aren't actually going to be seeing the deleted content except when explicitly going out of their way to visit the deleted spam post, so I don't see how this is at all necessary. With a deleted answer people are still going to be going to the question to see the non-spam content, and seeing the spam answer on that page (if they're 10k+) so removing the post itself has merit.
256,830
In this case I'm filtering by the tag [tag:css\*], but it's showing this as [css\*] and showing the [css](/questions/tagged/css "show questions tagged 'css'") tag's exerpt. ![Example](https://i.stack.imgur.com/kDkbz.png)
2015/05/20
[ "https://meta.stackexchange.com/questions/256830", "https://meta.stackexchange.com", "https://meta.stackexchange.com/users/211113/" ]
Since there's already a process in place to replace the question title and body with an appropriate text when deleted for being spam or rude, changing the page title as well should be a five minute fix. Ten minutes perhaps, to figure out a suitable replacement text, but here's my suggestion "Post Removed".
Unlike with a deleted answer, people aren't actually going to be seeing the deleted content except when explicitly going out of their way to visit the deleted spam post, so I don't see how this is at all necessary. With a deleted answer people are still going to be going to the question to see the non-spam content, and seeing the spam answer on that page (if they're 10k+) so removing the post itself has merit.
35,087
I am working with the latest version of Adobe Illustrator. I have the following: ![two rounded rectangles](https://i.stack.imgur.com/l0PQT.png) I would like to cup the shape at the following location, so that I create a flat document icon that is folded in one corner: ![slice line of rounded rectangle](https://i.stack.imgur.com/uWwx5.png) How I can achieve this? The knife tool doesn't do straight lines! Even though I press Ctrl / Shift / Alt .. etc Any help would be greatly appreciated. Thank You.
2014/06/26
[ "https://graphicdesign.stackexchange.com/questions/35087", "https://graphicdesign.stackexchange.com", "https://graphicdesign.stackexchange.com/users/21854/" ]
First of all, I worked in Outline mode (Ctrl+Y). 1. You have you shapes stacked. ![enter image description here](https://i.stack.imgur.com/3pXe1.jpg) 2. Turn on Smart Guides (Ctrl+U) it will help to fit exactly into intersection points. Do a straight line of cut with Pen tool (P). ![enter image description here](https://i.stack.imgur.com/PVbd8.jpg) 3. Do and complete any shape which will enclose your smaller rectangle ![enter image description here](https://i.stack.imgur.com/ifkKA.jpg) 4. Select all shapes, open Pathfinder panel and use Trim. ![enter image description here](https://i.stack.imgur.com/NiPvp.jpg) 5. Select unnecessary shapes with Direct Select (A), you can select even part of path or one point. And press Delete. At first press you will delete exactly what selected. After delete the whole path will be selected - press Delete second time. ![enter image description here](https://i.stack.imgur.com/fcJuo.jpg) 6. Back to Normal mode (Ctrl+Y). ![enter image description here](https://i.stack.imgur.com/1E90v.jpg)
Click TRIM or MERGE in the pathfinder, then use the Direct selection tool and delete all unneeded anchor points! ![enter image description here](https://i.stack.imgur.com/ImxmL.png)
3,368,746
I have been asked to use a triple integral to find the volume of the solid bounded by the surface: z = $x^2$ and the planes y = z and y = 1. How do I find the bounds of the triple integral and does the order of the triple integral matter? e.g dzdydx, dxdydz
2019/09/24
[ "https://math.stackexchange.com/questions/3368746", "https://math.stackexchange.com", "https://math.stackexchange.com/users/692813/" ]
The order of integration will depend on the parameterization that you choose. However, for any order of integration, there is a parameterization you might choose. I suggest you always try to sketch the region. In this case, we have a parabolic cylinder and two planes. [![enter image description here](https://i.stack.imgur.com/5tu3p.png)](https://i.stack.imgur.com/5tu3p.png) The dashed line is the image of $x = z^2$ in the plane $y = z$ Now we need some equations. We want values of $y $ above $y=z$ and below $y = 1$ $z\le y \le 1$ It is worth noting that the two planes intersect at a line where $z = 1, y=1$ We need values for $x,z$ that are inside the parabolic cylinder. $x^2\le z \le 1$ and $-1\le x \le 1$ $\int\_{-1}^1\int\_{x^2}^1\int\_z^1 dy\ dz\ dx$ But we could just as easily say $\int\_{0}^1\int\_{-\sqrt z}^{\sqrt z}\int\_z^1 dy\ dx\ dz$ or $\int\_{-1}^1\int\_{0}^{1}\int\_{x^2}^y dz\ dy\ dx$ And, if I have done this correctly, you should get the same result from all three integrals.
The triple volume integral can be set up as follows $$\int\_0^1\int\_{-\sqrt z}^{\sqrt z}\int\_z^1dydxdz$$ that is, integrate along $y$ first, then $x$ and finally $z$.
42,430,615
Hi I am trying to control the html based on the value inside directive. I have a html like this: ``` //myCtrl.isLoad was set to false <img ng-src="{{myCtrl.url}}" imageonload></img> <div ng-if="myCtrl.isLoad">Show me</div> ``` Directive: ``` angular.module('myApp') .directive('imageonload', imageonloadFunction); function imageonloadFunction() { var directive = { 'link': link, 'restrict': 'A' }; return directive; } function link($scope, element, attrs) { some other codes.. //Do something if the condition is met //and change myCtrl.isLoad = true so //<div ng-if="myCtrl.isLoad">Show me</div> //will show } ``` I am not sure the best way to bind the directive data to the parent. Can anyone help me about it? Thanks a lot!
2017/02/24
[ "https://Stackoverflow.com/questions/42430615", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6480044/" ]
you can just bind the controller property to the directive. ```js angular.module('myApp', []) .directive('imageonload', imageonloadFunction); function imageonloadFunction() { var directive = { 'link': link, 'scope': { 'isLoad': '=' }, 'restrict': 'A' }; return directive; } function link($scope, element, attrs) { $scope.isLoad = true; //Do something if the condition is met //and change myCtrl.isLoad = true so //<div ng-if="myCtrl.isLoad">Show me</div> //will show } ``` ```html //myCtrl.isLoad was set to false <img ng-src="{{myCtrl.url}}" imageonload is-load="myCtrl.isLoad"></img> <div ng-if="myCtrl.isLoad">Show me</div> ```
Display Loader When image load. In HTML: ``` <img src="img/loading.gif" imageload="{{myCtrl.url}}"> ``` Directive : ``` .directive('imageload', function() { return { restrict: 'A', scope: { imageload: '@' }, link: function(scope, element, attrs) { element.one('load', function() { element.attr('src', scope.imageload); }); } }; }) ```
24,831,850
Back in Objective-C, I defined the following macros in a `constants.h` file: ``` #define IS_IPHONE5 (([[UIScreen mainScreen] bounds].size.height-568)?NO:YES) #define IS_IPAD (UI_USER_INTERFACE_IDIOM()==UIUserInterfaceIdiomPad) #define IS_IOS7 ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7) #define APP_DEFAULT_FONT_FACE @"HelveticaNeue-Light" #define APP_DEFAULT_FONT_FACE_THIN @"HelveticaNeue-UltraLight" #define APP_VERSION @"1.2" ``` I started playing with Swift and I noticed that these things just don't work anymore. So now how should I define these macros, and detect which family the device belongs to? And if Swift doesn't have macros, what is the syntax of doing it?
2014/07/18
[ "https://Stackoverflow.com/questions/24831850", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3680562/" ]
In this case, the easiest way to define these constants seems to be to use the `let` keyword. Macros are not available in Swift, so you have to use constants in this case (which may be better in terms of performance anyhow, in this case): ``` let IS_IPHONE5 = fabs(UIScreen.mainScreen().bounds.size.height-568) < 1; let IS_IPAD = (UI_USER_INTERFACE_IDIOM()==UIUserInterfaceIdiomPad); let IS_IOS8 = (UIDevice.currentDevice().systemVersion.floatValue >= 8) let APP_DEFAULT_FONT_FACE_NAME = "HelveticaNeue-Light"; let APP_DEFAULT_FONT_FACE_THIN_NAME = "HelveticaNeue-UltraLight"; let APP_VERSION_STRING = "1.2"; ``` for the `IS_IPHONE5` constant, I used `fabs` to avoid possible floating point rounding errors. I'm not sure if they would be an issue, but it's better to be safe... The `IS_IOS7` macro is useless in Swift, because Swift [only supports iOS 7 and later versions](https://stackoverflow.com/questions/24001778/do-swift-based-applications-work-on-os-x-10-9-ios-7-and-lower) (`IS_IOS7` would always be `YES` in a Swift program.) I added an `IS_IOS8` constant instead...
For IPad : ``` static let IS_IPAD = UIDevice.currentDevice().userInterfaceIdiom == .Pad && ScreenSize.SCREEN_MAX_LENGTH >= 1024.0 ```
24,831,850
Back in Objective-C, I defined the following macros in a `constants.h` file: ``` #define IS_IPHONE5 (([[UIScreen mainScreen] bounds].size.height-568)?NO:YES) #define IS_IPAD (UI_USER_INTERFACE_IDIOM()==UIUserInterfaceIdiomPad) #define IS_IOS7 ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7) #define APP_DEFAULT_FONT_FACE @"HelveticaNeue-Light" #define APP_DEFAULT_FONT_FACE_THIN @"HelveticaNeue-UltraLight" #define APP_VERSION @"1.2" ``` I started playing with Swift and I noticed that these things just don't work anymore. So now how should I define these macros, and detect which family the device belongs to? And if Swift doesn't have macros, what is the syntax of doing it?
2014/07/18
[ "https://Stackoverflow.com/questions/24831850", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3680562/" ]
I tend to use these three structs in every project i do: ``` struct ScreenSize { static let SCREEN_WIDTH = UIScreen.mainScreen().bounds.size.width static let SCREEN_HEIGHT = UIScreen.mainScreen().bounds.size.height static let SCREEN_MAX_LENGTH = max(ScreenSize.SCREEN_WIDTH, ScreenSize.SCREEN_HEIGHT) static let SCREEN_MIN_LENGTH = min(ScreenSize.SCREEN_WIDTH, ScreenSize.SCREEN_HEIGHT) } struct DeviceType { static let IS_IPHONE_4_OR_LESS = UIDevice.currentDevice().userInterfaceIdiom == .Phone && ScreenSize.SCREEN_MAX_LENGTH < 568.0 static let IS_IPHONE_5 = UIDevice.currentDevice().userInterfaceIdiom == .Phone && ScreenSize.SCREEN_MAX_LENGTH == 568.0 static let IS_IPHONE_6 = UIDevice.currentDevice().userInterfaceIdiom == .Phone && ScreenSize.SCREEN_MAX_LENGTH == 667.0 static let IS_IPHONE_6P = UIDevice.currentDevice().userInterfaceIdiom == .Phone && ScreenSize.SCREEN_MAX_LENGTH == 736.0 static let IS_IPAD = UIDevice.currentDevice().userInterfaceIdiom == .Pad && ScreenSize.SCREEN_MAX_LENGTH == 1024.0 } struct iOSVersion { static let SYS_VERSION_FLOAT = (UIDevice.currentDevice().systemVersion as NSString).floatValue static let iOS7 = (iOSVersion.SYS_VERSION_FLOAT < 8.0 && iOSVersion.SYS_VERSION_FLOAT >= 7.0) static let iOS8 = (iOSVersion.SYS_VERSION_FLOAT >= 8.0 && iOSVersion.SYS_VERSION_FLOAT < 9.0) static let iOS9 = (iOSVersion.SYS_VERSION_FLOAT >= 9.0 && iOSVersion.SYS_VERSION_FLOAT < 10.0) } ``` And i use them in the following manner: ``` if DeviceType.IS_IPHONE_6 { //iPhone 6 specific code goes here. } ```
For IPad : ``` static let IS_IPAD = UIDevice.currentDevice().userInterfaceIdiom == .Pad && ScreenSize.SCREEN_MAX_LENGTH >= 1024.0 ```
492,607
I have a directory `/var/mychoot` on the same filesystem as `/`, and I've started the program `/var/mychroot/prog` as `sudo chroot /var/mychroot /prog`, so the program is running as EUID 0. If the program executes the [chdir("..") escape technique](http://linux-vserver.org/Secure_chroot_Barrier#Using_chdir.28.22...22.29_many_times), then it is able to escape the chroot and see everything within `/`. (I've verified this on Linux 4.18.) I want to prevent such an escape. In fact I want to prevent all kinds of chroot escapes, but in this question I'm only interested in how the [chdir("..") escape technique](http://linux-vserver.org/Secure_chroot_Barrier#Using_chdir.28.22...22.29_many_times) can be prevented on modern Linux systems. For this I'm looking for alternatives of the *chroot(2)* system call. I've found 2 solutions: [pivot\_root](https://github.com/opencontainers/runc/blob/4769cdf607b0d1cbd73e5407d9655da7511fe193/libcontainer/rootfs_linux.go#L693) and [MS\_MOVE](https://github.com/opencontainers/runc/blob/4769cdf607b0d1cbd73e5407d9655da7511fe193/libcontainer/rootfs_linux.go#L750), but they only work if `/var/mychroot` is a mount point, so they fail if `/var/mychroot` is just a subdirectory within the `/` filesystem. Is there another solution in this case? I want to avoid techniques using `LD_PRELOAD` (because `LD_PRELOAD` doesn't affect statically linked executables), techniques using *ptrace(2)* (because then I'm not able to run `strace` within the chroot, and also *ptrace(2)* is very tricky to get right: processes will crash or hang) and real virtualization (e.g. Xen or KVM or QEMU; because of the performance overhead and the less flexible memory provisioning). To recap, I need: * an alternative of *chroot(2)* system call, * with which root can restrict processes running as root (EUID 0), * to a subdirectory of the filesystem of `/`, * which prevents the [chdir("..") escape technique](http://linux-vserver.org/Secure_chroot_Barrier#Using_chdir.28.22...22.29_many_times), * and doesn't use `LD_PRELOAD` or * *ptrace(2)* or * virtualization (e.g. Xen, KVM or QEMU), * and it runs on a modern Linux system, * with and unpatched kernel. Does it exist?
2019/01/05
[ "https://unix.stackexchange.com/questions/492607", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/3054/" ]
To protect against the specific `chdir("..")` escape technique you mentioned, you can simply drop the capability to execute `chroot(2)` again once you're chrooted to `/var/mychroot` yourself. The escape technique requires another call to `chroot()`, so blocking that is enough to prevent it from working. You can do that with Linux capabilities, by dropping `CAP_SYS_CHROOT` which is the one needed for `chroot(2)` to be available. For example: ``` outside# chroot /var/mychroot inside# capsh --drop=cap_sys_chroot -- inside# ./escape_chroot chroot(baz): Operation not permitted ``` (The second prompt inside the chroot is from a shell spawned from `capsh`. You can make it run another command with, for example, `capsh --drop=cap_sys_chroot -- -c 'exec ./escape_chroot'`.) --- But a much better technique is to just use `pivot_root`, since it protects from many of the other possible exploits that `chroot(2)` will not protect from. You mentioned that it only works if `/var/mychroot` is a mount point, but you can make it a mount point by simply bind mounting it into itself. Note that you need to create a mount namespace to use `pivot_root` to create a jail, otherwise it will try to change the root of all processes in your filesystem, which is most likely not what you want here... So the whole sequence goes: ``` outside# unshare -m outside# mount --bind /var/mychroot /var/mychroot outside# cd /var/mychroot outside# mkdir old_root outside# pivot_root . old_root limbo# exec chroot . inside# umount /old_root ``` (Again, many of these commands are spawning new shells. `unshare` does that, so does `chroot` itself. You can work around those by passing commands as extra arguments. In some cases you might want to pass `sh -c '...'` for a full script.) At this point, you're inside a `pivot_root` jail in a separate mount namespace, and the fact that `/var/mychroot` is simply a directory of the original root (and not a mount of a separate device or loop device) didn't really prevent this from working, thanks to the bind mount into itself. Running the escape code, you'll see that the jail works as expected (even though the escape code claims otherwise): ``` inside# touch /inside_jail inside# ./escape_chroot Exploit seems to work. =) inside# ls -ld /inside_jail /old_root -rw-r--r--. 1 0 0 0 Jan 5 23:45 /inside_jail dr-xr-xr-x. 20 0 0 4096 Jul 5 23:45 /old_root ``` As you can see, still inside the jail... The exploit code is just a bit naive and assumes that as long as the operations (`chroot`, `chdir`) have succeeded, that was enough to escape the jail, which is not really the case... So consider using this technique to create a jail that is superior to `chroot` and does not require using Linux capabilities to block operations inside it (such as creating additional `chroot`s, which might actually be useful or required for what you're actually trying to run in a jail.)
> > they only work if /var/mychroot is a mount point, so they fail if /var/mychroot is just a subdirectory within the / filesystem. > > > You can make any directory a mount point: `mount --rbind /var/mychoot /var/mychoot`. This step - and others that you will need - are covered here: [How to perform chroot with Linux namespaces?](https://unix.stackexchange.com/questions/456620/how-to-perform-chroot-with-linux-namespaces) > > In fact I want to prevent all kinds of chroot escapes > > > Combine the above with user namespaces. Alternatively, `seccomp`. This is how Docker prevents contained processes calling `mount()`, for example. (When you mount a block device a second time, you get a second view of that filesystem, which more or less counts as an escape). Copy Docker's list of allowed syscalls - root has lots of different ways of escaping. <https://docs.docker.com/engine/security/seccomp/> <https://github.com/moby/moby/blob/master/profiles/seccomp/default.json>
75,388
Let us consider affine Cremona group $GA\_{n}$ ($n\gt 1$). Question: do exist finite-dimensional representation of $GA\_{n}$ ? Thank you for the answer!
2011/09/14
[ "https://mathoverflow.net/questions/75388", "https://mathoverflow.net", "https://mathoverflow.net/users/10613/" ]
I mentioned [here](http://www.normalesup.org/~cornulier/cremona.pdf) (esp. Remark 5.3) that $GA\_2$ has no faithful linear representation (finite-dimensional, over any field), but the proof can easily be modified to show that any linear representation of the kernel $SGA\_2$ of the determinant of the Jacobian has no nontrivial linear representation (and thus any linear representation of $GA\_2$ has an abelian image). To summarize the proof: by the (elementary) computation done in the above link, if $M(x,y)=(x,x+y)$, then for every $n$ there exists a nilpotent subgroup $N$ of $SGA\_2$ such that $M$ belongs to the $n$-th term of the descending central series of $N$. Nilpotency lengths of nilpotent subgroups in a given dimension are bounded. It easily follows that $M$ is killed by every linear representation of $SGA\_2$. Also the normal subgroup generated by $M$ contains the linear, and thus the affine transformations of the plane and using generation of $GA\_2$ by affine and elementary transformations it's easy to conclude. (I might include this further remark since the paper is not yet published.) For $n\ge 3$ this still proves that every linear representation of $GA\_n$ kills the affine transformations with determinant one, but I don't know if it's enough to conclude that all linear representations have an abelian image.
There is one obvious representation which takes an automorphism of $\mathbb A^n$ to the determinant of its Jacobian. Let $G\_n$ be its kernel. It carries a natural structure of infinite-dimensional algebraic group. Shafarevich proved that $G\_n$ is simple as an algebraic group in this [paper](http://iopscience.iop.org/0025-5726/18/1/A10/pdf/IZV_18_1_A10.pdf). Perhaps this suffices to answer your question but I am not sure. > > **Edit.** According to Jérémy's comment below the proof of Shafarevich > does not work. Apparently, the > simplicity of $G\_n$ as > an algebraic group is an open problem > for $n \ge 3$. > > > However it is known that $G\_2$, as an abstract group, is not simple. This was proved by Danilov in this other [paper](http://www.ams.org/mathscinet-getitem?mr=357626). According to [Furter and Lamy](http://arxiv.org/PS_cache/arxiv/pdf/0910/0910.1616v2.pdf), Danilov shows that the normal subgroup generated by $(ea)^{13}$, where $a = (y,−x)$ and $e = (x,y+ 3x^5 − 5x^4)$, is a strict subgroup of $G\_2$. For a more general statement see the paper By Furter and Lamy. It is also known that planar Cremona group ${\mathrm{Bir}}(\mathbb P^2)$ is not simple. This was proved recently by [Cantat and Lamy](http://arxiv.org/abs/1007.0895).
5,257,662
I am using table view and I am using different cell size, but when I delete the cell, it shows on constant position, not in the middle of the cell. What should I do for custom delete button position?
2011/03/10
[ "https://Stackoverflow.com/questions/5257662", "https://Stackoverflow.com", "https://Stackoverflow.com/users/651046/" ]
This is really hacky, but I found this snippet of code a while back: ``` - (void)willTransitionToState:(UITableViewCellStateMask)state { [super willTransitionToState:state]; if ((state & UITableViewCellStateShowingDeleteConfirmationMask) == UITableViewCellStateShowingDeleteConfirmationMask) { for (UIView *subview in self.subviews) { if ([NSStringFromClass([subview class]) isEqualToString:@"UITableViewCellDeleteConfirmationControl"]) { subview.hidden = YES; subview.alpha = 0.0; } } } } - (void)didTransitionToState:(UITableViewCellStateMask)state { [super willTransitionToState:state]; if (state == UITableViewCellStateShowingDeleteConfirmationMask || state == UITableViewCellStateDefaultMask) { for (UIView *subview in self.subviews) { if ([NSStringFromClass([subview class]) isEqualToString:@"UITableViewCellDeleteConfirmationControl"]) { UIView *deleteButtonView = (UIView *)[subview.subviews objectAtIndex:0]; CGRect f = deleteButtonView.frame; f.origin.x -= 20; deleteButtonView.frame = f; subview.hidden = NO; [UIView beginAnimations:@"anim" context:nil]; subview.alpha = 1.0; [UIView commitAnimations]; } } } } ``` Basically, you are peeling off the subviews until you find the delete button. What I would also suggest is to not show the default delete button and use your own custom delete button.
Reload the table in `viewWillAppear`. It will reload the table after record has been deleted. ``` [super viewWillAppear:animated]; // [self.tableView reloadData ]; [tblSimpleTable reloadData]; ```
37,260,473
I have published my WCF project onto a server, i have also published an MVC application onto the same box which consumes the WCF services. When trying login on my MVC application, this uses a wcf service, but i get this exception on the browser, > > The Entity Framework provider type > 'System.Data.Entity.SqlServer.SqlProviderServices, > EntityFramework.SqlServer' registered in the application config file > for the ADO.NET provider with invariant name 'System.Data.SqlClient' > could not be loaded. Make sure that the assembly-qualified name is > used and that the assembly is available to the running application. > > > This is an entity framework exception, but i assume since my project already references EF in the dev environment, after deploying the service project, the DLLs should contain the EF reference also but I am not sure why I am getting this error. I can see this message because I turned on the `includeExceptionDetailInFaults="True"`
2016/05/16
[ "https://Stackoverflow.com/questions/37260473", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5351206/" ]
@FranciscoGoldenstein saying ! You don't need to install Entity Framework in your Console application or whatever, you just need to add a reference to the assembly EntityFramework.SqlServer.dll. You can copy this assembly from the Class Library project that uses Entity Framework to a LIB folder and add a reference to it. In summary: * Class Library application: + Install Entity Framework + Write your data layer code + app.config file has all the configuration related to Entity Framework except for the connection string. * Create a Console, web or desktop application: + Add a reference to the first project. + Add a reference to EntityFramework.SqlServer.dll. + app.config/web.config has the connection string (remember that the name of the configuration entry has to be the same as the name of the DbContext class. it is work for me ! I hope it helps. also try this link [Entity Framework Provider type could not be loaded?](https://stackoverflow.com/questions/14033193/entity-framework-provider-type-could-not-be-loaded)
Uninstall Entity Framework nuget and just reinstall, worked for me.
37,260,473
I have published my WCF project onto a server, i have also published an MVC application onto the same box which consumes the WCF services. When trying login on my MVC application, this uses a wcf service, but i get this exception on the browser, > > The Entity Framework provider type > 'System.Data.Entity.SqlServer.SqlProviderServices, > EntityFramework.SqlServer' registered in the application config file > for the ADO.NET provider with invariant name 'System.Data.SqlClient' > could not be loaded. Make sure that the assembly-qualified name is > used and that the assembly is available to the running application. > > > This is an entity framework exception, but i assume since my project already references EF in the dev environment, after deploying the service project, the DLLs should contain the EF reference also but I am not sure why I am getting this error. I can see this message because I turned on the `includeExceptionDetailInFaults="True"`
2016/05/16
[ "https://Stackoverflow.com/questions/37260473", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5351206/" ]
@FranciscoGoldenstein saying ! You don't need to install Entity Framework in your Console application or whatever, you just need to add a reference to the assembly EntityFramework.SqlServer.dll. You can copy this assembly from the Class Library project that uses Entity Framework to a LIB folder and add a reference to it. In summary: * Class Library application: + Install Entity Framework + Write your data layer code + app.config file has all the configuration related to Entity Framework except for the connection string. * Create a Console, web or desktop application: + Add a reference to the first project. + Add a reference to EntityFramework.SqlServer.dll. + app.config/web.config has the connection string (remember that the name of the configuration entry has to be the same as the name of the DbContext class. it is work for me ! I hope it helps. also try this link [Entity Framework Provider type could not be loaded?](https://stackoverflow.com/questions/14033193/entity-framework-provider-type-could-not-be-loaded)
I also had a similar problem My problem was solved by doing the following: [![enter image description here](https://i.stack.imgur.com/fYdqE.png)](https://i.stack.imgur.com/fYdqE.png) [![enter image description here](https://i.stack.imgur.com/tPsC9.png)](https://i.stack.imgur.com/tPsC9.png)
37,260,473
I have published my WCF project onto a server, i have also published an MVC application onto the same box which consumes the WCF services. When trying login on my MVC application, this uses a wcf service, but i get this exception on the browser, > > The Entity Framework provider type > 'System.Data.Entity.SqlServer.SqlProviderServices, > EntityFramework.SqlServer' registered in the application config file > for the ADO.NET provider with invariant name 'System.Data.SqlClient' > could not be loaded. Make sure that the assembly-qualified name is > used and that the assembly is available to the running application. > > > This is an entity framework exception, but i assume since my project already references EF in the dev environment, after deploying the service project, the DLLs should contain the EF reference also but I am not sure why I am getting this error. I can see this message because I turned on the `includeExceptionDetailInFaults="True"`
2016/05/16
[ "https://Stackoverflow.com/questions/37260473", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5351206/" ]
@FranciscoGoldenstein saying ! You don't need to install Entity Framework in your Console application or whatever, you just need to add a reference to the assembly EntityFramework.SqlServer.dll. You can copy this assembly from the Class Library project that uses Entity Framework to a LIB folder and add a reference to it. In summary: * Class Library application: + Install Entity Framework + Write your data layer code + app.config file has all the configuration related to Entity Framework except for the connection string. * Create a Console, web or desktop application: + Add a reference to the first project. + Add a reference to EntityFramework.SqlServer.dll. + app.config/web.config has the connection string (remember that the name of the configuration entry has to be the same as the name of the DbContext class. it is work for me ! I hope it helps. also try this link [Entity Framework Provider type could not be loaded?](https://stackoverflow.com/questions/14033193/entity-framework-provider-type-could-not-be-loaded)
The easiest trick to resolve this issue is to add the following line inside one of the classes in your EF project: ``` public class Blablabla { private static string __hack = typeof(SqlProviderServices).ToString(); // other class members as they were before. } ``` This will force the build process to copy **EntityFramework.SqlServer.dll** to the `\bin` folder of any project that has references to the EF project. No need to install EF nuget package or make an explicit reference to EntityFramework.SqlServer.dll in any downstream project.
37,260,473
I have published my WCF project onto a server, i have also published an MVC application onto the same box which consumes the WCF services. When trying login on my MVC application, this uses a wcf service, but i get this exception on the browser, > > The Entity Framework provider type > 'System.Data.Entity.SqlServer.SqlProviderServices, > EntityFramework.SqlServer' registered in the application config file > for the ADO.NET provider with invariant name 'System.Data.SqlClient' > could not be loaded. Make sure that the assembly-qualified name is > used and that the assembly is available to the running application. > > > This is an entity framework exception, but i assume since my project already references EF in the dev environment, after deploying the service project, the DLLs should contain the EF reference also but I am not sure why I am getting this error. I can see this message because I turned on the `includeExceptionDetailInFaults="True"`
2016/05/16
[ "https://Stackoverflow.com/questions/37260473", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5351206/" ]
@FranciscoGoldenstein saying ! You don't need to install Entity Framework in your Console application or whatever, you just need to add a reference to the assembly EntityFramework.SqlServer.dll. You can copy this assembly from the Class Library project that uses Entity Framework to a LIB folder and add a reference to it. In summary: * Class Library application: + Install Entity Framework + Write your data layer code + app.config file has all the configuration related to Entity Framework except for the connection string. * Create a Console, web or desktop application: + Add a reference to the first project. + Add a reference to EntityFramework.SqlServer.dll. + app.config/web.config has the connection string (remember that the name of the configuration entry has to be the same as the name of the DbContext class. it is work for me ! I hope it helps. also try this link [Entity Framework Provider type could not be loaded?](https://stackoverflow.com/questions/14033193/entity-framework-provider-type-could-not-be-loaded)
Maybe is something silly, but for future reference: In my case I was working with Unit Testing. I added the configuration to the app.config, but never install the Entity Framework to the Unit Test Project. After installed, so far so good.
37,260,473
I have published my WCF project onto a server, i have also published an MVC application onto the same box which consumes the WCF services. When trying login on my MVC application, this uses a wcf service, but i get this exception on the browser, > > The Entity Framework provider type > 'System.Data.Entity.SqlServer.SqlProviderServices, > EntityFramework.SqlServer' registered in the application config file > for the ADO.NET provider with invariant name 'System.Data.SqlClient' > could not be loaded. Make sure that the assembly-qualified name is > used and that the assembly is available to the running application. > > > This is an entity framework exception, but i assume since my project already references EF in the dev environment, after deploying the service project, the DLLs should contain the EF reference also but I am not sure why I am getting this error. I can see this message because I turned on the `includeExceptionDetailInFaults="True"`
2016/05/16
[ "https://Stackoverflow.com/questions/37260473", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5351206/" ]
Uninstall Entity Framework nuget and just reinstall, worked for me.
I also had a similar problem My problem was solved by doing the following: [![enter image description here](https://i.stack.imgur.com/fYdqE.png)](https://i.stack.imgur.com/fYdqE.png) [![enter image description here](https://i.stack.imgur.com/tPsC9.png)](https://i.stack.imgur.com/tPsC9.png)
37,260,473
I have published my WCF project onto a server, i have also published an MVC application onto the same box which consumes the WCF services. When trying login on my MVC application, this uses a wcf service, but i get this exception on the browser, > > The Entity Framework provider type > 'System.Data.Entity.SqlServer.SqlProviderServices, > EntityFramework.SqlServer' registered in the application config file > for the ADO.NET provider with invariant name 'System.Data.SqlClient' > could not be loaded. Make sure that the assembly-qualified name is > used and that the assembly is available to the running application. > > > This is an entity framework exception, but i assume since my project already references EF in the dev environment, after deploying the service project, the DLLs should contain the EF reference also but I am not sure why I am getting this error. I can see this message because I turned on the `includeExceptionDetailInFaults="True"`
2016/05/16
[ "https://Stackoverflow.com/questions/37260473", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5351206/" ]
Uninstall Entity Framework nuget and just reinstall, worked for me.
Maybe is something silly, but for future reference: In my case I was working with Unit Testing. I added the configuration to the app.config, but never install the Entity Framework to the Unit Test Project. After installed, so far so good.
37,260,473
I have published my WCF project onto a server, i have also published an MVC application onto the same box which consumes the WCF services. When trying login on my MVC application, this uses a wcf service, but i get this exception on the browser, > > The Entity Framework provider type > 'System.Data.Entity.SqlServer.SqlProviderServices, > EntityFramework.SqlServer' registered in the application config file > for the ADO.NET provider with invariant name 'System.Data.SqlClient' > could not be loaded. Make sure that the assembly-qualified name is > used and that the assembly is available to the running application. > > > This is an entity framework exception, but i assume since my project already references EF in the dev environment, after deploying the service project, the DLLs should contain the EF reference also but I am not sure why I am getting this error. I can see this message because I turned on the `includeExceptionDetailInFaults="True"`
2016/05/16
[ "https://Stackoverflow.com/questions/37260473", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5351206/" ]
The easiest trick to resolve this issue is to add the following line inside one of the classes in your EF project: ``` public class Blablabla { private static string __hack = typeof(SqlProviderServices).ToString(); // other class members as they were before. } ``` This will force the build process to copy **EntityFramework.SqlServer.dll** to the `\bin` folder of any project that has references to the EF project. No need to install EF nuget package or make an explicit reference to EntityFramework.SqlServer.dll in any downstream project.
I also had a similar problem My problem was solved by doing the following: [![enter image description here](https://i.stack.imgur.com/fYdqE.png)](https://i.stack.imgur.com/fYdqE.png) [![enter image description here](https://i.stack.imgur.com/tPsC9.png)](https://i.stack.imgur.com/tPsC9.png)
37,260,473
I have published my WCF project onto a server, i have also published an MVC application onto the same box which consumes the WCF services. When trying login on my MVC application, this uses a wcf service, but i get this exception on the browser, > > The Entity Framework provider type > 'System.Data.Entity.SqlServer.SqlProviderServices, > EntityFramework.SqlServer' registered in the application config file > for the ADO.NET provider with invariant name 'System.Data.SqlClient' > could not be loaded. Make sure that the assembly-qualified name is > used and that the assembly is available to the running application. > > > This is an entity framework exception, but i assume since my project already references EF in the dev environment, after deploying the service project, the DLLs should contain the EF reference also but I am not sure why I am getting this error. I can see this message because I turned on the `includeExceptionDetailInFaults="True"`
2016/05/16
[ "https://Stackoverflow.com/questions/37260473", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5351206/" ]
I also had a similar problem My problem was solved by doing the following: [![enter image description here](https://i.stack.imgur.com/fYdqE.png)](https://i.stack.imgur.com/fYdqE.png) [![enter image description here](https://i.stack.imgur.com/tPsC9.png)](https://i.stack.imgur.com/tPsC9.png)
Maybe is something silly, but for future reference: In my case I was working with Unit Testing. I added the configuration to the app.config, but never install the Entity Framework to the Unit Test Project. After installed, so far so good.
37,260,473
I have published my WCF project onto a server, i have also published an MVC application onto the same box which consumes the WCF services. When trying login on my MVC application, this uses a wcf service, but i get this exception on the browser, > > The Entity Framework provider type > 'System.Data.Entity.SqlServer.SqlProviderServices, > EntityFramework.SqlServer' registered in the application config file > for the ADO.NET provider with invariant name 'System.Data.SqlClient' > could not be loaded. Make sure that the assembly-qualified name is > used and that the assembly is available to the running application. > > > This is an entity framework exception, but i assume since my project already references EF in the dev environment, after deploying the service project, the DLLs should contain the EF reference also but I am not sure why I am getting this error. I can see this message because I turned on the `includeExceptionDetailInFaults="True"`
2016/05/16
[ "https://Stackoverflow.com/questions/37260473", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5351206/" ]
The easiest trick to resolve this issue is to add the following line inside one of the classes in your EF project: ``` public class Blablabla { private static string __hack = typeof(SqlProviderServices).ToString(); // other class members as they were before. } ``` This will force the build process to copy **EntityFramework.SqlServer.dll** to the `\bin` folder of any project that has references to the EF project. No need to install EF nuget package or make an explicit reference to EntityFramework.SqlServer.dll in any downstream project.
Maybe is something silly, but for future reference: In my case I was working with Unit Testing. I added the configuration to the app.config, but never install the Entity Framework to the Unit Test Project. After installed, so far so good.
53,287
If I want to move the user view in Mac, I can do it by pressing `Alt` + `Shift` + `LeftMouseButton`. Note that I just have a trackpad, not a mouse. Anyway, the problem is that this way I can just move along two axes. To make this clear I took a video, which you can see [here](https://onedrive.live.com/redir?resid=768CF89E7CF13325!5476&authkey=!AMPdyrTLRKVm8zc&ithint=video%2Cmov). Like you see in the video I can only move just along the Y and Z axes, not along the X axis. If I wanted to move the user view in order to look at the back of the cube. I had first to rotate the camera and then move the visual again, which is doable but it's not fast/comfortable at all. I need a way (possibly a shortcut) to move the user view along the X axis.
2016/05/24
[ "https://blender.stackexchange.com/questions/53287", "https://blender.stackexchange.com", "https://blender.stackexchange.com/users/22491/" ]
You track forward/backward the same way that you scroll a web page. Often, a trackpad does this this with a two-finger drag up and down. Note, that even when this works correctly, it will still not allow you to view the back side of the cube. By default, it will track toward an invisible pivot point i the center of the view. As it approaches that point, the track will become slower and slower, so that you never go past that point. If you want to view the opposite side of you cube, you will have to rotate. But there is a setting that makes this a little easier. In User Preferences in the Interface tab, turn on "Rotate Around Selection." [![enter image description here](https://i.stack.imgur.com/kb2Me.png)](https://i.stack.imgur.com/kb2Me.png) This will force the view to orbit whatever object you have selected, instead of orbiting the center of the view. This will make it MUCH easier to just rotate around to the other side of an object. Check out the other options there, as many of them are very useful.
For this answer to work, you will need to enable something in the *User Preferences*. Go to *File > User Preferences... > Input* and check *Emulate Numpad* at the middle left, if it isn't already. From here, you can key `1`, `3`, or `7` to rotate the view around. From one of these rotated views, you can surely do what you've been doing, except this time along the *X-axis*. **Note that `Ctrl` + `1`, `3`, or `7` will rotate 180 degrees opposite plain `1`, `3`, or `7`.**
28,535,670
i have created an android application to download an image and save it to external directory but the application downloads the file and saves it to internal directory. this is my code ``` protected String doInBackground(String... aurl) { int count; try { File root = Environment.getExternalStorageDirectory(); File dir = new File(root.getAbsolutePath() + "/storage/extSdCard/prateek"); if(dir.exists() == false){ dir.mkdirs(); } URL url = new URL(aurl[0]); URLConnection conexion = url.openConnection(); conexion.connect(); int lenghtOfFile = conexion.getContentLength(); Log.d("ANDRO_ASYNC", "Lenght of file: " + lenghtOfFile); InputStream input = new BufferedInputStream(url.openStream()); // File SDCardRoot = Environment.getExternalStorageDirectory(); //create a new file, to save the downloaded file File file = new File(dir,"downloaded_file.png"); OutputStream output = new FileOutputStream(file); byte data[] = new byte[1024]; long total = 0; while ((count = input.read(data)) != -1) { total += count; publishProgress("" + (int) ((total * 100) / lenghtOfFile)); output.write(data, 0, count); } output.flush(); output.close(); input.close(); } catch (Exception e) { } return null; } ```
2015/02/16
[ "https://Stackoverflow.com/questions/28535670", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4570682/" ]
To make reduce a number by one, use the decrement operator. For example, ``` counter--; ``` would subtract one from the counter. If you want to subtract more than one, you can use the "-=" operator in the following manner: ``` counter -= 2; ``` So, in your code, in the final else if block, you could change the code to the following to reduce "counter" by 1. ``` else if (guess != answer) { counter--; System.out.println("You have " + count + " of guesses left"); } ``` But, in your code, you never declare the variable counter. Somewhere, most likely at the top of your code, you want to create this variable. To create an Integer variable you do the following: ``` int counter = 10; ``` You asked how to LOOP as well, so here it is. Read the comments to gain understanding of what the code does. If you have more questions, ask below. ``` public static void main(String[] args) { System.out.println("WELCOME TO GUESSING GAME BY JOSH!"); System.out.println("Rules: Player 1 picks number between 1 - 100 while Player 2 has 10 tries to guess"); Scanner josh = new Scanner(System.in); int guess = 0; // Create these variables up here to access them everywhere in "main" int counter = 0; boolean continueTheGame = true; // A boolean variable that holds ONLY either true or false System.out.println("Enter name here PLAYER 1: "); String p1 = josh.nextLine(); System.out.println("Enter name here PLAYER 2: "); String p2 = josh.nextLine(); System.out.println("Ok, " + p2 + " look away. " + p1 + ", Please enter a number and press enter:"); int answer = josh.nextInt(); // A while loop will continue as long as a boolean expression is true. // So, we create a boolean variable somewhere above called "continueTheGame" // As long as this is true, the code INSIDE of the while loop's brackets will repeat. // If the user has less than zero guesses left, we can set the variable to false, // which will make the loop stop! while (continueTheGame == true) { // The start of the while loop if (answer >= 100) { System.out.println("BUSTED! I said a number between 1 - 100!"); } else if (answer <= 100) { System.out.println("Guess in the space below."); guess = josh.nextInt(); } if (guess == answer) { System.out.println("CORRECT!!!!!"); } else if (guess != answer) { counter--; System.out.println("You have " + counter + " of guesses left"); if (counter > 0) { // If they have MORE than zero guesses left, loop again! continueTheGame = true; } else { // If they have zero guesses left, make it stop looping continueTheGame = false; } } } // Once the loop ends, the code will start again here, // because the bracket above is the final bracket of the WHILE loop } ```
Okay, so here is the full functional main method you are looking for: ``` public static void main(String[] args){ System.out.println("WELCOME TO GUESSING GAME BY JOSH!"); System.out.println("Rules: Player 1 picks number between 1 - 100 while Player 2 has 10 tries to guess"); Scanner josh = new Scanner(System.in); System.out.println("Enter name here PLAYER 1: "); String p1 = josh.nextLine(); System.out.println("Enter name here PLAYER 2: "); String p2 = josh.nextLine(); System.out.println("Ok, " + p2 + " look away. " + p1 + ", Please enter a number and press enter:"); int answer = josh.nextInt(); if (answer >= 100){ System.out.println("BUSTED! I said a number between 1 - 100!"); }else { System.out.println("Guess in the space below."); } for (int count = 10; count>=0; count--) { int guess = josh.nextInt(); if (guess == answer){ System.out.println("CORRECT!!!!!"); System.exit(0); } else { System.out.println("You have " + count + " of guesses left"); if (count == 0) { System.out.println("Sorry, you lost, no more tries.."); System.exit(0); } } } josh.close(); } ```
2,516,783
I'm trying to solve the problem below. > > $U$ and $W$ are subspaces of polynomials over $\mathbb{R}$. > > > $U = Span(t^3 + 4t^2 - t + 3, t^3 + 5t^2 + 5, 3t^3 + 10t^2 -5t + 5)$ > $W = Span(t^3 + 4t^2 + 6, t^3 + 2t^2 - t + 5, 2t^3 + 2t^2 -3t + 9)$ > > > What is $dim(U \cap W)$? > > > I have solved it using the fact that $dim(U) + dim(W) - dim(U \cap W) = dim(U \cup W)$, but was wondering how to solve it without using this fact. In order to find $dim(U \cap W)$, I first try and find $U \cap W$. Clearly if $v \in U \cap W$, then $$\alpha\_1(t^3 + 4t^2 - t + 3) +\alpha\_2(t^3 + 5t^2 + 5) +\alpha\_3(3t^3 + 10t^2 -5t + 5) = \beta\_1(t^3 + 4t^2 + 6) + \beta\_2(t^3 + 2t^2 - t + 5) + \beta\_3(2t^3 + 2t^2 -3t + 9)$$ for some $\alpha\_1, \alpha\_2, \alpha\_3, \beta\_1, \beta\_2, \beta\_3 \in \mathbb{R}$. Using this fact, you can reduce a system of linear equations to work out that: $\alpha\_1 + 5\alpha\_3 - \beta\_2 - 3\beta\_3 = 0$ $\alpha\_2 -2 \alpha\_3 + 2\beta\_2 + 6\beta\_3 = 0$ $\beta\_1 + 2\beta\_2 + 5\beta\_3 = 0$ But I don't know where to go from here. Any help would be greatly appreciated.
2017/11/12
[ "https://math.stackexchange.com/questions/2516783", "https://math.stackexchange.com", "https://math.stackexchange.com/users/381394/" ]
Consider a polynomial $p(t)=at^{3}+bt^{2}+ct+d$ belonging to $U$ and $V$ at the same time and solve two separated systems to find the conditions for $p(t)$ to be in $U$ and beside find the coditions for $p(t)$ to be in $V$ and once you find those two list of conditions consider a system on the unkowns $a,b,c$. $$p(t)=\alpha\_1(t^3 + 4t^2 - t + 3) +\alpha\_2(t^3 + 5t^2 + 5) +\alpha\_3(3t^3 + 10t^2 -5t + 5)$$ $$ p(t)=\beta\_1(t^3 + 4t^2 + 6) + \beta\_2(t^3 + 2t^2 - t + 5) + \beta\_3(2t^3 + 2t^2 -3t + 9)$$ then $$at^{3}+bt^{2}+ct+d=\alpha\_1(t^3 + 4t^2 - t + 3) +\alpha\_2(t^3 + 5t^2 + 5) +\alpha\_3(3t^3 + 10t^2 -5t + 5)$$ $$at^{3}+bt^{2}+ct+d=\beta\_1(t^3 + 4t^2 + 6) + \beta\_2(t^3 + 2t^2 - t + 5) + \beta\_3(2t^3 + 2t^2 -3t + 9)$$ this implies that For $U$ you need to find the conditions on $a,b$ and $c$ for the following system to have solution: $$at^{3}+bt^{2}+ct+d=\alpha\_1(t^3 + 4t^2 - t + 3) +\alpha\_2(t^3 + 5t^2 + 5) +\alpha\_3(3t^3 + 10t^2 -5t + 5)$$ $$A\_{U}=\left(\begin{array}{ccc|c} 1&1&3&a\\ 4&5&10&b\\ -1&0&-5&c\\ 3&5&5&d \end{array}\right)$$ For $V$ you need to find the conditions on $a,b$ and $c$ for the following system to have solution: $$at^{3}+bt^{2}+ct+d=\beta\_1(t^3 + 4t^2 + 6) + \beta\_2(t^3 + 2t^2 - t + 5) + \beta\_3(2t^3 + 2t^2 -3t + 9)$$ $$A\_{V}=\left(\begin{array}{ccc|c} 1&1&2&a\\ 4&2&2&b\\ 0&-1&-3&c\\ 6&5&9&d \end{array}\right)$$ ***The row reduced echelon form of $A\_{U}$ will give you the conditions for a polynomial to be in $U$. The same for $A\_{V}$. These conditions are linear equations in $a,b,c$ that you can put in a linear system of equations in the variables $a,b,c$ to finally find the conditions for $p(t)$ to be in the intersection of $U$ and $V$.***
Consider the matrix: \begin{bmatrix} 1 & 4 & -1 & 3 \\ 1 & 5 & 0 & 5 \\ 3 & 10 & -5 & 5 \\ 1 & 4 & 0 & 6 \\ 2 & 2 & -3 & 9 \\ \end{bmatrix} Row reduce the matrix to its Row reduced echelon form to get the basis of $U + W = \text{Span}\{v\_1,v\_2,v\_3,v\_4,v\_5,v\_6 \}$. Then use the formula: $$\dim(U + W) = \dim(U) + \dim(W) - \dim(U \cap W)$$
243,533
What to do when someone wants to show his flair/rep and at the same time do not want his identity to be known? I thought for a second for an intermediate site to produce a certified/anonymous flair.
2014/11/13
[ "https://meta.stackexchange.com/questions/243533", "https://meta.stackexchange.com", "https://meta.stackexchange.com/users/275154/" ]
Flair is not some secure proof of your rep. It's a picture. Anyone can get anyone's flair. The only way to gain real world benefit from your SE activities is to make a connection between the two, such as telling people "I am [username] on StackExchange." If you're not willing to do that, then you can't gain a real world benefit from what [username] has done. As a thought experiment, let's say SE came up with a way for you to prove that you own an account with Xk rep where X is a multiple of 10, along with dozens of badges. What problem would it solve or what purpose would it serve? None. Even for the simple case of SO, surely I care what tags you earned that rep in, and whether your earned it from asking or answering. Surely I want to look at a handful of your answers to see whether you're a good writer, good example-inventor, good explainer, or just write clever code. Hearing that someone has 20k rep doesn't really tell you much if you don't know which of the 20k rep users they are. (Yes, there are some counter examples. Once you make the first page or two of all time users on a site, it can be argued you know your way around the entire subject matter of that site pretty well. But such people can just state "my [site].stackexchange.com account is in the top 100 out of a million users for reputation" and don't need some automated certified anonymous flairy thing - they can just type the sentence.) I would recommend you connect your SE identity to your real world identity in some way, such as linking to your SE accounts from your blog. If it's important to stay totally anonymous on SE, then I recommend you abandon a plan to gain real world benefit from the numerical rep and the more nebulous "reputation and impression" you've built up here. Also, I think you're overestimating the value of "proof". In an interview, on a resume, in a cover letter, or on a social media profile, you can tell people that you keep up to date in your field by reading blogs (and naming 3 or 4 high profile bloggers you claim to read) or by taking courses, and naming a course provider such as Pluralsight. You can claim to have founded a user group or attended a conference. People don't ask you to attach some sort of digital proof of these activities. Similarly you can say you're active on [site] and have rep of over [whatever] and they are unlikely to ask for proof. Sure, you may get tripped up by an interviewer who asks "did you take [specific course]?" and knows it well (for example I once asked this about a course I wrote and delivered at Pluralsight) and can tell from your answer and reaction that you actually didn't take it. The SE equivalent might be asking if you're enjoying a particular review queue that you in fact don't have access to yet at the claimed rep. Being able to answer these questions correctly, because you do have the rep and you are that active, will be better than any kind of digital proof that some unknown account has a particular rep and badge count.
Like the commenters, I'm not sure I see the purpose of this. It sounds like you want to hold some anonymized badge that proves you to have millions and billions (or so) of rep points on one or several SE sites, but how would that even prove anything? **[![profile for Xline at Meta Stack Exchange, Q&A for meta-discussion of the Stack Exchange family of Q&A websites](https://meta.stackexchange.com/users/flair/275154.png "profile for Xline at Meta Stack Exchange, Q&A for meta-discussion of the Stack Exchange family of Q&A websites")](https://meta.stackexchange.com/users/275154)** There's your flair. I could pass that off to an employer/viewer as being my own. All anonymization aside, this doesn't count as proof of anything. If it were to be anonymized, that would simply make it less reliable. I could post Jon Skeet's with the name redacted and claim it my own. On top of those challenges, I'd wonder why you even want to do this. We tend to put a lot of (okay, maybe not *a lot*) weight on rep points 'round these parts, but most people in the real world probably don't. You'd be much better to advertise the content you've put on various sites, than just the fact that people appreciated you for it. And anonymizing it would take even more away from that.
70,030,106
I want to show from UserController how many products the User used and user information. I have created two `Resources` for it. SO I search him using `$id` Here is My `UserController` code ``` public function show($id) { // $user = User::find($id); if (is_null($user)) { return response()->json([ 'message' => 'User Not Found', 'status' => 404 ], 404); } $products = Product::where('user_id', $user->id)->get(); return response()->json([ 'data' => new UserProductResource($products), 'status' => 200 ], 200); } ``` And here is my `UserProductResource` ``` <?php namespace App\Http\Resources; use App\Http\Resources\ProductResource; use Illuminate\Http\Resources\Json\JsonResource; class UserProductResource extends JsonResource { public function toArray($request) { return [ 'id' => $this->id, 'first_name' => $this->first_name, 'last_name' => $this->last_name, 'profile_img' => $this->profile_img, 'products' => ProductResource::make($this->products), ]; } } ``` And The error is [![enter image description here](https://i.stack.imgur.com/dFDKP.png)](https://i.stack.imgur.com/dFDKP.png) My Route is: ``` Route::get('/show-product/{id}', [UserController::class, 'showProduct']); ```
2021/11/19
[ "https://Stackoverflow.com/questions/70030106", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16432482/" ]
You have an issue with ref declaration between react hook refs which its assigned to the same input, you need to create ref but without using already assigned ref to another input. The trick here to resolve issue: ``` const dopMReg = register("dobMonth"); const dopYReg = register("dobYear"); ``` for example: ``` import React, { useRef } from "react"; import { useForm } from "react-hook-form"; export default function App() { const { register, handleSubmit } = useForm(); const dobMonthInput = useRef(null); const dobYearInput = useRef(null); const onSubmit = (data) => { console.log(data); dobMonthInput.current.focus(); } const dopMReg = register("dobMonth"); const dopYReg = register("dobYear"); return ( <form onSubmit={handleSubmit(onSubmit)}> <input name="dobMonth" type="text" {...dopMReg} ref={(e) => { dopMReg.ref(e); dobMonthInput.current = e; }} /> <input name="dobYear" type="text" {...dopYReg} ref={(e) => { dopYReg.ref(e); dobYearInput.current = e; }} /> <button>Submit</button> </form> ); } ``` and this the [demo url](https://codesandbox.io/s/priceless-keldysh-uymsd)
you can use like this too: ``` const dobYearInput = useRef(null) const { register } = useForm() const { ref:refDobMonth, ...restDobMonth } = register('dobMonth', { required: true, validate: (value) => validateDate(value, getValues), onChange: (e) => onChange(e), }) const { ref:refDobYear, ...restDobYear } = register('dobYear', { required: true, validate: (value) => validateDate(value, getValues), onChange: (e) => onChange(e), }) ```
22,339
In a discussion on the history of Ethernet and 10BASE5, Stefan Skoglund commented [Was 10BASE5 a mistake?](https://retrocomputing.stackexchange.com/questions/22246/was-10base5-a-mistake?noredirect=1#comment73425_22246) > > One reason why 10BaseT became possible is Moores law (and the same for the other designs after that.) The designer's chip budget was only good enough for this. > > > This is an interesting remark that I think is worth expanding on. Does it take more sophisticated electronics to drive Ethernet over twisted pair than coaxial? If so, is there a way to quantify that? What's the reason for the greater difficulty? What sort of transistor count is needed? Ethernet ran at ten megabits per second, which was an *extremely* aggressive speed for the seventies, and even for the eighties. (I remember around 1990, seeing a 286 PC read data faster from a server, over 10Mb Ethernet, than from its own local hard disk – in other words, 1970s Ethernet speed was arguably still overkill in 1990.) Given that RS-232 was running fine over twisted pair since the sixties, presumably whatever difficulty there was, was not so much 'difficulty of communicating over twisted pair' as 'difficulty of communicating over twisted pair and still maintaining signal integrity *at ten megabits per second*'?
2021/11/20
[ "https://retrocomputing.stackexchange.com/questions/22339", "https://retrocomputing.stackexchange.com", "https://retrocomputing.stackexchange.com/users/4274/" ]
I designed a 10BASET ethernet chip (codename ENZO used in Sage MainLAN <https://archive.org/details/byte-magazine-1991-01-rescan/page/n67/mode/2up?q=sage+mainlan>) and produced a proposed design for a 10BASET hub. In electronics terms 10BASET is simpler, a pair of resistors for pulse shaping the output externally, a transformer for isolation and for the input side I have now forgottem I'd guess some sort of op-amp. There is a little more stuff required inside the ethernet chip set to generate link test pulses and the pulse shaping signal, but we did save having to have DC<->DC converters for the MAU and the 8392 for 10BASE2.
The per-port electronics in the network card is very similar, no matter whether you use 10base2 or 10baseT. AUI is slightly simpler on the network card, as a part of the electronics is not in the card, but in the MAU. The primary difference between coax and TP is that TP needs a hub or a switch, which is an additional electronic device and includes a second transceiver per participating machine in the hub (or switch), whereas the coax cable is a completely passive device. The success of 10baseT started coming in when hubs got cheap enough that the advantage of being able to drop single misbehaving stations or broken cables outweighted the installation costs.
22,339
In a discussion on the history of Ethernet and 10BASE5, Stefan Skoglund commented [Was 10BASE5 a mistake?](https://retrocomputing.stackexchange.com/questions/22246/was-10base5-a-mistake?noredirect=1#comment73425_22246) > > One reason why 10BaseT became possible is Moores law (and the same for the other designs after that.) The designer's chip budget was only good enough for this. > > > This is an interesting remark that I think is worth expanding on. Does it take more sophisticated electronics to drive Ethernet over twisted pair than coaxial? If so, is there a way to quantify that? What's the reason for the greater difficulty? What sort of transistor count is needed? Ethernet ran at ten megabits per second, which was an *extremely* aggressive speed for the seventies, and even for the eighties. (I remember around 1990, seeing a 286 PC read data faster from a server, over 10Mb Ethernet, than from its own local hard disk – in other words, 1970s Ethernet speed was arguably still overkill in 1990.) Given that RS-232 was running fine over twisted pair since the sixties, presumably whatever difficulty there was, was not so much 'difficulty of communicating over twisted pair' as 'difficulty of communicating over twisted pair and still maintaining signal integrity *at ten megabits per second*'?
2021/11/20
[ "https://retrocomputing.stackexchange.com/questions/22339", "https://retrocomputing.stackexchange.com", "https://retrocomputing.stackexchange.com/users/4274/" ]
I designed a 10BASET ethernet chip (codename ENZO used in Sage MainLAN <https://archive.org/details/byte-magazine-1991-01-rescan/page/n67/mode/2up?q=sage+mainlan>) and produced a proposed design for a 10BASET hub. In electronics terms 10BASET is simpler, a pair of resistors for pulse shaping the output externally, a transformer for isolation and for the input side I have now forgottem I'd guess some sort of op-amp. There is a little more stuff required inside the ethernet chip set to generate link test pulses and the pulse shaping signal, but we did save having to have DC<->DC converters for the MAU and the 8392 for 10BASE2.
Your question seems to ignore the topology of a network completely: If you want to connect, say 20 computers via Thickwire or BNC, you need: * A length of the chosen cabling * 20 MAUs if you want Thickwire * Some cheap termination resistors That is: No active electronics except the MAUs (which you could consider part of the computer's Ethernet card) If you wanted to do the same with 10base-T you needed: * Roughly 25 pieces of 10-base-T wiring * At least 5 four-port hubs (or one single 20-port hub which was a really expensive beast) The point is: You didn't need more *sophisticated* electronics for 10BT, but you needed *more* of it. 10BT wants active devices at each branching point, coax doesn't.
4,559,837
I have built a model that extends Zend\_Db\_Table\_Abstract and I can't figure out why I can't use createRow(); here is my code: ``` class Model_User extends Zend_Db_Table_Abstract { public function createUser() { $row = $this->createRow(); $row->name = 'test'; $row->save(); } } ``` and in a controller I use: ``` $userModel = new Model_User(); $userModel->createUser(); ``` which when run displays an error > > An error occurred > > > Application error > > > here is my setup in application.ini ``` resources.db.adapter = "pdo_mysql" resources.db.params.host = "localhost" resources.db.params.username = "root" resources.db.params.password = "pass" resources.db.params.dbname = "app_db" resources.db.isDefaultTableAdapter = true ``` I am sure that my user/pass/dbname is correct. I would appreciate it if you point me in the right direction.
2010/12/30
[ "https://Stackoverflow.com/questions/4559837", "https://Stackoverflow.com", "https://Stackoverflow.com/users/306703/" ]
Possible answers: 1. You forgot to call `Stream.close()` or `Stream.Dispose()`. 2. Your code is messing up text and and other kinds of data (e.g. casting a `-1` from a `Read()` method into a `char`, then writing it. We need to see your code though...
**Size on disk** vs **Size** First of all you should note that the *Size on disk* is almost always different from the *Size* value because the *Size on disk* value reflects the allocated drive storage but the *Size* reflects the actual length of the file. A disk drive splits its space into blocks of the same size. For example, if your drive works with 4KB blocks then even the smallest file containing a single byte will still take up 4KB on the disk, as that is the minimum space it can allocate. Once you write out the 4KB + 1 byte it will then allocate another 4KB block of storage, thus making it 8KB on disk. Hence the *Size on disk* is always a multiple of 4KB. So the fact the source and destination files have the same *Size on disk* does not mean the files are the same length. (Different drives have different blocks sizes, it is not always 4KB). The *Size* value is the actual defined length of the file data within the disk blocks. **Your Size Issue** As your *Size* values are different it means that the operating system has saved different lengths of data. Hence you have a fundamental problem with your copying routine and not just an issue with the last byte as you think at the moment. One of your files is 3,434 bytes and the other 2,008 which is a big difference. Your first step must be to work out why you have such a big difference. If your hex comparing routine is simply looking at the block data then it will think they are the same length as it is comparing disk blocks rather than actual file length.
4,139,384
I have a simple form: ``` <form id="radio_form"> <fieldset> <label><input type="radio" name="color" value="1" />Red</label><br /> <label><input type="radio" name="color" value="2" />Yellow</label><br /> <label><input type="radio" name="color" value="3" />Blue</label><br /> <label><input type="radio" name="color" value="4" />Purple</label><br /> </fieldset> <fieldset> <label><input type="radio" name="time" value="6" />12</label><br /> <label><input type="radio" name="time" value="7" />11</label><br /> <label><input type="radio" name="time" value="8" />10</label><br /> <label><input type="radio" name="time" value="9" />9</label><br /> </fieldset> </form> ``` I'm trying to pass both selected values as a sum to the .result unfortunately .result is showing only values from first input[color]. How can i grab results from both: input[color] and input[time]? This is my function: ``` $(function(){ var value = $('input:radio:checked').val(); $('.result').html(value) }); ``` Many thanks for help in advance. Dom
2010/11/09
[ "https://Stackoverflow.com/questions/4139384", "https://Stackoverflow.com", "https://Stackoverflow.com/users/177435/" ]
Like most of jQuery's getter overloads, `val()` returns only the first item's value. You could use *map()* and join the resulting array: ``` $(function() { var value = $('input:radio:checked').map(function() { return this.value; }).get().join(" "); // You could join with a comma if you like $('.result').text(value); // Use text() unless you're adding HTML }); ``` --- Ahh, it appears you're after a running total. In that case, you'll need *each()* instead: ``` $(function() { var value = 0; $('input:radio:checked').each(function() { value += +this.value; }); $('.result').text(value); // Use text() unless you're adding HTML }); ``` `+this.value` in the code above coerces the value to a number.
``` $(function(){ $(".result").html(""); // clear result $("input:radio:checked").each(function() { $(".result").append($(this).val()); // append value of each matched selector }); }); ```
159,671
Suppose I participate in a basketball game with my friends. I do not play as well as usual. Can I explain to them: > > Sorry, I am not in the good state > > > Will the audience naturally take it to mean that now I am not in the good state in which I can play basketball well? Does it make sense to say that I can be in several possible states, in some of them I can play well in others play badly?
2014/03/25
[ "https://english.stackexchange.com/questions/159671", "https://english.stackexchange.com", "https://english.stackexchange.com/users/51369/" ]
> > The moon shone on his face as he spoke, and the girl was pleased to watch it, it seemed to breathe such an innocent and old-world kindness of disposition, yet with something high too, as of a well-founded self-content. > > > This is a complicated sentence but we can remove a few of the clauses in order to get at "as of" more directly: > > The moon shone on his face as he spoke [and] it seemed to breathe such an innocent and old-world kindness of disposition, yet with something high too, as of a well-founded self-content. > > > It seemed to breathe such an innocent and old-world kindness of disposition, yet with something high too, as of a well-founded self-content. > > > It seemed to breathe such a kindness of disposition, yet with something high too, as of a well-founded self-content. > > > Whether we can trim out "yet with something high too" is debatable so we'll leave it in. "It" in this sentence could be either "the moon" or "his face" but you would need more context from the story to know exactly which it was. Fortunately, we don't need these details to understand "as of". Rewording and rearranging lets us avoid the commas: > > It seemed to breathe a [disposition that was kind], yet with something high too, as of a well-founded self-content. > > > It seemed to breathe a disposition that was kind [and was with something high], as of a well-founded self-content. > > > It seemed to breathe a disposition that was kind and was with something high, as of a well-founded self-content. > > > Therefore, "as of" means either (1) "similar to" or (2) "like it was coming from": > > 1. It seemed to breathe a disposition that was kind and was with something high, [similar to] a well-founded self-content. > 2. It seemed to breathe a disposition that was kind and was with something high, [like it was coming from] a well-founded self-content. > > > Based on the little context we have been provided, I would guess that (2) is most likely and a possible rewording: > > His disposition was kind, yet with something high, and suggested that he possessed a well-founded self-content. > > >
Mr Jekyll and Dr Hyde. Good one. "As" always means "similar to," like," etc. here, the object of "as" is "something high," which is modifying "it," which stands for his face on both occurrences. The something high here is indicated to have a quality quite like a well-founded self-content. Now, the question is why "of"? As itself would give the same meaning, wouldn't it? It would not quite the meaning intended by Stevenson here. Here, "something high" not exactly like "well-founded self-content", but it has a quality similar to "well-founded self-content's quality. Well, it's difficult to put the meaning in words here. One note: Modern grammar wants us to separate "it seemed to breath..." part as a separate sentence or after a semicolon.
159,671
Suppose I participate in a basketball game with my friends. I do not play as well as usual. Can I explain to them: > > Sorry, I am not in the good state > > > Will the audience naturally take it to mean that now I am not in the good state in which I can play basketball well? Does it make sense to say that I can be in several possible states, in some of them I can play well in others play badly?
2014/03/25
[ "https://english.stackexchange.com/questions/159671", "https://english.stackexchange.com", "https://english.stackexchange.com/users/51369/" ]
> > The moon shone on his face as he spoke, and the girl was pleased to watch it, it seemed to breathe such an innocent and old-world kindness of disposition, yet with something high too, as of a well-founded self-content. > > > This is a complicated sentence but we can remove a few of the clauses in order to get at "as of" more directly: > > The moon shone on his face as he spoke [and] it seemed to breathe such an innocent and old-world kindness of disposition, yet with something high too, as of a well-founded self-content. > > > It seemed to breathe such an innocent and old-world kindness of disposition, yet with something high too, as of a well-founded self-content. > > > It seemed to breathe such a kindness of disposition, yet with something high too, as of a well-founded self-content. > > > Whether we can trim out "yet with something high too" is debatable so we'll leave it in. "It" in this sentence could be either "the moon" or "his face" but you would need more context from the story to know exactly which it was. Fortunately, we don't need these details to understand "as of". Rewording and rearranging lets us avoid the commas: > > It seemed to breathe a [disposition that was kind], yet with something high too, as of a well-founded self-content. > > > It seemed to breathe a disposition that was kind [and was with something high], as of a well-founded self-content. > > > It seemed to breathe a disposition that was kind and was with something high, as of a well-founded self-content. > > > Therefore, "as of" means either (1) "similar to" or (2) "like it was coming from": > > 1. It seemed to breathe a disposition that was kind and was with something high, [similar to] a well-founded self-content. > 2. It seemed to breathe a disposition that was kind and was with something high, [like it was coming from] a well-founded self-content. > > > Based on the little context we have been provided, I would guess that (2) is most likely and a possible rewording: > > His disposition was kind, yet with something high, and suggested that he possessed a well-founded self-content. > > >
Looking at [dictionary.com](http://dictionary.reference.com/browse/of) we see two useful definitions: > > 1. (used to indicate derivation, origin, or source): a man of good family; the plays of Shakespeare; a piece of cake. > 2. (used to indicate cause, motive, occasion, or reason): to die of hunger. > > > Whether you interpret *of a well-founded self-content* here as 2. or 3. - the essence remains the same: The **something high** seems to originate in a well-founded self-content, or is caused by the same. *Of* simply means *coming from* or *caused by* here. So whatever that *something high* was that seemed to be in his face, it was **as** if it came **from** a well-founded self-content.
33,788,127
I'm subscribed to an issue in JIRA. Whenever someone comments on it, or changes a comment of his, I get an email. Often this results in multiple consecutive emails, when people enter a comment, and then refine it multiple times. I'd like to tell JIRA to wait after a new comment before sending me the notification mail, which should then include all modifications to it by the time. Is this possible? *I know this question might be better off at superuser, but the jira tag here seems by far more frequented.*
2015/11/18
[ "https://Stackoverflow.com/questions/33788127", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4636660/" ]
The reason is that you add your authentication provider twice, one time in `configure(HttpSecurity)` and one time in `configure(AuthenticationManagerBuilder)`. This will create a `ProviderManager` with two items, both being your provider. When authentication is processed, the providers will be asked in order until a success is made, *unless* a `LockedException` or similar status exception is thrown, then the loop will break.
There may be a situtation which you don't override `configure(AuthenticationManagerBuilder)` and still same `AuthenticationProver`'s `authenticate` method gets called twice like Phil mentioned in his comment in the accepted answer. Why is that? The reason is that when you don't override `configure(AuthenticationManagerBuilder)` and have an `AuthenticationProvider` bean, it will be registered by Spring Security, you don't have to do anything else. However, when `configure(AuthenticationManagerBuilder)` overridden, Spring Security will invoke it and won't try to register any provider by itself. If you're curious, you can take a look the [related method](https://github.com/spring-projects/spring-security/blob/master/config/src/main/java/org/springframework/security/config/annotation/web/configuration/WebSecurityConfigurerAdapter.java#L263). `disableLocalConfigureAuthenticationBldr` is true if you override `configure(AuthenticationManagerBuilder)`. So, briefly, if you want to register just one custom `AuthenticationProvider` then do not override `configure(AuthenticationManagerBuilder)`, do not call `authenticationProvider(AuthenticationProvider)` in `configure(HttpSecurity)`, just make your `AuthenticationProviver` implementation bean by annotating `@Component` and you're good to go.
60,917,678
I was trying to run a Python script from the linux terminal at AWS Ligthsail without success. ``` I tried multiple options and still can't get it to run: * * * * * /usr/bin/python3 path/to/my/script.py and within the .py script #/usr/bin/python3 I also tried: * * * * * /usr/bin/python3 path/to/my && ./script.py ```
2020/03/29
[ "https://Stackoverflow.com/questions/60917678", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7635726/" ]
I think the problem is in your cron schedule expression, it should be five stars `*`, like `* * * * *` to be excuted every minute , but in your example you are using just four stars which is wrong . in cron expressions each line has five time-and-date fields followed by a username (if this is the system crontab file), and followed by a command. The time and date fields are: 1. minute : 0-59 2. hour : 0-23 3. day of month : 1-31 4. month : 1-12 (or names) 5. day of week : 0-7 (0 or 7 is Sunday, or use names) you can read more [here](http://man7.org/linux/man-pages/man5/crontab.5.html) , and you can use this [website](https://crontab.guru/) to generate and experience with crontab schedule expressions . **So** you may need to update your cron schedule expression : ``` * * * * * /usr/bin/python3 path/to/my/script.py ```
When putting the result of the cron I could see that in the .py I had to specify a path. Now it works! ``` * * * * * sudo /usr/bin/python3 path/to/my/script.py >> path/to/my/script.py/out.txt 2>&1 ```
32,408,391
I am trying to have the code print out the highest of the three grades; however, the if/else statement in the highest method is finding an error in return d. I have tried putting if(d>b && d>c) return d, and also else return d. But both times the program says it is unreachable. Can someone explain what I'm doing wrong? Thank you! ``` import java.util.Scanner; public class Methods2 { public static double average(double a){ double ave= a/3.0; return ave; } public static double highest(double b, double c, double d){ if(b>c && b>d) return b; if(c>b && c>d); return c; return d;//unreachable code } public static void main(String[] args){ Scanner kb= new Scanner(System.in); System.out.println("Enter your name."); String name = kb.nextLine(); System.out.println("Enter your three grades."); double b= kb.nextDouble(); double c= kb.nextDouble(); double d= kb.nextDouble(); double av= average(b+c+d); System.out.println(av); double high= highest(b,c,d); System.out.println(high); } } ```
2015/09/05
[ "https://Stackoverflow.com/questions/32408391", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5302568/" ]
Yes. Because semicolon makes it an empty `if` body. ``` if(c>b && c>d); return c; ``` should be ``` if(c>b && c>d) return c; ``` or (the arguably better) ``` if(c>b && c>d) { return c; } ``` You could also use [`Math.max(double, double)`](https://docs.oracle.com/javase/7/docs/api/java/lang/Math.html#max%28double,%20double%29) to make this a one line method like ``` public static double highest(double b, double c, double d) { return Math.max(d, Math.max(b, c)); } ```
because of the semicolon in the second if ``` if(c>b && c>d); ``` That terminates the conditional statement right there and `return c;` becomes a statement that will get executed regardless of condition, remove it
12,653,237
We've started using the DevExpress MVC controls, which requires this code added in our Site.Master: ``` <% Html.DevExpress().RenderScripts(Page, new Script { ExtensionSuite = ExtensionSuite.GridView }, new Script { ExtensionSuite = ExtensionSuite.HtmlEditor }, new Script { ExtensionSuite = ExtensionSuite.Editors }, new Script { ExtensionSuite = ExtensionSuite.NavigationAndLayout }, new Script { ExtensionSuite = ExtensionSuite.Chart }, new Script { ExtensionSuite = ExtensionSuite.Report } ); %> ``` But this renders a massive 2mb javascript file through a handler called DXR.axd. When using Firefox this javascript is too large and increases the page's onload time from ~500 ms to ~5,000 ms (I timed it before and after). Using Chrome it loads in ~750ms This is a severe performance hit and causes a very noticeable pause when the page is rendering. Firefox reports that the DOMContentLoaded event takes 5 seconds to fire (because it takes so long to load and parse that 2mb of javascript) What can I do to fix this problem? I note that their own site <http://mvc.devexpress.com> has the exact same problem: if you view source and look for "DXR.axd" then download that file it is even bigger, at 2.6mb, and they also have a very slow onload in Firefox
2012/09/29
[ "https://Stackoverflow.com/questions/12653237", "https://Stackoverflow.com", "https://Stackoverflow.com/users/325727/" ]
I suppose they create a dynamic js file instead of using static js file just to avoide people might copy their js files. However there are other controls on the market without this problem. If you need a specific control that you can find just there...well you have to survive wuth this problem...otherwise change for another control suite. However, consider that more the controls are "out of the box" and ready fo the use with just a few code to be written, more your performance...go down, because each control takes with it several feature that you actually dont need.
I don't know how to fix it, but I have been working with DX components for more than a year in my current project so just want to tell you one thing: it's 3rd party component so you have to live with it, no other way. The components in my project also generate tons of scripts, and I personally think that you should only use it to solve a specific problem (pivotgrid in our case), and poor performance is a trade-off. I myself found several bugs in their components, some of them are low level implementation and they cannot fix it willy-nilly, at least for now.
20,706,534
I found a library which allows an app to wrap text around an image - however once implemented it changed the size of my text - how can the text size be increase when using this library? `android:textSize=` has no impact on the text size. Neither does: ``` FlowTextView titleTv = (FlowTextView) findViewById(R.id.titleTv); ((FlowTextView) findViewById(R.id.titleTv)).setTextSize(20); ``` <https://code.google.com/p/android-flowtextview/> **Example:** ``` <com.pagesuite.flowtext.FlowTextView android:id="@+id/titleTv" android:layout_width="fill_parent" android:layout_height="wrap_content" android:paddingLeft="5dp" android:text="" android:textSize="20sp" > ```
2013/12/20
[ "https://Stackoverflow.com/questions/20706534", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3113035/" ]
In the short term a call to invalidate will probably get it working: ``` FlowTextView titleTv = (FlowTextView) findViewById(R.id.titleTv); titleTv.setTextSize(20); titleTv.invalidate(); ``` However, I suspect you are using the JAR file right? It is quite out of date so I would recommend checking the source code out and using it as an android library project - setTextSize() should work properly then without needing a call to invalidate() (plus various other bug fixes etc). Also - I never added the ability to set the text size via XML - wouldn't be too hard to add this though.
I checked the code of `android-flowtextview` and they have the text size **hardcoded** (check line 131 **[here](https://code.google.com/p/android-flowtextview/source/browse/trunk/src/com/pagesuite/flowtext/FlowTextView.java)**). You have to change their source code or use the public method `setTextSize(int)`. Also, **[this link](https://code.google.com/p/android-flowtextview/issues/detail?id=7)** might help you, as seems that someone already did something as you are trying to do.
20,706,534
I found a library which allows an app to wrap text around an image - however once implemented it changed the size of my text - how can the text size be increase when using this library? `android:textSize=` has no impact on the text size. Neither does: ``` FlowTextView titleTv = (FlowTextView) findViewById(R.id.titleTv); ((FlowTextView) findViewById(R.id.titleTv)).setTextSize(20); ``` <https://code.google.com/p/android-flowtextview/> **Example:** ``` <com.pagesuite.flowtext.FlowTextView android:id="@+id/titleTv" android:layout_width="fill_parent" android:layout_height="wrap_content" android:paddingLeft="5dp" android:text="" android:textSize="20sp" > ```
2013/12/20
[ "https://Stackoverflow.com/questions/20706534", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3113035/" ]
In the short term a call to invalidate will probably get it working: ``` FlowTextView titleTv = (FlowTextView) findViewById(R.id.titleTv); titleTv.setTextSize(20); titleTv.invalidate(); ``` However, I suspect you are using the JAR file right? It is quite out of date so I would recommend checking the source code out and using it as an android library project - setTextSize() should work properly then without needing a call to invalidate() (plus various other bug fixes etc). Also - I never added the ability to set the text size via XML - wouldn't be too hard to add this though.
<https://code.google.com/p/android-flowtextview/source/browse/trunk/src/com/pagesuite/flowtext/FlowTextView.java> There's a 'setTextSize(int)' method that should do exactly what you're looking for. If you want to set it from XML, it's a little more involved. Since FlowTextView's constructors ignore the AttributeSet that gets passed in, you'll have to code this yourself. Follow guides like this: <http://kotikan.com/blog/posts/2012/09/android-attributes> to figure out how to add custom attributes to your views.
4,629,776
Can a Foursquare checkin function be added onto a website?
2011/01/07
[ "https://Stackoverflow.com/questions/4629776", "https://Stackoverflow.com", "https://Stackoverflow.com/users/535585/" ]
Although you can provide check-in capability on a web site, please use caution and realize that it may be difficult to comply with the appropriate Foursquare API requirements. (Poster amelvin is correct that the API you need is at <http://developer.foursquare.com/>) However keep in mind: * You need to find an accurate representation of the user's lat/long in order to create a check-in with the API * You should not spoof the location * You may be dependent on using modern browser's location capabilities
Use the [foursquare api](http://developer.foursquare.com/) to add foursquare checkin to your site.
20,092,212
I am new to Web GIS mapping, I am interested to learn about WEB GIS and what are the skills needed. I Know Arcgis Desktop, FME, VBA, Microstation and Autocad. Please guide me.
2013/11/20
[ "https://Stackoverflow.com/questions/20092212", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3012320/" ]
As you are interested in ArcGIS, I would recommend you get familiar with the ArcGIS developer site: <https://developers.arcgis.com/en/documentation/>. In particular, I recommend the Javascript API documentation. The are also APIs for Silverlight and Flex but interest in these is dying out in favour of Javascript. Remember there are other web GIS systems than ArcGIS: e.g. Goolgle Maps API if you only need to work in Web Mercator and have more simple requirements. As already mentioned, you'll probably find more GIS specific advice on <https://gis.stackexchange.com/>.
Maybe first you should start using the internets ... and find even more help here: <https://gis.stackexchange.com/>
20,092,212
I am new to Web GIS mapping, I am interested to learn about WEB GIS and what are the skills needed. I Know Arcgis Desktop, FME, VBA, Microstation and Autocad. Please guide me.
2013/11/20
[ "https://Stackoverflow.com/questions/20092212", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3012320/" ]
Quite an open ended question but really depends what you want it for? Career wise lots of organisations use Arc Server, but lots of people are going open now and Mapserver, Geoserver and Mapnik are all technologies I would seriously look at. Learning about the OGC protocols is a good start, i.e WFS, WMS etc. Open layers and Leaflet and how they can consume data through WMS or WFS, and DB management - i.e. ensuring the data is in good shape and has adequate spatial indexes.
Maybe first you should start using the internets ... and find even more help here: <https://gis.stackexchange.com/>
20,092,212
I am new to Web GIS mapping, I am interested to learn about WEB GIS and what are the skills needed. I Know Arcgis Desktop, FME, VBA, Microstation and Autocad. Please guide me.
2013/11/20
[ "https://Stackoverflow.com/questions/20092212", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3012320/" ]
**BASIC** * Knowledge about web development (Client: HTML, JS, CSS/ Server: Python, NodeJS, etc.): you can learn from the various resources. * Knowledge about GIS data (2D GIS: Shapefile, GeoJSON, etc. | 3D GIS: CityGML, 3D Tiles, I3S) and where to get them (e.g. [Get data from OpenStreetMap](https://towardsdatascience.com/beginner-guide-to-download-the-openstreetmap-gis-data-24bbbba22a38)) * Software (ESRI Suites, QGIS, AutoCAD, etc.) **WEB GIS** * Knowledge to publish your GIS data as a web service: OGC Standards, ArcGIS Rest Service. There are two main types of web map services: Raster (WMS, TMS) or Feature (WFS, GeoJSON, VectorTiles) Example tool: ArcGIS Online, ArcGIS Server, GeoServer. * Knowledge to build web maps or WebGIS using web services. Example Web map libraries: [ArcGIS JS](https://developers.arcgis.com/javascript/latest/), [Mapbox](https://www.mapbox.com/), [Leaflet](https://leafletjs.com/), [OpenLayers](https://openlayers.org/). * Automation web map builder using ArcGIS Pro or [qgis2web](https://plugins.qgis.org/plugins/qgis2web/) * 2.5, 3D Web Visualization: [CesiumJS](https://cesium.com/platform/cesiumjs/), [Deck.gl](https://deck.gl/), etc.
Maybe first you should start using the internets ... and find even more help here: <https://gis.stackexchange.com/>
20,092,212
I am new to Web GIS mapping, I am interested to learn about WEB GIS and what are the skills needed. I Know Arcgis Desktop, FME, VBA, Microstation and Autocad. Please guide me.
2013/11/20
[ "https://Stackoverflow.com/questions/20092212", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3012320/" ]
As you are interested in ArcGIS, I would recommend you get familiar with the ArcGIS developer site: <https://developers.arcgis.com/en/documentation/>. In particular, I recommend the Javascript API documentation. The are also APIs for Silverlight and Flex but interest in these is dying out in favour of Javascript. Remember there are other web GIS systems than ArcGIS: e.g. Goolgle Maps API if you only need to work in Web Mercator and have more simple requirements. As already mentioned, you'll probably find more GIS specific advice on <https://gis.stackexchange.com/>.
Quite an open ended question but really depends what you want it for? Career wise lots of organisations use Arc Server, but lots of people are going open now and Mapserver, Geoserver and Mapnik are all technologies I would seriously look at. Learning about the OGC protocols is a good start, i.e WFS, WMS etc. Open layers and Leaflet and how they can consume data through WMS or WFS, and DB management - i.e. ensuring the data is in good shape and has adequate spatial indexes.
20,092,212
I am new to Web GIS mapping, I am interested to learn about WEB GIS and what are the skills needed. I Know Arcgis Desktop, FME, VBA, Microstation and Autocad. Please guide me.
2013/11/20
[ "https://Stackoverflow.com/questions/20092212", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3012320/" ]
As you are interested in ArcGIS, I would recommend you get familiar with the ArcGIS developer site: <https://developers.arcgis.com/en/documentation/>. In particular, I recommend the Javascript API documentation. The are also APIs for Silverlight and Flex but interest in these is dying out in favour of Javascript. Remember there are other web GIS systems than ArcGIS: e.g. Goolgle Maps API if you only need to work in Web Mercator and have more simple requirements. As already mentioned, you'll probably find more GIS specific advice on <https://gis.stackexchange.com/>.
**BASIC** * Knowledge about web development (Client: HTML, JS, CSS/ Server: Python, NodeJS, etc.): you can learn from the various resources. * Knowledge about GIS data (2D GIS: Shapefile, GeoJSON, etc. | 3D GIS: CityGML, 3D Tiles, I3S) and where to get them (e.g. [Get data from OpenStreetMap](https://towardsdatascience.com/beginner-guide-to-download-the-openstreetmap-gis-data-24bbbba22a38)) * Software (ESRI Suites, QGIS, AutoCAD, etc.) **WEB GIS** * Knowledge to publish your GIS data as a web service: OGC Standards, ArcGIS Rest Service. There are two main types of web map services: Raster (WMS, TMS) or Feature (WFS, GeoJSON, VectorTiles) Example tool: ArcGIS Online, ArcGIS Server, GeoServer. * Knowledge to build web maps or WebGIS using web services. Example Web map libraries: [ArcGIS JS](https://developers.arcgis.com/javascript/latest/), [Mapbox](https://www.mapbox.com/), [Leaflet](https://leafletjs.com/), [OpenLayers](https://openlayers.org/). * Automation web map builder using ArcGIS Pro or [qgis2web](https://plugins.qgis.org/plugins/qgis2web/) * 2.5, 3D Web Visualization: [CesiumJS](https://cesium.com/platform/cesiumjs/), [Deck.gl](https://deck.gl/), etc.
20,092,212
I am new to Web GIS mapping, I am interested to learn about WEB GIS and what are the skills needed. I Know Arcgis Desktop, FME, VBA, Microstation and Autocad. Please guide me.
2013/11/20
[ "https://Stackoverflow.com/questions/20092212", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3012320/" ]
As you are interested in ArcGIS, I would recommend you get familiar with the ArcGIS developer site: <https://developers.arcgis.com/en/documentation/>. In particular, I recommend the Javascript API documentation. The are also APIs for Silverlight and Flex but interest in these is dying out in favour of Javascript. Remember there are other web GIS systems than ArcGIS: e.g. Goolgle Maps API if you only need to work in Web Mercator and have more simple requirements. As already mentioned, you'll probably find more GIS specific advice on <https://gis.stackexchange.com/>.
if you use Arcmap you will certainly be able to use QGIS, the open source version to manage the same cartographic data you use with Arcmap. Just install the qgis2web plugin to produce a webgis instantly without spending money on licenses. A complete guide here <http://www.qgistutorials.com/en/docs/3/web_mapping_with_qgis2web.html> I export the map with openlayers and then I added some extensions programmed by Viglino which you can find here <https://viglino.github.io/ol-ext/> The result is exceptional. Before qgis2web I did not know programming but the intent to improve my webgis projects started me to research and to understand slowly html code, javascript and css. I hope you will succeed in your intent. Greetings.
20,092,212
I am new to Web GIS mapping, I am interested to learn about WEB GIS and what are the skills needed. I Know Arcgis Desktop, FME, VBA, Microstation and Autocad. Please guide me.
2013/11/20
[ "https://Stackoverflow.com/questions/20092212", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3012320/" ]
Quite an open ended question but really depends what you want it for? Career wise lots of organisations use Arc Server, but lots of people are going open now and Mapserver, Geoserver and Mapnik are all technologies I would seriously look at. Learning about the OGC protocols is a good start, i.e WFS, WMS etc. Open layers and Leaflet and how they can consume data through WMS or WFS, and DB management - i.e. ensuring the data is in good shape and has adequate spatial indexes.
if you use Arcmap you will certainly be able to use QGIS, the open source version to manage the same cartographic data you use with Arcmap. Just install the qgis2web plugin to produce a webgis instantly without spending money on licenses. A complete guide here <http://www.qgistutorials.com/en/docs/3/web_mapping_with_qgis2web.html> I export the map with openlayers and then I added some extensions programmed by Viglino which you can find here <https://viglino.github.io/ol-ext/> The result is exceptional. Before qgis2web I did not know programming but the intent to improve my webgis projects started me to research and to understand slowly html code, javascript and css. I hope you will succeed in your intent. Greetings.
20,092,212
I am new to Web GIS mapping, I am interested to learn about WEB GIS and what are the skills needed. I Know Arcgis Desktop, FME, VBA, Microstation and Autocad. Please guide me.
2013/11/20
[ "https://Stackoverflow.com/questions/20092212", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3012320/" ]
**BASIC** * Knowledge about web development (Client: HTML, JS, CSS/ Server: Python, NodeJS, etc.): you can learn from the various resources. * Knowledge about GIS data (2D GIS: Shapefile, GeoJSON, etc. | 3D GIS: CityGML, 3D Tiles, I3S) and where to get them (e.g. [Get data from OpenStreetMap](https://towardsdatascience.com/beginner-guide-to-download-the-openstreetmap-gis-data-24bbbba22a38)) * Software (ESRI Suites, QGIS, AutoCAD, etc.) **WEB GIS** * Knowledge to publish your GIS data as a web service: OGC Standards, ArcGIS Rest Service. There are two main types of web map services: Raster (WMS, TMS) or Feature (WFS, GeoJSON, VectorTiles) Example tool: ArcGIS Online, ArcGIS Server, GeoServer. * Knowledge to build web maps or WebGIS using web services. Example Web map libraries: [ArcGIS JS](https://developers.arcgis.com/javascript/latest/), [Mapbox](https://www.mapbox.com/), [Leaflet](https://leafletjs.com/), [OpenLayers](https://openlayers.org/). * Automation web map builder using ArcGIS Pro or [qgis2web](https://plugins.qgis.org/plugins/qgis2web/) * 2.5, 3D Web Visualization: [CesiumJS](https://cesium.com/platform/cesiumjs/), [Deck.gl](https://deck.gl/), etc.
if you use Arcmap you will certainly be able to use QGIS, the open source version to manage the same cartographic data you use with Arcmap. Just install the qgis2web plugin to produce a webgis instantly without spending money on licenses. A complete guide here <http://www.qgistutorials.com/en/docs/3/web_mapping_with_qgis2web.html> I export the map with openlayers and then I added some extensions programmed by Viglino which you can find here <https://viglino.github.io/ol-ext/> The result is exceptional. Before qgis2web I did not know programming but the intent to improve my webgis projects started me to research and to understand slowly html code, javascript and css. I hope you will succeed in your intent. Greetings.
3,917,890
Simple question, rewriting $e^x$ with $x$ as the base- or more generally, trying to remove $x$ from the exponent. I don't know if it's possible, as I played around with it for a little while and got nothing. If it is, I suspect it has something to do with the Lambert W function. If it's not possible, is there an intuitive reason as to why not or is it just something that can't be done algebraically? I'm using it to simplify a string of terms into a shorter string of terms with $x$ as the base for each one. It's just convenient if the answer could be given in this polynomial-like form. Thanks, and sorry if I was a bit vague or missed details. Edit: It really is what's on the label; $e^x = x^?$- it's meant to be general. If you're solving for $?$ in the situation above, $e^x=x^y$ $y=\log\_x(e^x)$ $y=x\*log\_x(e)$ $y=\frac{1}{\log\_{e^x}(x)}$ And from there, I don't know how to go about reducing the equation to a single $x$, let alone removing the log and putting it in the form of $x^y$. Any ideas?
2020/11/22
[ "https://math.stackexchange.com/questions/3917890", "https://math.stackexchange.com", "https://math.stackexchange.com/users/803840/" ]
There's no $y$ such that $e^x = x^y$ for all $x$, because in the long term, the exponential beats **any** polynomial. One way to see it, is when defining the exponential as a power series: $e^x := \displaystyle\sum\_{n \geq 0} \dfrac{x^n}{n!}$. In particular, if the expression you're trying to simplify has $x \approx 0$, you can use the expression above and neglect terms above a certain order (that's called a MacLaurin/Taylor series). For example, an approximation of order $2$ would be $e^x = 1 + x + \dfrac{x^2}{2} + O(x^3)$, where $O(x^3)$ denotes the remainder, which is of order $x^3$. --- Another expression, which is not in polynomial form but might come in useful, is [Euler's relation](https://en.wikipedia.org/wiki/Euler%27s_formula) $e^{ix} = \cos x + i\sin x$.
$$e^0=1\text{ vs. }0^y=0$$ precludes any solution of the form $$e^x=x^y.$$ (And as shown by @nala, no polynomial can do. We can also add that no fractional polynomial can do. Furthermore, it is know that $e^x=1+x+\frac{x^2}2+\frac{x^2}{3!}+\cdots$ with an infinity of terms.) --- The equation $$e^x=x^y$$ is simply solved by $$y=\frac{\ln x}x$$ but this is of no use.
25,446,281
I am trying to get the object count and key counts for that json. I have tried to use count() function, it returns 2. ``` $data = json_decode($json, true); echo count($data); ``` I want to get **2** for object count and **22** as each object's key count. ``` [ { "name" : "EF", "OrganizationID" : "1", "name2" : "EF2", "m2014" : "0", "m2013" : "0", "m2012" : "0", "m2011" : "0", "m2010" : "0", "m2009" : "0", "m2008" : "0", "m2007" : "0", "m2006" : "0", "m2005" : "0", "m2004" : "0", "m2003" : "0", "m2002" : "0", "m2001" : "0", "me" : "0", "a" : "0", "a2" : "0", "b" : "0", "u" : "1" },{ "name" : "IO", "OrganizationID" : "2", "name2" : "IOX", "m2014" : "83", "m2013" : "78", "m2012" : "71", "m2011" : "73", "m2010" : "74", "m2009" : "137", "m2008" : "202", "m2007" : "206", "m2006" : "232", "m2005" : "313", "m2004" : "292", "m2003" : "306", "m2002" : "283", "m2001" : "204", "me" : "2339", "a" : "362", "a2" : "0", "b" : "1", "u" : "1" } ] ```
2014/08/22
[ "https://Stackoverflow.com/questions/25446281", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1494102/" ]
One approach ``` <?php $data = json_decode($json, true); echo count($data); echo count($data[0]); ``` or another one ``` echo count($data); foreach($data as $o){ echo count($o); } ```
Subelement count: ``` echo sizeof($data, COUNT_RECURSIVE) - sizeof($data); ``` Element count: ``` echo sizeof($data); ```
25,446,281
I am trying to get the object count and key counts for that json. I have tried to use count() function, it returns 2. ``` $data = json_decode($json, true); echo count($data); ``` I want to get **2** for object count and **22** as each object's key count. ``` [ { "name" : "EF", "OrganizationID" : "1", "name2" : "EF2", "m2014" : "0", "m2013" : "0", "m2012" : "0", "m2011" : "0", "m2010" : "0", "m2009" : "0", "m2008" : "0", "m2007" : "0", "m2006" : "0", "m2005" : "0", "m2004" : "0", "m2003" : "0", "m2002" : "0", "m2001" : "0", "me" : "0", "a" : "0", "a2" : "0", "b" : "0", "u" : "1" },{ "name" : "IO", "OrganizationID" : "2", "name2" : "IOX", "m2014" : "83", "m2013" : "78", "m2012" : "71", "m2011" : "73", "m2010" : "74", "m2009" : "137", "m2008" : "202", "m2007" : "206", "m2006" : "232", "m2005" : "313", "m2004" : "292", "m2003" : "306", "m2002" : "283", "m2001" : "204", "me" : "2339", "a" : "362", "a2" : "0", "b" : "1", "u" : "1" } ] ```
2014/08/22
[ "https://Stackoverflow.com/questions/25446281", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1494102/" ]
One approach ``` <?php $data = json_decode($json, true); echo count($data); echo count($data[0]); ``` or another one ``` echo count($data); foreach($data as $o){ echo count($o); } ```
``` echo "Object Count = ".$sizeof($data)."<br/>"; foreach($data as $key=>$arr) { echo "Key - ".$key." Count = ".$sizeof($arr)."<br/>"; } ```
25,446,281
I am trying to get the object count and key counts for that json. I have tried to use count() function, it returns 2. ``` $data = json_decode($json, true); echo count($data); ``` I want to get **2** for object count and **22** as each object's key count. ``` [ { "name" : "EF", "OrganizationID" : "1", "name2" : "EF2", "m2014" : "0", "m2013" : "0", "m2012" : "0", "m2011" : "0", "m2010" : "0", "m2009" : "0", "m2008" : "0", "m2007" : "0", "m2006" : "0", "m2005" : "0", "m2004" : "0", "m2003" : "0", "m2002" : "0", "m2001" : "0", "me" : "0", "a" : "0", "a2" : "0", "b" : "0", "u" : "1" },{ "name" : "IO", "OrganizationID" : "2", "name2" : "IOX", "m2014" : "83", "m2013" : "78", "m2012" : "71", "m2011" : "73", "m2010" : "74", "m2009" : "137", "m2008" : "202", "m2007" : "206", "m2006" : "232", "m2005" : "313", "m2004" : "292", "m2003" : "306", "m2002" : "283", "m2001" : "204", "me" : "2339", "a" : "362", "a2" : "0", "b" : "1", "u" : "1" } ] ```
2014/08/22
[ "https://Stackoverflow.com/questions/25446281", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1494102/" ]
Subelement count: ``` echo sizeof($data, COUNT_RECURSIVE) - sizeof($data); ``` Element count: ``` echo sizeof($data); ```
``` echo "Object Count = ".$sizeof($data)."<br/>"; foreach($data as $key=>$arr) { echo "Key - ".$key." Count = ".$sizeof($arr)."<br/>"; } ```
4,041,017
Let $f(x)=\sin\left(\frac{1}{x}\right)$ if $0<x\le1$ and $f(x)=0$ if $x=0$. Show that $f$ is Riemann integrable on $[0,1]$ and calculate it's integral on $[0,1]$. I would like to know if my proof holds, please. And, I would like have a hint on how we can calculate the intergal of this such of functions, please. My attempt is to pass by Darboux upper and lower sums. To show that $f$ is Riemann integrable, we have to show the following:$\forall \epsilon>0$ $\exists$ a partition $\sigma$: $\overline{S}\_{\sigma}(f)<\underline{S}\_{\sigma}(f)+\epsilon$. Let $0<\epsilon<2$ and consider the following intervals $[0,\epsilon/2]$ and $[\epsilon/2,1]$. First of all, as $f(x)$ is continuous on $[\epsilon/2,1]$($\sin(\frac{1}{x})$ is continuous on $[\epsilon/2,1]$), it is integrable on this interval. We would like to show now that $f$ is intergable on $[0,\epsilon/2]$. Consider the partition $\sigma=\{0,\frac{\epsilon}{2}\}$ on $[0,\epsilon/2]$ We have that $\overline{S}\_{\sigma}(f)-\underline{S}\_{\sigma}(f)=\sum\_{i=0}^{0}M\_i(x\_{i+1}-x\_i)-\sum\_{i=0}^{0}m\_i(x\_{i+1}-x\_i)$ with $M\_i=\sup\{f(x):x\in[x\_i,x\_{i+1}]\}$ and $m\_i=\inf\{f(x):x\in[x\_i,x\_{i+1}]\}$. We have that $M\_i\le1$ and $m\_i\le 0$. Thus, $\sum\_{i=0}^{0}M\_i(x\_{i+1}-x\_i)-\sum\_{i=0}^{0}m\_i(x\_{i+1}-x\_i)\le1\cdot \frac{\epsilon}{2}< \epsilon$. Therefore, as $f(x)$ is integrable on $[0,\epsilon/2]$ and on $[\epsilon/2,1]$, we conclude that $f$ is integrable on $[0,1]$. Now, I would like to calculate it's integral value... If someone could help with it, I would appreciate it. Honestly, I have no idea how to integrate this such of discontinuous functions at finitely many points. **Edit**: As $f(x)$ is continuous on $[\epsilon/3,1]$, it is integrable on this interval. Therefore, $\forall \epsilon>0 \ \exists$ partition $\tau$ on the interval $[\epsilon/3,1]$: $\overline{S}\_{\tau}(f)-\underline{S}\_{\tau}(f)<\epsilon/3$ To show that $f$ is integrable on $[0,1]$, we have to show that: $\forall \epsilon>0 \ \exists$ a partition $\sigma$: $\overline{S}\_{\sigma}(f)-\underline{S}\_{\sigma}<\epsilon$ Suppose $0<\epsilon<3$ and let $\sigma=\tau \ \cup \{0\}$ be a partition on the interval $[0,1]$. We have that (for the following inequality I use the same definition for $M\_i$ and $m\_i$ as above in the post): $\overline{S}\_{\sigma}(f)-\underline{S}\_{\sigma}=\Big(\sum\_{i=0}^{0}\underbrace{M\_i}\_{\le1}(x\_{i+1}-x\_i)-\sum\_{i=0}^{0}\underbrace{m\_i}\_{\ge -1}(x\_{i+1}-x\_i)\Big)+\underbrace{\Big(\sum\_{i=1}^{n}M\_i(x\_{i+1}-x\_i)-\sum\_{i=1}^{n}m\_i(x\_{i+1}-x\_i)\Big)}\_{<\epsilon/3}<\frac{\epsilon}{3}+\frac{\epsilon}{3}+\frac{\epsilon}{3}=\epsilon$. Therefore, $f$ is integrable on $[0,1]$.
2021/02/26
[ "https://math.stackexchange.com/questions/4041017", "https://math.stackexchange.com", "https://math.stackexchange.com/users/691131/" ]
This is about feedback on your proof. Your goal is to find a partition $\sigma$ such that $\overline{S}\_{\sigma} (f) <\underline{S} \_{\sigma} (f) +\epsilon $ but instead you are trying to use that $f$ is integrable on $[\epsilon/2,1]$ and prove that $f$ is integrable on $[0,\epsilon/2]$. This is not what you want. You want a partition $\sigma$ which works as expected. You can just say that since the function is integrable on $[\epsilon/2,1]$ there is a partition $\sigma\_1$ of $[\epsilon/2,1]$ which works for this interval and then take $\sigma=\sigma\_1\cup \{0\}$ and using your argument in question show that this particular partition works for $[0,1]$. You have the correct idea but you need to present it in proper manner.
Integrate by parts $$\int \sin \left(\frac{1}{x}\right) \, dx=x\sin \left(\frac{1}{x}\right) -\int x \left(-\frac{1}{x^2}\right)\cos \left(\frac{1}{x}\right)\,dx=$$ $$=x \sin \left(\frac{1}{x}\right)-\text{Ci}\left(\frac{1}{x}\right)+C$$ Ci is cosine integral $$\text{Ci}(x)=-\int\_x^{\infty}\frac{\cos x}{x}$$ $$\int\_0^1 \sin \left(\frac{1}{x}\right) \, dx=\sin (1)-\text{Ci}(1)-\lim\_{a\to 0^+}\left[a \sin \left(\frac{1}{a}\right)-\text{Ci}\left(\frac{1}{a}\right)\right]$$ set $\frac{1}{a}=t$ $$\lim\_{t\to\infty}\left[\frac{1}{t} \sin t-\text{Ci}\left(t\right)\right]=0$$ $$\int\_0^1 \sin \left(\frac{1}{x}\right) \, dx=\sin (1)-\text{Ci}(1)\approx 0.504$$
57,352,312
I am very new to `MongoDB`. I want to create an array of date. I am using mongoose with node.js. Below is what I think. Please, will the datatype be saved as date? Thanks. ``` date: { type: Array, default: Date.now } ```
2019/08/05
[ "https://Stackoverflow.com/questions/57352312", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10966017/" ]
It happens that I find the answer myself after research. For anyone that might need it again, the correct way is: `date: [Date]` A better explanation is found on Mongoose site : [Mongoose Link](https://mongoosejs.com/docs/schematypes.html)
default value will be Array if type is set as Array ``` date: { type: Array, default: [Date] } ```
57,352,312
I am very new to `MongoDB`. I want to create an array of date. I am using mongoose with node.js. Below is what I think. Please, will the datatype be saved as date? Thanks. ``` date: { type: Array, default: Date.now } ```
2019/08/05
[ "https://Stackoverflow.com/questions/57352312", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10966017/" ]
it should be like :- date: { type: Array, default: [Date] }
default value will be Array if type is set as Array ``` date: { type: Array, default: [Date] } ```
57,352,312
I am very new to `MongoDB`. I want to create an array of date. I am using mongoose with node.js. Below is what I think. Please, will the datatype be saved as date? Thanks. ``` date: { type: Array, default: Date.now } ```
2019/08/05
[ "https://Stackoverflow.com/questions/57352312", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10966017/" ]
It happens that I find the answer myself after research. For anyone that might need it again, the correct way is: `date: [Date]` A better explanation is found on Mongoose site : [Mongoose Link](https://mongoosejs.com/docs/schematypes.html)
it should be like :- date: { type: Array, default: [Date] }
21,354,203
``` <a id="f_post_button" href="javascript:toggle_hide('f_post_button','f_postbox','post');"> <button class="btn btn-hg btn-primary">Make a Post</button> </a> ``` This is working fine for me in safari and chrome, but in IE and Firefox it just opens a blank page. Is there any alternative way to do it?
2014/01/25
[ "https://Stackoverflow.com/questions/21354203", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1232881/" ]
add void method to resolve this ``` <a id="f_post_button" href="javascript:void(toggle_hide('f_post_button','f_postbox','post'));"> <button class="btn btn-hg btn-primary">Make a Post</button> ```
What is saying Quentin is something like this : ```html <button id="my-button" class="btn btn-hg btn-primary">Make a Post</button> ``` ```js var myButton = document.getElementById("my-button"); myButton.click = function (f_post_button,f_postbox,post){ //do your stuff for toggle here } ```
21,354,203
``` <a id="f_post_button" href="javascript:toggle_hide('f_post_button','f_postbox','post');"> <button class="btn btn-hg btn-primary">Make a Post</button> </a> ``` This is working fine for me in safari and chrome, but in IE and Firefox it just opens a blank page. Is there any alternative way to do it?
2014/01/25
[ "https://Stackoverflow.com/questions/21354203", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1232881/" ]
If it is a button you don't need to use href you can use onclick Try this: ``` <button class="btn btn-hg btn-primary" onclick="toggle_hide('f_post_button','f_postbox','post')">Make a Post</button> ``` <http://www.w3schools.com/js/tryit.asp?filename=tryjs_function3>
add void method to resolve this ``` <a id="f_post_button" href="javascript:void(toggle_hide('f_post_button','f_postbox','post'));"> <button class="btn btn-hg btn-primary">Make a Post</button> ```
21,354,203
``` <a id="f_post_button" href="javascript:toggle_hide('f_post_button','f_postbox','post');"> <button class="btn btn-hg btn-primary">Make a Post</button> </a> ``` This is working fine for me in safari and chrome, but in IE and Firefox it just opens a blank page. Is there any alternative way to do it?
2014/01/25
[ "https://Stackoverflow.com/questions/21354203", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1232881/" ]
If it is a button you don't need to use href you can use onclick Try this: ``` <button class="btn btn-hg btn-primary" onclick="toggle_hide('f_post_button','f_postbox','post')">Make a Post</button> ``` <http://www.w3schools.com/js/tryit.asp?filename=tryjs_function3>
What is saying Quentin is something like this : ```html <button id="my-button" class="btn btn-hg btn-primary">Make a Post</button> ``` ```js var myButton = document.getElementById("my-button"); myButton.click = function (f_post_button,f_postbox,post){ //do your stuff for toggle here } ```
64,526,527
I have a string in ruby, let's say `"hello, I am a string, I am surrounded by quotes"` and I want to replace all words ( separated by a space ) which don't match a RegExp pattern, lets say `/.+?s/` with `"foo"`. so the result would be `"foo foo foo foo string, foo foo surrounded foo quotes"` since words have a separator I could do ```rb str = "hello, I am a string, I am surrounded by quotes" str = str.split str.each{ |e| x = e.match(/(.+)?s/) if x.to_s.empty? then e.replace "foo" end } str = str.join(" ") puts str # -> foo foo foo foo string, foo foo surrounded foo quotes ``` but is there better way of doing this? As that is quite a lot of code for a relatively simple operation.
2020/10/25
[ "https://Stackoverflow.com/questions/64526527", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11787079/" ]
I would avoid using an array: Use a @key on each row. Note: I did not know the type of EntAddModelsList so I used object. Change this to the item type. ``` @foreach (var entAddModel in Arae.EntAddModelsList) { <tr @key="entAddModel"> ... <td>@entAddModel.Label</td> // more concise than Arae.EntAddModelsList[i].Label ... <button class="btn btn-primary table-btn" @onclick="@(() => UpdateAddress(entAddModel))"> <i class="fas fa-edit"></i> </button> </tr> } @code { async ValueTask UpdateAddress(object entAddModel) // Change object to the correct type { ... } } ``` Side Note: To bind to a checkbox use something like this: ``` <input type="checkbox" checked @bind="entAddModel.Prim"> ```
first off, you must define a local varaible in your loop like this: ``` @for (int i = 0; i < Arae.EntAddModelsList.Count(); i++) { var local = i; } ``` And use it instead of i in the lambda expression; As for your question: define your anchor element like this: ``` <a href="" id="@i" class="btn btn-primary table-btn" @onclick="@(() => UpdateAddress(local))"> <i class="fas fa-edit"></i> </a> ``` And in the `@code` block add the following: ``` private Task UpdateAddress(int i) { } ```
44,366,227
I am trying to make utils for performing network operations in `kotlin`. I have below code where the primary constructor is taking `Command` and `Context`. I am unable to access command variable in `command.execute(JSONObject(jsonObj))`, getting below error. I am not sure what is causing an issue? > > Unresolved reference: command > > > ``` class AsyncService(val command: Command, val context: Context) { companion object { fun doGet(request: String) { doAsync { val jsonObj = java.net.URL(request).readText() command.execute(JSONObject(jsonObj)) } } } } ```
2017/06/05
[ "https://Stackoverflow.com/questions/44366227", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2455259/" ]
A companion object is not part of an instance of a class. You can't access members from a companion object, just like in Java you can't access members from a static method. Instead, don't use a companion object: ``` class AsyncService(val command: Command, val context: Context) { fun doGet(request: String) { doAsync { val jsonObj = java.net.URL(request).readText() command.execute(JSONObject(jsonObj)) } } } ```
You should pass arguments directly to your companion object function: ``` class AsyncService { companion object { fun doGet(command: Command, context: Context, request: String) { doAsync { val jsonObj = java.net.URL(request).readText() command.execute(JSONObject(jsonObj)) } } } } ```
42,252
I am referring to a set of words that wouldn't make sense if one word or the other was omitted. Like *barbershop quartet*, or *Cyber Security*. What do you exactly call this set of words?
2011/09/18
[ "https://english.stackexchange.com/questions/42252", "https://english.stackexchange.com", "https://english.stackexchange.com/users/11171/" ]
A *collocation* is also an option, though the meaning is broader than requested. > > In corpus linguistics, collocation defines a sequence of words or terms that co-occur more often than would be expected by chance. > > > A pair or group of words that are juxtaposed in such a way > > > * “strong coffee” and “heavy drinker” are typical English collocations > > >
A phrase. > > Noun: A small group of words standing together as a conceptual unit, typically forming a component of a clause. > > >
42,252
I am referring to a set of words that wouldn't make sense if one word or the other was omitted. Like *barbershop quartet*, or *Cyber Security*. What do you exactly call this set of words?
2011/09/18
[ "https://english.stackexchange.com/questions/42252", "https://english.stackexchange.com", "https://english.stackexchange.com/users/11171/" ]
A *collocation* is also an option, though the meaning is broader than requested. > > In corpus linguistics, collocation defines a sequence of words or terms that co-occur more often than would be expected by chance. > > > A pair or group of words that are juxtaposed in such a way > > > * “strong coffee” and “heavy drinker” are typical English collocations > > >
This phenomenon is called a > > **stormy petrel** > > > which is both the name of the kind of bird and the name of the linguistic phenomenon because there is no such thing as a petrel of any other kind other than 'stormy'. There are [a number of examples here](http://www.satiche.org.uk/satiche/sat-0342.htm) It is also mentioned [here at ELU](https://english.stackexchange.com/questions/10614/is-there-a-term-for-words-that-have-a-single-meaning-or-are-only-used-in-a-single). The phenomenon could also be seen in single words which are formed from multiple morphemes, such as 'disgruntled', for which one of them never appears alone. Here is a [Language log posting](http://www.ling.upenn.edu/~beatrice/humor/how-i-met-my-wife.html) that is a quote of a passage intentionally filled with examples of these uncommonly exposed roots (mostly negatively prefixed words that have had the prefix removed). From either of these lists, I don't see any examples where -neither- part stands alone.
42,252
I am referring to a set of words that wouldn't make sense if one word or the other was omitted. Like *barbershop quartet*, or *Cyber Security*. What do you exactly call this set of words?
2011/09/18
[ "https://english.stackexchange.com/questions/42252", "https://english.stackexchange.com", "https://english.stackexchange.com/users/11171/" ]
A *collocation* is also an option, though the meaning is broader than requested. > > In corpus linguistics, collocation defines a sequence of words or terms that co-occur more often than would be expected by chance. > > > A pair or group of words that are juxtaposed in such a way > > > * “strong coffee” and “heavy drinker” are typical English collocations > > >
The label for the concept that you are looking for is a > > **set phrase** > > > or > > **idiom** > > > a phrase, collocation, locution (a sequence of words) that has more meaning to it than the combination of meanings of its constituents. That is, the literal meaning of its parts does not give the meaning of the entire phrase. There is a discussion here of [the difference between a plain old expression and an idiom](https://english.stackexchange.com/questions/35260/difference-between-phrase-idiom-and-expression) , and on [set phrase](https://english.stackexchange.com/questions/35264/is-set-phrase-a-set-phrase).
6,198,092
I am using SQLite.NET with C#[ visual studio 2008] and added the 'System.Data.SQLite.dll' as reference. The following code works with Windows Application for fetching data from my database file into a datagrid. ``` private void SetConnection() { sql_con = new SQLiteConnection("Data Source=emp.db;Version=3;"); } public DataTable LoadData() { SetConnection(); sql_con.Open(); sql_cmd = sql_con.CreateCommand(); string CommandText = "select * from employeedetails"; transaction=sql_con.BeginTransaction(); DA = new SQLiteDataAdapter(CommandText, sql_con); DS.Reset(); DA.Fill(DS); DT = DS.Tables[0]; transaction.Commit(); sql_con.Close(); return DT; } ``` **Invoking in:** ``` private void Form1_Load(object sender, EventArgs e) { EmpTable obj = new EmpTable(); this.dataGridView1.DataSource = obj.LoadData(); } ``` The same code not working with C# 'Smart Device Application'. It shows an exception: no such table 'employeedetails'. For Smart Device Application I have added the System.Data.SQLite.dll from "SQLite/CompactFramework" folder. Please help me to resolve this. Thanks in advance.
2011/06/01
[ "https://Stackoverflow.com/questions/6198092", "https://Stackoverflow.com", "https://Stackoverflow.com/users/711140/" ]
I'm not sure if this is what is causing your issue, but we've had issues in the past with mobile devices and sqlite where this solved it: For an application using the compact framework, you need to include SQLite.Interop.xxx.DLL in your project (in addition to the regular System.Data.SQLite.DLL). Make sure you set the file to *copy if newer* or *copy always*. Keep in mind that you can't set a reference to the interop dll. You must include it in the project by adding it as a file. For more information check [this website](http://sqlite.phxsoftware.com/readme.htm) under the *Distributing The SQLite Engine and ADO.NET Assembly* section.
``` sql_con = new SQLiteConnection("Data Source=emp.db;Version=3;"); ``` I think you need to specify the full path here, and make sure it's correct. If the path is to a non-existent file, it will create a new emp.db database file there instead. This new file will obviously be empty and without any tables, hence it would give a `no such table 'employeedetails'` exception such as you're getting if you query it.
6,198,092
I am using SQLite.NET with C#[ visual studio 2008] and added the 'System.Data.SQLite.dll' as reference. The following code works with Windows Application for fetching data from my database file into a datagrid. ``` private void SetConnection() { sql_con = new SQLiteConnection("Data Source=emp.db;Version=3;"); } public DataTable LoadData() { SetConnection(); sql_con.Open(); sql_cmd = sql_con.CreateCommand(); string CommandText = "select * from employeedetails"; transaction=sql_con.BeginTransaction(); DA = new SQLiteDataAdapter(CommandText, sql_con); DS.Reset(); DA.Fill(DS); DT = DS.Tables[0]; transaction.Commit(); sql_con.Close(); return DT; } ``` **Invoking in:** ``` private void Form1_Load(object sender, EventArgs e) { EmpTable obj = new EmpTable(); this.dataGridView1.DataSource = obj.LoadData(); } ``` The same code not working with C# 'Smart Device Application'. It shows an exception: no such table 'employeedetails'. For Smart Device Application I have added the System.Data.SQLite.dll from "SQLite/CompactFramework" folder. Please help me to resolve this. Thanks in advance.
2011/06/01
[ "https://Stackoverflow.com/questions/6198092", "https://Stackoverflow.com", "https://Stackoverflow.com/users/711140/" ]
Thank You Guys, I've resolved the Problem. As 'siyw' said, the problem was the application could not find the "db file". **For windows application,** The db file has to be located in debug folder where the .exe file is generated. So that, no need to specify the path of the DB file. **For Smart Device Application,** The DB file will be generated in the root folder of the device. If we bind the db file with exe means, it wont find it and it will create a new database in root folder. To avoid that, while crating CAB file we have to create custom folder [ ex. DBfolder ] and put the db file in the folder. Set the path in the connection String as, ``` sql_con = new SQLiteConnection("Data Source=DBfolder/emp.db;Version=3;"); ``` Now, the db is found by the Application.
I'm not sure if this is what is causing your issue, but we've had issues in the past with mobile devices and sqlite where this solved it: For an application using the compact framework, you need to include SQLite.Interop.xxx.DLL in your project (in addition to the regular System.Data.SQLite.DLL). Make sure you set the file to *copy if newer* or *copy always*. Keep in mind that you can't set a reference to the interop dll. You must include it in the project by adding it as a file. For more information check [this website](http://sqlite.phxsoftware.com/readme.htm) under the *Distributing The SQLite Engine and ADO.NET Assembly* section.
6,198,092
I am using SQLite.NET with C#[ visual studio 2008] and added the 'System.Data.SQLite.dll' as reference. The following code works with Windows Application for fetching data from my database file into a datagrid. ``` private void SetConnection() { sql_con = new SQLiteConnection("Data Source=emp.db;Version=3;"); } public DataTable LoadData() { SetConnection(); sql_con.Open(); sql_cmd = sql_con.CreateCommand(); string CommandText = "select * from employeedetails"; transaction=sql_con.BeginTransaction(); DA = new SQLiteDataAdapter(CommandText, sql_con); DS.Reset(); DA.Fill(DS); DT = DS.Tables[0]; transaction.Commit(); sql_con.Close(); return DT; } ``` **Invoking in:** ``` private void Form1_Load(object sender, EventArgs e) { EmpTable obj = new EmpTable(); this.dataGridView1.DataSource = obj.LoadData(); } ``` The same code not working with C# 'Smart Device Application'. It shows an exception: no such table 'employeedetails'. For Smart Device Application I have added the System.Data.SQLite.dll from "SQLite/CompactFramework" folder. Please help me to resolve this. Thanks in advance.
2011/06/01
[ "https://Stackoverflow.com/questions/6198092", "https://Stackoverflow.com", "https://Stackoverflow.com/users/711140/" ]
Thank You Guys, I've resolved the Problem. As 'siyw' said, the problem was the application could not find the "db file". **For windows application,** The db file has to be located in debug folder where the .exe file is generated. So that, no need to specify the path of the DB file. **For Smart Device Application,** The DB file will be generated in the root folder of the device. If we bind the db file with exe means, it wont find it and it will create a new database in root folder. To avoid that, while crating CAB file we have to create custom folder [ ex. DBfolder ] and put the db file in the folder. Set the path in the connection String as, ``` sql_con = new SQLiteConnection("Data Source=DBfolder/emp.db;Version=3;"); ``` Now, the db is found by the Application.
``` sql_con = new SQLiteConnection("Data Source=emp.db;Version=3;"); ``` I think you need to specify the full path here, and make sure it's correct. If the path is to a non-existent file, it will create a new emp.db database file there instead. This new file will obviously be empty and without any tables, hence it would give a `no such table 'employeedetails'` exception such as you're getting if you query it.
38,305
by the etymology of his name, he should be fair-skinned: > > Proto-IE: \*arg'-/\*e- > Meaning: white, brilliant > Hittite: harki- `weiss, hell' (Tischler 177) > Tokharian: A ārki, B arkwi weiss (PT *ārkw(ä)i) (Adams 49-50) > Old Indian: árjuna-`white, clear' > Avestan: arǝzah- n. `Nachmitteg und Abend' (Bed. fraglich) > Old Greek: argó-`weissglänzend'; argi- in compounds; árgemo-n n., á́rgemo-s m. `weisser Fleck im Auge, albugo' > Germanic: *irk-n-a- adj. > Latin: arguō, -uī, -ūtum, -ere`mache klar, weise nach, überführe', argūtus, -a `helltönend' > > > But [this book](https://books.google.com/books?id=cguMjbz3xmcC&pg=PA108&lpg=PA108&dq=dark-skinned+arjuna&source=bl&ots=31918bYtBU&sig=ACfU3U0EhH0TLHEGcK3AZ8NNjemylNYHiA&hl=en&sa=X&ved=2ahUKEwjZusyF3eLnAhWJmOAKHbaxCM84ChDoATACegQIDBAB#v=onepage&q=dark-skinned%20arjuna&f=false): says Krishna,Arjuna,Draupadi and Vyasa were dark-skinned.
2020/02/21
[ "https://hinduism.stackexchange.com/questions/38305", "https://hinduism.stackexchange.com", "https://hinduism.stackexchange.com/users/12489/" ]
His being "Arjuna" seems metaphorical (brilliant, rather than white) and in actuality he was dark-skinned: <https://www.sacred-texts.com/hin/m04/m04044.htm> > > "Arjuna said, 'I am Arjuna, called also Partha. Thy father's courtier is Yudhishthira and thy father's cook Vallava is Bhimasena, the groom of horses is Nakula, and Sahadeva is in the cow-pen. And know thou that the Sairindhri is Draupadi, for whose sake the Kichakas have been slain.' > > > "Uttara said, 'I would believe all this if thou canst enumerate the ten names of Partha, previously heard by me!' > > > "Arjuna said, 'I will, O son of Virata, tell thee my ten names. Listen thou and compare them with what thou hadst heard before. Listen to them with close attention and concentrated mind. They are Arjuna, Falguna, Jishnu, Kiritin, Swetavahana, Vibhatsu, Vijaya, Krishna, Savyasachin and Dhananjaya." > > > "Uttara said, 'Tell me truly why art thou called Vijaya, and why Swetavahana. Why art thou named Krishna and why Arjuna and Falguna and Jishnu and Kiritin and Vibhatsu, and for what art thou Dhananjaya and Savyasachin? I have heard before about the origin of the several names of that hero, and can put faith in thy words if thou canst tell me all about them.' > > > "Arjuna said, 'They called me Dhananjaya because I lived in the midst of wealth, having subjugated all the countries and taking away their treasures. They called me Vijaya because when I go out to battle with invincible kings, I never return (from the field) without vanquishing them. I am called Swetavahana because when battling with the foe, white horses decked in golden armour are always yoked unto my car. They call me Falguna because I was born on the breast of the Himavat on a day when the constellation Uttara Falguna was on the ascendent. I am named Kiritin from a diadem, resplendent like the sun, having been placed of old on my head by Indra during my encounter with the powerful Danavas. I am known as Vibhatsu among gods and men, for my never having committed a detestable deed on the battle-field. And since both of my hands are capable of drawing the Gandiva, I am known as Savyasachin among gods and men. They call me Arjuna because my complexion is very rare within the four boundaries of the earth and because also my acts are always stainless. I am known among human beings and celestials by the name of Jishnu, because I am unapproachable and incapable of being kept down, and a tamer of adversaries and son of the slayer of Paka. **And Krishna, my tenth appellation, was given to me by my father out of affection towards his black-skinned boy of great purity.'** > > >
Mahabharata gives the following description of the Pandava brothers. It does not say if Arjuna was fair or dark. > > Thus addressed, Draupadi replied, ‘Having done this violent deed to > shorten thy life, what will it avail thee now, O fool, to know the > names of these great warriors, for, now, that my heroic husbands are > come, not one of ye will be left alive in battle. However as thou art > on the point of death and hast asked me, I will tell thee everything, > this being consistent with the ordinance. Beholding King Yudhishthira > the just with his younger brothers, I have not the slightest anxiety > or fear from thee! That warrior at the top of whose flagstaff two > handsome and sonorous tabours called Nanda and Upananda are constantly > played upon, - he, O Sauvira chief, hath a correct knowledge of the > morality of his own acts. Men that have attained success always walk > in his train. **With a complexion like that of pure gold, possessed of a > prominent nose and large eyes, and endued with a slender make, that > husband of mine is known among people, by the name of Yudhishthira, > the son of Dharma, and the foremost of the Kuru race.** That virtuous > prince of men granteth life to even a foe that yields. Therefore, O > fool, throwing down thy arms and joining thy hands, run to him for thy > good, to seek his protection. **And the other man whom thou seest with > long arms, and tall as the full-grown Sala tree, seated on his > chariot, biting his lips, and contracting his forehead so as to bring > the two eye-brows together, is he, - my husband Vrikodara!** Steeds of > the noblest breed, plump and strong, well-trained and endued with > great might, draw the cars of that warrior! His achievements are > superhuman. He is known, therefore, by the name of Bhima on earth. > They that offend him are never suffered to live. He never forgetteth a > foe. On some pretext or other he wrecketh his vengeance. Nor is he > pacified even after he has wrecked a signal vengeance. **And there, that > foremost of bowmen, endued with intelligence and renown, with senses > under complete control and reverence for the old - that brother and > disciple of Yudhishthira - is my husband Dhananjaya! Virtue he never > forsaketh, from lust or fear or anger! Nor doth he ever commit a deed > that is cruel. Endued with the energy of fire and capable of > withstanding every foe, that grinder of enemies is the son of Kunti.** > And **that other youth, versed in every question of morality and profit, > who ever dispelleth the fears of the affrighted, who is endued with > high wisdom, who is considered as the handsomest person in the whole > world and who is protected by all the sons of Pandu, being regarded by > them as dearer to them as their own lives for his unflinching devotion > to them, is my husband Nakula possessed of great prowess.** Endued with > high wisdom and having Sahadeva for his second, possessed of exceeding > lightness of hand, he fighteth with the sword, making dexterous passes > there with. Thou, foolish man, shall witness today his performances on > the field of battle, like unto those of Indra amid the ranks of > Daityas! **And that hero skilled in weapons and possessed of > intelligence and wisdom, and intent on doing what is agreeable to the > son of Dharma, that favorite and youngest born of the Pandavas, is my > husband Sahadeva! Heroic, intelligent, wise and ever wrathful there is not > another man equal unto him in intelligence or in eloquence amid > assemblies of the wise.**’ > > > **Mahabharata, Vana Parva, Section CCLXVIII** Mahabharata says the following about Draupadi. > > Yudhisthira answered the chief of the deities once more, saying, - ‘O > conqueror of Daityas, I venture not to dwell anywhere, separated from > them. I desire to go there where my brothers have gone. I wish to go > there where **that foremost of women, Draupadi, of ample proportions and > darkish complexion and endued with great intelligence and righteous of > conduct,** has gone.’ > > > **Mahabharata Mahaprasthanika Parva Section III**
1,417,673
In Analysis, I learned that any number system satisfying all the axioms (commutativity, associativity, identity elements, invertibility, distributivity) is called a field. Then the professor mentioned that the set {0, 1} = F is also a field. Then he drew this: + 0 1 0 0 1 1 1 0 My question is why is 1 + 1 = 0 in the table? So, if we assumed that the set {0, 1} is a field, then I see that 1 + 1 = 0. But wasn't our purpose to show that the set {0, 1} is a field? Then shouldn't we just perform it "normally" i.e. 1 + 1 = 2? Then since 2 is not in F, we can conclude that this is not a field? Thank you for your answers in advance.
2015/09/01
[ "https://math.stackexchange.com/questions/1417673", "https://math.stackexchange.com", "https://math.stackexchange.com/users/-1/" ]
This is known as the finite field $\mathbb{F}\_2$. Here, we are thinking of doing the operations "[mod](https://en.wikipedia.org/wiki/Modular_arithmetic) 2". Let's look at the field axioms your professor gave: using the addition table he wrote out, we can show that the addition he defines is commutative, associative, and multiplication distributes over it. As well, with this addition, $1$ is it's own additive inverse. I would check out the modular arithmetic link above to learn more about this, and if you would like to know more about finite fields in general, here is a [link](https://en.wikipedia.org/wiki/Finite_field) to the Wikipedia page.
In the definition of a field, by "$0$ or $1$" we don't mean the *numbers* $0$ or $1$, we mean the the elements $0$ or $1$ which are the identity elements for addition and multiplication respectively. A field, I repeat, need not have numbers in it and $0$ and $1$ should not be interpreted as numbers.
1,417,673
In Analysis, I learned that any number system satisfying all the axioms (commutativity, associativity, identity elements, invertibility, distributivity) is called a field. Then the professor mentioned that the set {0, 1} = F is also a field. Then he drew this: + 0 1 0 0 1 1 1 0 My question is why is 1 + 1 = 0 in the table? So, if we assumed that the set {0, 1} is a field, then I see that 1 + 1 = 0. But wasn't our purpose to show that the set {0, 1} is a field? Then shouldn't we just perform it "normally" i.e. 1 + 1 = 2? Then since 2 is not in F, we can conclude that this is not a field? Thank you for your answers in advance.
2015/09/01
[ "https://math.stackexchange.com/questions/1417673", "https://math.stackexchange.com", "https://math.stackexchange.com/users/-1/" ]
This is known as the finite field $\mathbb{F}\_2$. Here, we are thinking of doing the operations "[mod](https://en.wikipedia.org/wiki/Modular_arithmetic) 2". Let's look at the field axioms your professor gave: using the addition table he wrote out, we can show that the addition he defines is commutative, associative, and multiplication distributes over it. As well, with this addition, $1$ is it's own additive inverse. I would check out the modular arithmetic link above to learn more about this, and if you would like to know more about finite fields in general, here is a [link](https://en.wikipedia.org/wiki/Finite_field) to the Wikipedia page.
If you interpret these elements as representing the parity of an integer $o$ for ‘even’, for ‘odd’, $1+1=0$ just means odd $+$ odd $=$ even.
2,051,036
I posted this on GAE for Java group, but I hope to get some answers here quicker :) I decided to do some long-run performance tests on my application. I created some small client hitting app every 5-30 minutes and I run 3-5 of threads with such client. I noticed huge differenced in response times and started to investigate issue. I found reason very quick. I am experiencing same issues as described in following topics: [Uneven response time between connection to server to first byte sent](http://www.google.com/url?sa=D&q=http://groups.google.com/group/google-appengine/browse_thread/thread/fed86730708f2a9d/c6f13c9c48c08791%3Flnk%3Dgst%26q%3Drequest%2Bresponse%2Btime%23c6f13c9c48c08791&usg=AFQjCNG6U6cscl2n1lsphsSMTIGMlw5wXg) [Application instances seem to be too aggressively recycled](http://groups.google.com/group/google-appengine/browse_thread/thread/7cd20b6fcfd38e5d) [Getting 'Request was aborted after waiting too long to attempt to service your request.' after application idle](http://groups.google.com/group/google-appengine-java/browse_thread/thread/755b7ba89db70213/4b39d900479ba1de?lnk=gst&q=application+instance#4b39d900479ba1de) I am using Springframework, it tkes around 18-20s to start app instance, which is causing response times to take from 1s (when requests hits running app - very rare) to 22s when fresh application is created. Is there any solution for this? I was thinking about creating most basic servlet performing critical tasks (serving API call) and leave UI as is. But then I would loose all benefits of Springframework. Is there any solution for this? After solving (hacking) numerous constrains of App Engine which I hit while developing my app that is the one I think will make me move out of App Engine... that's simply to much to all the time think how to win with GAE problems than how to solve my application problems... Any help? Regards Konrad
2010/01/12
[ "https://Stackoverflow.com/questions/2051036", "https://Stackoverflow.com", "https://Stackoverflow.com/users/86723/" ]
Use the new [precompilation](http://googleappengine.blogspot.com/2009/12/request-performance-in-java.html) feature. ``` <!-- appengine-web.xml --> <precompilation-enabled>true</precompilation-enabled> ```
This is definitely a tricky issue with AppEngine applications. The purists will tell you to look at why your application takes so long to start up and work backwards from there. In your case, the answer is obvious: you are using Spring, and it has to load many class files and instantiate many objects. The pragmatic answer, if you can live without Spring, is to make sure that you app instance stays warm. You can either ping it from an external source frequently enough that AppEngine never unloads it, or you could use an AppEngine cron job that runs frequently enough to keep your app in-memory. I am sure that Google despises the second option, as that runs against much of the fundamental ideas behind AE, but nevertheless, it is an issue that they and we 9as AE developers) must consider. Here is a [related discussion](https://stackoverflow.com/questions/1113066/how-to-keep-an-app-engine-java-app-running-with-deaf-requests-from-a-java-python)
2,051,036
I posted this on GAE for Java group, but I hope to get some answers here quicker :) I decided to do some long-run performance tests on my application. I created some small client hitting app every 5-30 minutes and I run 3-5 of threads with such client. I noticed huge differenced in response times and started to investigate issue. I found reason very quick. I am experiencing same issues as described in following topics: [Uneven response time between connection to server to first byte sent](http://www.google.com/url?sa=D&q=http://groups.google.com/group/google-appengine/browse_thread/thread/fed86730708f2a9d/c6f13c9c48c08791%3Flnk%3Dgst%26q%3Drequest%2Bresponse%2Btime%23c6f13c9c48c08791&usg=AFQjCNG6U6cscl2n1lsphsSMTIGMlw5wXg) [Application instances seem to be too aggressively recycled](http://groups.google.com/group/google-appengine/browse_thread/thread/7cd20b6fcfd38e5d) [Getting 'Request was aborted after waiting too long to attempt to service your request.' after application idle](http://groups.google.com/group/google-appengine-java/browse_thread/thread/755b7ba89db70213/4b39d900479ba1de?lnk=gst&q=application+instance#4b39d900479ba1de) I am using Springframework, it tkes around 18-20s to start app instance, which is causing response times to take from 1s (when requests hits running app - very rare) to 22s when fresh application is created. Is there any solution for this? I was thinking about creating most basic servlet performing critical tasks (serving API call) and leave UI as is. But then I would loose all benefits of Springframework. Is there any solution for this? After solving (hacking) numerous constrains of App Engine which I hit while developing my app that is the one I think will make me move out of App Engine... that's simply to much to all the time think how to win with GAE problems than how to solve my application problems... Any help? Regards Konrad
2010/01/12
[ "https://Stackoverflow.com/questions/2051036", "https://Stackoverflow.com", "https://Stackoverflow.com/users/86723/" ]
I know of some people having a keep-alive thing running in order to have an instance of their app always running. I mean, have a client that sends a request every X seconds so your app doesn't get recycled. This is a quick thing to implement but seems to go against the spirit of the platform. Make your numbers and check if it is worth it. Another option would be to refactor your application to make use of more lazy-loading than it does at the moment so it doesn't take that long to kick off. I don't know if you have any other option apart from these 2.
in case folks live in AE-land and want a quick-and-dirty keep-alive pinger, this one works like a charm (windows): <http://www.coretechnologies.com/products/http-ping/>
2,051,036
I posted this on GAE for Java group, but I hope to get some answers here quicker :) I decided to do some long-run performance tests on my application. I created some small client hitting app every 5-30 minutes and I run 3-5 of threads with such client. I noticed huge differenced in response times and started to investigate issue. I found reason very quick. I am experiencing same issues as described in following topics: [Uneven response time between connection to server to first byte sent](http://www.google.com/url?sa=D&q=http://groups.google.com/group/google-appengine/browse_thread/thread/fed86730708f2a9d/c6f13c9c48c08791%3Flnk%3Dgst%26q%3Drequest%2Bresponse%2Btime%23c6f13c9c48c08791&usg=AFQjCNG6U6cscl2n1lsphsSMTIGMlw5wXg) [Application instances seem to be too aggressively recycled](http://groups.google.com/group/google-appengine/browse_thread/thread/7cd20b6fcfd38e5d) [Getting 'Request was aborted after waiting too long to attempt to service your request.' after application idle](http://groups.google.com/group/google-appengine-java/browse_thread/thread/755b7ba89db70213/4b39d900479ba1de?lnk=gst&q=application+instance#4b39d900479ba1de) I am using Springframework, it tkes around 18-20s to start app instance, which is causing response times to take from 1s (when requests hits running app - very rare) to 22s when fresh application is created. Is there any solution for this? I was thinking about creating most basic servlet performing critical tasks (serving API call) and leave UI as is. But then I would loose all benefits of Springframework. Is there any solution for this? After solving (hacking) numerous constrains of App Engine which I hit while developing my app that is the one I think will make me move out of App Engine... that's simply to much to all the time think how to win with GAE problems than how to solve my application problems... Any help? Regards Konrad
2010/01/12
[ "https://Stackoverflow.com/questions/2051036", "https://Stackoverflow.com", "https://Stackoverflow.com/users/86723/" ]
What would be good is if we could serialize the `DispatcherServlet` to the memcache, and then deserialize it from the memcache on a cold start if it is there. Then the instantiation of Spring would be really short. `DispatcherServlet` is already marked as `Serializable`, we just need to find a way to serialize the `WebApplicationContext` object that the `DispatcherServlet` contains.
[SDK 1.4.0](http://groups.google.com/group/google-appengine/browse_thread/thread/0f90ef8dda3b8400) has this new feature: > > * Developers can now enable Warmup Requests. By specifying a handler in > an app's appengine-web.xml, App > Engine will attempt to to send a > Warmup Request to initialize new > instances before a user interacts with > it. This can reduce the latency an > end-user sees for initializing your > application. > > >
2,051,036
I posted this on GAE for Java group, but I hope to get some answers here quicker :) I decided to do some long-run performance tests on my application. I created some small client hitting app every 5-30 minutes and I run 3-5 of threads with such client. I noticed huge differenced in response times and started to investigate issue. I found reason very quick. I am experiencing same issues as described in following topics: [Uneven response time between connection to server to first byte sent](http://www.google.com/url?sa=D&q=http://groups.google.com/group/google-appengine/browse_thread/thread/fed86730708f2a9d/c6f13c9c48c08791%3Flnk%3Dgst%26q%3Drequest%2Bresponse%2Btime%23c6f13c9c48c08791&usg=AFQjCNG6U6cscl2n1lsphsSMTIGMlw5wXg) [Application instances seem to be too aggressively recycled](http://groups.google.com/group/google-appengine/browse_thread/thread/7cd20b6fcfd38e5d) [Getting 'Request was aborted after waiting too long to attempt to service your request.' after application idle](http://groups.google.com/group/google-appengine-java/browse_thread/thread/755b7ba89db70213/4b39d900479ba1de?lnk=gst&q=application+instance#4b39d900479ba1de) I am using Springframework, it tkes around 18-20s to start app instance, which is causing response times to take from 1s (when requests hits running app - very rare) to 22s when fresh application is created. Is there any solution for this? I was thinking about creating most basic servlet performing critical tasks (serving API call) and leave UI as is. But then I would loose all benefits of Springframework. Is there any solution for this? After solving (hacking) numerous constrains of App Engine which I hit while developing my app that is the one I think will make me move out of App Engine... that's simply to much to all the time think how to win with GAE problems than how to solve my application problems... Any help? Regards Konrad
2010/01/12
[ "https://Stackoverflow.com/questions/2051036", "https://Stackoverflow.com", "https://Stackoverflow.com/users/86723/" ]
[SDK 1.4.0](http://groups.google.com/group/google-appengine/browse_thread/thread/0f90ef8dda3b8400) has this new feature: > > * Developers can now enable Warmup Requests. By specifying a handler in > an app's appengine-web.xml, App > Engine will attempt to to send a > Warmup Request to initialize new > instances before a user interacts with > it. This can reduce the latency an > end-user sees for initializing your > application. > > >
This is definitely a tricky issue with AppEngine applications. The purists will tell you to look at why your application takes so long to start up and work backwards from there. In your case, the answer is obvious: you are using Spring, and it has to load many class files and instantiate many objects. The pragmatic answer, if you can live without Spring, is to make sure that you app instance stays warm. You can either ping it from an external source frequently enough that AppEngine never unloads it, or you could use an AppEngine cron job that runs frequently enough to keep your app in-memory. I am sure that Google despises the second option, as that runs against much of the fundamental ideas behind AE, but nevertheless, it is an issue that they and we 9as AE developers) must consider. Here is a [related discussion](https://stackoverflow.com/questions/1113066/how-to-keep-an-app-engine-java-app-running-with-deaf-requests-from-a-java-python)
2,051,036
I posted this on GAE for Java group, but I hope to get some answers here quicker :) I decided to do some long-run performance tests on my application. I created some small client hitting app every 5-30 minutes and I run 3-5 of threads with such client. I noticed huge differenced in response times and started to investigate issue. I found reason very quick. I am experiencing same issues as described in following topics: [Uneven response time between connection to server to first byte sent](http://www.google.com/url?sa=D&q=http://groups.google.com/group/google-appengine/browse_thread/thread/fed86730708f2a9d/c6f13c9c48c08791%3Flnk%3Dgst%26q%3Drequest%2Bresponse%2Btime%23c6f13c9c48c08791&usg=AFQjCNG6U6cscl2n1lsphsSMTIGMlw5wXg) [Application instances seem to be too aggressively recycled](http://groups.google.com/group/google-appengine/browse_thread/thread/7cd20b6fcfd38e5d) [Getting 'Request was aborted after waiting too long to attempt to service your request.' after application idle](http://groups.google.com/group/google-appengine-java/browse_thread/thread/755b7ba89db70213/4b39d900479ba1de?lnk=gst&q=application+instance#4b39d900479ba1de) I am using Springframework, it tkes around 18-20s to start app instance, which is causing response times to take from 1s (when requests hits running app - very rare) to 22s when fresh application is created. Is there any solution for this? I was thinking about creating most basic servlet performing critical tasks (serving API call) and leave UI as is. But then I would loose all benefits of Springframework. Is there any solution for this? After solving (hacking) numerous constrains of App Engine which I hit while developing my app that is the one I think will make me move out of App Engine... that's simply to much to all the time think how to win with GAE problems than how to solve my application problems... Any help? Regards Konrad
2010/01/12
[ "https://Stackoverflow.com/questions/2051036", "https://Stackoverflow.com", "https://Stackoverflow.com/users/86723/" ]
I know of some people having a keep-alive thing running in order to have an instance of their app always running. I mean, have a client that sends a request every X seconds so your app doesn't get recycled. This is a quick thing to implement but seems to go against the spirit of the platform. Make your numbers and check if it is worth it. Another option would be to refactor your application to make use of more lazy-loading than it does at the moment so it doesn't take that long to kick off. I don't know if you have any other option apart from these 2.
Use the new [precompilation](http://googleappengine.blogspot.com/2009/12/request-performance-in-java.html) feature. ``` <!-- appengine-web.xml --> <precompilation-enabled>true</precompilation-enabled> ```
2,051,036
I posted this on GAE for Java group, but I hope to get some answers here quicker :) I decided to do some long-run performance tests on my application. I created some small client hitting app every 5-30 minutes and I run 3-5 of threads with such client. I noticed huge differenced in response times and started to investigate issue. I found reason very quick. I am experiencing same issues as described in following topics: [Uneven response time between connection to server to first byte sent](http://www.google.com/url?sa=D&q=http://groups.google.com/group/google-appengine/browse_thread/thread/fed86730708f2a9d/c6f13c9c48c08791%3Flnk%3Dgst%26q%3Drequest%2Bresponse%2Btime%23c6f13c9c48c08791&usg=AFQjCNG6U6cscl2n1lsphsSMTIGMlw5wXg) [Application instances seem to be too aggressively recycled](http://groups.google.com/group/google-appengine/browse_thread/thread/7cd20b6fcfd38e5d) [Getting 'Request was aborted after waiting too long to attempt to service your request.' after application idle](http://groups.google.com/group/google-appengine-java/browse_thread/thread/755b7ba89db70213/4b39d900479ba1de?lnk=gst&q=application+instance#4b39d900479ba1de) I am using Springframework, it tkes around 18-20s to start app instance, which is causing response times to take from 1s (when requests hits running app - very rare) to 22s when fresh application is created. Is there any solution for this? I was thinking about creating most basic servlet performing critical tasks (serving API call) and leave UI as is. But then I would loose all benefits of Springframework. Is there any solution for this? After solving (hacking) numerous constrains of App Engine which I hit while developing my app that is the one I think will make me move out of App Engine... that's simply to much to all the time think how to win with GAE problems than how to solve my application problems... Any help? Regards Konrad
2010/01/12
[ "https://Stackoverflow.com/questions/2051036", "https://Stackoverflow.com", "https://Stackoverflow.com/users/86723/" ]
Use the new [precompilation](http://googleappengine.blogspot.com/2009/12/request-performance-in-java.html) feature. ``` <!-- appengine-web.xml --> <precompilation-enabled>true</precompilation-enabled> ```
in case folks live in AE-land and want a quick-and-dirty keep-alive pinger, this one works like a charm (windows): <http://www.coretechnologies.com/products/http-ping/>
2,051,036
I posted this on GAE for Java group, but I hope to get some answers here quicker :) I decided to do some long-run performance tests on my application. I created some small client hitting app every 5-30 minutes and I run 3-5 of threads with such client. I noticed huge differenced in response times and started to investigate issue. I found reason very quick. I am experiencing same issues as described in following topics: [Uneven response time between connection to server to first byte sent](http://www.google.com/url?sa=D&q=http://groups.google.com/group/google-appengine/browse_thread/thread/fed86730708f2a9d/c6f13c9c48c08791%3Flnk%3Dgst%26q%3Drequest%2Bresponse%2Btime%23c6f13c9c48c08791&usg=AFQjCNG6U6cscl2n1lsphsSMTIGMlw5wXg) [Application instances seem to be too aggressively recycled](http://groups.google.com/group/google-appengine/browse_thread/thread/7cd20b6fcfd38e5d) [Getting 'Request was aborted after waiting too long to attempt to service your request.' after application idle](http://groups.google.com/group/google-appengine-java/browse_thread/thread/755b7ba89db70213/4b39d900479ba1de?lnk=gst&q=application+instance#4b39d900479ba1de) I am using Springframework, it tkes around 18-20s to start app instance, which is causing response times to take from 1s (when requests hits running app - very rare) to 22s when fresh application is created. Is there any solution for this? I was thinking about creating most basic servlet performing critical tasks (serving API call) and leave UI as is. But then I would loose all benefits of Springframework. Is there any solution for this? After solving (hacking) numerous constrains of App Engine which I hit while developing my app that is the one I think will make me move out of App Engine... that's simply to much to all the time think how to win with GAE problems than how to solve my application problems... Any help? Regards Konrad
2010/01/12
[ "https://Stackoverflow.com/questions/2051036", "https://Stackoverflow.com", "https://Stackoverflow.com/users/86723/" ]
I know of some people having a keep-alive thing running in order to have an instance of their app always running. I mean, have a client that sends a request every X seconds so your app doesn't get recycled. This is a quick thing to implement but seems to go against the spirit of the platform. Make your numbers and check if it is worth it. Another option would be to refactor your application to make use of more lazy-loading than it does at the moment so it doesn't take that long to kick off. I don't know if you have any other option apart from these 2.
[SDK 1.4.0](http://groups.google.com/group/google-appengine/browse_thread/thread/0f90ef8dda3b8400) has this new feature: > > * Developers can now enable Warmup Requests. By specifying a handler in > an app's appengine-web.xml, App > Engine will attempt to to send a > Warmup Request to initialize new > instances before a user interacts with > it. This can reduce the latency an > end-user sees for initializing your > application. > > >
2,051,036
I posted this on GAE for Java group, but I hope to get some answers here quicker :) I decided to do some long-run performance tests on my application. I created some small client hitting app every 5-30 minutes and I run 3-5 of threads with such client. I noticed huge differenced in response times and started to investigate issue. I found reason very quick. I am experiencing same issues as described in following topics: [Uneven response time between connection to server to first byte sent](http://www.google.com/url?sa=D&q=http://groups.google.com/group/google-appengine/browse_thread/thread/fed86730708f2a9d/c6f13c9c48c08791%3Flnk%3Dgst%26q%3Drequest%2Bresponse%2Btime%23c6f13c9c48c08791&usg=AFQjCNG6U6cscl2n1lsphsSMTIGMlw5wXg) [Application instances seem to be too aggressively recycled](http://groups.google.com/group/google-appengine/browse_thread/thread/7cd20b6fcfd38e5d) [Getting 'Request was aborted after waiting too long to attempt to service your request.' after application idle](http://groups.google.com/group/google-appengine-java/browse_thread/thread/755b7ba89db70213/4b39d900479ba1de?lnk=gst&q=application+instance#4b39d900479ba1de) I am using Springframework, it tkes around 18-20s to start app instance, which is causing response times to take from 1s (when requests hits running app - very rare) to 22s when fresh application is created. Is there any solution for this? I was thinking about creating most basic servlet performing critical tasks (serving API call) and leave UI as is. But then I would loose all benefits of Springframework. Is there any solution for this? After solving (hacking) numerous constrains of App Engine which I hit while developing my app that is the one I think will make me move out of App Engine... that's simply to much to all the time think how to win with GAE problems than how to solve my application problems... Any help? Regards Konrad
2010/01/12
[ "https://Stackoverflow.com/questions/2051036", "https://Stackoverflow.com", "https://Stackoverflow.com/users/86723/" ]
in case folks live in AE-land and want a quick-and-dirty keep-alive pinger, this one works like a charm (windows): <http://www.coretechnologies.com/products/http-ping/>
This is definitely a tricky issue with AppEngine applications. The purists will tell you to look at why your application takes so long to start up and work backwards from there. In your case, the answer is obvious: you are using Spring, and it has to load many class files and instantiate many objects. The pragmatic answer, if you can live without Spring, is to make sure that you app instance stays warm. You can either ping it from an external source frequently enough that AppEngine never unloads it, or you could use an AppEngine cron job that runs frequently enough to keep your app in-memory. I am sure that Google despises the second option, as that runs against much of the fundamental ideas behind AE, but nevertheless, it is an issue that they and we 9as AE developers) must consider. Here is a [related discussion](https://stackoverflow.com/questions/1113066/how-to-keep-an-app-engine-java-app-running-with-deaf-requests-from-a-java-python)
2,051,036
I posted this on GAE for Java group, but I hope to get some answers here quicker :) I decided to do some long-run performance tests on my application. I created some small client hitting app every 5-30 minutes and I run 3-5 of threads with such client. I noticed huge differenced in response times and started to investigate issue. I found reason very quick. I am experiencing same issues as described in following topics: [Uneven response time between connection to server to first byte sent](http://www.google.com/url?sa=D&q=http://groups.google.com/group/google-appengine/browse_thread/thread/fed86730708f2a9d/c6f13c9c48c08791%3Flnk%3Dgst%26q%3Drequest%2Bresponse%2Btime%23c6f13c9c48c08791&usg=AFQjCNG6U6cscl2n1lsphsSMTIGMlw5wXg) [Application instances seem to be too aggressively recycled](http://groups.google.com/group/google-appengine/browse_thread/thread/7cd20b6fcfd38e5d) [Getting 'Request was aborted after waiting too long to attempt to service your request.' after application idle](http://groups.google.com/group/google-appengine-java/browse_thread/thread/755b7ba89db70213/4b39d900479ba1de?lnk=gst&q=application+instance#4b39d900479ba1de) I am using Springframework, it tkes around 18-20s to start app instance, which is causing response times to take from 1s (when requests hits running app - very rare) to 22s when fresh application is created. Is there any solution for this? I was thinking about creating most basic servlet performing critical tasks (serving API call) and leave UI as is. But then I would loose all benefits of Springframework. Is there any solution for this? After solving (hacking) numerous constrains of App Engine which I hit while developing my app that is the one I think will make me move out of App Engine... that's simply to much to all the time think how to win with GAE problems than how to solve my application problems... Any help? Regards Konrad
2010/01/12
[ "https://Stackoverflow.com/questions/2051036", "https://Stackoverflow.com", "https://Stackoverflow.com/users/86723/" ]
What would be good is if we could serialize the `DispatcherServlet` to the memcache, and then deserialize it from the memcache on a cold start if it is there. Then the instantiation of Spring would be really short. `DispatcherServlet` is already marked as `Serializable`, we just need to find a way to serialize the `WebApplicationContext` object that the `DispatcherServlet` contains.
in case folks live in AE-land and want a quick-and-dirty keep-alive pinger, this one works like a charm (windows): <http://www.coretechnologies.com/products/http-ping/>
2,051,036
I posted this on GAE for Java group, but I hope to get some answers here quicker :) I decided to do some long-run performance tests on my application. I created some small client hitting app every 5-30 minutes and I run 3-5 of threads with such client. I noticed huge differenced in response times and started to investigate issue. I found reason very quick. I am experiencing same issues as described in following topics: [Uneven response time between connection to server to first byte sent](http://www.google.com/url?sa=D&q=http://groups.google.com/group/google-appengine/browse_thread/thread/fed86730708f2a9d/c6f13c9c48c08791%3Flnk%3Dgst%26q%3Drequest%2Bresponse%2Btime%23c6f13c9c48c08791&usg=AFQjCNG6U6cscl2n1lsphsSMTIGMlw5wXg) [Application instances seem to be too aggressively recycled](http://groups.google.com/group/google-appengine/browse_thread/thread/7cd20b6fcfd38e5d) [Getting 'Request was aborted after waiting too long to attempt to service your request.' after application idle](http://groups.google.com/group/google-appengine-java/browse_thread/thread/755b7ba89db70213/4b39d900479ba1de?lnk=gst&q=application+instance#4b39d900479ba1de) I am using Springframework, it tkes around 18-20s to start app instance, which is causing response times to take from 1s (when requests hits running app - very rare) to 22s when fresh application is created. Is there any solution for this? I was thinking about creating most basic servlet performing critical tasks (serving API call) and leave UI as is. But then I would loose all benefits of Springframework. Is there any solution for this? After solving (hacking) numerous constrains of App Engine which I hit while developing my app that is the one I think will make me move out of App Engine... that's simply to much to all the time think how to win with GAE problems than how to solve my application problems... Any help? Regards Konrad
2010/01/12
[ "https://Stackoverflow.com/questions/2051036", "https://Stackoverflow.com", "https://Stackoverflow.com/users/86723/" ]
Use the new [precompilation](http://googleappengine.blogspot.com/2009/12/request-performance-in-java.html) feature. ``` <!-- appengine-web.xml --> <precompilation-enabled>true</precompilation-enabled> ```
[SDK 1.4.0](http://groups.google.com/group/google-appengine/browse_thread/thread/0f90ef8dda3b8400) has this new feature: > > * Developers can now enable Warmup Requests. By specifying a handler in > an app's appengine-web.xml, App > Engine will attempt to to send a > Warmup Request to initialize new > instances before a user interacts with > it. This can reduce the latency an > end-user sees for initializing your > application. > > >
53,347,830
I have a very simple query like this: ``` SELECT Name FROM Users WHERE Age < 20; ``` I want to implement such a feature: * If the result contains no value, return an empty string ''. * If the result contains only 1 value, return the value. * If the result contains more than 1 value, return a constant string 'Multiple'. How can I implement this with a very simple query? Thanks for your help!
2018/11/17
[ "https://Stackoverflow.com/questions/53347830", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10665696/" ]
If there is always going to be a double dash `--` you could do this. ``` s = '-2--1' s.replace('--',' -').split(' ') # ['-2', '-1'] ```
Split on the hyphen that comes after a digit: ``` def splitrange(s): return re.split(r'(?<=\d)-', s) ``` Demo: ``` >>> splitrange('-2--5') ['-2', '-5'] >>> splitrange('-2-5') ['-2', '5'] >>> splitrange('2-5') ['2', '5'] >>> splitrange('2--5') ['2', '-5'] ```
53,347,830
I have a very simple query like this: ``` SELECT Name FROM Users WHERE Age < 20; ``` I want to implement such a feature: * If the result contains no value, return an empty string ''. * If the result contains only 1 value, return the value. * If the result contains more than 1 value, return a constant string 'Multiple'. How can I implement this with a very simple query? Thanks for your help!
2018/11/17
[ "https://Stackoverflow.com/questions/53347830", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10665696/" ]
If there is always going to be a double dash `--` you could do this. ``` s = '-2--1' s.replace('--',' -').split(' ') # ['-2', '-1'] ```
split the numbers: ``` split= str.split('-') ``` Function to apply negations: ``` def actual(ns, minus=False): if not ns: return n, *rest = ns if n == '': yield from actual(rest, not minus) return yield -int(n) if minus else int(n) yield from actual(rest) ``` And now you can actualize: ``` numbers = list(actual(split)) ``` It will also handle multiple negations....
53,347,830
I have a very simple query like this: ``` SELECT Name FROM Users WHERE Age < 20; ``` I want to implement such a feature: * If the result contains no value, return an empty string ''. * If the result contains only 1 value, return the value. * If the result contains more than 1 value, return a constant string 'Multiple'. How can I implement this with a very simple query? Thanks for your help!
2018/11/17
[ "https://Stackoverflow.com/questions/53347830", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10665696/" ]
You could use a regex to find all numbers. ``` >>> import re >>> re.findall(r'-?\d+', '-2--1') ['-2', '-1'] ``` This will work for any characters between numbers. e.g. ``` >>> re.findall(r'-?\d+', '-2---$&234---1') ['-2', '234', '-1'] ``` But it assumes a `-` before a number will make it negative, of course
Split on the hyphen that comes after a digit: ``` def splitrange(s): return re.split(r'(?<=\d)-', s) ``` Demo: ``` >>> splitrange('-2--5') ['-2', '-5'] >>> splitrange('-2-5') ['-2', '5'] >>> splitrange('2-5') ['2', '5'] >>> splitrange('2--5') ['2', '-5'] ```
53,347,830
I have a very simple query like this: ``` SELECT Name FROM Users WHERE Age < 20; ``` I want to implement such a feature: * If the result contains no value, return an empty string ''. * If the result contains only 1 value, return the value. * If the result contains more than 1 value, return a constant string 'Multiple'. How can I implement this with a very simple query? Thanks for your help!
2018/11/17
[ "https://Stackoverflow.com/questions/53347830", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10665696/" ]
You could use a regex to find all numbers. ``` >>> import re >>> re.findall(r'-?\d+', '-2--1') ['-2', '-1'] ``` This will work for any characters between numbers. e.g. ``` >>> re.findall(r'-?\d+', '-2---$&234---1') ['-2', '234', '-1'] ``` But it assumes a `-` before a number will make it negative, of course
split the numbers: ``` split= str.split('-') ``` Function to apply negations: ``` def actual(ns, minus=False): if not ns: return n, *rest = ns if n == '': yield from actual(rest, not minus) return yield -int(n) if minus else int(n) yield from actual(rest) ``` And now you can actualize: ``` numbers = list(actual(split)) ``` It will also handle multiple negations....
53,347,830
I have a very simple query like this: ``` SELECT Name FROM Users WHERE Age < 20; ``` I want to implement such a feature: * If the result contains no value, return an empty string ''. * If the result contains only 1 value, return the value. * If the result contains more than 1 value, return a constant string 'Multiple'. How can I implement this with a very simple query? Thanks for your help!
2018/11/17
[ "https://Stackoverflow.com/questions/53347830", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10665696/" ]
``` import re s = '-1--2' result = [int(d) for d in re.findall(r'-?\d+', s)] ```
Split on the hyphen that comes after a digit: ``` def splitrange(s): return re.split(r'(?<=\d)-', s) ``` Demo: ``` >>> splitrange('-2--5') ['-2', '-5'] >>> splitrange('-2-5') ['-2', '5'] >>> splitrange('2-5') ['2', '5'] >>> splitrange('2--5') ['2', '-5'] ```
53,347,830
I have a very simple query like this: ``` SELECT Name FROM Users WHERE Age < 20; ``` I want to implement such a feature: * If the result contains no value, return an empty string ''. * If the result contains only 1 value, return the value. * If the result contains more than 1 value, return a constant string 'Multiple'. How can I implement this with a very simple query? Thanks for your help!
2018/11/17
[ "https://Stackoverflow.com/questions/53347830", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10665696/" ]
``` import re s = '-1--2' result = [int(d) for d in re.findall(r'-?\d+', s)] ```
split the numbers: ``` split= str.split('-') ``` Function to apply negations: ``` def actual(ns, minus=False): if not ns: return n, *rest = ns if n == '': yield from actual(rest, not minus) return yield -int(n) if minus else int(n) yield from actual(rest) ``` And now you can actualize: ``` numbers = list(actual(split)) ``` It will also handle multiple negations....
53,347,830
I have a very simple query like this: ``` SELECT Name FROM Users WHERE Age < 20; ``` I want to implement such a feature: * If the result contains no value, return an empty string ''. * If the result contains only 1 value, return the value. * If the result contains more than 1 value, return a constant string 'Multiple'. How can I implement this with a very simple query? Thanks for your help!
2018/11/17
[ "https://Stackoverflow.com/questions/53347830", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10665696/" ]
Split on the hyphen that comes after a digit: ``` def splitrange(s): return re.split(r'(?<=\d)-', s) ``` Demo: ``` >>> splitrange('-2--5') ['-2', '-5'] >>> splitrange('-2-5') ['-2', '5'] >>> splitrange('2-5') ['2', '5'] >>> splitrange('2--5') ['2', '-5'] ```
split the numbers: ``` split= str.split('-') ``` Function to apply negations: ``` def actual(ns, minus=False): if not ns: return n, *rest = ns if n == '': yield from actual(rest, not minus) return yield -int(n) if minus else int(n) yield from actual(rest) ``` And now you can actualize: ``` numbers = list(actual(split)) ``` It will also handle multiple negations....
24,825,054
Through an ajax call, I am procuring URLs which I need to use to change the `src` of an `img`. However this is taking time. Meanwhile i need to show loading or something. How do i check whether `$("#img#).attr("src","http:\\fsomething ");` has loaded the image on the page or not?
2014/07/18
[ "https://Stackoverflow.com/questions/24825054", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3840570/" ]
[`chrome.storage.sync.QUOTA_BYTES_PER_ITEM`](https://developer.chrome.com/extensions/storage#property-sync-QUOTA_BYTES_PER_ITEM) specifies the maximum size in *bytes*. In Chrome, JavaScript strings are encoded as UTF-8. A UTF-8 "character" has a variable byte length, it is either 1 or 2. Your string contains "Бетономешалка". The string length is 13, but the byte size is 26. To detect the size of a character, you could use `string.charCodeAt(index)` to get the character code of the string at a specified index. If this number is smaller than 256 (<= 0xFF), then it consists of one byte. Otherwise it will have two bytes. Some other ways to count the number of bytes in a string are listed at [How many bytes in a JavaScript string?](https://stackoverflow.com/questions/2219526/how-many-bytes-in-a-javascript-string).
``` /** * Count bytes in a UTF-8 string's representation. * * @param {string} * @return {number} */ function byteLength(str) { str = String(str); // force string type return (new TextEncoder('utf-8').encode(str)).length; } ```
48,481,671
I'm writing my first app with Kivy and am using Buildozer to deploy the app to Android. Although my app resumes when I switch between applications, if ever I lock my screen, the app does not resume at all. Is there anything that I'm missing? The documentation seems to refer to this problem as a "bug" from previous versions. I'm using Kivy 1.10.0. Here is what I did to handle pause/resume: ``` class MyApp(App): def build(self): return sm def on_pause(self): return True def on_resume(self): return sm ```
2018/01/27
[ "https://Stackoverflow.com/questions/48481671", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8900412/" ]
You may try to use a built-in sbt shell for compiling sbt projects: [![enter image description here](https://i.stack.imgur.com/fxSxM.png)](https://i.stack.imgur.com/fxSxM.png)
From my experience one reason for this kind of errors is if you have opened the output folder in shell or something like this. It looks like sometimes IDEA tries to delete the whole folder and if it can't do that because the folder is used, it mysteriously results in such a error.
13,373,206
Is there a function in gnuplot which returns the number of columns in a csv file? I can't find anything in the docs, maybe someone can propose a custom made function for this?
2012/11/14
[ "https://Stackoverflow.com/questions/13373206", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1564449/" ]
As of gnuplot4.6, you can make a little hack script to do this. It is certainly not the most efficient, but it is pure gnuplot: ``` #script col_counter.gp col_count=1 good_data=1 while (good_data){ stats "$0" u (valid(col_count)) if ( STATS_max ){ col_count = col_count+1 } else { col_count = col_count-1 good_data = 0 } } ``` Now in your main script, ``` call "col_counter.gp" "my_datafile_name" print col_count #number of columns is stored in col_count. ``` This has some limitations -- It will choke if you have a column in the datafile that is completely non-numeric followed by more valid columns for example, but I think that it should work for many typical use cases. ``` print col_count ``` As a final note, you can use the environment variable `GNUPLOT_LIB` and then you don't even need to have `col_counter.gp` in the current directory.
Assuming this is related to [this question](https://stackoverflow.com/q/13371449/1331399), and that the content of *infile.csv* is: ``` n,John Smith stats,Sam Williams stats,Joe Jackson stats 1,23.4,44.1,35.1 2,32.1,33.5,38.5 3,42.0,42.1,42.1 ``` You could do it like this: *plot.gp* ```gnuplot nc = "`awk -F, 'NR == 1 { print NF; exit }' infile.csv`" set key autotitle columnhead set datafile separator ',' plot for [i=2:nc] "< sed -r '1 s/,([^ ]+)[^,]+/,\\1/g' infile.csv" using 1:i with lines ``` Note that the `\1` needs escaping when used within `"` in Gnuplot. Output: ![Data file plot](https://i.imgur.com/mir8t.png)
13,373,206
Is there a function in gnuplot which returns the number of columns in a csv file? I can't find anything in the docs, maybe someone can propose a custom made function for this?
2012/11/14
[ "https://Stackoverflow.com/questions/13373206", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1564449/" ]
Assuming this is related to [this question](https://stackoverflow.com/q/13371449/1331399), and that the content of *infile.csv* is: ``` n,John Smith stats,Sam Williams stats,Joe Jackson stats 1,23.4,44.1,35.1 2,32.1,33.5,38.5 3,42.0,42.1,42.1 ``` You could do it like this: *plot.gp* ```gnuplot nc = "`awk -F, 'NR == 1 { print NF; exit }' infile.csv`" set key autotitle columnhead set datafile separator ',' plot for [i=2:nc] "< sed -r '1 s/,([^ ]+)[^,]+/,\\1/g' infile.csv" using 1:i with lines ``` Note that the `\1` needs escaping when used within `"` in Gnuplot. Output: ![Data file plot](https://i.imgur.com/mir8t.png)
Here is an update and an alternative extended retro-workaround: (of course *gnuplot-only*) **Update:** (gnuplot>=5.0.0, Jan 2015) Since gnuplot 5.0.0, there is the variable `STATS_columns` which will tell you the number of columns of the **first unommented** row. ``` stats FILE u 0 nooutput print STATS_columns ``` **Extended retro-workaround:** (gnuplot>=4.6.0, March 2012) Some time ago, I [learnt](https://stackoverflow.com/q/55188544/7295599) that a correct CSV file should have the same number of columns (i.e. commas) in all rows. So it should be sufficient to "count" the commas in the first uncommented row. That's apparently what gnuplot>=5.0.0 is doing more or less. However, in case you have an "incorrect CSV" with varying columns and you are interested in the minimum and maximum number of columns, you can use the following script, assuming that there are no (doublequoted) strings having a comma inside. Note, row indices are 0-based. **Data:** `SO13373206.dat` ``` 11, 12, 13, 14, 15, 16, 17 21, 22, 23, 24, 25, 26, 27, 28 31, 32, 33, 34, 35, 36, 37, 38, 39 41, 42, 43, 44, 45, 46 ``` **Script:** ``` ### count number of columns (gnuplot>=4.6.0) reset FILE = "SO13373206.dat" countCommas(s) = sum[i=1:strlen(s)] ( s[i:i] eq ',' ? 1 : 0) set datafile separator "\t" # in order to read a row as one string stats FILE u (colCount=countCommas(strcol(1))+1,0) every ::0::0 nooutput print sprintf("number of columns in first row: %d", colCount) colMin = colMax = rMin = rMax = NaN stats FILE u (c=countCommas(strcol(1))+1, \ c<colMin || colMin!=colMin ? (colMin=c,rMin=$0) : 0, \ c>colMax || colMax!=colMax ? (colMax=c,rMax=$0) : 0 ) nooutput print sprintf("minimum %d columns in row %d",colMin, rMin) print sprintf("maximum %d columns in row %d",colMax, rMax) set datafile separator "," # restore separator # ... plot something ### end of script ``` **Result:** ``` number of columns in first row: 7 minimum 6 columns in row 3 maximum 9 columns in row 2 ```
13,373,206
Is there a function in gnuplot which returns the number of columns in a csv file? I can't find anything in the docs, maybe someone can propose a custom made function for this?
2012/11/14
[ "https://Stackoverflow.com/questions/13373206", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1564449/" ]
As of gnuplot4.6, you can make a little hack script to do this. It is certainly not the most efficient, but it is pure gnuplot: ``` #script col_counter.gp col_count=1 good_data=1 while (good_data){ stats "$0" u (valid(col_count)) if ( STATS_max ){ col_count = col_count+1 } else { col_count = col_count-1 good_data = 0 } } ``` Now in your main script, ``` call "col_counter.gp" "my_datafile_name" print col_count #number of columns is stored in col_count. ``` This has some limitations -- It will choke if you have a column in the datafile that is completely non-numeric followed by more valid columns for example, but I think that it should work for many typical use cases. ``` print col_count ``` As a final note, you can use the environment variable `GNUPLOT_LIB` and then you don't even need to have `col_counter.gp` in the current directory.
Here is an update and an alternative extended retro-workaround: (of course *gnuplot-only*) **Update:** (gnuplot>=5.0.0, Jan 2015) Since gnuplot 5.0.0, there is the variable `STATS_columns` which will tell you the number of columns of the **first unommented** row. ``` stats FILE u 0 nooutput print STATS_columns ``` **Extended retro-workaround:** (gnuplot>=4.6.0, March 2012) Some time ago, I [learnt](https://stackoverflow.com/q/55188544/7295599) that a correct CSV file should have the same number of columns (i.e. commas) in all rows. So it should be sufficient to "count" the commas in the first uncommented row. That's apparently what gnuplot>=5.0.0 is doing more or less. However, in case you have an "incorrect CSV" with varying columns and you are interested in the minimum and maximum number of columns, you can use the following script, assuming that there are no (doublequoted) strings having a comma inside. Note, row indices are 0-based. **Data:** `SO13373206.dat` ``` 11, 12, 13, 14, 15, 16, 17 21, 22, 23, 24, 25, 26, 27, 28 31, 32, 33, 34, 35, 36, 37, 38, 39 41, 42, 43, 44, 45, 46 ``` **Script:** ``` ### count number of columns (gnuplot>=4.6.0) reset FILE = "SO13373206.dat" countCommas(s) = sum[i=1:strlen(s)] ( s[i:i] eq ',' ? 1 : 0) set datafile separator "\t" # in order to read a row as one string stats FILE u (colCount=countCommas(strcol(1))+1,0) every ::0::0 nooutput print sprintf("number of columns in first row: %d", colCount) colMin = colMax = rMin = rMax = NaN stats FILE u (c=countCommas(strcol(1))+1, \ c<colMin || colMin!=colMin ? (colMin=c,rMin=$0) : 0, \ c>colMax || colMax!=colMax ? (colMax=c,rMax=$0) : 0 ) nooutput print sprintf("minimum %d columns in row %d",colMin, rMin) print sprintf("maximum %d columns in row %d",colMax, rMax) set datafile separator "," # restore separator # ... plot something ### end of script ``` **Result:** ``` number of columns in first row: 7 minimum 6 columns in row 3 maximum 9 columns in row 2 ```
6,922,891
Given a set of points in the plane `T={a1,a2,...,an}` then `Graphics[Polygon[T]]` will plot the polygon generated by the points. How can I add labels to the polygon's vertices? Have merely the index as a label would be better then nothing. Any ideas?
2011/08/03
[ "https://Stackoverflow.com/questions/6922891", "https://Stackoverflow.com", "https://Stackoverflow.com/users/671013/" ]
``` pts = {{1, 0}, {0, Sqrt[3]}, {-1, 0}}; Graphics[ {{LightGray, Polygon[pts]}, {pts /. {x_, y_} :> Text[Style[{x, y}, Red], {x, y}]}} ] ``` ![enter image description here](https://i.stack.imgur.com/kyRPY.png) To add point also ``` pts = {{1, 0}, {0, Sqrt[3]}, {-1, 0}}; Graphics[ {{LightGray, Polygon[pts]}, {pts /. {x_, y_} :> Text[Style[{x, y}, Red], {x, y}, {0, -1}]}, {pts /. {x_, y_} :> {Blue, PointSize[0.02], Point[{x, y}]}} } ] ``` ![enter image description here](https://i.stack.imgur.com/7oG3v.png) **update:** Use the index: ``` pts = {{1, 0}, {0, Sqrt[3]}, {-1, 0}}; Graphics[ {{LightGray, Polygon[pts]}, {pts /. {x_, y_} :> Text[Style[Position[pts, {x, y}], Red], {x, y}, {0, -1}]} } ] ``` ![enter image description here](https://i.stack.imgur.com/d14to.png)
[Nasser's version (update)](https://stackoverflow.com/questions/6922891/labeling-vertices-of-a-polygon-in-mathematica/6923030#6923030) uses [pattern matching](http://reference.wolfram.com/mathematica/guide/RulesAndPatterns.html). This one uses [functional programming](http://reference.wolfram.com/mathematica/guide/FunctionalProgramming.html). `MapIndexed` gives you both the coordinates and their index without the need for `Position` to find it. ``` pts = {{1, 0}, {0, Sqrt[3]}, {-1, 0}}; Graphics[ { {LightGray, Polygon[pts]}, MapIndexed[Text[Style[#2[[1]], Red], #1, {0, -1}] &, pts] } ] ``` ![enter image description here](https://i.stack.imgur.com/h8QFO.png) or, if you don't like `MapIndexed`, here's a version with `Apply` (at level 1, infix notation `@@@`). ``` pts = {{1, 0}, {0, Sqrt[3]}, {-1, 0}}; idx = Range[Length[pts]]; Graphics[ { {LightGray, Polygon[pts]}, Text[Style[#2, Red], #1, {0, -1}] & @@@ ({pts, idx}\[Transpose]) } ] ``` This can be expanded to arbitrary labels as follows: ``` pts = {{1, 0}, {0, Sqrt[3]}, {-1, 0}}; idx = {"One", "Two", "Three"}; Graphics[ { {LightGray, Polygon[pts]}, Text[Style[#2, Red], #1, {0, -1}] & @@@ ({pts, idx}\[Transpose]) } ] ``` ![enter image description here](https://i.stack.imgur.com/cdAmb.png)
6,922,891
Given a set of points in the plane `T={a1,a2,...,an}` then `Graphics[Polygon[T]]` will plot the polygon generated by the points. How can I add labels to the polygon's vertices? Have merely the index as a label would be better then nothing. Any ideas?
2011/08/03
[ "https://Stackoverflow.com/questions/6922891", "https://Stackoverflow.com", "https://Stackoverflow.com/users/671013/" ]
``` pts = {{1, 0}, {0, Sqrt[3]}, {-1, 0}}; Graphics[ {{LightGray, Polygon[pts]}, {pts /. {x_, y_} :> Text[Style[{x, y}, Red], {x, y}]}} ] ``` ![enter image description here](https://i.stack.imgur.com/kyRPY.png) To add point also ``` pts = {{1, 0}, {0, Sqrt[3]}, {-1, 0}}; Graphics[ {{LightGray, Polygon[pts]}, {pts /. {x_, y_} :> Text[Style[{x, y}, Red], {x, y}, {0, -1}]}, {pts /. {x_, y_} :> {Blue, PointSize[0.02], Point[{x, y}]}} } ] ``` ![enter image description here](https://i.stack.imgur.com/7oG3v.png) **update:** Use the index: ``` pts = {{1, 0}, {0, Sqrt[3]}, {-1, 0}}; Graphics[ {{LightGray, Polygon[pts]}, {pts /. {x_, y_} :> Text[Style[Position[pts, {x, y}], Red], {x, y}, {0, -1}]} } ] ``` ![enter image description here](https://i.stack.imgur.com/d14to.png)
You can leverage the options of `GraphPlot` for this. Example: ``` c = RandomReal[1, {3, 2}] g = GraphPlot[c, VertexLabeling -> True, VertexCoordinateRules -> c]; Graphics[{Polygon@c, g[[1]]}] ``` This way you can also make use of `VertexLabeling -> Tooltip`, or `VertexRenderingFunction` if you want to. If you do not want the edges overlaid, you may add `EdgeRenderingFunction -> None` to the `GraphPlot` function. Example: ``` c = RandomReal[1, {3, 2}] g = GraphPlot[c, VertexLabeling -> All, VertexCoordinateRules -> c, EdgeRenderingFunction -> None, VertexRenderingFunction -> ({White, EdgeForm[Black], Disk[#, .02], Black, Text[#2, #1]} &)]; Graphics[{Brown, Polygon@c, g[[1]]}] ``` ![enter image description here](https://i.stack.imgur.com/YFdS0.gif)
6,922,891
Given a set of points in the plane `T={a1,a2,...,an}` then `Graphics[Polygon[T]]` will plot the polygon generated by the points. How can I add labels to the polygon's vertices? Have merely the index as a label would be better then nothing. Any ideas?
2011/08/03
[ "https://Stackoverflow.com/questions/6922891", "https://Stackoverflow.com", "https://Stackoverflow.com/users/671013/" ]
[Nasser's version (update)](https://stackoverflow.com/questions/6922891/labeling-vertices-of-a-polygon-in-mathematica/6923030#6923030) uses [pattern matching](http://reference.wolfram.com/mathematica/guide/RulesAndPatterns.html). This one uses [functional programming](http://reference.wolfram.com/mathematica/guide/FunctionalProgramming.html). `MapIndexed` gives you both the coordinates and their index without the need for `Position` to find it. ``` pts = {{1, 0}, {0, Sqrt[3]}, {-1, 0}}; Graphics[ { {LightGray, Polygon[pts]}, MapIndexed[Text[Style[#2[[1]], Red], #1, {0, -1}] &, pts] } ] ``` ![enter image description here](https://i.stack.imgur.com/h8QFO.png) or, if you don't like `MapIndexed`, here's a version with `Apply` (at level 1, infix notation `@@@`). ``` pts = {{1, 0}, {0, Sqrt[3]}, {-1, 0}}; idx = Range[Length[pts]]; Graphics[ { {LightGray, Polygon[pts]}, Text[Style[#2, Red], #1, {0, -1}] & @@@ ({pts, idx}\[Transpose]) } ] ``` This can be expanded to arbitrary labels as follows: ``` pts = {{1, 0}, {0, Sqrt[3]}, {-1, 0}}; idx = {"One", "Two", "Three"}; Graphics[ { {LightGray, Polygon[pts]}, Text[Style[#2, Red], #1, {0, -1}] & @@@ ({pts, idx}\[Transpose]) } ] ``` ![enter image description here](https://i.stack.imgur.com/cdAmb.png)
You can leverage the options of `GraphPlot` for this. Example: ``` c = RandomReal[1, {3, 2}] g = GraphPlot[c, VertexLabeling -> True, VertexCoordinateRules -> c]; Graphics[{Polygon@c, g[[1]]}] ``` This way you can also make use of `VertexLabeling -> Tooltip`, or `VertexRenderingFunction` if you want to. If you do not want the edges overlaid, you may add `EdgeRenderingFunction -> None` to the `GraphPlot` function. Example: ``` c = RandomReal[1, {3, 2}] g = GraphPlot[c, VertexLabeling -> All, VertexCoordinateRules -> c, EdgeRenderingFunction -> None, VertexRenderingFunction -> ({White, EdgeForm[Black], Disk[#, .02], Black, Text[#2, #1]} &)]; Graphics[{Brown, Polygon@c, g[[1]]}] ``` ![enter image description here](https://i.stack.imgur.com/YFdS0.gif)
10,955,547
The question says it all. I've ever put indexes for columns that I used on WHERE statements for optimization and help sites scale nicely. I'm talking with my co-worker who says it's best to not put those indexes and leave place for optimization when needed. What do you think it's the best practice here?
2012/06/08
[ "https://Stackoverflow.com/questions/10955547", "https://Stackoverflow.com", "https://Stackoverflow.com/users/425741/" ]
The answer, as always, is "it depends". If the WHERE clause uses a column in such a way that indexing is broken, then why bother? You'll want to rewrite those, if possible. Indexes have to be calculated when you INSERT, so there's a cost to be weighed against querying. If you read mostly, then indexing might make sense. If your database is heavily transactional, indexes will slow down INSERTs. Especially bulk uploads.
I think the best practice here is to put a few indexes in initially, as best-guesses for what indexes will be needed. But after that, you want to actually measure which queries are slow and index those. Maybe your where clauses, or even your entire queries will change as requirements change. This could be as easy as using something that aggregates query time over the course of a day, like [pgfouine](https://github.com/overplumbum/pgfouine). ![enter image description here](https://i.stack.imgur.com/S3ui9.png)
10,955,547
The question says it all. I've ever put indexes for columns that I used on WHERE statements for optimization and help sites scale nicely. I'm talking with my co-worker who says it's best to not put those indexes and leave place for optimization when needed. What do you think it's the best practice here?
2012/06/08
[ "https://Stackoverflow.com/questions/10955547", "https://Stackoverflow.com", "https://Stackoverflow.com/users/425741/" ]
I think the best practice here is to put a few indexes in initially, as best-guesses for what indexes will be needed. But after that, you want to actually measure which queries are slow and index those. Maybe your where clauses, or even your entire queries will change as requirements change. This could be as easy as using something that aggregates query time over the course of a day, like [pgfouine](https://github.com/overplumbum/pgfouine). ![enter image description here](https://i.stack.imgur.com/S3ui9.png)
**No.** It depends on the selectivity of the column. For example, there is no use indexing a column EMPLOYEE.GENDER. Probably not for COLLEGE\_STUDENT.YEAR\_IN\_SCHOOL\_STATUS (4 likely values) either. If there are a few rare values scattered with one or two common values, you could have a partial index. I would definitely index any field used in a query where no value is in more than 10% of the rows.
10,955,547
The question says it all. I've ever put indexes for columns that I used on WHERE statements for optimization and help sites scale nicely. I'm talking with my co-worker who says it's best to not put those indexes and leave place for optimization when needed. What do you think it's the best practice here?
2012/06/08
[ "https://Stackoverflow.com/questions/10955547", "https://Stackoverflow.com", "https://Stackoverflow.com/users/425741/" ]
The answer, as always, is "it depends". If the WHERE clause uses a column in such a way that indexing is broken, then why bother? You'll want to rewrite those, if possible. Indexes have to be calculated when you INSERT, so there's a cost to be weighed against querying. If you read mostly, then indexing might make sense. If your database is heavily transactional, indexes will slow down INSERTs. Especially bulk uploads.
I'd have to say no: It's not a good practice to simply index every column because it happens to appear in a `WHERE` clause. To start with, if you have two columns in a particular `WHERE` clause, you might have a decision as to whether to index both in the same index and which one to be the first column. Just with a single column, the choice of `ASCENDING` or `DESCENDING` in an index could be important. When the same table participates in many queries, and lots of columns in `WHERE` clauses, do you want to have multitudes of indexes with all these columns in various combinations and orders just because the columns appear in a `WHERE` clause? No. I would say that it **is** a good practice to design your indexes **taking into account** which columns are used in a `WHERE` clause, but ultimately, columns which may not appear in the `WHERE` clause but appear in a `JOIN` may be more significant to most of your indexes. You can certainly design some indexes with inspection, but in general, you are going to want to actually profile your processes and see which indexes are actually useful to the bulk of the workload.
10,955,547
The question says it all. I've ever put indexes for columns that I used on WHERE statements for optimization and help sites scale nicely. I'm talking with my co-worker who says it's best to not put those indexes and leave place for optimization when needed. What do you think it's the best practice here?
2012/06/08
[ "https://Stackoverflow.com/questions/10955547", "https://Stackoverflow.com", "https://Stackoverflow.com/users/425741/" ]
The answer, as always, is "it depends". If the WHERE clause uses a column in such a way that indexing is broken, then why bother? You'll want to rewrite those, if possible. Indexes have to be calculated when you INSERT, so there's a cost to be weighed against querying. If you read mostly, then indexing might make sense. If your database is heavily transactional, indexes will slow down INSERTs. Especially bulk uploads.
**No.** It depends on the selectivity of the column. For example, there is no use indexing a column EMPLOYEE.GENDER. Probably not for COLLEGE\_STUDENT.YEAR\_IN\_SCHOOL\_STATUS (4 likely values) either. If there are a few rare values scattered with one or two common values, you could have a partial index. I would definitely index any field used in a query where no value is in more than 10% of the rows.
10,955,547
The question says it all. I've ever put indexes for columns that I used on WHERE statements for optimization and help sites scale nicely. I'm talking with my co-worker who says it's best to not put those indexes and leave place for optimization when needed. What do you think it's the best practice here?
2012/06/08
[ "https://Stackoverflow.com/questions/10955547", "https://Stackoverflow.com", "https://Stackoverflow.com/users/425741/" ]
I'd have to say no: It's not a good practice to simply index every column because it happens to appear in a `WHERE` clause. To start with, if you have two columns in a particular `WHERE` clause, you might have a decision as to whether to index both in the same index and which one to be the first column. Just with a single column, the choice of `ASCENDING` or `DESCENDING` in an index could be important. When the same table participates in many queries, and lots of columns in `WHERE` clauses, do you want to have multitudes of indexes with all these columns in various combinations and orders just because the columns appear in a `WHERE` clause? No. I would say that it **is** a good practice to design your indexes **taking into account** which columns are used in a `WHERE` clause, but ultimately, columns which may not appear in the `WHERE` clause but appear in a `JOIN` may be more significant to most of your indexes. You can certainly design some indexes with inspection, but in general, you are going to want to actually profile your processes and see which indexes are actually useful to the bulk of the workload.
**No.** It depends on the selectivity of the column. For example, there is no use indexing a column EMPLOYEE.GENDER. Probably not for COLLEGE\_STUDENT.YEAR\_IN\_SCHOOL\_STATUS (4 likely values) either. If there are a few rare values scattered with one or two common values, you could have a partial index. I would definitely index any field used in a query where no value is in more than 10% of the rows.
39,309,253
I'm using SVG sprite and referencing fragment identifiers in it for CSS background image. The CSS code looks like this: `background: url(sprite.svg#icon-1);`. It works on Firefox/Win7, Google Chrome/Win7, IE11/Win7, IE10/Win8, Firefox/Android 4.4.2, and Google Chrome/Android 4.4.2. However, it does not work on iOS 9.3.4. [Here is a demonstration on Plunker](http://plnkr.co/edit/oaifzmh2g8pMkPtisyFP?p=preview). (And here is a shorter url for easier accesses for mobile devices: goo.gl/P9xG4E) Is it possible to get iOS working with this method? == Update == On Android 4.4.2, unlike Firefox and Google Chrome, the built-in Android browser does not support the feature.
2016/09/03
[ "https://Stackoverflow.com/questions/39309253", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1091014/" ]
[Can I Use](http://caniuse.com/#feat=svg-fragment) tells us that this is not supported on Safari (Mac or iOS). Also note that it wasn't supported on Android browser up to 4.4.4, which are still quite common, and some other browsers have limitations.
I found [a polyfill](https://github.com/preciousforever/SVG-Stacker/blob/master/fixsvgstack.jquery.js) which fixes WebKit browsers' this issue. And it works for me. Please check its [demonstration](https://github.com/preciousforever/SVG-Stacker/blob/master/examples/tango-icon-theme/devices/stack/stack-demo-jsfix.html) for implementation.
70,740,246
NestJS URI Versioning for HTTP REST applications can be easily enabled when following the docs [here](https://docs.nestjs.com/techniques/versioning). The docs do however not explain how to make URI versioning optional. **Example:** `/api/v1/users` `/api/v2/users` `/api/users` -> should be mapped to v1 to allow existing webhooks to keep working **Question:** How can we make the URI versioning optional in a NestJS REST application so that old versions (without any api version) keep working ?
2022/01/17
[ "https://Stackoverflow.com/questions/70740246", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6853836/" ]
You should use the `VERSION_NEUTRAL` version on `defaultVersion` option like: ```js app.enableVersioning({ type: VersioningType.URI, defaultVersion: [VERSION_NEUTRAL, '1', '2'], }); ``` <https://docs.nestjs.com/techniques/versioning>
**UPDATE:** The following is a hack and results in the global prefix for URI versioning no longer working, please use the accepted answer. **Original Answer:** To make versioning optional, set the versioning prefix to an empty string (default is `v`) and set the versioning string including the prefix explicitly. In `main.ts`: ``` app.enableVersioning({ type: VersioningType.URI, defaultVersion: ['', 'v1', 'v2'], prefix: '', }); ``` In the v1 controller: `@Controller({ path: 'users', version: ['v1', ''] })`