qid
int64
10
74.7M
question
stringlengths
15
26.2k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
27
28.1k
response_k
stringlengths
23
26.8k
28,869,932
This is my code: ``` <?php $value = 'something from somewhere'; setcookie("TestCookie", $value); ?> ``` I am getting the error message as follows: > > Warning: Cannot modify header information - headers already sent by > (output started at /home/nairsoft/public\_html/page1.php:2) in > /home/nairsoft/public\_html...
2015/03/05
[ "https://Stackoverflow.com/questions/28869932", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4422446/" ]
The headers are sent at the beginning of a request before the body of the server's response. It looks like your code already sent the headers so you can't modify them. As Afaan suggested, make sure you don't ouput anything before the opening php tag. In general, it is a good idea to process everything you need at the ...
Cookie is a part of headers and headers must be sent ***before*** any actual output to the browser. Make sure that you set your cookies and other headers before you output *anything*. It has nothing whatsoever to do with what type of hosting package you have.
414,055
I'm (really) newbie to functional programming (in fact only had contact with it using python) but seems to be a good approach for some list-intensive tasks in a shell environment. I'd love to do something like this: ``` $ [ git clone $host/$repo for repo in repo1 repo2 repo3 ] ``` Is there any Unix shell with these...
2012/04/18
[ "https://superuser.com/questions/414055", "https://superuser.com", "https://superuser.com/users/-1/" ]
Scheme Shell, scsh, is really good. As Keith Thompson notes, it's not useful as an interactive shell (though Commander S looks like an interesting experiment). Instead, it's an excellent programming language for contexts where having all the POSIX bindings is useful -- that includes cases where you want to call other ...
Don't know about it being "functional", but there is also [rc](http://en.wikipedia.org/wiki/Rc), which the [scsh paper](ftp://ftp.cs.indiana.edu/pub/scheme-repository/imp/scsh-paper.ps) mentions. It's a predecesor to es. On Linux Mint (and probably Debian, Ubuntu...) you can try it with ``` sudo apt-get install rc ma...
281,620
I am kind of confused.... Are the two sentences below the same? > > 1. Let’s pretend that none of this had ever/never happened. > 2. Let’s pretend that none of this have ever/never happened. > > > If it’s different, can you please be specific on how they are different from each other?
2021/04/16
[ "https://ell.stackexchange.com/questions/281620", "https://ell.stackexchange.com", "https://ell.stackexchange.com/users/134450/" ]
I think your claim is that the statement "either there is a professor of linguistics or there isn't" is a [tautology](https://en.wikipedia.org/wiki/Tautology_(logic)) and therefore not a supposition at all. And I think you're right. Unless we want to dive into [the philosophy of existence](https://en.wikipedia.org/wiki...
I didn't see any indication on the linked page that that presupposition has anything wrong with it. The page simply points out that a presupposition is implied by the question, and will be recognized by the hearer of the question. It is a yes/no question.
7,571,509
1. This code executes primes upto a given number. It works correctly as far as the prime generation is concerned but the output is painfully repetitive. 2. The code is: ``` numP = 1 x = 3 y = int(input('Enter number of primes to be found: ')) while numP<=y: for n in range(2, x): for b in range(2, n): ...
2011/09/27
[ "https://Stackoverflow.com/questions/7571509", "https://Stackoverflow.com", "https://Stackoverflow.com/users/952616/" ]
Remove one of the `slf4j-log4j12-1.5.8.jar` or `slf4j-log4j12-1.6.0.jar` from the classpath. Your project should not depend on different versions of SLF4J. I suggest you to use just the 1.6.0. If you're using Maven, you can [exclude transitive dependencies](http://maven.apache.org/pom.html#Exclusions). Here is an exam...
Have you read the URL referenced by the warning? ``` SLF4J: See [http://www.slf4j.org/codes.html#multiple_bindings][1] for an explanation. ``` Here is what the link states: > > SLF4J API is desinged to bind with one and only one underlying logging > framework at a time. If more than one binding is present on the ...
33,159,911
Why doesn't this return a value when the function is called? I've tried it with callbacks, and I can't seem to get it to work either. It lets me console.log, but it just won't return it to the `tmp` variable. ``` var URL = "https://api.instagram.com/v1/media/popular?client_id=642176ece1e7445e99244cec26f4de1f"; functi...
2015/10/15
[ "https://Stackoverflow.com/questions/33159911", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3224271/" ]
The problem is that your site does not contain anchors with the class `page-link` when it is loaded with `urllib`. However you see it in your browser. This is because JavaScript creates the page links to the next sites. If you use a browser with good developer tools (I use Chrome) you can disable JavaScript execution ...
Thanks GHajba for the detailed explanation! That's more or less what I ended up doing: ``` try: for i in range(2, 100): page = urlparse.urljoin(mainUrl, "?q=data%20science&page=" + str(i)) readPage = urllib.urlopen(page).read() soup = BeautifulSoup(readPage) except: pass ``` Thanks e...
34,140,559
I have connected temperature sensor to BeagleBone Black [BBB] board, after interval of 1 sec it sense the temperature and pass to BBB and beaglebone dumps it into mysql database on another computer. I want to show temperature data in graphical format. Graph should be updated after each second. I tried various librari...
2015/12/07
[ "https://Stackoverflow.com/questions/34140559", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4436739/" ]
``` import java.util.ArrayList; import java.util.Arrays; import java.util.List; public class ClassRoom { private List<Student> studentList = new ArrayList<>(); public void addStudents(Student... students) { studentList.addAll(Arrays.asList(students)); } } ``` Sample student class ``` class Stud...
It is possible to have variable parameter length with the following code: ``` public void addStudents(Student... students) {...} ``` `students` will be an array of `Student`.
33,546
Specifically, I was wondering if a core of magnitite or some such other magnetic metal could be a planet's core. This is in relation to my other question, found here: [Can airborne floating/flying islands be scientifically possible?](https://worldbuilding.stackexchange.com/questions/33513/can-airborne-floating-flying...
2016/01/17
[ "https://worldbuilding.stackexchange.com/questions/33546", "https://worldbuilding.stackexchange.com", "https://worldbuilding.stackexchange.com/users/17137/" ]
The answer depends on what your question really is. **Could you theoretically construct a magnetic planet using a core materially different than iron? Yes** Nickel and cobalt have are similar to iron in terms of their electrical, magnetic, and physical properties and both are a little denser than iron. **Could such ...
The problem with having magnetite as the core of an Earth-like planet is the pressure and associated temperature that the core would reach. Magnetite ($\text{Fe}\_{3}\text{O}\_{4}$) breaks down at very high pressures and temperatures (800°C and 10-11GPa) to a different phase, $\text{Fe}\_{4}\text{O}\_{5}$, which is sim...
15,464
In the page <http://www.teslamotors.com/models> if we scroll down we see the several flavors Tesla sells its Model S. It puzzles me why the 85 version has a shorter range than the 85D. The first can run 265 miles, the second 270. Given that in the former the battery has to feed only one motor and in latter it has to f...
2015/02/16
[ "https://mechanics.stackexchange.com/questions/15464", "https://mechanics.stackexchange.com", "https://mechanics.stackexchange.com/users/9367/" ]
It says right on the webpage: > > Conventional all-wheel drive cars employ complex mechanical linkages to distribute power from a single engine to all four wheels. This sacrifices efficiency in favor of all weather traction. In contrast, **each Model S motor is lighter, smaller and more efficient than its rear wheel ...
This is pieced together from articles about this and the talk we had from a Tesla rep at the car leasing company I work for. The improved range of the dual motor setup arises from the front and rear gearboxes (one per motor, nothing interlinking them) having different ratios. Electric motors have a rpm range in which ...
30,725,682
I am trying to create a login screen. I have used ScrollView to hold input fields. I have following xml: ``` <RelativeLayout ... > <RelativeLayout android:id="@+id/top_menu" ... > <ImageButton ... /> <com.neopixl.pixlui.components.textview.TextView... /> </RelativeLayout> <ScrollVi...
2015/06/09
[ "https://Stackoverflow.com/questions/30725682", "https://Stackoverflow.com", "https://Stackoverflow.com/users/614065/" ]
this is my code ```js window.onload = function () { var chart = new CanvasJS.Chart("chartContainer", { title: { text: "Top Categoires of New Year's Resolution" }, exportFileName: "Pie Chart", expo...
change `<div id="chartContainer" style="height: 300px; width: 100%;"></div>` with `<div id="chartContainer" style="height: 300px; width: 100%;direction: ltr;"></div>` its work very good
214,648
A lot of more realistic depictions of dragons have their fire breath coming from some sort of flammable substance like a gas or liquid that their body produces and stores before they spew it that they then light to create the illusion or at least an approximation of 'breathing fire'... somehow. My question is this. Co...
2021/10/02
[ "https://worldbuilding.stackexchange.com/questions/214648", "https://worldbuilding.stackexchange.com", "https://worldbuilding.stackexchange.com/users/90499/" ]
**The Flint** Flint is a mineral; it is a sedimentary cryptocrystalline form of the mineral quartz. Biomineralization is a naturally occurring trait of living organisms, and this is process is how seashells get formed, for example. So, yes, your dragon is some biological manner have a “tongue of flint.” Maybe its to...
Use Ferrocerium Instead ======================= Ferrocerium is an alloy that is used to start fires, like a flint-and-steel. However, ferroceriums are far better. Namely, their sparks burn far hotter (making it easier to light the fire), and can be sparked on many types of edge There is one problem: Cerium (a major p...
15,970,246
I am using Proguard in my application, After exporting build i have performed reverse engineering on it with help of dex2jar, but some java class names are still in readable format but method names are obfuscated. e.g. If i having class named as TestClass.java before obfuscation after obfuscation it expect something li...
2013/04/12
[ "https://Stackoverflow.com/questions/15970246", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1787795/" ]
Years later, there is now [Paws](https://metacpan.org/pod/Paws), a Perl AWS interface. It's on CPAN.
<http://www.timkay.com/aws/> I have found Tim Kay's "aws" and "s3" tools quite useful. They are written in Perl. It has the added advantage of --exec, so you can append commands directly to the output, in their original state from AWS. It has been a terror for me to have international characters and other junk floatin...
48,419,094
I am new to Angular js and I want to try the following. I have an Object Array that come from Database. This is the url(example): <http://localhost:3000/items/showAll> I have yet implemented the Add, Edit, Update, Delete (Crud operation in backend with nodejs and express js and frontend with angularjs) but my problem i...
2018/01/24
[ "https://Stackoverflow.com/questions/48419094", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8587628/" ]
The following will match 6 numbers, with any amount of space characters between them. ``` (?:\d\s*){5}\d ``` `?:` at the beginning there makes the group non-capturing. It's not necessary if all you wish to do is a simple match. A live example: <https://regex101.com/r/PZJ8DO/2>
You can try to use ``` (?<=).*6.* ``` This will match any line that contains '6' even if there are some white spaces or other characters in the line. The (?<=) Positive Look Behind. The . matches any character except line breaks. The \* matches 0 or more of the preceding token. And 6 matches a "6" Character. Y...
7,853,914
> > **Possible Duplicate:** > > [python str.strip strange behavior](https://stackoverflow.com/questions/2990973/python-str-strip-strange-behavior) > > > I have following piece of code: ``` st = '55000.0' st = st.strip('.0') print st ``` When i execute, it print only `55` but i expect it to print `55000`. I ...
2011/10/21
[ "https://Stackoverflow.com/questions/7853914", "https://Stackoverflow.com", "https://Stackoverflow.com/users/860103/" ]
You've misunderstood strip() - it removes **any** of the specified characters from both ends; there is no regex support here. You're asking it to strip both `.` and `0` off both ends, so it does - and gets left with `55`. See the [official String class docs](http://docs.python.org/library/string.html#string.strip) fo...
Because [that's what `strip` does](http://docs.python.org/library/stdtypes.html?highlight=strip#str.strip): > > The chars argument is not a prefix or suffix; rather, all combinations of its values are stripped > > >
13,580,848
Capturing a repetition group is always returning the last element but that is not quite helpfull. For example: ``` var regex = new RegEx("^(?<somea>a)+$"); var match = regex.Match("aaa"); match.Group["somea"]; // return "a" ``` I would like to have a collection of match element instead of the last match item. Is tha...
2012/11/27
[ "https://Stackoverflow.com/questions/13580848", "https://Stackoverflow.com", "https://Stackoverflow.com/users/343957/" ]
Take a look in the `Captures` collection: ``` match.Groups["somea"].Captures ```
You can also try something like this : ``` var regex = new RegEx("^(?<somea>a)+$"); var matches = regex.Matches("aaa"); foreach(Match _match in matches){ match.Group["somea"]; // return "a" } ``` This is just a sample but it should give a good start. I did not check the validity of your regular expression thoug...
20,678,664
How can I export a table to `.csv` in Postgres, when I'm not superuser and can't use the `copy` command? I can still import the data to postgres with "import" button on the right click, but no export option.
2013/12/19
[ "https://Stackoverflow.com/questions/20678664", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3118674/" ]
Use psql and redirect stream to file: ``` psql -U <USER> -d <DB_NAME> -c "COPY <YOUR_TABLE> TO stdout DELIMITER ',' CSV HEADER;" > file.csv ```
I was having trouble with superuser and running psql, I took the simple stupid way using PGAdmin III. 1) SELECT \* FROM ; Before running select Query in the menu bar and select 'Query to File' This will save it to a folder of your choice. May have to play with the settings on how to export, it likes quoting a...
92,305
Comedian/podcaster/QI elf [Dan Schreiber asked on Twitter](https://twitter.com/Schreiberland/status/1505611873735086085?s=20&t=vaW2BggycytqzVhVYbCeUg), as proxy for his 4-year old > > if it would ever be possible to hook a plane (like a 737) onto the back of another plane, like a train carriage, and then have both ta...
2022/03/21
[ "https://aviation.stackexchange.com/questions/92305", "https://aviation.stackexchange.com", "https://aviation.stackexchange.com/users/3146/" ]
[![enter image description here](https://i.stack.imgur.com/knASl.png)](https://i.stack.imgur.com/knASl.png)[Pic source](https://militaryhistorynow.com/2014/09/29/soar-winners-the-glider-troopers-of-ww2-2/) Yes it should be possible for an airliner to tow another airliner. In WW2 gliders with paratroopers on board were...
It is surely possible in theory, but not that much in practice - at least not without some serious custom engineering. One big problem is going to be find a point strong enough to attach the towing cable on both planes. Planes that are made to tow / be towed have special strong points. Also do not forget that when to...
219,329
For $t\in [ 0, 1 )$ is $$ \frac{xe^{tx}}{e^{x}-1}$$ integrable over $x\in (0 , \infty )$? I.e., $$ \int\_{0}^{\infty} \frac{xe^{tx}}{e^{x}-1} dx < \infty?$$ How do I show this?
2012/10/23
[ "https://math.stackexchange.com/questions/219329", "https://math.stackexchange.com", "https://math.stackexchange.com/users/41872/" ]
As $x\to0$, $x/(e^x-1)$ approaches a finite limit. As $x\to\infty$, do a limit-comparison of the integrand to $xe^{tx}/e^x$.
As $\frac x{e^x-1}$ as a limit when $x\to 0$ (namely $1$), the only problem is when $x\to\infty$. We have $e^x-1\sim e^x$ at $+\infty$, so $\dfrac{xe^{tx}}{e^x-1}\sim xe^{(t-1)x}$. Using Taylor's series, $$e^{(t-1)x}\leq \frac 1{1+(1-t)x+x^2(1-t)^2/2+x^3(1-t)^3/6},$$ the integral is convergent for $t\in[0,1)$.
17,070,281
I know that for targeting IE8+ you should use: ``` <!--[if gte IE 8]> According to the conditional comment this is IE 8 or higher<br /> <![endif]--> ``` For targeting non IE browsers you can use: ``` <!--[if !IE]> --> According to the conditional comment this is not IE<br /> <!-- <![endif]--> ``` You can also com...
2013/06/12
[ "https://Stackoverflow.com/questions/17070281", "https://Stackoverflow.com", "https://Stackoverflow.com/users/463065/" ]
From: [link](http://www.mediacollege.com/internet/html/detect/detect-ie.html) > > The next example is the opposite: "Only show this content if the > browser is NOT Internet Explorer". > > > ``` <![if !IE]> Place content here to target all users not using Internet Explorer. <![endif]> ``` Conditional comments a...
This is what works for me. I ended up having to include the non-IE-8 css twice: ``` <!--[if lt IE 9]> <link rel="stylesheet" type="text/css" href="/css/ie8.css"/> <![endif]--> <!--[if gte IE 9]> <link rel="stylesheet" type="text/css" href="/css/non_ie8.css"/> <![endif]--> <!--[if !IE]><!--> <link rel="styleshe...
44,642,412
I'm building out a simple user role management UI that has multiple permissions based on RBAC rules. So I have lets say a group called users and inside of that group you get "add user", "edit users", "delete users" and "view users". What I want to do is be able to select the entire "users" group checkbox and it should...
2017/06/20
[ "https://Stackoverflow.com/questions/44642412", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2923236/" ]
Add appropriate classes to your parent elements and to your child elements so your code could be altered like in the below example. ``` @foreach($permissions as $name => $permission) <div class="col-sm-3"> <h4> <label> <input type="checkbox" class="{{ $name }}"> ...
Your code is just fine but to make the answer even smaller I would like you to assign `class` attribute to your main div and checkbox so out jquery will depend on our own classes/selector instead of bootstrap classes. ``` <div class="col-sm-3 permission-block"> <h4> <label> <input type="checkbox" class=...
5,502,213
I have limited access to libraries so although using boost::multi\_index would solve my issue it is something that I cannot use. My current map setup is: The structure contains a fair amount of information in it such as an INT that I will also need to search by. What I was hoping was a structure such as so that I can...
2011/03/31
[ "https://Stackoverflow.com/questions/5502213", "https://Stackoverflow.com", "https://Stackoverflow.com/users/68046/" ]
I'm a little confused. You seem to be saying that you have a construct like this: (psudocode) ``` struct Gizmo { Gizmo(int foo, string bar) : foo_(foo), bar_(bar) {}; int foo_; string bar_; }; Gizmo make_gizmo(int foo, string bar) { return Gizmo(foo,bar); } std::map<string, Gizmo> my_gizmos; my_gizmos["aaa"] =...
If your searches actually are windowing queries(meaning you must return values in [param0\_0, peram0\_1]x[param1\_0, param1\_2]x...) or so, then you can use range tree structure for efficiency.
13,502,996
I have used `preventDefault` on an element event like this: ``` $('#element').click(function (e) { do stuff... }); ``` Now, I have a function that takes an argument already in which I would like to use `preventDefault` but I'm not sure how: ``` <a href="#services" id="services_link" class="services" onclick="se...
2012/11/21
[ "https://Stackoverflow.com/questions/13502996", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1595279/" ]
You can use jQuery, like you are with the other example, to handle the click event: ``` <a href="#services" id="services_link" class="services">Services</a> $('#services_link').click(function (e) { var id = "services"; history.pushState(null, null, '#' + id); $('html, body').animate({ scrollTop: ...
If .on("click") adds "overflow:hidden" to the body or html, the page scrolls anyway to the top, even if you use e.preventDefalt() inside the callback.
4,649,953
Let's say that I have this query: ``` SELECT * FROM students_results WHERE full_name LIKE '".trim($_POST['full_name'])."' AND mother_name LIKE '".$database->escape_value(trim($_POST['mother_name']))."' AND birthday = '".$database->escape_value($_POST['year2'])."'" ``` I need to display a message for the vist...
2011/01/10
[ "https://Stackoverflow.com/questions/4649953", "https://Stackoverflow.com", "https://Stackoverflow.com/users/308745/" ]
> > How to get wrong values when executing > MySQL query? > > > **You can't.** Take the example of two `John Smith`s, one born 1/1/70 with a mother named Ann, and one born 1/1/80 with a mother named Alice. When the older John Smith enters 1/1/70 and Alice, how will you know it's not the younger John Smith ente...
If `Students_results` table holds the students name, mothers name, the birthdate then I think the database isn't normalized enough. Normalizing could solve your problems too. You can use a student\_id to identify the correct row instead of a composite combination of name + mother name + bdate.
73,149,937
I'm writing a Java program that calculates the frequencies of words in an input. The initial integer indicates how many words will follow. Here is my code so far: ``` import java.util.Scanner; public class LabProgram { public static void main(String[] args) { Scanner scnr = new Scanner(System.in); int...
2022/07/28
[ "https://Stackoverflow.com/questions/73149937", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19638813/" ]
Creating a `HashMap` containing frequencies of each word is the most performant approach. One of the ways to do it is by using method [`merge()`](https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/Map.html#merge(K,V,java.util.function.BiFunction)), that was introduced in the `Map` interface with Ja...
I used another string variable I named currWord to hold the values in wordsList[i] and then compared currWord to wordsList[j]. Here is the code: ``` import java.util.Scanner; public class LabProgram { public static void main(String[] args) { Scanner scnr = new Scanner(System.in); String [] userSt...
53,231
I have a long stretch of yard where I want to allow some of it to grow into a forested backstop / wind-block / nature promotion (birds, squirrels...whatever) It has been just grass for a long time, but I just started letting this section go a few weeks ago, in hopes it will eventually grow some trees, bushes...etc. Wo...
2020/07/17
[ "https://gardening.stackexchange.com/questions/53231", "https://gardening.stackexchange.com", "https://gardening.stackexchange.com/users/17234/" ]
Depends on how much money and work you want to put into it. I once helped a friend who wanted trees in a 60 acre former corn field he bought. He welded up a couple things to poke a 12" deep holes in the ground and we put in about a zillion cuttings of various trees. I never saw it again but he did occasionally speak of...
After 10 loads of wood chips I've found that having an arborist dump off loads of late season tree trimmings with seeds in them will have plenty of viable seeds in them that you will want to spread in the area to about 1' in depth, but if you want specific trees you should plant the seeds in the wood chip mulch.
184,129
In Civil War we see Black Panther scratches Cap's shield with his claws, even though both are made of vibranium. How is this possible, especially given that Cap's shield is made of a vibranium alloy which is even stronger than simply using Vibranium? [![enter image description here](https://i.stack.imgur.com/F15fg.jpg...
2018/03/23
[ "https://scifi.stackexchange.com/questions/184129", "https://scifi.stackexchange.com", "https://scifi.stackexchange.com/users/89070/" ]
Simple answer. In the MCU, [Cap's shield](http://marvelcinematicuniverse.wikia.com/wiki/Captain_America%27s_Shield) is only made out of Vibranium, not an alloy, as in the comics. > > "No, no, that's just a prototype." > > "What's it made of?" > > "Vibranium. It's stronger than steel and a third of the weight....
Though it wasn't explicitly stated, Black Panther's claws are made of Antarctic Vibranium or "Anti-metal", which is the opposite of Wakandan Vibranium. While Vibranium from Wakanda strengthens vibrations, Antarctic Vibranium weakens them.
112,443
I am currently doing my master’s in German and need to start writing my thesis. Although I am already comfortable speaking the language, writing (especially academic papers) is not something I feel great about. Also, my thesis is a big deal. Legally speaking, could I write it in English and have it translated? It would...
2018/07/10
[ "https://academia.stackexchange.com/questions/112443", "https://academia.stackexchange.com", "https://academia.stackexchange.com/users/94846/" ]
When I had to do my project in French - I wrote in French directly trying to minimise my errors - as it was engineering based the vocabulary is more difficult... But as I completed each chapter / section I got my French colleagues (also students) to read and correct / improve / comment on what I was writing. I bribed...
First of all you need to weigh in pros and cons of having the final version of your thesis in German vs in English. Think of your future career plans in Germany or elsewhere, language the defense committee is comfortable with, etc. If you decide to write it in English and translate into German, do the following: 1. M...
11,669,461
While instrumenting a class for its different methods In order to make a method do a write operation in a text file. I first stored the string in a local variable 3160 explicitly defined. How to choose these variables to prevent conflicts with already existing variables. Like in this snippet The code does the work of ...
2012/07/26
[ "https://Stackoverflow.com/questions/11669461", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1303506/" ]
You should use [LocalVariablesSorter](http://asm.ow2.org/asm40/javadoc/user/org/objectweb/asm/commons/LocalVariablesSorter.html) adapter (either extend your own visitor from it, or add it to the visitors chain before MethodWriter). Then when you'll need a new variable you can call [LocalVariablesSorter.newLocal()](http...
I would look at the local variables debug table and I would use the next available id which is more likely to be 2 or 10 rather than 3160. If you don't have debugging information, you may need to scan the code more than once, first to see how many ids have been used. Note: `double` and `long` require two ids for hist...
3,132,053
The following is a failing unittest explaining a bug I found today: ``` [TestMethod] public void WFT() { string configDebug = "false"; bool configDebugEnabled = bool.TryParse(configDebug, out configDebugEnabled); Assert.AreEqual(false, configDebugEnabled); } ``` This is how t...
2010/06/28
[ "https://Stackoverflow.com/questions/3132053", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11850/" ]
The reason it's failing is that you are using the same variable to store the *success or failure* of the `TryParse` itself. As the parsing succeeds (the string does translate to a boolean value) you are overwriting the returned value of `false` with `true`.
bool.TryParse returns a bool to specify whether the parse was successful. You are assigning that result to the same bool variable that you are putting in the out parameter. You need a separate variable to test for the success of the function.
4,374,476
I just began learning group theory and this question came across my mind. Suppose $f :G \to H$ is a group homomorphism, where $G$ and $H$ are groups. Is $\ker f $ unique? Based on my understanding, since homomorphism preserves identity from $G$ to $H$, and that identity in groups $G$ and $H$ is unique, there is only ...
2022/02/05
[ "https://math.stackexchange.com/questions/4374476", "https://math.stackexchange.com", "https://math.stackexchange.com/users/1022273/" ]
Your argument only shows that the identity element of $G$ is contained in the kernel of $f$. There might be more elements depending on $f$ though. To give an extreme example: Let $G$ and $H$ be arbitrary groups and consider the homomorphism $1 \colon G \rightarrow H$ of groups that sends each element of $G$ to the ide...
Kernel of a homomorphism $f:G \to H$ is a set and the set is uniquely defined. If $0$ is the identity in $H$, then the $\ker(f) = \{g\in G \ | \ f(g) = 0\}$. However, the kernel need not have a unique element. Look at the following example: Let $G$ be the group of integers $\mathbb{Z}$ under addition. Consider the set...
4,077,059
I want to find every url in text and wrap them with a tag (`<a href="...">...</a>`). ``` var src = "bla blaaa blaaaaaa 1 http://yahoo.com text something about and. http://www.google.com"; var match = /http:\/\/([a-z0-9.-]+)/.exec(src); //this only can one matched // result: ["http://yahoo.com", "yahoo.com"] ``` Bu...
2010/11/02
[ "https://Stackoverflow.com/questions/4077059", "https://Stackoverflow.com", "https://Stackoverflow.com/users/104085/" ]
You can use `/g` (global) to match all occurences and the backreference like this: ``` var src = "bla blaaa blaaaaaa 1 http://yahoo.com text something about and. http://www.google.com"; var match = src.replace(/http:\/\/([a-z0-9.-]+)/g, '<a href="$1">$1</a>'); ``` [You can test it out here](http://www.jsfiddle.net...
``` var res = src.replace(/(http:\/\/([a-z0-9.-]+))/g, '<a href="$1">$2</a>'); ``` Outputs: `bla blaaa blaaaaaa 1 <a href="http://yahoo.com">yahoo.com</a> text something about and. <a href="http://www.google.com">www.google.com</a>` Not sure that was the intention, but what I could think of. Use `<a href="$1">$1</a...
15,042,989
During some projects I have needed to validate some data and be as certain as possible that it is javascript numerical value that can be used in mathematical operations. jQuery, and some other javascript libraries already include such a function, usually called isNumeric. There is also a [post on stackoverflow](https:...
2013/02/23
[ "https://Stackoverflow.com/questions/15042989", "https://Stackoverflow.com", "https://Stackoverflow.com/users/592253/" ]
> > In my opinion, if it's an array then its not numeric. To alleviate this problem, I added a check to discount arrays from the logic > > > You can have that problem with any other object as well, for example `{toString:function(){return "1.2";}}`. Which objects would you think were numeric? `Number` objects? Non...
How about: ``` function isNumber(value) { value = Number(value); return typeof value === 'number' && !isNaN(value) && isFinite(value); } ```
197,625
So, my friend and I were chatting the other day. I, being a new father, sent him a picture of my clothesline completely full of my daughter's diapers. Then this dialogue happened: > > My friend: Woah, babies are really poop factories. > > Me: No shit. > > > Now, at that point, the chat spiraled out to a disc...
2014/09/22
[ "https://english.stackexchange.com/questions/197625", "https://english.stackexchange.com", "https://english.stackexchange.com/users/88539/" ]
Correct and appropriate. Additionally *No shit Sherlock* ==> "You are stating the obvious" which according to [Wiktionary](http://en.wiktionary.org/wiki/no_shit,_Sherlock) breaks down into > > **no shit** (“an expression of amazement”) + **Sherlock** (“a fictional detective who makes ingenious deductions”) > > ...
Mplungjan has explained one sense in which your response was appropriate. There is another too, though it does involve inserting a comma into your original formulation: > > *"No, shit".* > > > Or perhaps (even more appropriately, given the topic) a colon: > > *"No: shit".* > > > You would say this if you f...
14,612,444
I'm a newbie to shell scripting. I have written a shell script to do incremental backup of MySQL database.The script is in executable format and runs successfully when executed manually but fails when executed through crontab. Crontab entry is like this : ``` */1 * * * * /home/db-backup/mysqlbackup.sh ``` Below is...
2013/01/30
[ "https://Stackoverflow.com/questions/14612444", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1809252/" ]
The problem is probably that your $PATH is different in the manual environment from that under which crontab runs. Hence, `which` can't find your executables. To fix this, first print your path in the manual environment (`echo $PATH`), and then manually set up PATH at the top of the script you run in crontab. Or just r...
My Issue was that I set the cron job in /etc/cron.d (Centos 7). It seems that when doing so I need to specify the user who executes the script, unlike when a cronjob is entered at a user level. All I had to do was ``` */1 * * * * root perl /path/to/my/script.sh */5 * * * * root php /path/to/my/script.php ``` Wher...
46,421,677
I'm using the following code to agregate students per year. The purpose is to know the total number of student for each year. ``` from pyspark.sql.functions import col import pyspark.sql.functions as fn gr = Df2.groupby(['Year']) df_grouped = gr.agg(fn.count(col('Student_ID')).alias('total_student_by_year')) ``` Th...
2017/09/26
[ "https://Stackoverflow.com/questions/46421677", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8674940/" ]
If you are working with an older Spark version and don't have the `countDistinct` function, you can replicate it using the combination of `size` and `collect_set` functions like so: ``` gr = gr.groupBy("year").agg(fn.size(fn.collect_set("id")).alias("distinct_count")) ``` In case you have to count distinct over mult...
By using Spark/PySpark SQL ``` y.createOrReplaceTempView("STUDENT") spark.sql("SELECT year, count(DISTINCT id) as count" + \ "FROM STUDENT group by year").show() ```
19,764,216
Assume I have some controller "Controller" and public method in it: ``` public ActionResult GetICal(int? param1, int? param2) { string cal = ""; //some logic goes here return File(Encoding.UTF8.GetBytes(cal), "text/calendar", "calendar.ics"); } ``` Then I'm trying to export it to Google Calendar via url:...
2013/11/04
[ "https://Stackoverflow.com/questions/19764216", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2169077/" ]
It's unfortunate that this bug has been around for so long, and that most answers here thought the question was about horizontal alignment rather than vertical spacing. [The bug](https://github.com/matplotlib/matplotlib/issues/6323) is known, and there is a patch to fix it, but it hasn't been merged, and simply been l...
The way I fix minor problems like this is to save the plot as an SVG and then edit it in my favourite Vector Graphics program (such as [InkScape](http://www.inkscape.org/en/)). This will allow you to select the individual parts of the plot and move them while preserving the good quality vector graphics.
2,836,042
When I look up for properties of the natural Logarithm I found in particular this property > > $$ \ln(x^r)=r \ln(x) $$ > > with $$x\in \Bbb R^{+\*} $$ > and$$ r\in\Bbb Q$$ > > > My Question is : Why $r$ should be $ \in\Bbb Q$ why not $r\in\Bbb R$ because i can't figure out any problem with being $ r\in\Bbb ...
2018/06/29
[ "https://math.stackexchange.com/questions/2836042", "https://math.stackexchange.com", "https://math.stackexchange.com/users/473273/" ]
It should be for all real $r$. The only reason I can see to restrict to $\Bbb Q$ is if you haven't defined $x^r$ for irrational $r$. You can define it for rational $r$ based on the definition for integers and the laws of exponents. Wherever you saw this may not have made the definition for irrational $r$ yet. That usua...
In the terms you put it, there is really no problem: that identity holds for all $r\in\Bbb R$.
7,087,861
I have a set of file names. ``` Eg: name=apple_class=1A_regis=1.txt name=apple_class=1A_regis=2.txt name=pear_class=1A_regis=1.txt ``` I want to be able to save all the file names that have the same 'name=apple\_class=1A' into an array. That would save the first two file names into an array. I have tried...
2011/08/17
[ "https://Stackoverflow.com/questions/7087861", "https://Stackoverflow.com", "https://Stackoverflow.com/users/897920/" ]
Alternative for those wanting method/action or class/controller wide `no-cache` ``` [OutputCache(Location = OutputCacheLocation.None)] public class HomeController : Controller { ... } ``` As explained here: [OutputCacheLocation Enumeration](http://msdn.microsoft.com/en-us/library/system.web.ui.outputcachelocation%2...
I recommend that these calls be limited to non-GET requests, to avoid losing the benefit of cache on GETs. The following ensures that even aggressive caching browsers like iOS 6 Safari will not cache anything that is not a GET request. I use a Controller base class that all of my controllers inherit from for a number ...
16,771,958
I have created a .NET Windows Service and installed the debug release from the bin/debug folder (yes I know this isn't a good approach, but I just want to be able to test it and attach debugger). The service basically runs in an endless loop checking an FTP directory for files, processing them, sleeping for a minute ...
2013/05/27
[ "https://Stackoverflow.com/questions/16771958", "https://Stackoverflow.com", "https://Stackoverflow.com/users/821210/" ]
As hinted in the comments, you need to reduce the number of queries by catenating as many inserts as possible together. In PHP, it is easy to achieve that: ``` $query = "insert into scoretable values"; for($a = 0; $a < 1000000; $a++) { $id = rand(1,75000); $score = rand(1,100000); $time = rand(1367038800 ,...
You are doing several things wrong. First thing you have to take into account is what MySQL engine you're using. The default one is InnoDB, previously the default engine is MyISAM. I'll write this answer under assumption you're using InnoDB, which you should be using for plethora of reasons. InnoDB operates in some...
17,751,377
Sorry if the title is a little confusing. I have a form for an `Item` with the field `name`. There's a text field where the user can input a name and submit it. But if the user doesn't type in anything and hits submit, Rails gives me a `param not found: item` error, and I'm not sure who to get around this. items\_con...
2013/07/19
[ "https://Stackoverflow.com/questions/17751377", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1839623/" ]
**Update:** Scaffolded rails4 app: <https://github.com/szines/item_17751377> It works if a user keep name field empty when create a new item... Looks, it works without problem... Development.log shows that parameters would be the following if user keep a field empty: ``` "item"=>{"name"=>""} ``` There is always...
I personally have not switched to strong parameters so I'm not sure how one should handle something like: ``` params.require(:item).permit(:name) ``` but you can always check for item presence with something like: ``` if params[:item].present? … end ```
1,492,297
In MySQL, how can I retrieve ALL rows in a table, starting from row X? For example, starting from row 6: ``` LIMIT 5,0 ``` This returns nothing, so I tried this: ``` LIMIT 5,ALL ``` Still no results (sql error). I'm not looking for pagination functionality, just retrieving all rows starting from a particular row...
2009/09/29
[ "https://Stackoverflow.com/questions/1492297", "https://Stackoverflow.com", "https://Stackoverflow.com/users/37630/" ]
If you're looking to get the last x number of rows, the easiest thing to do is `SORT DESC` and LIMIT to the *first* x rows. Granted, the `SORT` will slow your query down. But if you're opposed to setting an arbitrarily large number as the second `LIMIT` arg, then that's the way to do it.
The only solution I am aware of currently is to do as you say and give a ridiculously high number as the second argument to LIMIT. I do not believe there is any difference in performance to specifying a low number or a high number, mysql will simply stop returning rows at the end of the result set, or when it hits your...
43,723
I think it would be interesting to show some type of recognition on the main page for the "developer of the week", i.e. the developer who received the most votes (not reputation since there's a 200 per day cap) for a week. While no mortal man can possibly catch up with Jon Skeet's reputation; they may be able to top hi...
2010/03/23
[ "https://meta.stackexchange.com/questions/43723", "https://meta.stackexchange.com", "https://meta.stackexchange.com/users/134817/" ]
I'd be for this if the basis for the "Developer of the Week" title wouldn't be just reputation, but, say, the fact that somebody has gone the "extra mile" (providing support in comments beyond the mere collection of reputation for a good answer) extraordinarily often, or provided a truly brilliant, unheard-of answer. T...
This is for reputation, not upvotes, but the [reputation leagues](https://stackexchange.com/leagues/1/week/stackoverflow) show this.
111,487
We have a big problem that's just started happening. One of our network apps (may it rot in hell) requires a mapped network drive to function. Therefore, we map a drive to the network share in question for the users. This usually shows up of course in Explorer as: ``` Sharename on 'Servername' (Q:) ``` Problem is, i...
2010/02/10
[ "https://serverfault.com/questions/111487", "https://serverfault.com", "https://serverfault.com/users/14556/" ]
It almost sounds like you're after a P2P kind of deployment. I've never seen something like that, but it could be an interesting idea. We use ESET NOD32, which can run just fine without connection to a central server. Of course, then you miss out on centralized monitoring and alerting, as well as automated deployment....
I think it may be worth you while to grab eval copies of some likely looking AV products and install them on a test (virtual?) machine. Then have a look to see if they can be configured to grab the updates from a specific source. If they can, it should be easy enough to determine where their default downloads come from...
33,438,858
I am adding a folder module to a Moodle course using the API: ``` folder_add_instance($data, null); ``` I am getting the error below when running the script using CMD: ``` !!! Invalid course module ID !!! ``` I looked into the folder\_add\_instance() function in the library, the error is occurring when trying to ...
2015/10/30
[ "https://Stackoverflow.com/questions/33438858", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1934229/" ]
Here's complete code using `forEach`. The steps are same as [Quentin](https://stackoverflow.com/users/19068/quentin) has stated in his [answer](https://stackoverflow.com/a/33438900/2025923) 1. Copy the value 2. Remove the key-value from the object 3. Add new item with new value in the object ```js var arr = [{ "F...
You need to: * Copy the **value** * Delete the old property * Modify the correct object. (`data[i][obj]` will convert `obj` to a string and try to use it as a property name). Such: ``` for (var original_property in obj) { var new_property = original_property.split(' ').join('_'); obj[new_property...
9,198,362
``` <html> <head> </head> <body onload=> <button></button> <script> function give_show(value) { return function() { console.log(value); } } var button_element =document.getElementsByTagName('button')[0]; button_elemen...
2012/02/08
[ "https://Stackoverflow.com/questions/9198362", "https://Stackoverflow.com", "https://Stackoverflow.com/users/456218/" ]
Nested functions have access to everything defined in the scope in which they are created. So: ``` function give_show(value){ return function(){ console.log(value); } } ``` when you reference `value` in the nested function the variable defined in `give_show` is in scope and is used. However, when you do this: ``...
I change `load` for `click` on listners and add `console.log` before return internal function: ``` <html> <head> </head> <body> <button></button> <script> function give_show(value) { console.log(value); return function(value) { ...
4,585,439
I have tried searching almost all the blog sites. I need to send an MMS programatically. As far as my research on this I came to know that its not possible for IOS < 3. Is there any way i can use the messageUI kit fot sending MMS for IOS 4. Please let me know the possible ways. Thanks in advance!!!
2011/01/03
[ "https://Stackoverflow.com/questions/4585439", "https://Stackoverflow.com", "https://Stackoverflow.com/users/561365/" ]
You cannot send MMS right now. `MFMessageComposeViewController` only allow SMS messages on iOS 4 only.
iOS prevents SMS or MMS messages from being sent programmatically. You can compose the message, providing the "To" and the body of the message (in iOS 4+) and display a dialog that allows the user to tap a button and send it, but user intervention is always required.
44,437,784
trying to parse multiple sql variables from one file to another using session arrays but i cant. Whats the part iam missing here? Thanks in advance. file1.php ``` session_start(); while($row=mysql_fetch_array($result,MYSQL_BOTH)) { echo "<tr>"; $id=$row['id']; $array[] = $id; } $_SESSION['id'] = $array; ...
2017/06/08
[ "https://Stackoverflow.com/questions/44437784", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5687851/" ]
You can simply use this: ``` 'request_input' => exists:table,col,alternative_col_1,alternative_val_1,alternative_col_2,alternative_val_2, ...' ``` The SQL query is like below: ``` select count(*) as aggregate from `table` where `id` = [request_input] and `alternative_col1` = "alternative_val1" and `alternative_col2...
``` if (is_numeric($request->get('emailOrphone'))){ $request->validate([ 'emailOrphone'=>'exists:users,phone', ], [ 'emailOrphone.exists'=>'phone is invalid.' ]); }else{ $request->validate([ 'emailOrphone'=>'exists:users,email', ], [ 'emailOrphone.exists'...
51,256,570
I want to be able to move an img around within its container once the image is zoomed in, because as you can see once you click the image it becomes too big and you can't see the whole image. Also how can I make the image goes back to normal once it's not being hovered? thanks in advance. ```js // Zoom in/out clothing...
2018/07/10
[ "https://Stackoverflow.com/questions/51256570", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9840977/" ]
Since you're using `transform: scale()` for the zoom effect it's faster and more correct to modify `transform-origin` to change the center point of the zoom effect on mousemove: ```js // Zoom in/out clothing img $('.image').click(function() { $(this).toggleClass('normal-zoom zoom-in'); }); $('.image').on('mouse...
You can use the mousemove event listener on the image with class `.zoom-in` to change the left and top CSS params. Make sure to set `position:relative;` on the image. Example: ``` $(document).on('mousemove', '.zoom-in', function( event ) { $(".text").text(event.pageX + ", " + event.pageY); var positionLeft = even...
59,092,258
I have a directory with several large files. Every file comes in a pair, and I would like to use a bash loop to every time select two files, run a command line tool on them and then move on to the next pair of files. My directory would be like: file1, file2, file3, file4, file5, file6 I would then take file1 and file...
2019/11/28
[ "https://Stackoverflow.com/questions/59092258", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10403839/" ]
Going back to basic for loop, no array, etc. Will work for any shell (does not rely on bash features). Capture the name of the first file in a pair, and execute the command when on the second file. ``` first= for file_name in dir_name/* ; do if [ "$first" ] ; then # 2nd entry - pair do-something "...
If you want to be strict about handling special characters in filenames, how about: ``` while IFS= read -r -d "" f; do ary+=("$f") done < <(find "dir_name" -type f -print0 | sort -z) for ((i=0; i<${#ary[@]}; i+=2 )); do echo "${ary[i]}" "${ary[i+1]}" # or some_command "${ary[i]}" "${ary[i+1]}" done ``` ...
38,761,897
How can I convert `java.lang.reflect.Type` to `Class<T> clazz`? If I have one method as next which has an argument of `Class<T>`: ``` public void oneMethod(Class<T> clazz) { //Impl } ``` Then another method which has an argument of `java.lang.reflect.Type` and it calls `oneMethod(Class<T> clazz)` and for i...
2016/08/04
[ "https://Stackoverflow.com/questions/38761897", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4751165/" ]
If you are willing to use a library, you could use `com.google.guava:guava:12+`: ``` Class<?> clazz = com.google.common.reflect.TypeToken.of(type).getRawType(); ``` Alternatively you could also use `com.fasterxml.jackson.core:jackson-databind:2.8.x`: ``` Class<?> clazz = com.fasterxml.jackson.databind.type.TypeFact...
Using generic types in runtime is a little bit tricky in Java. And I think this is a root cause of your issue. 1) to be sure about generic in runtime we doing like this: ``` class MyClass<E> {} ``` and then: ``` MyClass<TargetType> genericAwaredMyClassInctance = new MyClass<TargetType>(){}; ``` **please pay atte...
72,696
Someone showed me a picture of an underwater slide from an image site a while back. This got me interested, as I love the sea. And drifting on a little current between fish sounded like heaven to me. After a little Googling, I managed to find this picture, which is in the [Atlantis Hotel](http://www.uniqhotels.com/at...
2016/07/02
[ "https://travel.stackexchange.com/questions/72696", "https://travel.stackexchange.com", "https://travel.stackexchange.com/users/36405/" ]
There's one at the [Golden nugget](http://www.goldennugget.com/lasvegas/pool_thetank.asp) in Las Vegas: ![](https://i.stack.imgur.com/YbfNq.jpg) According to this [list of waterslides](http://www.placesyoullsee.com/40-insane-waterslides-that-you-have-to-see-to-believe/), there is the Dolphin Plunge at Aquatica Sea Wo...
Atlantis in the Bahamas also has two similar attractions. Sorry, there are none that use open water since they need to control the entire experience.
977,883
How can I select the link elements of only the parent `<ul>` from a list like this? ``` <ul> <li><a href="#">Link</a></li> <li><a href="#">Link</a> <ul> <li><a href="#">Link</a></li> <li><a href="#">Link</a></li> <li><a href="#">Link</a></li> <li><a href="#">Link</a></li> <li><a href="#">Link</a...
2009/06/10
[ "https://Stackoverflow.com/questions/977883", "https://Stackoverflow.com", "https://Stackoverflow.com/users/120832/" ]
``` $("ul > li a") ``` But you would need to set a class on the root ul if you specifically want to target the outermost ul: ``` <ul class="rootlist"> ... ``` Then it's: ``` $("ul.rootlist > li a").... ``` Another way of making sure you only have the root li elements: ``` $("ul > li a").not("ul li ul a") ``` ...
You might want to try this if results still flows down to children, in many cases JQuery will still apply to children. ``` $("ul.rootlist > li > a") ``` Using this method: E > F Matches any F element that is a child of an element E. Tells JQuery to look only for explicit children. <http://www.w3.org/TR/CSS2/selecto...
4,369,457
Is there any way to deserialize in PHP an object serialized in Java? IE If I have a Java class that implements Serialization and I use an ObjectOutputStream to write the object, and convert the result to a string, is there a way in PHP to take that string and create a similar object representation from it? > > What ...
2010/12/06
[ "https://Stackoverflow.com/questions/4369457", "https://Stackoverflow.com", "https://Stackoverflow.com/users/301816/" ]
I would heavily recommend you don't do this. Java serialization is meant for a Java instance to both save and load the data (for either transmission to another Java application or persistence between invocations of the same application). It was not at all meant to be a cross-platform protocol. I would advise you to ma...
Is it possible to use one of the more common cross platform data formats like JSON to communicate between your Java app and PHP? PHP has plenty of parsers for those formats. Check out [json\_decode](http://ca.php.net/manual/en/function.json-decode.php) for an example.
2,043,982
i can't seem to find this limit $$\lim\_{(x,y)\to (0,0)} \frac{(5\cos y)(\sin y-x)}{4\left | x-\sin y \right |^{3/4}}$$ Wolfram says it doesn't exist but i don't understand why,can someone help me? Thanks a lot :)
2016/12/04
[ "https://math.stackexchange.com/questions/2043982", "https://math.stackexchange.com", "https://math.stackexchange.com/users/394364/" ]
Your main problem is why Wolfram is saying that the limit doesn't exist. Wolfram tells you this when you input your query > > lim\_({x, y}->{0, 0})(5 cos(y) (sin(y) - x))/(4 abs(x - sin(y))^(3/4)) > > > It says "Value may depend on x,y path in complex space". Wolfram thinks that x and y are complex variables not ...
How $|\frac{5}{4} \frac{\cos y(\sin y - x)}{|x- \sin y |^{3/4}}| \leq \frac{5}{4} |\frac{(\sin y - x)}{|x- \sin y |^{3/4}}| = \frac{5}{4} |x- \sin y |^{1/4} \to 0$ as $(x,y) \to 0$ and therefore $\lim\_{(x,y) \to 0}\frac{5}{4} \frac{\cos y(\sin y - x)}{|x- \sin y |^{3/4}}| = 0$. Note that in first inlequality, we use t...
21,591,734
I've got the page divided into different parts like header, footer and body. Now i need to set images on the background of header and footer. Should i choose a bigger image which can be re sized according to user's system dimension or should i keep it constant size? How to keep an image withing the section that has be...
2014/02/06
[ "https://Stackoverflow.com/questions/21591734", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3266127/" ]
i'd create separate images for the smaller devices as the smaller file sizes will help when loading on tablet or mobile. Load in the different images using media queries ``` header-bg-desktop.jpg header-bg-tablet.jpg header-bg-mobile.jpg ```
It largely depends upon your website's target audience. If you are going to target mobile, tablet and desktop all three user bases, then you must supply images for all of them with different background image code via CSS. Here is a very good reference to get you started, <http://css-tricks.com/snippets/css/media-que...
28,105,104
I have this as a string input. ``` $str = '[2]Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis vulputate cursus nulla, at rhoncus ante egestas vitae. [3]Cras euismod aliquet hendrerit. [3]Integer tortor lorem, suscipit a ante id, faucibus iaculis dolor. Sed aliquet, erat sit amet porta efficitur, eros lor...
2015/01/23
[ "https://Stackoverflow.com/questions/28105104", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4485616/" ]
In the simplest case the batch language includes a construct for this task ```dos if exist *.elf ( :: file exists - do something ) else ( :: file does not exist - do something else ) ``` where the `if exist` will test for existence of an element in the current or indicate folder that matches the indicated n...
as easy as you can think: ``` if exist *.elf echo yes ```
20,256,573
So basically, this prog reads 5 numbers: X, Y, startFrom, jump, until with space separating each number. an example: ``` 3 4 1 1 14 X = 3 Y = 4 1 = startFrom jump = 1 until = 14 ``` In order to do that, I used: ``` #get X, Y, startFrom, jump, until parameters = raw_input() parametersList = parameters....
2013/11/28
[ "https://Stackoverflow.com/questions/20256573", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2997196/" ]
My version has no `if` :) ``` parameters = raw_input() sx, sy, sstartfrom, sjump, suntil = parameters.split() x = "0123456789".index(sx) y = "0123456789".index(sy) startfrom = int(sstartfrom) jump = int(sjump) until = int(suntil) for i in range(startfrom, until+jump, jump): si = str(i) booz = sx in si or i%x =...
``` def CheckCondition(number, xOrY): return (xOrY in str(number)) or not (number % xOrY) def SomeMethod(X, Y, start, jump, end): for i in range(start, end, jump): isPassX = CheckCondition(i, X) isPassY = CheckCondition(i, Y) if isPassX and isPassY: print "BOOZ-BANG" ...
19,740
I have a pretty picture set as my desktop background, but I've lost the original file. However, my desktop is still set to this picture. How can I get back my picture?
2011/01/02
[ "https://askubuntu.com/questions/19740", "https://askubuntu.com", "https://askubuntu.com/users/880/" ]
If your image came from the internet, then I would suggest taking a Screenshot (Applications->Accessories->Take Screenshot). Then upload your screenshot to [TinEye.com](http://www.tineye.com/). On the results page select "Biggest Image" from the left hand side navigation. Then look to see if the website has found your...
In the case when you absolutely misplace a file and aren't able to get online to ask about the location of where it might be stored, always remember this... it has helped me a lot throughout the years. `CTRL` + `ALT` + `T` to get shell, then: `locate` (type file name you are looking for here, without the parentheses)...
52,278,414
I have a remote MySQL database that I am trying to connect to via my webserver. The error I get when trying to connect via `mysqli` is ``` Connection refused 2002 ``` I have invoked this command for remote connections: ``` grant all on db.* to '<user>'@'<hostname>' identified by '<password>'; ``` I'm hoping I ca...
2018/09/11
[ "https://Stackoverflow.com/questions/52278414", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4675176/" ]
Granting access to tables or databases in mysql is actually associated to a user connecting from a given host, so when you do `grant all on db.* to '<user>'@'<hostname>'` you are granting access to the user when they are connecting from "hostname" and that may be your problem. Make sure the host you are connecting from...
Have you tried to swap the host address (45.77.xx.xxx) with your host\_name? When I had the same issue (although, mine was on localhost), I changed the host IP to from 127.0.0.1 and it worked. You may want to tit to your hostname instead of the IP address.
55,903,352
I'm a beginner when it comes to MySQL and I've taken it upon myself to create a type of translating service like google translate. The problem is the querys are not being displayed the way I enter them, instead they seem to be ordered by the ID column. I've tried (with my limited knowledge) looking into different ways...
2019/04/29
[ "https://Stackoverflow.com/questions/55903352", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11426919/" ]
You can use [`FIND_IN_SET`](https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_find-in-set) ``` ORDER BY FIND_IN_SET(swedish.word, 'Hej,Mitt,Namn,Är'); ```
You can provide your way to sort the rows with CASE in ORDER BY: ``` SELECT swedish.word, german.word, german.swear, swedish.swear, swedish.id FROM swedish INNER JOIN german ON swedish.id = german.id WHERE swedish.word IN ('Hej', 'Mitt', 'Namn', 'Är') ORDER BY CASE swedish.word WHEN 'Hej' THEN 1 WHEN 'Mitt' ...
43,816,716
I'm trying to link to Buddypress groups, and I need the username of the logged in user to do this. Here is my current shortcode, which is fine, but just outputs // in the URL with no username between. ``` // Add Shortcode function my_groups_button() { ob_start(); ?> <a href="https://acaffiliates.coach/members/<?php ec...
2017/05/06
[ "https://Stackoverflow.com/questions/43816716", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1341807/" ]
You don't need the username, just the user id. ``` function my_groups_button() { ob_start(); ?> <a href="<?php echo bp_core_get_user_domain( bp_loggedin_user_id() ); ?>groups/">My Groups</a> <?php return ob_get_clean(); } add_shortcode( 'my-groups-button', 'my_groups_button' ); ```
You can use the following method to get the buddypress username inside the shortcode. ``` function my_groups_button() { ob_start(); $user_name = bp_core_get_user_displayname( bp_loggedin_user_id() ); // or bp_get_displayed_user_fullname(); ?> <a href="https://acaffiliates.coach/members/<?php echo $user_...
7,629,813
I need to run python script and be sure that it will restart after it terminates. I know that there is UNIX solution called supervisord. But unfortunately server where my script has to be run is on Windows. Do you know what tool can be useful? Thanks
2011/10/02
[ "https://Stackoverflow.com/questions/7629813", "https://Stackoverflow.com", "https://Stackoverflow.com/users/560602/" ]
Despite the big fat disclaimer [here](https://github.com/Supervisor/supervisor#supported-platforms), you can run Supervisor with [Cygwin](http://www.cygwin.com/) in Windows; it turns out that Cygwin goes a long way to simulate a Posix environment, so well that in fact supervisord runs unchanged. There is no need to lea...
[supervisor for windows](https://github.com/alexsilva/supervisor) worked for us on python27 - 32 bit. I had to install pypiwin32 and pywin32==223.
133,754
I realise that working for free would change the relationship between me and a client compared to paid work, but the end result (a quality design that helps the client make money and improve their visibility) would be the same while removing much of the time and financial pressures from both parties. My motivation wou...
2020/02/13
[ "https://graphicdesign.stackexchange.com/questions/133754", "https://graphicdesign.stackexchange.com", "https://graphicdesign.stackexchange.com/users/69252/" ]
Edit > Preferences > Tools > Text: Text size unit type : Point or Double-click on text tool icon > Text size unit type : Point.
not available on my prefs, what am I doing wrong (IS v1.1)?[![snip](https://i.stack.imgur.com/2TaNO.jpg)](https://i.stack.imgur.com/2TaNO.jpg)
7,567,701
when I run this code ``` PrincipalContext ctx = new PrincipalContext(ContextType.Domain, adHost, adRoot, ContextOptions.SimpleB...
2011/09/27
[ "https://Stackoverflow.com/questions/7567701", "https://Stackoverflow.com", "https://Stackoverflow.com/users/759196/" ]
Below is the code that works fine for a password request management system we developed in-house, do try and let me know: ``` PrincipalContext context = new PrincipalContext( ContextType.Domain, null, adAdminLogin, adAdminPassword ); UserPrincipal user = UserPrincipal.FindByIdentity( context, adUserLogin ); user.SetPa...
When the Context is created, make sure to set the `ContextOptions` to `ContextOptions.Negotiate` . If you have mentioned `ContextOptions.SimpleBind`, `SetPassword` may not work. ``` PrincipalContext oPrincipalContext = new PrincipalContext (ContextType.Domain, "Name", "DefaultOU(if required)", ContextOptions.N...
1,977,397
So I have been given this question to answer: Give a proof by cases to show that the equation $5x^2 + 4y^3 = 51$ does not have any solution $x,y \in \mathbb Z^+$ I am assuming that I could give two cases for this problem: 1. Express everything in terms of y = $((51-5x^2)/4)^{1/3}$ 2. Express everything in terms of x...
2016/10/20
[ "https://math.stackexchange.com/questions/1977397", "https://math.stackexchange.com", "https://math.stackexchange.com/users/380743/" ]
You’re making it much more complicated than necessary. If $x$ and $y$ are positive integers such that $5x^2+4y^3=51$, then certainly $4y^3<51$, and a little arithmetic quickly shows that $y$ must be $1$ or $2$: $4\cdot3^3=4\cdot27>51$. Now you have two cases, $y=1$ and $y=2$; substitute those values of $y$, solve for $...
$5x^2 \equiv 0,1 \pmod{4}$ (How?) $4y^3 \equiv0 \pmod {4}$ $\therefore 5x^2+4y^3\equiv0,1\pmod{4}$ But, $51\equiv 3 \pmod{4}$ So, there are no such positive integers (rather, integers!) $x,y$.
48,402,302
I have a form that has some radio buttons which I need some fields to be required if a radio button is checked. I have the HTML5 `required` attribute on the radio button group which works fine but I want some text fields to be required if the corresponding radio button is checked. I have written some JS which seems t...
2018/01/23
[ "https://Stackoverflow.com/questions/48402302", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4085041/" ]
You can do it like this, where you disable all inputs and then only activate the one that is selected. It requires that you have the "disabled" prop added to all child inputs at the start. I also added the ID's for the c-rail inputs. Note that the check you do does not trigger when you select another radio button, tha...
Another way to do it is using this function: ``` $('.input-radio').change(function () { $('div.reveal-if-active').children('input').removeAttr('required'); $(this).parent().children('div.reveal-if-active').children('input').attr('required', true); }); ``` and adding `class="input-radio"` to those input that ...
27,294,854
I have a problem i implement Facebook SDK in my view controller and want to get list of friends and email using Facebook. I wrote this: ``` FBLoginView *loginView = [[FBLoginView alloc] initWithReadPermissions:@[@"public_profile", @"email", @"user_friends"]]; loginView.delegate = self; ``` and then use the protocol...
2014/12/04
[ "https://Stackoverflow.com/questions/27294854", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4035448/" ]
sorry , but you can't Read `Facebook` [Permissions](https://developers.facebook.com/docs/facebook-login/permissions/v2.2) you only can get the `email` when the user login , but you can't get user's `friends email`. i am not really sure but maybe you can use "friendsusername"@facebook.com ("facebook email"). i found...
For friends with `Facebook SDK 3.0` you can do this ``` FBRequest* friendsRequest = [FBRequest requestForMyFriends]; [friendsRequest startWithCompletionHandler: ^(FBRequestConnection *connection, NSDictionary* result, NSError *error) { NSArray* fr...
8,398,419
I have a gridview in the aspx file. In the aspx.cs file I have 2 string variables which I want to display as one string in one cell in the gridview, thats no problem. The problem is that I want to have a smaller fontsize on one of the two string variables and I have to do that in the aspx.cs file, I cannot do that on t...
2011/12/06
[ "https://Stackoverflow.com/questions/8398419", "https://Stackoverflow.com", "https://Stackoverflow.com/users/655474/" ]
You could use the [jQuery validate plugin](http://docs.jquery.com/Plugins/validation) for this, but if you only want to check the validity of an email address in one field, that is a little bit of overkill. Instead, the regular expression in the function below will make sure the format of the email address is correct,...
You could use regular expressions to validate the email address in JavaScript. ``` function validateEmail(email) { var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\ ".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA -Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; return re.test(email); } `...
2,697,509
This is the jquery code for superfish menu plugin (after some revisions of mine). I'm looking to add an effect (either through superfish or adventitiously) that would cause the submenus to **slide up** on mouseout (just as they slide down when you hover a menu-top). ``` jQuery("ul.sf-menu").supersubs({ minWid...
2010/04/23
[ "https://Stackoverflow.com/questions/2697509", "https://Stackoverflow.com", "https://Stackoverflow.com/users/202895/" ]
--- However, you can make it work by hacking the code. I would submit a patch but the code development isn't hosted publicly. ``` hideSuperfishUl : function(){ var o = sf.op, not = (o.retainPath===true) ? o.$path : ''; o.retainPath = false; var $ul = $(['li.',o.hove...
Correct way to achieve task of hiding superfish same as showing: ``` hideSuperfishUl : function(){ var o = sf.op, not = (o.retainPath===true) ? o.$path : ''; o.retainPath = false; //hacked code by Farhan Wazir (Seejee) var $ul_p1 = $(['li.',o.hoverClass].join(''),this).add(this).not...
31,342,588
In order to learn riot.js I started from well-known bootstrap navbar example. Then I added my custom tag using riot.js: ``` <script type="riot/tag"> <menu-item> <li><a href={this.href}><yield/></a></li> this.href = opts.href </menu-item> </script> <script src="https://cdn.jsdelivr.net/g/riot@2.2(riot.min....
2015/07/10
[ "https://Stackoverflow.com/questions/31342588", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4941997/" ]
Your riot tag markup is inserted into your riot tag i.e. what happens is ``` ul li ``` from your working example is actually ``` ul menu-item li ``` in your non-working example. Since bootstrap styles the navigation items expecting a certain hierarchy, your result is broken. This was raised as...
Perhaps not so elegant, but in riot 2.3.13 I'm using something like this in a .tag file: ``` <menu-bar> <ul list="<yield/>"> <li each={ item in items }> <a href="http://localhost/pages/{ item }.html">{ titles[item] }</a> </li> </ul> <script> this.titles = { inventario: 'Inventario', ...
116,076
I'm in the process to move the development on Ubuntu 14.04. At the beginning everything seemed to work fine but quickly I discovered it was not. Installing new modules, by UI, Drupal stops without (displaying) any error and shows a blank page. After that, the site works undisturbed. You can go back and continue on ot...
2014/06/02
[ "https://drupal.stackexchange.com/questions/116076", "https://drupal.stackexchange.com", "https://drupal.stackexchange.com/users/27180/" ]
This could be a bug, see: * <https://bugs.launchpad.net/ubuntu/+source/php5/+bug/1315888> * <https://bugs.php.net/bug.php?id=53829> As I had the same error and after deep diving I reached to `modules/system/system.tar.inc at line 716` which calls `gzopen()`. Here the errors are suppressed using `@`. Actually its giv...
Try enabling error reporting of PHP on your application adding temporally on the index.php: ``` error_reporting(E_ALL); ini_set('display_errors', TRUE); ini_set('display_startup_errors', TRUE); ``` You could do the same by editing the same values on the php.ini. Enable error reporting on Drupal adding on the settin...
61,193,815
I am trying to do some basic group management using Azure Automation, but I'm having a heck of a time getting the script to authenticate correctly. I have added the Azure.Account modules to the runbook, and the connection seems to get established (at least, it doesn't throw an exception, and the returned object is no...
2020/04/13
[ "https://Stackoverflow.com/questions/61193815", "https://Stackoverflow.com", "https://Stackoverflow.com/users/328161/" ]
I have faced a very similar issue. You have a problem with the API permissions Azure APP has. In my case, my **azure App was working as a Service Principal**, and not only modifying some stuff in the **Azure AD**, but also some **Azure resources**, therefore, these were the api permissions that I had to grant: [![ent...
**Go to Azure portal --> Azure AD --> roles and Administrator-->Directory Readers role --> assign this role to the runbook account name**
16,187,902
Since Firefox 19, there is an internal default PDF reader "pdf.js". How can I detect whether this is the reader by default?
2013/04/24
[ "https://Stackoverflow.com/questions/16187902", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1097647/" ]
This might be what you are looking for... <http://www.pinlady.net/PluginDetect/PDFjs/>
This will test for it. I can't get to the other link due to corporate firewall. Dunno what it says. Maybe its the same. [FIDDLE HERE](http://jsfiddle.net/bWstc/) ``` <iframe src="some.pdf" id="iframe" name="iframe"></iframe> ``` . ``` // FireFox test for PDFJS to display PDFs. Works in 20 & 21. // If you don't tes...
4,229,602
I'm building a site that needs to work with browsers that support JavaScript and browsers that don't (or that have it disable). What are some good resources that explain good approaches in doing this? Any specific technologies or frameworks that handle this well?
2010/11/19
[ "https://Stackoverflow.com/questions/4229602", "https://Stackoverflow.com", "https://Stackoverflow.com/users/53183/" ]
The technique is called Progressive Enhancement, [Christian Heilmann wrote a good introduction to the subject.](http://icant.co.uk/articles/pragmatic-progressive-enhancement/)
There is a [great video presentation](http://jsconfeu.blip.tv/file/4336317/) from JSConf.eu 2010 on exactly this topic.
291,974
I took a look at my old accounting system, and it seems that performance is taking a role in the daily labor of the employees using it. So, I discovered that using a subquery was the problem, I've been reading, testing and, it seems that using a JOIN is like 100x faster as the data that we have in our Databases is huge...
2021/05/21
[ "https://dba.stackexchange.com/questions/291974", "https://dba.stackexchange.com", "https://dba.stackexchange.com/users/228193/" ]
I would not do what another Answer suggests -- it involves the "explode-implode", which is even slower. I would start by seeing if this helped much: ``` orders: INDEX(order_state, order_time) ``` Your correlated subquery is not necessarily inefficient *in this case*. (That 100X quote is based on too few examples ...
A simple way to do this would be like so: ``` SELECT ord.order_id, ord.orden_time, ord.orden_user, ord.payment_state, ord.order_state, ord.area_name, COUNT(itm.item_id) AS items_number FROM orders ord INNER JOIN order_item itm ON ord.order_id = itm.order_id WHERE ord.order_state = 1 and ord.order_time BET...
85,780
It has 46 chromosomes by default when healthy(Differences almost always are pathological) and has almost every biological functions, processes a Newborn or and Adult person has. It even invades fertile ground(womb) to survive.
2019/07/26
[ "https://biology.stackexchange.com/questions/85780", "https://biology.stackexchange.com", "https://biology.stackexchange.com/users/52803/" ]
That looks like the cast off outer layer of a dragon fly nymph§: [![Dragon fly larvae from: https://butterfliesandgardens.wordpress.com/tag/dragonfly-larvae/](https://i.stack.imgur.com/kuHxb.jpg)](https://i.stack.imgur.com/kuHxb.jpg) The following resources may be helpful to get a more precise identification: <https:/...
indeed -Exuvieae of a Anisopera dragonfly. <https://en.wikipedia.org/wiki/Exuviae>
29,554,041
I'm trying to setup a vagrant system for rails development. My vagrant version is Vagrant 1.4.2 and I have installed both the plugins vagrant-librarian-chef (0.1.4) and vagrant-vbguest (0.10.0). But when I do `vagrant up` I get the following error. > > The plugin "vagrant-vbguest" could not be found. Please make su...
2015/04/10
[ "https://Stackoverflow.com/questions/29554041", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4772231/" ]
If you don't read from the pipe, the subprocess is fairly likely to **never** terminate. The buffer between the ends of the pipe is fairly small. So, as the subprocess writes output, the buffer will fill and the subprocess will block in the `write()` call. Then you'll have deadlock. The parent process is waiting for th...
This won't work (at least not on Linux system). The file descriptor (as given by [fileno(3)](http://man7.org/linux/man-pages/man3/fileno.3.html)) of a [popen(3)](http://man7.org/linux/man-pages/man3/popen.3.html)-ed command is a [pipe(7)](http://man7.org/linux/man-pages/man7/pipe.7.html). So it is not seekable, and [f...
1,172,826
I need to export data from a SQL server 2005 DB to an Access 97 .mdb file. The client that needs it, needs it to be Access 97 because the system that they're importing it into requires Access 97 file format (don't get me started). Any suggestions how to write an old-timey Access file from SQL or .Net (or VB6 or Ruby or...
2009/07/23
[ "https://Stackoverflow.com/questions/1172826", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1385504/" ]
What you need to do is export into an Access file for whatever Access version you have installed (as long as it's 2000...2003; Access 2007 can't write to Access 97 files). I assume you already know how to do this. Then you can create an Access object via COM and ask it to convert your new .mdb file into a new Access 9...
I think it's crazy to do it from SQL Server. Just create an ODBC DSN for your SQL Server and import the tables into your Access 97 MDB and be done with it. The only reason you might want to do it otherwise is if you want to automate it and do it repeatedly, but that can be automated in Access, too (TransferDatabase can...
20,094,193
I would like to filter the papers sold within a particular range of time but i still don't know how can i insert the Date when the papers were ordered. Please see current codes ``` SELECT p.PaperID, p.PaperName,COUNT(Orders.OrderID) AS NumberOfOrders FROM Orders LEFT JOIN Papers as p ON Orders.PaperID=p.PaperID GROUP ...
2013/11/20
[ "https://Stackoverflow.com/questions/20094193", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1473914/" ]
First of all you need to sum the arrays: ``` raw_data.sum ``` This will return sth like: ``` [ {"created_at"=>"2013-11-17","number"=>0,"s_number"=>0,"l_number"=>0}, {"created_at"=>"2013-11-18","number"=>6,"s_number"=>1,"l_number"=>4}, {"created_at"=>"2013-11-19","number"=>1,"s_number"=>1...
``` output = [] raw_data.flatten.group_by {|x| x[:created_at].to_s}.each do |key, values| temp_hash = { :created_at => key.to_date } [:number, :s_number, :l_number].each do |attr| temp_hash[attr] = values.collect{|w| w[attr]}.sum end output << temp_hash end # output will contain your result ```
4,897,737
I need to change the td background to grey and text in another td when the user's mouse goes over the first mentioned td. I have done this so far: ``` <td onMouseOver="this.style.background='#f1f1f1'" onMouseOut="this.style.background='white'"> ``` but this only changes the background of the first td and does not c...
2011/02/04
[ "https://Stackoverflow.com/questions/4897737", "https://Stackoverflow.com", "https://Stackoverflow.com/users/272756/" ]
Have a look at this: ``` function highlightNext(element, color) { var next = element; do { // find next td node next = next.nextSibling; } while (next && !('nodeName' in next && next.nodeName === 'TD')); if (next) { next.style.color = color; } } function highlightBG(element, co...
You should give that other td an id and access it from your onmouseover event handler. Maybe you should put that onmouseover code into its own function and call it from the onmouseover.
8,892,360
I am using this code to convert a `Set` to a `List`: ``` Map<String, List<String>> mainMap = new HashMap<>(); for (int i=0; i < something.size(); i++) { Set<String> set = getSet(...); //returns different result each time List<String> listOfNames = new ArrayList<>(set); mainMap.put(differentKeyName, listOfNames)...
2012/01/17
[ "https://Stackoverflow.com/questions/8892360", "https://Stackoverflow.com", "https://Stackoverflow.com/users/420613/" ]
You could use this one line change: `Arrays.asList(set.toArray(new Object[set.size()]))` ``` Map<String, List> mainMap = new HashMap<String, List>(); for(int i=0; i<something.size(); i++){ Set set = getSet(...); mainMap.put(differentKeyName, Arrays.asList(set.toArray(new Object[set.size()]))); } ```
I create simple `static` method: ``` public static <U> List<U> convertSetToList(Set<U> set) { return new ArrayList<U>(set); } ``` ... or if you want to set type of List you can use: ``` public static <U, L extends List<U>> List<U> convertSetToList(Set<U> set, Class<L> clazz) throws InstantiationException, Illeg...
46,435,376
It is true that each object has its own copy of instance variables. But is it true that like static members, there is only one copy of instance methods? If yes, then where it resides in memory?
2017/09/26
[ "https://Stackoverflow.com/questions/46435376", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8465183/" ]
There only needs to be one copy of instance methods in memory. When an instance method is called there will be a "this" variable implicitly included in the stack. The "this" variable allows the instance method to access the instance variables for the object instance that called it. Classes, including their methods, wo...
Yes. Logically, a method in every instance of one class, shares one algorithm. Memory behaves in a similar way. Each object calls one method algorithm and required values are pushed to the stack temporary during the method call. Method is a set of instructions to follow, not a data structure. It should not specificall...
237,733
I've been a bad programmer because I am doing a copy and paste. An example is that everytime i connect to a database and retrieve a recordset, I will copy the previous code and edit, copy the code that sets the datagridview and edit. I am aware of the phrase code reuse, but I have not actually used it. How can i utiliz...
2008/10/26
[ "https://Stackoverflow.com/questions/237733", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26087/" ]
Put the code into a routine and call the routine whenever you want that code to be executed.
Easy: whenever you catch yourself copy-pasting code, take it out *immediately* (i.e., don't do it after you've already CP'd code several times) into a new function.
467,482
Any pointers on how I can programmatically get exactly the identical stored procedure source from SQL Server 2005, as when I right-click on that stored procedure in SQL Server Management Studio and select modify? I'm trying using SMO, but there are some textual differences. The procedure always has CREATE, not ALTER, ...
2009/01/21
[ "https://Stackoverflow.com/questions/467482", "https://Stackoverflow.com", "https://Stackoverflow.com/users/49251/" ]
``` EXEC sp_helptext 'your procedure name'; ``` This avoids the problem with INFORMATION\_SCHEMA approach wherein the stored procedure gets cut off if it is too long. Update: David writes that this isn't identical to his sproc...perhaps because it returns the lines as 'records' to preserve formatting? If you want to...
You said programmatically, right? I hope C# is ok. I know you said that you tried SMO and it didn't quite do what you wanted, so this probably won't be perfect for your request, but it will programmatically read out legit SQL statements that you could run to recreate the stored procedure. If it doesn't have the `GO` st...
14,279
If you purchase a movie bundle including multiple formats, is it legal to distribute one or more of those formats—at no cost—to varying family members and/or friends? When I say "distribute" I mean to give away the original without making copies. The verbiage from one Blu-Ray + DVD + Digital HD combo reads "Unless exp...
2016/09/29
[ "https://law.stackexchange.com/questions/14279", "https://law.stackexchange.com", "https://law.stackexchange.com/users/9269/" ]
There *was* a lawsuit Disney v Redbox in 2018 and 2019 about exactly that. [It settled.](https://www.youtube.com/watch?v=dKvdD_A8iGo) [Lawfull masses has 6 videos about the topic](https://www.youtube.com/results?search_query=lawful+masses+disney+v+redbox). In part, it did lead to Disney altering the ToS of the digital...
Video stores sell previously viewed titles without the digital download s all the time, some are even selling them separately as a unique product. In litigation, it is likely to be established that the spirit of the contractual language is intended specifically to prevent unauthorized copies of an intellectual property...
78,869
I have a coworker that primarily develops programs for internal use in the company. They design their programs in such a way that they progressively consolidate their position within the company so that they are gradually more difficult to replace. Some examples: * Don't check their code into company version control, ...
2016/11/01
[ "https://workplace.stackexchange.com/questions/78869", "https://workplace.stackexchange.com", "https://workplace.stackexchange.com/users/59396/" ]
**You need to compile a report for management.** Write a short document outlining *exactly* why the current approach is leading the company down a dangerous path (getting hit by a bus scenario, for example). Outline security risks, maybe even cite cautionary tales from within your industry, with references to articles...
It seems there are some good remedies here to prevent this in the future, but not what to do about it now. 1. Secure the computer. Either have management and an IT expert go over when it's unlocked and un-attended, or go and demand that he unlock the machine and grant access. Then get this monster off the network. Mak...
5,326,763
I have the following two Python functions: ``` @classmethod def serialize_dict(cls, d): values = [] for column_name in cls().distinguishing_column_names(): value = str(d[column_name]) if value == 'None': value = '' values.append(value) return ' '.join(values) @classmeth...
2011/03/16
[ "https://Stackoverflow.com/questions/5326763", "https://Stackoverflow.com", "https://Stackoverflow.com/users/199712/" ]
Add an `if isinstance(arg, dict)` to determine whether to treat it as a row or dict, then merge the two methods together.
You could implement the function that serialise the bit into two different lambda functions that can then used as parameters of a single serialisation method: ``` ds = lambda d , cls , column_name : str(d[column_name]) rs = lambda d , cls , column_name : str(d.value(cls()._meta.db_table, column_name)) def __serialize...
31,542,454
I have been using an Arduino Uno to connect to IoT Foundation on Bluemix. I've used both the Quickstart and the Registered devices. So far I've found that connecting to either service is intermittent. Currently I cannot connect my device (using IBM internal IP) to the quickstart. I've set this up and tested in the pa...
2015/07/21
[ "https://Stackoverflow.com/questions/31542454", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2252757/" ]
Quickstart will not respond to ping, which is why you get a timeout when pinging that hostname. Using mosquitto (<http://mosquitto.org/>) I use the following as a simple test when debugging issues like this -- are you sure your arduino isn't having networking issues as all seems fine when I connect? Make a subscript...
We have also had issues with connections and outages when working with Bluemix. Another issue we faced was with the length of messages in the suggested [MQTT library](https://github.com/256dpi/arduino-mqtt/pull/5). We ended up using ATSD instead of Bluemix for our IOT use cases with Arduino Uno devices and DHT sensors...
48,386,443
Let's say I have a file named `m1.txt`, whose contents (`- . ... - / -. --- / .----`) I want to decode from Morse to text. Here's what I have written: ``` sed -i 's/.- /A/g' m1.txt sed -i 's/-... /B/g' m1.txt sed -i 's/-.-. /C/g' m1.txt ``` and so on, including numbers, and later on: ``` sed -i 's:/ : :g' m1.txt ca...
2018/01/22
[ "https://Stackoverflow.com/questions/48386443", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5976239/" ]
Two things: 1. You need to escape `.`, since it will match any character 2. You need to consider interactions, since `.` (E) will match a single dot, it will also match the end of (N) `-.` unless you consider them in the right order or preserve the separators (on both the left and right). (1) is obvious to solve, sim...
Morse table (morse-to-char mapping): ``` $ cat morse-table.txt ## this is table of char-to-morse-code mapping ## taken from https://en.wikipedia.org/wiki/Morse_code ## dated: 2018 01 23 ## characters A .- B -... C -.-. D -.. E . F ..-. G --. H .... I .. J .--- K -.- L .-.. M -- N -. O --- P .--. Q --.- R .-. S ... T...
42,137,020
I tried to write raspbian operating system to my sdcard. I put my sdcard into sdcard reader and then tried to format it to fat32. I can not do that with microsoft windows, so I downloaded [sdformatter](https://www.sdcard.org/downloads/formatter_4/eula_windows/) and my sdcard formatted successfully. After that , I trie...
2017/02/09
[ "https://Stackoverflow.com/questions/42137020", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4284233/" ]
Given the string has the above stated format, you could use regex substitution with *backrefs*: ``` import re a = '(a,1.0),(b,6.0),(c,10.0)' a_fix = re.sub(r'\((\w+),', r"('\1',",a) ``` So you look for a pattern `(x,` (with `x` a sequence of `\w`s and you substitute it into `('x',`. The result is then: ``` # resul...
No need for regexes, if your string is in this format. ``` >>> a = '(a,1.0),(b,6.0),(c,10.0)' >>> d = dict([x.split(',') for x in a[1:-1].split('),(')]) >>> print(d) {'c': '10.0', 'a': '1.0', 'b': '6.0'} ``` We remove the first opening parantheses and last closing parantheses to get the key-value pairs by splitting ...
179,188
For an irreducible finite depth finite index subfactor $(N \subset M)$, there is a structure of fusion category given by the even part of its principal graph. The simple objects $(X\_i)\_{i \in I}$ of depth $0$ or $2$ correspond to the projections $p\_i = I\_{H\_i}$ on the $2$-boxes space $\mathcal{P}\_2(N \subset M) =...
2014/08/23
[ "https://mathoverflow.net/questions/179188", "https://mathoverflow.net", "https://mathoverflow.net/users/34538/" ]
In the formula, $tr(b)$ should be replaced by $tr(|b|)$, i.e., $\|b\|\_1$. $$b\_\alpha\*b\_\beta=\sum\_\gamma\frac{\|b\_\alpha\|\_1\|b\_\beta\|\_1\bar{c}\_{\alpha\beta}^\gamma}{\sqrt{n}\|b\_\gamma\|\_1}b\_\gamma.$$ Unfortunately the proof needs the irreducibility. I do not know how to generalize it to weak Kac algeb...
**Depth $2$ case:** Let $(N \subset M)$ be a depth $2$ irreducible subfactor of finite index $[M:N]=: \delta^{2}$. Let $\mathbb{A}:=P\_{2,+}(N \subset M)$ the finite dimensional Kac algebra. Let the inner product $(a,b) = tr(a^\*b)$ on $\mathbb{A}$ with $tr()$ the *normalized* trace. Let $(b\_i)\_i$ be an orthono...
213,940
Previous owner decided to recess the hinge plate below the previous (larger) hinge plate. While the door closes, you have to pull it closes otherwise it will "spring" back open. The door makes contact with the jamb (on the hinge side), which I believe is caused by this. I am going to go buy some new hinges, but how to...
2021/01/15
[ "https://diy.stackexchange.com/questions/213940", "https://diy.stackexchange.com", "https://diy.stackexchange.com/users/64979/" ]
Shims. Go to the local home center and get some of the (*free?*) laminate counter top samples in the kitchen cabinet section, they are about 3x5 inches. I then cut them to the same size as the hinge plate. Remove the hinge, place it on the sample and trace around it, it does not need to perfect but it should not be bi...
Cut a plug of wood to the height and width of the two mortises. Use pine and cut the depth so the plug stands slightly proud when set in the mortises. You want the mortises to be a single mortise so chisel out any partition. Cut the mortise to fit the plug. With a utility knife define the shape of the plug on the jamb...
1,876,606
I can do SELECT TOP (200) ... but why not BOTTOM (200)? Well not to get into philosophy what I mean is, how can I do the equivalent of TOP (200) but in reverse (from the bottom, like you'd expect BOTTOM to do...)?
2009/12/09
[ "https://Stackoverflow.com/questions/1876606", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18309/" ]
Logically, ``` BOTTOM (x) is all the records except TOP (n - x), where n is the count; x <= n ``` E.g. Select Bottom 1000 from Employee: In T-SQL, ``` DECLARE @bottom int, @count int SET @bottom = 1000 SET @count = (select COUNT(*) from Employee) select * from Employee emp where emp.EmployeeID not in ( SELECT...
All you need to do is reverse your `ORDER BY`. Add or remove `DESC` to it.
895,789
* CentOS 7 I have a simple Nginx proxy Docker container listening on port 80. Here is the Dockerfile: ``` FROM centos:7 MAINTAINER Brian Ogden # Not currently being used but may come in handy ARG ENVIRONMENT RUN yum -y update && \ yum clean all && \ yum -y install http://nginx.org/packages/centos/7/noarch/R...
2018/02/05
[ "https://serverfault.com/questions/895789", "https://serverfault.com", "https://serverfault.com/users/176115/" ]
Thanks to this [question and answer here](https://stackoverflow.com/questions/46264954/connection-refused-while-connecting-to-upstream-when-using-nginx-as-reverse-prox), I was able realize that I had two issues going on: 1. the containers have different default Docker networks because I am using two different docker-c...
I had this problem but my issue was that I had two folders that both had docker-compose.yml files which both had a service named 'web'. I changed the name of one of the services. **The full picture to help someone struggling with docker networks as much I was (am?):** Docker-compose projects often use nginx as revers...
3,147,905
I would like to convert a Java Object to a String containing the marshaled XML data. One of the ways I could find was to first marshal to a File and then read the file using BufferedReader to convert into a String. I feel this may not be the most efficient way, because the IO operations are performed twice (Once during...
2010/06/30
[ "https://Stackoverflow.com/questions/3147905", "https://Stackoverflow.com", "https://Stackoverflow.com/users/333125/" ]
Pass a StringWriter object as argument to [marshal method](http://java.sun.com/webservices/docs/1.6/api/javax/xml/bind/Marshaller.html#marshal%28java.lang.Object,%20java.io.Writer%29) of Marshaller
Here is the simple code by [AbacusUtil](https://github.com/landawn/AbacusUtil) ``` Account account = N.fill(Account.class); String xml = N.toXML(account); N.println(xml); // <account><id>6264304841028291043</id><gui>33acdcbe-fd5b-49</gui><emailAddress>19c1400a-97ae-43</emailAddress><firstName>67922557-8bb4-47</firstNa...
20,674,662
In eclipse, if you change a variable name, eclipse will automatically change this variable's name in whole project. Can vim do that too?
2013/12/19
[ "https://Stackoverflow.com/questions/20674662", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2038901/" ]
Sort of. Because it is not an IDE and thus doesn't understand *anything* about your code, Vim only sees text where you see a variable name. It can't infer anything from the scope or whatever. Without the use of some external program, renaming a variable in Vim is usually done with a buffer-wide or project-wide search/...
try this plugin -> [Clighter](https://github.com/bbchung/clighter), for c-family rename-refactoring. It's based on clang, but there are limitations. Still in development
5,075,893
I want to disable a screen saver to another user. How it can be done? I have administrative privileges. I have an application that can't be interrupted by the screen saver.
2011/02/22
[ "https://Stackoverflow.com/questions/5075893", "https://Stackoverflow.com", "https://Stackoverflow.com/users/627977/" ]
If you're writing the application yourself, look into calling the unmanaged API SetThreadExecutionState ([PInvoke reference](http://www.pinvoke.net/default.aspx/kernel32/SetThreadExecutionState)). Copying from my answer to [how do i prevent screen-savers and sleeps during my program execution?](https://stackoverflow.co...
[Controlling The Screen Saver With C#](http://www.codeproject.com/KB/cs/ScreenSaverControl.aspx) ``` public static class ScreenSaver { // Signatures for unmanaged calls [DllImport( "user32.dll", CharSet = CharSet.Auto )] private static extern bool SystemParametersInfo( int uAction, int uParam, ref int...
55,695,866
I'm trying to set the logo to the left and the rest of the list to the right. I tried removing it from the and adding it on it's own. it ends up behind the text even with a z-index= 2. I tried a and floated it to the left i found in another thread. still didn't work ```css * { font-family: arial, sans-serif; box...
2019/04/15
[ "https://Stackoverflow.com/questions/55695866", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9255004/" ]
I found a solution, also thanks to the one who took the trouble to read the question Code: ``` $data = 'foobar'; return datatables() ->of($query) ->addColumn('Action', function() use ($data){ return view('Actions.something', compact('data')); }) ->rawColumns(['Action']) -...
This question is the only one that shows up, when I try to google this problem. I can see that @lewis4u's problem isn't solved yet. If anyone else experience this, the following code snippet will allow you to access the model variables. ``` return datatables() ->of($query) ->addColumn('Action', function($row){ ...
31,850,824
My `angular` application is constantly changing these days because our team runs rapid updates right now. Because of cache our clients does not always have the newest version of our code. So is there a way in `angular` to force the browser to clear cache?
2015/08/06
[ "https://Stackoverflow.com/questions/31850824", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1647457/" ]
You can use a very simple solution that consist in append a hash to your scripts files. Each time your App is deployed you serve your files with a different hash automatically via a gulp/grunt task. As an example you can use [gulp-rev](https://github.com/sindresorhus/gulp-rev). I use this technique in all my projects a...
If you are looking for a really simple solution and your IDE is visual studio under C# you can get app build Id and concatenate on your js file url. First you should activate incrementation for minor versions like that: ![enter image description here](https://i.stack.imgur.com/VGeNC.png) Go to your project properties...
8,321,230
I'm trying to get a simple AS3 app up and running, and for some reason, I cannot get a sprite to show. At this point, all I want to do is get a red sprite to fill the stage. ``` public class Main extends Sprite { public function Main():void { super(); stage.scaleMode = StageScaleMode....
2011/11/30
[ "https://Stackoverflow.com/questions/8321230", "https://Stackoverflow.com", "https://Stackoverflow.com/users/119283/" ]
You need to pass `RequestContext` in render\_to\_response for `csrf_token` For this : (**views.py**) ``` from django.template import RequestContext ... return render_to_response('fileupload/upload.html', {'form': c['UploadFileForm']}, RequestContext(request)) # Added RequestContext ``` This passes the token for ...
For my case, I use AJAX to post data to my views function, then the same error happens, so the easy method to solve it is to change the data from ``` data:{ 'k':'v' } ``` To ``` data:{ 'k':'v' ,addcsrfmiddlewaretoken:'{{ csrf_token }}',} ``` because we manually add a csrf-token, so it is not missing or incorrect.
1,146,785
Consider the series $$\lim \limits\_{n \to \infty}\sum\_{i=1}^n \frac{n}{n^2+i}$$ Considering individual terms, we get $$\lim \limits\_{n \to \infty}\frac{n}{n^2+i}=\lim \limits\_{n \to \infty}\frac{1}{n+\frac{i}{n}}=0.$$ Hence the sum would be $0$. However, considering an alternative approach, we observe that $\frac...
2015/02/13
[ "https://math.stackexchange.com/questions/1146785", "https://math.stackexchange.com", "https://math.stackexchange.com/users/117913/" ]
The second solution you have is correct (although in the last step, the expression on the right side of the inequality should just be $n^2/(n^2 + 1)$). The first method is incorrect; since the number of terms of the sum varies with $n$, you cannot simply use the addition rule for limits.
Just an addition: you can get some nice asymptotics out of this sum (set $t=n^2$): $$ n \sum\_{k=0}^{n} \frac{1}{t+k} = n \bigg(\frac{1}{t} + \ldots + \frac{1}{t+n} \bigg) \\ =n \bigg(1 + \frac{1}{2} + \ldots \frac{1}{t+n} -(1+\frac{1}{2} +\ldots \frac{1}{t-1} \bigg)\\ \sim n (\log (t+n) - \log t) = n \log (1+\frac{1}{...