INSTRUCTION
stringlengths 25
999
| RESPONSE
stringlengths 0
999
| SOURCE
stringlengths 16
38
| METADATA
dict |
---|---|---|---|
How to set ANT_HOME in Jenkins in Ubuntu
I am new to Ubuntu.I have installed ant using `apt-get install ant` then I tried `which ant` which showed the path `/usr/bin/ant` I included the same path in Jenkins ANT_HOME but it shows `/usr/bin/ant` is not a directory.I tried adding the ANT_HOME in .bashrc file .what should I need to do to set the ANT_HOME in Jenkins.Please help
|
Jenkins can use its own versions of Ant, and this is really the preferred way. You can have multiple versions of Ant in Jenkins, and each job can use whatever version you desire.
Go to the Configuration Section (`$JENKINS_SERVER/jenkins/configure`). Look for the _Ant_ section, and click on the _Ant Installation_ button. To add an Ant installation, click on _Add Ant_ , then add in a name which should include the Ant version. Click on the _Install Automatically_ button, and under the _Install from Apache_ , select the version you want to install.
Once this is done, you will get a choice of Ant installations when you select that you want to do an _Ant Build_ when you configure a job.
Using the default Ant version can be tricky if it is updated, and your job can't use the newer version. Or, if someone adds something to the default Ant version that breaks your builds.
|
stackexchange-stackoverflow
|
{
"answer_score": 5,
"question_score": 3,
"tags": "ubuntu, ant, jenkins"
}
|
Simple and efficient way to send a 5V square wave to an 8ohm 1W speaker
I want to use a 5 V square wave generated by an ATTINY85 to drive a 1 W, 8 ohm speaker at 1 W. The project has to be battery powered.
I would like to use a 18650 rechargeable 3.7 V Li-ion battery and a 5 V 600 mA boost converter:
 swing.
