INSTRUCTION
stringlengths 25
999
| RESPONSE
stringlengths 0
999
| SOURCE
stringlengths 16
38
| METADATA
dict |
---|---|---|---|
Moz rendering height differently on element than Webkit
Trying to display an H3 on hover using the following CSS on this site:
a > h3 {
min-width: 100% !important;
min-height: 100px;
max-height: 100px;
display: block;
position: absolute;
bottom: -80px;
color: #FFF;
padding: 25px 5px;
box-sizing: border-box;
-webkit-transition: all 300ms ease-in;
-moz-transition: all 300ms ease-in;
-ms-transition: all 300ms ease-in;
-o-transition: all 300ms ease-in;
transition: all 300ms ease-in;
a:hover > h3 {
bottom: 0;
}
For some reason this is not rendering the same in Firefox as it is in Chrome and Safari. When min-height is set to 100px it works fine in Chrome and Safari, when it is set to 50px it works fine in Firefox. | Its likely because Firefox (as of ver. 20.0.1) still needs the `-moz` vendor prefix for the `box-sizing` property, just add:
-moz-box-sizing: border-box; | stackexchange-stackoverflow | {
"answer_score": 1,
"question_score": 0,
"tags": "css, firefox"
} |
How can I configure a concurrent cloud pub/sub queue when triggering cloud functions using cloud pub/sub?
I am triggering cloud functions using cloud pubsub. However, I want cloud pubsub to run concurrently as many processes as I specify. Is there a way to this? | A cloud function (instance) invocation happens automatically when triggered by a message in a pubsub topic. Those invocations are independent from each other.
The maximum number of simultaneously running cloud functions is limited by the max-instances argument when your cloud function is deployed. | stackexchange-stackoverflow | {
"answer_score": 2,
"question_score": 0,
"tags": "google cloud platform, google cloud functions, google cloud pubsub"
} |
Application.Current.MainPage.DisplayActionSheet causing issue in xamarin.forms IOS
Hello i have implemented camera functionality in my app using media.plugin but camera does not open in ios.
if (string.IsNullOrEmpty(StorageFolder))
{
StorageFolder = await Application.Current.MainPage.DisplayActionSheet(SystemMessages.PhotoSaveFolder, "Cancel",
null, "folder1", "folder2");
}
await CrossMedia.Current.Initialize();
MediaFile file = await CrossMedia.Current.TakePhotoAsync(new StoreCameraMediaOptions
{
});
it is because of DisplayActionSheet() which i use for folder option selection.if i remove that code it works fine.then what is issue with it.cant figure out.
it dont throw any error but thread exit after some time and in debugging i am unable to trace what exactly going on. please help.stuck with this.
Thank you in advance. | oh..that's the issue of xamarin version. i upgraded xamarin.forms from 2.3.0.107 to 2.3.4.247.that was causing issue. revert back this changes solved my issue and working well as before. | stackexchange-stackoverflow | {
"answer_score": 1,
"question_score": 1,
"tags": "camera, xamarin.forms"
} |
Number Formatting in iReport
Can any body help me for giving pattern for a number?
Here is my problem.
I just wanted to display a number as "30.00",
Eventhough I had set the pattern as 2 decimal points it is not displayting the result as"30.00" instead it is showing the result as "30".
And one note is that for that field pattern it is shoeing an extra button as "ResetDefault". Is there is any problem with that button for this.
Can any one please solve this problem. | iReport has a bad habit of not changing the pattern on the jrxml when you just open and press OK (your format is default). Change something and then change it back, press OK and you are ready to GO.

