INSTRUCTION
stringlengths
25
999
RESPONSE
stringlengths
0
999
SOURCE
stringlengths
16
38
METADATA
dict
Can i insert a some code in HTML to set android wallpaper This would be my first post ever on stackoverflow.com I have found many many of the answers to my questions but this one question i cannot figure out. I know that it is possible to invoke few android commands via either java code or other html code and was wondering if it is possible for a my website to set an image on my site as their wallpaper on their android phone. To better explain this is what im doing. My website will have say for example 50 images of something and when the user clicks on one of those photos the website will ( if possible ) invoke the android " set as background " Process. Currently it is set to just download to their phone and then the user goes and selects the photo as their wallpaper from their download folder on their phone. Thank You in advance Vick S.
Interesting question. In Android, java runtime environment is what being run inside OS, and in order to execute commands you wish to make, rooting to OS is only way, and this can be done in java. So, if I were in your shoes, I'd drop the idea of rooting command line to android via HTML - but look over onto java side. In other words...yes, it is possible. But, end-users will already have their phone/mobile pre-set to guard against that rooting commands, but to ask for permission from owner. If owner clicked yes, then you are in game. The hardest part about this is the complexity requiring bunches of efforts to code such rooting functions. But, this could something as a starting point, at least? Running Shell commands though java code on Android? Good luck!
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "java, android, html, wallpaper" }
abp backgroundjobmanager and load balancing we are using abp framework for our enterprise application. i am wondering if it's neccessary to replace the default backgrundjob manager when using load balancing for the appservice in an azure environment? would the hangfire integration of abp solve that issue? Thank you and best regards
ABP Framework's default background job manager can only run in a single instance. If that's enough for you, then you can disable background job processing in all instances, except one of them. Or you can create a dedicated application (a simple console app, for example) to process the background jobs while others add jobs to the queue. If you have too many background jobs and want to process them concurrently, you can easily replace with HangFire. Then refer to HangFire documentation to setup a clustered environment. So, yes it should solve the issue.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 0, "tags": "load balancing, aspnetboilerplate, abp" }
Syntax for writing strings spread over multiple lines I have a string in my code and I want it to appear like this: NSString *string = @"The string other part of the string is bellow the last part is in the third line"; That is, in order to make the code more readable, I want to situate the text on several lines. I think I have to write some symbols after the line breaks, but can't remember which ones. What are they? I've searched quite a lot, but I can't a find solution.
NSString *string = @"The string" "other part of the string is bellow" "the last part is in the third line";
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "objective c, string literals" }
Maintaining two Xcode versions in parallel on a Mac Can we maintain two versions of Xcode (like Xcode 3.2 and Xcode 4) in parallel on a single Mac machine?
Yes - this works fine - normally when you install Xcode 4 if you already have an older version of Xcode it gets moved to `/Developer-old` and the new Xcode 4 installation goes in `/Developer`. Many people such as myself do this so that they can have both Xcode 3.x and Xcode 4.x installed at the same time.
stackexchange-stackoverflow
{ "answer_score": 7, "question_score": 5, "tags": "xcode, macos, xcode4" }
Why do electromagnetic waves have the magnetic and electric field intensities in the same phase? My question is: in electromagnetic waves, if we consider the electric field as a sine function, the magnetic field will be also a sine function, but I am confused why that is this way. If I look at Maxwell's equation, the changing magnetic field generates the electric field and the changing electric field generates the magnetic field, so according to my opinion if the accelerating electron generates a sine electric field change, then its magnetic field should be a cosine function because $\frac{d(\sin x)}{dx}=\cos x$.
E and B are in phase for a running plane wave, but are 90 degrees out of phase for a standing wave. !standing waveThis can be easily seen by considering the vector potential, $A(t, x) $. Using $E = \partial_t A$ and $B=\partial_x A$. For $A=sin(\omega t - kx) $ you find that E and B are in phase. For $A=sin(\omega t) sin(kx) $, a standing wave, E and B are out of phase.
stackexchange-physics
{ "answer_score": 4, "question_score": 14, "tags": "electromagnetic radiation" }
Is there a website for redirecting to odd protocols from http? For instance, if you click a URL with the apt: protocol in Ubuntu, it will install a package from your repository: * Install `firefox` As you can see, this doesn't work on StackExchange, despite the URL being there. If you click a link with the about: protocol in Firefox, it can lead to inner workings of your browser: * Browser configuration As you can see, this doesn't work on StackExchange, either. Many websites, forums, etc. only recognize http:// URLs, but there are all kinds of other useful protocols, like news:, mailto:, aim:, etc. However, I can work around this in a sense. Instead of linking to `apt:firefox`, I can link to < which I know will then launch the apt: link: * Install `firefox` Is there a tinyurl-esque website or other workaround that allows creation of http:// URLs that then launch other arbitrary protocol URLs?
I just reminded myself of one possible workaround. TinyURL itself! < <
stackexchange-superuser
{ "answer_score": 1, "question_score": 1, "tags": "web, url, aptitude, about config" }
How to put large binary files into source control without bogging down svn updates To facilitate building a kitchen sink installer for our app we have several large binary files (.Net Framework and SQL Server Express redistributable installers) in our application repository. The problem is that checking the files to make sure they're unchanged and simply grabbing a fresh copy of the trunk are really bogged down because of the size of the files. Is there any way we could either mark the files not to be checked out by default, or to be checked for changes every time we do an update?
If you're having problems with large files that change infrequently, you might consider putting those files in a separate repository. With the Subversion "externals" feature, you can attach this external repository to your main repository so you can, if you like, check out the complete project. But if you don't need the installer files you can choose not to get them, and local repository operations on your code repository won't involve the big files.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "svn, tortoisesvn" }
Launch UIActivity without UIActivityViewController? Was wondering if it's possible to launch a `UIActivity` from my own menu with my own buttons, rather than having to launch a `UIActivityViewController`. I do know that it's possible using `MFMailComposeViewController`, `TWTweetComposeViewController`, etc, but wondering if there is some way that it's all consolidated into `UIActivity` so don't have to use a separate API for each individual `UIActivity`.
This isn't possible, have to use the separate API's for each task to accomplish this.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "iphone, ios, cocoa touch, uiactivityviewcontroller" }
How to concatenate in PHP? Create a variable called fullName and assign it a value equal to the concatenation of the firstName variable, a space, the middleName variable, a space, and the lastName variable. I have : $firstName = "Tony"; $middleName = "Muscles"; $lastName = "Montana"; Why doesn't the following work? $fullName = $firstName." ".$middleName." ".$lastName
Missing the semicolon: $fullName = $firstName.' '.$middleName.' '.$lastName;
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 0, "tags": "php, web, concatenation" }
MPMoviePlayer Controller blackscreen when Status bar hides I am trying to get a videostream to work. My Code works super, it starts playing (fetches the Video From an url provided by Apple Support Sites - the player plays the first four seconds of the Video and then when this little status bar thing wants to automatically hide the player goes blackscreen (with Status bar I mean the indicator of Time, with the fullscreen Button etc.). I cant Post sourcecode right now because I am writing with my iPhone, so I will do that later... Hope That my description helps you to understand and maybe you can help me.
In my .h File: MPMoviePlayerController *mp; In my .m File: NSURL *mediaURL = [NSURL URLWithString:@" mp = [[MPMoviePlayerController alloc] init]; [mp setShouldAutoplay:YES]; [mp setMovieSourceType:MPMovieSourceTypeStreaming]; [mp setContentURL:mediaURL]; [mp setControlStyle:MPMovieControlStyleEmbedded]; [mp setFullscreen:NO]; [mp setScalingMode:MPMovieScalingModeNone]; [mp prepareToPlay]; mp.view.frame=CGRectMake(0, 0, 320, 220); [self.view addSubview:mp.view]; this is working fine :)
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "ios, video streaming, mpmovieplayercontroller" }
Questions about ODE with constant coefficients When we solve the characteristic equation, it is inevitable that sometimes we may have complex roots, and we simply use the Euler formula to expand the solution and take $e^{at}cosbt, e^{at}sinbt$ as the basic solution. But do these two basic solutions still independent from the other $(n-2)$ basic solutions? Is there any possible convenient way to prove using the Wronski determinant?
Yes, they are independent of the others. The proof is the following (informally): First, you prove that your 2 complex conjugate solutions $z$ and $\bar{z}$ are independent from the other solutions. This implies that they span a linearly independent subspace of your space of solutions. Then, any linear combination of $z$ and $\bar{z}$ will belong to that same subspace, and will therefore be independent of all the other solutions. In other words, you can perform local changes of basis in that subspace without losing the linear independence from the other solutions. In particular, the Euler formula provides a change of basis for that subspace, and gives you two new basis functions which are independent from each other (and by the above reasoning also independent from all the other solutions). Cheers!
stackexchange-math
{ "answer_score": 1, "question_score": 0, "tags": "ordinary differential equations" }
PHP store require_once inside variable and execute it later $var = require_once("target.php"); is that possible to store require_once in variable and execute it late? I need to place this into function function foo($path){ if($path !== ""){$path = require_once($path);} do something first... $path//than execute require_once }
The answer is no. When you assign require_once(); to a variable, the variable turns into a boolean with 1 in case the file was included successfully, or 0 otherwise (useless in require_once() as it returns a fatal error if it fails. So, doing: <?php $hello = require_once("./hello.php"); echo $hello; // Prints 1. ?> Anyway, if you create a php file that returns something, as for example: FILE: require.php <?php $hello = "HELLO"; return $hello; ?> In this case, the previous example would be different: <?php $hello = require_once("./require.php"); echo $hello; // Prints HELLO. ?> So, you cannot store the function itself to execute it later, but you can store returned values from the required or included files. Anyway, if you explain better what are you using it for, I maybe able to help you better.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "php" }
How to replace a number in my dataframe (the header also has digits)? I have a tab data-frame as follows where the 1st row and column are headers: Marker DS_123_ DS_246 DS_789 10103 1 1 0 10104 1 1 1 10105 - 1 0 I need to replace the 1s with 2s within the dataset (without changing the headings) I tried using the following code: file1 <- data.frame(lapply(file, function(x) { gsub("1", "2", x) })) Expected output: Marker DS_123_ DS_246 DS_789 10103 2 2 0 10104 2 2 2 10105 - 2 0 The output that I got: X.c.20203..20204..20205..
We can try using apply here: file <- data.frame(apply(file, 2, function(x) { ifelse(x == "1", "2", x) }))
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "r" }
Does it make sense for software developer to use jQuery when learning Javascript? It's often claimed that learning a lower-level language is a good foundation for any new developer. What about an experienced developer (say a C++ or Java guy) learning Javascript? in the same way should he learn using the raw language so he understands what's going on, and learn JQuery later, or use JQuery from the start as 'part of' Javascript?
I think it's worth spending a bit of time working on JavaScript without jQuery so you can appreciate just what jQuery brings you. But most of what you'll be learning in JavaScript (`getElementById` etc.) will be replaced by better jQuery functions, so don't spend too long in pure JavaScript. I guess the important thing to realise is that a lot of what you do in JavaScript is actually just working with the DOM API. The JavaScript language is great, but the DOM API is RUBBISH. jQuery doesn't really abstract the language, just the API. So the distinction isn't between using JavaScript or using jQuery, it's more about using the DOM API vs using jQuery.
stackexchange-stackoverflow
{ "answer_score": 14, "question_score": 16, "tags": "javascript, jquery" }
Probability of two events related to a statement of the form "P implies Q" Let the probability space be $(\Omega,\mathcal{F},\mathbb{P})$. Let For every $\omega \in \Omega$, $P(\omega) \Rightarrow Q(\omega)$ where $P,Q$ are two expressions. Can we claim that $\mathbb{P}(\\{\omega: P(\omega)\\}) \leq \mathbb{P}(\\{\omega: Q(\omega)\\}) $? Notes: 1. $P(\omega) \Rightarrow Q(\omega)$ means "if $P$ then $Q$" or "$P$ is sufficient to conclude $Q$" or "$Q$ is necessary for $P$" 2. A related question is: is $\\{\omega: P(\omega)\\} \subseteq \\{\omega: Q(\omega)\\}$? 3. Example of expressions: $P(\omega)$ can be $ \mathbb{E}_{z_1}[f(z_1,\omega)] \geq 0, \mathbb{E}_{z_2}[f(z_2,\omega)] \geq 0$ where $z_1,z_2$ are independent Guassians. $Q(\omega)$ can be the expression $\mathbb{E}_{z_1}[f(z_1,\omega)] + \mathbb{E}_{z_2}[f(z_2,\omega)] \geq 0$. 4. For a given $\omega$, is there a venn diagram for "$P(\omega)$ implies $Q(\omega)$"?
The claim is correct and immediately follows from your note 2 (which is trivially true: $a\in\\{x|P(x)\\} \iff P(a)=\text{true} \implies Q(a)=\text{true} \iff a\in\\{x|Q(x)\\}$). The Venn diagram for implication is the same as for subset, i.e., the set $\\{x|P(x)\\}$ being contained in the set $\\{x|Q(x)\\}$.
stackexchange-math
{ "answer_score": 2, "question_score": 1, "tags": "probability" }
A good way to do a fast divide in C++? Sometimes I see and have used the following variation for a fast divide in C++ with floating point numbers. // orig loop double y = 44100.0; for(int i=0; i<10000; ++i) { double z = x / y; } // alternative double y = 44100; double y_div = 1.0 / y; for(int i=0; i<10000; ++i) { double z = x * y_div; } But someone hinted recently that this might not be the most accurate way. Any thoughts?
On just about every CPU, a floating point divide is several times as expensive as a floating point multiply, so multiplying by the inverse of your divisor is a good optimization. The downside is that there is a possibility that you will lose a _very_ small portion of accuracy on certain processors - eg, on modern x86 processors, 64-bit float operations are actually internally computed using 80 bits when using the default FPU mode, and storing it off in a variable will cause those extra precision bits to be truncated according to your FPU rounding mode (which defaults to nearest). This only really matters if you are concatenating many float operations and have to worry about the error accumulation.
stackexchange-stackoverflow
{ "answer_score": 26, "question_score": 14, "tags": "c++, performance, math" }
Help with this differential equation $(3x^2y+2xy+y^3)dx + (x^2+y^2)dy = 0$ We have: $(3x^2y+2xy+y^3)dx + (x^2+y^2)dy = 0$ Say $M(x, y) = 3x^2y+2xy+y^3$ and $N(x, y) = x^2+y^2$ We want $M_y = N_x$, but they are not. So we suppose there is a $π(x, y)$ so that $π(x, y)M(x, y)dx + π(x, y)N(x, y)dy = 0$. The method I know is that $π(x, y) = μ(φ(x, y))$ with $φ(x, y)$ given, but in this equation there is no such function given. How can I work this out?
Suppose $(\pi M)_y = (\pi N)_x$, i.e. $$ \pi_yM + \pi M_y = \pi N_x + \pi_x N $$ If we make the simplifying assumption that $\pi_y = 0$ (i.e. $\pi$ is only a function of $x$), we get $$ \frac{M_y-N_x}{N} = \frac{\pi_x}{\pi} $$ from which we get $\pi(x) = e^{3x}$.
stackexchange-math
{ "answer_score": 1, "question_score": 0, "tags": "ordinary differential equations" }
How to set superscript footnote mark in the text body but normalsized in the foot? I want the footnote mark to be superscripted in the text body (e.g. Footnote mark²), but normalsize in the foot, to be shown like: ________________ 2. Some footnote text Also, it would be nice if the mark appeared hanging in the left margin, like ________________ 2. Some footnote text (That is recommended by Bringhurst in his _Elements of Typographic Style_ )
Use the `scrextend` package (part of `KOMA-script`) to customize footnotes. See section 3.14 of the documentation of `KOMA-script` for details about the `\deffootnote` macro. \documentclass{article} \usepackage{scrextend} \deffootnote{0em}{1.6em}{\thefootnotemark.\enskip} \usepackage[english]{babel} \usepackage{blindtext} \begin{document} \blindtext\footnote{\blindtext} \end{document}
stackexchange-tex
{ "answer_score": 17, "question_score": 28, "tags": "formatting, footnotes, indentation" }
How do you find such points? The following is the plot of $y=4x^6+x^5+2x^3-x^4-5x-3$ ![]( There's a point in the red oval where the derivative changes "speed". Before that point the function quickly decreases and after that point the function decreases slowly. How do you find this point?
I think that you may be thrown off by the scale of the picture. It's easier to see what's going on if you zoom in. Here's a plot of the function (red) as well as its first derivative (green). As you can see, the derivative has a local maximum at approximately $x=-0.6$, which is the point that meets your description: > There's a point ... where the derivative changes "speed". Before that point the function quickly decreases and after that point the function decreases slowly. ![enter image description here](
stackexchange-math
{ "answer_score": 2, "question_score": -1, "tags": "calculus, real analysis" }
Does your MMR fall if you dodge a Queue? Your MMR is calculated by your wins/ loses and what ranked you were at the previous season I believe. My question is, does your MMR fall if you dodge a queue for whatever reason when you lose those 3 or 10 LP after you've left?
No your MMR does not drop and it will also not decay from inactivity. Really the only things that affect your MMR are winning and losing. Up until last Season Queue Dodging was used to "troll" the League system by playing into a promotion and then winning one game while dodging the other one. With this trick players were able to reach Diamond MMR while being placed in a Bronze league. Basically, if you dodge you will lose LP but you will gain slightly more LP next game.
stackexchange-gaming
{ "answer_score": 5, "question_score": 3, "tags": "league of legends" }
gauge: rotate the needle i'm building a gauge widget with raphaeljs, starting with < example.. I don't understand what the criteria is for select a particular "center" for the needle: in the first example the center of the needle is [140, 5] and the second is [67, 13]... how the author calculate it? ..and can i place the needle like this !gauge or it's necessary to place it in the middle of the circle/gauge?
Take a look at < The little dot that the gauge pivots on is 67 px right and 13 px down from the top left of the image in this original orientation. That's how you need to slice and measure your image. ("Pivot point" would be a much better way for Raphael docs to explain it than "center point", it's confusing.) You'll want to attach your background to the gauge at about 97, 81, assuming you crop that gauge image right to its edges (~193x193). That's gonna look really cool when it's done ;^)
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "javascript, raphael" }
Why does Torricelli's law seems to fail when water speeds up after I put my finger in a hose? We are taught that the speed of the fluid through a hole in a water filled tank obeys Torricelli law: $v=\sqrt{2gh}$, thus the speed is independent of the size of the hole. Why is it then that making the hole of the end of a hose smaller (for instance, by using my finger) the speed increases? (note, I was told that this is because the situation is different, and what I have is constant pressure from the street, but this is not the case in my house where we have a tank on the roof)
Torricelli's law is just a restatement of the conservation of energy of a non-viscous, non-turbulent and incompressible liquid flow. Thus, the maximum speed that can be obtained by making water flow through a hose (purely by the force of gravity, ie. a tank on the roof) is the formula that is given. The water flows slower when it moves through a hose with a larger diameter because of the turbulence of the flow, reducing it's speed from the ideal limit.
stackexchange-physics
{ "answer_score": 2, "question_score": 0, "tags": "fluid dynamics, fluid statics" }
tdd - how to test whether User.Identity.Name appears in razor view I am trying to unit test a razor view (MVC .NET). I want to test whether the user logged in's name appears on the site. I am not sure how will I do this due to User.Identity.Name - this is a static object, so can't be mocked. Should this static object be set in the test? Is there a nicer way of doing this? Thanks!
You could create create a ControllerContext with a mock HttpContext to return an IPrincipal to your liking. See this post on how to do that: Mocking and HttpContextBase.get_User() The example uses Rhino Mocks, but is easily adaptable to whatever mock framework you are using. Make sure that the fake IPrincipal.Identity.Name returns a string for the name. I can give you an example with FakeItEasy or Rhino Mocks if you think its not clear. You can then assert that the user name placed in the ViewBag or in the ViewModel for your view is equal to the name you let your fake IIdentity return.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "asp.net mvc 3, razor, tdd" }
Customize My Sites on SharePoint 2010 For a project I am working on, our group is hoping to heavily customize the SharePoint 2010 My Sites layout and design. I've done some research and found the following link that explains how Feature Stapling is the suggested way of customizing the look/feel of these pages. Link Unfortunately, it only describes how to replace the Navigation delegate control. We'd like to modify and/or completely remove the profile badge area and replace it with a custom web-part that we develop (see screenshot below). Anybody know how this can be done via Feature Stapling? Any info and/or suggestions would be much appreciated. !Profile Badge in SharePoint 2010
There are two sides to the Personalized Sites; the "My Site" is a site collection owned by the user, and the other features like the Profile Page (Person.aspx) which is in a shared site collection used by all users in the User Profile Store. Since the Person.aspx page is shared, it is a bit easier to customize those after deployment. Feature stapling would be a bit overkill since it is only executed once. Here is an article I wrote for customizing the page in SharePoint Designer: <
stackexchange-sharepoint
{ "answer_score": 1, "question_score": 1, "tags": "sharepoint designer, my site" }
Paraview: Multiple csv files to time series I have multiple CSV files with point-coordinates and, possibly, multiple data values attached to them, i.e., the rows look like x y z data1 data2 ... Is there any possibility to display say 10 of those CSV files in a "time" series in Paraview?
If you managed to of load a single file and plot what you want from it you can try to rename the files. In Paraview, when you have multiple files with the same base name but consecutive enumeration you can plot them over time.
stackexchange-scicomp
{ "answer_score": 1, "question_score": 1, "tags": "visualization, paraview" }
How to use build_query function of Guzzle? I have to pass a query parameters with different values but absolutely equal keys. I found this `\GuzzleHttp\Psr7\build_query();` But it returns only last value. For instance: $array = [ 'test' => '1', 'test' => '2' ] \GuzzleHttp\Psr7\build_query($array); //OR http_query_builder($array); It returns every time string with the last item. Does it possible to do that with PHP? Because the side which will take these parameters just can not do anything in their side so I have to pass parameters with the equal keys.
The problem was not with the specific method used, but with how you filled your array to begin with: $array = [ 'test' => '1', 'test' => '2' ] You can not use the same array _key_ twice; your array only contains _one_ element now, because the second one has overwritten the existing first one under that same key. Make the `test` element _itself_ an array, that contains your two values: $array = [ 'test' => ['1', '2'] ];
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": -2, "tags": "php, laravel, guzzle" }
Download Folder Structure from GitHub A bit of a newbie question. I see a repo on GitHub with a specific folder structure but when I download it I get a different image. What is the issue? FYI the repo is : < Thanks!
I have just cloned a repo with git clone It's alsolutely the same as in the repo, both folder structure and files. UPD: downloaded a zip, it's also just the same. So, try cloning a repo.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "github" }
Excel: Text-Based Multi-Lookup Formula I have a table describing a basic two-way relationship system. For simplicity, I'll just use animals as an example. (My actual spreadsheet is needlessly complicated, and wouldn't be helpful.) I list animals with a unique text name (identifier). Then in another column, I list the animals that are related the animal in the ID column. And finally, I need a column which calculates the relationships in reverse. ![enter image description here]( In order to accomplish this, I'll need to search the entire second column, and produce a list of Animal IDs that contain a certain word in column 2. I know this might be a stretch for an Excel formula, but it would be hugely beneficial if I could keep this out of PowerQuery or VBA for now. (This table won't be very big, maybe 100 rows at most.)
Per my comment: If you're on Excel 2016 or Office 365, you should be able to use TEXTJOIN for this as an array formula, like so: =TEXTJOIN(", ",TRUE,IF(ISNUMBER(SEARCH(A2,$B$2:$B$7)),$A$2:$A$7,"")) Or, if you prefer to use table notation (without the "Unique" column tags): =TEXTJOIN(", ",TRUE,IF(ISNUMBER(SEARCH([@Animal],[Related Animal])),[Animal],"")) Put that formula in cell C2 (and don't forget to confirm it with Ctrl+Shift+Enter to make it an array formula) and then copy down. If you're on an earlier version of Excel, this will require that the results be in separate cells, or you'll need VBA. **NOTE** : Placement of closing parentheses was corrected by OP Giffyguy
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "excel, excel formula, vlookup, excel 2019" }
Does a simple subalgebra have to be an ideal of the larger algebra? A simple Lie Algebra $A$ is defined to only contain the ideals $\\{0\\}$ and $\\{A\\}$ i.e $[A,0] \subset 0$ and $[A,A] \subset A$. However, when this algebra $A$ is a subalgebra of a larger algebra $L$, does someone describing a subalgebra $A$ being 'simple' require that $[L,A] \subset A$ (or still only that $[A,A] \subset A$ as before)? (In other words, does the definition of an 'ideal' change to include all elements in the largest algebra now?) The reason I ask this question, is in the context of semi-simple Lie Algebra decomposition into a direct sum of simple subalgebras. Does this statement alone imply that the simple subalgebras are ideals of the full semi-simple Lie Algebra?
The following facts hopefully clear the fog. * It is possible for a simple Lie algebra $L_1$ to be a sub Lie algebra, but not an ideal, of a bigger simple Lie algebra $L_2$. For example, consider $L_1=\mathfrak{sl}_2$ as a subalgebra of $L_2=\mathfrak{sl}_3$. Obviously $L_1$ is not an ideal, and both the Lie algebras are simple. In fact, a fundamental tool when developing the structure theory of simple Lie algebras is to observe that to each root there is a corresponding copy of $\mathfrak{sl}_2$. * However, when we talk about a direct sum of Lie algebras, $L_1\oplus L_2$, then this alone implies that $[L_1,L_2]=0$. It follows that both $L_1\oplus 0$ and $0\oplus L_2$ are automatically ideals of $L_1\oplus L_2$. * So when we decompose a semi-simple Lie algebra into a direct sum of simple ones, those summands are automatically also ideals by the previous bullet.
stackexchange-math
{ "answer_score": 3, "question_score": 0, "tags": "group theory, representation theory, manifolds, lie groups, lie algebras" }
$[[x,y],z]=[x,[y,z]] \Rightarrow [x,y]=0$? I got the next problem: Let $A$ be a Lie algebra, prove that if the bracket associates $([[x,y],z]=[x,[y,z]]$) then the bracket is zero $([x,y]=0)$. Can't get the result using the properties (alternating, Jacobi identity, anticommutativity), i think that the result is false. Any suggestions? Thanks.
The Lie algebra $N$ formed by strictly upper triangular $3\times 3$ matrices satisfies $$[z, [x, y]]= 0\ \ \ \forall x, y, z\in N.$$ But $[x, y] \neq 0$.
stackexchange-math
{ "answer_score": 3, "question_score": 1, "tags": "lie algebras" }
How do I propose new ideas? If a person uses their own devices to study a subject, that is, their methods deviate from conventionally accepted methods due to lack of knowledge regarding mainstream mathematics, how do they disclose findings, or make minor propositions?
Your best bet may be to find somebody at a local university who works in the same subject and is willing to be a mentor to you. This is easiest if you are a student at that university, but even if you are not, they may be willing if they find your ideas interesting and you do not take too much of their time. You must be willing to study the "conventionally accepted methods": there are likely to be good reasons why your methods are not "conventionally accepted". That said, it is not unheard of for an amateur to come up with some significant new ideas that the professionals have missed.
stackexchange-math
{ "answer_score": 1, "question_score": 4, "tags": "soft question" }
Show simle view from ios module in titanium appcelerator I am new to titanium development and i am developing an iOS module. I just want to know the flow of how i can show the view from ios (xcode development) to the titanium. I read the titanium document for it but it is very unclear and i did not get the good idea. I read there is something TIproxyview and UIview which can be used to show view in titanium but i didn't understand that document. So anyone can please help me. Thank you
Watch this presentation: < and these are the slides: < . I has all you need to get started. Also there's a bunch of Open Source Titanium Modules here: < . Reading the code could help. I agree that the documentation is not great on the Modules side, but at least there's many community developers who can help you out. HTH, R
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "ios, titanium" }
mvc components in codeigniter? in yii i could have mvc components (acts like an own application). could i have this too in codeigniter? eg. in SYSTEM/APPLICATION have a folder called COMPONENTS and in there i put stand-alone applications that would be a part of the application. components like ADDRESS BOOK, MAIL, TWITTER and so on. every component folder has folders like: models, views, controllers, config etc. so a component model extends the application model which in turn extends system's (code igniter) model. the same goes for view and controller. i've already got a lot of these components which i want to use in codeigniter. is it good idea to place them as i said in SYSTEM/APPLICATION/COMPONENTS or is there best practice for this?
You can do this in CodeIgniter using v1.7.2 or 2.0, but using Packages as Billiam suggested would not work and sadly he is just confusing you. You are basically looking for a HMVC architecture and this can be provided with a system called Modular Separation. That works with CodeIgniter 1.7.2 and I have patched it to work with the (still unfinished) CodeIgniter 2.0 branch on the link in the entry.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "model view controller, codeigniter" }
Pandas Transform and add second line between the measurements I am struggeling with transforming a pandas dataframe. df= 0 A -- cm 1 B -- cm2 2 C 69 cm/s 3 D 48 cm/s 4 E 152 ms 5 F 1.05 NaN 6 G 9.15 NaN 7 H -- ms 8 I 8 cm/s 9 J 12 cm/s I want to transform it to: > A A_Unit B B_Unit C C_Unit ... > -- cm -- cm2 69 cm/s ... A to J is a parameter. Conversion to a dataframe with only numbers works very good with df.T.drop(0), but i have actually no clue, how to add the label of the units it's values next to the parameter columns. Maybe someone has a good idea and might help me with this topic. Thanks Thomas
You can stack and transpose since you will always have groupings of two. * * * u = df.set_index(0).stack().to_frame().T u.columns = [ x if y == 1 else f'{x}_Unit' for x, y in u.columns] A A_Unit B B_Unit C C_Unit D D_Unit E E_Unit F G H H_Unit I I_Unit J J_Unit 0 -- cm -- cm2 69 cm/s 48 cm/s 152 ms 1.05 9.15 -- ms 8 cm/s 12 cm/s
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "python 3.x, pandas, numpy" }
CGI scripts for bash commands I'm kinda new to all this, so tell me if I'm doing something totally wrong. I'm doing some gpio stuff with my raspberry pi, and at the moment i'm making something so the gpio pins can be controlled via a web interface. One of the ways I'm doing this is using bash CGI scripts to control the pins, and executing them from the browser. So far the only way I can get this to work involves the browser loading the page "`.../cgi-bin/gpio1.cgi`" etc, which contains the code: #!/bin/bash echo "Content-type: text/html" echo "" ...gpio stuff... This works, but the browser navigates to the blank page created by this script. Is there a way of executing these scripts without leaving the webpage, and so the scripts aren't writing HTML but instead focusing on the actual gpio stuff? Thanks
Try this: #!/bin/bash echo "Status: 204 No Content" ...gpio stuff... HTTP responses must start with a status line; webservers will normally add status "200 Ok" if the CGI doesn't specify one. That status must be accompanied by response body, which will form the new web page. The status you want is `204`, which indicates that the request was satisfied but that there is no response and the browser should stay on the same page. Normally, this would be a response to a `POST` request, not a `GET` request, but it should work anyway. Since a `204` response does not require a response body (in fact, it doesn't permit one), it should not be necessary to output a blank line following the status line, but you might need one if the script takes a long time to run.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "html, apache, bash, cgi, raspberry pi" }
Can't post feedback, but can post answers; or, how to address a problem with an existing answer? I just created an SO account to offer some feedback to this answer to this question. Although I can apparently post a whole answer, or even _edit_ others' answers (okay, it's moderated, but still), I can't post feedback to the one answer on that page I wanted to. I don't have anything to add further to the other answers already posted, but I wanted to post a likely explanation as to why the poster of the linked answer didn't get a flush. (The calls to flush and close lack parens, so all you get is a reference to the function, not an invocation of it.) The tips popup for the answers makes it clear that answers should answer the OP, not address other answers. I don't want to edit the answer at hand (even if it would be accepted), because it's not my post. Can I do anything, or should I wait until I've built up enough reputation?
I do agree with the OP. There shouldn't be a barrier to posting comments. It's easy to say "well just answer some questions and get 50 rep" but when you're faced with a question that you need to ask for clarification about, or if you want to post a helpful but not complete-answer comment, you can't just poof 50 rep into existence on demand. You have to find multiple questions you're capable of answering, and hope you get enough up-votes from them, and by that time, you might have forgot about the comment you wanted to make.
stackexchange-meta
{ "answer_score": 1, "question_score": 5, "tags": "support, reputation, comments, privileges" }
NSTimer is pausing a while when UIGesture action performed NSTimer is pausing a while an then again it is starting when UIGesture action performed. I am developing an iOS application where I have to trigger the NSTimer repeatedly for every 0.5 seconds and based on that timer I'm moving a song progress bar. And also handling touch events when user touching on some images which I kept on the same view. I am seeing when user touches the images, the timer for moving the progress bar is stopping a little while and continues again. Are there any problem that we can't handle timer and touch events at the same time in the same view? My code for timer myTimer = [NSTimer scheduledTimerWithTimeInterval:timeinterval target:self selector:@selector(updatplayer:) userInfo:nil repeats:YES]; [[NSRunLoop mainRunLoop] addTimer:myTimer forMode:NSRunLoopCommonModes];
This is a common issue with NSTimer. While you can play with run loop modes to improve things, a nicer solution is to switch to GCD timers. See RNTimer for an example. See the docs on dispatch_source_create for more information.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 2, "tags": "objective c, ios" }
VB6 Dynamic Array Determination In VB6 you can declare an array statically and dynamically. When an array is declared dynamically, is it possible to determine if the array was declared dynamic and therefore would possibly need a "redim" before it can be used? i.e. I'm looking for something like: if myarray is dynamic then redim ... end if myarray(x) = y
Use this code Private Sub Command1_Click() Dim A() As Double Dim B() As Double ReDim B(4) If (Not A()) = -1 Then MsgBox "Empty" If (Not B()) = -1 Then MsgBox "Empty" End Sub (Not ArrayName()) returns a -1 if it is empty.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "arrays, vb6, dynamic" }
recursively looping through each value in deps I am having difficulty looping through each value in deps..currently am able to loop only once.i have the expected output below..can anyone provide inputs on how to change to loop to get the expected output below? ''' EXPECTED OUTPUT:- external_dep = { '253036': ['12345','34567'], '12345': [], '34567': ['99999'] '99999': [] } ''' def findexternaldep(num): if num == '253036': output =['12345','34567'] if num == '12345': output = [] if num == '34567': output = ['99999'] if num == '99999': output = [] return output master_gerrit = ["253036"] external_dep={} for num in master_gerrit: deps=findexternaldep(num) #print deps external_dep[num] = deps #loop should be repeated for each value in the list deps print external_dep
Currently there is no recursion. Instead of a loop you need a function that you call recursively. Something like this: external_dep={} def handle_gerrit(num, external_dep): deps=findexternaldep(num) external_dep[num] = deps for num in deps: handle_gerrit(num, external_dep) handle_gerrit("253036", external_dep) print external_dep
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "python" }
Can you get a bound GAS script from the File? I have a google form (copied from template) that has a bound script. I want to set a form submit trigger on that script, but I cannot figure out if I can get the script when all I have is the file/form. Maybe it's not possible, or maybe there's an easy answer. I just spent the last hour trying to find something in the documentation or here on the forum. I guess the next question will be whether I can give the script permission to run programmatically - I think the answer is no, but If you know, give me a quick tip so I can start barking up another tree. If you know, could you help me? thank you!
I wasn't sure if this is what you wanted. You can make sure if the script is present by opening the script editor from Tools> Script editor on the form builder page. From there you can set up the trigger as in the screenshot. < Let me know if this wasn't what you were looking for and if possible, share the form with the "Add collaborators" button to better see this. EDIT: This should help. Form triggers) To attach it to the form. You'll still need to be in a script editor and run the function that performs this `ScriptApp.newTrigger('myFunction') .forForm('1234567890abcdefghijklmnopqrstuvwxyz') .onFormSubmit() .create()`
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "google apps script, google forms" }
Is the system $y[n]=x[n]+2=T\{x[n]\}$ an LTI-System? Is the system $y[n]=x[n]+2=T\\{x[n]\\}$ an LTI-System? Linearity: $ \alpha \cdot T\\{x_1[n] \\} + \beta \cdot T\\{x_2[n] \\} = T\\{\alpha \cdot x_1[n]\ + \beta \cdot x_2[n] \\} \\\\\alpha \cdot (x_1[n]+2) + \beta \cdot(x_2[n]+2)= \alpha \cdot (x_1[n]+2) + \beta \cdot(x_2[n]+2)$ Time-Invariance: $y_1[n] = y[n-n_0] = x[n-n_0]+2 \\\ x_2[n]= x_1[n-n_0]\\\ y_2 [n]=T\\{x_2[n ]\\}= x[n-n_0]+2 \\\y_1[n]=y_2[n]$ So I would say it is an LTI-System, is that right?
A system that adds a constant is rarely linear. If you have two inputs $x_1$ and $x_2$, each one gets the constant, so their combination get the constant two times. While the input $x_1+x_2$ gets the constant only once.
stackexchange-dsp
{ "answer_score": 0, "question_score": 2, "tags": "linear systems" }
Poor look of a gtkmm program I'am writing with my friends a simple photo viewer in C++ using gtkmm. Everything goes quite well, except that our app is looking very poor and completely diffrent from any other GTK+ application on ours Linux desktops. If anyone could give us some advice about what are we doing wrong, we will be very grateful. Code responsible for creating the window is here (the rest is in the repository): < Screenshot with the look: ![Screenshot with the look]( Any help would be apprecieated, thanks in advance!
GTK 3.0 has a different theming than GTK 2.0. Probably any of your other GTK+ applications still depend on 2.0 so you don't have set a theme for 3.0. Find out how to set it to e.g. Adwaita in your desktop environment. Btw: have a look at `Glib::RefPtr<>`.
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 4, "tags": "c++, gtk, gtk3, gtkmm, gtk2" }
aspx page gives viewstate error I have a simple aspx page with one grid view. When deployed on server, and accessed through that machine, it works fine. However, when connected through load balancer, we get this error ( when click on any button). The page however refreshes when pressed F5. Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machineKey> configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster. Any idea what is happening here???
Added enableViewStateMAC = false on the page directive
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "asp.net, viewstate" }
Lipschitz-continuity of matrix-valued function I would like to show the Lipschitz-continuity of a matrix-valued function $\sigma$. Suppose $\sigma:\mathbb{R}^d\to\mathbb{R}^{d\times d}, \beta\mapsto \sqrt{\phi(\lVert \beta \rVert_2)}I_{d\times d} $ where the function $$ \mathbb{R}\to\mathbb{R}, z\mapsto \sqrt{\phi(z)} $$ is Lipschitz-continuous. I would like to show Lipschitz-continuity in the respective $\lVert \cdot \rVert_2$-norms. But for $x, y \in \mathbb{R}^d$ we have $$ \lVert \sigma(x)-\sigma(y) \rVert_2 = \max\\{|\lambda| : \lambda \mathrm{~eigenvalue~of~} (\sigma(x)-\sigma(y)(\sigma(x)-\sigma(y)^T\\} = \sqrt{ | \phi(\lVert x \rVert_2) - \phi(\lVert y \rVert_2)|}. $$ I don't see, how the Lipschitz-continuity of $\sqrt{\phi(z)}$ is helping me, but the author seems to use it to conclude the L-cont. of $\sigma$. Could someone explain? Thanks a lot!
By the Lipschitz-continuity of $\sqrt{\phi}$ there is some $L>0$ with $$|\sqrt{\phi(s)}-\sqrt{\phi(t)}|\leq L|s-t|$$ for all $s,t\in\Bbb R$. Hence we get for $x,y\in\Bbb R^d$ by the reverse triangle inequality: $$\|\sigma(x)-\sigma(y)\|=|\sqrt{\phi(\|x\|_2)}-\sqrt{\phi(\|y\|_2)}|\leq L\big|\|x\|_2-\|y\|_2\big|\leq L\|x-y\|$$ Hence $\sigma$ is Lipschitz-continuous. (Basically the composition of Lipschitz-continuous functions is again Lipschitz-continuous, here we have the functions $\Bbb R^d\to\Bbb R,x\mapsto\|x\|$, $\Bbb R\to\Bbb R,r\mapsto\sqrt{\phi(r)}$ and $\Bbb R\to\Bbb R^{d\times d},s\mapsto sI$.)
stackexchange-math
{ "answer_score": 1, "question_score": 0, "tags": "real analysis, matrix calculus, lipschitz functions" }
Show that $Y \cup Y'$ is well-ordered if and only if it is totally ordered. Let $X$ be a partially ordered set, and let $Y$ and $Y'$ be well-ordered subsets of $X$. Show that $Y \cup Y'$ is well-ordered if and only if it is totally ordered. Suppose $Y \cup Y'$ is totally ordered, and consider $A \subset Y \cup Y'$. $A$ is either a subset of $Y$ or $Y'$ or the union of both. In the first two cases, we can easily see that it has a minimal point. In the last case, we have that $A = T \cup T'$ for $T\subset Y$ and $T' \subset Y'$. $T \cup T' = T \cup (T'\setminus T)$. We know that $T$ and $(T'\setminus T)$ both have a minimal point, and let us call each one $t$ and $t'$, respectively. Then, the minimal point of $A$ exists and it must be either $t$ or $t'$. Since $Y \cup Y'$ is totally ordered, $t \le t'$ or $t' \le t$, so we can pick one. I am struggling with the other direction, and I am not so sure why $Y \cup Y'$ cannot be partially ordered. Any help would be appreciated.
What you missed here is that any well-ordered subset $T$ is automatically totally ordered : indeed, for two elements $t,t'$ in $T$ consider the subset $\lbrace t,t' \rbrace$ of $T$ : it has a minimum element by the well-ordering property.
stackexchange-math
{ "answer_score": 1, "question_score": 0, "tags": "elementary set theory" }
How to examine api without documentation? I have to use an API for my android app without any documentation. Before in my work I always had documentation, so this is a new situation for me. Backend developers said their api supports option requests. How to send option request? Using browser or what? And how to find out what I should put in POST requests' bodies? Thanks for your help in advance!
You can issue an `OPTIONS` request (which is an HTTP method like GET or POST) like so with, say, `curl`: curl -X OPTIONS -i or Postman. However, OPTIONS is designed only to reply with the _methods_ a particular endpoint accepts: _I can do GET and POST_. It would be rather irregular for it to respond with an _expected data structure_ , but nothing is impossible.
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 1, "tags": "android, json, api, http options method" }
How to be sure a http request is local when using HttpListener I'm using `HttpListener`. However, I only want to process requests that come locally, not from another machine/server. How would I programmatically verify if an incoming request is local for sure? Would I need to use some of the `HttpListenerRequest` members?
Check with `RemoteEndPoint` property if the remote address of the request equals `127.0.0.1`.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 2, "tags": ".net, http, httplistener, httplistenerrequest" }
why lib/pp.rb requires lib/pp/room which does not exist I am trying to create gem using bundler. This gem requires pp gem to make 'pretty print'. I have require 'pp' at the top of the source and after that I use pp where needed. However, a runtime error occurs. D:/PRJ/git/smde/vendor/bundle/ruby/2.5.0/gems/pp-0.1.1/lib/pp.rb:1:in `require': cannot load such file -- pp/room (LoadError) There is no room file in lib/pp directory in pp gem. Why? What is more interestingly, pp gem works well when I start my gem scripts directly, i.e. "ruby myscript.rb". The lack of pp/lib/room is not essential.
The "pp" gem is not required for using pretty print. That gem is related to Campfire, which does have the concept of a room. See < Pretty print is available to you without requiring anything: notice if you run irb, you can immediately type pp "something" And it will print as you want.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 2, "tags": "ruby, rubygems, bundler, perl packager" }
arraylist not work as expected i have 2 arraylist ArrayList<List<Integer>> main = new ArrayList<>(); ArrayList<Integer> sub=new ArrayList<>(); sub.add(1); sub.add(2); main.add(sub); sub.clear(); sub.add(5); sub.add(6); sub.add(7); main.add(sub); now i expect main to be what i expect main-->[[1,2],[5,6,7]] ; but really main-->[[567],[567]]; i think sub array share reference ..so how can i make main as [[1,2],[5,6,7] i can't create sub1 ,sub2,...because actually i do this inside huge loop
You were modifying the list and adding it one more time, so that's why [567] appeared twice. I suggest you change code as following: ArrayList<List<Integer>> main = new ArrayList<>(); ArrayList<Integer> sub = new ArrayList<>(); sub.add(1); sub.add(2); main.add(sub); sub = new ArrayList<>(); sub.add(5); sub.add(6); sub.add(7); main.add(sub);
stackexchange-stackoverflow
{ "answer_score": 6, "question_score": 2, "tags": "java, arraylist" }
Tags inside <button> clickable even if button is disabled - Webkit only Here is a fiddle to prove my point. When I use `$(document).on("click"....)`, I can still click on tags inside a disabled button. This behavior does not occur with `$("button").click(`.. FIDDLE Can someone explain this discrepancy? Is it a bug, or a feature of jQuery? Edit: The workaround I have come up with: $(document).on("click", "button > *", function() { if ( $(this).parent().is(":disabled") ) { return false; } }); ​
This must have been a bug with JQuery 1.7.1. If you move to 1.7.2 or 1.8, it goes away.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 2, "tags": "jquery, button, webkit, tags" }
Can IOS be upgraded on a Cisco Catalyst 6509 switch without downtime? There's this Cisco Catalyst 6509 switch with 2 (two) supervisor modules; one of them is active, the other is (almost always) in standby. We need to upgrade IOS; current version is 12.2.something (I can check exactly which one, if this does matter). Can this be done without service interruption? Something like "upgrade the standby supervisor, activate it, upgrade the other one"?
You want to do a Enhanced Fast Software Upgrade (eFSU). It is supported in versions 12.2(33)SXI and later. <
stackexchange-serverfault
{ "answer_score": 2, "question_score": 3, "tags": "cisco, ios" }
Finding folders I want to find how much folders are in folder or I should say how much SubFolreds are in folder. So, how I should do that??? P.S. I'm programing with Delphi
In addition to the FindFirst trick, you'll need to use recursion, if you want to count all folders in the tree (i.e. all levels) and not just the immediate folder. Here is a short example of the recursive approach, looks to be exactly what you're looking for. Hint: the Find() method is used recursively. Recursive Search example at DelphiTricks.com
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 0, "tags": "delphi, count, directory" }
sp_executesql Expects statement... Well, I give it to it I'm having an issue with this procedure. Here's the code declare @sql nvarchar(4000) set @sql = N'SELECT @resp2 = count(*) from '+ @NameTable + ' where datum = ''1'' or datum = ''2'' ' EXEC sp_executesql @query = @sql, @params = N'@resp2 INT OUTPUT', @resp2 = @resp2 OUTPUT > "Procedure expects parameter '@statement' of type 'ntext/nchar/nvarchar'." Am I not giving the statement? (@sql) All I want to do is set a value to @resp2 in the execution.
According to the manual.aspx "sp_executesql \(Transact-SQL\)"), you should provide a value for the parameter called **`@statement`** , but you are supplying it as `@query`. So it should be: declare @sql nvarchar(4000) set @sql = N'SELECT @resp2 = count(*) from '+ @NameTable + ' where datum = ''1'' or datum = ''2'' ' EXEC sp_executesql **@statement** = @sql, @params = N'@resp2 INT OUTPUT', @resp2 = @resp2 OUTPUT Just follow the manual, and you'll be okay.
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 1, "tags": "sql server" }
Get MIME type of an ALAsset Is there a way how to get MIME type for ALAsset? There is a nice method for metadata: NSDictionary *data = [[asset defaultRepresentation] metadata]; But that doesn't contain MIME type data...
ALAssetRepresentation *rep = [asset defaultRepresentation]; NSString* MIMEType = (__bridge_transfer NSString*)UTTypeCopyPreferredTagWithClass ((__bridge CFStringRef)[rep UTI], kUTTagClassMIMEType); This will give you the MIME type. You need to add MobileCoreService framework and import `<MobileCoreServices/MobileCoreServices.h>`
stackexchange-stackoverflow
{ "answer_score": 15, "question_score": 4, "tags": "ios, mime types, alasset" }
R: Merge of rows in same data table, concatenating certain columns I have my data table in R. I want to merge rows which have an identical `customerID`, and then concatenate the elements of other merged columns. I want to go from this: title author customerID 1 title1 author1 1 2 title2 author2 2 3 title3 author3 1 to this: title author Group.1 1 title1, title3 author1, author3 1 2 title2 author2 2
The `aggregate` function should help you in finding a solution: dat = data.frame(title = c("title1", "title2", "title3"), author = c("author1", "author2", "author3"), customerID = c(1, 2, 1)) aggregate(dat[-3], by=list(dat$customerID), c) # Group.1 title author # 1 1 1, 3 1, 3 # 2 2 2 2 Or, just make sure you add `stringsAsFactors = FALSE` when you are creating your data frame and you're pretty much good to go. If your data are already factored, you can use something like `dat[c(1, 2)] = apply(dat[-3], 2, as.character)` to convert them to character first, then: aggregate(dat[-3], by=list(dat$customerID), c) # Group.1 title author # 1 1 title1, title3 author1, author3 # 2 2 title2 author2
stackexchange-stackoverflow
{ "answer_score": 14, "question_score": 11, "tags": "r, merge, concatenation" }
Error: "binary literals are not supported at this language level " I am using JDK 1.7 and getting the error "binary literals are not supported at this language level" when I attempt to use expressions such as: int x = 0b000001; I thought binary literals were supported by 1.7?
Solution in Intellij 13.2 and similar: Select menu choice `File/Project Structure`. The following dialog appears: !enter image description here Set **Project language level** to be what is needed (7.0 for binary literals).
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 2, "tags": "java, intellij idea, literals" }
Sort and toggle table columns with jQuery I would like to enable user to choose which columns in table are visible, and it what order. How can I mix sortable/draggable or other plugins to achieve this? Any help would be great. It would be nice if user settings could be saved and re-read with jQuery cookie plugin, which I use.
I've solved this problem like this: Make a form with checkboxes of available columns, and make form fields sortable. After a form submit I have clear list of columns to display along with order.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "jquery, jquery ui sortable, jquery ui draggable" }
Java endsWith() not working as expected I'm probably just overlooking something obvious, but I can't for the life of me figure out why this section of code is not working. if(txtFileLocation.toString().toLowerCase().endsWith(".twn")){ file = new File(txtFileLocation.getText()); } else { file = new File(txtFileLocation.getText() + ".twn"); System.out.println(txtFileLocation.getText() + " didn't end in .twn, so appending it"); } System.out.println(file.getPath()); The output is as followers: C:\temp\netprimaries1.twn didn't end in .twn, so appending it C:\temp\netprimaries1.twn.twn Why doesn't endsWith(".twn") return true?
Probably because you are calling `toString` and not `getText` in the `if` statement.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "java" }
Changing value in structure Why is this code below legal Point point = new Point(); point.X = 6; point.Y = 5; but this generates error? myButton.Location.X = 6; myButton.Location.Y = 5; I know that structs are value type, we get copy, so we cannot modify `Location.X` indirectly and we have to assign to `myButton.Location` a whole new struct as `new Point(6,5)`, but why does `point.X = 6` work? I don't get the difference.
> but why point.X = 6 works? Because `point` is a variable. You're just modifying one part of the value of the variable. That's allowed and useful (although I'd personally steer away from using mutable value types wherever possible). So for example, you can write: Point point = myButton.Location; point.X = 6; myButton.Location = point; ... and that will effectively just change the value of `X` for `myButton.Location`. Changing part of a value which is copied and then lost is _not_ useful.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "c#, types, struct" }
Weka: Convert Nominal to Numeric When I imported a CSvfile in Weka, it reads some numeric variable as Nominal Type. I would like to convert them to Numeric but Im not seeing any option in Weka. I tried to open the .arff file using Notepad and Notepad++. I remove the variables and change it to numeric example: @attribute thours {' ',18,4,48,42,56,35,40,30,14,54,24,36,20,77,25,70,0,16,34,60,64,21,32,6,84,23,31,52,28,50,66,45,12,10,33,11,22,98,8,3,65,72,9,26,15,63,5,27,51,39,105,7,2,58,43,90,68,46,44,47,112,49,91,37,1,41,104,78,96,75,74,62,71,76,89,13,38,19,29,59,92,81,55,57,53,67,80,102,100,17} to @attribute thours numeric and save the file. when i imprted the fiel again, Im getting an error "...not recognized as an 'Arff data files' file. reason: numebr expected, read Token ], line 78" Any help is greatly appreciated. Thanks. Dixi
**I believe the reason for your error is that one or more entries of the variable, "thours", is missing.** This is represented in the attribute description as the single quotes. If those values are indeed supposed to be missing, you should change it to the format Weka expects in a ".arff", which is a question mark "?". This link provides a very detailed description of ".arff" files, and what is expected in them.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "weka, numeric" }
MySQL check incoming hostname (Linux) I have a user that needs access to the database. I set him up a user but he is telling me what his host name is and I added that host name for the username, but he cannot connect. I think there may be some disconnect and was hoping there may be a way to see which hostname is coming thru. He is connecting to our network via VPN so I think something may be changing with the host name. Thanks
In light of "MySQL said: Can't get hostname for your address" in your comment, this must be related to VPN configuration then. You or your network admin should be able to tell what is your box's hostname on the private network and that should be used as host in the MySQL user table. Turning off name resolving for the MySQL server might also help: MySQL error: Can't get hostname from your ip address
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "mysql, linux" }
Image overlay with matrix I have an image (png) that I want to put underneath a heatmap(so to speak) made from a and a 2D matrix of values 0-1. So the intensity of the spot would be decided by how large the value in the matrix is. I can use imshow(matrix) but that completely draws over the image underneath. Is it possible to perhaps, not draw any pixels with matrix values <.05 or some other way to make this work?
Here is an example of overlaying a binary heatmap on top of a color image: %# some image I = im2double( imread('peppers.png') ); %# I create here a random mask (gaussian centered in middle of image) [r,c,~] = size(I); [X Y] = meshgrid(1:r,1:c); Z = mvnpdf([X(:) Y(:)], [r c]./2, diag(15.*[r c])); Z = (Z-min(Z(:)))./range(Z(:)); Z = reshape(Z',[c r])'; %# show image and mask separately subplot(121), imshow(I) subplot(122), imshow(Z) %# show overlayed images figure, imshow(I), hold on hImg = imshow(Z); set(hImg, 'AlphaData', 0.6); %# also we can specify a colormap colormap hsv !enter image description here !enter image description here !enter image description here
stackexchange-stackoverflow
{ "answer_score": 8, "question_score": 6, "tags": "matlab, matlab figure" }
How does vmware easy install work? With VMWare Workstation Easy Install you can install an OS without any input. How does it do this? Is the support for this built into the OS, or does vmware do some magic to automatically select the correct options?
The support is built into the OS. For example, in the case of Windows guests, VMware generates a floppy disk image containing a `txtsetup.oem` and some other files used for Windows' unattended-installation feature.
stackexchange-stackoverflow
{ "answer_score": 15, "question_score": 11, "tags": "vmware" }
Group of order $pq$ (both primes) where $p\nmid q-1,~q\nmid p-1$ This little number theory problem came from an application of Sylow theorem which said for groups of order $pq$, where $p,~q$ are primes and $p\nmid q-1,~q\nmid p-1$. Then $G$ is cyclic. By Sylow III Thm, $n_p=pk+1\mid pq$, but why this implies $n_p=1$? I can't see the clear reason.
There is a stronger consequence of the Sylow theorems. If $n = p^Rm$ with $n$ the order of $G$ and $p \not | m$, then the amount of $p$-Sylows of $G$ which I will note $n_p$ is $1$ modulo $p$ **and** $n_p | m$. In this case, we get that $n_p | q$ and so in particular either $n_p = q$ or $n_p = 1$. The former is impossible by hypothesis: if $n_p = pk + 1 = q$, then $q-1 = pk$ and so $p | q-1$. > Hence there is a unique $p$-Sylow. By symmetry there is a unique $q$-Sylow. Both are normal, disjoint, and their product contains at least $pq$ elements: it must be the whole group. If $S_p,S_q$ are such Sylow groups, this tells us that $(s,t) \in S_p \times S_q \mapsto st \in G$ is an isomorphism. Consequently, $G \simeq S_p \times S_q \simeq \mathbb{Z}_p \oplus \mathbb{Z}_q \stackrel{(CRT)}{\simeq} \mathbb{Z}_{pq}.$
stackexchange-math
{ "answer_score": 1, "question_score": 2, "tags": "abstract algebra, group theory, number theory" }
OSGi console after running tycho tests I wonder is there any way to tell the osgi console in eclipse not to exit after running tests with tycho-surefire-plugin? I have tried out `<argLine>-Dosgi.noShutdown=true</argLine>` and `<appArgLine>-console -noExit</appArgLine>`, but I do not get what I want.
I finally succeeded in getting to the OSGi console by starting the tycho test in the remote debug mode. However in contrast to the above mentioned solution I had to use the following configuration: <argLine>-ea -Dosgi.clean=true -Ddebug=true -Dosgi.console.enable.builtin=true</argLine> <appArgLine>-console 1234 -noExit</appArgLine>
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 4, "tags": "eclipse, osgi, tycho" }
EF - Add to an association set by Id Say I have a many to many relationship: Song *---* Artist I'm at a point in my code where I want to add an artist to the song. I know the artist's ID, but I don't have an instance of the `Artist` entity. Currently I have to do something like: var artist = context.Artists.Single(a => a.Id == artistId); song.Artists.Add(artist); This involves a DB query. The many-to-many relationship is modelled as a table: SongId | ArtistId -------+--------- What I'd like to do, for performance reasons, is to just add an entry to this table without having to go to the DB to load a bunch of entity data that I don't need. Is there a way to do this with EF? For example, an API like this: song.Artists.Add(artistId);
You can use dummy object: var song = context.Songs.Single(s => s.Id == songId); var artist = new Artist { Id = artistId }; context.Artists.Attach(artist); song.Artists.Add(artist); context.SaveChanges();
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 4, "tags": ".net, performance, entity framework, entity framework 4, associations" }
Scripting languages supported for Git hooks Which scripting languages does Git hooks support? I see examples of Python, Ruby and Bash. Are these the only ones? I'm mainly interested in using it on windows at the moment and am not proficient in the above. I wanted to know whether it supports anything like VBscript, Powershell or windows batch files? Is there a list of all the supported languages.
It supports anything that your system knows how to execute. You can implement your hooks in COBOL if you want!
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 5, "tags": "git" }
Sass and Compass I started working with compass today. I have created a project using sass (that's atleast what I entered in the cmd). It made my project, all good. All files are good etc, made them .sass extensions. File Structure: < But now (here comes the problem), when I try to enter in some sass code, it's giving me an error: < I have already found out what the problem is. The project thinks I'm using scss (where the syntax is without the ';'s and '{ }'s. I don't mind working with scss instead of sass, but I find it weird. Because it made sass files for me etc.. and now it's wanting me to use scss. Does anyone know how I would maybe be able to use sass instead of scss? Kind Regards!
Your file extensions should be .scss for SASS, not .sass. Chances are your precompiler is choking because it don't know what format you are feeding it.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": -3, "tags": "css, sass, compass" }
SPE prevent Get-Item from throwing error if no item found I'm writing a script to show the missing/new items between two content branches. For the target of the comparison, I build an item path and then call `Get-Item` on that path to see if there is an equivalent item. The problem is that Get-Item throws an exception if no item is found - I would just like to handle a case of a 'null' item in my script. #$source is the root path of the source branch $localPath = $sourceItem.Paths.FullPath.SubString($source.Length) $targetPath = "master:" + $target + "/" + $localPath $targetItem = Get-Item $targetPath The script works in that $targetItem is null if no item is found using $targetPath but I would like to suppress the error message in the script.
Just use the standard PowerShell error handling parameters: $localPath = $sourceItem.Paths.FullPath.SubString($source.Length) $targetPath = "master:" + $target + "/" + $localPath $targetItem = Get-Item $targetPath -ErrorAction Ignore Sounds like in your case this would be more than enough. But if you want the ability to check for other potential errors, you could combine the `SilentlyContinue` action with the `ErrorVariable` option, and then act out based on what's in the variable. For instance: # ... $targetItem = Get-Item $targetPath -ErrorAction SilentlyContinue -ErrorVariable myError if ($myError.Count -gt 0 -and !($myError[0].FullyQualifiedErrorId.Contains("ItemDoesNotExist"))) { Write-Warning $myError[0] } Lots more details in this blog post: <
stackexchange-sitecore
{ "answer_score": 8, "question_score": 3, "tags": "powershell extensions" }
format - undefined is not a function for Date object I have following code: var actualDate=new Date(); actualDate.format("YYYY-mm-dd HH-MM-ss.l"); My browser complains about second row: Uncaught TypeError: undefined is not a function How to fix this issue?
JavaScript `Date` objects don't have a `format` function built in. If you want one, you'll have to add it to `Date.prototype`, either directly or via a library. It's not just a name thing, either: JavaScript's `Date` objects just don't have a formatting function at all. They have various functions you can use to _build_ one, and they give you `toString`, `toUTCString`, `toLocaleString`, and `toISOString`, but those don't let you control the format.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "javascript, date, format" }
Oracle: Selecting * and aggregate column Is it possible to select fields using the method below? SELECT *, count(FIELD) FROM TABLE GROUP BY TABLE I get the following error ORA-00923: FROM keyword not found where expected 00923. 00000 - "FROM keyword not found where expected" *Cause: *Action: Error at Line: 1 Column: 9 Is it a syntax error or do you have to explicitly define each column rather than using *?
The columns that are selected in the field should be * an expression used as one of the group by criteria , or * an aggregate function , or * a literal value For this, you need to indicate the fields you needed and should fit in the following criteria mentioned above. SELECT FIELD1,FIELD2, COUNT(*) FROM TABLE1 GROUP BY FIELD1, FIELD2 If you insist to use the logic of your query, the use of subquery should be helpful. For example, `SELECT * FROM TABLE1 T1 INNER JOIN (SELECT FIELD1, COUNT(FIELD1) AS [CountOfFIELD1] FROM TABLE1 T2 GROUP BY FIELD1)T3 ON T1.FIELD1=T3.FIELD1`
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "oracle" }
GROUP BY needs ORDER BY NULL to avoid filesort I've noticed again and again that when I `EXPLAIN` queries with a `GROUP BY` clause, I get `filesort` as an extra condition. A long time ago I read a suggestion to use `GROUP BY NULL` in these cases to avoid the filesort, and it does indeed eliminate that unsavoury looking `filesort` condition. I would think that if no `ORDER BY` clause is present that the dbms would just present an arbitrary order or whatever is most efficient rather than ordering by some mysterious column which requires a filesort. It seems strange to me that I need to include an extra direction which basically amounts to saying _"don't do anything stupid"_. My question is why is this even necessary and is adding `ORDER BY NULL` actually helping performance?
MySQL 5.7 Reference Manual / ... / SELECT Syntax > If you use GROUP BY, output rows are sorted according to the GROUP BY columns as if you had an ORDER BY for the same columns. To avoid the overhead of sorting that GROUP BY produces, add ORDER BY NULL
stackexchange-dba
{ "answer_score": 13, "question_score": 11, "tags": "mysql, group by, order by" }
"Tu es Français, pourquoi besoin d'un cours?" Could you please explain the meaning of the phrase "Tu es Français, pourquoi besoin d'un cours?" to me? I was told that this has a certain zen koan-like quality, and my French isn't enough to understand all the nuances. Thanks in advance!
You are French, why do you need a lesson ? By the way, it is not strictly french. I mean every french would understand what you say, but you should say something like : "Tu es français, pourquoi as-tu besoin d'un cours ?"
stackexchange-french
{ "answer_score": 9, "question_score": 2, "tags": "sens" }
How do I find what kernel module is behind a network interface? How do I find out what kernel module is used for any given network interface?
On the command line run sudo lshw -C network For every network interface you'll get a section starting with `*-network`. Every section hast a `logical name:` line that contains the interface name and a `configuration:` line that contain the driver and some other information.
stackexchange-askubuntu
{ "answer_score": 25, "question_score": 24, "tags": "networking, kernel, interface" }
How to disable Komodo Edit's update suggestion? The update screen that comes everytime is really annoying. How should I stop further suggesting? I'm running `Komodo Edit, version 7.1.2, build 10678, platform linux-x86_64. Built on Fri Aug 17 19:51:14 2012`. !enter image description here
Please have a look at - < Gotta ask though - why don't you want to update to 7.1.3? Or 8.0 for that matter, which was released a while ago.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "editor, text editor, komodoedit" }
Dynamic EmbeddedDocument with mongoDB - MongoEngine So, according to the MongoEngine documentation: < a document of type A needs to inherit from DynamicDocument in order for us to be able to save an object (of type A) that has additional fields than the ones "officially" declared. How can I make an EmbeddedDocument behave like a DynamicDocument?
It sounds like you want a Dynamic Schemas.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 3, "tags": "mongodb, mongoengine" }
Best and most complete user browser "finger printing" to identify as much data as I can about a visitor? I'm getting my daughter an emergency alert bracelet because we're traveling across the US soon. On the bracelet I'm getting my website address for the person who finds/kidnaps my kid. When every ANYONE visits the unique URL, I want it to register their IP, and as much other personally identifying data as possible, then send that to me as an email. This should tell me where they are located at a bare minimum, but in the even that they are criminals, I'd like to have enough information to help the police track them down faster. I was thinking a $_SERVER dump via PHP, and possibly some tricky JavaScript methods. What specifically should I implement using PHP and Javascript to track down the visitor?
The reason why web applications are blowing up is because how secure they are. Browsers unfortunately will not give you access to much information, however you can access their IP address and Geolocation. I think the most data you will be able to get is their Long/Lat and IP address, however they would need to allow the site to grab their Geolocation. <
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "javascript, php" }
Creating a "Unsafe" File Format - OK on Local File System, but Prompt from Browser What is the correct way to create a file extension (and maybe a MIME type) that will run from your local file system without prompt, but if you browsed to that file through Internet Explorer or Firefox you would get prompted (warned)? What is the exact mechanism in the windows registry that controls this?
This mechanism is not controlled by the registry. What IE does is add a NTFS stream to downloaded files, specifcying which zone it was downloaded from. For example, I just downloaded notepad++, and performed the following command to show the alternate stream: `c:\Downloads>more <npp.5.4.5.installer.exe:Zone.Identifier` Which outputted: [ZoneTransfer] ZoneId=3 Windows explorer / ShellExecute uses this alternate stream as a means to trigger the "unsafe" warning.
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 0, "tags": "windows, security, internet explorer, firefox, registry" }
Android tools r17 x86 emulator - why can't I create an x86 AVD? I've installed the new tools without problems. I've installed the Intel HAXM. I've verified (with `sc query intelhaxm`) that the Intel service is running. I've also confirmed the machine (a Lenovo ThinkCentre) supports Intel Virtualization Technology. So why in the AVD Manager is the CPU/ABI field fixed at ARM for every single platform version of Android?
At the time of this writing, the only available x86 emulator image is for Android 2.3.3 (API Level 10), listed in the SDK Manager as "Intel Atom x86 System Image". Hopefully others will become available in the future. BTW, for those reading this question and answer and going "huh?", the r17 edition of the Android developer tools added support for native x86 emulators, which will run somewhat faster than their ARM emulator equivalents.
stackexchange-stackoverflow
{ "answer_score": 24, "question_score": 11, "tags": "android, android emulator" }
Writing to plists located at resource folder in iPhone Any one please answer me, how to write into the plist file which is located in my resource folder. Please write an example code for me.
You can't. The application bundle is not writable on iPhone OS devices.
stackexchange-stackoverflow
{ "answer_score": 6, "question_score": -2, "tags": "iphone, objective c, cocoa touch" }
multiple domains being hosted, force https on one, http on the other how can i write my htaccess file to check which domain is being requested and then either force https or force http depending which domain is being requested (my godaddy (i know, i know) hosting plan has a primary domain and multiple addon domains which point to directories in the main domain's public_html folder)? if user requests < then force it to be https if user requests < then force it to be http basically, how can we force https or http based on which domain is being requested.
Make sure you have mod_rewrite loaded and add these rules to the document root of both "secure" and "nonsecure" websites: RewriteEngine On RewriteCond %{HTTP_HOST} ^secure\.com$ [NC] RewriteCond %{HTTPS} off RewriteRule ^ [L,R] RewriteCond %{HTTP_HOST} ^nonsecure\.com$ [NC] RewriteCond %{HTTPS} on RewriteRule ^ [L,R]
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "apache, .htaccess, mod rewrite" }
Remove day name from DateTimePicker I have a `DateTimePicker` and it is currently displaying **"Friday, June 26 2009"** How would I change it so it displays **"June 26 2009"**?
this code worked for me DTP_deltek.CustomFormat = "MMM-dd-yyyy"; DTP_deltek.Format = DateTimePickerFormat.Custom;
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 0, "tags": ".net, winforms, datetime, format, datetimepicker" }
Why do I not get any content with python requests get, but still a 200 response? I'm doing a `requests.get(url='url', verify=False),` from my django application hosted on an Ubuntu server from AWS, to a url that has a Django Rest Framework. There are no permissions or authentication on the DRF, because I'm the one that made it. I've added headers such as `headers = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36'}`, but wasn't able to get any content. BUT when I do run `./manage.py shell` and run the exact same command, I get the output that I need! EDIT 1: So I've started using `subprocess.get_output("curl <url> --insecure", shell=True)` and it works, but I know this is not a very "nice" way to do things.
I know what the problem was. My application when it was being deployed was single threaded, not multithreaded. I changed my worker number and that fixed everything.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "python, django, python requests" }
Why is this VBA giving me a 1004 error I have tried a few different renditions here are some I THINK should work: Sheets(Sheet1.Name).Range("Q2").Value = "=IF($H2="""","""",IF($L2=""Successful"",0,IF($O2="""",""Error"",!$O2)))" Sheets(Sheet1.Name).Range("Q2").Formula = "=IF($H2="""","""",IF($L2=""Successful"",0,IF($O2="""",""Error"",!$O2)))" Sheets(Sheet1.Name).[Q2].Formula = "=IF($H2="""","""",IF($L2=""Successful"",0,IF($O2="""",""Error"",!$O2)))" Dim Data As Worksheet Set Data = ThisWorkbook.Sheets(Sheets1.Name) Data. (all of the above after the sheets part) No matter what I do this gives a 1004 error. What am I doing wrong?
It seems to be the "!" before "$O2".
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "excel, vba" }
Change original variable value by changing value of passed function parameter Is it possible to change the variable value with function like example below? Whenever I change the passed parameter value the original value doesn't change. Why is this happening? let b = 3; function t(n) { n = 5; } t(b) console.log(b) // still 3 I know this can be done like this, but I am wondering why the example above wont work. let b = 3; function t() { return 5; } b = t(); console.log(b)
Passing scalar values to function will pass them by value, not by reference. One solution would be to pass it as object: let b = {value: 3}; function t(n) { n.value = 5; } t(b); console.log(b.value);
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "javascript" }
PHPExcel how to set cell value dynamically using codeigniter I can't fix what's wrong in my code. It results to ONE data. what i need is to loop and get all the data from the database using this lines. Controller function firstDebit(){ $series=$this->uri->segment(3); $this->db->select ( 'accountcode.accountName' ); $this->db->from ( 'accountcode' ); $this->db->join ( 'generalaccount ', 'generalaccount.AccountCode = accountcode.id'); $this->db->where ( 'generalaccount.Series', $series); $this->db->where ( 'generalaccount.Account', 'debit'); $this->db->where ( 'generalaccount.Count', 1); $query = $this->db->get(); $query->row_array(); $rowNumber=10; foreach($query->row_array() as $rows){ $this->excel->setCellValue('b'.$rowNumber, $rows); $rowNumber++; } }
I think what you need is result_array so your code would be function firstDebit(){ $series=$this->uri->segment(3); $this->db->select ( 'accountcode.accountName' ); $this->db->from ( 'accountcode' ); $this->db->join ( 'generalaccount ', 'generalaccount.AccountCode = accountcode.id'); $this->db->where ( 'generalaccount.Series', $series); $this->db->where ( 'generalaccount.Account', 'debit'); $this->db->where ( 'generalaccount.Count', 1); $query = $this->db->get(); $rowNumber=10; foreach($query->result_array() as $rows){ $this->excel->setCellValue('b'.$rowNumber, $rows['accountName']); $rowNumber++; } }
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 2, "tags": "php, codeigniter" }
Designing for all resolution My layout structure is as below: res/layout-small-ldpi res/layout-ldpi res/layout-mdpi res/layout-large-mdpi res/layout-hdpi. I have the images for the following resolution: 240x320 320x480 480x800 1024x600 but i don't know where to place these images in drawables. Please help.
There are four types of Drawable folder in your res named folder so you have to put. 1) for 240x320 image put it to in drawable-ldpi or simple drawable folder. 2) for 320x480 image put it to in drawable-mdpi 3) for 480x800 image put it to in drawable-hdpi 4) for 1024x600image put it to in drawable-xhdpi.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "android" }
Неправильные операции с числом Неправильно делится число на число. В данном случае **`$amount = 0.2`** и мы **делим его на 0.2**. Но почему-то выдаётся ответ 0, хотя **должен быть 1**. В чём проблема? `intval` и `int` у `$xml->operation->amount;` не помог. $ch = curl_init(' curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLINFO_HEADER_OUT, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $request_wm); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $result = curl_exec($ch); // разбираем ответ $xml = new SimpleXMLElement($result); $retval = $xml->retval; $amount = $xml->operation->amount; $points = $amount/0.2; echo $points;
> intval и int у $xml->operation->amount; не помог. И не должен был помочь, так как int - целочисленный. Вам нужен floatval
stackexchange-ru_stackoverflow
{ "answer_score": 4, "question_score": 0, "tags": "php" }
Conditionally change order of if-else blocks Is there an elegant way to solve this? if (condition0) { if(condition1) { do thing 1 } else if(condition2){ do thing 2 } } else { if(condition2) { do thing 2 } else if(condition1){ do thing 1 } } `do thing 1` and `do thing 2` function calls with a lot of parameters and somehow it seems like there is unnecessary repetition. Is there is a better way of doing this?
if (condition1 && (condition0 || !condition2)) { do thing 1 } else if (condition2) { do thing 2 }
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "javascript, if statement" }
Como Inspecionar um elemento que só aparece quando faço Hover em outro elemento? Eu tenho um elemento que ao fazer um `hover` nele vai aparece um _pseudo-elemento_ em outro lugar da tela, porém eu gostaria de inspecionar esse _pseudo-elemento_ quando ele está visível na tela. **_Como eu faço para inspecionar um elemento que só aparece quando o outro está com`hover`?_** Veja esse exemplo simples button { position: relative; } button::after { content: ""; display: inline-block; margin-left: 150px; background-color: red; position: absolute; } button:hover::after { content: "aqui!"; } <button>button</button>
Siga os passos: 1. Clique sobre o elemento que você precisa dar o `hover` e inspecione elemento nele. 2. No HTML verifique que este elemento está selecionado e você verá na direita um item `:hov` 3. Clique em `:hov` e selecione `:hover`. Pronto basta inspecionar o elemento que apareceu na tela e não sai mais. ![inserir a descrição da imagem aqui]( Para o **Firefox** , ao invés do botão `:hov` existe o ícone ![inserir a descrição da imagem aqui]( com título " _Toggle pseudo-classes_ ".
stackexchange-pt_stackoverflow
{ "answer_score": 9, "question_score": 4, "tags": "html, css, navegador, css hover, dev tools" }
Store a number in an integer string and recall it in a later action I'm currently trying to get a UISlider to work. I'm trying to set the strings value as 8 to start off with on view load. Then when the slider changes value I want the string to update with that number, and then later on I can use the value in the string for a setDuration:## later on in another action. Any ideas?
I ended up using CAFloat..
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "cocoa touch" }
Append title tag in html How can I append the title tag? Consider the example of messages page, its title is : Messages Now on the middle of the page I check the amount of unread messages, suppose it is '4' then what I want is that the title of my page should become: Messages (4) Should I rewrite the tag or is there another way to append it.
To do with PHP, just echo it within your `title` element. If you are wanting to do it with JavaScript, you can do this... document.title = 'Messages (4) ' + document.title; However, if you want to change it, it may better off caching the original title to make it easier to update. var originalTitle = document.title; var prependToTitle = function(prefix) { document.title = prefix + originalTitle; }; If you simply want to change the title, just set the `document.title` property. ### Update > I want to achieve similar thing like in facebook. Even when the homepage is not fully loaded the title appears but as the notifications are loaded the title also appends If they appear at the front, they are being _prepended_ , not _appended_. The JavaScript function above will suit your requirements.
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 1, "tags": "php, html" }
Text with special class as excerpt (or exclude special class) I am new in Wordpress and I am trying to customize my own theme. All my posts are starting with a kind of content that I don't want to become the excerpt. It is kind of header. Is there a way to use as excerpt only content with class `.myOnwnExcerpt`, or maybe it will be easier to ask wordpress to run excerpt rule excluding text with class `.notToBeDisplayedAsExcerpt`. Thanks for any suggestions.
The easiest course of action would be to write manual excerpts instead of having the system generate them. Second, would be to wrap your "content that isn't an excerpt" in a shortcode. If you look at the `wp_trim_excerpt()` function, which generates excerpts from post content, one of the first thing it does is strip shortcodes. For example, if you had a shortcode like this: function foocode($atts,$content){ return $content; } add_shortcode('foo','foocode'); Anything in the post body such as `[foo]Hello[/foo]` would not appear in the generated excerpts. Note that the "exceprt" is not necessarily the chunk of text that displays on the index page. If the the theme uses `the_content()` the post content will break on the `<!-- more -->` tag, or nothing at all, and your content will still appear.
stackexchange-wordpress
{ "answer_score": 2, "question_score": 0, "tags": "excerpt, content, exclude" }
How to overload @ in python? I want to overload the operator `@` in python for a class I have written. I know how to do operator overloading in general (i.e. by defining `__add__` and `__radd__` to overload `+`) but I could not find a way to overload `@`. Why I know, that `@` can be overloaded: for numpy arrays, `A@B` gives the matrix product of `A` and `B`, while `A*B` gives the Hadamard (element-wise) product.
The methods you need to overload are the `__matmul__` and `__rmatmul__` methods. E.g. if you want to add the inner product to lists: class Vector(list): def __matmul__(self, other): return sum(x * y for x, y in zip(self, other)) def __rmatmul__(self, other): return self.__matmul__(other)
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 2, "tags": "python, operator overloading" }
Are (USB-)FDDs supported by Win 10? Is it possible to use a (USB-)Floppy Disk Drive (3.5") with Windows 10? I have read in a magazine (I think it was c't 14/15, but I'm not sure) that Win 10 would no longer support FDDs (maybe meant: natively).
Microsoft says: > Wenn Sie eine USB-Floppy-Drive betreiben möchten, müssen Sie zuerst den aktuellen Treiber über Windows Update oder die Herstellerseite herunterladen. > > (Google translation: _If you want to use a USB floppy drive, you must download the latest drivers from Windows Update or the manufacturer's website first._ )
stackexchange-superuser
{ "answer_score": 2, "question_score": 1, "tags": "drivers, windows 10 preview, floppy" }
postgres user's watchbog command taking 100% CPU constantly I have installed postgre on Ubuntu 16.04 with postgres user, and after running my application for a couple of days, I am observing the CPU usage from `watchbog` command is 100% constantly forever untill i restart the server. I have checked running queries in `pg_stat_activity` there are no queries running. Following is from top PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 9964 postgres 20 0 619320 14368 4028 S 399.0 0.1 102527:09 watchbog
You've been hacked. Watchbog is a name known to be used by malware, and is unused by PostgreSQL itself. They may have come in through your database server and leveraged that to run commands in the OS as 'postgres', or maybe they just hacked into the OS account named 'postgres' directly.
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 1, "tags": "postgresql" }
Disable Math Handwriting Icon Does anyone know what setting in Mathematica will stop the little pop-up icon coming up for handwritten input while using the stylus on the tablet? It's intrusive when I'm using the front end as a whiteboard for a video lesson. ![picture of front-end use with handwritten input option icon](
You could try removing the Math Recognizer from Settings app > Apps > Optional Features.
stackexchange-mathematica
{ "answer_score": 1, "question_score": 2, "tags": "front end" }
How do I list the defined keys in emacs isearch-mode? How do I list the defined keys in emacs isearch-mode? Based on Emacs: print key binding for a command or list all key bindings I have tried C-h m, but I cannot do that while in isearch-mode (`C-h` and `M-x` seem to cancel out of it) Thanks, -Shawn
Try this to get the help page: `M-x` `isearch-mode-help`
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 2, "tags": "emacs, key bindings" }
What would be the fastest way to achieve the equivalent of mysql - "truncate tablename" for IndexedDB? I am trying to find the fastest way to clear an `object_store` (table) of its data in `IndexedDB`. Consider there are 5000+ records being stored. I thought of just `.deleteObjectStore` but it creates the following `error`: InvalidStateError: A mutation operation was attempted on a database that did not allow mutations. It seems you can `create` or `delete` an `object_store` only in a `versionchange transaction`. What would be the fastest way to achieve the equivalent of `mysql` \- `truncate tablename` for `IndexedDB` when the `database` is connected?
Have you considered IDBObjectStore.clear ?
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 4, "tags": "javascript, html, indexeddb" }
Java Streams, filter only the first 'N' matches is there any way to filter only the first 'n' matches using java streams? for example, if we have this code: List<String> words = Arrays.asList("zero","one","two","three","four","five","one","one"); List<String> filteredWords = words.stream() .filter(word->!word.equals("one"))//filter all "one" strings.. .collect(Collectors.toList()); System.out.println(filteredWords); this will filter all "one" strings from the word stream. So, how to filter **only** the first 'n' matches and keep the rest of the stream intact? in other words, if n=1 then, the program should output "zero","two","three","four","five","one","one" if n=2 then "zero","two","three","four","five","one"
You can create a class doing the filtering for you class LimitedFilter<T> implements Predicate<T> { int matches = 0; final int limit; private Predicate<T> delegate; public LimitedFilter<T>(Predicate<T> p, int limit) { delegate = p; this.limit = limit; } public boolean test(T toTest) { if (matches > limit) return true; boolean result = delegate.test(toTest); if (result) matches++; return result; } } and then use it to filter Predicate<String> limited = new LimitedFilter<>(w -> !"one".equals(w), 5); List<String> filteredWords = words.stream() .filter(limited) //filter first five "one" strings.. .collect(Collectors.toList());
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 2, "tags": "java" }