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 |
|---|---|---|---|---|---|
4,093 | I'm setting a document that includes some music; I'm using lilypond-book for the musical examples. However, there are some points where the author has inserted a musical symbol in the text; I'm using MusiXTeX for those bits. Notes and accidentals are easy, but I can't find a way to put in just a clef sign. For example,... | 2010/10/13 | [
"https://tex.stackexchange.com/questions/4093",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/1470/"
] | Found my own answer after help from Seamus:
```
The G sol re ut clef . . . is made thus, \begin{music}\trebleclef\end{music}.
```
That is, of course, after including `\usepackage{musixtex}` in the header. | There are various packages that allow you to include musical symbols. See p.88 *et seq.* of the [LaTeX comprehensive symbols list](http://www.tex.ac.uk/tex-archive/info/symbols/comprehensive/symbols-a4.pdf).
Weirdly, I'm not actually sure the above document contains the "clef" symbols you want. (I don't actually know ... |
66,286,464 | I am trying to test if a number is even or odd.
It works fine with numbers of 8 digits, but when ever I go over 9 digits it looks weird. The number I type in changes.
Example with 8 digits:
```
Enter the ID : 20202020
20202020 is even.
Program ended with exit code: 0
```
But when doing it with 10 digits it looks l... | 2021/02/19 | [
"https://Stackoverflow.com/questions/66286464",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15235039/"
] | This problem comes from the fact that, as everybody mentionned, you are trying to fit more information that what can be contained in a signed (32 bits) integer.
Nevertheless I feel that other answers are just kicking the can down the road, so I will provide you a solution that would also work for a **REALLY high (odd ... | Typical `int` (signed 32-bit long) can store only upto 2,147,483,647. Your input `2345678915` is beyond this.
If this is supported in your environment, you can use `long long`, which is typically 64-bit long and can store upto 9,223,372,036,854,775,807.
```
#include <stdio.h>
int main()
{
long long id;
pr... |
30,807 | I am looking for a solution to carry 2 check-in (around 50 lbs each) roller bags to airport.
Since I am alone its hard to pull both at same time.
Options I think I have:
1. Use taxi and pay him around 80bucks
2. Use option like luggage cart that can carry up to 100lbs.
3. Any other innovative idea.
In other words, I... | 2014/06/21 | [
"https://travel.stackexchange.com/questions/30807",
"https://travel.stackexchange.com",
"https://travel.stackexchange.com/users/16770/"
] | I've done this once or twice and it's generally horrible. Some tips:
* you have two hands, so you can generally handle two things, though doors and whatnot will provide a challenge. But you really can't do three. So your carry on should either be a backpack (so it doesn't use up any hands) or be strapped to one of the... | You can check with hotels near you (or with the airport) if there are shuttle buses that go to hotels on demand. You can then take a taxi just up to the airport and then the shuttle bus the rest of the way.
Another way you can do it is to only take one bag at a time, and use an airport locker to store one of the bags,... |
62,111,828 | This is my first day learning python from a book called "Automate the Boring Stuff with Python".
On the "your first program" section the program is this
```
# This program says hello and asks for my name.
print('Hello world!')
print('What is your name?') # ask for their name
myName = input("Mizu")
print('It is good ... | 2020/05/31 | [
"https://Stackoverflow.com/questions/62111828",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13651086/"
] | You are not setting $\_SESSION['username'] after your user was found in the db.
Im not a PHP expert, but you need to do something like $\_SESSION['username'] = 'xyz' i think. Besides that your select query is vunerable to sql injection.
<https://www.php.net/manual/en/security.database.sql-injection.php> | In your script there is one mistake
```
$sql="SELECT * FROM loginform where korisnickoime='".$username."'AND sifrajedan='".$password."' limit 1";
```
in this query near username `where korisnickoime='".$username."'AND sifrajedan='".$password."'` there is not space between `$username` and `AND`.
The end result of th... |
52,478,211 | I'm building my app with the **Ionic Framework**.
I'm facing a problem with the *Ionic Native HTTP plugin*, because it works only on iOS and Android platforms.
Is there an alternative to HTTP plugin that works also on Browser platform?
I use it in a straight way:
```
import { HTTP } from '@ionic-native/http';
...
... | 2018/09/24 | [
"https://Stackoverflow.com/questions/52478211",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3642532/"
] | It looks like there's a problem when there is an input inside a `menuItem`. You can do:
```
sidebar <- dashboardSidebar(
sidebarMenu(
id="tabs",
menuItem("Dashboard", tabName = "dashboard", icon = icon("dashboard")),
conditionalPanel(
"input.tabs == 'dashboard'",
sliderInput("slider", "Slide... | Below is the code which works.
```
library(shiny)
library(shinydashboard)
ui <- dashboardPage(
dashboardHeader(),
dashboardSidebar(
sidebarMenu(
menuItem("Dashboard", tabName = "dashboard", icon = icon("dashboard"),
sliderInput("slider", "Slider Input", min = 0, max = 10, step = 1, value =... |
52,614,923 | I have a webpage. Suppose I don't know that the page contains a `<p>` or any other HTML tag. The script runs in the background and when I click anywhere on the webpage if there is a corresponding HTML tag to the click then the script returns the tag with its index number.
```
<!DOCTYPE html>
<html>
<head>
... | 2018/10/02 | [
"https://Stackoverflow.com/questions/52614923",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9422949/"
] | Just use event delegation within the `on` method. <http://api.jquery.com/on/>
If you provide a selector JQuery will setup the event to fire only when an element within the parent matches that selector. In the below it grabs any element because the selector is `"*"` - this has the added benefit of providing the current... | Without jQuery you can attach an `onclick` handler to your elements like so:
```
for (let i = 0, len = document.body.children.length; i < len; i++) {
document.body.children[i].onclick = function(){
alert(i) ;
}
}
```
This will show you the index of the item on the page. |
412,256 | Can the iPhone determine if you're facing north, south, east or west? | 2009/01/05 | [
"https://Stackoverflow.com/questions/412256",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46182/"
] | This maybe a bit of a hack but what I was doing was keeping tracking of the lat/long and then determining by that the direction.
Within my code that returns the GPS information I created a delegate that would return back the latitude and longitude
```
[[self delegate] currentDirectionLat:newLocation.coordinate.latitu... | To my knowledge there is **no compass in the iPhone 3G**. Unfortunately, unless I'm missing something I don't think looking at GPS and accelerometer data will help you determine which direction the iPhone is facing - only the direction you're travelling. Sorry.
**UPDATE**: Note that the question and this post was writ... |
35,228,035 | I'm looking for any modern resources for setting up a video streaming server. Preferably open source solutions.
My searching on this has lead to a lot of dead ends. I also do need to build my own instead of paying for a service. | 2016/02/05 | [
"https://Stackoverflow.com/questions/35228035",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3609124/"
] | Use nginx mp4 module to stream videos. Limit bandwidth, concurrent connection, max buffer size and more. Use md5 key and ttl for security. | There is a site (<https://www.youphptube.com>) a it's project on github (<https://github.com/DanielnetoDotCom/YouPHPTube>) for building your own video sharing site.
I didn't digged in this project, it may or may not be cool project. |
94,591 | I can never remember the number. I need a memory rule. | 2008/09/18 | [
"https://Stackoverflow.com/questions/94591",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15054/"
] | Here's a mnemonic for remembering 2\*\*31, subtract one to get the maximum integer value.
a=1,b=2,c=3,d=4,e=5,f=6,g=7,h=8,i=9
```
Boys And Dogs Go Duck Hunting, Come Friday Ducks Hide
2 1 4 7 4 8 3 6 4 8
```
I've used the powers of two up to 18 often enough to remember them, but even ... | You will find in binary the maximum value of an Int32 is 1111111111111111111111111111111
but in ten based you will find it is 2147483647 or 2^31-1 or Int32.MaxValue |
26,018 | This question is regarding **One Piece**.
As I was going through the design of the **Thousand Sunny** on Wikia, I came across [**this**](http://onepiece.wikia.com/wiki/Thousand_Sunny?file=Thousand_sunny_boys_room.png) image of **The boys' room**, which I've posted below:
[ implicitly set a `Content-Type: JSON` header for POST requests. In my case, I forgot to allow that header causing only POSTS to fail.
```
@Bean
CorsConfigurationSource corsConfigurationSource() {
...
configuration.addAllowedHeader("Content-... |
7,344,908 | How can I make my registration fields like this

How can I achieve this via CSS?
I mean, that my textboxes should be aligned from label's end to the page's end...
EDIT
Here is my view part
```
<div id="member-search">
<h5>Last Name:</h5>
@Html.Te... | 2011/09/08 | [
"https://Stackoverflow.com/questions/7344908",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/867232/"
] | After I had to refator your HTML to properly reflect the actual rendered code, this is the best I can come up with.
HTML:
```
<div id="member-search">
<label for="member-last-name">Last Name:</label>
<input type="text" name="member-last-name" class="myInput">
</div>
<div class="clear">
<label for="member-pass">Pass... | here you go
<http://jsfiddle.net/8YAhW/>
Pay attention to the label tag and the "for" attribute. This helps when tabbing across items commonly used when making forms.
Hope this helps you out |
30,488,440 | I am using an AsyncTask to run database querying in the background.
I get this error when I run my applection.
```
05-27 16:35:13.638: I/Choreographer(3421): Skipped 53 frames! The application may be doing too much work on its main thread.
05-27 16:35:13.859: I/Choreographer(3421): Skipped 57 frames! The application... | 2015/05/27 | [
"https://Stackoverflow.com/questions/30488440",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4945552/"
] | based on your logcat, I can sense the error occurs in catch block of doinbackground function.
You are using toast in that method, toast cannot be executed in background. that should be in main thread.
So actual error is at line 189, what ever is at 189 is null. So it is going to catch and throwing another error at ... | according to your logcat, you have an error on line 189
```
Caused by: java.lang.NullPointerException 05-27 16:35:14.029: E/AndroidRuntime(3421): at com.example.iqraa.Buy$SearchBook.doInBackground(Buy.java:189) 05-27 16:35:14.029:
```
So something on that line is not initialized and your trying to access it. |
9,041,681 | I'm having a hard time finding examples for rotating an image around a specific point by a specific (often very small) angle in Python using OpenCV.
This is what I have so far, but it produces a very strange resulting image, but it is rotated somewhat:
```
def rotateImage( image, angle ):
if image != None:
... | 2012/01/27 | [
"https://Stackoverflow.com/questions/9041681",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/514086/"
] | I had issues with some of the above solutions, with getting the correct "bounding\_box" or new size of the image. Therefore here is my version
```
def rotation(image, angleInDegrees):
h, w = image.shape[:2]
img_c = (w / 2, h / 2)
rot = cv2.getRotationMatrix2D(img_c, angleInDegrees, 1)
rad = math.radi... | You need a homogenous matrix of size 2x3. First 2x2 is the rotation matrix and last column is a translation vector.
[](https://i.stack.imgur.com/VkRVA.gif)
Here's how to build your transformation matrix:
```py
# Exemple with img center point:
# angl... |
25,094,642 | I was basically playing with data types in order to learn java and here is what i am confused about.
```
double douVar = 30000000000.323262342134353;
int intVar = (int)douVar; // casting
System.out.println(intVar);
```
Now converting the `douVar` to string i overwrite the `double` variable:
```
douVar = 3458390523... | 2014/08/02 | [
"https://Stackoverflow.com/questions/25094642",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2351202/"
] | The literal **345839052304598** will be considered as an `integer` by the `compiler`, since this value is to large for an integer, a compile time error is thrown. Therefore you need to tell the compiler that the value you want to use is actually double value, that you can do the following way:
```
douVar =345839052304... | Just change `douVar = 345839052304598;` to `douVar = 345839052304598.00;` |
47,078,123 | I have the following boundary dataset for the United Kingdom, which shows all the counties:
```
library(raster)
library(sp)
library(ggplot)
# Download the data
GB <- getData('GADM', country="gbr", level=2)
```
Using the `subset` function it is really easy to filter the shapefile polygons by an attribute in the data... | 2017/11/02 | [
"https://Stackoverflow.com/questions/47078123",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7347699/"
] | You have to put name attribute on all input tags which you want send, e.g:
```
<input class="CreateAccountInput" type="text" id="Username" placeholder="Username" style="" name="username">
``` | >
> You are missing the `name` attribute in every input .
>
>
> |
28,737,292 | I wrote a script to read text file in python.
Here is the code.
```
parser = argparse.ArgumentParser(description='script')
parser.add_argument('-in', required=True, help='input file',
type=argparse.FileType('r'))
parser.add_argument('-out', required=True, help='outputfile',
type=argparse.FileType('w'))
args... | 2015/02/26 | [
"https://Stackoverflow.com/questions/28737292",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3573959/"
] | On Python3 you should use pathlib.Path features for this purpose:
```py
import pathlib as p
path = p.Path(f)
if path.exists() and path.stat().st_size > 0:
raise RuntimeError("file exists and is not empty")
```
As you see the Path object contains all the functionality needed to perform the task. | ```
def exist_and_not_empty(filepath):
try:
import pathlib as p
path = p.Path(filepath)
if '~' in filepath:
path = path.expanduser()
if not path.exists() and path.stat().st_size > 0:
return False
return True
except FileNotFoundError:
return... |
2,308,669 | The projection of the point $(11,-1,6)$ onto the plane $3x+2y-7z-51=0$ is equal to
(A) $(14,1,-1$
(B)$(4,2,-5)$
(C)$(18,2,1)$
(D) None of these
I'm exactly sure how to do this but if $(a,b,c)$ is the projection of the point then the line connecting $(a,b,c)$ and $(11,-1,6)$ must be orthgonal to the plane $3x+2y-... | 2017/06/03 | [
"https://math.stackexchange.com/questions/2308669",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/71612/"
] | The point which is foot of perpendicular on the plane and the original point itself,when joined are parallel to the normal to the plane. So you get the Dr's of the line formed by the original point and foot of perpendicular same as Dr's of normal to the plane. I.e. $(3,2,-7)$. So you can take a parametric point :
$$(a... | The plane: $f(x) = 3x + 3 y + 7 z - 51 = 0$.
The normal $\vec{N}$ to this plane : $\nabla f = (3, 2, -7)$.
Vector joining original point to projection point is parallel to the normal $\vec{N}$:
A) $\vec{v\_1} = (11, -1, 6) - (14, 1, -1) = (-3, -2, 7)$.
First time lucky, $( -3, -2, 7)$ is $(-1)(3, 2, -7)$, hence par... |
42,826,448 | I am trying to download a theme automatically on Wordpress by utilizing PhantomJS. As my script stands, the page is not evaluated until it has stopped loading, the problem is as follows:
When I try to click an element on the page, it is not yet visible because the query to their database still has to be returned. EVEN... | 2017/03/16 | [
"https://Stackoverflow.com/questions/42826448",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5893866/"
] | Try this :
```
$data = array(
array(
'contact_id' => '1',
'ib_volume' => 5,
'ib_comm' => 8),
array(
'contact_id' => '2',
'ib_volume' => 10,
'ib_comm' => 2),
array(
'contact_id' => '2',
'ib_volume' => 6,
'ib_comm' => 2),
array(
'contact_id' => '3',
'ib_volume' => 8,... | U can use `foreach`loop,like this:
```
$arr = Array
(
'0' => Array
(
'contact_id' => 458,
'contact_fullName' => 'Karla Pearson',
'contact_email' => 'karla.pearson@kp.com',
'ib_level' => 1,
'ib_volume' => 0,
'ib_comm' => 0,
'parent_ib_code' => 70770,
),
'... |
37,595,322 | Is there a code to put in the settings or a plugin that will show the total number of lines along the current line and column in the status bar in Sublime Text 3? | 2016/06/02 | [
"https://Stackoverflow.com/questions/37595322",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2319308/"
] | The code to show the number of lines in the status bar is very simple,
just get the number of lines
```py
line_count = view.rowcol(view.size())[0] + 1
```
and write the to the status bar
```py
view.set_status("line_count", "#Lines: {0}".format(line_count))
```
If you want to pack in a plugin you just need to writ... | Goto menu -> find -> find in files.
Then select regex.
use this pattern to count line including white spaces in each line-
```
^(.*)$
```
To count the number of lines excluding white spaces, use pattern
```
^.*\S+.*$
```
you can specify if you exclude some directories of file types like
```
c:\your_project_f... |
68,012,808 | I'm working on a personal project that involves a Beaglebone blue. I want to access it remotely from anywhere. I'm not sure what the best way to do this is. I know I could just forward a corresponding port (unsafe) or something along those lines but I want to avoid too many security flaws. The board controls a camera w... | 2021/06/17 | [
"https://Stackoverflow.com/questions/68012808",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4496298/"
] | There are a lot of solutions for this question. I will mention a few.
**In general your device should either:**
Have a public ip (if your infra allows it and your ISP provides this service), and then you can access it directly.
Connect to an online server using some service:
1. Using VPN. Connecting your device to ... | So let me post my comments as a coherent answer. Assuming you have a dynamic IP but otherwise unrestricted access to it from public Internet:
1. Make sure your router always gives the BB the same address in LAN
2. Install your Web UI and other stuff on BB
3. Configure SSH server on BB to accept only key-based authenti... |
6,487,649 | I’m getting a lot of errors. And I've tried several suggestion across different sites, deleted the parent function, removed the array, updated my php ini file, no luck.
This is the first of 13 errors I’m getting.
A PHP Error was encountered
Severity: Warning
Message: fsockopen() [function.fsockopen]: unable to connect... | 2011/06/27 | [
"https://Stackoverflow.com/questions/6487649",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/798060/"
] | Use a phpinfo(); statement in a .php file to check if the openssl extension actually loaded.
In your `php.ini` enable **php\_openssl**
```
extension=php_openssl.so
```
if you are on Windows, then
```
extension=php_openssl.dll
``` | Mayowa:
Perhaps I'm a little late and you already has this solved.
After searching a lot in the web I found out that for mail configuration simple quotes and double quotes is not the same.
I use the /application/config/email.php file and after many attempts I found out that this will not work:
```
$config['protocol... |
50,618,661 | I am trying to load the multibyte character with length more than 7000 char from my External Tables to SQL DW Internal tables. I have the data stores in a compressed format in BLOB Storage and External tables are pointed to the BLOB Storage Location.
External table with varchar supports till 4000 charater. is there an... | 2018/05/31 | [
"https://Stackoverflow.com/questions/50618661",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9874394/"
] | If you use PolyBase to load the data directly into the SQL DW production tables (dbo.) from the Azure Blob Storage via the linked External (ext.) tables, you should be able to get around the external table limitation.
This tutorial walks you through the process: [Tutorial: Load New York Taxicab data to Azure SQL Data... | How have you defined your database column?
The limit for a varchar is 8,000 characters, but an nvarchar is 4,000 characters. Because you're using multi-byte characters I guess you're using nvarchar.
Consider using nvarchar(max) as your target type for this column. (EDIT) As pointed out in the comments, an EXTERNAL ta... |
1,383,721 | I come across this problem in an advanced maths textbook for grade 11 in my country. And it's marked a star, which means that it's a difficult exercise, and so, no solution for this problem is given.
I can solve problems asking for which conditions do $\sin(\alpha + \beta) = \sin(\alpha) + \sin(\beta)$, and $\tan(\alp... | 2015/08/04 | [
"https://math.stackexchange.com/questions/1383721",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/49685/"
] | The following contour plots hint us why the third equation defies many attempts.
[](https://i.stack.imgur.com/C0yXP.png)
Another possible explanation is that, if we substitute $x = \tan(\alpha/2)$ and $y = \tan(\beta/2)$ then the formulas
$$ \sin \a... | Write $x=\cos\alpha$, $y=\cos\beta$, and now write $\cos(\alpha+\beta)$ in terms of just $x$ and $y$. Rearrange the terms of the equation $\cos(\alpha+\beta)=\cos\alpha+\cos\beta$ and square both sides. You should now get an equation you can use to solve for $y$ in terms of $x$. It doesn't look like the solution is goi... |
5,580 | Every time I try to hold water with a obstacle, it leaks out. Here is one example I have made.

The shape has no holes, and the water is partially contained but slowly leaks out. This has occurred every time I have tried this. What could the cause be? | 2013/12/16 | [
"https://blender.stackexchange.com/questions/5580",
"https://blender.stackexchange.com",
"https://blender.stackexchange.com/users/1165/"
] | For me it helped when I applied *Surface Thickness* to the obstacle.
[](https://i.stack.imgur.com/BV5Ad.png) | Try to apply modifiers on your obstacle, especially Solidify. Fluid seems to leak when the obstacle's geometry has to be computed on-the-fly. |
53,294,979 | Below is the versions i am using
"@types/jasmine": "^2.8.9"
"typescript": "~2.6.2"
```
"devDependencies": {
"@ionic/app-scripts": "3.2.0",
"@types/jasmine": "^2.8.9",
"@types/node": "^10.12.5",
"angular2-template-loader": "^0.6.2",
"html-loader": "^0.5.5",
"istanbul-... | 2018/11/14 | [
"https://Stackoverflow.com/questions/53294979",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4675072/"
] | You have just change typescript@2.8.4 and @types/jasmine@2.8.3
Like
1. npm install typescript@2.8.4 --save-dev
2. npm install @types/jasmine@2.8.3 --save-dev
It's working 100%.
Thanks, | If you have reached this page when you are not using Jasmine anywhere in your application, then I would suggest checking your import statements on the top of your ts file. It should have this added on the top:
```
import { ConsoleReporter } from 'jasmine';
```
I saw this accidentally added on the top when I was usin... |
336,495 | Working with Microsoft SQL Server I found extremely useful SQL Server Profiler and Estimated Execution Plan (available in Management Studio) to optimize queries during development and production system monitoring.
Are there similar tools (open source or commercial) or techniques available for MySQL? | 2008/12/03 | [
"https://Stackoverflow.com/questions/336495",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42512/"
] | You can get information about how a query will execute using [`EXPLAIN`](http://dev.mysql.com/doc/refman/5.0/en/explain.html).
For example:
```
EXPLAIN SELECT * FROM foo INNER JOIN bar WHERE foo.index = 1 AND bar.foo_id = foo.id
```
It will then tell you which indexes will be used, what order the tables will be joi... | As RoBorg suggests, you can use EXPLAIN to show the details of how MySQL will execute your query. I found [this article](http://dev.mysql.com/doc/refman/5.0/en/using-explain.html) more useful, as it tells you how to interpret the results and improve your SQL.
Also helpful are these articles on [query cache configurati... |
49,520,971 | I have installed hunspell 1.6 in python 3.5 environment using conda. When I try to import, it gives a import error.
```
ImportError: No module named 'hunspell'
```
Here is the screenshot attached.
[Hunspell Error](https://i.stack.imgur.com/KPB6B.png) | 2018/03/27 | [
"https://Stackoverflow.com/questions/49520971",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9418332/"
] | It's pages\_messaging permission, Facebook not allow it at this time. Please remove it for now until Facebook update. | You need a Login Review in your app for use 'user\_friends' permission
<https://developers.facebook.com/blog/post/2018/03/26/facebook-platform-changes/> |
32,076,963 | I've read and read and looked at examples on SO and tried to find the answer to my question but cant seem to find it but, here's the scenario to my particular problem:
**Main.php**
has a a search form up top, based on search, it posts results on left side of page with help of css.
when you click a result, based on s... | 2015/08/18 | [
"https://Stackoverflow.com/questions/32076963",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5178089/"
] | You are only getting the start and end positions for the first element, which has 21 characters. Therefore for the elements that have 20 characters you are including the closing parenthesis, thereby making `as.numeric` return `NA`.
You should change it to extract the entire column for these values:
```
start <- str... | You could run those dates through the date handler `R_json_dateStringOp` in `RJSONIO::fromJSON` after removing three zeros from the end of your string.
```
library(RJSONIO)
## create the JSON string after removing three zeros at the end of each 't'
make <- toJSON(gsub("0{3}(?=\\))", "", t, perl = TRUE))
## run it thr... |
42,198,417 | I want to delete a record from my table named post. I am sending a param named tag in my view to delete a certain record against this tag.
So here is my route
```
Route::get('/delete' , array('as' =>'delete' , 'uses' => 'Postcontroller@deletepost'));
```
by this route i am delete my post against it's 'tag' fiel... | 2017/02/13 | [
"https://Stackoverflow.com/questions/42198417",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5796642/"
] | Your action should look like this:
```
use Illuminate\Http\Request;
public function deletepost(Request $request) // add Request to get the post data
{
$tagId = $request->input('id'); // here you define $tagId by the post data you send
$post = post::find($tagId);
if ($post) {
$post->delete();
... | You have to pass the parameter for an example if you pass it like tag\_id then you have to capture it inside the controller function using Request.
```
public function deletepost(Request $request){
$post = post::find($request::get('tag_id'));
$post->delete();
echo ('record is deleted');
}
``` |
338,944 | I'm working on a JIRA implementation and need to make use of the API.
Does anyone know of an existing .NET wrapper for the JIRA SOAP API? | 2008/12/03 | [
"https://Stackoverflow.com/questions/338944",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3452/"
] | In a Visual Studio .NET project, right click the project references and choose 'Add Service Reference', enter the URL of JIRA's WSDL descriptor (<http://your_installation/rpc/soap/jiraservice-v1.wsdl>), and Visual Studio will auto-generate a .NET class for accessing the JIRA SOAP API.
The parameter names aren't partic... | As per this page <https://developer.atlassian.com/jiradev/support/archive/jira-rpc-services/creating-a-jira-soap-client/remote-api-soap-examples>, JIRA SOAP API has been deprecated, and as per this page <https://developer.atlassian.com/jiradev/latest-updates/soap-and-xml-rpc-api-deprecation-notice>, completely removed ... |
23,142,021 | When I run the following query on a table that has 22M rows it in it takes 20 seconds to run:
```
select p.*,
(select avg(close)
from endOfDayData p2
where p2.symbol = p.symbol and
p2.date between p.date - interval 6 day and p.date
) as MvgAvg_X
from endOfDayData p
where p.symbol = 'AAPL'
```
The table structure loo... | 2014/04/17 | [
"https://Stackoverflow.com/questions/23142021",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3546638/"
] | I got around this issue by executing some javascript to fill out date fields.
```
protected void FillOutDate(string cssSelector, DateTime date)
{
var js = Driver as IJavaScriptExecutor;
if (js != null) js.ExecuteScript(string.Format("$('{0}').val('{1}').change()", cssSelector,date.ToString("yyyy-MM... | I believe the input type of "date" is new to html 5 and requires a specific to the RFC 3339: <http://www.ietf.org/rfc/rfc3339.txt>
Try using 1981-01-01 and it should work. YYYY-MM-DD instead of MM/DD/YYYY as you have provided. |
25,197,480 | Thanks a lot in advance for helping me out!
```
var f2 = function() {
x = "inside f2";
};
f2();
console.log(x);
// → inside f2
```
Why do I get the x as a global variable with value "inside f2" when I didn't declare it to be a global variable with "var x;" before defining the function?
```
var f2 = function() {
... | 2014/08/08 | [
"https://Stackoverflow.com/questions/25197480",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3774341/"
] | >
> Why do I get the x as a global variable with value "inside f2" when I didn't declare it to be a global variable with "var x;" before defining the function?
>
>
>
Because the [specification](http://es5.github.io/#x11.13.1) [says so](http://es5.github.io/#x8.7.2). If you assign to an undeclared variable, a globa... | Doing `x = "inside f2"` will climb the scope chain until it hits an `x` or until the global space, where it will do property assignment on the global object.
It doesn't matter if you've *declared* `x` in the global space or not. |
33,994,046 | I am trying to set `LatLangBound` in map.When I give `SouthWest LatLang` & `NorthEast Latlang` of India, I am getting an error message that latitude of SouthWest > latitude of NorthEast (28.5827577 > 20.593684).
Is there any other way to display India regions when I start `MapFragment`.
My code snippet is.
```
priva... | 2015/11/30 | [
"https://Stackoverflow.com/questions/33994046",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5413238/"
] | For people who are upgrading their php from 7.0 to 7.4 like me, and not able to get php-redis working. These are the steps I used after following the answers above.
1) remove Redis
```
sudo apt purge php-redis
```
2) Install Igbinary
```
sudo apt-get install php-igbinary
```
3) Install php-redis again
```
sudo ... | just resolve the same problem:
php-pecl-redis installed by yum will cause this problem.
so you need to install the php-redis manually. wget the package and phpize - configure - make .... |
5,343,689 | How do you read the contents of a file into an `ArrayList<String>` in Java?
**Here are the file contents:**
```
cat
house
dog
.
.
.
``` | 2011/03/17 | [
"https://Stackoverflow.com/questions/5343689",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/618712/"
] | To share some analysis info. With a simple test how long it takes to read ~1180 lines of values.
If you need to read the data very fast, use the good old BufferedReader FileReader example. It took me ~8ms
The Scanner is much slower. Took me ~138ms
The nice Java 8 Files.lines(...) is the slowest version. Took me ~388... | Here is an entire program example:
```
import java.io.File;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.Scanner;
public class X {
public static void main(String[] args) {
File f = new File("D:/projects/eric/eclipseworkspace/testing2/usernames.txt");
try{
... |
21,448,735 | I am new to cakephp and trying to implement `AJAX` . I have a view `add.ctp` in which I have written the following lines :
```
$('#office_type').change(function(){
var office_id = $('#office_type').val();
if(office_id > 0) {
var data = office_id;
var url_to_call = "http://localhost/testpage/officename... | 2014/01/30 | [
"https://Stackoverflow.com/questions/21448735",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/729144/"
] | Could be caused by two issues:
1) In your js snippet, you are querying
`http://localhost/testpage/officenames/get_office_names_by_catagory/`.
Note the plural 'names' in `get_office_names_by_category`. In the PHP snippet, you've defined an action `get_office_name_by_catagory`. Note the singular 'name'.
2) You may ... | I think, you have specified data in wrong format:
```
$.ajax({
type: "GET",
url: url_to_call,
data = data, // i guess, here is the problem
//dataType: "json",
success: function(msg){
alert(msg);
}
});
```
To
```
$.ajax({
type: "GET",
url: url_to_call,
data: { ... |
2,437,622 | I'm practicing Jquery and I've written this simple Jquery statement:
```
var someText = $("table tr td").text();
```
Should this not return all text of td elements found within tr's that are found within tables? How do I fix this? Currently when I run this, it says that `table tr td` is null, but I have a table on t... | 2010/03/13 | [
"https://Stackoverflow.com/questions/2437622",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/205930/"
] | Python 2.7 and 3.1 have [OrderedDict](https://docs.python.org/3/library/collections.html#collections.OrderedDict) and there are pure-Python implementations for earlier Pythons.
```
from collections import OrderedDict
class LimitedSizeDict(OrderedDict):
def __init__(self, *args, **kwds):
self.size_limit = ... | There have been many good answers, but I want to point out a simple, pythonic implementation for LRU cache. It's similar to Alex Martelli's answer.
```
from collections import OrderedDict, MutableMapping
class Cache(MutableMapping):
def __init__(self, maxlen, items=None):
self._maxlen = maxlen
sel... |
19,430,868 | Can you please help me to find a expression to accept these :
```
C1D3
A1Z5R7
H2L7V5X3
```
but does not accept these :
```
A1B2A2 //Because the A repeated 2 times
C4F5F3
C2C1
B1B2F6
```
I am tring to create a expression to use it in C#.Net | 2013/10/17 | [
"https://Stackoverflow.com/questions/19430868",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/985084/"
] | In this sort of problem back-references are you're friend.
so `(.).*\1` will match a character followed by anything followed by whatever the first capture group matched | You can use this negative lookahead based rgex to avoid matching duplicate containing strings:
```
/^(?:(.)(?!.*?\1))+$/
/^(?:(.)(?!.*?\1))+$/.test('A1B2D3'); // true
/^(?:(.)(?!.*?\1))+$/.test('A1B2A3'); // false
``` |
8,920,199 | If I do the following in code for an 8-bit processor:
```
typedef union
{
unsigned long longn ;
unsigned char chars[4];
} longbytes;
```
Is `longbytes.chars[0]` always going to be the lowest byte of `longbytes.longn`, or does it depend on endianness/compiler/platform/target/luck etc.? I've viewed the disassembly of ... | 2012/01/19 | [
"https://Stackoverflow.com/questions/8920199",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/894445/"
] | There are several reasons why this is not portable:
* It depends on the endianess your platform (or compiler) enforces which byte is written first, so you can't count on `chars[0]` addressing the lowest byte
* `unsigned long` is not guaranteed to be exactly as long as `4` chars, so depending on the platform you might ... | In general, if you ever need to care about endianness you're doing something wrong, and need to work around your problem (e.g. with shifts and masks, or serialisation/de-serialisation).
For example, rather than having a union maybe you should do something like:
```
uint32_t pack(uint8_t byte0, uint8_t byte1, uint8_t ... |
7,032,743 | Is it possible to define an overloaded `operator[]` that takes more than one argument? That is, can I define `operator[]` as follows:
```
//In some class
double operator[](const int a, const int b){
return big_array[a+offset*b];}
```
and later use it like this?
```
double b=some_obj[7,3];
``` | 2011/08/11 | [
"https://Stackoverflow.com/questions/7032743",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/789750/"
] | Prior to C++23 it isn't possible. You can do this from C++23.
[From cppreference](https://en.cppreference.com/w/cpp/language/operators#Array_subscript_operator):
---------------------------------------------------------------------------------------------------
>
> Since C++23, operator[] can take more than one subs... | The better way to do that, since it doesn't lock you into creating temporaries and allows multiple arguments, is `operator()`. More details are in the [C++ FAQ](http://www.parashift.com/c++-faq/operator-overloading.html#faq-13.10). |
10,670,379 | You are given a large range [a,b] where 'a' and 'b' can be typically between 1 and 4,000,000,000 inclusive. You have to find out the XOR of all the numbers in the given range.
This problem was used in TopCoder SRM. I saw one of the solutions submitted in the match and I'm not able to figure out how its working.
Could... | 2012/05/20 | [
"https://Stackoverflow.com/questions/10670379",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1305805/"
] | I found out that the below code is also working like the solution given in the question.
May be this is little optimized but its just what I got from observing repetition like given in the accepted answer,
I would like to know / understand the mathematical proof behind the given code, like explained in the answer b... | Adding on even further to FatalError's answer, it's possible to prove (by induction) that the observed pattern in `f()` will cycle for every 4 numbers.
We're trying to prove that for every integer `k >= 0`,
```
f(4k + 1) = 1
f(4k + 2) = 4k + 3
f(4k + 3) = 0
f(4k + 4) = 4k + 4
```
where `f(n)` is `1 ^ 2 ^ ... ^ n`.
... |
2,997,264 | Sorry for this title, I didn't know how to describe it better.
**I have** the following table:
```
<tr class="row-vm">
<td>...</td>
<td>...</td>
...
</tr>
<tr class="row-details">
<td colspan="8">
<div class="vmdetail-left">
...
</div>
<div class="vmdetail-right">
... | 2010/06/08 | [
"https://Stackoverflow.com/questions/2997264",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/284318/"
] | I [found this fiddle](http://jsfiddle.net/q7VL3/) for the jQuery tablesorter in another post, worked beautifully for me!
```
<tr class="row-vm">
<td>John</td>
</tr>
<tr class="row-details expand-child">
<td colspan="6">
Detail About John
</td>
</tr>
``` | The plugin available at Datatables.net supports detail rows, though the way I use them the detail rows are opened via ajax rather than all the data always being present. But when you do sort/reorder the details stay with the main data. |
38,096,937 | How can I push another element to the `variables` property from the below object?
```
var request = {
"name": "Name",
"id": 3,
"rules":[
{
"name": "Rule name",
"tags": [
{
"tagId": 1,
"variables":[
{
"variable": "var1",... | 2016/06/29 | [
"https://Stackoverflow.com/questions/38096937",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4737546/"
] | Try like this:
```
object = {"variable": "var3", "matchType": "Regex", "value": ".*"};
request.rules[0].tags[0].variables.push(object);
``` | dot operator(.) can be used to get the value of a particular object property.
square brackets ([]) can be used to access an element of an array.
Now the answer to your question:
```
request.rules[0].tags[0].variables.push({
"variable": "var3",
"matchType": "Regex",
"value": ".*"
});
```
here, `[0]` specifies th... |
32,397,753 | I have a table with the fields:
Parent references the primary key ID in the same table (not foreign key).
```
+----+--------+------------+
| ID | Parent | Title |
+----+--------+------------+
| 1 | 0 | Wallpapers |
| 2 | 1 | Nature |
| 3 | 2 | Trees |
| 4 | 3 | Leaves |
+----... | 2015/09/04 | [
"https://Stackoverflow.com/questions/32397753",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5300603/"
] | In PHP, I wrote a function that retrieve all the hierarchy of my route table (infinite depth).
I think that, in this example, **you can see SQL syntax of query you are looking for**. I use same column names except in lowercase.
```
function get_breadcrumb($route_id) {
//access PDO mysql object instance
globa... | Use a UNION to combine the query that returns the main row with another query that returns the parent row.
```
SELECT *
FROM YourTable
WHERE Title = "Leaves"
UNION
SELECT t1.*
FROM YourTable AS t1
JOIN YourTable AS t2 ON t1.id = t2.parent
WHERE t2.Title = "Leaves")
``` |
370,156 | *This tag has been burninated. Please do not recreate it. If you need advice on which tag to use, see the answer below. If you see this tag reappearing, it may need to be blacklisted.*
---
I don't see how the [ebay](https://stackoverflow.com/questions/tagged/ebay "show questions tagged 'ebay'") tag is on topic here. ... | 2018/06/26 | [
"https://meta.stackoverflow.com/questions/370156",
"https://meta.stackoverflow.com",
"https://meta.stackoverflow.com/users/3479456/"
] | * [258 questions tagged [ebay]+[api]](https://stackoverflow.com/questions/tagged/ebay+api) can have both tags removed and [ebay-api](https://stackoverflow.com/questions/tagged/ebay-api "show questions tagged 'ebay-api'") added where missing.
* [~659 questions tagged [ebay] containing 'api'](https://stackoverflow.com/se... | There is already a widespread consensus that company-specific tags usually don't work very well on the site. For example, [the Apple and Microsoft tags were blacklisted awhile back](https://meta.stackoverflow.com/questions/284167/blacklist-the-microsoft-and-apple-tags) following a [burnination effort](https://meta.stac... |
9,374,008 | i have a database structure like this

and am trying to print the rows count
but am getting 1 only
the code am using is
```
$sql="select Count(*) from uniqueviews where hour=13"; $result=mysql_query($sql); $ml=mysql_num_rows($result); echo $ml;
`... | 2012/02/21 | [
"https://Stackoverflow.com/questions/9374008",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1196338/"
] | `Count(*)` only returns one row, containing the number of rows. That's why you get only `1` as return value. If you want the actual value, you can either do this:
```
$sql="select * from uniqueviews where hour=13";
$result=mysql_query($sql);
$ml=mysql_num_rows($result);
echo $ml;
```
or this:
```
$sql="select CO... | Num rows returned by your query is always 1, because there is only 1 record returned - record with count of rows from that select.
Replace:
```
$sql="select Count(*) from uniqueviews where hour=13";
```
With:
```
$sql="select id from uniqueviews where hour=13";
```
Then use mysql\_num\_rows.
But you should get... |
140,312 | GE seems to make two variants of their arc-fault breakers for use in their residential panels:
* [THQL1115AF](https://www.geempower.com/ecatalog/ec/EN_NA/p/THQL1115AF)
* [THQL1115AF2](https://www.geempower.com/ecatalog/ec/EN_NA/p/THQL1115AF2)
(also similar models for 20A which are THQL1120AF / THQL1120AF2).
I can't ... | 2018/06/09 | [
"https://diy.stackexchange.com/questions/140312",
"https://diy.stackexchange.com",
"https://diy.stackexchange.com/users/41781/"
] | [This forum discussion](http://www.diychatroom.com/f18/ge-thql1115af-vs-thql1115af2-561106/) includes the following statement describing the differences between the two breaker models - *which may or may not be accurate*:
>
> The ... older [THQL1115AF] AFCI breakers contain an EPD device. It's the same
> concept and... | af2 is gray with black handle and black test switch, it can share a neutral in a three wire. very difficult getting them on ebay because packages get mixed up. im not sure what a afp2 is |
2,706,776 | In solving the wave equation
$$u\_{tt} - c^2 u\_{xx} = 0$$
it is commonly 'factored'
$$u\_{tt} - c^2 u\_{xx} =
\bigg( \frac{\partial }{\partial t} - c \frac{\partial }{\partial x} \bigg)
\bigg( \frac{\partial }{\partial t} + c \frac{\partial }{\partial x} \bigg)
u = 0$$
to get
$$u(x,t) = f(x+ct) + g(x-ct).$$
**My q... | 2018/03/24 | [
"https://math.stackexchange.com/questions/2706776",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/147776/"
] | Yes, this logic is totally legitimate. In the language of linear algebra, we have two operators $A$ and $B$ and the wave equation is
$$AB \psi = 0, \quad A = \partial\_t - c \partial\_x, \quad B = \partial\_t + c \partial\_x.$$
Since $A$ and $B$ commute, they may be simultaneously diagonalized, i.e. there is a basis $\... | Let us define $$ f(u)=\frac{\partial u}{\partial t}-c\frac{\partial u}{\partial x},\ g(u)=\frac{\partial u}{\partial t}-c\frac{\partial u}{\partial x} $$
Then, wave equation can be expressed by composition of two functions.
$$ f(g(u))=g(f(u))=\frac{\partial^2 u}{\partial t^2}-c^2\frac{\partial^2 u}{\partial x^2}=0 $$... |
5,357,254 | I'm trying to profile a system with XPerf.
And see that performance problems occurs when there is activity in HardFaults !

But what I cant figure out and find in google what are these Hard Faults that xperf shows.
What are they related to?
What do they indi... | 2011/03/18 | [
"https://Stackoverflow.com/questions/5357254",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/548894/"
] | A hard fault is when a the request process private page or file backed page is not in RAM. Hard faults occur for allocations that have been paged out, but also accesses to data file and executable images.
The type of page will determine where the data data will be read from. Most hard faults are not for data from teh ... | Vaguely I remember a hard fault is when the requested virtual memory block is not in memory anymore and needs to be paged-in from the swapfile. |
92,935 | I'm connecting to the internet through a router at the moment, a Linksys WRT54G, do I need to have a software firewall set up? It seems kind of redundant if you're never going to directly connect to the modem. | 2010/01/08 | [
"https://superuser.com/questions/92935",
"https://superuser.com",
"https://superuser.com/users/20944/"
] | A software firewall on your computer can be useful because it can alert you to unexpected OUTGOING connections. A hardware firewall (because it has no user interface) pretty much has to let outgoing connections happen by default because otherwise you can't do anything with it! A software firewall can be more discerning... | I second [Michael Kohne]
Your router should by default include a firewall, if it does not then assume all ports are always open.
You dont NEED a firewall on your router but it is HIGHLY suggested that EVERY computer has a firewall of its own up and running when connected to this modem. In short your don't NEED a fire... |
34,284,036 | Let say I have 3 Activities, `Activity A`, `Activity B` and `Activity C`.
Activity A and Activity B sends an intent to activity C with let say the following code:
ActivityA sending an intent:
```
Intent i = new Intent();
i.putExtra("ListName", s);
i.setClass(ActivityA.this, ActivityC.class);
startActivity(i);
```
... | 2015/12/15 | [
"https://Stackoverflow.com/questions/34284036",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3712490/"
] | Add an extra field for class name in Intent,
```
In ActivityA,
Intent i = new Intent();
i.putExtra("ListName", s);
i.putExtra("Class","A");
i.setClass(ActivityA.this, ActivityC.class);
startActivity(i);
```
In ActivityB,
```
Intent i = new Intent();
i.putExtra("PersonName", s);
i.putExtra("Class","B");
... | You need to add one extra value to the intent with the classs name of the calling activity
```
Intent intent = new Intent();
intent.setClass(A.this,MyActivity.class);
intent.putExtra("ClassName","A");
A.this.startActivity(intent);
Intent intent = new Intent();
intent.setClass(B.this,MyActivity.class);
intent.p... |
65,305,779 | I wrote a class to share a limited number of resources (for instance network interfaces) between a larger number of threads. The resources are pooled and, if not in use, they are borrowed out to the requesting thread, which otherwise waits on a `condition_variable`.
Nothing really exotic: apart for the fancy `scoped_lo... | 2020/12/15 | [
"https://Stackoverflow.com/questions/65305779",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2140449/"
] | This error message can be very confusing and the solution can be surprisingly primitive.
In my case: Oracle stored procedure sends recordset to MS Excel via "Provider=OraOLEDB.Oracle;Data Source= ...etc" .
The problem was many decimal numbers in the Oracle data column sent to Excel 2010. When I used Oracle SQL query RO... | The system cannot find message text for message number 0x80040e0c in the message file for OraOLEDB, such error message indicates single or multiple errors like integrity constraint including null inserting into not null columns, unique constraint. I have fixed the error by redirecting such bad/incorrect records before ... |
8,499,608 | Coming from a C++ background, I religiously use the `use strict` and `use warnings` features of Perl:
```
#!/usr/bin/perl -w
use strict;
use warnings;
$foo = 1; #Throws "$foo" requires explicit package name error
foobar( 1 );
```
The `use strict` construct is immensely helpful to catch errors when you mistype a ... | 2011/12/14 | [
"https://Stackoverflow.com/questions/8499608",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/764882/"
] | Try this:
```
perl -MO=Lint -cw /path/to/script.pl
```
This uses the [B::Lint module](https://metacpan.org/pod/B::Lint). | Perl cannot possibly know at compile time that there won't be a sub to call once the sub call is reached, so `-c` cannot possibly tell you that.
[`perlcritic`](http://search.cpan.org/perldoc?perlcritic) is a tool designed to scan Perl code and *guess* at possible problems like this one. The Perl::Critic::StricterSubs ... |
33,109,236 | My college gave me a exercise:
*1. Create a new document in Jasmin*
*2. Use the AL-Register to to add 9 to 8.*
*3. Subtract 2.*
*4. Divide by 7.*
My solution is:
```
mov al,9
add al,8
sub al,2
```
But how do I divide by 7? I tried something like `div al,7` but that doesn't work. | 2015/10/13 | [
"https://Stackoverflow.com/questions/33109236",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5300594/"
] | `div` operation divides (unsigned) the value in the AX, DX:AX, or EDX:EAX registers (dividend) by the source operand (divisor) and stores the result in the AX (AH:AL), DX:AX, or EDX:EAX registers.
[source](http://x86.renejeschke.de/html/file_module_x86_id_72.html)
so, to divide value in al, you need to do:
```
mov a... | There's a `DIV` instruction [which does division](http://x86.renejeschke.de/html/file_module_x86_id_72.html), but you'll need to put the dividend into `AX` (or one of its siblings) first. |
2,713,022 | I have a project that i use at two places(i dont use git server).
When i copy the project at second place i have to check-in all the files(but they have not changed), git shows me for example
```
@@ -1,8 +1,8 @@
-#Sat Mar 06 19:39:27 CET 2010
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inli... | 2010/04/26 | [
"https://Stackoverflow.com/questions/2713022",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30453/"
] | Altough not answering your question - do not copy your git repo. Assuming you copy via USB memstick or something like that - create a third repo on the memstick (in 'bare' mode, preferrably), and sync your changes between the two computers via that repo. | I usually just [`git clone`](http://git-scm.com/docs/git-clone) stuff between computers - if you have network access to git (ie, via ssh).
You can also use a third repo, either a public one (see [github](http://github.com/) and friends) or a private one (I really like [gitosis](http://scie.nti.st/2007/11/14/hosting-gi... |
11,867 | I have three goods:
* beer
* carp (fish)
* museum ticket
Is it possible to tell anything about market structure if I have annual price data of the industries? Here's the time-series plot on a single graph:
[](https://i.stack.imgur.com/8ypWs.png)
I wo... | 2016/05/06 | [
"https://economics.stackexchange.com/questions/11867",
"https://economics.stackexchange.com",
"https://economics.stackexchange.com/users/5017/"
] | That that we have linear supply and demand functions, pretty much the simplest case such that quantity supplied of good $i$ is:
$$ Q\_{s,i,t} = \alpha\_{0,i,t} + \alpha\_{1,i,t} \cdot P\_{i,t}$$
and quantity demanded is:
$$ Q\_{d,i,t} = \beta\_{0,i,t} + \beta\_{1,i,t} \cdot P\_{i,t}$$
In equilibrium $Q\_{i,t}=Q\_{d,i,... | You cannot say anything about the underlying market structure if you only have aggregated data. This phenomenon is known as heterogeneity, and it can pose significant problems even for studies of the aggregated data itself.
But that doesn't mean your data is useless. I'm guessing IO theory stands for Industrial Organi... |
21,951,416 | I'm playing with `memcpy` in order to acquire better perception of its work and i've run into things i can't understand.
I start from very simple piece of code:
```
char str [] = "0123456789abcdef";
memcpy(str + 5, str, 5);
puts(str);// prints 0123401234abcdef
```
that's absolutely understandable for me. Then i mov... | 2014/02/22 | [
"https://Stackoverflow.com/questions/21951416",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/994107/"
] | >
> [The memcpy() function shall copy n bytes from the object pointed to by s2 into the object pointed to by s1. If copying takes place between objects that overlap, the behavior is undefined.](http://pubs.opengroup.org/onlinepubs/009695399/functions/memcpy.html)
>
>
>
`memcpy` assumes that the source and destinat... | For [**`memcpy()`**](http://en.cppreference.com/w/c/string/byte/memcpy):
>
> [...] If the objects overlap, the behavior is **undefined**.
>
>
>
You should use [**`memmove()`**](http://en.cppreference.com/w/c/string/byte/memmove) instead for overlapping cases.
>
> [...] The objects may overlap: copying takes pla... |
3,234,575 | [](https://i.stack.imgur.com/A8Ha1.jpg)
This is an exercise from Loring Tu's Introduction to Manifolds that I am stuck at. I know that a tangent bundle is trivial if it is isomorphic to the product bundle $M \times \mathbb{R}^{n}$. Here $n$ is the dimension of the (smooth of co... | 2019/05/21 | [
"https://math.stackexchange.com/questions/3234575",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/164955/"
] | On $\mathbb{R}^n$ there is the obvious basis $e\_1,e\_2,\dots,e\_n$. Since $TM\cong M\times\mathbb{R}^n$ you have the $p\mapsto e\_i$ for all $p$ defines a smooth section $X\_i$ of $TM$. The $X\_1,\dots,X\_n$ defines a frame at every point.
Conversely, if you have global frame field $X\_1,\dots,X\_n$, then for $v\in T... | If there is a smooth frame $X\_1,\dots,X\_n$, then each tangent vector $V$ is uniquely written as
$$V=v^1X\_1+\dots+v^nX^n.$$
What can you say about the map $(x,V)\mapsto(x,v^1,\dots,v^n)$? |
57,055,876 | i have a program where i post data by radio button and send it to a php page by jquery ajax function . I want to get variable data from this page so that i can use it in my page from where i send the data . can anyone help me
```
<script type="text/javascript">
function getDesign() {
var radioValue = $("input[nam... | 2019/07/16 | [
"https://Stackoverflow.com/questions/57055876",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11785768/"
] | Use `dataType` option to accept the response in `JSON` format.
```
<script type="text/javascript">
function getDesign() {
var radioValue = $("input[name='metal']:checked").val();
$.ajax({
type: "POST",
dataType: "json",
url: "<?php echo SITE_URL; ?>image_filter.php",
data: {
... | You can return json in PHP this way:
```
<?php
$metal = $_POST['metal'];
$finish = $_POST['finish'];
header('Content-Type: application/json');
$json = json_encode(array("metal"=>$metal));
echo $json;
exit;
?>
``` |
16,202 | I am trying to teach myself to create music. I know it is not a learned behavior and is rather a skill dependent process, but the basics have to be learned and that is where I am stuck. I play some piano, beginner level and has some knowledge of Indian classical music - Carnatic.
What I am finding difficult is to choo... | 2014/03/18 | [
"https://music.stackexchange.com/questions/16202",
"https://music.stackexchange.com",
"https://music.stackexchange.com/users/9269/"
] | One helpful starting point, though you may need to gather some further information to fully comprehend and apply:
Within a given key, all notes of the scale can be harmonized by one of three chords while giving a functional harmony. These 3 chords would be the I, IV and V chords of the scale.
We can use C Major as an... | If you are trying to find the chords to play a specific song (as opposed to playing/improvising a new melody), here is a much simpler approach. Given that I, IV and V chords often work for most melodies, it is far easier to apply this same idea in the following manner: play the root notes at 1, 3 or 5 note intervals BE... |
136,036 | I've got two points which I need to create a bounding box with, and then check to see if points are within this bounding box. The end result is a marquee selection tool.
So, here is the code I started with:
```
var v1 = Camera.main.ScreenToViewportPoint( screenPosition1 );
var v2 = Camera.main.ScreenToViewpor... | 2017/01/19 | [
"https://gamedev.stackexchange.com/questions/136036",
"https://gamedev.stackexchange.com",
"https://gamedev.stackexchange.com/users/96577/"
] | This is an X/Y problem. You want to select something on the screen, right? So do things in screen space.
Get your point in the world in question `p_w`. Project it onto the screen giving `p_s` in pixels. Then check a pixel rectangle on the screen to see if it contains `p_s`. Easy right?
Here's some pseudocode.
```
//... | From my understanding of your problem, building a selection marque function, you would follow this approach
1. Project test points p0, p1, ... to viewport space (or some surface) that is facing the camera.
2. Get viewport space (or surface) coordinates of two mouse points. These form the bounding box for selection mar... |
17,910,866 | I've found that when a toplevel widget calls a messagebox dialog (like "showinfo"), the root window is showed up, over the toplevel. Is there a way to set the Toplevel window as the master of the messagebox dialog ?
Here is a script to reproduce this :
```
# -*- coding:utf-8 -*-
# PYTHON 3 ONLY
from tkinter import *... | 2013/07/28 | [
"https://Stackoverflow.com/questions/17910866",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2455658/"
] | This may address more current versions.
```
#TEST AREA forcommands/methods/options/attributes
#standard set up header code 2
from tkinter import *
from tkinter import messagebox
root = Tk()
root.attributes('-fullscreen', True)
root.configure(background='white')
scrW = root.winfo_screenwidth()
scrH = root.winfo_screen... | add `topWindow.attributes("-topmost", 1)`
after defining the Toplevel, and this should fix the problem |
66,000,070 | Could someone please explain what is wrong? and how to fix it.
**Class 'Result' has no instance getter 'length'.
Receiver: Instance of 'Result'
Tried calling: length**
i have fetched some data from an API successfully. when i passed this data to promotions\_page.dart
i get this error i know i am doing something wron... | 2021/02/01 | [
"https://Stackoverflow.com/questions/66000070",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2524657/"
] | read your code out loud.
If funcp has class unhidden-pr, add class hidden-pr and if funcp has class hidden-pr add unhidden-pr.
So you really should be using an `else if` or just `else`. You also are not removing the class.
```js
function bt1Func() {
if ($("#funcp").hasClass('unhidden-pr')) {
$("#funcp").addCla... | You can use if-else , along with add/RemoveClass
```
function bt1Func() {
if ($("#funcp").hasClass('unhidden-pr')) {
$("#funcp").removeClass("unhidden-pr");
$("#funcp").addClass("hidden-pr");
}
else if ($("#funcp").hasClass("hidden-pr")) {
$("#f... |
3,251 | We are in a situation where we need to choose between **ballet classes** and **swimming classes** for our 4-year old girl. Problem is that we cannot afford both of them. We need to choose one.
On the other hand, she loves and asks for both. She has been having swimming lessons since the age of 6 months but she hasn't ... | 2011/10/26 | [
"https://parenting.stackexchange.com/questions/3251",
"https://parenting.stackexchange.com",
"https://parenting.stackexchange.com/users/1666/"
] | In reality I think it's going to be up to you to know for sure what works best for yourself and your child. There are probably alternatives to many of these, but if cost is an issue and you look for cheaper alternatives you do tend to get what you pay for. Some of the things I've heard about ballet (my cousin was a bal... | My youngest also likes both activities, but what decided us was that ballet was so much more expensive than swimming.
She now does swimming, and is on the waiting list for Tae Kwondo (this is just because her siblings both compete in TKD so it makes sense to get them all in - less journeys)
For us it comes down to co... |
2,601,321 | I've got a conjecture:-
If $k$ is a natural number, then either $6k+1$ or $6k-1$ is a prime number.
Is this true? | 2018/01/11 | [
"https://math.stackexchange.com/questions/2601321",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/517484/"
] | No it is not, say $120+1 = 11 ^2$ and $120-1 = 7\cdot 17$ | According to elementary number theory, however, you can represent every prime number in the form $6k\pm1$ so your conjecture I would say is close to true however it does not mean that every number of the form $6k\pm1$ is a prime.
This, however, holds true only for all primes $\gt3$. That is $2$ and $3$ are not writt... |
15,242,241 | I have a database in which there is a row containing the images. Now in my code, I want to get images out of the database, but somehow I am unable to do it. Following is my code – kindly help me out –:
```
<?php
$qry = mysql_query("SELECT * FROM products ORDER BY products.id DESC LIMIT 0, 1", $con);
if (!$qry)
{
... | 2013/03/06 | [
"https://Stackoverflow.com/questions/15242241",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Try changing,
```
echo "<img src=".'Image/'.$row['image']." />";
```
to
```
echo "<img src='Image/".$row['image']."' />";
``` | try this
```
while($row=mysql_fetch_array($qry))
{
$title = $row['title'];
$src = $row['image'];
$whatever = $row['body'];
echo "$title <br/><img src="$src" alt="my fancy photo" height="" width=""/><br/>$watever";
}
``` |
56,604,354 | i have the domain www.abc.com registered and forwarded via DNS-A-Record to my vServer 111.222.333.444 running CentOS 7.
I have a jar-File containing a fully working Spring-Boot Application answering REST Calls on Port 8080.
The Problem is, whatever I do, i can't manage to make it work.
I want to do this:
www.abc.co... | 2019/06/14 | [
"https://Stackoverflow.com/questions/56604354",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11649738/"
] | Thanks for this. I tried following the latest instructions.
Following the instructions at
<https://github.com/apple/tensorflow_macos>
In the Terminal on a new Mac M1:
```
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/apple/tensorflow_macos/master/scripts/download__install.sh)"
```
Confirm y/N? y
Inst... | Emmmm, actually is quite easy, though the tensorflow 2.0 is still in experimental stage. It is better to install the `preview version` in a virtual environment with anaconda, now the following is a Linux example:
```
$ conda create --name tensorflow_2_0
$ conda activate tensorflow_2_0
$ pip install tf-nightly-2.0-prev... |
195,459 | My patio flooring has a paint-like texture on it that is chipping off. The base is concrete. I have tried scraping, but it's incredibly tedious to get up and is taking hours of work. Is there some sort of chemical or solution I can use to help the paint/texture lift easier? | 2020/06/17 | [
"https://diy.stackexchange.com/questions/195459",
"https://diy.stackexchange.com",
"https://diy.stackexchange.com/users/118087/"
] | You say "paint-like" texture. Are you sure it's paint?
If it's paint, any sort of chemical paint stripper should do the trick. There are quite a number of more "friendly" "citrus" or "orange" based paint strippers that don't have the smell and toxic concerns of paint strippers of the past.
I presume a patio is outdoo... | Your patio flooring has been painted over top of concrete.
The problem is, when you do that, the surface tends to become impossibly slick - it's not so bad *bone dry*, but get a drop of oil and some condensation, the oil will spread all over and the water will multiply with it to make the the surface **shockingly slic... |
33,308,674 | Error message is:
>
> '\_djv.Authenticator' does not contain a definition for 'authenticate'
> and no extension method 'authenticate' accepting a first argument of
> type '\_djv.Authenticator' could be found (are you missing a using
> directive or an assembly reference?) my code is below, I have a
> console app ... | 2015/10/23 | [
"https://Stackoverflow.com/questions/33308674",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5475424/"
] | There is a clash of class names. Your `auth` variable refers to the class inside `_djv` namespace. Specify the full name of the class to be able to use it.
```
var auth = new _Authenticator.Authenticator();
```
Alternatively, you can create an alias for the class. I'd recommend this approach here as it makes writing... | You have two classes called `Authenticator`. If you don't specify the namespace explicitly, the class in the current namespace will be used (which is the wrong one in this case).
You can solve it either by:
1. Explicitly create an instance of the right class
`var auth = new _Authenticator.Authenticator()`
2. Rename ... |
182,447 | I'm writing a code to evaluate if the *Cauchy-Riemann conditions* are satisfied for a given function. For example, for the function `f[z]=Conjugate[E^(z)]` it has to evaluate this expression below
```
Boole[E^x Cos[y] == -E^x Cos[y]]
```
But it doesn't give a zero output. It just holds unevaluated.
I don't understan... | 2018/09/24 | [
"https://mathematica.stackexchange.com/questions/182447",
"https://mathematica.stackexchange.com",
"https://mathematica.stackexchange.com/users/58552/"
] | I think the answer is that in general this expression can either be true or false, depending on values of `y`. When `Cos[y]==0`the expression is true.
i.e. Try `Boole[Simplify[E^x Cos[y] == -E^x Cos[y], 0 < y < \[Pi]/2]]` | Because it is `SameQ (===)` that guarantees a binary outcome of `True` and `False`, rather than `Equal (==)`.
```
Boole[E^x Cos[y] === -E^x Cos[y]]
```
>
>
> ```
> 0
>
> ```
>
> |
29,373,833 | I'm using v2.0 of the API via the C# dll. **But this problem also happens when I pass a Query String to the v2.0 API** via <https://rally1.rallydev.com/slm/doc/webservice/>
I'm querying at the Artifact level because I need both Defects and Stories. I tried to see what kind of query string the Rally front end is using,... | 2015/03/31 | [
"https://Stackoverflow.com/questions/29373833",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/202963/"
] | In addition to the other two answers, here is a real usecase that calls for such a named inner struct:
```
struct LinkedList {
//data members stored once per list
struct LinkedListNode {
//data members for each entry of the list
struct LinkedListNode *next;
} *head, *tail;
};
```
Its hard... | Well, this is legal in C:
```
struct BatteryStatus_st {
int capacity;
int load;
};
struct Robot_st {
int pos_x;
int pos_y;
struct BatteryStatus_st battery;
};
```
and, as you pointed out, it is effectively identical to the code you posted (since C doesn't have the namespace/scoping rules introdu... |
24,164 | I was over at a friend's house and her roommate complained of computer troubles. A standard Dell laptop running Vista. When plugged into the internet (no router) both IE and Firefox would refuse to work. However, a simple
```
ping www.google.com
```
worked flawlessly. Any ideas? | 2009/08/18 | [
"https://superuser.com/questions/24164",
"https://superuser.com",
"https://superuser.com/users/5657/"
] | Third step after successful pinging a machine and having already checked the proxy settings of the browser (don't forget to check how they are set at the machine where it does work) would be to actually trying to connect on the correct port with telnet. You don't need to understand the protocol, usually it's enough to ... | @Zefiro above wrote good solution but it could be a bit better formulated. From above description (ping is working, web browsing is not working), following can be concluded:
1. DNS is working (resolving of www.google.com to 208.117.229.182 or something similar)
2. your PC is connected to internet
To reconfirm above, ... |
1,410,954 | I have what I'm sure is a fairly common issue, and I don't want to re-invent the wheel.
I have a search form where users can specify search criteria and type of search (AND OR Ext..).
The form passes back id's that map to column names and values. Currently, I'm using server side Java to glue the strings together into... | 2009/09/11 | [
"https://Stackoverflow.com/questions/1410954",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/150598/"
] | I'd use prepare and ? for parameters anyway, if only to avoid injection and other misconversion risks.
If your search criteria are limited in size, you can statically list all possible queries to prepare.
If not, you can maintain a pool of prepared queries dynamically. This is not as useful for a web app, where you p... | The book "Expert SQL Server 2005 Development" by Adam Machanic has some excellent suggestions in chapter 7 concerning dynamic SQL. He dives into all kinds of issues including performance, maintainability, and security. I won't attempt to rewrite his chapter - suffice to say that he believes less is more when it comes t... |
65,044,768 | I'm having problems with mobx and radiobox: screen don't update when selected. I think it's a silly mistake, here are my main.dart, teste\_store.dart and pubspec.yaml. The partial file .g was generated with build\_runner and mobx\_codegen.
A message appears when I run it: "No observables detected in the build method o... | 2020/11/27 | [
"https://Stackoverflow.com/questions/65044768",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14671052/"
] | Cypress command [cy.intercept](https://on.cypress.io/intercept) has the
`times` parameter that you can use to create intercepts that only are used N times. In your case it would be
```js
cy.intercept('http://localhost:4200/testcall', {
fixture: 'example.json',
times: 1
});
...
cy.intercept('http://localhost:4200... | ```
const requestsCache = {};
export function reIntercept(type: 'GET' | 'POST' | 'PUT' | 'DELETE', url, options: StaticResponse) {
requestsCache[type + url] = options;
cy.intercept(type, url, req => req.reply(res => {
console.log(url, ' => ', requestsCache[type + url].fixture);
return res.send(r... |
32,064,961 | I had following code
```
public interface IFoo
{
void Execute();
}
public abstract class FooBar: IFoo
{
public void Execute()
{
OnExecute();
}
public abstract void OnExecute();
}
```
and following test case to test the `Execute()` method
```
[Fact]
public void When_execute_method_c... | 2015/08/18 | [
"https://Stackoverflow.com/questions/32064961",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1139856/"
] | The difference is due to the overrideability of the method `Execute` on `FooBar`.
FakeItEasy [can only override virtual members, abstract members, or interface members](https://fakeiteasy.readthedocs.io/en/stable/what-can-be-faked/#what-members-can-be-overridden).
In your original example, when `IFooBar` is an interfa... | Following addition help solve the issue
```
A.CallTo(() => sutMethod.Execute()).CallsBaseMethod();
```
This calls the virtual method `Execute`of `FooBar` |
430,241 | Like in the title, is it possible. I was thinking about that last year but everybody told me that it's not possible due to controller issues. Today I revisited that idea after seeing awesome vids on youtube running two ssd in raid 0. I'm running 2xhdd in raid 0 and I'm wondering wether to change 2x64gb sdd raid 0 for s... | 2012/05/29 | [
"https://superuser.com/questions/430241",
"https://superuser.com",
"https://superuser.com/users/100218/"
] | Under Cygwin, `/var/empty` must be owned **by the user running `sshd`**. (Unless you disable privilege separation!)
From [a helpful email to the Cygwin mailing list in 2012 by Corinna Vinschen](https://www.cygwin.com/ml/cygwin/2012-04/msg00525.html)
>
> Usually sshd tests if /var/empty is owned by uid 0. On Cygwin, ... | In my case I had a conflict with another service. I installed Bitvise trial to try out hosting a SSH server.
When I installed Cygwin OpenSSH, I need to shutdown Bitvise service to be able to start up Cygwin sshd. |
1,813,649 | How do you know how many developers were involved in a project using a Revision Control System? A friend of mine found this way to look up the answer in git log:
```
git log | grep Author: | sort -u | cut –delimiter=” ” -f2 | sort -u | wc -l
```
Is there a straightforward way in git? How about other Revision Contro... | 2009/11/28 | [
"https://Stackoverflow.com/questions/1813649",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/157519/"
] | git
---
The [`shortlog`](http://www.kernel.org/pub/software/scm/git/docs/git-shortlog.html) command is very useful. This summarizes the typical `git-log` output.
```
$ git shortlog -sn
119 tsaleh
113 Joe Ferris
70 Ryan McGeary
45 Tammer Saleh
45 Dan Croak
19 Matt Jankowski
...
```
Pa... | There is stats plugin for Bazaar to get different info about project contributors:
<https://launchpad.net/bzr-stats/> |
41,851,227 | I have a navigation that looks like this:
```
<ul>
<li><a href="index.html#open-site">Test</a></li>
<li><a href="#open-site">Test</a></li>
<li><a href="test.html#open-site">Test</a></li>
</ul>
```
When i click on #open-site, a show up.
If im on index.html and i click as an example on the second link with... | 2017/01/25 | [
"https://Stackoverflow.com/questions/41851227",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3660653/"
] | Another way of doing it
```
declare @sDate datetime
declare @eDate datetime
SET @sDate = '2017-01-01'
SET @eDate = '2017-01-31'
--A recursive CTE for fetching the weeks range
;WITH CTE AS
(
SELECT @sDate SDATE
, DATEADD(DD,6,@sDate) AS TO_DTE
UNION ALL
SELECT DATEADD(DD,1,TO_DTE)
, CASE ... | Maybe you can use `UNION ALL` instead of just `UNION`. |
21,833,537 | I'm reading about the new features at: <http://www.javaworld.com/article/2078836/java-se/love-and-hate-for-java-8.html>
I saw the example below:
**Using Anonymous Class:**
```
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
System.out.println("Action Detected... | 2014/02/17 | [
"https://Stackoverflow.com/questions/21833537",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1688441/"
] | You can use multi-method interfaces with lambdas by using helper interfaces. This works with such listener interfaces where the implementations of unwanted methods are trivial (i.e. we can just do what `MouseAdapter` offers too):
```
// note the absence of mouseClicked…
interface ClickedListener extends MouseListener
... | I created adapter classes that allow me to write (single-line) lambda-function listeners, even if the original listener interface contains more than one method.
Note the InsertOrRemoveUpdate adapter, which collapses 2 events into one.
My original class also contained implementations for WindowFocusListener, TableMode... |
11,080,815 | I have installed *jdk 1.7* in `C:\jdk1.7.0 directory` and *JCreator* in `C:\Program Files directory`. I set the path of correct jdk path in JCreator. But when I try to execute a java program in this I have shown the following messages:
```
--------------------Configuration: <Default>--------------------
Err... | 2012/06/18 | [
"https://Stackoverflow.com/questions/11080815",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | The error shows up when the following executable does not exist.
```
C:\Program Files\Java\jdk1.7.0_04\bin\javac.exe
```
Make sure that you have the `jdk` executable installed. | ```
Error : Invalid path, "C:\Program Files\bin\javac.exe" -g -classpath
"C:\Users\HP PAVILION\Desktop\java" -d "C:\Users\HP PAVILION\Desktop\java"
"C:\Users\HP PAVILION\Desktop\java\das.java"
```
Process completed.
**Error:** Could not find or load main class das
Process completed. |
16,743,966 | Is there any difference between the two following statements. They achieve the same end, correct? Do they compile to the same Java code? Is there any performance difference between them or is it just a matter of preference/readability?
```
for (thing <- things) {
doSome(thing)
}
things.foreach(
thing =>
doS... | 2013/05/24 | [
"https://Stackoverflow.com/questions/16743966",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1906491/"
] | `for` comprehensions are defined as simple syntactic translations. That's extremely important, because that allows *any* object to work with `for` comprehensions, it just has to implement the right methods.
IOW: the Scala Language Specification says that the first snippet gets translated into the second. So, if there ... | Per [scala-lang.org](http://docs.scala-lang.org/overviews/collections/iterators.html):
>
> As always, for-expressions can be used as an alternate syntax for expressions involving foreach, map, withFilter, and flatMap, so yet another way to print all elements returned by an iterator would be:
>
>
> for (elem <- it) ... |
3,812,641 | Having just moved from textmate to vim I'm curious. To be able to navigate my project efficiently I've installed command-t and ack.vim. These both seem like relatively new projects in the history of vim. What do people traditionally do to move around a project when they work in vim, do they just use the file explorer o... | 2010/09/28 | [
"https://Stackoverflow.com/questions/3812641",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/162337/"
] | I set `path` properly then use `find` for most things. Sometimes I just rely on the tags. The tags allow tab-completion, but find does not.
in my vimrc:
```
set path=src/**;c:/work,scripts/**;c:/work
```
then
```
:find foobar.cpp
```
Will turn up foobar.cpp if it exists under a src/ folder somewhere around my cu... | What I'm using generally:
1. For opening new files: `:e` with tab-completion, or `:Ex` (open explorer in the directory of current file).
2. For jumping between files in the buffer list (`:ls`): the taglist plugin, or `:b` and its tab-completion. Note that for `:b`, tab-completion works for substrings. For example, if ... |
12,087,510 | In my splash screen, I want to check if the phone has a SDCard. The Boolean statement is beneath:
```
Boolean isSDPresent = android.os.Environment.getExternalStorageState()
.equals(android.os.Environment.MEDIA_MOUNTED );
```
So, if I have the SDCard in the slot on my phone, this boolean will return t... | 2012/08/23 | [
"https://Stackoverflow.com/questions/12087510",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/835585/"
] | I've found that phones, like the Galaxy phones from Samsung, have `/mnt/sdcard` point to internal memory and not the external SD card as expected.
You can know if the path returned by [Environment.getExternalStorageDirectory()](http://developer.android.com/reference/android/os/Environment.html#getExternalStorageDirec... | I modificated that if sd card exists, sets the path there
if not sets it at the internal directory
```
Boolean isSDPresent = android.os.Environment.getExternalStorageState().equals(android.os.Environment.MEDIA_MOUNTED);
if(isSDPresent)
{
path = theAct.getExternalCacheDir().getAbsolutePath() + "/Gramm... |
193,276 | What happens if the load on the electrical generator exceeds its power generation? and why?
To be more precise, suppose we have a standard induction generator operating at frequency $\nu=50\:\mathrm{Hz}$ and voltage $V\_0$, and rated to produce a maximum power $P\_0$, and that we connect this to a load $R<V\_0^2/P\_0$... | 2015/07/09 | [
"https://physics.stackexchange.com/questions/193276",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/44026/"
] | As the current drawn by the load increases the torque opposing the motion of the prime mover on its coils increase. This opposing torque is a result of the force acting on the coil since it's a current carrying conductor moving in a magnetic field. Hence its rpm reduces and so does its voltage output. | If the generator's power source exceeds the generator's capacity, and if a load is placed on the generator that also exceeds the generator's capacity, and if all safety devices are disabled; the generator would heated up to a point where the weakest link would burn out like a fuse and thus remove the electrical load. |
31,745,942 | I am trying to write to a text document with a specific format. Here's what I have right now.
```
String line = "";
double totalCost = 0;
Node curr = summary.head.next;
while(curr!=summary.tail)
{
line += [an assortment of strings and variables] +"\r";
totalCost += PRICELIST.get(cu... | 2015/07/31 | [
"https://Stackoverflow.com/questions/31745942",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3809907/"
] | First of all don't use
```
while(..){
result += newString
..
}
```
inside loop. This is very inefficient especially for long texts because each time you call
```
result += newString
```
you are creating new String which needs to copy content of `result` and append to it `newStrint`. So the more text you... | You can also try to use `\n\r` in combination. This helped in one of my projects. |
61,304,483 | I want to change header image every time when I click on the link but my default image comes back every time
I have 2 header file one is for `index.php` and one for all other links
```
<script>
function _(x){
return document.getElementById(x);
}
function changeimage(x,imgsrc){
_(x).src= imgsrc;
}
</script>
... | 2020/04/19 | [
"https://Stackoverflow.com/questions/61304483",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8022721/"
] | Your description of the problem looks like `UNION` to me.
```
SELECT ID_Entity, [timestamp], 'Task1' AS Task, [ID_Task1] AS TaskID
FROM Task1
WHERE ID_Entity = 1
UNION ALL
SELECT ID_Entity, [timestamp], 'Task2' AS Task, [ID_Task2] AS TaskID
FROM Task2
WHERE ID_Entity = 1
UNION ALL
SELECT ID_Entity, [timestamp],... | You should write a recursive query for this |
4,694,201 | I am tired of writing `x > min && x < max` so i wawnt to write a simple function but I am not sure if I am doing it right... actually I am not cuz I get an error:
```
bool inBetween<T>(T x, T min, T max) where T:IComparable
{
return (x > min && x < max);
}
```
errors:
```
Operator '>' cannot be... | 2011/01/14 | [
"https://Stackoverflow.com/questions/4694201",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/171136/"
] | ```
return x.CompareTo(min) > 0 && x.CompareTo(max) < 0;
```
If you're going for maximum readability, you could use an extension method on `IComparable<T>`, and create a syntax like:
```
return 5.IsBetween(10).and(20);
```
or
```
return 5.IsBetween(10.and(20));
```
Here is an implementation for the second examp... | You can try adding a constraint that T is an IComparable, and then using CompareTo instead of < and >.
But this probably won't let you send all the value types you may want to. In that case, just create the overloads you need, without generics. |
6,313,217 | I am currently trying to write a PHP script to connect to an Oracle database. The reason I am using PHP is because I need to connect the Oracle database with my current CRM system, written in PHP/MySQL.
The PHP is hosted on 1&1 hosting, which is an external server. I read that I need to enable the extension php\_oci8... | 2011/06/11 | [
"https://Stackoverflow.com/questions/6313217",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/793528/"
] | 1) 1&1 will have Linux, so you will have to use linux names for extensions. In this case name of extension will be `php_oci8.so`
2) create the `php.ini` in root directory and put the following line
`extension=php_oci8.so`
3) create a simple php script with one line to test if it works:
`<?php phpinfo(); ?>`
Please n... | According to your problem. first thing is that linux doesn't support .dll file.
You have to install OCI8 extension module in your Apache server.
Follow this link to get easy solution.
<http://coffeewithcode.com/2012/09/how-to-install-oracle-libraries-for-php5-on-ubuntu-server/> |
73,913,635 | I have a `<TextBlock x:Key="_tb1"/>` and another `<TextBlock x:Key="_tb2"/>`.
How to set visibility of \_tb1 when for exemple `IsMouseOver` of \_tb2 is true ? | 2022/09/30 | [
"https://Stackoverflow.com/questions/73913635",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10220629/"
] | You can use [melt](https://pandas.pydata.org/docs/reference/api/pandas.melt.html) and [merge](https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.merge.html) for this.
If you care about the order of the output, you could add `how='left'` to the merge function.
```
import pandas as pd
df1 = pd.DataFrame({'na... | Another way you can do with apply-lambda.. with if condition... But chris's way is better one...
```
df1 = pd.DataFrame({"name":["fish","pork","apple"]})
df2 = pd.DataFrame({"seafood":["fish"],
"meat":["pork"],
"fruit":["apple"]})
df1["category"] = df1["name"].apply(lambda x: "se... |
46,239 | My city has online billing for utilities. When you set up an account they email your user name and password to you. You can't change your password without them emailing it to you again. Isn't this insecure? Doesn't that mean my user name and password is being sent in the clear and someone can log on to my account? | 2013/11/29 | [
"https://security.stackexchange.com/questions/46239",
"https://security.stackexchange.com",
"https://security.stackexchange.com/users/34854/"
] | Yes this is correct. Security principles dictate that you should be able to set your own password. | It is my understanding that, unless they are doing something to securely deliver the email to you, that they are effectively writing your password on a postcard and sending it out for any sniffers to see. Combined with the system having your PII (name, phone, address, ect.) and financial information, I would be concern... |
42,670,380 | I have an ACF Repeater field i'd like to output as an accordion grid, like so:
```html
<div class="intro row">
<div class="item item-1">name 1</div>
<div class="item item-2">name 2</div>
<div class="item item-3">name 3</div>
<div class="item item-4">name 4</div>
</div>
<div class="expanded row">
... | 2017/03/08 | [
"https://Stackoverflow.com/questions/42670380",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1746972/"
] | The second 'expanded' row can be done so that you store each count (item-1,item-2) in an array or just traverse through all the count when you close the intro row.
```
<?php
if ($count % 4 == 3) {
?>
</div><!-- intro-->
<div class="expanded row">
<?php
$start = $count-3;
... | okey, lets see ,
using variables to store your templates may helps a lot in this context ,
as follow :
```
$intro = '';
$expanded = '';
while (have_rows('features')) :
the_row();
if ($count % 4 == 0) {
$group++;
$intro .= '<div class="intro row">';
$expanded .= '<div class="expande... |
16,751,313 | I'm using this html below:
```
<input name="t1" class="imgupload" type="file" accept="image/*" capture="camera">
<input type="submit" class="submit" value="Upload">
```
I'm trying to figure out how to have some alert(); show when the input type="file" is empty
```
$(document).on('click', '.submit', function(e) {
va... | 2013/05/25 | [
"https://Stackoverflow.com/questions/16751313",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2391929/"
] | Here's an example
<http://jsfiddle.net/aesmA/>
HTML
```
<form>
<input type="file" />
<input type="submit" />
</form>
```
Javascript (jQuery)
```
$("form").on("submit", function(){
var $file = $(this).find("input[type=file]");
if (!$file.val() || $file.val() == "") {
alert("File is missing");
retu... | Try something like this.
```
$('form#fl').submit(function(e){
var a = $('input.imgupload').val();
if(a == '' || a == null){
e.preventDefault();
alert('hello');
}
});
``` |
6,119,667 | I want to read in a CSV file whose first line is the variable names and subsequent lines are the contents of those variables. Some of the variables are numeric and some of them are text and some are even empty.
```
file = "path/file.csv"
f = file(file,'r')
varnames = strsplit(readLines(f,1),",")[[1]]
data = strsplit(r... | 2011/05/25 | [
"https://Stackoverflow.com/questions/6119667",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/239923/"
] | An alternate strategy that has been discussed here before to deal with very big (say, > 1e7ish cells) CSV files is:
1. Read the CSV file into an SQLite database.
2. Import the data from the database with `read.csv.sql` from the `sqldf` package.
The main advantages of this are that it is usually quicker and you can ea... | Just for fun (I'm waiting on a long running computation here :-) ), a version that allows you to use any of the `read.*` kind of functions, and that holds a solution to a tiny error in \Greg's code:
```
read.clump <- function(file, lines, clump, readFunc=read.csv,
skip=(lines*(clump-1))+ifelse((header) & (clump>1)... |
37,695,413 | I am using codeigniter email, to send an email to the client who has registerd him self into the system, and after that I echo a json code that syas an email has been sent to you.
this proccess is working when i am using web browser, but it is not working in android application.
my code is below:
```
$config = Array(
... | 2016/06/08 | [
"https://Stackoverflow.com/questions/37695413",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3003376/"
] | You can use this implementation of the DateRange :
```
public class DateRange : IEquatable<DateRange>
{
public DateTime Start { get; set; }
public DateTime End { get; set; }
public DateRange Intersect(DateRange d)
{
var s = (d.Start > this.Start) ? d.Start : this.Start; // Later Start
... | In your last statement you have a mistake: present r2start == r1end in all cases.
Maybe:
1. r1start < r2end : r2start <**=** r1end
2. r1start <**=** r2end : r2start < r1end
?
I solve this problem that condition:
```
return r1Start <= r2Start && r1End >= r2Start ||
r1Start <= r2Start && r1End >= r2End ||
... |
2,079,002 | I would like to use a fixed image as the background in a simple grouped table view in my iPhone program. Unfortunately, no matter what I do, the background is always solid white. I have followed several supposed solutions on this site and others to no avail. Here is the relavant code in the viewDidLoad method of the ta... | 2010/01/16 | [
"https://Stackoverflow.com/questions/2079002",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/210876/"
] | Use `UITableView`'s `subviews` property to add your background there:
```
[self.tableView addSubview:backgroundView];
[self.tableView sendSubviewToBack:backgroundView];
```
Also, your cell/header etc. will probably need to be set to transparent for your backgroundView to be visible. | I would simply set the `backgroundColor` property of the UITableView itself. You can use UIColor's `+colorWithPatternImage:` method to convert a UIImage into a UIColor (that will repeat across the entire view, if not big enough):
```
// From within UITableViewController's -viewDidLoad:
UIImage *image = [UIImage imageN... |
41,252,238 | Say I have one column called colors with 1000 cells populated with values. Some of the cells have the word `blue` in it. In another column I have unique identifiers that correspond with the colors column. For example `Blue` can have a value associated to it of 01, 02, 04, or 05. The word `blue` appears 20 times within ... | 2016/12/20 | [
"https://Stackoverflow.com/questions/41252238",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5610247/"
] | Assuming your data is located at `A1:B21` try this:
Enter the following headers at `D1:F1`
[](https://i.stack.imgur.com/m3GZO.png)
Enter these `ArrayFormulas`
*`FormulaArrays` are entered pressing* `CTRL`+`SHIFT`+`ENTER` *simultaneously, you shall ... | In addition to the answer in the first comment, you can filter it with something like this (not tested):
```
= SUMPRODUCT( IFERROR(1 / COUNTIFS(A2:A21, "Blue", B2:B21, B2:B21), 0) )
``` |
4,223,150 | When CheckBox is unchecked in a ListView i need to get a popup window? | 2010/11/19 | [
"https://Stackoverflow.com/questions/4223150",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/68381/"
] | I have make a JS function and just pass id of your list like as
```
OnClientClick="return GetSelectedCheckBoxInGrid('grdCustomer');"
function GetSelectedCheckBoxInGrid(obj)
{
var con = 'ctl00_ContentPlaceHolder1_' + obj
var Parent = document.getElementById(con);
var TargetChildContro... | Not too sure about this, but hypothetically, you could give each checkbox a class, eg chkbox, and then have some jquery code to handle a click event:
$('chkbox').click(function() {
alert("here is where you put your popup code");
});
You could use window.open here |
45,689,274 | I want to use a smooth scroll for the anchors on the page.
Therefore I use the following code:
```
<script>
$(document).on('click', 'a', function(event){
event.preventDefault();
$('html, body').animate({
scrollTop: $( $.attr(this, 'href') ).offset().top
}, 500);
});
</script>
```
The only proble... | 2017/08/15 | [
"https://Stackoverflow.com/questions/45689274",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4343043/"
] | If you know that your fixed header will **always** have a height of 88px, you can simply add that value to the final scroll position to make space for that :)
```
$('html, body').animate({
scrollTop: $( $.attr(this, 'href') ).offset().top + 88
}, 500);
```
If the fixed header height might change, you will want t... | CSS ONLY solution
```
html{
scroll-behavior: smooth;
}
[id] { scroll-margin-top: 88px }
```
This css sets the scroll behavior to smooth and sets all anchors on page to have a scroll-margin-top property, which snaps scrolling to the set position. |
2,230,448 | I'm using php DOM to build an XML file of data, it works fine but it all outputs on one line, like so:
```
<property><something><somethingelse>dfs</somethingelse></something></property>
```
However in all examples I've found it's outputting properly, like so:
```
<property>
<something>
<somethingelse>
... | 2010/02/09 | [
"https://Stackoverflow.com/questions/2230448",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/200518/"
] | use `urlencode` :]
<http://php.net/manual/en/function.urlencode.php> | Use [urlencode](http://php.net/manual/en/function.urlencode.php). That will encode all 'url breaking' characters so that they can safely passed in an URL.
Also, consider passing the date in some other format, as a regular urlencoded datetime might look a bit ugly. You can use timestamps instead. For example, compare t... |
16,636,007 | My default terminal color is gray, and that's fine.
My Bash prompt displays a bunch of colors, and this works fine:
```
PS1="${COLOR_RED}\u${COLOR_WHITE}@${COLOR_RED}${COMPUTERNAME} ${COLOR_BLUE}\w${GITPROMPT} ${COLOR_RESET}"
```
But the text I type in, at the end of the prompt, is gray. I want it to be white (ANSI... | 2013/05/19 | [
"https://Stackoverflow.com/questions/16636007",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/447186/"
] | Try this one. It is simpler:
```
export PS1="\e[0;32m\t \e[32;1m\u@\h:\e[0;36m\w\e[0m$ "
``` | I would suggest changing your terminal emulator's settings.
It appears you are using [iTerm2](https://en.wikipedia.org/wiki/ITerm2) (if you are on iTerm, I suggest looking at iTerm2), so:
*Settings* → *Profiles* → *Your Profile* → *Color*. Under 'basic colors', adjust 'foreground'.
For just changing the color of the... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.