Вот полный код:
# Принимаем аудио
@bot.message_handler(content_types=["voice"])
def voice_cmd(message):
# Узнаем id, если требуется
id_voice = message.voice.file_id
print(id_voice) # Вывод id сообщения в консоль
# Отправка нужного аудио
bot.send_voice(message.chat.id, "Id сообщения, которое хотим отправить") | stackexchange-ru_stackoverflow | {
"answer_score": 2,
"question_score": 0,
"tags": "python, python 3.x, telegram bot"
} |
HTML/CSS Inexplicable 1px margin/border/padding
NOTE: The website currently does not display correctly in all browsers. This is a separate goal to that of this post. Please use safari to find and diagnose the problem.
(URL REMOVED AS SOLVED)
Is our website.
looking in safari, you will see this:
!
Looking closely at the area indicated by the arrow, you can see there is a 1px gap between the header and bottom section of our... "table" of topics.
I cannot find ANY reason that this should be there! I've used the safari web inspector and checked EVERY element, no borders, no margins, no nothing up there! It should simply not exist! And yet, it does.
So I assume that his is some kind of CSS bug/quirk and I am not sure where exactly it is originating in the HTML to even begin to google about it. Can anyone offer any help as to what is actually causing this/how to fix it? | Tables are causing your problem. You can fix it (causing some more problems) by adding this CSS:
.table_list {
border-collapse: collapse;
}
But really, it's pretty useless to use tables for the section headings, although it's fine for displaying the list of forums/boards/whatever. | stackexchange-stackoverflow | {
"answer_score": 4,
"question_score": 3,
"tags": "html, css, margin, padding"
} |
Clearing SharePoint Online Distributed cache?
I have a spfx webpart that I recently deployed a quick UI update to. Essentially, I changed a dropdown to be multi-select instead of single select. For hours after deploying my update, half my users continued to see the old version of the webpart on our page, half see the new one. When my users continually refreshed, sometimes they would get the old version, sometimes the new version, sporadically, back and forth. This happened even in Incognito and InPrivate browsing sessions - so it seems to indicate a server cache of sorts on the SharePoint side of things.
I've noticed this behavior multiple times after deploying a new version of a web part. Is there a way to get SharePoint Online to clear this distributed cache, or whatever is happening behind the scenes. | As per other comments, this has two potential solutions.
1. Waiting it out will sometimes clear up this issue after a number of hours. I deploy non-critical web parts after business hours.
2. Change the Guid and redeploy such as here: < | stackexchange-sharepoint | {
"answer_score": 0,
"question_score": 3,
"tags": "sharepoint online, spfx, cache, distributedcache"
} |
Learning basics of Flash related to video streaming?
I am currently working on a on-demand video project. There's a lot of aspects to this such as the recording, transcoding, setting up a streaming server etc. The client will be a Flash powered webclient. However there is one problem with that: I don't know any Flash (I'm a C++ developer).
I am willing to spend some days or weeks learning Flash. However, the size of the Flash universe is somewhat overwhelming. I would greatly appreciate it if somebody would summarize which topics I need to learn in order to use Flash for video playback.
The features that should be implemented for the video player are:
* playback of the video
* table of contents that can be clicked to jump to the corresponding video segment
So that's not too much I think.
And one final but very important question: _do I need a paid license in order to create Flash applications?_ | GotoAndLearn is a /great/ resource. Make sure you select to view ActionScript 3 tutorials, rather than ActionScript 2.
Also, take a look at the ActionScript 3 API. There are some examples at the bottom of each page. Classes you want to become familiar with:
* flash.net.NetStream
* flash.net.NetConnection
* flash.media.Video
* flash.media.Sound
* flash.media.SoundChannel
* flash.media.SoundTransform | stackexchange-stackoverflow | {
"answer_score": 1,
"question_score": 0,
"tags": "flash"
} |
Lenovo ThinkPad W540 works through the power adapter without the battery, but won't charge the battery
I have a Lenovo ThinkPad W540 that, once plugged in without a battery, works fine. However, when I connect the battery, it just won't charge.
In most cases connecting the adapter into the laptop, doesn't cause the LED to flash, which is a sign of charging. The battery did charge once for about 2 minutes before returning to this non-charge state.
Any suggestions? | So after a bit of research and gained knowledge, I figured I'd let the laptop run on the false percentage indication of 13 percent. It would sooner or later run out and die, which it did. Now that it's truly at 0 percent, it works perfectly fine. All you have to do is let it die without the adapter. | stackexchange-superuser | {
"answer_score": 0,
"question_score": 0,
"tags": "laptop, battery, charging"
} |
How to find the smallest of an array within VBA, not in an excel range
Basic idea here is roll 4 d6, drop the lowest.
For lngPosition = LBound(strAttributes) To UBound(strAttributes)
i = 0
For shortPosition = LBound(intRoll) To UBound(intRoll)
intRoll(shortPosition) = Int((6 - 1 + 1) * Rnd + 1)
i = intRoll(shortPosition) + i
Next shortPosition
i = {i - smallest intRoll()}
strAttributes(lngPosition) = i
Next lngPosition
I've found a lot of info on how to find the lowest value in a range in excel, by adding `.Small` after defining the range, but I don't think that works here. It may be that I'm off by miles on how to accomplish this, but I'm so fresh that I really don't know.
Thanks | Assuming your array is a one-dimensional array, you can still use the worksheetfunction class, like:
Dim myArray
myArray = Array(5, 3, 103, 99, -14, 12)
Debug.Print Application.WorksheetFunction.Small(myArray, 1)
If your array is multi-dimensional, then you will need to use brute force iteration. | stackexchange-stackoverflow | {
"answer_score": 3,
"question_score": 1,
"tags": "excel, vba"
} |
Combinatorical partial sum
I am looking in `R` for a function `partial.sum()` which takes a vector of numbers and returns an ascending sorted vector of all partial sums:
test=c(2,5,10)
partial.sum(test)
# 2 5 7 10 12 15 17
## 2 is the sum of element 2
## 5 is the sum of element 5
## 7 is the sum of elements 2 & 5
## 10 is the sum of element 10
## 12 is the sum of elements 2 & 10
## 15 is the sum of elements 5 & 10
## 17 is the sum of elements 2 & 5 & 10 | Here is one using recursion. (Not making claims about it being efficient either)
partial.sum <- function(x) {
slave <- function(x) {
if (length(x)) {
y <- Recall(x[-1])
c(y + 0, y + x[1])
} else 0
}
sort(unique(slave(x)[-1]))
}
partial.sum(c(2,5,10))
# [1] 2 5 7 10 12 15 17
Edit: well, turns out it is a little faster than I thought:
x <- 1:20
microbenchmark(flodel(x), dason(x), matthew(x), times = 10)
# Unit: milliseconds
# expr min lq median uq max neval
# flodel(x) 86.31128 86.9966 94.12023 125.1013 163.5824 10
# dason(x) 2407.27062 2461.2022 2633.73003 2846.2639 3031.7250 10
# matthew(x) 3084.59227 3191.7810 3304.36064 3693.8595 3883.2767 10
(I added `sort` and/or `unique` to dason and matthew's functions where appropriate for fair comparison.) | stackexchange-stackoverflow | {
"answer_score": 6,
"question_score": 4,
"tags": "r, numbers, combinatorics"
} |
What happens when the physical address corresponding to CS:IP is more than 20 bits in 8086?
In 8086 microprocessor, suppose CS is FFFFH and IP is FAB0H Then the physical memory address would be computed by multiplying CS by 16 and adding IP. i.e. Add = FFFF0 + FAB0 This sum gives an overflow as the sum cannot be stored in 20 bits. What will happen? | For 8086 the result will be truncated to fit in 20 bits; causing it to wrap around. For example `0xFFFF0 + 0xFAB0 = 0x10FAA0 = 0xFAA0`. The segmented address that points above 1 MiB then actually accesses memory in the first 64 KiB - 16 Bytes.
Newer 80x86 CPUs (starting with 80286) support wider physical addresses and don't truncate; but to uphold backward compatibility the old behavior was simulated by having a programmable "A20 gate" (that was originally outside the CPU) to mask off the 21st address bit (A20) if "A20 gate" is disabled. Because of this, for newer CPUs with "A20 gate" enabled, you can access almost 64 KiB more physical address space in real mode (up to `0xFFFF:0xFFFF = 0x10FFEF`, or 65520 bytes more than the original 1 MiB). This is called the High Memory Area. | stackexchange-stackoverflow | {
"answer_score": 7,
"question_score": 3,
"tags": "x86, intel, x86 16, memory address, real mode"
} |
List all possible occurrences within a column?
I am trying to merge a data.frame and a column from another data.frame, but have so far been unsuccessful.
My first data.frame [Frequencies] consists of 2 columns, containing 47 upper/ lower case alpha characters and their frequency in a bigger data set. For example purposes:
Character<-c("A","a","B","b")
Frequency<-(100,230,500,420)
The second data.frame [Sequences] is 93,000 rows in length and contains 2 columns, with the 47 same upper/ lower case alpha characters and a corresponding qualitative description. For example:
Character<-c("a","a","b","A")
Descriptor<-c("Fast","Fast","Slow","Stop")
I wish to add the descriptor column to the [Frequencies] data.frame, but not the 93,000 rows! Rather, what each "Character" represents. For example:
Character<-c("a")
Frequency<-c("230")
Descriptor<-c("Fast") | Following can also be done:
> merge(adf, bdf[!duplicated(bdf$Character),])
Character Frequency Descriptor
1 a 230 Fast
2 A 100 Fast
3 b 420 Stop
4 B 500 Slow | stackexchange-stackoverflow | {
"answer_score": 0,
"question_score": 0,
"tags": "r"
} |
ignoring attempt to close li with a
I am a bit confused as to why this line `<li><a href= /login class="glyphicon glyphicon-log-in" ></a></li>` is throwing the warning line `ignoring attempt to close li with a` when i run my test. I have read multiple questions similar to this such as Ignoring attempts to close x with y but as far as i understand that line of html code is valid. If i replace it with `<li><%= link_to login_path, login_path %><li>` , i don't understand how to treat and remove this warning. I also dont want to silence the warnings that rails test throw off because of this. | Isn't it supposed to be `<li><a href="/login" class="glyphicon glyphicon-log-in" ></a></li>`. You forgot to give `""` to your `href`. | stackexchange-stackoverflow | {
"answer_score": 1,
"question_score": 0,
"tags": "css, ruby on rails, html"
} |
Local extrems of two variable function
I have a function: $f(x,y)=x^3 + y^3(8x^2-6xy+3y^2)$
I have problem with finding local extrems, more precisely I think that the function doesn't have any local extrem, but I have problem to prove it. I did a partial derivations and only point that could be extreme is $[x,y] = [0,0]$. Hessian matrix came out to be zero in that point. So what should i do? Thank you for response. | Since $f$ is differentiable, the only points where a local extreme value might occur are points where both partial derivatives evaluate to zero.
As you noted, there is only one such point, namely $(x,y)=(0,0)$.
But as $(x,y)$ approaches $(0,0)$ along the line $y=0$, we have $$ f(x,y)=f(x,0)=x^3 $$ which yields positive outputs for $x > 0$, and negative outputs for $x < 0$.
Hence, since $f(0,0)=0$, it follows that $f$ does not have a local minimum or maximum at $(0,0)$.
Therefore $f$ does not have any local extrema. | stackexchange-math | {
"answer_score": 1,
"question_score": 1,
"tags": "multivariable calculus"
} |
Local and WCF design for a class
I have a class which does stuffs with database, I want it to be used in these two ways:
1: a dll which can be referenced and used locally with direct call.
2: can be hosted as a WCF service.
when it is hosted as a WCF service many clients can connect to it but when it is used as a dll it just has one client. how should I design my class?
For example I want to use it like this in dll form:
var a = new A();
and then call `a.DoSomething()`
or host it in WCF service and call `server.DoSomething()` from my client. | put your class into an assembly of it's own along with any support classes it needs and just reference that assembly from your WCF service.
Put your "api" in an interface, implement it fully in your "work" assembly, then implement it in your WCF service, but just haave that act as a proxy. Using an interface will mean you don't miss anything in your proxy. | stackexchange-stackoverflow | {
"answer_score": 1,
"question_score": 0,
"tags": "c#, .net"
} |
CSS Helvetica Neue not working
I am trying to use Helvetica Neue as the font for my website everywhere so I applied to the body like so
body {
background-image: url("
font-family: "Helvetica Neue" !important;
}
but my font does not appear, it was working at one point but now its not working in Firefox, Chrome, Safari or IE
you can see what I am talking about here
<
any help would be appreciated,
Thanks, J | You need to upload the font to your web-site and declare the font-face
@font-face
{
font-family: 'Helvetica Neue';
src: url('HelveticaNeue.ttf'),
url('HelveticaNeue.eot'); /* IE9 */
}
and only then you can use it on your web-pages. | stackexchange-stackoverflow | {
"answer_score": 4,
"question_score": 0,
"tags": "css, font face"
} |
Get the history of TFS for expired trial version
I installed the Basic TFS trial version and now it got expired. It is mandatory for me to get the history of TFS.
* Where does it store the history? Does it store it in the SQL Express?
* Is there any way to get the saved history? | Digging through the database is not trivial. You'd have to piece the history back together and de-deltify all the blogs.
It would be much easier just to get your TFS instance working again so that you can get the files out of it. TFS Express 2012 is now available, and has no such time restriction. It's free for up to 5 users. You may be able to upgrade your existing installation. | stackexchange-stackoverflow | {
"answer_score": 3,
"question_score": 1,
"tags": "tfs"
} |
How to write DDL against SQL SE database programmatically?
I have an SDF database file. I'm looking forward to manage my database in C#. for example I want to drop a table or change a table schema.
How can I achieve this?
I insist achieving this using Entity Framework and DbContext. | cmd is a SqlCeCommand object (or IDbCommand object)
cmd.ExecuteNonQuery("DROP TABLE myTable;");
cmd.ExecuteNonQuery("ALTER TABLE MyTable ADD ...");
With Entity Framework, you can use the above SQL statements like this:
context.Database.ExecuteSqlCommand("DROP TABLE myTable;"); | stackexchange-stackoverflow | {
"answer_score": 1,
"question_score": 1,
"tags": "c#, sql server ce"
} |
How to print intermediate result of commands in a pipeline?
I have a series of commands running through a pipeline like this:
cmd1 | cmd2 | cmd3 | cmd4
How can I print the intermediate result of `cmd1`, `cmd2` and `cmd3`? I know I can use the `tee` command to print the result to a file. But is it possible to just print it to the console? This is for debugging purpose as my actual commands are very complex. | You can `tee` to the current terminal:
cmd1 | tee /dev/tty | cmd2 | tee /dev/tty | cmd3 | tee /dev/tty | cmd4 | stackexchange-unix | {
"answer_score": 3,
"question_score": 0,
"tags": "command line, pipe, console, tee"
} |
Can coq express its own metatheory?
I'm learning about language metatheory and type systems, and am using coq to formalize my study. One of the things I'd like to do is examine type systems that include dependent types, which I understand is very involved: being able to rely on coq would be invaluable.
Since this type system feature (and other, simpler ones) brings the expressive power of my studied system closer to coq's own, I worry that I might run into a bootstrapping problem that might not reveal itself until much later. Perhaps someone here can address my fears before I set out.
Can coq express its own metatheory? If not, can it still express simpler systems that include common forms of dependent typing? | It is possible to formalize Coq's logic within Coq but only subsets of the logic have been formalized yet. Relevant contributions are CoqInCoq, PTS, PTSATR, and PTSF. | stackexchange-cs | {
"answer_score": 3,
"question_score": 7,
"tags": "type theory, dependent types, coq"
} |
Find out number of active locks on a table
I was wondering if there is a way to find out the number of active locks held on a table in SQL Server? | Here is a start. Remember that locks can go parallel so you may see the same object being locked on multiple `resource_lock_partition` values.
USE yourdatabase;
GO
SELECT * FROM sys.dm_tran_locks
WHERE resource_database_id = DB_ID()
AND resource_associated_entity_id = OBJECT_ID(N'dbo.yourtablename');
Please look at the documentation for `sys.dm_tran_locks` | stackexchange-dba | {
"answer_score": 12,
"question_score": 5,
"tags": "sql server, locking"
} |
San Francisco and Roboto fonts in Codename One
I need to write an app that uses the San Francisco font on iOS < and the Roboto font on Android.
I'm not sure if they are both native fonts currently used by Codename One. If not, what should I do to use them as default fonts? Thank you | If you use the native builtin fonts then Roboto will be used on Android and San Francisco will be used on newer iOS devices (older devices will use Helvetica Neue).
See this post which discusses the one caveat which is Italics where we don't use San Frsancisco: < | stackexchange-stackoverflow | {
"answer_score": 1,
"question_score": 1,
"tags": "codenameone"
} |
Difference of perp and bot
I saw in _math.stackexchange_ that someone uses `\perp` for what I always use `\bot`. In XeLaTeX: lost \perp in Cambria math? it says that they are two different symbols, do they just look the same?
I guess the spacing is different like in `\Longleftrightarrow` and in `\iff`, which one should be used in math? | \DeclareMathSymbol{\bot}{\mathord}{symbols}{"3F}
\DeclareMathSymbol{\perp}{\mathrel}{symbols}{"3F}
So they use the same glyph from the same font but `\perp` gets the spacing for an infix _relation_ like `<` whereas `\bot` is a mathord so gets no special spacing, like a letter `x`.
So either can be used in math, depending on the intended meaning. | stackexchange-tex | {
"answer_score": 20,
"question_score": 17,
"tags": "symbols, relation symbols"
} |
if $f(n) \to g(n)$ then $\frac{\sum f(n)}{\sum g(n)} \to 1$?
Say we have some function $f(n)$ that behaves like $g(n)$ for large $n$. It is easier to analyse in general the $g(n)$. Then it seems intuitive to say $$\frac{\sum f(n)}{s_n}\to 1$$ where $s_n= \sum g(n)$ (i.e coming from the asymptotic recipe for $f(n)$). Is this intuition correct? How can one prove/disprove it?
Many thanks! | I assume you mean $f(n)\sim_{n\to\infty} g(n)$, "i.e." (up to some technicalities if $g$ cancels) $\frac{f(n)}{g(n)}\xrightarrow[n\to\infty]{} 1$.
Then this is false:
* take $f(n) = \frac{6}{\pi n^2} + \frac{1}{n^3} $ and $g(n) = \frac{6}{\pi n^2}$. Then $$ \frac{\sum_{n=1}^N f(n)}{\sum_{n=1}^N g(n)}\xrightarrow[N\to\infty]{} 1 + \sum_{n=1}^\infty \frac{1}{n^3} \simeq 2.2 $$
* But this is true if $f(n)\geq 0$ and $\sum_n f(n)$ diverges (which implies $g(n)\geq 0$ and divergence of $\sum_n g(n)$): $$ \frac{\sum_{n=1}^N f(n)}{\sum_{n=1}^N g(n)} = 1+ \frac{\sum_{n=1}^N \left( f(n) - g(n)\right) }{\sum_{n=1}^N g(n)} $$ and by theorem s of comparisons, the second term will be $o(1)$ (this last point does require a proof, not very complicated. Let me know if I should include it.) | stackexchange-math | {
"answer_score": 3,
"question_score": 1,
"tags": "real analysis, sequences and series, summation"
} |
Can you add CSS for desktop only that is resolution independent?
Can you detect if the user is viewing your website from a touch enabled device, or is using a mouse?
There are very large tablets and tiny laptops, so I feel like media queries based on screen size don't do the trick.
For context: I have some buttons with an extra element. I want that element to be displayed by default when viewing from phone or tablet, and to be displayed on hover when viewing from laptop/desktop.
Is that possible? | In a more reliable way, you can use the `pointer` and `hover` media queries separately or together to achieve what you are tryig.
/* smartphones, touchscreens */
@media (hover: none) and (pointer: coarse) {
/* ... */
}
/* stylus-based screens */
@media (hover: none) and (pointer: fine) {
/* ... */
}
/* Nintendo Wii controller, Microsoft Kinect */
@media (hover: hover) and (pointer: coarse) {
/* ... */
}
/* mouse, touch pad */
@media (hover: hover) and (pointer: fine) {
/* ... */
}
`Pointer` media query helps you to understand the kind of pointing device with which the site is being used. Values to the `pointer` media query are 'fine', 'coarse', and 'none'.
While `hover` media query is used to understand if the primary interactive mechanism can hover over elements with ease. The values are 'hover' and 'none'. | stackexchange-stackoverflow | {
"answer_score": 3,
"question_score": 1,
"tags": "css, responsive design"
} |
Unit in $A[x]$ implies $a_0$ is unit and $a_i$ are nilpotent. A little question about some detail.
My question is that $f= a_0 + a_1X + ... + a_nX^n\in A[x]$ is unit with inverse $g= b_0 + b_1X + ... + b_mX^m$
**My Question** in the first induction step $a_nb_m=0$ why it implies $a_n$ nilpotent?
if $a_n$ and $b_m$ are zero divisors then $a_nb_m$ is zero.
For example consider: $\mathbb Z_6$, we can see that $\bar 2 * \bar 3=\bar 0$ but $\bar 2^n\neq 0$ for any $n$. (Since any power of $2$ cannot $=0 \quad mod 6=2.3$, $2^n$ never divisible by $3$) | In your link (which you deleted from your post), you have to read not only the answer (which focuses on a detail, as requested) but the question (which describes the whole proof). The first induction step is indeed $a_nb_m=0$, but the last one is $a_n^mb_0=0$, and it is this last step which (since $b_0$ is invertible) proves that $a_n$ is nilpotent.
I hear you grumble, like I did: "ok then, $a_n$ is nilpotent, but what about $a_{n-1},\dots,a_1$?" The key is in N. S. answer's in the duplicate of your link. | stackexchange-math | {
"answer_score": 2,
"question_score": -1,
"tags": "abstract algebra"
} |
HtmlPage.Document.QueryString within a UserControl
A) If I check the querystring within a Navigation Page, things work great.
B) But if I check the querystring within a UserControl (which is delcared in the Navigation Page), the querystring shows it is empty.
Question) If there a way to check for a querystring by the UserControl (i.e. a child control who ultimately has a Navigation Page as a parent)???
Thanks!! | see my comment above. | stackexchange-stackoverflow | {
"answer_score": 0,
"question_score": 0,
"tags": "silverlight, frameworks, navigation, query string"
} |
Array Results in 2 Columns Even When Odd
I am trying to return my array into two columns. It is working when the number of results is even, but not odd. When the results are odd, it keeps all of the results in the left `ul` but not the right `ul`.
How can I change the code so that if there is a remainder, it will put the odd number of results into the second column?
<?php
$terms = get_field('featured_cities');
echo '<ul>';
$i =0;
foreach ($terms as $term) {
echo '<li><a href="'.get_term_link($term->slug, 'cities').'">'.$term->name.'</a></li>';
$i++;
if((int)sizeof($terms)/2 == $i){
echo '</ul><ul>';
}
}
echo '</ul>';
?> | Use
if (ceil(count($terms)/2) == $i){
instead of
if((int)sizeof($terms)/2 == $i){
Also, consider putting `ceil(sizeof($terms)/2)` in some variable, so
<?php
$terms = get_field('featured_cities');
echo '<ul>';
$i =0;
$half = ceil(count($terms) / 2);
foreach ($terms as $term) {
echo '<li><a href="'.get_term_link($term->slug, 'cities').'">'.$term->name.'</a></li>';
$i++;
if ($half == $i){
echo '</ul><ul>';
}
}
echo '</ul>';
?>
If you want odd number in the second column, add fixing of `$half`:
$cnt = count($terms);
$half = ceil($cnt / 2);
if ($cnt % 2 && $half % 2) $half--; | stackexchange-stackoverflow | {
"answer_score": 0,
"question_score": 0,
"tags": "php"
} |
aMule and Deluge on Raspberry Pi
I'm already using my Pi as a media center, now I would also like to transform it into my download center. I've seen that both `deluged` and `amule-daemon` packages are available, but the question is, will I be able to use them both?
I have a 128/128 MB memory split, are 128 megs enough to run both **`Deluge`** and **`aMule`** even if daemonized? Anyone tried them yet? | Let me give you some other alternative: use mldonkey.
> sudo apt-get install mldonkey-server
It has torrent and donkey protocols in a light daemonized server, that you can access via a HTTP connection using a browser, even from remote machines. | stackexchange-raspberrypi | {
"answer_score": 1,
"question_score": 0,
"tags": "software installation, memory, file sharing, p2p"
} |
How did the Edo Tensei reanimated Second Mizukage summon the Giant Clam?
As I understand, summoning requires blood sacrifice, contract and chakra from the jutsu user. Only Nagato (Rinnegan user) is the exception because he uses the Animal Path. He doesn't require hand seals or blood sacrifice.
How did the Edo Tensei reanimated Second Mizukage summon the Giant Clam without blood sacrifice? **I assume Edo Tensei bodies don't have blood.**
!The Second Mizukage and his clam | He probably summoned the clam the normal way with blood. The anime / manga probably just skipped the summoning scene because this isn't a major character and the panels could be better filled with other scenes.
Edo Tensei reanimated characters do in fact have blood. I believe there are a few examples, but the only one that comes to mind at the moment is Itachi's eyes bleeding after using Amaterasu. | stackexchange-anime | {
"answer_score": 4,
"question_score": 4,
"tags": "naruto"
} |
Similar to Jad file in J2ME & BlackBerry, exist in Android?
Similar to jad entries in J2ME, is there any such provision in android? | A Jad file for J2ME and Blackberry is there for a) app permissions, b) app name c)key-value pairs that are used in the app.
For a) and b) in Android we use AndroidManifest.xml. For c) we can use a .properties file or xml in the apk. Note that we can modify Jad file after compilation for modifying key-value pairs, but we cant do the same with Android. Atleast we cannot do it manually. We can programmtically modify values in the properties file, say by overwriting them with values sent from server. | stackexchange-stackoverflow | {
"answer_score": 3,
"question_score": 1,
"tags": "java, android"
} |
There is an entire function $g$ such that $f(z)=g\left(z^{n}\right)$.
Let $f$ be an entire function and $\xi=e^{\frac{2\pi i}{n}}$ for some $n\in \mathbb{N}$. Suppose that $f\left(\xi z\right)=f(z)$ for all $z\in \mathbb{C}$. Show that there is a entire function $g$ such that $f(z)=g\left(z^{n}\right)$ for all $z \in \mathbb{C}$.
**Remark:** I have tried to express $g$ in terms of $f\left(\xi z\right)$ but my attempts have been unsuccessful. | Using power series is cheating because it makes it too easy. Say $$f(z)=\sum_{k=1}^\infty a_k z^k.$$
Now $f(\xi z)=f(z)$, with uniqueness of the power series coefficients, shows that $$\xi^ka_k=a_k$$for all $k$. If $k$ is not a multiple of $n$ then $\xi^k\ne1$, so $a_k=0$. Hence $$f(z)=\sum_{j=0}^\infty a_{jn}z^{jn}=g(z^n)$$if $$g(z)=\sum_{j=0}^\infty a_{jn}z^j.$$ | stackexchange-math | {
"answer_score": 7,
"question_score": 5,
"tags": "complex analysis, complex integration"
} |
Zip 3 Lists into a Tuple- Erlang
Is there an optimized way to zip 3 lists, in order
zip(L1, L2, L3)
So that they result in a list of tuples, example:
L1 = [1, 2, 3, 4],
L2 = [a, b, c, d],
L3 = [1, 2, 3, 4],
Resultant List of Tuples Should look like:
[{1,a,1}, {2,b,2}, {3,c,3}, {4,d,4}] | 1> lists:zip3([1,2,3,4],[a,b,c,d],[1,2,3,4]).
[{1,a,1},{2,b,2},{3,c,3},{4,d,4}]
2>
Or you could implement it manually:
myzip3([], _, _) ->
[];
myzip3([X|Xs], [Y|Ys], [Z|Zs]) ->
[{X,Y,Z}|myzip3(Xs,Ys,Zs)].
Or using accumulator:
myzip3acc(Xs, Ys, Zs) ->
myzip3acc_do([], Xs, Ys, Zs).
myzip3acc_do(Acc, [], _, _) ->
lists:reverse(Acc);
myzip3acc_do(Acc, [X|Xs], [Y|Ys], [Z|Zs]) ->
myzip3acc_do([{X,Y,Z}|Acc], Xs,Ys,Zs). | stackexchange-stackoverflow | {
"answer_score": 6,
"question_score": 2,
"tags": "list, erlang, zip, tuples"
} |
Websocket. Раздельное подключение
Есть админка с бэком на ноде. Суть: пользователь авторизуется. Вводит ссылку на сайт. Нажимает старт -> запрос на сервер -> запускается селениум -> между селениумом и клиентом образуется соединение по вебсокетам -> селениум отсылает данные на фронт.
**Суть вопроса: зашёл с 2 разных аккаунтов. Ввёл ссылку на 1 из них и запустил. Вебсокеты начали слать данные 2 аккаунтам. Я же хочу, чтобы они слали только инициатору запроса. Что для этого надо?**
На сервере стоит обработчик сокетов на порте 8080. Соответственно клиенту я тоже указываю этот порт. Надо как-то динамически его изменять для каждого из пользователй? | const userOnline = {};
wsServer.on('connection', (ws, req) => {
const id = Math.random();
userOnline[id] = ws;
setInterval(() => {
sendMessageToUser(id)
}, 2000)
})
function sendMessageToUser(id) {
userOnline[id].send('message', "I'am here")
}
Хранить ли массив идентификаторов онлайн-юзеров в БД - нет. Кроме идентификатора, Вам же еще необходимо хранить данные самого подключения, чтобы иметь возможность отправить сообщение пользователю | stackexchange-ru_stackoverflow | {
"answer_score": 1,
"question_score": 1,
"tags": "javascript, node.js, websocket"
} |
Can you specify an accout to use with Google's “.new” doc creation URL?
I am usually logged in to multiple Google accounts, and I have been using links like these to create sheets (docs, etc.) in the respective accounts:
*
*
There is now a fancy new way to create Google docs with `.new`:
* Docs: doc.new, docs.new, document.new
* Forms: form.new, forms.new
* Sheets: sheet.new, sheets.new, spreadsheet.new
* Sites: site.new, sites.new, website.new
* Slides: slides.new, deck.new, presentation.new
I'd like to use those shorter URLs, but I need to be able to specify an account. I've tried a few variations, but they haven't worked:
* sheet.new/1
* sheet.new/u/1
* sheet.new/u/1/
So is there any way to use the `.new` shortcut URLs to create new Google docs, and specify which account to create them with? | Since Jul. 25th 2019 it's actually possible to specify in which account to create the new file, exactly as you stated in your question.
From now on:
* docs.new/1 - creates the file in your personal account
* docs.new/2 - creates the file in your second account (if you're signed in)
That applies to all `.new` shortcut URLs, check the explainer video from Google. | stackexchange-webapps | {
"answer_score": 10,
"question_score": 8,
"tags": "google sheets, google workspace, google docs"
} |
Python Matrix multiplication; numpy array
I have some problem with matrix multiplication:
I want to multiplicate for example a and b:
a=array([1,3]) # a is random and is array!!! (I have no impact on that)
# there is a just for example what I want to do...
b=[[[1], [2]], #b is also random but always size(b)= even
[[3], [2]],
[[4], [6]],
[[2], [3]]]
So what I want is to multiplicate in this way
[1,3]*[1;2]=7
[1,3]*[3;2]=9
[1,3]*[4;6]=22
[1,3]*[2;3]=11
So result what I need will look:
x1=[7,9]
x2=[22,8]
I know is very complicated but I try 2 hours to implement this but without success :( | How about this:
In [16]: a
Out[16]: array([1, 3])
In [17]: b
Out[17]:
array([[1, 2],
[3, 2],
[4, 6],
[2, 3]])
In [18]: np.array([np.dot(a,row) for row in b]).reshape(-1,2)
Out[18]:
array([[ 7, 9],
[22, 11]]) | stackexchange-stackoverflow | {
"answer_score": 3,
"question_score": 2,
"tags": "python, arrays, matrix, numpy"
} |
Display applet version in Java Cache Viewer
Helllo,
When I open the Java Cache Viewer, see applets that were used. Some applets have shown the version number and some do not.
1. What is it specifically for the version number?
2. Where is this version number determined?
3. How do I set it to display the version number at my applet in Java Cache Viewer?
Thanks for answers... | My problem solved edit of JNLP file. I added `version` attribute in `jar` element.
Like this:
...
<resources>
<j2se version="1.7+" href=" />
<jar href="/my-applet.jar" main="false" version="1.1.0"/>
</resources>
... | stackexchange-stackoverflow | {
"answer_score": 0,
"question_score": 0,
"tags": "java, caching, applet"
} |
How to test puppeteer page.evaluate() in Chrome
Learning puppeteer. How can i test commands out without having to run puppeteer?
For example, I tried to run the command in chrome's javascript console:
const is_disabled = await page.$('button[disabled]') !== null;
It doesn't work:
caught (in promise) ReferenceError: page is not defined ReferenceError: page is not defined | You need to read the documentation to see what each function does. For example, the docs of the page.$ says:
> The method runs `document.querySelector` within the page. If no element matches the selector, the return value resolves to `null`.
That means it runs `document.querySelector` inside the page, which you can also do yourself in the Developer console like this:
document.querySelector('button[disabled]') !== null | stackexchange-stackoverflow | {
"answer_score": 1,
"question_score": 0,
"tags": "google chrome, puppeteer"
} |
Auth0 Next.js error withPageAuthRequired You should not access 'res' after getServerSideProps resolves
I seem to be getting the error:
`You should not access 'res' after getServerSideProps resolves.`
With the following code:
export const getServerSideProps = withPageAuthRequired({
async getServerSideProps(ctx){
// access the user session
const session = getSession(ctx.req,ctx.res);
return {props:{
customProp:'bar'
}};
}
});
This code comes directly from <
I didn't know if there was a way to get rid of this warning when implementing auth0 I'm on Next.js 12.0.4 & auth0 ^1.6.1
What would be the best way to get rid of this error? | It's not an error, it's a warning
This warning is decribed here, no simple solution
P.S. I have the same stuff in my projects, waiting for update fix. This bug appeared in next^12.0.2 version | stackexchange-stackoverflow | {
"answer_score": 1,
"question_score": 2,
"tags": "next.js, auth0"
} |
How to trim a string after a specific character in java
I have a string variable in java having value:
String result="34.1 -118.33\n<!--ABCDEFG-->";
I want my final string to contain the value:
String result="34.1 -118.33";
How can I do this? I'm new to java programming language.
Thanks, | You can use:
result = result.split("\n")[0]; | stackexchange-stackoverflow | {
"answer_score": 59,
"question_score": 41,
"tags": "java"
} |
Objective C - Adjust height of image in image view automatically after original size
I am developing an app that will show flags for countries some places, but after looking at flags I realized that the flags format was different for almost every country. Therefor I would like the height of the image view to automatically adjust it self to the width i set. Example: Standard width for all flags: 100 px USA : Height: 50px UK: Height 56 px Russia: Height 34px
I have no idea how to solve this, thanks for help! The best would be if this could be done automatically - without me needing to create example arrays or something for every flag to adjust size. | This is a ratio problem. Suppose your English flag is 120x80px. You want it to be 100px wide. How tall will it be? You have to scale the width and height by the same ratio.
First of all, calculate the ratio between the desired width of the flag and its actual width:
CGFloat ratio = 100.0f / 120.0f;
That gives us a ratio of 0.83. Now we can calculate the display height by multiplying the actual height by the ratio:
CGFloat height = 80.0f * 0.83;
The display height is 66.4px.
* * *
Here's the neat thing: **UIImageView does this for you**. If you specify the width of the image view and set its content mode to `UIViewContentModeScaleAspectFit` it does the hard work automatically.
See this question:
How to scale a UIImageView proportionally? | stackexchange-stackoverflow | {
"answer_score": 2,
"question_score": 1,
"tags": "objective c, uiimageview, imageview"
} |
Is $\lnot\lnot\forall x(A(x)\vee\neg A(x))$ a theorem of intuitionistic logic?
I have a short question. I know that $\neg\neg(A\vee\neg A)$ is a theorem of intuitionistic logic. What about $\neg\neg\forall x(A(x)\vee\neg A(x))$? | No, it is not. To prove this, we can give a countermodel (I'll use Kripke semantics).
For a world $v$ in a Kripke model $M$, the meaning of $M,v\Vdash\lnot\lnot\forall x(A(x)\lor \lnot A(x))$ is: for all worlds $v'\geq v$, there exists a world $v''\geq v'$ such that for all worlds $w\geq v''$ and all $x\in M_{w}$, $A(x)$ holds at $w$ or for all worlds $w'\geq w$, $A(x)$ does not hold at $w'$.
In other words, there is a dense set above $v$ of worlds $v''$ with the property that the truth value of $A(x)$ does not ever "flip" for any element of any world above $v''$.
For our countermodel, take the frame to be $\mathbb{N}$ with its usual order, $M_n = \\{0,\dots , n\\}$, and interpret $A$ in $M_n$ as $M_n\setminus\\{n\\}$. Then $M,0\not\Vdash\lnot\lnot\forall x(A(x)\lor \lnot A(x))$, since for any world $n$, the truth value of $A(n)$ "flips" when moving from $n$ to $n+1$. | stackexchange-math | {
"answer_score": 4,
"question_score": 0,
"tags": "logic, intuitionistic logic"
} |
Non existence of a non vanishing 1-form on a compact manifold without boundary
Let $M$ be a compact manifold without a boundary and let us assume $\omega$ is a non-vanishing 1-form on $M$ that is exact. Then there is a 0-form, or a function to be precise, $f:M\to \mathbb{R}$ such that $df=\omega\neq0$. I am trying to get a contradiction but I cannot seem to do it. I guess if $f$ has any critical points then $df=0$ at such points but does $f$ have critical points? | As $M$ is compact $f$ takes a maximum somewhere, and there $df=0$. | stackexchange-math | {
"answer_score": 4,
"question_score": 1,
"tags": "manifolds, differential topology, differential forms"
} |
deleting repetitive columns in unix
I would like to delete multiple repetitive columns from a huge file (about 1 million). The columns that I want to delete has the same column names: A and others has different unique name. Say:
A B2 A B3
1.1 AA 1.2 AA
2.1 AB 4.3 CT
2.2 AC 6.4 GT
so column headers are A, B2, A, B3,... . How could I delete the columns named as A's from the data. | Another in awk:
$ awk '
NR==1 {
split($0,a)
for(i in a)
if(a[i]=="A")
delete a[i]
}
{
for(i=1;i<=NF;i++)
printf "%s",(i in a?$i OFS:"")
printf ORS
}' file
B2 B3
AA AA
AB CT
AC GT | stackexchange-stackoverflow | {
"answer_score": 0,
"question_score": -2,
"tags": "unix, sed, cut"
} |
Odd/even Primitive function
How do you prove that the primitive function of an odd and continuous function is even without using integrals ? Knowing that both functions, f and F, are defined on R.
Ps: maybe we can prove that F(-x) - F(x) = 0 But I can't get around proving it tho | By differentiation of $F(-x)-F(x)$ wrt. $x$ we get zero since $f$ was odd. Then $F(-x)-F(x)=C$ for any $x$ (this is a constant function). Putting $x=0$ we get $C=0$ and the proof is finished.
Observe that the converse is not true. I have in mind a primitive of an even function. $f(x)=3x^2$ is even, while one of itr primitive is $F(x)=x^3+1$ which is neither odd nor even. Try to check whether or not $G(x)=F(x)-F(0)$ (where $F$ is a prmitive of an even function $f$) is odd. | stackexchange-math | {
"answer_score": 2,
"question_score": 0,
"tags": "integration"
} |
RedirectToRoute not working in ASP.NET MVC project
I am building a somewhat complex ASP.NET MVC website with multiple controllers. In the Index()-method/handler of each controller I perform some validation and redirect to the default route in case of an error so the user gets redirected to the default page of the website when something goes wrong. However, for some reason the redirect just doesn't work. I use `RedirectToRoute("Default")` to redirect to the default route but somehow the Index()-method of the controller I am currently in just gets called again and no redirect is happening. This results in an infinite loop and at some point the browser displays a redirect error. I have the default route defined as follows:
routes.MapRoute(
name: "Default",
url: "{controller}/{action}",
defaults: new { controller = "Home", action = "Index" }
Why does it not redirect to the Index-action of the Home-controller? | Because you are redirecting to the same route as you are now. The defaults that are specified on the "Default" route only apply when there are no values for "controller" and "action", which is not the case - you are running inside a specific action of a controller. Probably what you want is to redirect to the root of your app, which is normally where you go to in the first place (your "Default" route seems to indicate that). | stackexchange-stackoverflow | {
"answer_score": 1,
"question_score": 0,
"tags": "c#, asp.net mvc, redirect"
} |
Best approach for loading images from sql database
What is the best approach for loading images from restful api? Is it by making url reference to them or base64 string? I have a memory problem with base64, even when I use glide. So should I make url's and then load them with glide? | Dont store the image into a databse, takes up too much memory instead store the image on the internet or on a service like amazon s3 bucket and keep the url reference to the image on your database. | stackexchange-stackoverflow | {
"answer_score": 2,
"question_score": 0,
"tags": "android, sql"
} |
setFrame not working properly for AVCaptureVideoPreviewLayer
I am trying to add a AVCaptureVideoPreviewLayer into my view like this
[captureVideoPreviewLayer setFrame:CGRectMake(10.0f,10.0f,300.0f,300.0f)];
[self.view.layer addSublayer:captureVideoPreviewLayer];
but it doesnt seem to follow the CGRectMake, the layer is 300 in height but not in width, I am not sure why! | The solution was simple, I just had to add `captureVideoPreviewLayer.videoGravity = AVLayerVideoGravityResizeAspectFill;` and that fixed the problem. | stackexchange-stackoverflow | {
"answer_score": 11,
"question_score": 3,
"tags": "ios, avfoundation, layer"
} |
Using external SQLite database with SwiftUI
I am writing a SwiftUI app that needs to read an external SQLite database. I just need to open the database, query the database, copy values into an array and close the database. Then I need to load the text from one variable in the array to the buttons in a view. I am using the SQLite.swift library but I'm not sure how to do it.
I don't have any code yet but I have loaded the SQLite.swift package and just need to write my DatabaseHelper class and then run it when the View is opened. If anyone can help please reply! :) | Bear in mind that I haven't actually done this, but will have to in the near future. You are going to have to accept the fact that you need to take baby steps and throw out half your work, perhaps multiple times, until you get a satisfactory solution.
I would start by opening your db outside swiftui, probably in the app delegate class. Then stick all your values into the environment object and attach that to your content view
let contentView = ContentView().environmentObject(your_stuff_here)
Down in Swiftui you can extract the details from the environment object and add them to your button.
That should at least get you going. | stackexchange-stackoverflow | {
"answer_score": 1,
"question_score": 0,
"tags": "sqlite, swiftui"
} |
Using base64 image strings for an app in React Native crashes
I am using base64 strings as image sources. when i open my app crashes immediately when loading any image with font. and at the same time the application closes me. this happens only on IOS on Android everything works fine.
I am using react-native version: "0.62.2"
For example:
<ImageBackground source={{"uri": 'base64encodedstring'}} /> | From the Using base64 strings for an Image URI crashes app issue on GitHub:
> For anyone else that comes across this just change the version of Flipper in the podfile to
>
>
> versions['Flipper'] ||= '~> 0.37.0'
>
>
> as this is what the pr did
So, for this case:
versions['Flipper'] ||= '~> 0.37.0'
versions['Flipper-Folly'] ||= '~> 2.2'
versions['Flipper-RSocket'] ||= '~> 1.1' | stackexchange-stackoverflow | {
"answer_score": 2,
"question_score": 2,
"tags": "javascript, ios, react native"
} |
How do I use SELECT on columns that don't have column names in SQL Server 2008 R2?
Here's my code:
SELECT DISTINCT Column 3
FROM [TestTable].[dbo].data
I get an error on "Column 3". The error is Incorrect syntax near '3'.
My table has no column names so I don't know how to run my Select command on the third column. | If the name of you third column is indeed 'Column 3', you need to run this query:
SELECT DISTINCT [Column 3]
FROM [TestTable].[dbo].data | stackexchange-stackoverflow | {
"answer_score": 2,
"question_score": 0,
"tags": "sql server, sql server 2008 r2"
} |
dynamic memory allocation for strings
int ReadNames(char ***Names, int *n)
{
int i, k;
char name[100];
printf("Enter how many names\n");
scanf("%d", n);
/* Allocate memory and read names */
*Names=(char **)malloc((*n)*sizeof(char *));
for(i=0;i<(*n);i++)
{
*(*Names+i)=(char*)malloc(sizeof(name));
gets(name);
strcpy(*(*Names+i),name);
}
for(i=0;i<(*n);i++)
printf("%s\n",*(*Names+i));
return 1;
}
void main()
{
char **Names;
int n, i;
ReadNames(&Names, &n);
}
This program is running fine...but there is slight difference from what i am expecting. Problem is when i am entering value of 'n' as 3, it is able to read only 2 strings and prints those two strings....ie. it reads n-1 strings and prints n-1 strings. Anything wrong in my code. | just add `getchar()` after `scanf()`
so that each `'\n'` gets disposed of while taking input. Your code will be
int ReadNames(char ***Names, int *n)
{
int i, k;
char name[100];
printf("Enter how many names\n");
scanf("%d", n);
getchar(); // eats unnecessary '\n' in the buffer
/* Allocate memory and read names */
*Names=(char **)malloc((*n)*sizeof(char *));
for(i=0;i<(*n);i++)
{
*(*Names+i)=(char*)malloc(sizeof(name));
gets(name);
strcpy(*(*Names+i),name);
}
for(i=0;i<(*n);i++)
printf("%s\n",*(*Names+i));
return 1;
}
void main()
{
char **Names;
int n, i;
ReadNames(&Names, &n);
} | stackexchange-stackoverflow | {
"answer_score": 2,
"question_score": 0,
"tags": "c, string, pointers, malloc, gets"
} |
MySQL wrong value in variable (SELECT INTO)
I am debugging a stored procedure in MySQL and I don't know where my error is. I have following code:
SELECT refreshToken.token FROM refreshToken WHERE refreshToken.accountId = 2;
This code returns an empty set. But this code:
SELECT refreshToken.token INTO @a FROM refreshToken WHERE refreshToken.accountId = 2;
SELECT @a;
returns the first value in the table. | This is because @a is already initialized with some values.
When a query returns empty records, the global variables will retain its previous values.
So it is always a good idea to clear the variable value prior to running query
set @a = null;
SELECT refreshToken.token INTO @a FROM refreshToken WHERE refreshToken.accountId = 2;
SELECT @a;
This should show @a as null | stackexchange-stackoverflow | {
"answer_score": 4,
"question_score": 2,
"tags": "mysql, sql, select, stored procedures"
} |
How do I read a json file in a Github Action using a windows hosted runner
I have the following snippet of code to read a json file in a linux hosted runner. How do I do the same using windows?
- id: getParams
run: |
content=`cat ./server.main.params.json`
# the following lines are only required for multi line json
content="${content//'%'/'%25'}"
content="${content//$'\n'/'%0A'}"
content="${content//$'\r'/'%0D'}"
# end of optional handling for multi line json
echo "::set-output name=packageJson::$content"
#testing output from the previous command
- name: echo ServerName
run: echo "${{fromJson(steps.getParams.outputs.packageJson).parameters.ServerName.value}}.suffix" | You should be able to do the same thing on a windows runner by informing `shell: bash` for each step, to use `bash` instead of the default shell for windows (which is `powershell`).
- id: getParams
shell: bash
run: |
content=`cat ./server.main.params.json`
# the following lines are only required for multi line json
content="${content//'%'/'%25'}"
content="${content//$'\n'/'%0A'}"
content="${content//$'\r'/'%0D'}"
# end of optional handling for multi line json
echo "::set-output name=packageJson::$content"
#testing output from the previous command
- name: echo ServerName
shell: bash
run: echo "${{fromJson(steps.getParams.outputs.packageJson).parameters.ServerName.value}}.suffix" | stackexchange-stackoverflow | {
"answer_score": 1,
"question_score": 0,
"tags": "github actions"
} |
Create a popup inside chrome extension
I need to have a small div like a popup on my chrome extension. This div needs to have a simple animation and not to have menu bar at all. Is it possible to do it with chrome.windows.create Method ? Is there another way to do it ? What I need is similar to pocket's extension popup. < | You need to use content scripts. If you have made a trigger the content script is able to change the page. By using that to your advantage you can add a div filled with all of the html you want to add. You can find a in depth example here. | stackexchange-stackoverflow | {
"answer_score": 1,
"question_score": 0,
"tags": "google chrome extension"
} |
c#: controlling access to object from different threads
How do I control when a thread is permitted to access an object and when it is not.
For example, if I have situation like below, I want to make sure that when I am doing something with **_objFoo_** in my ButtonClick event, I should not be able to touch **_objFoo_** from my **_doSomethingWithObjFoo_** method.
private void button1_Click(object sender, EventArgs e) {
// doing something with objFoo
}
private void timer1_Tick(object sender, EventArgs e) {
Thread T = new Thread(new ThreadStart(doSomethingWithObjFoo));
T.Start();
}
private void doSomethingWithObjFoo(){
// doing something else with objFoo
} | The easiest way is perhaps to use `lock`:
private object _fooLock = new object();
private void button1_Click(object sender, EventArgs e) {
lock(_fooLock)
{
// doing something with objFoo
}
}
private void timer1_Tick(object sender, EventArgs e) {
Thread T = new Thread(new ThreadStart(doSomethingWithObjFoo));
T.Start();
}
private void doSomethingWithObjFoo(){
lock(_fooLock)
{
// doing something else with objFoo
}
}
There are other options as well, such as using a `ReaderWriterLockSlim`. | stackexchange-stackoverflow | {
"answer_score": 5,
"question_score": 0,
"tags": "c#, .net, multithreading, thread safety"
} |
"Вглубь ночи" — где ударение, какой падеж?
Вглубь ночИ или вглубь нОчи, как правильно? В каком падеже слово ночь? | В Викисловаре (< добавлен местный падеж: в ночИ. Но это не относится к Вашему случаю. У Вас Р. п.: вглубь (чего?) нОчи. Это современное произношение. Как было раньше и допустимо ли изменение ударения в современной поэзии — эти вопросы оставляю без ответа. | stackexchange-rus | {
"answer_score": 2,
"question_score": 4,
"tags": "орфоэпия, падежи"
} |
unknown coding of .bmp file
I have an xml file with a string that is supposed to be an encoded .bmp file. However I am unable to find out what kind of coding this is (xml document sais its UTF-8, but it doesn't look like).
Here a piece of the string:
Qk1OHQAAAAAAAD4AAAAoAAAAKAEAALoAAAABAAEAAAAAAAAAAADEDgAAxA4AAAIAAAACAAAAAAAA////////////////////////////////////////////////////////AAAA//////////////// /////////////////////////////////wAAAP////////////////////////////////////// //////////8AAAD
or later in the string:
AAAA/////f/v9/9//v/////v+///e//////7////+B////P//////wAAAP////7/9/v/v/7/ ////9/v//7v//////f///4f////8//////8AAAD
I would very much appreciate any hint as to what kind of coding is this or even how to convert it back to a .bmp file? | To expand on @Shyam's comment. This is likely base64 encoded. So what you need to do is copy and paste just the xml content related to the encoded string. Then put it into a file, called base64Input
base64 -d < base64Input > base64Output
The base64Output will be your bmp image file which you can view. Even better if the bmp is part of a webpage you can simply base64 decode the entire xml/webpage then view in web browser then grab out the bmp image.
The base64 command is available usually by default on linux. If you are running windows, then you can download a base64 encoder/decoder. The -d flag specifies that you want to decode the specified file. My initial filenames were confusing, so I have edited the filenames to make more sense base64Input and base64Output. The < and > are the standard redirection operations. The base64 command will read the base64Input file and output the decoded result to the base64Output file. | stackexchange-stackoverflow | {
"answer_score": 1,
"question_score": 1,
"tags": "xml, decode, bmp"
} |
Excel Formula: Find duplicates and compare dates in other column
Can someone please advise on a formula which:
looks at column A where I have duplicates and then compares the dates in column B returning e.g. x next to the higher date like on the photo below:
.
My guess is we probably need an array formula? | I have created de-duped version of the column A and applied following formula:
{=MAX(IF($F$1:$F$428=V1,$L$1:$L$428))} | stackexchange-stackoverflow | {
"answer_score": 1,
"question_score": 1,
"tags": "excel formula"
} |
Make shell functions only be found in the scope of the importing file
I declare functions in one shell file,
# a.sh
foo() { ... }
function bar() { ... }
and imported in another shell file by `source`:
# b.sh
source ./a.sh
# invoke foo and bar
foo
bar
Now in the shell, I can use `foo`/`bar` after executing `b.sh`
$ source b.sh
...
# I can call foo or bar now in the shell (undesirable)
$ foo
...
How can I make the functions be local variables in the scope of the importing file, and avoid them to contaminate global/environmental variables? | There's no such thing as "file scope" in shell -- just global scope and function scope. The closest you can come is running b.sh in another shell:
$ b.sh # run b.sh rather than reading it into the current shell
then everything in in b.sh will just be in that other shell and will "go away" when it exits. But that applies to _everything_ defined in b.sh -- all functions, aliases, environment and other variables. | stackexchange-stackoverflow | {
"answer_score": 1,
"question_score": 0,
"tags": "bash, shell, scope"
} |
How to output to the console "SUCCESS" after a successful launch, and "ERROR" after an unsuccessful one?
_The question is:_
I'm currently working on **Node.js** with the **Puppeteer library** and I need to print _**" SUCCESS"**_ to the console after a successful run and _**" ERROR"**_ after a failed run. But I don't quite understand how to do it.
I will be grateful to everyone for help. | You could wrap the whole thing in a try...catch
try {
// Your Code Here
console.log('Success')
} catch (e) {
console.log('Error')
} | stackexchange-stackoverflow | {
"answer_score": 0,
"question_score": 0,
"tags": "javascript, node.js, google chrome, google apps script, puppeteer"
} |
How to know what button is clicked when opening modalBottomSheet for changing his value
I have a problem in JetpackCompose, i have some boxes in my screen, and for each boxes, it hide or open the ModalBottomSheet. What I want to do is that I want to change the value of the box I clicked when I'm choosing a proposition in the list in my ModalBottomSheet.
I can't figure it out, how I can achieve this. | Always store such states inside a viewmodel. You can use state hosting to pass callback events up to the viewmodel. See this is a conceptual problem. You should consider taking the state codelab for Jetpack compose to understand this. Concepts like unidirectional data flow and all. It sounds pretty mumbo-jumbo but is fairly easy and straightforward to understand.
I'll see if I can edit this answer later with an explanation. Till then, please take the codelab | stackexchange-stackoverflow | {
"answer_score": 1,
"question_score": 0,
"tags": "android, kotlin, android jetpack, android jetpack compose"
} |
JavaScript function to compare values in the array and return it
Mods: feel free to paraphrase the question. What I am trying to do is tell whether all values in the array for a given **dynamic** property are the same and, if **true** , return it.
I have achieved this in 3 lines using underscore.js, however, I was hoping this could be simplified/shortened:
var val = this.children[0]["myProperty"];
var same = _.all(this.children, child => child["myProperty"] === val);
return same ? val : null;
so that if:
`this.children = [{"myProperty":null},{"myProperty":2},{"myProperty":1},{"myProperty":1}];` ...returns `null`
`this.children = [{"myProperty":1},{"myProperty":1},{"myProperty":1},{"myProperty":1}];` ...returns `1`
N.B. the value of "myProperty" is a **single digit whole number or null** | with a dynamic property:
var prop = "myProperty";
//vanilla JS
return this.children.map(o => o[prop]).reduce((acc, v) => acc === v? v: null);
//and underscore
return _.reduce(_.pluck(this.children, prop), (acc, v) => acc === v? v: null); | stackexchange-stackoverflow | {
"answer_score": 1,
"question_score": 2,
"tags": "javascript, typescript, underscore.js"
} |
Request for some references exploring the connections of Riemann surfaces with medical imaging
I'd like to know some references for a beginner who has basic background in Riemann surfaces and differential geometry, and would like to start learning/working on more applied areas, medical imaging/imaging problems in particular. I searched it online, but it was not so productive for me.
I was also wondering whether one must learn the theory of discrete differential geometry/discrete Riemann surfaces in order to work in these areas; I've sometimes seen faculty webpages mentioning their research in both areas.
Thanks in advance! | Here are some papers--accessible to beginners-- relating circle packings (which themselves are related to triangulations of Riemann surfaces) and image processing:
MR2492509 Williams, G. Brock: Circle packings, quasiconformal mappings and applications. Quasiconformal mappings and their applications, 327–346, Narosa, New Delhi, 2007.
MR2011604 Stephenson, Kenneth: Circle packing: a mathematical tale. Notices Amer. Math. Soc. 50 (2003), no. 11, 1376–1388. < | stackexchange-mathoverflow_net_7z | {
"answer_score": 3,
"question_score": 3,
"tags": "reference request, dg.differential geometry, discrete geometry, riemann surfaces, applied mathematics"
} |
How to get the first day of current month measure with Year parameter in Power BI?
Seems like it should be very simple, but I still couldn't fine the way to get the first day of current month having parameter "Year"
So if parameter year 2018 - I need May 1,2018
if parameter year 2017 - need May 1, 2017
etc.
I tried to use DATE function, but the year will be dynamic.
How simply choose the first day of the month?
Thanks | I'm not sure how your year parameter is set up, but how about something along these lines?
FirstDayOfCurrentMonth = DATE([Year Parameter], MONTH(TODAY()), 1) | stackexchange-stackoverflow | {
"answer_score": 6,
"question_score": 3,
"tags": "powerbi, dax, powerbi embedded"
} |
How to stop a regex capture in a string with no newlines yet still capture globally?
I'm trying to extract mustache template keys from a long string with no newlines. I currently have:
`\{\{^><\}\}`
Which keeps matching *all character past each key's closing `}}` until it it finds the last occurrence of `}}`
How do I get it to capture each key and move on globally?
Here's a regex101 link: <
Thanks | Make it non-greedy regex:
\{\{^><\}\}
Regex Demo | stackexchange-stackoverflow | {
"answer_score": 3,
"question_score": 2,
"tags": "javascript, regex, mustache"
} |
Como fazer verificação de qualquer tipo recebido (maiúsculas ou minúsculas)?
Como posso fazer com que sejam ignoradas as maiúsculas e minúsculas para comparar com palavra predefinida?
Ex: stack(palavra predefinida para comparar)
Palavras que poderiam ser recebidas: "sTAck" "STACk" | Simples: converta o texto para maiúscula e compare. Exemplo de código em C++:
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
bool compare(string s1, string s2)
{
transform(s1.begin(), s1.end(), s1.begin(), ::toupper);
transform(s2.begin(), s2.end(), s2.begin(), ::toupper);
return s1 == s2;
}
int main() {
string s[] = {"sTAck", "STACk", "STAcK", "SSTTAACCKK", "stack", "Extack"};
for(int i = 0; i < 6; i++)
cout << s[i] << (compare(s[i], "stack") ? " OK" : " NOK") << endl;
return 0;
}
Resultado:
sTAck OK
STACk OK
STAcK OK
SSTTAACCKK NOK
stack OK
Extack NOK
Veja executando no Ideone. | stackexchange-pt_stackoverflow | {
"answer_score": 3,
"question_score": 3,
"tags": "c++"
} |
"Share your Developer Story" links lead to 404 pages
On the right-hand side of my Developer Story, I see the following:
; | stackexchange-stackoverflow | {
"answer_score": 1,
"question_score": 0,
"tags": "php, composer php, autoload, psr 4"
} |
Adding string 'm2' to arithmetic result
When I have
case
when p.okres_nazev like '%Praha%'
then cast(isnull(RealEstateTax_Suma,0) / 7 / 2 as varchar (30)) +' m2'
It gives me error
`Conversion failed when converting the varchar value '0.00 m2' to data type int.`
I want the result + m2 . So something like 30 m2
UPDATE : the query looks like
SELECT a.custkey,
a.dt,
a.RealEstateTax_Suma,
a.RealEstateTax_pocet,
p.psc,
CASE
WHEN p.okres_nazev LIKE 'Praha'
THEN CAST(isnull(RealEstateTax_Suma, 0) / 7 / 2 AS VARCHAR (30)) + ' m2'
ELSE 0
END AS VelikostNemovitosti
FROM wspace.dbo.DP_CustPayments_v3 a
JOIN dmr.Cust c
ON a.custKey = c.CustKey
AND c.LastRecFlg = 1
LEFT JOIN wspace.dbo.tp_GEO p
ON c.PostZIPCode = p.psc | The problem is with the `else 0`. Change it to `else '0 m2'` and it should work.
The thing is, the result of the `case` always has to be the same type. The `0` in the `else` clause is an integer, so it tries to convert the `varchar` in the other case to an `int`, which doesn't work.
However, you shouldn't be doing that in the database anyway. Adding `m2` and handling `null` values should really be done in the presentation layer, rather than in SQL.
Also, `like` doesn't work that way - you need to use e.g. `like 'Praha%'`, otherwise you're really just doing `= 'Praha'`. | stackexchange-stackoverflow | {
"answer_score": 2,
"question_score": 0,
"tags": "sql server"
} |
Change ServiceStack default format to JSON, but keep HTML format for SwaggerUI
Essentially, I want all of my responses returned in JSON by default, searched for an answer and stumbled upon this discussion: ServiceStack default format
What I tried:
1. Setting DefaultContentType to JSON and disabling Feature.Html --> works for responses, but breaks SwaggerUI (error on page render)
2. Only setting DefaultContentType to JSON --> doesn't break SwaggerUI, but making requests to my services from browser returns HTML (which makes sense because browsers usually the Accept header to receive html or xml, but I want to default to JSON)
That said, is there any way to _only_ (and safely) enable Feature.Html for SwaggerUI? Maybe using PreRequestFilters? | The issue is removing the HTML Format essentially removes HTML ContentType from consideration, but I've changed it to preserve the Content Type if the Service returns a raw HTML string in this commit where the Swagger UI can return HTML pages even if the HTML Format is disabled.
This change is available from v5.4.1 that's now available on MyGet.
An alternative is to leave the HTML Format enabled but use a request filter to change the Content Type to JSON where it's HTML for all Requests you want to do this for, e.g:
PreRequestFilters.Add((req, res) => {
if (req.ResponseContentType.Matches(MimeTypes.Html) && !req.PathInfo.StartsWith("/swagger-ui"))
req.ResponseContentType = MimeTypes.Json;
}); | stackexchange-stackoverflow | {
"answer_score": 2,
"question_score": 2,
"tags": "json, servicestack, swagger ui"
} |
How to capture any key in X?
I am building an application for which I need to periodically get information about users keyboard. It is going to be user idle detection application. I have a fairly simple solution to periodically check if the mouse has been moved. But I can't figure any reasonable non root way to detect if the keyboard has been pressed.
I was thinking about registering a hook every timer timeout and on any key press to unregister it. So if there is no key press for a long time then my program will know if the user is idle.
Anyway, I couldn't find any global hooks for _any_ key, including modifiers. Is there an easy way to do this? Or would someone have a better way to detect keyboard idleness?
Thanks | After a lot of searching I found this:
bool kbdActivity(Display* display) // checks for key presses
{
XQueryKeymap(display, keymap); // asks x server for current keymap
for (int i=0; i<32; i++) // for 0 to 32 (keymap size)
{
if (prevKeymap[i] != keymap[i]) // if previous keymap does not
{ // equal current keymap
XQueryKeymap(display, prevKeymap); // ask for new keymap
return true; // exit with true
}
}
return false; // no change == no activity
}
When I call it every 100-300ms it detects any pressed key anywhere in X. | stackexchange-stackoverflow | {
"answer_score": 4,
"question_score": 5,
"tags": "c++, linux, keyboard, hook"
} |
Save and load a singleton
I have created a singleton like this:
+ (instancetype)sharedDataStore {
static SSDataStore *_sharedDataStore = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
_sharedDataStore = [[self alloc] init];
});
return _sharedDataStore;
}
What is the best way of saving and loading it to and from the documents folder? I tried saving it with NSKeyedArchiver, but I don't know how to load it afterwards. What do I do instead of
_sharedDataStore = [[self alloc] init];
? | To restore the state of your singleton, you need to implement the `initWithCoder` method from the `NSCoding` protocol. Something like:
- (id)initWithCoder:(NSCoder *)decoder {
self = [super init];
if (!self) {
return nil;
}
self.property1 = [decoder decodeObjectForKey:@"property1"];
self.property2 = [decoder decodeObjectForKey:@"property2"];
return self;
}
* See NSCoding/NSKeyedArchiver on NSHipster for more details. | stackexchange-stackoverflow | {
"answer_score": 1,
"question_score": 1,
"tags": "objective c, xcode, singleton"
} |
How to port forward passive FTP from a router
I have a TP-Link archer c7 that I use as an access point connected to my ZTE mf283 router. To my TP-Link ac I have connected a 250GB external HDD which I use as storage for my FTP server that I set up on my TP-Link router.
That works great on my local network but I wanna be able to connect to my router from outside my network so I tried portforwarding but I soon found that that I need to use passive FTP. Now I understand theory more or less but how can I set that up so that it works? | You need to:
* Forward the FTP control connection port 21.
* Forward the passive mode data connection port range (server-specific, usually configurable).
* Configure your FTP server with the external IP address of the router, so that the server reports the correct address to the clients.
Some references:
* My article on network configuration for FTP modes;
* My answer to Connection to FileZilla FTP server works, but directory listing fails. | stackexchange-superuser | {
"answer_score": 5,
"question_score": 1,
"tags": "networking, wireless networking, router, wireless router, ftp"
} |
Hosting webapp on an AWS EC2 server. Do I need to use the AWS "application services" for search and email?
I want to host my app on an VPS/VPC and am currently leaning towards the AWS EC2 server. I'm looking at the console right now and I see a bunch of services offered like CloudSearch(managed search service) and SES(email sending service).
Considering the fact that I have already written code to do these things (at least for the search) that works locally, do I/should I still utilize these services? If so, why and how? | You do not need to use these services. But there are limits on sending emails from EC2 instances. (< , search for _Are there any limitations in sending email from EC2 instances?_ ).
If you intent to send huge amount of emails then you want to use SES. | stackexchange-stackoverflow | {
"answer_score": 2,
"question_score": 0,
"tags": "amazon web services, amazon s3, hosting, web hosting, vps"
} |
How do I manipulate an external list view's columns with javascript?
I want to manipulate the columns of an external list view (XsltListViewWebPart), however, as the data loads asynchronously I must wait for the data to load and the table to be generated before my code can run.
I assume I need to use a callback but can't find anything. | I ended up just polling for the existence of the table containing the data, which will have class `ms-listviewtable`. (I'm using jQuery here.)
$(function(){
var intervalId = setInterval(function() {
if ($('.ms-listviewtable').length > 0) {
clearInterval(intervalId);
// Code here
}
}, 100);
}); | stackexchange-sharepoint | {
"answer_score": 0,
"question_score": 2,
"tags": "list view, external list"
} |
Rotate an array of arrays clockwise 90 degrees
I would like to rotate the orientation of an array so that rows and columns are inverted.
For example, I want to convert this:
1 cat calico
2 dog collie
3 cat siamese
4 dog mutt
to this:
4 3 2 1
dog cat dog cat
mutt siamese collie calico
How can I accomplish this? | Here is a way you can accomplish this:
function rotate_2d_array($array)
{
$result = array();
foreach (array_values($array) as $key => $sub_array)
{
foreach (array_values($sub_array) as $sub_key => $value)
{
if (empty($result[$sub_key]))
{
$result[$sub_key] = array($value);
}
else
{
array_unshift($result[$sub_key], $value);
}
}
}
return $result;
}
And here is the test:
$a = array(
array(1, 'cat','calico'),
array(2, 'dog', 'collie'),
array(3, 'cat', 'siamese'),
array(4, 'dog', 'mutt')
);
print_r($a);
$b = rotate_2d_array($a);
print_r($b); | stackexchange-stackoverflow | {
"answer_score": 1,
"question_score": 0,
"tags": "php, multidimensional array, rotation, orientation"
} |
How do you call master page methods from a content page when the button is inside an update panel?
I have a masterpage and a content page. In the content page I have a script manager and an update panel. In the update panel I want to be able to click a button which would hit a public method on the master page to show a message. This works if I don't have an update panel on the content page but is there a way to get it to work when the button is in an update panel?
Master Page:
public void ShowMessage(string Message)
{
lblError.Text = Message;
lblError.Visible = True;
}
Content Page:
Master.ShowMessage("something"); | I ended up just sucking it up and putting the script manager on the master page and putting the label on the master page inside an update panel. | stackexchange-stackoverflow | {
"answer_score": 2,
"question_score": 8,
"tags": "c#, asp.net, .net 4.0"
} |
ElasticSearch equivalent to SQL "WHERE (condition1 OR (condition2 AND condition3))"
I'm new to elastic search and I'm having a hard time figuring out how to transform the SQL query below into ES syntax :
WHERE (id IS NULL OR (id IS NOT NULL AND test = 0))
I guess I have to use the "should" keyword somewhere and maybe the filter, but I'm not quite sure how to make the query in ES. | Your query should be like:
{
"bool": {
"should": [
{
"bool": {
"must_not": [
{
"exists": {
"field": "id"
}
}
]
}
},
{
"bool": [
"must": [
{
"exists": {
"field": "id"
}
},
{
"term": {
"test": {
"value": 0
}
}
}
]
]
}
]
}
} | stackexchange-stackoverflow | {
"answer_score": 1,
"question_score": 0,
"tags": "sql, elasticsearch"
} |
What is the default WordPress API
I'm looking to start a new WordPress API based project. I want to make sure I'm starting with the best tools at hand so that I'm not changing my mind half way through. What I want to know is; What is the best supported API framework for WordPress? What is the default API that comes as part of WordPress core and how does it compare to other WP API plugins.
I'm leaning towards the WP REST API however I would like to know if the XML-RPC interface 'WordPress API' would alternatively be the right way to go.
Any feedback would be great. | The _official_ wordpress API is still under ongoing development. You can find the old legacy REST api here, which will work, but might be broken in the future: <
As for the new and improved version 2 found here < this is the version that will be supported and used in the future. **I would recommend using this API** , as there will most likely not be any huge breaking changes in the future, and this is being actively maintained and developed by a considerable amount of contributors.
There's still a lot missing from the official API, but they're working away on these issues as we speak. In it's current state, it's still quite powerful. | stackexchange-stackoverflow | {
"answer_score": 1,
"question_score": 3,
"tags": "wordpress, api"
} |
How to rewrite the lower bound and upper bound of the double sum to accommodate a constraint?
How to rewrite the upper bound and lower bound of this double sum:
$$\sum\limits_{K = 0}^{K = M - 1} {\sum\limits_{L = 0}^{L = M - 1} {f\left( {{x_L},{x_K}} \right)} }$$
When the summation process can only be proceeded under the constraint $K + 1 > L$ ?
Since $M$ could be very large, for example the number of antenna in Massive MIMO system dropping the conditional checking of $K + 1 > L$ can save a little bit time.
Thank you for your enthusiasm ! | You can write it as
$$\sum_{L=0}^{M-1}\sum_{K=L}^{M-1}f(x_L,x_K)$$
or as
$$\sum_{K=0}^{M-1}\sum_{L=0}^Kf(x_L,x_K)\,;$$
both are equivalent to
$$\sum_{0\le L\le K\le M-1}f(x_L,x_K)\,.$$ | stackexchange-math | {
"answer_score": 2,
"question_score": 0,
"tags": "sequences and series, summation"
} |
Why does strlen return a different length for floats?
I do understand that PHP can interchangeably consider a number and string (if it represents a number).
<?php
$original = 23.000000000001;
echo strlen($original); # Displays 15
?>
and thanks to the definite limit a computer can store float values upto,
<?php
$original = 23.0000000000001;
echo strlen($original); # Displays 2
?>
But why does PHP display 3 instead of 15 here?
<?php
$original = 23.0000000000001*10;
echo strlen($original); # Displays 3
?> | Before calculating the length, it is converted to a string. This is the same as
echo (string) 23.0000000000001*10; // 230
As you can see, the length is really 3 Why is this happening ? Overflow occurs. during multiplication, the mantisa is transferred, an overflow occurs, the last number does not have enough space
<
23.0000000000001 == 0100000000110111000000000000000000000000000000000000000000000000 IN IEEE 754 format. After when multiplying, a byte move to the left is done, as a result, we lose bits | stackexchange-stackoverflow | {
"answer_score": 2,
"question_score": 0,
"tags": "php"
} |
How to create multiline ListBox in GWT?
In my project the value to show in GWT list-box is big(from database). So user is not able to see the full value at once. For this I have decided to add display value in multiline. I have used tags like \n and HTML tags like breakline but not getting the result. GWT compiler considering these tags as a string and showing in the list. How can I do this. Can I apply customized css?
My code is as below:
ListBox getListBox(boolean dropdown) {
String longText = "AAAAAAAAAAAAAAAAAAAA BBBBBBBBBBBBBBBBBBBB CCCCCCCCCCCCCCCCCCCC";
ListBox widget = new ListBox();
widget.addStyleName("demo-ListBox");
widget.addItem(longText);
widget.addItem("Two");
widget.addItem("Three");
widget.addItem("Four");
if(!dropdown)widget.setVisibleItemCount(3);
return widget;
} | GWT `ListBox` simply wraps an HTML `select` element. Such element does not allow line breaks in its `option` values.
You can:
* change approach: use a short description with a longer `title` attribute;
* roll out your own widget, or use one already available (like the new `GwtChosen`). | stackexchange-stackoverflow | {
"answer_score": 1,
"question_score": 0,
"tags": "html, css, gwt"
} |
What is this schematic symbol in the INA851 overvoltage schematic?
I was looking at the INA851 and trying to understand the input over-voltage protection. I can't seem to figure out what this pictured part is.
 than expected(44)