I considered using an LM386N amplifier, but from the datasheet it seems that the output voltage would not be enough to achieve the required 1 W maximum power.
I am wondering if I have to use more capable boost converter, making the project more complex having other stuff which need to work at 5 V, or if it is possible to do something else.
|
If you need to drive a square wave the usual trick (from the piezo days) is to use an H-bridge do double the applied voltage:
* On 'forward' you have 5V applied
* On 'reverse' you have -5V applied
… driving thus the speaker with a 10Vpp signal You could use a bridge intended for small DC motors, the load is in fact similar.
Just remember to _switch off_ the bridge when you are done otherwise you'll burn the speaker with a DC signal.
|
stackexchange-electronics
|
{
"answer_score": 9,
"question_score": 4,
"tags": "circuit design"
}
|
Birth-death process with a single absorbing state which is not $0$
I'm working on an issue related to Hyperdimensional Computing. In short, I have a $d$-bit array $v$ sampled uniformly from the space of all $d$-bit binary arrays.
Consider the following process: at each step, I uniformly choose one of the $d$ positions of this vector $v$ and flip the bit. My question is: what is the expected number of steps until the vector obtained is orthogonal ($d/2$ distant) to the initial vector?
What I could think of so far is that this process can be expressed as a birth-death process where state $0$ is not absorbing but another state $d/2$ is. In this case the question would be: what is the expected number of transitions, starting from state $0$, to absorption in state $d/2$?
Thank you so much,
|
I guess these are $\\{ -1,1 \\}$ bits instead of $\\{ 0,1 \\}$ bits.
If so then yes, assuming $d$ is even, then you can model this as a symmetric random walk which is _a priori_ on $0,1,\dots,d$ with reflecting boundaries, but can be restricted to $0,1,\dots,d/2$ by making $d/2$ into an absorbing boundary. This random walk describes the number of bits that are different than the original, so it starts at $0$.
So you have $p_{i,i+1}=(d-i)/d$ for $0 \leq i<d/2$, $p_{i,i-1}=i/d$ for $1 \leq i<d/2$ and $p_{d/2,d/2}=1$. Everything else is zero. Say $u(i)$ is the expected absorption time starting at $i$. By considering starting at each state and conditioning on each possible outcome, you get $u(0)=1+u(1),u(i)=1+\frac{(d-i) u(i+1)+i u(i-1)}{d}$ for $1 \leq i<d/2$ and $u(d/2)=0$. This is a linear system you can solve.
|
stackexchange-math
|
{
"answer_score": 1,
"question_score": 1,
"tags": "probability, markov chains, birth death process"
}
|
Why the article before "when"?
In heist comedy movie _Logan Lucky (2017)_ , Jimmy wants to steal money:
> Jimmy: I even know **the when** to do it. June 4th, the Grocery Castle Auto Show. It's graduation weekend. It'll be the smallest turnout of the summer. And gonna be bare bones staff and security.
Why the article before "when"?
|
Here, “when” is used as a countable noun to mean “date”. And we use an article before a countable noun. He has used the definite article before “when” to talk about one specific date. However, It’s informal to use “when” as a noun.
|
stackexchange-ell
|
{
"answer_score": 1,
"question_score": 1,
"tags": "grammar"
}
|
VBA copy formatting from a row to several rows
Alright so I am really close to getting this but I am just trying to make it work better. I want to copy row 2 formatting that goes until like Column H. The data only goes until Column H. So my code copies ONLY row 2 until Column H. But when it goes to paste, it highlights the whole sheet besides row 1 and it looks like it copies the formatting across the whole thing. It is not really an issue but I would rather know how to make it paste only in the rows and columns I want for future reference. I only want it going to cells that have data in it basically. Thanks for the help in advance!
Range("A2", Cells(2, Columns.Count).End(xlToLeft)).COPY
Range("A2", Cells(Range("A" & Rows.Count).End(xlDown).Row)).PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
|
Try this:
Dim rngCopy As Range, rngPaste As Range
With ActiveSheet
Set rngCopy = .Range(.Range("A2"), .Cells(2, Columns.Count).End(xlToLeft))
Set rngPaste = .Range(.Range("A2"), _
.Cells(Rows.Count, 1).End(xlUp)).Resize( , rngCopy.Columns.Count)
End With
rngCopy.Copy
rngPaste.PasteSpecial Paste:=xlPasteFormats
Application.CutCopyMode = False
|
stackexchange-stackoverflow
|
{
"answer_score": 7,
"question_score": 3,
"tags": "vba, excel"
}
|
Removing the default language in an assembly and moving it to a satellite assembly
I have a .Net 3.5 application written mostly in C# that uses .resx files to store internationalization data for several different languages, consisting of strings, control sizes and positions, etc. What I'm trying to figure out is this: **it is possible to compile my application in such a way that the default culture data will be pulled out into a satellite assembly** in much the same way as the other culture data?
I'm trying to prevent a situation where the user uses the software in one (non-default) language, removes the culture folder in the bin directory, and then has **access to the default language**.
If this is impractical or impossible due to framework limitations, is it possible to perhaps **compile in a language other than the default** , so that I could give a single, non-default version of the application to the user?
Thanks so much for your answers.
|
I did something similar just a few days ago, because I needed all my app's assemblies to have access to the same resources. You just need to create a separate assembly containing the resources, and reference it from your app's assemblies. Note that if you do that, the resource assembly won't be a _satellite_ assembly: it willbe explicitly referenced from other assemblies, and the app won't start at all if it's not present.
Also note that by default the resources classes generated by Visual Studio are internal. To make them public, you need to replace the custom tool `ResxFileCodeGenerator` with `PublicResxFileCodeGenerator`.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 1,
"tags": "c#, .net, internationalization, compilation, satellite assembly"
}
|
Are there any games that contain a machine learning AI?
Can anybody here give a reference to commercial AAA games that implement a machine learning AI?
|
The most common approach is to train the AI off-line or pre-release, and to ship that final result. As such the game arguably doesn't contain a machine-learning AI.
This is because machine learning can traditionally take many hours of training to produce a usable result, and as it's by definition emergent, it's probably a good idea to put any result through a full QA pass to make sure there aren't any exploitable edge cases.
For the above reasons, and because gameplay changes and balancing even late on might mean that the AI has to be retrained and retested, not many studios use this approach.
|
stackexchange-gamedev
|
{
"answer_score": 13,
"question_score": 10,
"tags": "ai"
}
|
Implementing Basic Authentication in WCF
I've a requirement to implement basic authentication in WCF but the user credentials are stored in database instead of Active Directory. So whenever a client call my service method I've to get the username & password from the SOAP headers and authenticate using database. Can any body point out some good references to implement this?
Note: The service is using basic-http binding.
|
What are you really want to use? You are combining multiple authentication strategies together because Basic authentication usually refers to Basic HTTP authentication and it doesn't use SOAP header. It uses HTTP header.
If you want to use Basic HTTP authentication your choices differ by hosting type:
* In self hosting scenario and WCF 4 you should be able to validate credentials with custom password validator
* In IIS hosted service you need custom authentication module because default authentication always goes against windows accounts
If you want to use authentication based on SOAP header you can again use custom password validator.
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 2,
"tags": "wcf, wcf security, basic authentication"
}
|
Character Translation using Python (like the tr command)
Is there a way to do character translation / transliteration (kind of like the `tr` command) using **Python**?
Some examples in Perl would be:
my $string = "some fields";
$string =~ tr/dies/eaid/;
print $string; # domi failed
$string = 'the cat sat on the mat.';
$string =~ tr/a-z/b/d;
print "$string\n"; # b b b. (because option "d" is used to delete characters not replaced)
|
See `string.translate`
import string
"abc".translate(string.maketrans("abc", "def")) # => "def"
Note the doc's comments about subtleties in the translation of unicode strings.
And for Python 3, you can use directly:
str.translate(str.maketrans("abc", "def"))
Edit: Since `tr` is a bit more advanced, also consider using `re.sub`.
|
stackexchange-stackoverflow
|
{
"answer_score": 54,
"question_score": 54,
"tags": "python, perl, tr, transliteration"
}
|
What are the essential resources for learning the fundamentals of LEGO building?
After years of buying and building LEGO sets, my six-year-old son is tearing through the first level of the Master Builder Academy. He's fascinated by micro-building, and generally seems liberated after learning some of the fundamentals of LEGO design and building.
There are so many books and blogs, but many of them just show (fantastic) finished projects. I'm looking for the best published material (of any era), websites and individual blog posts that teach techniques and ways of thinking about building with LEGO -- that show _and_ tell.
|
I'd particularly recommend The Unoffical LEGO Builder's Guide. It covers all of the basics and gets into many of the more complex building techniques.
If you're interested in getting right into the details, The Unofficial LEGO Advanced Building Techniques Guide by Didier Enjary covers a wide variety of building techniques and is freely available. I don't know a lot about this document, but I first came across it on The Brothers Brick.
|
stackexchange-bricks
|
{
"answer_score": 12,
"question_score": 15,
"tags": "building"
}
|
Points $A (b, 2c), B(4 b, 3c), C (5b, c)$, and $D(2b, 0)$ form a quadrilateral. How would you classify the Quadrilateral and explain your steps?
I have homework -
> Points $A (b, 2c), B (4 b, 3c), C (5b, c)$, and $D (2b, 0)$ form a quadrilateral. How would you classify the Quadrilateral and explain your steps?
But I don't know really how to start? I mean should I draw figure? And where are points (in a coordinate system)?
If someone can explain?
Thanks again!!!
|
Let $A':=(1,2),\,B':=(4,3),\,C':=(5,1),\,D':=(2,0)$ and we apply a linear transformation $(x,y)\to (bx,cy)$ to them, obtaining $A,\,B,\,C,\,D$.
As it can be clearly seen from the picture $. It will remain parallelogram after the transform (e.g. for the same reasoning, $\overrightarrow{AB}=\overrightarrow{DC}=(3b,c)$).
|
stackexchange-math
|
{
"answer_score": 2,
"question_score": 1,
"tags": "geometry, quadrilateral"
}
|
Роутер DLink Dir - 100, после отключения из розетки слетело ПО
В MiniWeb не заходит, горит только индикатор питания.
|
Скорее всего, только подключение через serial порт поможет узнать что с ним. Распиновка порта есть тут: < там уровни 3,3в, так что нужен специальный конвертер с USB на 3,3в TTL.
|
stackexchange-ru_stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "сеть, роутер"
}
|
In Spark how to call UDF with UDO as parameters to avoid binary error
I defined a UDF with UDO as parameters. But when I tried to call it in dataframe, I got the error message "org.apache.spark.SparkException: Failed to execute user defined function($anonfun$1: (array) => int)". Just want to know it is expected that the exception mentioned the UDO as binary, and also how should I fix it?
val logCount = (logs: util.List[LogRecord]) => logs.size()
val logCountUdf = udf(logCount)
// The column 'LogRecords' is the agg function collect_list of UDO LogRecord
df.withColumn("LogCount", logCountUdf($"LogRecords"))
|
in general you cant pass in custom objects into UDFs, and you should only call the udf for non-null rows otherwise there will be a NullPointerException inside your UDF. try:
val logCount = (logs: Seq[Row]) => logs.size()
val logCountUdf = udf(logCount)
df.withColumn("LogCount", when($"LogRecords".isNotNull,logCountUdf($"LogRecords")))
or just use the built-in function `size` to get the logCount :
df.withColumn("LogCount", size($"LogRecords"))
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "apache spark, apache spark sql"
}
|
Ensure newline at EOF in RubyMine
How does one enforce a newline at end of file in RubyMine (v 4.5.3, on Mac OS)?
_e.g., similar to Sublime Text 2_
|
Enable **Ensure blank line before end of file on Save** option in the `Editor` settings:
!Ensure blank line before end of file on Save
|
stackexchange-stackoverflow
|
{
"answer_score": 45,
"question_score": 34,
"tags": "macos, rubymine"
}
|
How to combine a dictionary and list by key
I have a dictionary which looks like this:
Dictionary<String, String> dictionary = new Dictionary<string, string>{
{ "dog", "DOG" },
{ "cat", "CAT" },
...continued
};
and I want to extract the Id value from a list that has a matching value like below:
List<Animal> records = new List<Animal>{
{ Id: "1", Name: "DOG" },
{ Id: "2", Name: "CAT" }
...continued
}
I need to output a dictionary that looks like this:
Dictionary<String, String> newDictionary = new Dictionary<string, string>
{ "dog": "1" },
{ "cat": "2 }
...continued
}
Is there a simple LINQ solution to this?
|
You can use `JOIN` to get matching records from dictionary and list like this:
var query = from d in dictionary
join r in records
on d.Value equals r.Name
select new { Id=r.Id, Name=d.Key };
var newDictionary = query.ToDictionary(d => d.Name, d => d.Id);
|
stackexchange-stackoverflow
|
{
"answer_score": 5,
"question_score": 0,
"tags": "c#, json, list, linq, dictionary"
}
|
In MATLAB, For Looping with String Array
A similar question has been asked, but still I'm looking for a solution.
In MATLAB, I have an array of states s:
s = {'Indiana', 'Texas', 'Alabama'}
Time is a column vector: [120 30 20 40 50]'
Tornadoes is a column vector: [5 5 3 5 5]'
And I need to for loop through this array s for the following code below while placing each string in s in the first line.
index = strcmpi(States,s)
Time = Time(index)
Tornadoes = Tornadoes(index)
h = scatter(Time,Tornadoes)
So how can I write the code to push each state in s to generate a plot for each plot.
|
Could it be as simple as this?
for ii = 1:numel(s)
index = strcmpi(States, s{ii})
Time = Time(index)
Tornadoes = Tornadoes(index)
figure % make sure you start a new figure each time...
h = scatter(Time,Tornadoes)
title(['Tornadoes in ' s{ii}])
end
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": -2,
"tags": "arrays, matlab, for loop"
}
|
Syntax for Azure Cosmos DB CONTAINS
I have the following JSON Store on Azure Cosmos DB.
{
"id": "4",
"total": 10.46,
"tax": 0.55,
"soldItems": [
{
"item": "CHEESE NIPS 004400001300 F 1.97 D",
"price": 1.97
},
{
"item": "ROOT BEER 10.46",
"price": 10.46
}
]
}
and I am getting no results from this query:
SELECT * from c where CONTAINS(c.soldItems.item, "BEER")
What would be the correct syntax to check for a string in an JSON object value?
|
Try this:
SELECT VALUE c FROM c JOIN s in c.soldItems WHERE CONTAINS(s.item, "BEER")
|
stackexchange-stackoverflow
|
{
"answer_score": 64,
"question_score": 33,
"tags": "azure cosmosdb"
}
|
Query By Humming system
I need to identify the songs by human hum. what are the best methodology and algorithm that i can use for achieve that. I search for code samples. But I couldn't find. Please help me....
|
You could begin a python program that uses tensorflow to deep-learn the correspondence between humming and songs - it should fall under the umbrella initiative by Google Brain called Magenta. Of course for Deep-Learning you would need to have a large corpus of examples to learn from.
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": -6,
"tags": "python"
}
|
Continuous of function.
If $f$ continuous at $x_0$ and $f(x_0)>0$
then how to show there exist $\epsilon>0$ and $\delta>0$ such that $f(x)>0$ for $|x-x_0|<\delta$.
I don't know to start proving and then i use definition continuous function at $x_0$ is
$\forall\epsilon>0, \, \exists\delta>0 \, \text{such that if }|x-x_0|<\delta\implies |f(x)-f(x_0)|<\epsilon$
|
$f$ continuos at $x_0$, and $f(x_0) >0$.
For every $\epsilon >0$ there is a $\delta >0$ such that
$|x-x_0| \lt \delta$ implies
$|f(x)-f(x_0)| \lt \epsilon.$
Since $|f(x)-f(x_0)| \lt \epsilon$, we have
$-\epsilon \lt f(x)-f(x_0) \lt \epsilon$, or
$f(x_0) -\epsilon \lt f(x)$.
For which choice of $\epsilon$ is the LHS positive?
Recall: $f(x_0) >0.$
|
stackexchange-math
|
{
"answer_score": -1,
"question_score": 1,
"tags": "calculus, real analysis, continuity"
}
|
Do Wolverine's opponents bleed (and leave blood on the claws) in comics?
As per this question, in the movies, they don't show blood on Wolverine's claws (because MPAA ratings would suffer otherwise).
The implication seems to be that this is endemic to movies, and not the case in comics.
Is that the case? **Do the comics routinely show blood, both in general when Wolverine stabs/slashes people, and most especially, on his claws**?
Any era answer will do, but I'm interested in "mainstream" X-men or wolverine ones, not some extra edgy/gritty niche arcs.
* * *
A negative answer should have some proof from out-of-universe statements from marvel-associated people. A positive answer should least (if possible give a screenshot/thumbnail) of at least 2-3 distinct examples from different comics/eras.
|
Yes, Wolverine's opponents do bleed, as would be expected by razor-sharp claws penetrating a person's skin, and there have been a number of comics featuring blood on the claws.
Even a cursory search for images of Wolverine shows his opponents bleeding, but one example is the 2nd printing variant of _Wolverine_ #2.
To give a few examples of comics that show blood on the actual claws, one needs to look no further than the covers of:
* _X-Force Sex and Violence_ #1 and its variant
* _Wolverine: Bloody Choices_ Volume 1 #1
* _Wolverine Origins_ #50
* _Wolverine_ #2 Vampire Variant
|
stackexchange-scifi
|
{
"answer_score": 17,
"question_score": 7,
"tags": "marvel, wolverine"
}
|
how to calculate minimum distance between an ellipsoid hull and a point in R
I applied the ellipsoidhull() function in R to a set of latlong points. From there I am trying to find the minimum distance between that ellipsoid and a new latlong point. So far I have the code below but it is certainly incomplete. Any help is appreciated, thank you.
df <- cbind(A$lat, A$long)
ellipse <- ellipsoidhull(df)
point <- (28.5,-81.2)
distance <- spDistsN1(ellipse, point, longlat = FALSE)
|
I may have found an answer although not exact. I was missing the predict function so:
df <- cbind(A$lat, A$long)
ellipsePoints <- ellipsoidhull(df)
ellipse <- predict(ellipsePoints)
ellipse <- cbind(ellipse$longpts,ellipse$latpts)
point <- (longpt,latpt)
distance <- spDistsN1(ellipse, point, longlat = FALSE)
if anyone else has a more accurate way please let me know, thank you.
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 1,
"tags": "r, distance, point, ellipse"
}
|
.split from a file and putting it in an array
Im reading a file with some information and each part is separated with a @ however on each line i want it to be a different array so i did this and im not sure why its not working.
main_file = open("main_file.txt","r")
main_file_info=main_file.readlines()
test=[]
n=0
for line in main_file_info:
test[n]=line.split("@")
test=test[n][1:len(test)-1] # to get rid of empty strings at the start and the end
print(test)# see what comes out
main_file.close()
|
The way you are inserting the output of `line.split("@")` in your list is wrong. Your list is not initialized, hence, you can't simply assign anything to any element of the list. So, what you need to do is this :
test.append(line.split("@"))
Or, you can initialize your list as below :
test = [[]]*(len(main_file_info))
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 1,
"tags": "python"
}
|
Can I translate a stacktrace from minified code into a human readable stacktrace using sourcemaps?
I have some errors from minified code in production. I have sourcemaps not in production. I'd like to (after the fact) use source maps in a way to convert my stack trace into a human readable stack trace. Has anyone done this before?
|
I am also doing some research on the same, and come up with some reference. I am sharing those for you:
* <
* <
* <
|
stackexchange-stackoverflow
|
{
"answer_score": 8,
"question_score": 13,
"tags": "javascript, stack trace, source maps, minifiedjs"
}
|
How can I convert array to an object
I have an array with a single element that looks like this `[{…}]`
All I have to do simply to convert this to an object like this `{}`
|
Solution was `array.reduce((acc, x) => ({...acc,...x}))`
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "javascript, arrays, reactjs, javascript objects"
}
|
Directing non extension files to .php
I have a file with .php extention `www.example.com/thefile.php?name=123` that I want to direct the user to if the user visits any of the following aliases:
www.example.com/alias?name=123
www.example.com/unreal?name=123
www.example.com/fake?name=123
Is there a way I can get this done without using a framework that already uses this structure? I'm using pure php.
|
Yes you can, if you have mod_rewrite activated on your Apache Server, you can add a `.htaccess` file at the root of your website and have something like this into it (not 100% sure since I don't have Apache here at home) :
RewriteRule ^(alias|unreal|fake)$ thefile.php [QSA]
You can consult Apache mod_rewrite doc here
|
stackexchange-stackoverflow
|
{
"answer_score": 5,
"question_score": 3,
"tags": "php, url, mod rewrite, url rewriting, url routing"
}
|
Explain in SO FAQ concept of accepting answers
I see lots of folks on SO that ask tons of questions and never bother to even accept a single one.
I don't think they're all creeps--but I can't find any explanation in the SO FAQ where I could point them to, to explain how the concept of "accepting the answer" works.
This might be so self-evident to most of us--but to some, it seems quite foreign. Could the SO team add a section to the FAQ "How and why to accept answers?" and maybe even post a screenshot or two for those who claim they don't speak enough English to understand how to accept an answer? A picture is worth more than a 1'000 words--and it's true in _any_ language! :-)
**UPDATE** : it would be really nice to have a link to this post on the SO FAQ page at < People might read that page--I doubt they'll read anything else...
|
It's already in the official FAQ here: Accepting Answers, What is it all about?.
All the FAQs on all the sites point back to the FAQ tag on Meta in this regard.
There is very little that can be done about the drive by askers however, and the acceptance rate has slowly started to build awareness around the issue. Over time the more regular users are the more accepting of answers will happen.
|
stackexchange-meta
|
{
"answer_score": 4,
"question_score": 2,
"tags": "feature request, accepted answer, meta faq"
}
|
Switching Blogger Account to Custom Domain
I have a blogger account < I wish to host this at < How to switch? I have created a CNAME record in my DNS Management for blog.jus4frnds.com to ghs.google.com. What else should I do? Should I Import my blog and upload it on my hosting?
|
Moving the contents to new Platform is all your decision.If you want to customize the overall behavior of your blog which is not possible in Blog-spot than yes its good to move all content to the new platform.
But if you only want to change the domain name and not planning to do any major customization you can keep on using Blog-spot as you blogging platform and can use the new domain name.
I myself have done similar in which i have pointed my new domain to existing blog-spot platform but still i am using the blogger platform for writing new post and any other work,but as i am planning to move to WP so will move all the content to new platform to get more hold on overall look and feel of my Blog.
Choice is all your what you want with new platform
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": -2,
"tags": "hosting, blogger"
}
|
For an integrable function $f$, the measure of the set $\{x: |f(x)|=a \}$ is zero for all but countably many $a's$
Suppose $(\Omega, \mathcal{F}, \mu)$ is a probability space and $f$ is integrable function. Then, is it true that $\mu \\{ \omega: |f(w)|=\alpha\\}=0$ for all but countably many $\alpha$ ? \
|
It doesn't depend on integrability of $f$. Measurability suffices. Let $$ A_n = \\{ a\in [0,+\infty] : \mu(|f|=a)>1/n \\}$$ Then the cardinality of $A_n$ is at most $n$. And $\cup_{n\geq 1} A_n$ is the set of $a$'s for which $\mu(|f|=a)$ is strictly positive.
Remark: The result also holds for any $\sigma$-finite measure space.
|
stackexchange-math
|
{
"answer_score": 6,
"question_score": 4,
"tags": "measure theory"
}
|
"Switching users" in Lotus Notes
I am using a computer previously used by someone else. I logged in to Lotus Notes under my .nsf file, but I'm getting many errors. It seems Notes is trying to access the previous user's data still, in many different places. The Mail button on the home page tries to go to the previous user's inbox, and some settings are inaccessible.
What can I do to make a clean break from the previous user's settings?
|
Lotus Notes uses the concept of location documents to control some user settings such as the location of the mail file. The name of the current location document is shown in the lower right corner and is usually called something like Office, Network, Online etc. You can click the location name and then edit it.
In the location document you need to go to the Mail tab and change the location of the mail file to match the location of your mail file.
This most likely fixes most of your problems.
For reference: the following help document contains information on location documents: <
|
stackexchange-superuser
|
{
"answer_score": 4,
"question_score": 1,
"tags": "lotus notes"
}
|
How do the `DispatchResultWithPostInfo` and `Pays::No` actually work?
This makes me confused for a whole day.
* * *
First, please take a look at these: PolkadotApps, Subscan, Code.
From the code, we know this is a `Pays::No` call. Indeed, it doesn't cost any tx fee. But why the extrinsic detail shows:
{
weight: 2,347,339,000
class: Normal
paysFee: Yes
}
IIUC, it should be:
PostDispatchInfo {
actual_weight: None,
pays_fee: Pays::No,
}
* * *
And the second weird thing, please take a look at these: PolkadotApps, Subscan, Code.
From the code, we know this is also a `Pays::No` call. But why does it cost a lot of tx fees? I've grabbed the data and tested it on the mock file. I'm sure `is_mandatory_header` is `true`.
|
For the first question, I have an answer now.
Code:
/// Calculate how much weight was actually spent by the `Dispatchable`.
pub fn calc_actual_weight(&self, info: &DispatchInfo) -> Weight {
if let Some(actual_weight) = self.actual_weight {
actual_weight.min(info.weight)
} else {
info.weight
}
}
This is a `DispatchInfo` which was converted from `DispatchResultWithPostInfo`.
* * *
For the second question.
I found that the system will withdraw your balance then deposit it back.
So, it's free actually.
* * *
This answered my question. Because I'm on a quite old Substrate version.
If somebody comes from the future, also check @bkchr 's answer.
|
stackexchange-substrate
|
{
"answer_score": 0,
"question_score": 1,
"tags": "weight, fee"
}
|
How to re-serve the image instead of redirect when no query string parameters are sent
I am using the ImageReszier module with the AzureReader2 plugin.
Everything is working great, but I am trying to get one more requirement of mine working. I always need to re-serve the image from this website. I've found that ImageResizer will redirect to the Azure blog URL if there are no query string parameters found in the url string.
I would like to prevent this, and just re-serve the original image.
My main reason for this, is so I can support HTTPS with Azure blob storage for images that don't need to be resized.
Any config options to pull this off? Thanks!
|
There will be a config option for this in V4; for V3, you can 'hack' it by adding a placeholder query string value to any azure request during the `Config.Current.Pipeline.Rewrite` event. This will bypass the Redirect behavior.
Or, just add a meaningless querystring to all of your image URLs that don't need resizing.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "asp.net mvc, imageresizer"
}
|
Does this mean that $x = \sum_{i=1}^{\infty}{a_i}$?
This feels very basic, but I'm wondering if there is anything subtle here.
Assume $x, a_i, b_i\geq 0$. Let's say I can have that:
$$x = b_1$$ $$b_i = a_i + b_{i+1}$$
Then, I can definitely say that:
$$x = b_1 = a_1 + b_2 = a_1 + a_2 + b_3 = a_1 + a_2 +a_3 +b_4 = \cdots$$
However, can I then conclude that:
$$x = \sum_{i=1}^{\infty}{a_i}$$
This seems right to me, but wondering (a) if this is always true or is there something subtle I need to worry about; and (b) if so, how to prove this?
|
$(b_i)$ is a non-increasing sequence of positive numbers, so it tends to a limit $B$. Now what you _can_ say is $$x=B+\sum_{i=1}^\infty a_i$$
But there is no guarantee that $B$ is non-zero, as FOE's counterexample shows.
|
stackexchange-math
|
{
"answer_score": 3,
"question_score": 0,
"tags": "sequences and series"
}
|
Proof that graphs are not isomorphic
. But I've made a mistake, cause my exercise was about cospectral graphs, like above. $C_{4}+$vertex and $K_{1,4}$. I know that there is no way that they are isomorphic cause first has degrees $(2,2,2,2,0)$ second $(1,1,1,1,4)$, but what is my mathematical argument to conclude that these graphs are not isomorphic ?
|
A more formal justification would argue that the multiset of vertex degrees is a _graph invariant_ ; that is, a property of the graph that is the same for every graph isomorphic to it. Since these two graphs have different multisets of vertex degrees, they cannot be isomorphic.
We can see that the multiset of vertex degrees is a graph invariant because an isomorphism always maps a vertex of degree d to another vertex of degree d. That can be directly argued from the definition of isomorphism.
Note that degree _sequences_ of graphs are not an invariant, as the degree sequence may be permuted by an isomorphism.
|
stackexchange-math
|
{
"answer_score": 2,
"question_score": 1,
"tags": "graph theory, graph isomorphism"
}
|
Moving the cursor through long soft-wrapped lines in Vim
I'm sorry if my question isn't very clear. I'm not sure how to phrase it.
I'd like to use VIM to write papers for some classes I'm in. The problem I'm having is with the formatting of lines in the editor. If I don't explicitly break the end of a line with the enter key, when I try to move the cursor through the text, it skips multiple lines if I have a sentence that spans more than one line. Is there any way to make it so that the cursor will be able to move through the text akin to the way it does in most word processors?
|
Have you tried the following in vim command line:
:set nowrap
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 24,
"tags": "vim, text, formatting"
}
|
Imagefield Crop – use existing file
Is there a way to make a few images with Image Crop out of one uploaded file? Currently i have to upload the same, big pic to get new pics with various dimensions. Unfortunately the "Imagefield sources"-module doesn´t support Image Crop. Is there an alternative?
|
I don't understand your requirement very well. But if you want multiple versions of the same image it sounds like a use-case for imagcache ( < )
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": -2,
"tags": "drupal 6, drupal modules, crop, filefield, imagefield"
}
|
$\sqrt[3]{3} + \sqrt[3]{9}$ is algebraic over $\mathbb{Q}$
Show that $\alpha = \sqrt[3]{3} + \sqrt[3]{9}$ is algebraic over $\mathbb{Q}$ by presenting a polynomial $p$ from $\mathbb{Q}[X]$ with $p(\alpha)$. It _seems like_ $$\mathbb{Q}(\sqrt[3]{3} + \sqrt[3]{9}) = \\{a + b\sqrt[3]{3} + c\sqrt[3]{9},~a,b,c\in\mathbb{Q} \\},$$ but I'm stuck proving that it's closed under inverse. If that is true, then the minimal polynomial should be of 3rd degree. True or not, I can't find any such polynomial.
**Solution:** As @José Carlos Santos mentioned below: $$\alpha^3=12+9\sqrt[3]3+9\sqrt[3]9=12+9\alpha,$$ from which it follows $$(x - \sqrt[3]3-\sqrt[3]9)(x^2 + x(\sqrt[3]3+\sqrt[3]9) + (\sqrt[3]3+\sqrt[3]9)^2) - 9(x - \sqrt[3]3 - \sqrt[3]9)= x^3 - 12 - 9(\sqrt[3]3+\sqrt[3]9) -9x + 9(\sqrt[3]3+\sqrt[3]9) = x^3 - 9x - 12 = p(x);~~ p(\alpha) = 0.$$
|
Let's have $q=\sqrt[3]{3}\quad$ and $\quad\alpha=q+q^2$.
$$q+q^2+q^3=q(1+q+q^2)\iff3+\alpha=q(1+\alpha)$$
Now since $q^3=3$ then $\alpha$ is solution of $$(3+\alpha)^3=3(1+\alpha)^3\iff 12+9\alpha-\alpha^3=0$$
|
stackexchange-math
|
{
"answer_score": 4,
"question_score": 4,
"tags": "abstract algebra, minimal polynomials, algebraic numbers"
}
|
C++ random number between 2 numbers reset
The function below runs, but always returns the same numbers each time I run the program. Is there a way to generate random numbers that are different each time I run the program?
int getrand(int min,int max){
int rnum = rand()%(max-min)+min;
return rnum;
}
|
a simple solution to randomize once would be:
int getrand(int min, int max) {
static bool init = false;
if (!init) {
srand(time(NULL));
init = true;
}
return rand()%(max-min)+min;
}
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "c++, random, numbers"
}
|
Is this a capacitor in series with the power source?
I'm a complete newcomer here. I was looking at this small circuit and it looks like there is a capacitor connected in series with the power source. Is it possible that this is the case, or do capacitors always have to be connected in parallel with the power source?

