INSTRUCTION
stringlengths
25
999
RESPONSE
stringlengths
0
999
SOURCE
stringlengths
16
38
METADATA
dict
Why do we need multiple LSTM units in a layer? What is the point of having multiple LSTM units in a single layer? Surely if we have a single unit it should be able to capture (remember) all the data anyway and using more units in the same layer would just make the other units learn exactly the same historical features? I've even shown myself empirically that using multiple LSTMs in a single layer improves performance, but in my head it still doesn't make sense, because I don't see what is it that other units are learning that others aren't? Is this sort of similar to how we use multiple filters in a single CNN layer?
Let's write down Fibonacci! > **K = 0 1 1 2 3 5 ...** And another series that is derived from Fibo; > **X = 1 4 7 12 30 $X_{5}$** Guessing $X_{5}$ is our task and both series are available to you (Fibonacci as an additional feature). One unit that you feed with **X** will try to capture the relation of $X_{t}$ and $X_{t-1}$ _only_ ; $X_{t}$ = $X_{t-1}$ \+ $X_{t-2}$ However, an additional unit that you insert&feed with **K** will not only try to capture $K_{t}$ and $K_{t-1}$ relation but also the relation between $K_{t}$ and $X_{t}$. $K_{t}$ = $K_{t-1}$ \+ $2*$$X_{t}$ \+ $1$ In the example above, there is a clear correlation between $K_{t}$ and $X_{t}$ (which is not always the case) and it will support the network to capture the sequential relation. Even the CORRELATION is not crystal clear, almost every additional feature data correlates with the other features and will support the network to grab the relation.
stackexchange-ai
{ "answer_score": 0, "question_score": 0, "tags": "machine learning, deep learning, long short term memory" }
how will i change the color of a font based on a value using angularjs directives? I would like to create a directive that can change the font color of the text displayed on a span based on some value that is not displayed. I have an array: $scope.due =[{somedate: "April.8.2010"}, {past:"yes"}]; If the value of "past " is yes, then the value inside the span: `<span>{{somedue.date}}</span>` will be color red, else if "past" is no, then font color is black. I am new with angularjs so i would appreciate it if you can suggest on how can i do this using angularjs.
You can use `ng-class` <span ng-class="{red: past == 'yes', black: past == 'no'}">{{somedue.date}}</span> where the classes red or black will be applied. You can style those via CSS to make the color red / black. Example: < Your data structure was odd in your example, it has been modified in mine to showcase `ng-class`. Also: You could use `true` / `false` and not need to do a string comparison to `'yes'`/`'no'`.
stackexchange-stackoverflow
{ "answer_score": 11, "question_score": 5, "tags": "angularjs, angularjs directive" }
Does inline css override a stylesheet css file? I'm trying to style 4 divs (next to each other) of the same class with a `margin-right` of `35px` to divide them evenly, except for the last div so it doesn't add extra margins to the `30px` `margin` already assigned to the right side of the wrapper. Now, I'm not an expert at coding yet so I might be wrong here, but I was thinking that I could add `margin-right: 0;` inline to the last div to override the property value `35px` in my stylesheet. Would this work? Or is there a different solution that I'm not seeing? **Edit: thanks to you all, the last-child pseudo selector worked! :-)**
This would override the style and work. But another solution would be to use the `:last-child` pseudo selector in the sheet. For more on `last-child`: <
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "html, css, margin" }
Finding dimension of orthogonal complement The question goes as follows: > Let there be $\xi \in T_2(V)$ Where $V = M_n(\mathbb C))$: > > $\xi (A,B) = n*tr(AB)-tr(A)tr(B).$ > > Find $dim(V_{\bot\xi})$. > > $( V_{\bot\xi} = \\{ A \in M_n(\mathbb C) | \xi(A,B) = 0, \forall B\in M_n(\mathbb C) \\})$ I was struggling to find the dimension, this is what I tried to do: First we mark $A=(a_{ij}), B = (b_{ij})$. Then, we want to find all $A \in M_n\mathbb C$ that $n*tr(Ab)=tr(A)tr(B)$ for every $B\in M_n\mathbb C$. Since $tr(AB) = \sum_{i=1}^n \sum_{j=1}^n a_{ij}b_{ji}$, we get that: $$n * \sum_{i=1}^n \sum_{j=1}^n a_{ij}b_{ji} = \sum_{i=1}^na_{ii}*\sum_{j=1}^nb_{jj}$$ $$\sum_{i=1}^n \sum_{j=1}^n na_{ij}b_{ji} = \sum_{i=1}^n\sum_{j=1}^na_{ii}b_{jj}$$ but I don't know how to continue from here. Am I on the right track? Is there any other intuitive way? Thanks!
**Hint** Let $(E^a{}_b)$ denote the standard basis of $M_n(\Bbb C)$. The condition implies the $n^2$ conditions $$\xi(A, E^a{}_b) = 0 .$$ Write these conditions in terms of the entries of $A$.
stackexchange-math
{ "answer_score": 1, "question_score": 0, "tags": "orthogonality, trace, bilinear form" }
Check whether address path is available Sorry, it might be duplicated post. is there a way can javascript/jquery to detect whether the url link is available or not ?? for instances, detect ` is not available and return false, if ` is available and return true.
So, since you could run into problems if making an ajax request because of cross-domain restrictions, another strategy would be trying to load the url into a script tag, which does accept other domains. Here is what your code would look like: function checkURL(url) { var scriptTag = document.body.appendChild(document.createElement("script")); scriptTag.onload = function() { alert( url + " is available"); }; scriptTag.onerror = function() { alert( url + " is not available"); }; scriptTag.src = url; }
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 2, "tags": "javascript, jquery, html" }
R data table one field without aggregation I have used data.table functionality to find out the minimum of "y" by "x" as shown in the code below. > x <- c("A", "B", "A", "C", "B", "A") > y <- c(0, 1, 1, 1, 2, 2) > z <- c(1, 2, 1, 4, 5, 3) > df <- data.table(x, y, z) > temp <- df[, .(M=min(y)), by="x"] > temp x M 1: A 0 2: B 1 3: C 1 > df x y z 1: A 0 1 2: B 1 2 3: A 1 1 4: C 1 4 5: B 2 5 6: A 2 3 However, now after finding out the minimum, I want to be able to pull out the corresponding value of "z" for each of the "x"s. In short, I want temp to be like so: > temp x M z 1: A 0 1 2: B 1 2 3: C 1 4 How do I do this in R?
We can do this by a single step using `.I` to extract the row index of the logical vector and subset the rows of the dataset based on that df[df[, .I[y==min(y)], by = x]$V1] # x y z #1: A 0 1 #2: B 1 2 #3: C 1 4 Or another option is df[order(x,y)][!duplicated(x)] * * * If we want to get the output based on 'temp', use a join df[temp, on =.(x, y=M)] # x y z #1: A 0 1 #2: B 1 2 #3: C 1 4
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "r" }
dojo require fails see this fiddle. This upon running gives an error in console. I'm currently on chrome. Is this a bug? doing `require(["dijit/tree" ]` should load `.../digit/tree.js` but it gives a `404` GET 404 (Not Found) there should be only one `/` but there are two!
You need to capitalize tree require(["dijit/Tree"]
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "dojo, dijit.tree" }
Cannot open IIS 7.5 in Windows 7 I am using Windows 7, Visual Studio 2010. I just downloaded and installed IIS 7.5 from www.microsoft.com . Installation also ended up successfully. But I cant able to find IIS in any of the way which I could find in the internet. I tried by Run -> inetmgr , control panel -> Administrative tools -> IIS . But I cannot find IIS anywhere. I also found an answer in stackoverflow forum for World Wide Web Publishing Service. but I cant find that too. Please help me. :(
I have found a solution for this. I made IIS enabled in control panel. There is an option in control panel as Turn Windows on/off. In that I checked all the sub folders under IIS menu. Now I can able to open the IIS manager. If any one come across this issue, u can try this step too.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "iis express" }
How to create a method in Angular 6 that returns a queryParams from the url? This is my code. Is there any other better or best way to get the queryParams from the url? getSolutionId(){ let solutionId: number; this.activatedRoute.queryParams.subscribe((queryParams) => { solutionId = queryParams.solutionId ? queryParams.solutionId: null; }); return solutionId; }
This is already answered by this comment that also references the Angular docs describing how to achieve this.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "angular, typescript" }
Proof of equality of independent variables With $X_1,X_2,..$ as a sequence of i.i.d variables with F as a distribution function and $M_n=max\\{X_m:m<=n\\}$ for $n=1,2,..$ To prove $P(M_n<=x)=F^n(x)$, I did the following: a) $P(M_n<=x)=P(max(X_1,X_2,...X_n)<=x)=\prod_{i=1}^{n}P(X_i<=x)=P(X_1<=x)\cdot P(X_2<=x)\cdot\cdot\cdot P(X_n<=x)=F\cdot F \cdot F.. = [F(x)]^n= F^n(x)$ b) Given $ F(x)=1-x^{-α}$ for $x>=1, α > 0$. Need to prove that as _n_ approaches infinity $P(\frac{M_n}{n^{1/α}} <= y) -> exp(-y^{-α})$ I proved $P(\frac{M_n}{n^{1/α}} <= y)=P(M_n<=y \cdot n^{1/α})=(F(y \cdot n^{1/α}))^n=(1-\frac{1}{n \cdot y^α})^n -> e^{-y^{-α}}$ as n approaches $\infty$ Are proofs in a) and b) are done correctly? Please let me know if something needs to be added to make it solid. Thank you very much!
What are you doing in $(b)$? $(a)$ is right: * Steps 1,3,5 and 6 are by definition. * Step 2 is the trick where one combines understanding of 'maximum' with utilising the independence of the random variables. * Step 4 utilises the identical distribution of the random variables.
stackexchange-math
{ "answer_score": 1, "question_score": 1, "tags": "probability theory, probability distributions, convergence divergence, order statistics" }
Create multiple hyperlink with shortcut using Sublime Text 3 I am trying to create a menu using HTML and I saw a lecture on **Udemy** and in which the instructor just simply wrote e.g `a*3` and automatically 3a tags were generated like this. <a href=""></a> <a href=""></a> <a href=""></a> He did not mention how? This is my code: <nav class="menu"> a*3 </nav>
That's the magic of emmet. For that to work in Sublime, you would need to install the emmet plugin for Sublime Text through package control.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "html, hyperlink, menu, tags, nav" }
how do I use the Rails.logger from javascript I nside a html.erb, I want to use the logger <script type="text/javascript"> $j(function(){ $j('#AddQuestion').click(function(){ //Send and http transaction to the server to get the address $j('#dialog').dialog( {buttons:{OK:function (event) { say('You clicked the ' + $(event.target).text() + ' button' ); }, No:function (event) { say('You clicked the ' + $(event.target).text() + ' button' ); } } }); $j('#dialog').dialog('open'); }); }); </script>
# controllers/logs_controller.rb class LogsController < ApplicationController def create logger.debug params['message'] render :nothing => true end end # config/routes.rb map.logs "logs", :controller => 'logs', :action => 'create', :conditions => {:method => :post} # js $.post('/logs', {message: 'Your log message'})
stackexchange-stackoverflow
{ "answer_score": 9, "question_score": 1, "tags": "javascript, jquery ui, ruby on rails 3" }
Laravel: Throw error from controller I have a project and if I want to access `partner/X` I got `get property of non object` error, becouse I have less partners than X. My question. How to tell the controller, that `if the result of the modelquery is empty, than throw a 404 error`? My code is so far: public function showPartner($id = 0){ //Only allow numerical values if ($id > 0){ $partner = Partner::find($id); if (empty($partner)){ return ??? } } }
Laravel has a specific method for that. If you use `findOrFail($id)`, it will throw an `Illuminate\Database\Eloquent\ModelNotFoundException`, so there's no need to throw an Exception by yourself. If you mean "show the user an 404 error" instead of literally throwing an Exception, then catch it and `abort()`: public function showPartner($id = 0){ //Only allow numerical values if ($id > 0){ try { $partner = Partner::find($id); // do your work } catch (Illuminate\Database\Eloquent\ModelNotFoundException $e) { abort(404, "The Partner was not found"); } } } Read more about this here.
stackexchange-stackoverflow
{ "answer_score": 9, "question_score": 12, "tags": "php, laravel" }
PHP debug_backtrace bitmask usage Trying to understand this entry in the php manual on `debug_backtrace`. I don't understand what they mean by "this parameter is a bitmask for ...." I have done web searches on bitmasks and my head is spinning round so I have decided I don't really want to learn the detail about it but just to know how I can supposed to add the options to that function. Do I put in both options as in debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT, DEBUG_BACKTRACE_IGNORE_ARGS) if I want both and one of them if I only want that one?
It means you combine options with the bitwise OR operator: `|`. For example: debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT | DEBUG_BACKTRACE_IGNORE_ARGS); For more details about bitmasks: <
stackexchange-stackoverflow
{ "answer_score": 11, "question_score": 18, "tags": "php, bit manipulation, stack trace, bitmask" }
Redirect DIR/SubDIR/page.php to /page.php Please see the following URL format: /faq/ANY_SUB_DIRECTORY/SOME_PAGE.php What I want to do is to redirect these kind of URLs to the following using HTACCESS to root: /SOME_PAGE.php I only want to redirect the urls that has `/faq/*/*.php` format to `/*.php`. Is it possible to redirect URL formats like this? I am trying for last few hours but failed completely! Waiting for your valuable suggestions. Here is what I have tried so far: RedirectMatch 301 ^faq/*/(.*)\.php$ $1.php RewriteRule ^faq/([^/]*)\.php$ faqpreview.php?page=$1 [L] RewriteRule ^([^/]*)\.php$ $1.php [L] RewriteRule ^faq/([^/\.]+)/?$\.php /$1.php [L]
You're close, you can use: RewriteRule ^faq/.+/([^/.]+\.php)$ /$1.php [L,NC] This will do silent rewrite without changing the URL, if you want to change URL in browser as well then use: RewriteRule ^faq/.+/([^/.]+\.php)$ /$1.php [L,NC,R=302]
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "php, .htaccess, redirect" }
Two network adapters with the same ip I have two network adapters that use the same ip range, but are different networks. I tried this but it didn't work: iptables -t nat -A OUTPUT -p all -d 1.2.3.0/8 -j DNAT --to-destination 192.168.0.0/8 -o eth0 iptables -t nat -A OUTPUT -p all -d 3.2.1.0/8 -j DNAT --to-destination 192.168.0.0/8 -o eth1 Example: eth0 has the ip of 192.168.0.1 on a network with the range 192.168.0.* eth1 has the ip of 192.168.0.8 on a separate network with the range 192.168.0.* 1.2.3.* = 192.168.0.* through eth1 3.2.1.* = 192.168.0.* through eth0 Is this something I can do with iptables?
Your question is not clear, but assuming you want to route your 1.2.3.4 traffic to one NIC and 4.3.2.1 to another than you need to update you routing table using route command. Example : route add -net 1.2.3.4 netmask 255.0.0.0 dev eth1 route add -net 4.3.2.1 netmask 255.0.0.0 dev eth0
stackexchange-serverfault
{ "answer_score": 2, "question_score": 1, "tags": "networking, iptables, internet, ethernet, eth0" }
Beamer - best way to manage "show notes on second screen" on MacOS in 2019 I just compiled my slides for the first time with the option "show notes on second screen". It produces, as all of you know, PDF slides which contain the part of the notes and the content of the presentation. I've found a few topics of how to display those files in a right way. But, all of the topics were a little old. So, I decided to ask you again, how to do this in 2019 and especially on MacOS. Thanks a lot for your help and for sharing your experience!
Présentation.app was just updated a few weeks ago to include support for beamer's notes on second screen (they appear below the current slide in the presenter view).
stackexchange-tex
{ "answer_score": 3, "question_score": 2, "tags": "beamer" }
Can't find php-zip extension for php 7.1 on CentOS 7 I am attempting to install Magento 2.2.5 on a new CentOS 7 server with PHP 7.1. I can't seem to find how to install and/or enable the `php-zip` extension. The issue I'm trying to resolve is this (via composer): > magento/product-community-edition 2.2.5 requires ext-zip * -> the requested PHP extension zip is missing from your system. The repo I'm using (remi-php71) doesn't seem to have the extension, or maybe it's included in another package. I have searched the webtatic repo as well. How can I install and enable the php-zip extension?
I ended up rebuilding my server and I found a guide that worked using the ius repository: < yum install -y yum -y update yum -y install php71u php71u-pdo php71u-mysqlnd php71u-opcache php71u-xml php71u-mcrypt php71u-gd php71u-devel php71u-mysql php71u-intl php71u-mbstring php71u-bcmath php71u-json php71u-iconv php71u-soap
stackexchange-unix
{ "answer_score": 1, "question_score": 1, "tags": "centos, yum, php7" }
Extracting last 2 characters of a string using regex and testing for numeric alpha pattern I have a string, I want to use a regular expression to find out if the last 2 characters match NA i.e., numeric alpha characters Eg., abcd1e , efgh4k for such strings i should get true from the regex pattern compile. i tried `(\d[a-zA-Z])..$` and it did not work. It somehow does not identify the last 2 characters
Since you are matching last two characters for digit and alpha, remove the dots: (\d[a-zA-Z])$
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "regex" }
How to add to a new dataframe the preceding rows! R I have a date frame which looks approximately in the next way: x<-c(0,0,0,0,0,1,1,1,0,1,0) y<-c(12,12,3,45,6,5,63,2,3,4,5) z<-data.frame(x,y) z # x y #1 0 12 #2 0 12 #3 0 3 #4 0 45 #5 0 6 #6 1 5 #7 1 63 #8 1 2 #9 0 3 #10 1 4 #11 0 5 I would like to run a function or loop which find the rows in `x` which equals to `1` and add to a new data frame this row and the 4 preceding rows.
A small riff to @user1981275 solution with a small fix if there are no preceding rows to avoid negative indexing l <- lapply(which(z$x==1), function(x) { z[(ifelse(x-4 < 1, 1, x-4)):x,] }) do.call(rbind, l)
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": -1, "tags": "r, loops, dataframe, rows" }
LINQ Union Error - type cannot be inferred I'm just trying to perform as simple union on 2 linq queries as below: var results1 = from a in dt.AsEnumerable() where array1.Contains([COL_1]) select new { a = a.Key }; var results2 = from b in dt.AsEnumerable() where array2.Contains([COL_2]) select new { b = b.Key }; var concatResults = results1.Union(results2); But I am getting the following error: > The type arguments for method 'System.Linq.Enumerable.Union(System.Collections.Generic.IEnumerable, System.Collections.Generic.IEnumerable)' cannot be inferred from the usage. Try specifying the type arguments explicitly. Can anyone give me a steer on how to resolve this problem? Thanks in advance CM
You are trying to union two different (anonymous) types, which isn't possible. You could create your own type to store your Key value, so that both queries project to the same type. public class MyType { string Key { get; set; } } var results1 = from a in dt.AsEnumerable() where array1.Contains([COL_1]) select new MyType { Key = a.Key }; etc
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "linq, types, union" }
How do i install wordpress in plesk panel 9.5.5 Am new to plesk panel. Is this possible to install wordpress on plesk panel.hope someone can help for this issue.
Extract of this topic : 1. Created a domain/subdomain in Plesk 2. Created a DB and username on Plesk 3. Copied all the files from unzipped "Wordpress" folder to /var/www/vhots/mydomain/httpdocs wget < 4. Changed the wp-config.php with DB name, Username and password
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": -1, "tags": "wordpress, installation, plesk" }
How to do exact word match in Neo4j? In Neo4j, we can do mysql query **"like"** with ex. If node **"temp"** have column **"col"** and value "This was in World war 1945"; If we search by "wor" and where query is temp.col =~ '(?i).*'. $search_value . '.*' Then results are coming. But I want results to come only when searched for world with any case change. How to do exact word match? i.e. If we search for string then there should be space or no any character at start and end of word.
=~ '(?i).*'. $search_value . '.*' =~ = Regex search (?i) = case insenstive .* = Match anything $search_value = Your string .* = Match anything If you want to match whole words, and you want to match the case, and if that whole word can appear mid sentence then you could try: =~'.*\\b' . $search_value . '\\b.*' `\b` is a word boundary matcher. Update: `"\\b"` double slashes are required to escaping in for regular expressions.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "php, regex, neo4j, exact match" }
Skitch failed to work for Big Sur even though I have granted Screen Recording I have granted Skitch Screen Recording permission but Skitch still failed to capture the screen. ![screen recording permission]( This happened after I upgraded to the latest Big Sur patch. It used to work. How do I fix it? Thanks! ![skitch](
With Big Sur, it is the Skitch Helper which needs to be granted the Screen Recording permission. ![enter image description here]( To fix this, I suggest completely uninstalling Skitch and reinstall. Either when installing or on first run, you will be asked to grant the Screen Recording permission. Make sure you are using the current version 2.9 Skitch.
stackexchange-apple
{ "answer_score": 4, "question_score": 4, "tags": "permission, big sur, screen capture" }
AND/OR operator between numbers in Python How do `and`/`or` operators work between numbers (or even strings)? 5 and 7 # this returns 7 7 and 5 # this returns 5 21 and 4 # this returns 4 4 and 21 # this returns 21 How does the `and` operator work in such cases?
AND/OR : 5 and 7 #7 It check 5 first and found it is 'True' so it check for second also and return last one. 0 and 5 # 0 it check for first and found is zero so whatever will be next value it is always zero so it return 0 2 or 3 and 4 #2 first value is 2 ('True') and found OR So value is always true so return 2 (2 or 3) and 4 #4 now return 4.
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 4, "tags": "python" }
Position / lot size based on buy entry and stop gap I'm trying to code in Python my lot size based on a positive order signal. Below is the expected output which was done in excel. The logic is: Lot_size = IF (Order_Signal=1, then Prior_Period_Portfolio_Value * Risk_pct / Stop_gap, elif(Active=0, 0, prior period lot size)) risk_pct=0.02 I'm having a having a hard time to reproduce this in excel, specifically the last component where it refers to the prior period lot size. ![enter image description here](
It depends on how you store these data in Python. But for simplicity I'll assume each variable is in its own list. order_signal = [0,0,...-1,0] stop_gap = [0.44,1.13,...1.94,9.06] prior_period_portfolio_value = [10000,10000,...9900,9807.5] active = [0,0,...1,0] lot_size = [0] * len(order_signal) risk_pct = 0.02 for i = 1:len(order_signal): if order_signal[i] == 1: lot_size[i] = prior_period_portfolio_value[i] * risk_pct / stop_gap[i] elif active[i] == 0: lot_size[i] = 0 else: # just need to be sure this doesn't happen on the first iteration lost_size[i] = lot_size[i-1]
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "python, position, trading" }
Proving the maximum of $(x^2-y^2-1)^2+4x^2y^2$ occurs at $x=0$, $y=\pm 1$. I'm trying to get some practice using the Maximum Modulus theorem, and want to use it to conclude that the maximum of $(x^2-y^2-1)^2+4x^2y^2$ occurs at $x=0$, $y=\pm 1$, supposing $x^2+y^2\leq 1$. My thinking is I want to find some suitalbe complex function $f(z)$ such that $|f(z)|^2=(x^2-y^2-1)^2+4x^2y^2$, and then apply the Maximum Modulus principle, since I know the maximum will occur somewhere on the boundary $x^2+y^2=1$. However, I can't find such a function, so maybe I"m approaching it incorrectly. I did manage to find that $$ z^2-1=(x+iy)^2-1=(x^2-y^2-1)+2xyi $$ which looked somewhat close, but no cigar. How can this be done better? Thanks.
Take $f(z) = z^2 - 1$. If $z = x + iy$, then $|f(z)|^2 =$ the expression you have. EDIT: Strangely, I missed that you already found $z^2-1$. You have a mistake in your working: $$(x+iy)^2 - 1 = (x^2 - y^2 - 1) + 2ixy$$ and $$|(x+iy)^2 - 1|^2 = (x^2 - y^2 - 1)^2 + 4x^2y^2$$
stackexchange-math
{ "answer_score": 2, "question_score": 2, "tags": "complex analysis, optimization" }
Setting All Vendor Prefixed Versions of "width: calc..." With jQuery? I'm working on using a project which uses jQuery, and I need to dynamically set a calc() based width using jQuery. The problem is that for calc to work, the CSS needs to look something like this: **CSS** width: -moz-calc(33% - 50px); width: -webkit-calc(33% - 50px); width: calc(33% - 50px); When I try to use jQuery `$(selector).css('width', 'calc(33% - 50px)')`, I can't set width with multiple vendor prefixed versions of calc. What's the right way to handle multiple settings of the same CSS property in jQuery, to allow for vendor-prefixing?
Have you tried something like: calc = "calc(33% - 50px)"; if ($.browser.webkit) { calc = "-webkit-"+calc; } $(selector).css('width',calc);
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 5, "tags": "jquery, css, vendor prefix" }
Select 10th working day from my calendar table I have a table where there are 2 columns DATE and HOLIDAY_FLAG. DATE HOLIDAY_FLAG 01-JUL-2015 00.00.00 N 02-JUL-2015 00.00.00 N 03-JUL-2015 00.00.00 Y 04-JUL-2015 00.00.00 Y 05-JUL-2015 00.00.00 Y 06-JUL-2015 00.00.00 N 07-JUL-2015 00.00.00 N 08-JUL-2015 00.00.00 N 09-JUL-2015 00.00.00 N 10-JUL-2015 00.00.00 N 11-JUL-2015 00.00.00 Y 12-JUL-2015 00.00.00 Y 13-JUL-2015 00.00.00 N 14-JUL-2015 00.00.00 N I want to provide required date in the where condition and get the date of the next 5th working day. Example: Input 01-JUL-2015 00.00.00 Output 09-JUL-2015 00.00.00 Here is what i have done so far select b.DATE + 5 from CALENDAR b where b.DATE = '01-JUL-2015 00.00.00' and b.HOLIDAY_FLAG is not null; I know this doesn't work
One of the ways is to use analytical function `lead()`: SQLFiddle demo select d5 from ( select cal_date, lead(cal_date, 5) over (order by cal_date) d5 from calendar where holiday_flag='N') where cal_date = date '2015-07-01'
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "oracle, date, select, calendar" }
sum each value in a list of tuples I have a list of tuples similar to this: l = [(1, 2), (3, 4), (5, 6), (7, 8), (9, 0)] I want to create a simple one-liner that will give me the following result: r = (25, 20) or r = [25, 20] # don't care if tuple or list. Which would be like doing the following: r = [0, 0] for t in l: r[0]+=t[0] r[1]+=t[1] I am sure it is something very simple, but I can't think of it. Note: I looked at similar questions already: How do I sum the first value in a set of lists within a tuple? How do I sum the first value in each tuple in a list of tuples in Python?
Use `zip()` and `sum()`: In [1]: l = [(1, 2), (3, 4), (5, 6), (7, 8), (9, 0)] In [2]: [sum(x) for x in zip(*l)] Out[2]: [25, 20] or: In [4]: map(sum, zip(*l)) Out[4]: [25, 20] `timeit` results: In [16]: l = [(1, 2), (3, 4), (5, 6), (7, 8), (9, 0)]*1000 In [17]: %timeit [sum(x) for x in zip(*l)] 1000 loops, best of 3: 1.46 ms per loop In [18]: %timeit [sum(x) for x in izip(*l)] #prefer itertools.izip 1000 loops, best of 3: 1.28 ms per loop In [19]: %timeit map(sum, zip(*l)) 100 loops, best of 3: 1.48 ms per loop In [20]: %timeit map(sum, izip(*l)) #prefer itertools.izip 1000 loops, best of 3: 1.29 ms per loop
stackexchange-stackoverflow
{ "answer_score": 66, "question_score": 34, "tags": "python, performance, list, python 2.7, list comprehension" }
Butler is to Jeeves as Maid is to I'm trying to see if there a term for a maid that equates to the use of the word Jeeves for a butler. It is an if, I'm not sure there is one, after Jeeves is only the joking name for a butler due to the Jeeves and Wooster books (as far as I know it). Is there a maid equivalent? Or even a non-gendered version? Maybe for a generic home-help kind of role?
In earlier centuries, the word would be Abigail, but I don't think many people would understand it now. The OED says: > Now _arch._ and _hist._ A lady's maid; a female servant or attendant.
stackexchange-english
{ "answer_score": 3, "question_score": 3, "tags": "single word requests" }
Setting http get request parameters using Qt I'm developing a basic application in Qt that retrieves data from Parse.com using the REST API. I went through some class references and the cURL manual but it's still not clear how you set the request parameters. For example, I'd like to authenticate a user. Here's the curl example provided by Parse: curl -X GET \ -H "X-Parse-Application-Id: myappid" \ -H "X-Parse-REST-API-Key: myapikey" \ -G \ --data-urlencode 'username=test' \ --data-urlencode 'password=test' \ I set the url and the headers like this QUrl url(" QNetworkRequest request(url); request.setRawHeader("X-Parse-Application-Id", "myappid"); request.setRawHeader("X-Parse-REST-API-Key", "myapikey"); nam->get(request); which worked fine when there were no parameters, but what should I use to achieve the same as curl does with the --data-urlencode switch? Thanks for your time
Unfortunately, QUrl::addQueryItem() is deprecated in qt5 but starting from there I found the QUrlQuery class which has an addQueryItem() method and can produce a query string that is acceptable for QUrl's setQuery() method so it now looks like this and works fine: QUrl url(" QUrlQuery query; query.addQueryItem("username", "test"); query.addQueryItem("password", "test"); url.setQuery(query.query()); QNetworkRequest request(url); request.setRawHeader("X-Parse-Application-Id", "myappid"); request.setRawHeader("X-Parse-REST-API-Key", "myapikey"); nam->get(request); Thanks for the tip Chris.
stackexchange-stackoverflow
{ "answer_score": 14, "question_score": 6, "tags": "qt, rest, curl, parse platform" }
Using NSLingusiticTagger I have put together a sample code to test the functionality of NSLinguisticTagger but had no luck. The code is as below. The problem is I never get in to the Block code which is a log. NSString *linguisticTaggerTestString = @"My name is Jacob Thomas"; NSLinguisticTagger *lingusticTagger = [[NSLinguisticTagger alloc] initWithTagSchemes:[NSArray arrayWithObject:@"NSLinguisticTagSchemeNameType"] options:NSLinguisticTaggerJoinNames]; [lingusticTagger setString:linguisticTaggerTestString]; NSRange range = NSMakeRange(0, [linguisticTaggerTestString length]); [lingusticTagger enumerateTagsInRange:range scheme:@"NSLinguisticTagSchemeNameType" options:NSLinguisticTaggerJoinNames usingBlock:^(NSString *tag, NSRange tokenRange, NSRange sentenceRange, BOOL *stop) { NSLog(@"Tag is %@ and the string is %@",tag, [linguisticTaggerTestString substringWithRange:tokenRange]); }];
It may be the case that you haven't properly initialised the linguistic tagger. `NSLinguisticTagSchemeNameType` is a constant, you shouldn't be passing it in as a string. try the following line of code instead: NSLinguisticTagger *lingusticTagger = [[NSLinguisticTagger alloc] initWithTagSchemes:[NSArray arrayWithObject:NSLinguisticTagSchemeNameType] options:NSLinguisticTaggerJoinNames];
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "iphone, ios, cocoa touch" }
Where do you draw the line between what is "embedded" and what is not? ASIDE: Yes, this is can be considered a subjective question, but I hope to draw conclusions from the statistics of the responses. There is a broad spectrum of computing devices. They range in physical sizes, computational power and electrical power. I would like to know what embedded developers think is the determining factor(s) that makes a system "embedded." I have my own determination that I will withhold for a week so as to not influence the responses.
I would say "embedded" is any device on which the end user doesn't normally install custom software of their choice. So PCs, laptops and smartphones are out, while XM radios, robot controllers, alarm clocks, pacemakers, hearing aids, the doohickey in your engine that regulates fuel injection etc. are in.
stackexchange-stackoverflow
{ "answer_score": 17, "question_score": 12, "tags": "embedded" }
Getting Remote Notification Device Token in Swift 4? I am using this code to get the Notification Center Device token. It was working in Swift 3 but not working in Swift 4. What changed? if #available(iOS 10.0, *) { let center = UNUserNotificationCenter.current() center.requestAuthorization(options:[.badge, .alert, .sound]) { (granted, error) in } } func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) { let deviceTokenString = deviceToken.reduce("", {$0 + String(format: "%02X", $1)}) print(deviceTokenString) }
Assuming that you already checked that everything has been setup right, based on your code, it seems that it should works fine, all you have to do is to change the format to `%02.2hhx` instead of `%02X` to get the appropriate hex string. Thus you should get a valid one. As a good practice, you could add a `Data` extension into your project for getting the string: import Foundation extension Data { var hexString: String { let hexString = map { String(format: "%02.2hhx", $0) }.joined() return hexString } } Usage: func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) { let deviceTokenString = deviceToken.hexString print(deviceTokenString) }
stackexchange-stackoverflow
{ "answer_score": 64, "question_score": 24, "tags": "ios, swift, apple push notifications, devicetoken" }
Not able to share a service instance in IBM Cloud? im trying to share a services instance between two spaces but when i run this command : **cf enable-feature-flag service_instance_sharing** I get this error msg : **Server error, status code: 403, error code: 10003, message: You are not authorized to perform the requested action** It's weird that i'm not authorized because i'm the admin for this account. I even tried to give SpaceDeveloper role to some users but still having the same error. So, how can i fix this because we need to share some service instances between a couple of spaces. Thank you.
Running `cf enable-feature-flag` requires you to be an operator and have admin permissions. It's not something that an end user can do. No amount of toggling the org or space roles will resolve this. In short, you need to ask your operator (IBM) to enable this feature, or change to a different provider that has the feature enabled. Hope that helps!
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "ibm cloud, cloud foundry" }
Missing API's while creating autodesk forge application I'm new to Autodesk Forge API. Planning to use it for converting Revit files. But when creating an app inside the Forge console, the system doesn't allow me to select relevant API's to "turn them on" for the app. < While < guide lists all possible API's the service provides. What could be the issue?
I believe you did not start your trial, please apply for FREE 90-DAY TRIAL, and you will see all the available APIs in the list.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": -1, "tags": "autodesk forge, autodesk, autodesk viewer, autodesk model derivative, autodesk data management" }
mysql and php fetch_assoc() not working I have the following: <?php include 'connect.php'; //get average from all reviews $allreviews = "SELECT round(avg(Stars_overall),0) AS average FROM (SELECT Stars_overall FROM Reviews WHERE Meal_ID = 1 ORDER BY Order_ID DESC LIMIT 5) AS Average"; $getresult = mysqli_query($conn, $allreviews); $row3 = mysql_fetch_assoc($getresult); echo "aaaaa" .$row3['average']. "bbbbb"; mysqli_close($conn); ?> Unfortunately it is not working, any clue why? It is for a review system, i'm trying to display an average of star ratings stored in database. The first sql gets all the ratings for a specific meal and the second sql calculates the average. I then want to be able to display the average
You are using mysqli, therefore you must use `mysqli_fetch_assoc` and not `mysql_fetch_assoc`.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "php, mysql" }
Azure VM backup best practice I have a customer who has just lifted-n-shifted their 1TB SQL Server 2008 R2 production, and QA servers (2 servers) to Azure IaaS from a small cloud provider. What is the best practice for backups? I am more used to Azure SaaS with encrypted, centralised backup storage.
you should use manual backup or better Azure SQL vm backup. < here you can find microsoft guide: <
stackexchange-dba
{ "answer_score": 2, "question_score": 0, "tags": "sql server, backup, azure vm" }
Ford Econoline Van AC Failing If the vents start putting out hot air when accelerating or driving up hills but are ice cold when idling, is that a sign of a failing blower pump or leak? I am dealing with a Ford Econoline E350. Refrigerant is obviously not the problem because the air is cold when idling. The air usually stays cold in the front but the back half of the vehicle's vents are blowing out hot air.Any ideas?
The air conditioner on this vehicle uses a vacuum powered HVAC controls. A leak anywhere in the vacuum system can cause this symptom. One way to test for leaks is to apply low pressure air (10psi) into the system and listen for leaks. Leaks at the vacuum reservoir are common. So is the line to the air recirculation valve because it is close to the passengers right foot.
stackexchange-mechanics
{ "answer_score": 3, "question_score": 9, "tags": "ford, ac, troubleshooting, e350, econoline" }
Is there a way to return variables from R function when terminated by hand? So I have evolutionary algorithm, which takes some time to run. I have written it as a function and wrap it in package, and now I am facing the issue with early stopping. Is there a way to return current variables even if you terminate the function before completion? I am looking for something like return on error, like when you running script on stoppage the current variables remain in environment. Is that possible in R? Thank you
You can use an _Exit handler_ with `on.exit` defined in your function. A simple usage, where I terminate the function with ctrl-c is: fun <- function() { on.exit(return(i)) i <- 0 repeat { i <- i + 1 Sys.sleep(1) } } z <- fun() #^C z #[1] 3
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "r, function, return" }
p-adic expansion of a rational number Studying $p$-adic numbers I encountered the following theorem: Given a eventually periodic sequence $(a_n)_{n=k}^{\infty}$ such that $0 \le a_n <p$, the sum \begin{equation*} \sum_{n=k}^{\infty}a_np^n \end{equation*} converges p-adically to a rational number. The proof of this fact consists mainly in rearranging the sum. Here is my problem... In all the books I have seen this is not justified. Only some authors prove a theorem about rearrangement, but in other parts of their books and seems we don't need it here. Why I can rearrange the terms of this sum? Why I don't need any theorem? Thank you all!
As @ThomasAndrews says, you don’t need to rearrange anything. First, knock off the nonperiodic part at the beginning. That will be a rational number. Now take the periodic part, say of period $N$. Then the part you didn’t knock off has the form $A + Ap^N + Ap^{2N} +Ap^{3N}+\cdots$, a geometric series with common ratio $p^N$. Since this ratio is $p$-adically smaller than $1$, the series is convergent, and the periodic part has rational value $A/(1-p^N)$, done.
stackexchange-math
{ "answer_score": 7, "question_score": 6, "tags": "sequences and series, number theory, p adic number theory" }
Flash - Button control I am doing a simple Flash button that controls the playing of a moving clip. I want the movie to go to frame one and play when I mouse over the button and I want it to go to frame 12 and play when I mouse out. I have stop(); at frames 1, 12 and 25 to prevent looping. The mouse_over part works fine, but the mouse_out part is unresponsive. Here is my actionscript: stop(); button_btn.addEventListener(MouseEvent.MOUSE_OVER, playMovie); button_btn.addEventListener(MouseEvent.MOUSE_OUT, unwindMovie); function playMovie(evtObj:MouseEvent) { gotoAndPlay(1); } function unwindMovie(evtObj:MouseEvent) { gotoAndPlay(12); } I would appreciate some help figuring out why this will not play properly. Thanks.
I'd like to see more of your code. I am assuming this is on the timeline, so my first question is, "Whre is the code?" Timeline code responds to keyframes as well, so if it exists in one place, but not at the next keyframe, it will be unresponsive. A good stratagy is create one layer with no keyframes/graphics that holds all this kind of code, that way it will always be available. But let me know some more info if the above isn't the issue, andwe can sort it out.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 2, "tags": "flash, actionscript 3" }
Firebase - Two offline devices modifying same data and order of changes I have an Android app, that keeps track of some items and their quantities. What I need is a way for the user to modify data on multiple devices while being offline, with proper synchronization order. I don't know how to best explain it, so I'll give an example: 1. Device A changes quantity of item to 5. 2. Device B changes it to 3. 3. Device B goes online, changes data on server, like it should, to 3. 4. Device A goes online and replaces that data with 5 which is an older change and shouldn't be done. Can this situation be prevented natively in Firebase, or should I, for example, use timestamps on items myself, and replace it only if newer? Thanks.
Adding timestamp field to every item in database and writing security rule in firebase seems to work. The thing to consider is, when offline, the only timestamp I can get is from the device, not from the server, so it can sometimes lead to overwrite of data that we don't want. Still it works good enough for this project. Below is the database rule needed to check those timestamps: "$name" : { ".write": "!data.exists() || (newData.child('timestamp').isNumber() && data.child('timestamp').val() <= newData.child('timestamp').val())" } It says: "you can write if there's no data, or stored data has older timestamp that new request" Important thing to remember while making those is, that parent nodes overwrite rules in children. That means any authentication of write should be done on this level too.
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 6, "tags": "firebase, synchronization, firebase realtime database, wpfdatagrid, offline" }
MacOS App Resolution Independence I know how to change the screen resolution for the entire system. That is not a problem. What I would like to do (for my boss) is to "make everything bigger" in macOS 10.14 Mojave Mail, which is his preferred mail client. I know how to increase the size of the fonts in the mail list and in the massages already. That helps some, but there is also the issue of the left-hand navigation pane (Inbox, Sent, Junk, etc). Is it possible to increase the resolution of specific apps independently of the rest of the MacOS system? Alternatively, how does one increase the size of other things in Mac Mail?
No, Apple does not support app-dependent window scaling. The screen is scaled as a whole. That's why it works so well, compared to Windows' attempts at HiDPI. Sadly, Apple does not provide options for setting typefaces and sizes for a considerable part of its UI. Your best bet is to set the screen scaling to a value where everything is at a suitable size.
stackexchange-apple
{ "answer_score": 3, "question_score": 2, "tags": "macos, mail.app, mojave, resolution" }
Triangle with two slopes and x-axis Triangle has: Side 1 (p): `x-2y+1=0` Side 2 (q): `x+y-2=0` Side 3: x-axis What is the area of this triangle? I know that it has 2 equal sides but I have no idea how to solve this.
I guess you mean the area of the triangle. First find the two vertices on $x$-axis by substituting $y=0$ into (p) and (q), and you'll get $(-1,0),(2,0)$, the length of the side along the $x$-axis is $3$. Now solve (p) and (q) to get the third vertex $(1,1)$. So the height corresponding to the side above is $|1|=1$. Therefore the area is $A=\frac{1}{2}\cdot 3\cdot 1=\frac{3}{2}$.
stackexchange-math
{ "answer_score": 1, "question_score": 0, "tags": "geometry, analytic geometry" }
How to build Twitter Bootstrap I'm trying to build Bootstrap from source. It is throwing the following error while I'm trying to run the `make` command. Running JSHint on javascript... â Done /bin/sh: 1: recess: not found make: *** [build] Error 127 This is what I've done so far 1. Clone the bootstrap repository `git clone git://github.com/twitter/bootstrap.git` 2. Install npm `apt-get intall npm` 3. Install less `npm install -g less` 4. Install jshint `npm install -g jshint` 5. Install make `apt-get install make` What am I missing here?
You are missing recess, wrapper for less keeping CSS code clean due to the Twitter's code guide. Just follow the instruction in the README.md file from the Bootstrap sources. See "Developers" section (same info also in official Bootstrap site): npm install recess connect uglify-js jshint -g
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 6, "tags": "twitter bootstrap, makefile" }
Good third party comment system for a custom CMS? I built a small cms for personal websites using Rails. Each site has a simple blog. I've been looking for a good third party comment system to add to the cms. Have you used (or know of) any "comment service" that I can seamlessly integrate via their API, and if they have a ruby gem even better. Thanks in advance Deb
In addition to the two above, I've found this service (formerly called jskit) interesting, and it seems to have some great Twitter-integration features: <
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 2, "tags": "ruby on rails, content management system, rubygems, comments, social networking" }
Google App Engine Prepaid Instance Hours From the application dashboard you used to be able to navigate to a menu option under Billing in order to access and set your prepaid instance hours. That menu seems to been moved or removed. Where is this menu now? How does one currently purchase prepaid instance hours?
you can't purchase prepaid instance hours any more. since the new pricing announced this year prices dropped about 30% for appengine. also there is a sustained use discount applied to the cloud plaform. <
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "google app engine" }
Lebesgue measure of a set and its closure Is it true that for any $A\subset\mathbb{R}$ then the Lebesgue measure $$m(A)=m(\overline{A})$$ And why? where $\overline{A}$ denotes the closure of the set.
**Hint:** Consider $A=\mathbb{Q}$.
stackexchange-math
{ "answer_score": 13, "question_score": 5, "tags": "measure theory" }
How to Remove "[Running] python -u" while running my code in Output (Code Runner) How to remove the [Running] python -u "e:\Cats\Brownie\Python\helloworld.py"? I know, that code runner is doing this. I want the output to come like this: > Hello World! But it's coming like this: > [Running] python -u "e:\Cats\Brownie\Python\helloworld.py" Hello World! [Done] exited with code=0 in 0.29 seconds You might ask "Why code runner? the Terminal is there right?" I also like the terminal but I don't wanna type "python helloworld.py" 10000 times I run my code.
You could find the "`showExecutionMessage`" option in "settings", uncheck it: ![enter image description here]( Or add the following settings in "settings.json": "code-runner.showExecutionMessage": false, Run: ![enter image description here](
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "python, visual studio code" }
How do I authenticate for Twitter friends_timeline? This is my first web API project, so I hope the solution to this isn't blindingly obvious. // Contstruct the http request NSString *urlString = [NSString stringWithFormat:@" username, password, friend]; NSURL *url = [NSURL URLWithString:urlString]; NSURLRequest *urlRequest = [NSURLRequest requestWithURL:url]; // Recive the data from the synchronous request NSData *urlData; urlData = [NSURLConnection sendSynchronousRequest:urlRequest returningResponse:nil error:nil]; The results returned from this query look fine _except_ they don't reflect if I've favorited them or not. All tweets return "false", even if the authenticating user has starred them. I'm fairly confident that I'm authenticating correctly as code further down that does require authentication behaves correctly.
Add a Basic Authentication header field where you specify the username/password. Most libraries have a setCredentials() method though.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "objective c, twitter" }
fetch record from cursor in SQL i have list of records and have created cursor to loop through each record and check certain condition and return record if it satisfies my cursor is as follows : DECLARE @ID int DECLARE @FromDate datetime, @ToDate datetime DEClare @expid as int set @expid = 839 DECLARE IDs CURSOR FOR select patpid,fromdate,todate from tdp_ProviderAccomodationTariffPlan where fk_patid = 162 and fk_pacid = 36 OPEN IDs FETCH NEXT FROM IDs into @ID,@FromDate,@ToDate WHILE @@FETCH_STATUS = 0 BEGIN print @ID print @FromDate print @ToDate --SELECT patpid,rate,SType FROM tdp_ProviderAccomodationTariffPlan --WHERE ('2012-12-27' BETWEEN @FromDate AND @ToDate) and fk_patid = 162 and fk_pacid = 36 FETCH NEXT FROM IDs into @ID,@FromDate,@ToDate END CLOSE IDs DEALLOCATE IDs in loop cursor fetch record whose id is '839' , Please help me solve the problem.
Replace your cursor with WHILE loops to gain faster performance as follows: select identity(int,1,1) as id, patpid,fromdate,todate INTO #temp1 from tdp_ProviderAccomodationTariffPlan where fk_patid = 162 and fk_pacid = 36 declare @index int declare @count int select @count = count(*) from @temp1 set @index = 1 declare @patpid int declare @fromdate datetime declare @todate datetime while @index <= @count begin select @patid = patid, @fromdate = fromdate, @todate = todate from #temp1 where id = @index -- do your logic here set @index= @index + 1 end drop table #temp1
stackexchange-stackoverflow
{ "answer_score": 6, "question_score": 6, "tags": "sql server 2008, database cursor" }
Unable to execute command in cron I was trying to configure rsync to backup a directory every day with the name of current day. rsync --verbose --stats --compress --recursive /home/alpha/ /var/backups/alpha/`date +"%a"` Above command is working fine and is syncing data in `Mon` directory. But when I copy the same command in **cron** it is not working 13 16 * * * rsync --verbose --stats --compress --recursive /home/alpha/ /var/backups/alpha/`date +"%a"` But when I remove **`date +"%a"`** part from **cron** it works. Why cron is not executing **`date +"%a"`**?
The `%` sign must be escaped with `\`, since it is an alternate way to end a command in `crontab`. > The "sixth" field (the rest of the line) specifies the command to be run. The entire command portion of the line, up to a newline or % character, will be executed by /bin/sh or by the shell specified in the SHELL variable of the cronfile. Percent-signs (%) in the command, unless escaped with backslash (), will be changed into newline characters, and all data after the first % will be sent to the command as standard input. So your `crontab` line should look like: 13 16 * * * rsync --verbose --stats --compress --recursive /home/alpha/ /var/backups/alpha/`date +"\%a"` Sources: * < * <
stackexchange-askubuntu
{ "answer_score": 4, "question_score": 1, "tags": "cron" }
GCC linker does not link standard library I'm developing a basic kernel for my term project. Until now, I haven't used any standard libraries in my project but I needed `gets()`, I included `<stdio.h>`. GCC finds the header location but the linker gives error : ld -melf_i386 -Tlink.ld -o kernel boot.o main.o monitor.o common.o descriptor_tables.o isr.o interrupt.o gdt.o timer.o main.o: In function `main': main.c:(.text+0x53): undefined reference to `gets' This is my Makefile file, SOURCES=boot.o main.o monitor.o common.o descriptor_tables.o isr.o interrupt.o gdt.o timer.o CFLAGS= -m32 -fno-stack-protector -fstack-check LDFLAGS= -melf_i386 -Tlink.ld ASFLAGS=-felf all: $(SOURCES) link clean: -rm *.o kernel link: ld $(LDFLAGS) -o kernel $(SOURCES) .s.o: nasm $(ASFLAGS) $<
You cannot use the C library for a kernel as it is build **for an existing kernel** and relies on the syscalls of its target OS. Instead, you have to write a driver for keyboards and everything else you need to get characters from anywhere. `getc()` is a very advanced function from that point of view and you should consider making the basic functions of the kernel stable before programming anything to interact with. By the way, you should really build a cross compiler. It has many advantages over feeding the system compiler with awkward options. After all, the kernel is meant to run on different machines, so it should be compiled for bare x86, which is what a cross-compiler does. Keep coding this thing! leitimmel
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "c, gcc, assembly, osdev" }
How do I Fulton child soldiers? In Metal Gear Solid 5: The Phantom Pain, Mission 23 Kaz wants me to Fulton child soldiers to save me a lot of time. How do I do that?
Side Ops 113 unlocks the child Fulton. To unlock the Side Ops, you will have to complete Mission 26.
stackexchange-gaming
{ "answer_score": 15, "question_score": 8, "tags": "metal gear solid 5 the phantom pain" }
Does Libre Office have an equivalent of OneNote, or is there another alternative? I know that LibreOffice is a bit like Microsoft Office, but I can't find the equivalent of OneNote, something that I used a lot before I moved over to Ubuntu, and I do miss the features that it had. Currently I use Evernote Web, or just nothing at all. Does this not exist?
Libreoffice does not have an equivalent to Onenote, but nobody says you should use only Libreoffice on your PC. Along with some of the very good alternatives already pointed out by Sardinha 94410 and muru, you may want to use a program with sync capabilities. In that case you should keep in mind that: * Evernote works great for taking notes and syncing across devices, and there are two clients which run on Ubuntu (NixNote and Everpad) * There is a free online version of OneNote which you can use with a Live account I personally prefer using the Evernote web interface, but it's a matter of taste.
stackexchange-askubuntu
{ "answer_score": 13, "question_score": 32, "tags": "software recommendation, libreoffice" }
MacOS X - how to move separate data partition into home directory? I'm having a MacBook 13" with MACOS X 10.6.8. Up to now I had a separate data partition called /Volumes/Data and a partition for the OS, user folders, etc. /Volumes/System I want to merge the 2 partition into one and integrate the "Data" directory into the home directory of my user account and have system and data on one partition. * I wonder how I could do that without breaking all the applications, scripts, aliases and things which are referring to the path /Volumes/data Would it be sufficient to move it into ~/data and then create a symbolic link named "data" in the /Volumes/ directory? Or is there another way to create a "virtual volume" which points to the path in my home directory?
Move /Volumes/Data to your home directory, e.g. mv /Volumes/Data ~/Data Verify that everything is there. Try unmounting the partiotion and accessing your new Data files just to make sure. If everything is ok, unmount the /Volumes/Data permanently. If your /Volumes is a directory and Data was the mount point, you may have to delete /Volumes/Data rmdir /Volumes/Data Then create a symbolic link to the new location: ln -s ~/data /Volumes/Data Always a good idea to create a backup first!
stackexchange-superuser
{ "answer_score": 2, "question_score": 0, "tags": "osx snow leopard, partitioning" }
converting base64 to GUIDs/UUIDs in bigquery I've been trying to find a way to decode a base64 column in a bigquery table to a GUID/UUID. Does anyone know of a function in SQL that I can do this with or would I have to use a different language than SQL.
If understand correctly, `SELECT FROM_BASE64(guid_column) AS id` should do it for you.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "google bigquery, base64, guid" }
How can i change font color for a snapchat login button after click on it? I use the official login button example from snapchat kit After clicking on the login button, the span element with text is deleted. What should I change in my code to see span text even after clicking on the login button? My code example is here codesandbox
I have fixed this with ::before element .snapchat-login-button button { animation: none; &::before { content: "Button text is here" } } .snapchat-login-button span { padding-left: 0; display: none; }
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "javascript, reactjs, sdk, snapchat" }
Customizing one route in Rails 3 resources function By default the resources command generates the url for `new` action as `{model}/new`. Sending a `path_names = {}` hash doesn't change the base `{model}` according to the documentation. How would I go about routing `/submit` to `posts#new` action?
match 'submit' => 'posts#new' I hope this is what you are looking for... You might want to have a look at those two awesome screencasts by Ryan Bates if you wish to understand how it works behind the scene. routing-walkthrough routing-walkthrough-part-2
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "ruby on rails, rails routing" }
how can I set up this equation for constrained maximization? ![enter image description here]( How i can write this equation inside R as a function? subject to: 20* x1 \+ 170*x2 = 20000 ![enter image description here]( #ATTEMPT library(Rsolnp) fn <- function(h, s){ z=200 * x[1]^(2/3) * x[2]^(1/3) return(-z)} # constraint z1: 20*x+170*y=20000 eqn <- function(x) { z1=20*x[1] + 170*x[2] return(c(z1)) } constraints = c(20000) x0 <- c(1, 1) # setup init values sol1 <- solnp(x0, fun = fn, eqfun = eqn, eqB = constraints) sol1$pars
In R, we would use the keyword `function`, and we would pass the necessary parameters: for example in this case. R <- function(h, s)200 * h^(2/3) * s^(1/3) We now have a function called R, that takes in arguments h and s and gives us an output. For example, we could do: R(27, 8)
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "r" }
Why doesn't FirebaseFirestore throw an exception deleting a non-existing file? I want to know when FirebaseFirestore does not delete file from remove: FirebaseFirestore db = FirebaseFirestore.getInstance(); FirebaseFirestoreSettings settings = new FirebaseFirestoreSettings.Builder() .setPersistenceEnabled(false) .build(); db.setFirestoreSettings(settings); //delet document from Cloud Firestore by documentId (is uniq name of doucument) db.collection(COLLECTION_PATH).document(documentId).delete() I put non-existing id of document but task is isSuccessful. Is it correct behave?
The task is considered successful when the document no longer exists on the server. That means that the task is also successful if the document doesn't exist by the time your action gets to the server. So what you're seeing is indeed the expected behavior. If you want to know if the document previously existed, use a transaction that fetches the document first, checks for existence, and then deletes it.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "android, firebase, google cloud firestore" }
iOS: How do I detect if an email has been successfully sent? I am trying to check if an Email message was sent and display an Alert allowing the user know. I tried the delegate method below , but sadly will display the alert message if user cancels as well. Any help will be appreciated and rewarded. - (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error{ if (error) { UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error" message: [NSString stringWithFormat:@"Error %@", [error description]] delegate:self cancelButtonTitle:@"Dismiss" otherButtonTitles:nil]; [alert show]; } NSLog(@"email sent"); } }
All that it means when that function is called is that _something_ happened with the email because the `MFMailComposeViewController` is finished. To know what did actually happen, you have to take a look at the value of `result`, which can be any of the following: MFMailComposeResultCancelled MFMailComposeResultSaved MFMailComposeResultSent MFMailComposeResultFailed As rmaddy says in comments, you can't be 100% sure that the email was actually sent (it could be stuck in the outbox). What `MFMailComposeResultSent` signifies, then, is that the email has been sent over to the Mail app, which will send it as soon as it can.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "ios, cocoa touch, mfmailcomposeviewcontroller" }
If I delete a paid app purchased through the Mac App Store, can I redownload without paying? If I delete an app purchased through the Mac App Store, can I download it again without paying for it again like I can with iOS? In the event of an app restore, does the app retain settings, saved progress, etc from the previous installation?
Yes. Just go to the "Purchases" tab and click "Install" by the app you wish to reinstall: ![]( Well-behaved apps should retain settings, etc upon reinstall, as merely deleting the app from /Applications is not sufficient to remove that information from your system. This may not be the case if an app cleaner is used.
stackexchange-apple
{ "answer_score": 13, "question_score": 7, "tags": "applications, restore, mac appstore" }
MySQL Query - select distinct showing wrong results Im wondering if someone could help me. I have hundreds of people uploading images to my site, basically each upload has its own row in the database with the data created, user id, images name etc etc etc. What i want to do is display the last 3 users to upload images the problem being that if a user uploads more pics, another row is added to the database with that users id so i can just show the last 3 rows. I have the following statement, but it doesnt seem to be working properly SELECT DISTINCT * FROM kicks GROUP BY uid ORDER BY created DESC LIMIT 3 I was wondering if someone could point me out where im going wrong. Cheers Sorry, i should have added sample data, ok id | uid | created | 195 | 33 | 2012-03-06 12:32:54 196 | 33 | 2012-03-06 12:35:23 197 | 34 | 2012-03-06 13:09:31 198 | 19 | 2012-03-08 10:37:21 199 | 33 | 2012-03-09 21:04:04
`SELECT DISTINCT uid FROM kicks ORDER BY created DESC LIMIT 3` is what you want.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": -2, "tags": "php, mysql" }
Jmeter XML API Response and JDBC response value matching order Jmeter XML API Response and JDBC response value matching order. Do you think this order is correct? (Xpath reference name is using in jdbc request) ![enter image description here]( **more details given below** ![enter image description here]( ![enter image description here]( ![enter image description here](
Finally I found answer for this just moved Response assertion under JDBC request[other screenshots are remain same]. Thank you all. ![enter image description here](
stackexchange-sqa
{ "answer_score": 0, "question_score": 1, "tags": "java, jmeter, jmeter plugins, sql" }
add sqlite DB to executable JAR file I am using JAVA (with eclipse juno) and try to create an executable JAR file which include sqlite DB file. I've try to get connection to the DB by this line: DriverManager.getConnection("jdbc:sqlite:"+DataController.class.getResource("test.sqlite").getPath()) The DataController is a class that located where the sqlite located. and i keep get an error: java.sql.SQLException: invalid database address Does someone can help and give step by step instructions about how to include sqlite DB inside an executable JAR file?
Apparently sqlite-jdbc can open resources on it's own. Per this thread < add :resource to the path. So try the following: DriverManager.getConnection("jdbc:sqlite::resource:package/test.sqlite"); or depends on version of sqlite DriverManager.getConnection("jdbc:sqlite::resource:package/test.db"); Replacing package with the '/' separated path to the package this file is in. Be aware that it will actually copy the file to a tmp directory.-
stackexchange-stackoverflow
{ "answer_score": 15, "question_score": 8, "tags": "java, eclipse, jdbc" }
Chrome processes still being displayed, even after chrome instance has been closed I've recently been playing around with the Process class, however, I've come across something a bit peculiar. When I execute the following code, after I have closed all instances of Chrome: foreach(var p in Process.GetProcesses().OrderBy(p => p.ProcessName)) { if(p.ProcessName == "chrome") string.Format("{0}: {1} - {2}", p.Id, p.ProcessName).Dump(); } The strange thing is that it still shows multiple chrome processes running. How is this possible?
Chrome per default preserves its processes when they are started by a plugin. So, if you have any plugin installed, this process will remain in memory after you have once started Chrome - even after you have closed the browser. This is done due to performance reasons - almost all plugins will go through a fairly extensive initialization phase on startup (login, data retrieval etc.). You can change this in Chrome's settings.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "c#, asp.net, google chrome" }
Modeling Complicated Wheel I'm currently modeling a Golf GTI 2018 in Blender, and have come down to modeling the wheels. I'm currently using Blue Inversion's tutorial, and I just can't find a way to get the way the GTI's wheels look. The way that the "spokes" or whatever they're called come out not straight but each slanted like a throwing star or something of the type. I was wondering if anyone had any tips on how to model the wheel. Any tutorial on Youtube I search up have the spokes coming straight out. Blue Inversion's tutorial ![GolfGTI Wheel](
![enter image description here]( 1. Make a circle with 5 vertices. 2. Duplicate it (in Edit Mode, so it's the same object) and scale up. Rotate the outer circle. 3. Select all Edges and subdivide. 4. Make faces following the pattern shown. 5. You're done- you can adjust/tweak/whatever now
stackexchange-blender
{ "answer_score": 6, "question_score": 1, "tags": "modeling" }
Is __int32 defined? gcc c89 I am came across this code. typedef __int32 int32_t; typedef unsigned __int32 uint32_t; typedef __int64 int64_t; typedef unsigned __int32 uint64_t; I am just wondering that is the __int32 I didn't think that was a type? Why the underscore? Does this mean I could do things like this? typedef __int32 myInt32; Many thanks for any advice,
The type is not standard, but is supported on your compiler. Symbols that begin with an underscore or contain two underscores are reserved by the standard for your compiler's implementation. See Why do people use __(double underscore) so much in C++ (The question is about C++ but the reason is the same)
stackexchange-stackoverflow
{ "answer_score": 7, "question_score": 4, "tags": "c" }
I need to decrease first n elements of an array by 1 I would like to decrease the first n-elements in an array by 1. I tried this but its not working int n = 3; for(int i = 0 ; i <array.length;i++) { while(i<=n){ array[i]-=1; } }
let's say `n=3` int n =3; for(i = n-1; i >= 0; i--) { array[i]-=1; } Alternatively as @locus2k points out we can also iterate through the array starting at the 0th index as so int n = 3; for(i = 0; i < n; i++) { array[i]-=1; }
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": -6, "tags": "java, arrays" }
Python django выводит ошибку:django.db.utils.IntegrityError: ОШИБКА: столбец "group_id" содержит значения NULL Я работал над проектом и все было хорошо,я работал с моделями,и в один момент django начал выводить ошибку:Python django выводит ошибку:django.db.utils.IntegrityError: ОШИБКА: столбец "group_id" содержит значения NULL.Я почистил модели и создал новые , но это ошибка вылазит каждый раз.Работаю на бд postgresql.В чем проблема?
попробуйте вернуть миграции к начальному состоянию python manage.py migrate 'имя_приложения' zero --fake Создать новый файл миграции python manage.py makemigrations Запустить новую миграцию с параметром fake, чтобы добавить информацию о миграции в базу данных,не изменяя структуру базы данных python manage.py migrate 'имя_приложения' --fake
stackexchange-ru_stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "django, postgresql" }
Solidity: extracting (slicing) characters from a string Perhaps a double, but I couldn't find an answer here, and neither in strings library. I have a `string public string = "ABCDEFG"` I need to put together a function that iterates through the characters of the string and returns the characters that are in between the input numbers. for example, `function getSlice(uint256 begin, uint256 end)` would return `CDE` if passed 2 and 6. What would be the best way to create such a function?
You can do this: pragma solidity 0.4.24; contract test{ function getSlice(uint256 begin, uint256 end, string text) public pure returns (string) { bytes memory a = new bytes(end-begin+1); for(uint i=0;i<=end-begin;i++){ a[i] = bytes(text)[i+begin-1]; } return string(a); } } The variable `text` is the text that you want to slice. Hope it helps
stackexchange-ethereum
{ "answer_score": 5, "question_score": 3, "tags": "solidity, string" }
Kill all instances of an Activity I'm setting up Notifications in my app and I've noticed whilst testing, after clicking a new notifications (in this case the notification loads a blog details page), I have many instances of the blog details activity running (pressing back it shows each activity with the previously loaded blogs). Is it possible in my Receiver class, so look if there is any instance of `ActivityBlog` already running, and if there all `.finish()` them all so there is only ever once instance running? I found this but I couldn't work out a way to do it from that.
You should study _activity launch modes_ < Use **android:launchMode="singleTop"** in element in manifest file. You will get callback in **onNewIntent()** if an instance of activity is already up. Stack of your activities will be automatically updated and there wont be any need of killing activities which is consumes time and resources. This i believe is the recommended approach.
stackexchange-stackoverflow
{ "answer_score": 6, "question_score": 1, "tags": "android, android activity, android notifications" }
Remote clients can't access Delphi WebService hosted in IIS 7.5 ## Remote clients can't access Delphi WebService hosted in IIS 7.5 Delphi WS clients are configured to point to URL of Delphi SOAP webService hosted on Windows 7, IIS 7.5 server. **All clients point to same URL - (not the default 'local host' generated by WSDL import utility). WebService VD is configured to allow anonymous access using credentials of a domain admin account** Problem: clients deployed on the server machine itself run fine, clients deployed on other machines on the network cannot access webService - error msg: 'EDOMParseError at $00534E53 XML document must have a top level element'. I've tried this instantiating the client proxy class with both SOAP and WSDL params. Same webService hosted on XP-IIS 5 server is accessible to all clients, so I believe this is probably a configuration problem in IIS 7.5.
@CosminPrund was correct in his comment on the question. Windows Firewall was only permitting file sharing in the domain, but not other services.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 2, "tags": "web services, delphi, windows 7, iis 7.5" }
Why do people behave normally when they come across Ted Ted is famous and most of the people will be aware that a walking talking teddy bear exists in the world but its not normal to come across a walking talking teddy bear in daily life at a public place. It is strange that people are not even excited to see him. Why is that so?
> Its not normal to come across a walking talking teddy bear in daily life at a public place It's not normal in our reality but it is normal in this _movie universe_ As Wikipedia#Plot) says* > In 1985, 8-year-old John Bennett is a lonely child living in Norwood, Massachusetts, a suburb of Boston, who wished for his new Christmas gift—a jumbo teddy bear named Ted—to come to life and become his friend. The wish coincides with a shooting star and comes true; **word spread and Ted was briefly a celebrity**. T **ed has been around for over 25 years and his existence is well known**. Certainly he's unique and one could argue that he should be more of a celebrity but people get blase about such things. * Thanks to @BCdotWEB In fact, as noted by @Gallifreyan it's stated that > "Eventually, nobody gives a shit"
stackexchange-movies
{ "answer_score": 4, "question_score": -2, "tags": "ted, ted 2" }
How to display fileRead result in an input? I'm using `phonegap` and using it's `fileRead` method to read a txt file. I can output the contents in the text file by using: function fileRead(evt) { alert(evt.target.result); } but this only gives me an alert of the content. I rather the content to be shown in a `input` area I provided after I click a button. I'm not sure if I should use input field or textarea field after a button is clicked. Below is my code for the `input` field I wish my content to be shown after retrieving it: <div data-role="fieldcontain"> <input name="" id="retrieveText" placeholder="Sample Text" value="" type="text"> </div>
document.getElementById('retrieveText').value=evt.target.result;
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 1, "tags": "javascript, jquery, html, cordova" }
Commands on my .bash_profile aren't recognized when using `:!cmd` on OSX 10.11 using mvim Why are the commands on my `.bash_profile` not recognized? I tried using both `set shell=/bin/bash\` and `set shell=/bin/bash\ -i` \- none worked.
The shell which executes your command isn't a login shell, so it doesn't load .bash_profile. One hack for getting it to work (even though most people I've seen recommend against it) is: `:set shellcmdflag=-i` in your .vimrc. I don't recall why it was recommended against, but when I've done it, Vim tends to randomly get put in the background like `CTRL+z` was pressed. Here's a previous StackOverflow answer to the same question: <
stackexchange-vi
{ "answer_score": 2, "question_score": 1, "tags": "vimrc" }
How do you have multiple multiplicities in a polynomial? I need to make a 3 degree polynomial with the only zeros being 3 with the multiplicity being "1, 4 and multiplicity of 2." I know that the zeros and 3 degree are typed together like so, (x-3)^3. But how can one have multiple multiplicities? Here is the full question for future users. "Find a formula for a degree three polynomial function whose zeros are 3 with multiplicity 1, and 4 with multiplicity 2" It was worded funny.
The sum of the multiplicities of the roots of a polynomial is equal to the degree of the polynomial (this is essentially the Fundamental Theorem of Algebra). Since your polynomial has degree 3, the only reasonable interpretation of the problem that I can find is that the polynomial should have as roots 3 (with multiplicity 1) and 4 (with multiplicity 2), which identifies the polynomial $c(x-3)(x-4)^2$, where $c$ is any nonzero constant. To answer your question more directly, there is no such thing as "multiple multiplicities" in the sense of a single root having more than one multiplicity associated with it. The multiplicity of a root $r$ refers to the exponent of $(x-r)$ in the factorization of the polynomial.
stackexchange-math
{ "answer_score": 0, "question_score": 1, "tags": "algebra precalculus, polynomials" }
How to limit items from for loop? How to limit items from for loop <?php for ($i=0; $i< count($contentdinamit["chart"]["songs"]["song"]); $i++ ) { echo'<li class="up"><a href="' .$contentdinamit["chart"]["songs"]["song"]["$i"]["artist_name"].'"><strong>' .$contentdinamit["chart"]["songs"]["song"]["$i"]["song_name"].'</strong></a><br /><a href="' .$contentdinamit["chart"]["songs"]["song"]["$i"]["artist_name"].'">' .$contentdinamit["chart"]["songs"]["song"]["$i"]["artist_name"].'</a></li>'; } ?>
Dont know what you mean there. But here is what I understand from your question <?php for ($i=0; $i< count($contentdinamit["chart"]["songs"]["song"]); $i++ ) { if(($i+1)<=10){//limit your item by 10 echo'<li class="up"><a href="' .$contentdinamit["chart"]["songs"]["song"]["$i"]["artist_name"].'"><strong>' .$contentdinamit["chart"]["songs"]["song"]["$i"]["song_name"].'</strong></a><br /><a href="' .$contentdinamit["chart"]["songs"]["song"]["$i"]["artist_name"].'">' .$contentdinamit["chart"]["songs"]["song"]["$i"]["artist_name"].'</a></li>'; } } ?>
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": -6, "tags": "php, for loop, count, limit" }
in vim, how to get rid of irritating "E141: No file name for buffer nn" This happens when I open an anonymous scratch file, and then do a `:wa` even if I close the buffer.
Your own answer is just curing the symptoms, not tackling the root cause. It's better to properly indicate to Vim that your "scratch buffer" (which I guess is just by convention for you) is not meant to be persisted. That's what the `'buftype'` option is for. Open a scratch buffer with this (or create a corresponding mapping or command): :new +setl\ buftype=nofile
stackexchange-stackoverflow
{ "answer_score": 11, "question_score": 6, "tags": "vim" }
How Reverse DNS does what it does Hopefully this is not a stupid question, but I cannot find a clear cut answer. Can someone please inform me exactly what 'source address' is used in Reverse DNS? Does rDNS pull the IP address from the `Received:` portion of the header, or does it use the `Sender:` or `From:` address to get the domain? I understand the purpose of rDNS and why we use it, but I want to be able to send email using an email service and have the `From` and `Sender` indicating otherwise. Will this affect the delivery of my emails? Thanks in advance.
> Does rDNS pull the IP address from the Received: portion of the header Depends on exactly what you are looking at. A mail server, or some anti-spam system. Most often the IP address used has nothing to do with anything in the message headers or body, and instead is the source address of the mail server/client that has connected and is attempting to deliver the message. > I want to be able to send email using an email service and have the From and Sender indicating otherwise. Will this affect the delivery of my emails? Possibly, but not often. What matters more is your SPF record. If you have a SPF record, you must explicitly permit the all systems that will be sending messages for a given domain. The reverse DNS address of the sending MTA doesn't usually have to match the envelop from address. AFAIK, there are very few SPAM systems that take this into account, and none that would block the messages solely because of something like this.
stackexchange-serverfault
{ "answer_score": 3, "question_score": 2, "tags": "email, email server, reverse dns, spam filter, spam" }
Call Kinesis Firehose vs Kinesis Stream directly from Lambda I have a need where I wanted to push some data to S3 from lambda. The data coming to Lambda is from a Dynamodb streams. Since, for pushing to S3 bucket, use of Firehose is considered best as it batches and buffers the data before pushing to S3 as well as provide the retry strategy. So, I am using Firehose instead of directly pushing to S3. But I observe lot of people push data from Lambda to Kinesis Stream from which data is pushed to Kinesis Firehose instead of directly pushing to Firehose from AWS Lambda. Is there any reason of doing it this way? Any benefits? What are the drawbacks of pushing to Kinesis firehose directly?
If **Amazon Kinesis Data Firehose** meets your needs, then definitely use it! It takes care of most of the work for you, compared to normal Kinesis Streams. The only time you would **_not_ use Firehose** is when you have a different destination (eg you want to process the data on Amazon EC2 instances) or you want more control of the streams and shards (eg to process certain producers on specific shards to retain ordering on a per-shard basis).
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "amazon web services, amazon s3, aws lambda, amazon kinesis firehose, amazon kinesis" }
PHP get create time of directory Is there anyway to find the created time of a directory in php? I've tried `filectime` but that only works on files.
It should work for directories, this is what I get: $ php -r "echo filectime(__DIR__);" 1311596297
stackexchange-stackoverflow
{ "answer_score": 9, "question_score": 13, "tags": "php" }
Installing software programmatically in background I trying to make an application that help me to install software on other PC, I am using this code but did not work unfortunately : string filename = "Java\\jre-6u24-windows-i586.exe"; Process p = new Process(); p.StartInfo.FileName = "msiexec.exe"; p.StartInfo.Arguments = "/i \"" + filename + "\" /qn"; p.StartInfo.UseShellExecute = false; p.StartInfo.RedirectStandardOutput = true; p.Start(); string output = p.StandardOutput.ReadToEnd(); p.WaitForExit(); if (p.ExitCode != 0) { MessageBox.Show("ERROR: " + output); } > ERROR : T
**`msiexec.exe`** is to install ***.msi-Files!** Your `re-6u24-windows-i586.exe` is a standalone executeable. Which must be assigned to the `p.StartInfo.FileName` property! And the `p.StartInfo.Arguments` must contain the args this specific installer! **`/qn`** are args for an MSI-package!
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": -2, "tags": "c#" }
Pass values to child in LayoutBuilder I'm using LayoutBuilder and would like to pass values to a child widget: LayoutBuilder( builder: (BuildContext context, BoxConstraints constraints) { return Padding( padding: const EdgeInsets.all(constraints.maxWidth / 10), But I'm getting the error Invalid constant value Is there a way to pass constraints.maxWidth to the child widget?
Remove the const keyword before EdgeInsets.all because constraints.maxWidth is not a constant term
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "flutter, widget, flutter layoutbuilder" }
Product Image Uploader to Preview Product M2.2.2 My goal is to have the same functionality as the "Image and Video" uploader to preview my products in a block I created. ![enter image description here]( ![enter image description here]( As of right now, this is what my module looks like. ![enter image description here]( If you need any more information, just let me know! Thanks for looking.
I found a solution using the Github repo below. This allowed me to add images in the product tab. snowdog/module-product-custom-description
stackexchange-magento
{ "answer_score": 0, "question_score": 2, "tags": "module, custom options, custom attributes, magento2.2.2, gallery image" }
Change Part of text font in Excel cell using vba Hi I am trying to create a function to calculate milliohms (mOhms) my function is Function mOhms(Current, Voltage) mOhms = Format((Voltage / Current) * 1000, "00.00 m") & Chr(87) End Function with results being > 40.00 mW (if cell values are 24 and 1 respectivly) How do i get the W as (Ω) ohms symbol if i change the cell font style to Symbol m changes to micro (μ) symbol i have tried paying with With ActiveCell.Characters(Start:=Len(ActiveCell) - 1, Length:=1).Font .FontStyle = "Symbol" End With Which results in "Circular reference error"s Need some help to resolve this
Try using Unicode in place of the Chr(87) Function mOhms(Current, Voltage) mOhms = Format((Voltage / Current) * 1000, "00.00 m") & ChrW(&H2126) End Function
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "vba, excel, function, fonts" }
IP для подключения к сокету Я через android могу подключится к серверу только через 192.168.0.102, а через айпи который выдаёт сайт 2ip.ru, не выходит. Почему?
`192.168.0.102` \- это ip в локальной сети. 2ip.ru выдаёт ваш внешний ip за NAT'ом. К нему вы не сможете подключиться, пока порт не пробросите.
stackexchange-ru_stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "java" }
Ideal classes fixed by the Galois group Let $K$ be a number field and let $G$ be the group of automorphisms of $K$ over $\mathbf Q$. The group $G$ acts in a natural way on the ideal class group of $K$. I would like to know if there are any results giving a formula for the number of orbits of this action (or equivalently a formula for the number of ideal classes that are fixed by some element of $G$). In particular, I would like to compare the number of orbits to the class number of $K$.
I assume you want $K$ to be Galois over $\mathbb{Q}$. More generally, let $L/K$ be a Galois extension of number fields. The the class group $C_K$ of $K$ maps to $C_L^{G_{L/K}}$, the part of $C_L$ fixed by the Galois group of $L/K$, and you seem to be asking what the quotient $C_L^{G_{L/K}}/C_K$ looks like. Taking cohomology of the exact sequences $$ 1\to R_L^*\to L^*\to L^*/R_L*\to1 \quad\text{and}\quad 1\to L^*/R_L* \to I_L \to C_L \to 1 $$ gives (if I'm not mistaken) exact sequences $$ 0 \to H^1(G_{L/K},L^*/R_L*) \to H^2(G_{L/K},R_L^*) \to \text{Br}(L/K) $$ and $$ 0 \to C_K \to C_L^{G_{L/K}} \to H^1(G_{L/K},L^*/R_L*), $$ so the quotient that you're interested in naturally injects $$ C_L^{G_{L/K}}/C_K \hookrightarrow \text{Ker}\Bigl(H^2(G_{L/K},R_L^*) \to \text{Br}(L/K)\Bigr). $$ The Galois structure of unit groups has been much studied. You might look at some of Ted Chinburg's papers (<
stackexchange-mathoverflow_net_7z
{ "answer_score": 10, "question_score": 15, "tags": "nt.number theory, algebraic number theory, class field theory" }
Run external command in dart Is it possible to run an external command in Dart? I need to run the external command `plutil`, but everything I google gives me results to run Dart code from the command line, so I have not been able to find a solution. Thanks!
Example of `Run external command in dart`: import 'dart:io'; void main(List<String> args) async { var executable = 'ls'; if (Platform.isWindows) { executable = 'dir'; } final arguments = <String>[]; print('List Files and Directories'); print('============'); final process = await Process.start(executable, arguments, runInShell: true); await stdout.addStream(process.stdout); await stderr.addStream(process.stderr); final exitCode = await process.exitCode; print('============'); print('Exit code: $exitCode'); }
stackexchange-stackoverflow
{ "answer_score": 6, "question_score": 2, "tags": "dart" }
Using update panel in AJAX a good practice in asp.net? Using update panel in AJAX a good practice in asp.net ??? ... or one should code himself for AJAX for each and every control using HTTP-Object ? In which scenarios are the above two strategies used ???
The Update Panel is a good thing in that it allows the developer to code AJAX very simply. It has a lot of overhead, though, and I would not recommend it as a solution in most (if not all) cases. Look into ASP.Net AJAX for a good way to get started using AJAX. Its fairly simple, robust, and flexible. (It doesn't prevent you from using the update panel either).
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "asp.net, ajax" }
Is there a way to build a site column and implement it twice(or more) in the same list? I want to create a list of names in and Offices site column and then use this around my site. Specifically I want to have a list with columns called OPR and OCR, but they need to be from the same site column. Is this possible?
No. You would need to create a separate site column. SharePoint doesn't support adding multiple instances of the same site column.
stackexchange-sharepoint
{ "answer_score": 2, "question_score": 1, "tags": "list, site column" }
confused with for loop incrementing rule Can you tell me why the OUTPUT of this program is `ABBBCDE`? It was my exam question. #include <stdio.h> int main (void) { int i; for (i = 0; i < 2; i++) { printf ("A"); for (; i < 3; i++) printf ("B"); printf ("C"); for (; i < 4; i++) printf ("D"); printf ("E"); } return 0; }
Because you have a for loop that checks if i is less than three. It starts at zero, zero is less than three so it prints B once, then it adds one to i and i becomes one, which is still less than three, so it prints another B. Then it ads one to i, making it two, which is still less than zero, which makes it print B a third time. Then it adds another one to i, making it three, which is not less than three, so it continues the program by typing C.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": -1, "tags": "c, for loop, increment" }
How to grow number smoothly from 0 to 5,000,000 This is probably basic math that I don't seem to remember. I'm trying to get from 0 to 5,000,000 in 10 seconds while having all the numbers ticking. I don't have to have the number reach exactly 5,000,000 because I can just do a conditional for it to stop when it's over. Right now I have this: count+= 123456 if (count > 5000000) { count = 5000000; } It gives the sense of number moving you know? But It really starts off too high. I wanted to gradually climb up.
You can tween: import fl.transitions.Tween; import fl.transitions.easing.Regular; var count = 0; var tween:Tween = new Tween(this, "count", Regular.easeInOut,0,5000000,10, true); This will tween you variable count from 0 to 5000000 in 10 seconds. Read about these classes if you want to expand on this code. * Tween * TweenEvent Good luck!
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": -1, "tags": "javascript, actionscript 3, math" }
How to package a command-line tool in Nix? Suppose you have a simple collection of `bash` scripts making up a command line tool, with a primary script in `bin/` and some library scripts in `lib/`, all to be packaged with Nix using `tool.nix` with a `default.nix` for convenience: scriptdir bin/ tool lib/ default.nix tool.nix **What should`tool.nix` look like in order to correctly package this tool, allowing to execute `tool` in the shell with `tool <args>`?**
After some help from IRC, the following `tool.nix` works: { stdenv }: let version = "0.0.1"; in stdenv.mkDerivation rec { name = "tool-${version}"; src = ./.; installPhase = '' mkdir -p $out cp -R ./bin $out/bin cp -R ./lib $out/lib ''; } For completeness, `default.nix` would look like { pkgs ? import <nixpkgs> {} }: pkgs.callPackage ./tool.nix {} and can be installed by calling `nix-env -f ./default.nix -i` from `scriptdir`.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 3, "tags": "nix" }
boostrap on wp-admin backend via plugin installation how can i add and use the twitter bootstrap to my wp-admin backend by a plugin installation approach? i plan to create multiple custom plugins and i just want to add bootstrap as a global style instead of using it per plugin this is my code, it doesnt seem to work. <?php /* * Plugin Name: bootstrap * Plugin URI: * Description: add boostrap * Author: some guy * Author URI: * Version: 0.1.0 */ function theme_name_scripts() { wp_enqueue_style( 'style-name', get_stylesheet_uri() . '/custom/css/bootstrap.css'); } add_action( 'wp_enqueue_scripts', 'theme_name_scripts' ); ?>
For use in the admin, you need the admin_enqueue_scripts hook instead of wp_enqueue_scripts.
stackexchange-wordpress
{ "answer_score": 2, "question_score": 0, "tags": "twitter bootstrap" }
Perl long data type I am writing an app in Perl that requires long data type instead of integers. How can I achieve this. For example; my $num = sprintf('%ld', 27823221234); print $num; The output is not a long, but an integer.
Here is some code that illustrates some of how Perl behaves - derived from your example: use strict; use warnings; my $num = sprintf("%ld", 27823221234); print "$num\n"; my $val = 27823221234; my $str = sprintf("%ld", $val); printf "%d = %ld = %f = %s\n", $val, $val, $val, $val; printf "%d = %ld = %f = %s\n", $str, $str, $str, $str; With a 64-bit Perl, this yields: 27823221234 27823221234 = 27823221234 = 27823221234.000000 = 27823221234 27823221234 = 27823221234 = 27823221234.000000 = 27823221234 If you really need big number (hundreds of digits), then look into the modules that support them. For example: * Math::BigInt
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 2, "tags": "perl, perl data structures" }
Indicator LED on a switch with no neutral - impossible, right? I have a switch in my bathroom that switches the floor heating (a resistive load of 180 Ω, corresponding to a power of 300 W @ 230 VAC) on/off. I'm considering replacing the manual switch with an Aqara T1 single switch module - no neutral. However, since the Aqara module will be hidden, and the manual switch will be removed, there will be no easy way to see, in the bathroom, whether the floor heating is on or off. So I considered adding an LED of some sort, but when I tried drawing the schematic, it occurred to me that that's impossible - right?
A current-sensing transformer and indicator may suit - provided an indication only when current is flowing is satisfactory. (i.e., If the switch is on but a thermostat or other control in the load switches itself off the current would drop and the indication turn off.) ![enter image description here]( _Figure 1. An image deliberately obscured so as not to be a product recommendation._
stackexchange-electronics
{ "answer_score": 4, "question_score": 1, "tags": "led, resistors, switches" }