query:
SELECT COUNT(*)
FROM tableA as u
LEFT JOIN tableB as d
ON u.uid=d.uid
WHERE
u.uid=912391178669
AND
u.deleted = 0
AND
d.deleted=0
tables schema:
**tableA**
id | uid | deleted
**tableB**
id | uid | deleted | I have run the following query It is working correctly.. U can check it out.
SELECT
( SELECT count(*) from table1 where.... )
+ ( SELECT count(*) from table2 where.... )
as total from dual | stackexchange-stackoverflow | {
"answer_score": 2,
"question_score": 1,
"tags": "mysql, sql, join, left join, mysql num rows"
} |
Quiz master software?
Are there any software for Ubuntu which quiz masters can use to display questions for quiz events?
If there aren't any, what tools or frameworks provide an easir way to build one. Minimum requirements are: a window with eye-candy look, one or multiple text questions on each page, display of multiple images or a single picture and also ability to include videos or sound. There should be an interface to display scores. | Try KWordQuiz. !alt textIt's not the best, or necessarily the most appropriate, but it gets the job done.
I would also suggest using KompoZer or a similar program from creating a quiz in HTML, or possibly even OpenOffice.org(LibreOffice) impress/writer. All 3 can create a presentation style quiz, which you could then convert to PDF format (built into OOo) for display. | stackexchange-askubuntu | {
"answer_score": 5,
"question_score": 3,
"tags": "software recommendation"
} |
About spacing between three identical symbols
The following code
\documentclass{article}
\usepackage{amsmath}
\begin{document}
$*,**,***$
\end{document}
* * *
yields
. | The problem is that TeX interprets the middle `*` as a binary operator in `***`, so it adds more space. With one or two `*`'s this does not happen because binary operators need two operands.
To turn this "feature" off use `{*}`, which tells TeX to interpret the `*` as an ordinary character.
Changing your MWE to:
\documentclass{article}
\usepackage{amsmath}
\begin{document}
$*,**,*{*}*$
\end{document}
gives the output:
; | You don’t publish to queues, you send to queues.
You can get a send endpoint from the `ConsumeContext` or `IBus` by calling `GetSendEndpoint` with a URI specifying the queue name, such as `queue:name`. | stackexchange-stackoverflow | {
"answer_score": 1,
"question_score": 1,
"tags": "masstransit"
} |
Why can't I connect these two components in Altium?
It continues showing me green errors. Why?