In other words, every $y=n$ gives you two solutions for $z$.
|
stackexchange-math
|
{
"answer_score": 2,
"question_score": -1,
"tags": "diophantine equations"
}
|
Android: How to make scrollable table with frozen table headers?
I wonder how I could make a scrollable table with static table header ? (with different elements in cells like buttons, images, etc.)
I have already made some of this, but i dont know how to make columns in different tables match each other by width.
<TableLayout>
<TableRow>
Table headers...
</TableRow>
<ScrollView>
<TableLayout > <!-- Table content--></TableLayout >
</ScrollView>
</TableLayout>
Thanks !
|
You should ditch the TableLayout for a ListView or GridView Then use a RelativeLayout
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_parent"
android:laout_height="wrap_content"
android:alignParentTop="true"
android:id="@+id/buttons">
<!-- Your Buttons Here -->
</LinearLayout>
<GridView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="@id/buttons"/>
</RelativeLayout>
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "android"
}
|
Reverse Bernoulli Trial?
I'm struggling to figure out how to do what I think would be called a reverse Bernoulli trial, essentially:
> How many coin flips must I make to have a 75% change of getting three heads?
First of all, does this even make sense as a thing to try to work out? As for my attempts so far, I've tried expanding the binomial ${n \choose j}$, taking the log of the whole thing and using Stirling's approximation on the $ln(n!)$-like terms, but I get horribly tangled up and can't see a way round.
Does anyone have a method to do what I'm trying to? Does it have a name?
|
You could try to use the normal approximation of the binomial distribution, which states that the binomial distribution with parameters $n$ and $p$ converges to a normal distribution with mean $np$ and variance $np(1-p)$.
This approximation is "good" if $n$ is large, so either you ask for many heads, or a probability close to $1$.
Now let's say we can make this approximation: the number of tails is $N\sim\mathcal{N}(np,np(1-p))$. So \begin{align} P(N\geq 3)&=0.75\\\ &\iff P\left(\frac{N-np}{\sqrt{np(1-p)}}<\frac{3-np}{\sqrt{np(1-p)}}\right)=0.25\\\&\iff \frac{3-np}{\sqrt{np(1-p)}}=\Phi^{-1}(0.25)\end{align}
Where $\Phi$ is the cdf of the standard Gaussian distribution. Now you have to solve this in $n$.
|
stackexchange-math
|
{
"answer_score": 0,
"question_score": 1,
"tags": "probability"
}
|
How can I set an SObject field to null using Java API?
I have a third party service which updates custom object values in my service on Force.com platform using Java API and OAUTH2.
From some reason when I try to update the SObject field value to null, it ignores my request and keeps the old value. If I update it to a non-null value it does so successfully.
Here is the code:
SObject quizTemplateSObject = new SObject();
...
...
quizTemplateSObject.setField("skills__notifyList__c",null);
results = connection.update(new SObject[] { quizTemplateSObject });
Appreciate your thoughts.
|
Salesforce has a "fieldsToNull" array in its update API as described in the update documentation. Exactly how this is exposed depends on the tools used to generate the Java code from the WSDL but it is likely to be something like:
quizTemplateSObject.setFieldsToNull(
new String[] {"skills__notifyList__c"}
);
|
stackexchange-salesforce
|
{
"answer_score": 5,
"question_score": 2,
"tags": "api, force.com sites, java"
}
|
Apps Script Error. Cannot find method getRange(number,number,number)
I'm trying to run a function within a sheet. The data used for the calculations is from another sheet. I'm trying to open it by the sheet id and use sheet 1 to make the required calculations. I'm not able to get my range in sheet 1 though. Any help would be appreciated.
Below is my code:
var ss = SpreadsheetApp.openById("18UIbdc8Sw1zwc");
var sheet = ss.getSheets()[0];
var lastRow = sheet.getLastRow();
var lastCol= sheet.getLastColumn();
ss.setActiveSheet(sheet).getRange(1,30, lastRow).activate();
var data = sheet.getRange(1, 30, lastRow).getValues();
|
I am not entirely sure what you're trying to do in this line: `ss.setActiveSheet(sheet).getRange(1,30, lastRow).activate();`
You don't need to set a sheet as active in order to call `getRange` on it. You already set `sheet` to be specifically the first sheet in the document when you called `var sheet = ss.getSheets()[0];`. You should then be able to call `var data = sheet.getRange(1, 30, lastRow).getValues();` as you do in your last line, without that `setActiveSheet` line.
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": -1,
"tags": "google apps script, google sheets"
}
|
File download problem: filename with spaces truncated!
While I am working on code to download file from server using :
Response.AddHeader("Content-Disposition", "attachment; filename=" +
Server.UrlPathEncode(Path.GetFileName(_Filename)));
The problem is while having spaces in the file name, with this code the server split automatically while finding the first space!
I'm hoping to know Why & what is the solution for that?
|
I found the solution :)
We have to surround the filename with double quotation mark like :
Response.AddHeader("Content-Disposition", "attachment; filename=\"" + Path.GetFileName(_Filename) + "\"");
But up till now, I didn't have any idea for this split?
|
stackexchange-stackoverflow
|
{
"answer_score": 6,
"question_score": 17,
"tags": "asp.net, c# 4.0"
}
|
Insert data if previous column contains data
I'm trying to think of a way where I can have a Powershell script check an Excel or CSV file, read the last column and then insert a static data for each row that has data. For example this is the original file:
| Id | Price | Description |
|-----|---------|---------------------------------|
| 33 | 878.35 | C2 Flush Casement |
| 52 | 1111.69 | DS2-L101-T102_L |
| 71 | 875.75 | C2 Flush Casement |
I would like to add the Quote number (Which I can get from the file name):
| Id | Price | Description | Quote |
|----|---------|-------------------|-------|
| 33 | 878.35 | C2 Flush Casement | Q1234 |
| 52 | 1111.69 | DS2-L101-T102_L | Q1234 |
| 71 | 875.75 | C2 Flush Casement | Q1234 |
Any pointers would be appreciated.
|
You can use `Import-Csv` to read and parse the data, then create the new column with `Select-Object` and write to a new CSV file with `Export-Csv`:
Import-Csv path\to\file.csv |Select-Object *,@{Name='Quote';Expression={if($_.Description -ne ''){'Q1234'}}} |Export-Csv path\to\output.csv -NoTypeInformation
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 1,
"tags": "excel, powershell, csv"
}
|
Minimum number of cameras required to cover all nodes in graph
I came across a problem in leetcode named "Binary Tree Camera".
I was wondering how to approach this similar problem:-
You have to place cameras at nodes of a graph such that whole graph is covered. A camera on a node monitors all its immediate neighbour nodes and itself. Find the minimum number of cameras required to cover all nodes.
|
This is a set cover problem, which there are many well-known algorithms for. To model it as an instance of the set cover problem, map each node to the set of nodes which a camera at that node would cover. The original problem of choosing the fewest number of nodes is equivalent to choosing the fewest number of those sets.
In general, this is an "NP Hard" problem, meaning there is no known algorithm which always gives the minimum covering and also scales well to large instances of the problem. Since the problem asks for the minimum, a heuristic algorithm is not suitable, so you will need to do something like a backtracking search.
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 2,
"tags": "algorithm, graph, dynamic programming, graph theory, graph algorithm"
}
|
Как изменить ширину textarea и поставить на место кнопку?
На этой странице есть форма, в которой находиться textarea, в котором iframe.
Мне очень нужно сделать ширину textarea 80% и fontsize 125%. И у кнопки Submit внизу сделать верхний и нижний отступ по 25 пикселей.
Но у меня не получается.
Помогите, пожалуйста.
|
Вопрос слишком размыт, вряд ли у кого будет желание лезть и препарировать какой-то там код для расплывчатого вопроса.
Ширина - `width: 80%;`: зависит от предков.
Размер шрифта - `font-size: 125%;`: лучше использовать `em`.
Отступы - `margin: 25px 0;`: No comments.
|
stackexchange-ru_stackoverflow
|
{
"answer_score": 2,
"question_score": 1,
"tags": "jquery, css, javascript"
}
|
Is there a standard way to create a command history "effect" for "edit" fields in Windows?
Can I achieve the command history effect (i.e. up arrow = previous issued command, down arrow = next command - like in `cmd.exe`, for example) for `edit` fields (windows created with CreateWindow) in Win32 using a standard approach, or do I have to implement my own?
|
The Windows API does not have equivalent functionality. There is no style setting for an edit control that tells it to maintain history, and there's no standard control with such functionality that you can attach to an edit control.
I've also never seen a third party control that includes such functionality. Although it's possible that one does exist.
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 0,
"tags": "winapi"
}
|
My users are getting 302 Found page if they don't write https in address bar, how can I prevent this?
I host a forum website in DigitalOcean's cloud servers, using Ubuntu 16.04, Apache 2.4.20, PHP 7.0.8 and MySQL 5.7.12.
I tried to troubleshoot with cURL about what is the problem, these are the results:

 [R=301,L]