{
getNewestData();//$resource factory to get server data
}, pollInterval );
This works fine voor 99% of the time, but if the internet speed is really slow(I have actually experienced this), It will send the next request before the current is finished. Is there a way to just skip the current interval request if the previous one is still busy? Obsiously I could just use booleans to keep the state of the request, but I wonder if there is a better(native to angular) way of doing this? | How about making the request, then waiting for that to complete and then wait 10 seconds before making the same request again? Something along this line:
var pollInterval = 10000;
var getNewestData = function () {
// returns data in promise using $http, $resource or some other way
};
var getNewestDataContinuously = function () {
getNewestData().then(function (data) {
// do something with the data
$timeout(function () {
getNewestDataContinuously();
}, pollInterval);
});
};
`getNewestData` is the function that actually makes the request and returns the data in a promise.
And once data is fetched, a `$timeout` is started with timer as 10 seconds which then repeats the process. | stackexchange-stackoverflow | {
"answer_score": 0,
"question_score": 0,
"tags": "angularjs, ajax, rest, request, setinterval"
} |
Wrap text round brackets
I want to accomplish this effect with LaTeX:
!enter image description here
I have a slight idea of how to do that using \left{ and \right} on math mode but I’m not sure. If there’s a package that helps to do that, coding would be much easier and code would be much more beautiful. | another possibility is to use the `array` environment:
He is being
{\arraycolsep=0pt $\left\{
\begin{array}{l} \mbox{a nuisance}\\ \mbox{naughty} \end{array}
\right\}$}
again.
the `\arraycolsep` has to be localized, otherwise it will apply to the entire document from that point on. if you are already using the `amsmath` package, you can use `\text` instead of `\mbox`. | stackexchange-tex | {
"answer_score": 4,
"question_score": 7,
"tags": "formatting"
} |
Create a Timestamped ZIP Archive from Windows Command Prompt
I've made a simple script to create a timestamped zip archive using a combination of PowerShell and a DOS command, but is there a better way to do this just using a single PowerShell command with piping?
FOR /F "tokens=* USEBACKQ" %%F IN (`powershell get-date -format "{yyyymmdd-HHmmss}"`) DO (
SET ARCHTIMESTAMP=%%F
)
powershell Compress-Archive -Path yourpath -DestinationPath yourdestpath\yourname-%ARCHTIMESTAMP%.zip | You're incredibly close with what you have here. Just drop the `get-date` in where you're creating the string for your destination path.
Compress-Archive -Path yourpath -DestinationPath "yourdestpath\yourname-$(get-date -format "{yyyyMMdd-HHmmss}").zip" | stackexchange-stackoverflow | {
"answer_score": 2,
"question_score": 1,
"tags": "windows, powershell, command line"
} |
SoapUI not reading project property
I'm trying to use a project property to make up part of a JWT token that I'm passing through for my request.
The project property is: `Name = AuthToken, Value = 12345`.
The following works in the header:
`Header = Authorization, Value = JWT 12345`
But when I try to use property expanison: `Value = JWT ${AuthToken}`
I get an error saying:
{
"statusCode": "InternalServerError",
"message": "An unknown error has occured. Please try again later.",
"reason": "Internal Server Error"
}
Is there something wrong with the syntax? I've tried a couple of variations based on what I read in the user guides, but it doesn't seem to be working. | The syntax to access a **project** property using property expansion is `${#Project#YourPropertyName}`.
So as header value use `JWT ${#Project#AuthToken}` instead of `JWT ${AuthToken}`
Hope it helps, | stackexchange-stackoverflow | {
"answer_score": 1,
"question_score": 0,
"tags": "soapui"
} |
Setting "domain" permission on google cloud storage bucket/object - UI or API only?
Is it possible to set this permission through the Cloud Console UI for cloud storage? Or is it only settable through the API (for example, following the guidance in this post)
In the documentation for Google's cloud storage, one of the defined permission scopes is "domain". This allows you to specify that the read or write permission is granted to any authenticated user that is part of your Google Apps domain.
When accessing a storage container UI in the cloud console, you can set user or group permissions, but entering a naked domain with either "User" or "Group" selected results in an "Invalid Value" message when the changes are saved. | This setting is now exposed via the Cloud Console UI. You should notice 3 sections in the dropdown: user, group, and domain.
The setting is also available via the API and via the command-line utility, gsutil. To grant read access to the domain my-domain.org from gsutil, you'd do something like this:
gsutil acl ch -g my-domain.org:R gs://bucket | stackexchange-stackoverflow | {
"answer_score": 1,
"question_score": 4,
"tags": "permissions, google cloud storage"
} |
XSetgv crashes in my bare metal software
I am developing a bare metal program. The platform is x86, 32 bit, protected mode, I am at ring 0. I would like to enable AVX by using xsetgv instruction. 18th bit of CR4 is 1, if I use xgetgv then nothing wrong happens, but the xsetgv crashes (the virtualbox reports fatal error). The problematic code is the following:
mov ecx, 0
mov eax, 0x7
mov edx, 0
xsetbv
What is the problem? | The problem was the bugy virtual box, my code works greatly on a real hardware, and the newest virtualbox. | stackexchange-stackoverflow | {
"answer_score": 2,
"question_score": 0,
"tags": "assembly, x86, bare metal"
} |
What's the memory footprint of the DLR?
I'm considering making limited use of C#'s `dynamic` keyword. My initial time trials were astonishing - a performance hit of less than a second for 100,000 iterations (likely due to DLR caching).
I don't have access to a memory profiler, though, and Eric Lippert wrote:
> Then it starts up the DLR [...] The DLR then starts up a special version of the C# compiler...
What's the memory footprint of this, and is it unloaded when the dynamic code is garbage-collected? | > is it unloaded when the dynamic code is garbage-collected?
The question presupposes an incorrect premise; the dynamically generated code _isn't_ garbage collected in the current implementation. It is cached and the caches live until the appdomain is torn down. We don't know when the _last time_ a particular code path is going to be called.
If you want to know the impact on virtual memory, heap memory, private bytes, shared bytes, and so on, then my suggestion is that you use a memory profiler to answer those specific questions. There are a half a dozen different "memory footprints" you could be interested in, and I don't know which one is relevant to you. Use the appropriate tool to measure whatever is interesting to you, and then you'll know. | stackexchange-stackoverflow | {
"answer_score": 11,
"question_score": 5,
"tags": "c#, memory, dynamic, c# 4.0, dynamic language runtime"
} |
FileMaker Pro Standard/Advanced users connection limits to a FileMaker Server with Team License
Is there a limit in quantity of FileMaker Pro Standard/Advanced users where connection to a FileMaker Server with Team License is involved? I mean that if a company choose the FileMaker Server with 5 license for User Connection, I may be the sixth to be connected with my standard FileMaker Pro Advanced with no problem (I work this way at my customer sites) but which is the limit for quantity of user connected, if any, at server side? | The limit of 5 pertains to the ones connecting using the team license. For regular Pro/Advanced licenses there is no limit, other than the physical limits imposed by the server software/hardware combination. Check the FileMaker Server specification at filemaker.com for those limits. | stackexchange-stackoverflow | {
"answer_score": 0,
"question_score": 0,
"tags": "filemaker"
} |
why require login when already add cookie on browser?
I login to website successfully and cookie add in browser for that website but 1 day later, I enter this website so website require me login although I check cookie still available somebody can help me to explain in this case ! P/S:this website use PHP source. in case appear in some other PHP website | So what it sounds like is happening is that the session cookie (the cookie used to authenticate you) expired. Cookies are often set to expire to log you out of a given application for security reasons (to prevent cases such as someone else using your computer and accessing your banking details because the cookie didn't expire and you didn't explicitly click log out). | stackexchange-stackoverflow | {
"answer_score": 0,
"question_score": 0,
"tags": "php, cookies, browser, web"
} |
Replace Lenovo Yoga cracked screen
I have a lenovo yoga 13.3" first gen touch screen laptop with cracked screen. LCD is working fine. I only need to replace the cracked screen which screwed up the digitizer. I'm using it by disabling the touch interface.
Can anyone help/redirect me with how to replace the screen? | Firstly, I would recommend contacting your countries Lenovo Support Centre as it may not cost a lot to have it replaced by them.
Failing that and if you are up to it, the Hardware Maintenance manual should have all the instructions you need to replace the digitizer.
The instructions you'll need for removing and replacing the LCD assembly start on page 48 here. You will however need to go back as far as page 33 (1010 Keyboard) and work through to 1090 LCD unit.
**NOTE:** While Lenovo do freely release part replacement documents for their products, I would still recommend having the part replaced by a certified technician. | stackexchange-superuser | {
"answer_score": 2,
"question_score": 1,
"tags": "laptop, touchscreen"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.