Currently your telling the browser " _There is a https version I want you to visit_ ". The `R=301` adds " _I want you to go there via a 301 reload_ ". It's the reload part you don't have in place currently.
The `L` stands for "Last", after this line it will not excecute the remainder of your htaccess, it will start the reload. After the reload this line is skipped.
|
stackexchange-webmasters
|
{
"answer_score": 1,
"question_score": 2,
"tags": "htaccess, redirects, html, url, apache"
}
|
Do I need to be experienced with html before building website using ASP.Net with Visual Studio?
I need to build not very complex website with MySQL database. I am experienced with SQL, .Net languages and a bit of html. I usually use drag and drop to build the website controls and interface.Do I need to learn html first?
|
If you are using ASP.NET WebForms you can still do alot of drag and drop for building your web pages but the more you know about HTML the easier it will be to get the results you want. With ASP.NET MVC it will be even more important to know HTML.
Honestly, if you know sql and a .Net language, then it's likely you can learn HTML pretty quickly. I'd encourage you to dive and and learn HTML but if you just need to get the project done quickly, you could consider using ASP.NET WebForms (which is an older technology) and it's drag and drop approach will generate alot of the HTML for you.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 1,
"tags": "html, asp.net, visual studio, drag and drop"
}
|
Randomly pair set of $2m$ elements, twice. Can original set always be reconstituted by selecting one element from each pair?
Given set of $2m$ elements, randomly group them into $m$ pairs. Create another $m$ pairs by once again randomly pairing elements from the set.
Example. Given m=3, $\\{1,2,3,4,5,6\\}$
Randomly pairing twice: $(1,3)$ $(2,4)$ $(5,6)$ and $(1,5)$ $(2,3)$ $(4,6)$
The original set can be reconstituted by selecting $1,2,6$ and $5,3,4$
There are $2^{2m}$ possible selections. Will at least one of these always reproduce the original set? Or alternately, does there exist a pairing regimen that makes reconstituting the original set impossible?
|
Yes, there will always be at least two such selections.
For simplicity remove any pairs that are identical in both pairings (each of which has itself 2 ways of selection to rebuild the original set). Then the remaining pairs can define the edges of a graph where every vertex is degree $2$ and the graph is bipartite, since all cycles are even due to the alteration of edges from each pairing. Then each such cycle can be selected from in two ways from the two pairings.
Example graphed out, red lines representing the first pairing selection $(1,3),(5,6),(7,2),(4,8)$ and blue lines the second pairing $(1,2),(5,3),(7,8),(4,6)$:

Thanks in advance (Sorry for bad english!).
|
You can use 3rd parameter of this function: _context_
$postdata = http_build_query(
array(
'var1' => 'some content',
'var2' => 'doh'
)
);
$opts = array(
'http' => array(
'method' => "POST",
'header' => "Connection: close\r\n".
"Content-Length: ".strlen($postdata)."\r\n",
'content' => $postdata
)
);
$context = stream_context_create($opts);
$result = file_get_contents(' false, $context);
// edit -little bug should be:
$opts = array(
'http' => array(
'method' => "POST",
'header' => "Connection: close\r\n".
"Content-type: application/x-www-form-urlencoded\r\n".
"Content-Length: ".strlen($postdata)."\r\n",
'content' => $postdata
)
);
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": -5,
"tags": "php"
}
|
Cubemap projection onto a sphere
I need to be able to generate texture coordinates on a sphere for cubemaps textures. But somehow I seem to fail in Blender to accomplish this.
See the image below as example cubemap.
, then add:
* Subdivision modifier with _" simple"_ algorithm (we don't want to smooth but just to give more geometry for the cast below)
* Cast to sphere modifier
 visible to users based on their SharePoint group memberships. One option is to run my site on it's own, determine group membership in code, and limit data available, and the other, less attractive option is to deploy my site to several departmental sites, and then determine which data to present according to the parent site that mine is hosted under.
In either case, I need to access some sort of SharePoint API to determine either the location of my site, or the group membership of the logged on user. How can I go about getting this information?
|
You could use a Web Part and programmatically security trim links in the WP. In any case, Groups are created at the site collection level and _assigned_ to a site. If you have a site located at mycompany/mydeptsite, you could use:
SPSite siteCollection = new SPSite("
SPWeb site = siteCollection.OpenWeb();
foreach(SPGroup group in site.Groups)
{
Console.WriteLine(group.Name);
}
Some more info: <
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "asp.net, windows, sharepoint"
}
|
What's the best way to start out with astrophotography on a tight budget?
I'm new to astronomy and I don't have a great deal of cash to spend. I currently have a 3" reflector telescope which I've had great fun with. I also have a Pentax DSLR which I've been using to take long exposure photos of various constellations (+ brighter deep sky objects such as the Orion nebula).
I've managed to take some surprisingly good photos of the moon and jupiter's moons combining my mobile phone with my telescope (which requires a very steady hand and alot of patience) but I'd really like a better way of taking photos. I'm wondering whether I should investigate getting an SLR mount to attach my Pentax to my scope, or whether to go for one of these webcam eyepeiece attachments. Any advice?
|
If you already have a DSLR then a T-mount is pretty cheap and will give you steadier photos. The first issue you may hit is that you can only do short exposures unless you have a motorized mount.
I use a lens mount adapter on my Pentax K-x to attach a 1.25" barlow ( and it works quit well for me.
But I also have a friend to does wonderful stuff using a Canon 20x zoom (non SLR) connected to a motorized mount.
One of the tricks to learn is image stacking. Registax (< for Windows does a very good job and is free. There are other apps for MacOS. This lets you combine multiple exposures to cancel out noise and to enhance your images.
|
stackexchange-physics
|
{
"answer_score": 4,
"question_score": 6,
"tags": "astronomy, telescopes"
}
|
List all .txt file and count number of column
How to list all the .txt files (pipe delimited file) and the number of columns of each file in a directory?
|
find . -name '*.txt' -type f -size +0 -exec awk -F '|' '
FNR == 1 {print FILENAME ": " NF; nextfile}' {} +
Would print something like
./dir/foo.txt: 2
for each regular non-empty file whose name ends in `.txt` where `"2"` is the number of `|`-separated fields in the first line of the file.
Note that `nextfile` is not available in all `awk` implementations, but in those where it's not, it should be harmless (just less efficient as `awk` would read the files fully).
If you wanted to consider only the files that have the same number of columns in all their non-empty lines, with GNU `awk`:
find . -name '*.txt' -type f -size +0 -exec awk -F '|' '
BEGINFILE {n = 0}
NF {
if (n && NF != n) {
print "skipping "FILENAME" ("NF" != "n")" > "/dev/stderr"
n = 0; nextfile
}
n = NF
}
ENDFILE {if (n) print FILENAME ": " n}' {} +
|
stackexchange-unix
|
{
"answer_score": 5,
"question_score": 3,
"tags": "awk"
}
|
MySQL update a row but a single field
I update a Table with multiple fields. Now one of the fields may only be updated if another field has a defined value, e.g.:
id | name | image | update
--------------------------------------------------
1 | john | myimage.jpg | 0
2 | ben | yourimage.gif | 1
--------------------------------------------------
Now i walk through all rows and update all fields but the image should only be update if the "update"-flag is set to 1. If its 0 the existing value should not be overwritten.
_Now i tried this:_
...
`image` = IF(update = 1, VALUES(`image`),`image`)
...
but its obviously not working because it overwrites the image in every case.
|
If you only want to update the image column Ofer's answer is surely the best. If you'd like to pack the image update into a bigger query, the `IF()` works as follows:
IF(expression, return this if expression true, return this if expression false)
in your case:
UPDATE table t1
SET
t1.image = IF(t1.update = 1, t1.image, 'new image')
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 2,
"tags": "mysql, sql, cakephp"
}
|
How secure my server is... Should I worry?
I updated my server yesterday to a new version of CentoOS including a new version of DirectAdmin panel. This new installation comes with Brute Force Monitor service.
As far as I see, this BFM protects brute force tries. In just 24h of this new server, I see that my 5 sites had 10,000 brute force tries. Basically I see creatures from mud, scum, trying to use my mail server (dovecot) to send emails and also attacks to gain access through ssh. Apparently these attacks are failing.
My questions are:
1. Are these attacks really failing?
2. What kind of protection is given by this BFM service? I ask this because I see some entries on BFM log reporting 4265 tries of the same IP? How is this allowed, isn't reasonable for BFM to ban that IP after 3 or 5 wrong tries?
3. Should I be worried?
|
BFM only blocks addresses which try to brute force DirectAdmin itself; for other services it only notifies you.
If you want something which will actually block addresses which attempt to brute force other services, try fail2ban.
|
stackexchange-unix
|
{
"answer_score": 4,
"question_score": 3,
"tags": "ssh"
}
|
array.splice() function explanation
I'm fairly new with jQuery and I'm not sure what this splice function does.
Does it check that "My_adress" exists in the profilingArray and then removes it?, Or does it add it at position 1?
profilingArray.splice(jQuery.inArray('My_adress',profilingArray),1);
Ty very much
|
You're not using a jQuery function but the standard javascript splice function.
`splice` is a convenient function used to add or remove items in arrays.
Here you're just removing one (`1`) item from the position of `'My_adress'` in `profilingArray`. So you're removing `'My_adress'` from the array.
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 0,
"tags": "javascript, jquery"
}
|
The Lagrangian of a Rocket
I am trying to understand how to write the Lagrangian of a system which consists of a rocket losing gas mass in a rate of $\frac{dm}{dt}$, the gas moving in a velocity of $u_0$ in the rocket's view? Gravity can be neglected.
I wrote it as the kinetic energy of the gas, in the rocket's system. But I guess it isn't complete. What is the potential energy in this problem?
In this blog he seems to try and take care of this problem, but the equations there seem to have nothing to do with the subject...
|
Normally, the Lagrangian (in Cartesian coordinates) for an object of mass $m$ in a potential $V$ would be $$L=T-V\to\frac{1}{2}m(\dot{x}^2+\dot{y}^2+\dot{z}^2)-V(x,y,z)\tag{1}$$ It then follows that for a coordinates $q$, $$\frac{\mathrm{d}}{\mathrm{d}t}\left(\frac{\partial L}{\partial\dot{q}}\right)=\frac{\partial L}{\partial q}\to\frac{\mathrm{d}}{\mathrm{d}t}\left(m\dot{q}\right)=-\frac{\partial V}{\partial q}\to \ddot{q}=-\frac{1}{m}\frac{\partial V}{\partial q}\tag{2}$$ For a free particle, $V=0$ and $\frac{\partial V}{\partial q}=0$, and so $\ddot{q}=0$.
However, we have to account for the fact that the propulsion comes from a force that is _not_ derived from an external potential. Just like friction, we have to treat this separately by adding an additional term to the right-hand side: $$\frac{\mathrm{d}}{\mathrm{d}t}\left(\frac{\partial L}{\partial\dot{q}}\right)=-\frac{\partial V}{\partial q}-F_q$$ These are called the Euler-Lagrange equations of the first kind.
|
stackexchange-physics
|
{
"answer_score": 1,
"question_score": 4,
"tags": "newtonian mechanics, lagrangian formalism, rocket science"
}
|
Arba'a Veshiv'im - mi yodeya?
## Who knows seventy-four?
_Please cite/link your sources, if possible. At some point in the next few days, I will:_
* _Upvote all interesting answers._
* _Accept the best answer._
* _Go on to the next number._
|
74 are the mitzvos in Parshas Ki Teitzei, highest number in any single Torah portion.
|
stackexchange-judaism
|
{
"answer_score": 4,
"question_score": 2,
"tags": "mi yodeya series, number"
}
|
iphone push notification provider limit
I want to install same push notification certificate in multiple servers. I wonder Is there any limitation for provider(server) count with same certificate?
For example, We have 10 clients who bought our web application server. The server has function that works as push notification provider for iphone users. There is iphone application on App Store that works client of web application. All servers uses same iphone application and same push notification certificate.
|
You can install the certificate on multiple servers, there's no limitation as far as I know. The only recommendation is that you keep the connection with the Apple server open for as long as possible, and that you refrain to send notifications to devices where your application has been uninstalled. For this, you have to query Apple's feedback service.
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "iphone, ios, push notification, apple push notifications"
}
|
Regular expression to match version numbers
I need a regular expression that is matching below criteria
For example : below should be matched
1
1134
1.1
1.4.5.6
Those below should not match:
.1
1.
1..6
|
You can use
^\d+(\.\d+)*$
See demo
* `^` \- beginning of string
* `\d+` \- 1 or more digits
* `(\.\d+)*` \- a group matching 0 or more sequences of `.` \+ 1 or more digits
* `$` \- end of string.
You can use a non-capturing group, too: `^\d+(?:\.\d+)*$`, but it is not so necessary here.
|
stackexchange-stackoverflow
|
{
"answer_score": 5,
"question_score": 1,
"tags": "asp.net, regex"
}
|
How to Call a stored procedure from another stored procedure?
I have an insert stored procedure which takes many parameters - 2 of them are @FirstName, @LastName. I also have an update stored procedure which takes many parameters - 2 of them are @FirstName, @LastName.
What I want to do is, from inside the insert SP, when it's done, call the update SP and send to it the @FirstName, @LastName.
I don't know the right syntax to do that; I tried:
exec LandData_Update @FirstName, @LastName
But I think it's wrong.
Can someone tell me how to write this calling?
And if I will call the update sp with different param names? Such as @MyFirstName, @MyLastName? Would I write it like this: `EXECUTE LandData_Update @MyFirstName=@FirstName, @MyLastName=@LastName`?
|
What makes you think it's wrong?
CREATE PROCEDURE MyInsertSP
@FirstName varchar(255),
@LastName varchar(255)
AS
BEGIN
INSERT INTO Table VALUES('Some Value')
EXECUTE LandData_Update @FirstName, @LastName
END
Do you get an error or something?
**EDIT:** It doesn't matter what the name of the variables are, but to do what you want you can declare two new variables.
DECLARE @MyFirstName varchar(255)
DECLARE @MyLastName varchar(255)
SET @MyFirstName = @FirstName
SET @MyLastName = @LastName
And then use the new variables. But again, the Store Procedure doesn't care what the variables are called.
|
stackexchange-stackoverflow
|
{
"answer_score": 16,
"question_score": 11,
"tags": "sql, sql server 2005, stored procedures"
}
|
uninstall cmake in Ubuntu 18.04
I need to uninstall cmake from my Ubuntu machine. I tried via command line as I saw in How can I uninstall software in Ubuntu?
sudo apt-get remove cmake
sudo apt-get purge cmake
sudo apt remove cmake
But it didn't worked, the cmake is still exist in `~/.local/bin` dir and when I check the version how to check whether CMake is installed in ubuntu?
cmake --version
I get the cmake version . How can I uninstall and remove cmake?
|
It is absolutely normal that `~/.local/bin` folder is not maintained by APT.
Remove the file with:
rm -rf ~/.local/bin/cmake
and retry running `which cmake` or `cmake --version` to confirm its removal.
|
stackexchange-askubuntu
|
{
"answer_score": 4,
"question_score": 4,
"tags": "uninstall, cmake"
}
|
Safari messes the design when zooming in/out
I have sliced a design (see the first psd here) for my practice, and it works fine. But when I zoom-in in Safari the whole design gets messed up. I have fixed sizes of central rectangle which contains all elements of the site which remains the same after zooming in and text becomes bigger. (I think the original design dictates the rectangle to have fixed dimensions!)
The question is this, how can I make the text zoom in in Safari without messing the design, and how professional it is if you have this type of problem? Should this problem be necessarily solved?
Thanks!
|
I should use em units as em unit changes when the font is changed. Em is associated with the font size so it solves the problem.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 1,
"tags": "html, css, safari, zooming, slice"
}
|
If $f$ is a function of moderate decrease then $\delta \int f(\delta x) dx = \int f(x) dx$
A function of moderate decrease is a map from $\mathbb{R}$ into $\mathbb{C}$ such that there exists $A \in \mathbb{R}$ such that $\forall x\in \mathbb{R}, \ |f(x)| \lt \frac{A}{1 + |x|^{1+\epsilon}}$. Let $\epsilon$ be fixed, then such functions form a vector space over $\mathbb{C}$ called $\mathcal{M}_{\epsilon}(\mathbb{R})$. Improper integrals are well-defined for such functions. I want to prove the property called "Scaling under dilations":
For any $\delta \gt 0$, $$ \delta \int_{-\infty}^{\infty} f(\delta x) dx = \int_{-\infty}^{\infty}f(x) dx $$
My problem is showing that $f(\delta$x) is in $\mathcal{M}_{\epsilon}(\mathbb{R})$. Or do we have to? I.e. could we just show that the improper integral on the left is valid?
|
You don't have to show that $x \mapsto f(\delta x)$ belongs to $\mathcal{M}_\varepsilon(\mathbb{R})$, but it's not hard. If $\lvert \delta\rvert \geqslant 1$, then
$$\lvert f(\delta x)\rvert \leqslant \frac{A}{1 + \lvert \delta x\rvert^{1+\varepsilon}} \leqslant \frac{A}{1+\lvert x\rvert^{1+\varepsilon}},$$
and if $0 < \lvert \delta\rvert < 1$, then
$$\lvert f(\delta x)\rvert \leqslant \frac{A}{1 + \lvert \delta x\rvert^{1+\varepsilon}} \leqslant \frac{A}{\lvert\delta\rvert^{1+\varepsilon}+\lvert \delta x\rvert^{1+\varepsilon}} = \frac{A\cdot \lvert \delta\rvert^{-(1+\varepsilon)}}{1 + \lvert x\rvert^{1+\varepsilon}},$$
so in either case, $x \mapsto f(\delta x)$ belongs to $\mathcal{M}_\varepsilon(\mathbb{R})$.
|
stackexchange-math
|
{
"answer_score": 2,
"question_score": 3,
"tags": "calculus, fourier analysis"
}
|
How can I launch an independent activity to my application as well as the application of phone launches the activity to make calls?
I'm working on an application and I need to make it possible to launch an activity in a separate history and stack as you can see in the photo that the application of the telephone starts the activity to make calls that works independently and even this can be observed when I want See recent apps.
):
if((df.iloc[i][5]=='District Steam') & (df.iloc[i][1]!='Baltimore')):
df.drop(df.iloc[i])
Whenever the 5. value is District Steam, I only want to keep the rows in which the city is Baltimore It provides the following error:
KeyError: "['Office' 'Miami' 'District Steam'] not found in axis"
|
I think you want:
df = df.loc[df.iloc[:, 5].ne('District Steam') | df.iloc[:, 1].eq('Baltimore')]
In other case please show an example and your expected output
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "python, pandas"
}
|
Which IP is used by Virtual Box for Internet Communication (if I'm running a VM)?
short question: Which IP is used by Virtual Box for Internet Communication if running a VM ? Is it the IP - Address generated by the VM I use, or is the query (communication task) done with the IP of the Computer that runs Virtual Box ?
regards RNNUSr11
|
> Which IP is used by Virtual Box for Internet Communication (if I'm running a VM)?
It depends on whether the VM connection is NAT (Default) or Bridged (not Default).
Let us say your Host is 192.168.1.101 which is from the router.
Then if Bridged, the VM will be (say) 192.168.1.103 or like, which is also from the router.
If NAT (Default), the VM will be (say) 192.168.77.100 or like.
Notice the NAT Subnet is 77 and Bridged uses the Router Subnet which is 1 . Very different. NAT comes from the VBOX internal DHCP server.
I trust this helps.
|
stackexchange-superuser
|
{
"answer_score": 0,
"question_score": 0,
"tags": "virtualbox, virtual machine, internet connection"
}
|
How can I skip the Nth element in a Rust iterator?
Iterators have a `skip` method that skips the first `n` elements:
let list = vec![1, 2, 3];
let iterator = list.iter();
let skip_iter = iterator.skip(2); //skip the first 2 elements
I could not find a method to skip only the `n`-th element in the iterator. Do I need to implement something on my own or is there a method somewhere I haven't found?
|
That seems to be a very specific operation. There is no adaptor for that in the standard library or the `itertools` crate.
It's easy to implement nonetheless. One could enumerate each element and filter on the index:
iter.enumerate().filter(|&(i, _)| i != n).map(|(_, v)| v)
Playground
|
stackexchange-stackoverflow
|
{
"answer_score": 20,
"question_score": 16,
"tags": "iterator, rust, skip"
}
|
RStudio doesn't work
Why RStudio doesn't work after successful installation. When I'm opening RStudio (the up to data version V98.501) I see only a white desktop, the menu fields are completely paralized:!enter image description here
The only option is either Reload or Inspect. How Can I fix this problem? It occurd when I was trying to switch from R 2.15 to R 3.0.2, getting Tools --> General Options-- > Choose R Version. I tried to remove all and install again, it doesn't help at all.
|
On Windows, you can force RStudio to bind to a specific version of R by pressing and holding **Ctrl** when starting RStudio.
|
stackexchange-stackoverflow
|
{
"answer_score": 4,
"question_score": 4,
"tags": "r, rstudio"
}
|
Which cable for 230.4 Kbps RS-232
I have to communicate between a sensor module and micro-controller board. The sensor module uses UART at 230400 bps. I have used a MAX3227 on sensor module as well as micro-controller board. So, the signal levels will be +5V and -5V. The distance between the two circuits will be 3 meters.
The baud rate and distance are fixed and cannot be changed.
I am confused about what cable should I use. I read that twisted pair for Rx-Tx will cause crosstalk. Please suggest me what cable I should select. Thanks!
|
It's likely working with RS-232, but you need to take a bit of care.
* I'd use a shielded cable, standard network cable Cat. 5e or better will do. You can use one pair for RX and one pair for TX. The second wire of each pair can be tied to ground. Using just two wires to transmit the data will very likely not work.
* 230 kBaud should be possible using the driver you mentioned. It is specified up to 1 MBaud at a line capacity of 1 nF. Your 3m cable will be much lower.
* I would add a low-pass filter close to the driver to reduce the slope of the signal and reduce cross-talk and reflections. As every bit has a length of about 5µs, you need an RC-time of less than 1µs, e.g. 1 kOhm in series followed by 100 pF to ground. A termination resistor at the far end might help as well, e.g. 5 kOhm to ground. You might have to play a bit with these values and check the signal quality.
|
stackexchange-electronics
|
{
"answer_score": 3,
"question_score": 0,
"tags": "uart, communication, cables, rs232"
}
|
Using NetworkCallback instead of NetworkInfo
In deprecated class NetworkInfo there were methods `isConnected()` and `isConnectedOrConnecting()`. But in the class that we are recommended to use instead of deprecated NetworkInfo class we have only `onAvailable(Network network)`. As I understood we can use `onAvailable(Network network)` instead of deprecated `isConnected()` method, but what should we use instead of `isConnectedOrConnecting()`? Is there any alternative or maybe shouldn't we use it at all?
|
Looks like there are no alternative of `isConnectedOrConnecting()` method in new api and there are no "connecting" state at all.
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "java, android, networking, deprecated"
}
|
localhost remove HTML extension
I've been trying to clean up my urls with htaccess but I can't seen to get it to work on my localhost.
My website url: localhost/index.html
This is the default htaccess file that's in my www folder.
#------------------------------------------------------------------------------
# To allow execution of cgi scripts in this directory uncomment next two lines.
#------------------------------------------------------------------------------
AddType application/x-httpd-php .html .htm .php
AddHandler cgi-script .pl .cgi
Options +ExecCGI +FollowSymLinks
|
Add this to your `.htaccess` in your web root `/www` directory
Options +ExecCGI +FollowSymLinks -MultiViews
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^(.*)$ /$1.html [L]
Now ` can also be accessed as `
* * *
Note, that I had missed adding `RewriteCond %{REQUEST_FILENAME} !-d` before. This condition makes sure that any existing directory named `/page` doesn't get over-shadowed by `page.html`.
|
stackexchange-stackoverflow
|
{
"answer_score": 3,
"question_score": -2,
"tags": "html, .htaccess, localhost"
}
|
Determine if $x_n$ converges or diverges
Let $(x_n)_{n\geq 1} \subset \mathbb{R}$ such that $x_1>0$ and $$x_{n+1}=\frac{1}{2}(x_n+\sqrt{x_n^2+a_n}), \quad \forall n \geq 1$$ Determine if $x_n$ converges or diverges when
a) $a_n=\frac{1}{\sqrt{n}}$
b) $a_n=\frac{b_n^2}{(1+b_1^2+b_2^2+\dots+b_n^2)^2}$, where $(b_n)_{n \geq 1} \subset \mathbb{R}$
It is quite easy to see that $x_n>0, \forall n\geq 1$ and $(x_n)$ is strictly increasing. I didn't succeed in finding a bound for a) and I think that $(x_n)$ diverges, but couldn't prove it.
|
Note that
$$x_{n+1} - x_n = \frac{1}{2}\bigl(\sqrt{x_n^2 + a_n} - x_n\bigr) = \frac{a_n}{2(\sqrt{x_n^2+a_n} + x_n)}.$$
Hence, if $(a_n)$ is a bounded positive sequence, $(x_n)$ converges if and only if
$$\sum_{n = 1}^{\infty} a_n < +\infty.$$
|
stackexchange-math
|
{
"answer_score": 3,
"question_score": 1,
"tags": "real analysis, sequences and series, limits, convergence divergence"
}
|
Query execution failed for dataset. Server: The operation has been cancelled
An error has occurred during local report processing.
An error has occured during report processing.
Query execution failed for dataset 'DataSet_XXXXX'
Server: The operation has been cancelled.
What the William H Gates is going on here?
I am trying to preview a report, that uses datasets which connect to ssas cubes, in the report designer.
I'm using SSRS2008 on xpsp3
|
I changed the query to use a different dimension containing the same data and it works.
The number of dimensions used in the query was reduced from 3 to 2.
I guess by touching the other dimension it was creating a large dataset which in turn caused the error.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 1,
"tags": "reporting services, ssas, ssrs 2008, cube"
}
|
Understanding the definition of endless sets
In a course on theoretical computer science we have to prove if sets are endless. I have two problems with the exercise:
* I don't understand exactly, what an endless set is (I find it very hard to understand, maybe because of the "endless")
* I don't know, how I can prove that the given sets are endless
The definition given is this:
> A set $X$ is called endless set, if there is a endless family of sets $\\{X_n\\}_{n=0}^{\infty}$ with $... \in X_3 \in X_2 \in X_1 \in X_0 \in X$.
Can someone explain in simple words what an endless set is?
|
Defining endless sets, you probably assume that you don't have the Axiom of regularity.
A set is endless when it doesn't contain only simple elements, it has to contain an other set among his elements, and this other set has again to contain an other set and this third set has to contain an other set, etc..
For example, a set verifying $M = \\{M\\}$ is endless because it contains an other set ($M$) which contains an other set (still $M$) which contains an other set ($M$), etc.. You can take $X=X_0= X_1= ... = M$ as infinite family.
A counter example is $M = \\{42\\}$; $M$ doesn't contain any set. $M= \\{42, \\{12\\}\\}$ is also a counter example because $M$ contains a set ($\\{12\\}$) but this set doesn't contain any set.
|
stackexchange-cs
|
{
"answer_score": 1,
"question_score": 0,
"tags": "terminology, sets"
}
|
How does Tony Stark know Spider-Man's web shooter formula?
In _Spider-Man: Homecoming_ ,
> Tony Stark gives Peter Parker a highly upgraded Spider-Man suit, including many new web shooting protocols.
**How did Tony know the formula for making the webs?** I thought that the formula was a secret that Peter's father had hidden from OsCorp at the cost of his own life.
Is Stark doing anything else with the web formula?
I know that back stories get rewritten often, but this seems to conflict with long-standing explanations. What is the new back story?
|
> TONY: You know what I think is really cool? This webbing. **Tensile strength is off the charts**. Who manufactured that?
>
> PETER: I did.
>
> _Captain America: Civil War_
Tony already knew the tensile strength of the webbing before he even visited Peter in Queens for the first time, and of course he already knew that Peter was Spider-Man, so he must have already gotten his hands on a sample of it. And this is Tony, he'd have scanned every molecule of the stuff so that he could replicate it and test with it. How he got this sample? We don't know, because it happens off-screen.
We can estimate _when_ he got it, however. We already know that he must have obtained it prior to the events of _Captain America: Civil War_ and, given how long it would have taken to try out all those different web shooter variants, probably at least several months prior.
|
stackexchange-scifi
|
{
"answer_score": 10,
"question_score": 13,
"tags": "marvel, marvel cinematic universe, spider man, spider man homecoming"
}
|
How do I create a knob like on my amplifier
On my amp, I have a big round knob, that I can turn forever in both directions, to control volume. It simply turns up whenever I turn clockwise and down when I turn counter clockwise. There is no limit as to how far I can keep turning it.
How do I create this in my own project? I have an arduino where I want a knob like this, to control a value in the arduino memory. Simply, turning up, add to value, turning down, subtract from value.
I assume I need some kind of potentiometer, but they do not turn forever, do they?
|
What you need in a rotary encoder, they have two outputs that generate pulses which are then decoded to read the direction of rotation.
!Rotary mechanical encoder !Rotary mechanical encoder waveform
Refer to <
To control the volume you can use Arduino to drive a volume control chip like PGA2311.
There are even 4 channel versions like PGA4311
You can also control digital potentiometers like MCP41xxx/42xxx
|
stackexchange-electronics
|
{
"answer_score": 10,
"question_score": 6,
"tags": "potentiometer"
}
|
Adding items in a loop on Python
So what I'm trying to do is make a code that adds the value of the letters in a name e.g. name: ABCD ---> 1 + 2+ 3+ 4= 10
My code so far is:
def main():
name = input("Please enter your name (all lowercase): ")
print("\nHere is the code: ")
for ch in name:
print(ord(ch)-96,end=" ")
What I want to do is add all the values of the `(ord(ch)-96,end=" ")`
|
You could do this:
sum(ord(c) - 96 for c in name)
* * *
**Relevant documentation**
* `sum`
* `ord`
|
stackexchange-stackoverflow
|
{
"answer_score": 3,
"question_score": 2,
"tags": "python, loops, encoding"
}
|
Linux- Convert 2 disk raid1 to raid0
I have a linux server (3.19.0) which has raid setup with md (v3.2.5). `/` is a raid1 device with 2 disks. There was a mistake when installing this machine, instead we need those 2 disks to be in raid0 configuration. Is there an easy way to change the md device like this?
I can maybe figure out how to make this happen by jugglying disks around, (and reinstalling is an option), but is there an easy way to turn a raid1 into a raid0?
In theory this feels possible to me. Is it possible for md to act like one of the disks is empty, and change the raid type from 1 to 0?
|
`mdadm`(8) sez:
> The GROW mode is used for changing the size or shape of an active array. [...] Currently the supported changes include
>
> [...]
>
> * convert between RAID1 and RAID5, between RAID5 and RAID6, between RAID0, RAID4, and RAID5, and between RAID0 and RAID10 (in the near-2 mode).
>
So, going from RAID1 to RAID0 doesn't appear to be possible. If you had a third disk, you could perhaps go from RAID1 to RAID5 to RAID0, but that seems like a rather roundabout way to do it.
The manpage does, however, say that you can "increase or decrease the "raid-devices" attribute of RAID0, RAID1, RAID4, RAID5, and RAID6", so you could break the RAID1, turn one of the disks into a new one-disk RAID0 array, copy the data across, then nuke the other half of the RAID1 and add that now available disk into the RAID0.
Finally, you can do it the right way, and just backup the data, reconfigure the RAID array offline, and then restore the backup onto the new array.
|
stackexchange-serverfault
|
{
"answer_score": 2,
"question_score": 2,
"tags": "linux, raid, mdadm, raid1, raid0"
}
|
What does this particular symbol mean/stand for?
!EL Pic Sometimes my heroes show me this symbol, but I don't know what it actually means. What does this symbol stand for?
|
That symbol indicates the siege strength of a fleet. When you see that message, it's saying that the siege strength of the fleet has been increased by 50%.
|
stackexchange-gaming
|
{
"answer_score": 5,
"question_score": 4,
"tags": "endless space"
}
|
If I'm not using a GUI program, how do I know how much traffic has gone through my tor relay?
If I'm not using a GUI program, how do I know how much traffic has gone through my tor relay? I'm on Linux, and run tor as a system service.
|
Using arm you can monitor traffic information. Install this program and simply run it in terminal without any command line options, and you'll see realtime traffic in a TUI interface:
];
[logoView setBackgroundImage:[UIImage imageNamed:@"logo.png"] forState:UIControlStateNormal];
[logoView setUserInteractionEnabled:NO];
self.navigationItem.titleView = logoView;
image which i can see on my Device is getting blur or it is getting streched.
I made image with Resolution of `180*40`(Width*Height)
I want to know the exact size of Image. what, it would be ?
**Thanks in advance.**
|
use this
UIImageView *navigationImage=[[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 98, 34)];
navigationImage.image=[UIImage imageNamed:@"topNav-logo.png"];
UIImageView *workaroundImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 98, 34)];
[workaroundImageView addSubview:navigationImage];
self.navigationItem.titleView=workaroundImageView;
hope this helps.
|
stackexchange-stackoverflow
|
{
"answer_score": 22,
"question_score": 8,
"tags": "iphone, ios, uiimageview, uinavigationbar"
}
|
Is there any code assist editor?
How can I use code assist with d3 library? aptana or anything, I try to that with Aptana,but it was not available.
|
For code assist in Aptana 3:
1. Choose Window in the main menu Go to Preferences
2. Choose Aptana Studio → Content Assist
3. Look at the Auto-display content assist
4. You will see a drop down menu
5. Click drop-down menu and select Default delay.
This will give you content assist.
In Aptana 2:
To get the code assist working just change the default editor for .js files from JavaScript editor to Aptana JS editor (Go to Preferences->General->Editors->File Associations, then select *.js in the top list. Aptana JS Editor in the bottom list, click the "Default" button).
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 2,
"tags": "d3.js"
}
|
I don't understand the dual syntax of event delegate
In answer to my other question How to send custom event message just after control instantiation? I read this:
if (ValueChanged != null)
{
ValueChanged(sender, e);
}
What is ValueChanged in the first case ? Not a function as in the second instruction ? How can the same symbol be used for both ... and function ?
uPDATE after james's answer: if ValueChanged is an Object, How can I call it as if it were a Method? Is it a syntactic sugar or alien syntax with some mysterious mechanism behind like calling ValueChanged.Invoke(sender, e); ?
|
ValueChanged is a multi-cast delegate, which is an object. If no one has subscribed to the event, it can be null, hence the check. If you want to avoid the check, you can define an empty delegate and assign it to the event.
public event EventHandler ValueChanged = delegate {};
You can now just call ValueChanged(sender, e) because ValueChanged can never be null.
|
stackexchange-stackoverflow
|
{
"answer_score": 3,
"question_score": 2,
"tags": "c#"
}
|
Open a specific url by typing a single letter in the address bar in Google Chrome
I'd like to open a specific URL by typing a single letter in the address bar of google chrome. Before, when I typed the letter "g", google wrote automatically the URL. Now I deleted the cache, so google forgot the memory.
I tried to open many times the following URL (google books in which I set specific parameters: book, from 1980 to today, view and preview), but google is not able to memorize it. Is there a way to do it?
|
Follow the steps below:
1. Open Settings -> Search engines -> Manage search engines and site search -> Site Search, click `Add`.
2. Enter the Search engine name (even of the site is not a search engine). Enter the shortcut, then the site's URL. Click `Save`.
3. On the address bar, type the shortcut created on the previous step, press `Enter`. The URL entered on step 2 will open.
only operations on a specific data structure but occasionally you were updating the data structure. How could you synchronize accesses to that data structure to avoid race conditions and still mostly access the data structure in parallel. please i need your help
|
pthreads read-write locks were designed for this use case.
Read-write locks are declared using the `pthread_rwlock_t` type, and initialised either with the static initializer `PTHREAD_RWLOCK_INITIALIZER` or dynamically using `pthread_rwlock_init()`.
The read-only users of your data structure take a read lock with `pthread_rwlock_rdlock()` \- an unlimited number of read locks can be held concurrently, so multiple readers can access the data structure simultaneously. The updating users of your data structure take a write lock with `pthread_rwlock_wrlock()`. A write lock is exclusive - no other threads can have the read-write locked (either for reading or writing) while a write lock is held.
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "multithreading, synchronization, thread safety, pthreads"
}
|
Multiple clients on Azure Service Bus, receiving individual messages
How do I fetch individual messages to multiple clients, from the Azure Service Bus relay, without having to have a namespace for each client?
Background:
I have a web service, which has multiple users, which are businesses. Not a huge number, but a few hundred. The users are mostly on NATs and behind firewalls, so I created a Windows Service to be installed on the users local machine, and that service listens to a Azure Service Bus Relay Service.
How can I deliver individual messages to these users/clients via the service bus relay? Do I have to create a new namespace on the service bus for each user? Or is there something smarter than that I can do?
Thanks!
|
This was answered well over at the Windows Azure forum on MSDN:
<
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 2,
"tags": "c#, .net, azure, azure servicebusrelay"
}
|
A new PSE member with square reputation
(For those viewing this, this is asked from the time when upvotes on question leads to +5 rep.)
A new Puzzling Stack Exchange member (reputation = 1) asked a good question.
He got a square number upvotes, and a square number downvotes.
(more Upvotes than Downvotes)
So, His reputation is a square number below 500.
Then he answered a question, and got good responses.
Again, he got a square number upvotes, and a square number downvotes.
(more Upvotes than Downvotes)
Again, his reputation now is a square number, but still not more than 500.
How many upvote and downvote he get after asking?
Then, How many upvote and downvote he get after answering?
**Bonus Question** : How if he answer first before asking?
|
In the beginning, when he asks he gets
> 64 upvotes and 16 downvotes ending up with 289 rep = 17$^2$ rep
and then after he answers the question, he gets
> 16 upvotes and 4 downvotes ending up with 441 rep = 21$^2$ rep
so we are done!! :)
* * *
_For the Bonus:_
After answering he gets
> 49 upvotes and 25 downvotes ending up with 441 rep = 21$^2$ rep
and then after asking he gets
> 9 upvotes and 1 downvote ending up with 484 rep = 22$^2$ rep
* * *
**EDIT: HOW I FIGURED IT OUT**
> The riddle never said anything about having to use pencil and paper so I made an assumption and assumed that both numbers were less than 200. Then I wrote a short C++ program and tested all possibilities, ending up with both my answers. Total time taken: 4 min and 30 sec.
|
stackexchange-puzzling
|
{
"answer_score": 11,
"question_score": 13,
"tags": "mathematics"
}
|
conditionally close insert </tr><tr> in Vuejs
I have a Component in Vue
I need to add list of 6 items to the table 2x3.
Is there any way to conditionally add "" after every second insert?
<template>
<tr>
<td>asdasd</td><td>qweqwe</td>
<!-- here i would like to insert </tr><tr> after every second add
v-if="post.tag%2"? -->
</tr>
|
You could do something like this:
<table>
<tr v-for="i in fruits.length/2"> <!--- create a row for every second item -->
<td>
Fruit: {{fruits[i*2]}}
</td>
<td v-if="i*2+1 < fruits.length"> <!--- check if there is another item left to display -->
Fruit: {{fruits[i*2+1]}}
</td>
</tr>
</table>
It's not very elegant, but it does the job! I made a Codepen here.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "vue.js"
}
|
Two enum with same value, how to access them?
class Card
{
public:
enum class Rank{ TWO = 2, THREE = 3, FOUR = 4, FIVE = 5, SIX = 6, SEVEN = 7,
EIGHT = 8, NINE = 9, TEN = 10, JACK = 10,
QUEEN = 10, KING = 10, ACE = 11 };
Rank r;
}
Is it possible to access TEN, JACK and Queen without using `Card::Rank::TEN Card::Rank::JACK` `Card::Rank::QUEEN Card::Rank::KING`?
I am overloading `ostream operator<<` using a `switch`, but it has errors... when i try to create a constructor initializing 52 cards in class Deck, I find it impossible.
|
There is really no difference between `Card::Rank::TEN`, `Card::Rank::JACK`, `Card::Rank::QUEEN` and `Card::Rank::KING`. You cannot tell them apart.
It's the same as if you wrote
#define TEN 10
#define JACK 10
#define QUEEN 10
#define KING 10
And then programmatically trying to distinguish between them. But they contain the exact same value; they are indistinguishable.
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 2,
"tags": "c++, enums"
}
|
Looking for a reference to a proof of $(I - A)^{-1} = I + A + A^2 + A^3 + \ldots$
On some online forum, there is the claim:
Given some square matrix:
$$(I - A)^{-1} = I + A + A^2 + A^3 + \ldots$$
> This is true if the right side converges, which is true if and only if all of the eigenvalues of A have absolute value smaller than $1$.
Reference <
I really like this result, because it relies on the more intuitive spectral radius rather than matrix norm which is defined as:
\begin{align} \|A\| &= \sup\\{\|Ax\| : x\in K^n \mbox{ with }\|x\|= 1\\} \\\ &= \sup\left\\{\frac{\|Ax\|}{\|x\|} : x\in K^n \mbox{ with }x\ne 0\right\\}. \end{align}
Can someone provide a reference to the proof of this claim?
|
You can also prove it by relating spectral radius with matrix norm. For a linear operator $A$, $$\operatorname{spr}(A) \le \|A\|$$ where $$\begin{align} \|A\| &= \underset{\|x\|=1}{\sup} \|Ax\| \\\ \operatorname{spr}(A) &= \max\left\lbrace |\lambda|: \lambda \text{ is an eigenvalue of } A \right\rbrace \end{align}$$ The spectral radius $\operatorname{spr}(A)$ and $\|A\|$ are equal iff the operator $A$ is normal.
So $\|A\| < 1 \Rightarrow \operatorname{spr}(A) < 1 \Rightarrow $ all of the eigenvalues of $A$ have absolute value smaller than 1.
See Exercise I.2.6 of Rajendra Bhatia's Matrix Analysis where he calls it the Neumann Series.  and I would like to handle this user as normal spring security user.
After the user is logged in I'll be able to enrich his profile with his linkedin settings.
Any suggestions?
|
Grails have a set of plugins for different authentications: core plugin \+ set of extenstions for different auth providers (openid, twitter, facebook). As I see it don't have a plugin for LinkedIn authentication, but core plugin is very flexible and extensible, so you can easily add functionality for LinkedIn, if you know how it works.
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "facebook, grails, twitter, spring security, linkedin"
}
|
What's The Difference Between Keys, Fields And Values In Acumatica API?
Can someone enlight me on how Keys, Fields and Values in the Acumatica web services differs from one another? In which circumstance should I use each of them when Exporting and Submitting?
Thanks, G
|
basically it's inherited from business layer. Values - it;s just a fields on the screen Keys - keys fields on the screen ( you can use search by key fields) Fields - virtual fields that you can create
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "acumatica"
}
|
How can I get the port that a WCF service is listening on?
I have a net.tcp WCF service, and I would like the OS to pick the port that it should listen on. So I have set the port to 0 in my URI, and `netstat` confirms that the OS has picked a port in the 5000 range.
How can I find the actual port that has been picked, in code, inside the service process?
Some code to show what I have tried:
Type serviceType = ...;
Uri address = new Uri("net.tcp://0.0.0.0:0/Service/");
ServiceHost serviceHost = new ServiceHost(serviceType, address);
ServiceEndpoint endPoint = serviceHost.AddServiceEndpoint(type, binding, "");
int port1 = endPoint.ListenUri.Port; // returns 0
int port2 = serviceHost.BaseAddresses.First().Port; // also returns 0
|
Not sure if this will help, but there's a similar question already on SO: How can I get the listening address/port of a WCF service?
The relevant part of a submitted answer that you may want to try:
foreach (var channelDispatcher in serviceHost.ChannelDispatchers)
{
Console.WriteLine(channelDispatcher.Listener.Uri);
}
So maybe you need `channelDispatcher.Listener.Uri.Port`.
Hope this helps!
|
stackexchange-stackoverflow
|
{
"answer_score": 11,
"question_score": 8,
"tags": "c#, wcf, service"
}
|
How to make WebApi HelpPage recognize model documentations located outside the WebApi project itself
Let's say I have two project in one solution
* WebApi: A WebApi project that provides access points for all api services
* Core: A library project where business Logic defined here, including system model.
For each WebApi request, it uses ModelState to check if the model was valid and then pass the request to the business model defined in the Core library to get result.
I wanted to have automatic API documentation so I configured the WebApi project to generate XML document and the HelpPage module did perfectly as expected, **except when it comes to models that's defined in the Core.dll, it's left blank.**
I wonder if there's any workaround that could make the HelpPage module "recognize" XML documentations outside the WebApi project?
|
For each external library that contains documentation, you can setup a post build event that copies the locally generated xml file to a central "documentation" folder. This would obviously require that each project that is generating xml docs to uniquely name the file.
Your web api project can then run a post build event to copy whichever xml files it needs from the central shared library into its own project folder. You then need to tweak the xml documentation provider to look for multiple xml files as shown in this post
How can Xml Documentation for Web Api include documentation from beyond the main project?
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "asp.net web api, asp.net web api helppages"
}
|
Get index of element in array jQuery
I has an array of objects `$('selector')`, I want to get `index()` of each element and append it to the html of each elemt. I can get index of first element just write `$('selector').index()`, but how I can get other, and append them to they DOM-objects. Help, I am new in Javascript and jQuery.
|
Try this...
$("selector").each(function(i) {
$(this).html($(this).html() + " " + i);
});
`i` will be the index of each selected element and will be appended to the html.
Here's a jsfiddle example...
<
|
stackexchange-stackoverflow
|
{
"answer_score": 3,
"question_score": 1,
"tags": "javascript, jquery, object, dom"
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.