INSTRUCTION
stringlengths 25
999
| RESPONSE
stringlengths 0
999
| SOURCE
stringlengths 16
38
| METADATA
dict |
---|---|---|---|
Point And Figure - implementation
Hi Can anyone recommend some open source projects for calculating and plotting point & figure charts with as many as possible options.
Thx | The only open source useable implementation I could find is point and figure. There is also Financio.
I'm not used neither one but since nobody answered yet I just pointed out some alternatives. | stackexchange-stackoverflow | {
"answer_score": 0,
"question_score": 0,
"tags": "charts, stock"
} |
MySQL TRIM spaces inside text
I have a DB with users table. One of the fields is cellphone, but is as VARCHAR type. Some users modify their phone with correct and desired behavior, a number without spaces. But other users just add it and let spaces between chars.
Desired data:
5354663598
Some cases:
53 5 466 3598
In PHP I can solve this with a foreach, and later a `str_replace(" ", "", $user->cellphone);`
But I just want to know if there is a MySQL function for it.
Thanks! | Uhmm, solved!, thanks Ferenc Kurucz.
UPDATE users SET phone = REPLACE(phone," ","") | stackexchange-stackoverflow | {
"answer_score": 0,
"question_score": 0,
"tags": "mysql, replace"
} |
Equivalent of e.ReturnValue in EntityDataSource
I'm using EntityDataSource with DetailsView in my ASP.NET application. I want to get identity column value after inserting the record. ObjectDataSource has e.ReturnValue property I want to know its equivalent in EntityDataSource? | You can subscribe to the `Inserted` event, which is an `EventHandler<EntityDataSourceChangedEventArgs>`.
The `EntityDataSourceChangedEventArgs` instance has an Entity property, representing the newly inserted entity.
void EntityDataSource1_Inserted(object sender, EntityDataSourceChangedEventArgs e) {
YourEntityType newlyAdded = (YourEntityType)e.Entity;
int newId = newlyAdded.Id;
} | stackexchange-stackoverflow | {
"answer_score": 1,
"question_score": 0,
"tags": "asp.net, objectdatasource, entitydatasource"
} |
How can I make the changes of a transformation stick?
So I have a `FrameworkElement` to which I apply a template that has a thumb. I calculate the angle and then I set the `RenderTransfrom` property equal to a `RotationTranform`. Once I do the rotation and want to do another rotation, the changes don't stick, that it the element returns to its initial position. How can I make the changes stick after a transformation has been applied. Any help would be appreciated. Thank you.
Do transformations affect the actual element or are they only a rendering thing? Also do they affect the bounding box of the element? I tried a layout transformation and still the same result. | You can only have one tranform at a time, but if you need multiple transfomations you can use a `TransformGroup` to add whatever transforms you need.
Alternatively you can use a `MatrixTransform` whose Matrix you can manipulate (those changes will not be reversible but as there is only one transformation in total it should have a higher performance). | stackexchange-stackoverflow | {
"answer_score": 0,
"question_score": 0,
"tags": "wpf, rotation, transform, render"
} |
Is it possible to construct a type that allows objects but not Errors in Typescript?
I'm trying to fix a weird corner case in a logger, where calls like `log({ info: 'information' })` do work as expected, but `log(new Error())` does not.
While there's no fix avaiable, I want to override the log method to allow all objects but errors as parameters. Is it possible in Typescript?
I've tried with the new conditional types:
type NotError<T> = T extends Error ? never : T;
log(NotError<object>): void
But this still allows calls like `log(new Error())` without any errors or warnings.
PS: The bug is caused by all objects with properties that are not enumerable, but our only use case that envolves such objects are Errors. | The problem is that `NotError<object>` will just resolve to `object`. What you want is to use generics:
function log<T>(notError: NotError<T>): void {
console.log(notError);
}
More reading: < | stackexchange-stackoverflow | {
"answer_score": 3,
"question_score": 2,
"tags": "typescript"
} |
How can i add a table in my existing database without losing data in Entity-framework Code first 5.0 ?
Recently I updated my software and I need to add a new table in my database. I am using
Update-Database -Force -Verbose
to update my database in my development PC. But when I install update version of my software in my client machine then it throw following exception.
The model backing the ‘MyContext’ context has changed since the database was created. Consider using Code First Migrations to update the database (
If I drop and recreate database then it`s work fine.
But it is quite impossible to drop existing database in my client machine. I have to add my new table without losing any data.
Please tell me how can i add a new table without out losing data in my existing Database.
I am using
Visual Studio 2012
Entity Framework 5.0
DotNet 4.0
MSSQL Server 2008 R2 | You need to use Code First Migrations. When you set up your DbContext it will look something like this:
Database.SetInitializer<dbContext>(new MigrateDatabaseToLatestVersion<dbContext, Configuration>()); | stackexchange-stackoverflow | {
"answer_score": 4,
"question_score": 5,
"tags": "c#, .net, sql server, entity framework, tsql"
} |
How can i set my vm to have exclusive access to my ethernet port in mac os x lion?
I have a vmware of windows 7 on osx lion. I am on a corporate network that assigns IPs via DHCP through ethernet, and i also have an airport card thats connected to a 4g hotspot.
This corporate network is behind a proxy and what i need to be able to do is force osx lion to use my airport and force vmware to use the ethernet.
I have set the network priority order under preferences -> network -> advanced but is there anything else i need to do? | I forced my mac to use Wifi as the preferred method, then in vmware options i set the network adapter to ethernet. Enabled proxy settings in my vmware and its functioning properly. | stackexchange-superuser | {
"answer_score": 0,
"question_score": 0,
"tags": "windows 7, vmware, osx lion, ifconfig"
} |
May a C-1/D and B-1/B-2 holder stay two weeks in USA immediately after working on a sea vessel?
My father is working on board sea vessel, so he "entered" US using C-1/D visa. In the same time he has current B-1/B-2 visa.
Is it possible for him to visit me (i.e. stay in US for a couple of weeks) when he finishes his contract without re-entering US?
The trick here is to not cross the ocean once more. | So, just called the CBP Info centre, as well as the CBP at JFK airport
According to both sources, if his visa is a combination C1/D and B2 visa, then he can stay after his contract finishes without further ado.
If, however, the visas are separate, then once his contract finishes, if he wishes to remain in the US for a while as a visitor, he has to:
* Exit and re-enter the US in B2 status. The quickest and cheapest option, but may require a Canadian/Mexican visa depending on nationality
**or**
* Apply for a change from C1/D to B2 status (costs USD 370) by filing form I-539 and sending it to:
> USCIS
>
> ATTN: I-539
>
> 2501 S. State Highway 121 Business
>
> Suite 400
>
> Lewisville, TX 75067 | stackexchange-travel | {
"answer_score": 4,
"question_score": 5,
"tags": "visas, usa, b1 b2 visas, sea travel, transition of visa status"
} |
Push into array overrides previous value
I want to build an array having this format:
x = [
{'projectName': 'a', 'serialNo': 1},
{'projectName': 'b', 'serialNo': 2},
{'projectName': 'c', 'serialNo': 3},
]
using values passed from a form
onSubmit(form: NgForm) {
let x = []
x.push({
projectName: form.value.projectName,
serialNo: form.value.serialNo,
})
console.log(x) // -> this will always give me the value I just inserted
// form.value.project = JSON.stringify(x)
// putObj(form.value).subscribe((res) => { });
}
Then I send form.value in backend and the field `project` is modified. My problem is that everytime I push values into `x`, the previous value overrides.
Which seems to be the problem? If my code is unclear, I can explain or give more snippets.
EDIT: thank you very much! It worked, I declared `x` inside component. | not tested, but should work in theory:
// ...
private x: {'projectName': string, 'serialNo':number}[] = [];
// ...
onSubmit(form: NgForm) {
this.x.push({
projectName: form.value.projectName,
serialNo: form.value.serialNo,
});
console.log(this.x)
}
// ... | stackexchange-stackoverflow | {
"answer_score": 1,
"question_score": 0,
"tags": "javascript, arrays"
} |
Way to separate two duplicates names in a single cell without a indicator?
I have a column that has cells where the name is duplicated in each cell. An example is John DoeJohn Doe is occurring in a single cell and this is the same for the rest of the cells in the column. I know a way to do it with and indicator such as a space or a comma but this one has no indicator I can think of because the names are smushed together. Please help with this problem. | Use `MID` and `LEN()/2`:
=MID(A1,1,LEN(A1)/2)
.
So far I have something like this:
CustomForm c = new CustomForm();
DialogResult r = c.DialogResult;
c.ShowDialog();
if (r == DialogResult.OK)
{
//Run code
}
This however isn't working. How do I code this properly? I also set the "OK" button as the AcceptButton in CustomForm. | Perhaps prefer compacting it like so:
CustomForm c = new CustomForm();
if (c.ShowDialog() == DialogResult.OK) {
// run code
}
Also, remember you have to set the DialogResult of the button on the other form to be OK:
!DialogResult Property
`DialogResult` is an `enum`. As such, it is copied by value.. not by reference. | stackexchange-stackoverflow | {
"answer_score": 4,
"question_score": 0,
"tags": "c#, winforms, events, button"
} |
Local storage of REST/JSON web service results in Android SQLite DB
I'm developing my first android application which is basically a task manager in a professional context. My data comes from a central server and the user can only modify the progression rate and the number of hours he worked on a particular task. He can also search by task name/date/project/client... I'm wondering if i need to store the tasks that i get from the server in a local database ? Would the application be too slow if i get the tasks at each session,put them all in a list then preform my operations on that list ?
Thanks in advance. | I would recommend storing the "current" list in a database as a local cache to handle the case where the user has no network connectivity or was unable to connect to your server. You can display the last known good set of tasks and queue up any changes from them to the server when connectivity is restored, or not allow changes when using the cache. Kind of like a read-only mode.
Hope that's helpful! | stackexchange-stackoverflow | {
"answer_score": 0,
"question_score": 1,
"tags": "android, sqlite, rest"
} |
SQL Expression wrong
I try to create a table but I keep getting an SQL Error but I can't figure out why.
This is the error:
> check the manual that corresponds to your MySQL server version for the right syntax to use near '+491634170770 (Id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,Type VARCHAR(20),Conte' at line 1 ERROR 1064 (42000): You have an error in your SQL syntax;
This is my statement:
CREATE TABLE +491234175789 (
Id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
Type VARCHAR(20),
Content MEDIUMBLOB
);
I already tried to find a solution here, but my syntax seems to be correctly. I think its because of the name of the table. But using backticks like this `´+491234175789´` didn't work. | This is the backtick `:
CREATE TABLE `+491234175789` (
Id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
Type VARCHAR(20),
Content MEDIUMBLOB
);
However, don't create a table name that requires backticks. It is just bad form and makes queries harder to read and write -- you are creating problems for the future. Call it something like:
CREATE TABLE t_491234175789 (
Id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
Type VARCHAR(20),
Content MEDIUMBLOB
); | stackexchange-stackoverflow | {
"answer_score": 3,
"question_score": -1,
"tags": "mysql, sql"
} |
Appending bash alias to .bashrc doesn't work
I want to create a alias of my **`cd command`**. I have created the .bashrc file and append the command **`cd ......`** to it. (Since the file was newly created, it just has this one line that I added).
After that, only after I typed `. ~/.bashrc`, can the alias works. If I close the terminal and open it again, I need to retype `. ~/.bashrc`.
It's really annoying to do this every time. Is there any way to solve this problem?
Thank you so much for help | If using OS X, append the alias to `~/.bash_profile`.
You could also add alias to `~/.bashrc`, then add `source ~/.bashrc` to `~/.bash_profile`.
Better yet, put all your aliases in `~/.aliases`, and source it in `~/.bash_profile`.
By default, OS X first sources `/etc/bashrc` (which shouldn't be modified unless absolutely necessary), then sources the user's `~/.bash_profile` at the start of every interactive session. | stackexchange-stackoverflow | {
"answer_score": 2,
"question_score": 0,
"tags": "bash, alias"
} |
My while loop goes back to the top after running the code.How Can I make it that it starts again after the 'again;?
I am trying to create a dice game but after the game is complete I would like it to start again with the question "Do you want to roll the dice again" instead of going to the first statement. This is as far as I have gotten and am not sure what to do to correct the code. Any help is much appreciated!!
import random
dice_number = random.randint(1, 6)
play = True
while play:
roll_dice = input("Would you like to roll the dice?")
if roll_dice.lower() == 'yes':
print(dice_number)
else:
print("Let us play later then.")
break
again = str(input("Do you want to roll the dice again?"))
if again == 'yes':
print(dice_number)
if again == 'no':
play = False
print("It has been fun playing with you.")
continue | Try this:
import random
dice_number = random.randint(1, 6)
play = True
first = True
while play:
again = input("Would you like to roll the dice?") if first else str(input("Do you want to roll the dice again?"))
first = False
if again.lower() == 'yes':
print(dice_number)
else:
print("Let us play later then.")
break | stackexchange-stackoverflow | {
"answer_score": 0,
"question_score": -1,
"tags": "python"
} |
Help translating "It's not a bug, it's a feature!"?
I know no Latin, but playing around with Google Translate I came up with "Non insectum opus est". _Insectum_ seems like a good stand in for a generic bug, but maybe _blatta_ is better (see < And opus carries the connotation that the entire program is as designed. | Google Translate is unreliable with Latin and you should not take anything it gives seriously. The suggestion _non insectum opus est_ sounds like "an insect is not work".
I am not aware of good Latin words for "bug" or "feature". Therefore I would take a different approach and suggest:
> _Non forte sed ratione._
> Not by chance but by design.
Another option is to go with participles:
> _Non ruptum sed designatum._
> Not broken but designed.
If you refer to something specific, remember that the Latin participle needs the correct form (gender and number). As just a general rule without referring to any single thing, I think singular neuter works well.
You can also substitute _erratum_ (misstep, mistake) for _ruptum_ (broken). This should be seen as a noun ( _errare_ is intransitive, so _erratum_ is best seen as a derived noun rather than a participle). If you want to shift nuance from "broken" to "misstep", you can say _Non erratum sed designatum_. | stackexchange-latin | {
"answer_score": 27,
"question_score": 8,
"tags": "english to latin translation, idiom, translation check"
} |
Mysql: get 10 random rows among 50 rows (the rest excluded by WHERE) from 600k rows fast
My question is based on the SO MySQL select 10 random rows from 600K rows fast. It is known
SELECT column FROM table
ORDER BY RAND()
LIMIT 10
is too slow for huge tables, another tricks and methods are used to extract some rows.
But what if I use WHERE:
SELECT column FROM table
WHERE colA=123
ORDER BY RAND()
LIMIT 10
What about the performance, if `WHERE` actually excludes at least `99.99%` wrong rows among 600k? By another words, what works first in this query - `WHERE` or `ORDER BY RAND()`?
If `WHERE` works first, does this mean `ORDER BY RAND ()` sort only 60 rows (not 600k) and works fast? | If this performs well (fast enough for you) and returns not many rows (say, less than a 1000):
SELECT column FROM table
WHERE colA=123 ;
Then this will perform well, too, because it will sort only the (less than 1000) rows of the previous query:
SELECT column FROM table
WHERE colA=123
ORDER BY RAND()
LIMIT 10 ;
If you want to be dead sure that it will perform pretty well, even if the first query returns many thousands or million rows, you can use this, which will limit the sorting to maximum 1000 (or a number of your choice) rows:
SELECT column
FROM
( SELECT column FROM table
WHERE colA=123
LIMIT 1000
) AS tmp
ORDER BY RAND()
LIMIT 10 ;
The downside is that if there are indeed many rows, the 1000-cut will be arbitrary and indeterminate but not random. It will probably be done based on the indexes used for the query. | stackexchange-stackoverflow | {
"answer_score": 3,
"question_score": 1,
"tags": "mysql, performance, select, random, sql order by"
} |
Django JSON file to Pandas Dataframe
I have a simple json in Django. I catch the file with this command `data = request.body` and i want to convert it to pandas datarame
JSON:
`{ "username":"John", "subject":"i'm good boy", "country":"UK","age":25}`
I already tried pandas read_json method and json.loads from json library but it didn't work. | You can also use `pd.DataFrame.from_records()` when you have json or dictonary
`df = pd.DataFrame.from_records([ json ]) OR df = pd.DataFrame.from_records([ dict. ])`
or
you need to provide iterables for pandas dataframe:
`e.g. df = pd.DataFrame({'column_1':[ values ],'column_2':[ values ]})` | stackexchange-stackoverflow | {
"answer_score": 2,
"question_score": 2,
"tags": "python, json, django, pandas"
} |
SQL query to retrieve XML data
I have some XML in SQL Server:
')
from @xmlresponse.nodes('.') Node(Data)
This returns both fields (`inputrefid` and `crn`) as one string.
I would like to retrieve the values in separate fields starting with the inputrefid, but no matter what I try I get NULL.
e.g
select inputRefId = Node.Data.Value('(/inputRefId)[1]', 'varchar(50)') | Try it with this XQuery:
;WITH xmlnamespaces(' AS ns)
SELECT
inputRefId = Data.value('(ns:inputRefId)[1]', 'varchar(50)'),
crn = Data.value('(ns:crn)[1]', 'varchar(50)')
FROM
@xmlresponse.nodes('/resultDTO') Node(Data)
The point is that your top-level node - `<resultDTO>` does _not_ have the ` XML namespace - so you cannot really use the ` as the _default_ XML namespace for all the nodes in the XML - you need to be more specific and only apply it where it's really been set. | stackexchange-stackoverflow | {
"answer_score": 1,
"question_score": 1,
"tags": "sql server, xml"
} |
Can only edit list forms with InfoPath
I've got an issue in SharePoint 2010 where I can only edit list forms with InfoPath. Any idea how to restore default form editing for a given site? | This works for both SharePoint 2010 and 2013.
Go to the list where you wanna get rid of the custom InfoPath forms, go to a list/library settings > Form Settings > Select "Use the default SharePoint form" and if you like to get rid of the customized forms, check the box for deleting the forms from the server.
!enter image description here | stackexchange-sharepoint | {
"answer_score": 2,
"question_score": 0,
"tags": "list form"
} |
Change in call price Value as time goes by
In various papers and discussions in here I have seen that in delta hedging setup people compute the **Change in value/Price of Call option** by: $$ dC_t = \Theta_t dt + \Delta_t dS + \frac{1}{2} \Gamma_t dS^2 $$ assuming constant volatility. As tome goes by (and spot stays the same) the option is loosing value so the the first part make sense (theta is negative in BS model).
The second part also make sense: when spot change by $dS$ ( _relative_ small changes) the option value changes by $\Delta$.
My question: **Why do we include the last part?** Is that because we want to make up for the for non-linearity of delta? If that is the case; why only include the second derivative and why multiplying by 1/2? | From the mathematical standpoint it is a consequence of Ito's Lemma. The intuition is that $dS^2$ (or rather $<dS,dS>$ - the quadratic variation of $S$) is of the same order of magnitude as $dt$ so that when you do a **Taylor expansion** you cannot neglect it, but you can neglect higher order terms. In the Brownian case if $dS = \alpha dt + \sigma dW$ then $<dS,dS> = \sigma^2 dt$. Again you can gain some intuition by noting that a random walk $\pm \sqrt{dt}$ with probabilities $1/2$ and $1/2$ is an approximation of the Brownian motion, and that $(\pm \sqrt{dt})^2 = dt$. | stackexchange-quant | {
"answer_score": 3,
"question_score": 2,
"tags": "options, black scholes, delta hedging"
} |
my username is not in max os x 10.6's passwd file
my login name is 'john', in linux, I should see john in the /etc/passwd file. but in max os 10.6, I can't found such record in /etc/passwd file! Can anybody tell me why and where I can found such record!
this post help me out. | See this question over on superuser. To quote from there: "The /etc/passwd file is only consulted when the OS is in single-user mode. The "standard" location for account information on OS/X is the DirectoryService." | stackexchange-stackoverflow | {
"answer_score": 2,
"question_score": -3,
"tags": "operating system, max"
} |
Saving Multiple Plots with Different Names
I'm trying to save multiple plots to a directory. Problem is, I don't want to use a counter for the different file names because they all have different ID numbers, denoted as trk_id, or j. If you need more of the code, please let me know! Plus, I know this code just uses the same name and overwrites each file.
for i, j in enumerate(trk_id):
t = np.arange(0, 3*3600) + t0_b[i]
g_x = f_r(tau_b[i], t0_b[i], c0_b[i], c1_b[i], c2_b[i])
fig,ax = plt.subplots()
ax.plot(t, g_x(t))
plt.yscale('log')
plt.ylabel('Height (arcsec)')
plt.xlabel('Time (s)')
ax.set_title(j)
plt.savefig('plots/j.png') | In order to use the loop variable `j` as filename, you can generate a string like
filename = 'plots/' + str(j) +'.png'
plt.savefig(filename)
or
filename = 'plots/{}.png'.format(j)
plt.savefig(filename) | stackexchange-stackoverflow | {
"answer_score": 1,
"question_score": 1,
"tags": "matplotlib"
} |
How can I make a Windows 7 computer appear to be Linux to remote OS detectors
I have a Windows 7 computer that I'd like to spoof as Linux on my network. By that, I mean that anyone on the network who runs nmap or a System Properties scan would think that my computer (running W7) was a Linux computer. The spoof would only need to hold up to cursory inspection such as direct TCP or UDP traffic, not necessarily packet inspection between my computer and one not on the network. I know that using IPtables on Linux makes it possible to do the opposite of this... but I'm not entirely familiar with the set of tools available in Windows. | I know of at least one program that can easily change the OS fingerprint for Windows systems so they look like something else.
OSfuscate | stackexchange-superuser | {
"answer_score": 2,
"question_score": 1,
"tags": "windows 7, networking"
} |
pgAdmin4 got removed after upgrading from Ubuntu 18.04 to 19.10
I just upgraded from Ubuntu 18.04 to 19.10. After upgrade I noticed that pgAdmin4 got removed while other softwares are still present and now when I try to install pgadmin4 from the terminal, I get:
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
pgadmin4 : Depends: pgadmin4-common (= 4.18-1.pgdg18.04+1) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
I have installed pgadmin3 but I really want pgadmin4. Is that possible? | As far I can understand the `pgadmin4` package was installed from third-party repository.
Quick search gives me this page - < .
So you have to open Software & Updates (`software-properties-gtk`) and enable line similar to above.
Or add this repository again as described in <
sudo apt-get install curl ca-certificates gnupg lsb-release
curl | sudo apt-key add -
sudo sh -c 'echo "deb $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
sudo apt-get update
sudo apt-get install pgadmin4 | stackexchange-askubuntu | {
"answer_score": 1,
"question_score": 1,
"tags": "software installation, 19.10, pgadmin"
} |
LWUIT in a enterprise J2ME application?
We are developing a J2ME application and sometimes we face constraints while working with the default lcdui library. Whenever we want some extra in the UI, the only option is to work with canvas which is not so easy. Now we are thinking to use LWUIT as UI library instead of ludui but having some question before starting -
1. Is LWUIT mature enough to be used in a enterprise J2ME application?
2. Can we mix LWUIT and LCDUI in same application ? | 1. In my point of view. lwuit is mature enough to be used in enterprise applications. It's still in permanent development and it's progressing fast.
2. Yes you can mix both of them. If you use an lwuit form you can only add lwuit components and vice versa. It should be possible to implement and draw you own container objects (canvas style). | stackexchange-stackoverflow | {
"answer_score": 4,
"question_score": 2,
"tags": "java me, lwuit, lcdui"
} |
What to install and download?
I bought Albion prelude, Reunion and Terran Conflict but i am wondering which is the last in the series. Do they extend themselves and can I install/play them all at once? Other then that are there any free DLC's/mods I should install on top of it? I vaguely remember there was a free add on pack that adds some more items etc. | Reunion was the first X3 game; Terran Conflict, the second; and Albion Prelude, the third and last. I would not recommend playing more than 1 game per 2 arms at the same time.
You can get the official addons called Bonus Packs from Egosoft's website - they add various command options for your ships
* Reunion bonus pack
* Terran Conflict bonus pack
* Albion Prelude bonus pack | stackexchange-gaming | {
"answer_score": 4,
"question_score": 0,
"tags": "x3 albion prelude, x3 terran conflict, x3 reunion"
} |
Import Points from QGIS into AutoCAD
I want to know how to import points from QGIS into AutoCAD. My points have certain coordinates for X and Y and when importing them into AutoCAD they should have the same coordinates as in QGIS.
Is there any easy and fast way to do this? | You can just "save As" your point layer to a DXF file from QGIS by right click on the layer. Be sure the CRS is right. After that, you can import this DXF file to AutoCAD.
$ implies $ f \in C(\mathbb{R})$
Is $ f \in L^2(\mathbb{R})$, $\hat{f}$ the Fourier transform from $f$ and $h: \mathbb{R} \to \mathbb{R}, h(\xi) = \xi \hat{f}(\xi))$
Show: $h \in L^2(\mathbb{R})$ implies $ f \in C(\mathbb{R})$
Does someone know where to begin? I can't find a stepping stone for this one. I tried to get something out of the integral of the Fourier transform but i can't find an argument why it should be $ f \in C(\mathbb{R})$. | Since $\int_{-1}^1|\hat f|\le\sqrt 2\left(\int_{-1}^1|\hat f|^2\right)^{1/2}$ it follows easily that $\hat f\in L^1$. Now the Inversion Theorem and the Riemann-Lebesgue Lemma show that $f\in C_0(\Bbb R)$. | stackexchange-math | {
"answer_score": 3,
"question_score": -3,
"tags": "lebesgue integral, fourier transform"
} |
HLOOKUP Return Greatest Value
I have some columns A, B, C, D, E, F, G with some values in the rows below 2, 3, 4. I don't know if HLOOKUP is the correct answer for what I am trying to do but I want to have a function that looks at the values in row 4, finds the highest/greatest value, and then return the column name/label.
I am really rusty with Excel (this is 2011 by the way) so excuse me if it is a noob question. Don't waste your time telling me how easy it was to do. Just show me the solution. | Here's a way:
=INDIRECT("R1C" & MATCH(MAX(4:4),4:4,0),FALSE)
Here's another:
=INDEX(1:1,0,MATCH(MAX(4:4),4:4,0))
By the way, I was assuming by column name/label that you meant the header row value... | stackexchange-superuser | {
"answer_score": 2,
"question_score": 0,
"tags": "microsoft excel, worksheet function, microsoft excel 2011"
} |
How to get to the solution of the problem on percentage?
If a value is increased by n/d then to get the same number p from the resultant value we have to decrease the increased value by (n/d+n). Please explain this in details. I am unable to comprehend this completely. | If the original value is $p$, and we increase it by $n/d$, this means we are multiplying $p$ by $n/d$ and adding that to $p$. Algebraically, the resultant value is $$r:=p+p\left(\frac nd\right)=p\left(1+\frac nd\right)=p\left(\frac{d+n}d\right).\tag1$$ To return to the original value $p$, we rearrange (1) to solve for $p$ in terms of $r$:
$$p = r\left(\frac d{d+n}\right)=r\left(1-\frac n {d+n}\right)=r-r\left(\frac n{d+n}\right).\tag2$$ In other words, to regain $p$ we decrease the resultant value $r$ by $n/(d+n)$.
Examples:
* If you raise the price of an item by 25%, so that $n/d=25/100$, you get back to the original price by lowering the new price by 20%, since $n/(d+n)=25/(100+25)=0.2$.
* If you double the price of an item, so that $n/d=100/100$, you get back to the original price by lowering the new price by 50%, since $n/(d+n)=100/(100+100)$. | stackexchange-math | {
"answer_score": 0,
"question_score": -2,
"tags": "arithmetic, percentages"
} |
Limit of a quotient sequence, where the denominator isn't required to be non-zero
So I have been trying to prove the following question from my textbook:
Let $(a_n)_{n \geq 0}$ and $(b_n)_{n \geq 0}$ be two real convergent sequences, with $\lim a_n = a$ and $\lim b_n = b \neq 0$. Prove that $\lim \frac{a_n}{b_n} = \frac{a}{b}$. Why doesn't the requirement "$b_n \neq 0$ for all n" play a big role here?
Now I was able to prove that the limit of the quotient sequence is indeed the quotient of the limits. However, I just can't quite understand why the requirement "$b_n \neq 0$ for all n" doesn't have a big role here. Isn't that requirement necessary for the existence of the quotient sequence? | Strictly speaking, yes. However, as $b\ne 0$, we can at least be sure that only finitely many terms need to be removed from the sequence. And the convergence behaviour (including its possible limit) does not change when we modify the sequence in only finitely many terms. In that light, it doesn't even really matter when some (but only finitely many!) terms are not even defined in the first place. | stackexchange-math | {
"answer_score": 1,
"question_score": 0,
"tags": "sequences and series, limits"
} |
StartActivityforResult brackets meaning
I'm a beginner in Android and I'd like to know, what is the meaning of the words in brackets in `StartActivityforResult(Intent, "bla bla")`. What does the second term in brackets represent? | public void **startActivityForResult** (Intent intent, int requestCode) Added in API level 1
Same as calling startActivityForResult(Intent, int, Bundle) with no options.
Parameters
* intent The intent to start.
* requestCode If >= 0, this code will be returned in onActivityResult() when the activity exits.
Quoted from Android Developers. It's like a reply for the calling method. | stackexchange-stackoverflow | {
"answer_score": 0,
"question_score": -6,
"tags": "android, eclipse, android intent"
} |
How can I get gold versions of cards in Hearthstone?
The first time I saw a premium card I thought that it was like that because it was a Legendary card. Like this:
!Onyxia card
But I discovered that Legendary cards have a "normal" version:
!Onyxia card
I thought that maybe it could be explained cause the game is in beta. Like, the normal one was the first version of a Legendary Card, than they became a little more detailed. But searching a little more I found this:
!Goldshire Footman card
How can I get this kind of card? | The Gamepedia article on Hearthstone card rarity explains gold cards this way:
> Cards within the 4 basic rarities described above can have a chance of being obtained with a gold border with custom art animation. Gold cards do not appear frequently, and therefore add to the rarity of a card. Gold cards can also be crafted with Arcane Dust for ten/eight/four/two times the normal cost of the card (in order of rarity). Gold Cards are commonly compared with "foil" cards of other types of Trading Card Games (TCGs).
So basically, expert set gold cards drop randomly when opening packs or can be crafted. Additionally as indicated in this question and answer basic gold cards (which cannot be crafted) are earned by leveling heroes. | stackexchange-gaming | {
"answer_score": 11,
"question_score": 9,
"tags": "hearthstone"
} |
Loading from JAR as an InputStream?
Is there a ClassLoader implementation I can use to load classes from an InputStream?
I'm trying to load a JAR for which I have an InputStream into a new ClassLoader. | This is unlikely, as you will find if you try to do it yourself. You won't be able to randomly access an `InputStream` to look up classes as they're requested, so you'll have to cache the contents either in memory or in the file system.
If you cache on disk, just use URLClassLoader.
If you cache in memory, you'll need to create some sort of `Map` with JarInputStream and then extend `ClassLoader` (overriding the appropriate methods). The downside of this approach is that you keep data in RAM unnecessarily. | stackexchange-stackoverflow | {
"answer_score": 6,
"question_score": 8,
"tags": "java, jar, classloader, inputstream"
} |
Replace SQL Query
I want to replace this Query
DECLARE @tmpUser TABLE( UserId INT, UserType INT )
INSERT INTO @tmpUser
SELECT
u.UserId,
1
FROM
Users u (nolock)
WHERE
u.UPIN = @AttendingDoctorID
IF @@ROWCOUNT = 0
BEGIN
INSERT INTO @tmpUser
SELECT
u.UserId,
1
FROM
Users u (nolock)
WHERE
u.FirstName = @AttendingDoctorFirstName AND
u.LastName = @AttendingDoctorLastName
END
SELECT * FROM @tmpUser
to a single SQL SELECT statement without using `@tmpUser` or any other temp tables | The following uses an extra lookup, but it fulfills your requirements. I don't know for sure if this is any more efficient than using a temp table, though if UPIN is indexed then I suspect it would be.
IF EXISTS(
SELECT
1
FROM
Users u
WHERE
u.UPIN = @AttendingDoctorID)
BEGIN
SELECT
u.UserId, 1
FROM
Users u WITH(nolock)
WHERE
u.UPIN = @AttendingDoctorID
END ELSE BEGIN
SELECT
u.UserId,
1
FROM
Users u (nolock)
WHERE
u.FirstName = @AttendingDoctorFirstName AND
u.LastName = @AttendingDoctorLastName
END | stackexchange-stackoverflow | {
"answer_score": 3,
"question_score": 1,
"tags": "sql, sql server, sql server 2008, case when"
} |
Are there any video tutorials for P4V?
I have just moved to a team where they use P4V tool and Perforce. I used to work with SVN.
Are there any video tutorials for P4V tool explaining its principles, usage etc.? | Yes, Perforce has lots of useful video tutorials, linked from < | stackexchange-stackoverflow | {
"answer_score": 4,
"question_score": 1,
"tags": "version control, perforce"
} |
Equivalence of an alternative definition of the derivative.
My calculus professor defined the derivative of a real function $f$ as follows :
"Let $f\colon \mathbb{R} \longrightarrow \mathbb R$ be a function. Then $f$ is said to be differentiable at a point $a \in\mathbb R$ if $\exists$ a function $\psi$ such that :
1) $(\forall h \in\mathbb{R}): f(a+h) = f(a) + mh + hΨ(h)$
2) $\psi$ is continuous at $0$
3) $\psi(0) = 0$
Then we denote the derivative of $f(x)$ as $f'(x) = m$"
My problem in this definition is as follows: I can see that by rearranging the terms $f(a)$ and then dividing by h we get the regular definition of the limit. I do not see what is the significance of $\psi$. | From the new definition,
$$\psi(h)=\frac{f(a+h)-f(a)}h-m.$$
If you take the limit for $h\to0$,
$$\lim_{h\to0}\psi(h)=\lim_{h\to0}\frac{f(a+h)-f(a)}h-m=f'(a)-m.$$
So $m$ plays the role of the derivative and $\psi$ is an error term, i.e. the adjustment required when $h$ is nonzero. For $m$ to equal the derivative, we need to error term to vanish for $h\to0$.
For the sake of illustration, a sinusoid, the tangent at $x=1$ and the error function.
 and 3) of $\psi$ are another way to express that $\lim_{h\to0}\psi(h)=0$. | stackexchange-math | {
"answer_score": 1,
"question_score": 4,
"tags": "calculus, derivatives, definition"
} |
$f : [a,b] \rightarrow \mathbb{R}$ such that |$f(x) - f(y)$| $\leq c{|x - y|}^k$
Let $f : [a,b] \rightarrow \mathbb{R}$ such that |$f(x) - f(y)$| $\leq c{|x - y|}^k$ where $c \geq 0$ and $k$ greater than 1. Show that $f$ is a constant function. I notice that $f$ is continuous. | For $x\neq y$ you get $$ \frac{|f(x)-f(y)|}{|x-y|}\leq C|x-y|^{k-1}. $$ Observe that $k-1>0$, let $y\to x$. | stackexchange-math | {
"answer_score": 3,
"question_score": 2,
"tags": "real analysis, analysis"
} |
Do we have to create db and schema in mongodb before using it in node app using mongoose?
I am a beginner to MEAN stack,I have one doubt that if I want to use any database and schema in my app using mongoose .Is it important that the same database and schema should exist in mongo db before? | Mongodb is schema-less. In other words the schema lives in the application. So no separate schema definitely is required in Mongodb prior to using it. Both database and collection (schema) gets created on the fly while using it.
However if authentication is enabled in Mongodb, then the userid should have sufficient privilege to access the database and create collections within them. | stackexchange-stackoverflow | {
"answer_score": 1,
"question_score": 1,
"tags": "mongodb, mongoose schema"
} |
How to organize the dependencies of a project
I have a project built with Gradle, which contains libraries which can be used freely outside the main project, like this:
!Project structure
The folders with a square at the bottom right are project modules.
I want to opensource this project (I mainly use Git and GitHub for tasks like this), but I have no idea how to organize it. Should I create separate repositories for each library (and if so, how can I link them to the main repository?), or should I put it all in one repo (I guess that's bad practice)?
The main criteria is that when `git clone repo_url` is run, it should recreate project structure one-to-one, so it can still be built with `./gradlew build`. | You can create separate Git repositories for each library, publish them, then use Git submodules to link them to the main repository.
git submodule add submodule1_url directory1
git submodule add submodule2_url directory2
git commit -m "add submodules"
Working with submodules is a little more complex. After cloning the repo, you need to clone the submodules as well:
git clone repo_url
cd repo
git submodule init
git submodule update
./gradlew build
And voilà - you have a project with independent submodules.
* * *
You might also want to look at gradle: Chapter 50. Dependency Management. I haven't read that myself, but handling the dependencies outside of the SCM is often preferred, and as gnat was saying, you should take a look at the different options and decide for yourself. | stackexchange-softwareengineering | {
"answer_score": 5,
"question_score": 6,
"tags": "version control, git, dependencies"
} |
isomorphism between field extension
Assume F is a field, E/F and H/F are two field extension. If E is isomorphic to H, then whether exist a isomorphism $\varphi:E \rightarrow H$ such that $\varphi|_F = Id_F$? I think it's worry but I can find some counterexamples. If F = Q, then it is true obviously, but other field? I think it maybe true if E/F is finite extension. Maybe someone give me some references or hints, thanks. | Take $\beta=\sqrt[4]2\in\mathbb R$, so that $\beta^2=\sqrt2>0$. Let $F=\mathbb Q(\sqrt2)$, $E=\mathbb Q(\beta)$ and $H=\mathbb Q(i\beta)$. Then $E$ and $H$ both contain $F$. They are also isomorphic, as they are both isomorphic to $\mathbb Q[X]/(X^4-2)$. In fact, there are precisely two isomorphisms $E\to H$, given by $\beta\mapsto\pm i\beta$ (the two possible roots of $X^4-2$ in $H$), so both send $\sqrt2=\beta^2$ to $(\pm i\beta)^2=-\sqrt2$, and so neither is the identity on their common subfield $F$. | stackexchange-math | {
"answer_score": 3,
"question_score": 2,
"tags": "abstract algebra, field theory"
} |
How do I add a parameter for an anchor/hash to a RedirectToRouteResult?
I want to use a RedirectToRouteResult to redirect to a url like /users/4#Summary. Using ASP.NET MVC 1.0, I haven't been able to find a way to do that - have I missed it? | You should properly build your routes in route table. Eg.:
routes.MapRoute("MyRoute" ,"{controler}/{id}#{detail}" ,new { controller = "users", action = "index", id = (string)null, detail = "Summary" }); | stackexchange-stackoverflow | {
"answer_score": 14,
"question_score": 10,
"tags": "asp.net mvc, redirect"
} |
Adding values based on certain Data in a Colimn
I have not been able to find anything on the web
I have 3 columns like so:
Customer Currency Balance
| a | | AUD | | 22.5 |
| b | | GBP | | 30.0 |
| c | | GBP | | 45.5 |
| d | | USD | | 56.9 |
| e | | USD | | 45.4 |
| f | | EUR | | 28.0 |
I want to get a full Sum of each currency, For example: so all the balances whose currecy is GBP, add them together and so on
Im new to SQL and again, i could not find anything online that does this | SELECT Currency, SUM(Balance) AS total
FROM currencies
GROUP BY Currency | stackexchange-stackoverflow | {
"answer_score": 3,
"question_score": 1,
"tags": "sql"
} |
how do i know what is the video resolution in elementary os juno
}$
(As,$\sin(x-y)=\sin x \cos y-\sin y \cos x$)
You can finish it from here I think. | stackexchange-math | {
"answer_score": 4,
"question_score": 3,
"tags": "sequences and series"
} |
f# parsing string to color
type circle = { X : int; Y : int; Diameter : int; Color : Color}
let mutable clickedCircle = { X = 0; Y = 0; Diameter = 0; Color = Color.White}
let txtBoxVal4 = System.Enum.Parse(typeof<Color>,txtBox2.Text)
clickedCircle <- {X = txtBoxVal2; Y = txtBoxVal3; Diameter = txtBoxVal1; Color = txtBoxVal4}
I am trying to parse a textbox.text into a color. From this code i get the error:
Error 1 This expression was expected to have type
Color
but here has type
obj
Quite new to F# and not to sure about the syntax. The error comes at
"Color = txtBoxVal4" | `System.Enum.Parse` returns an `obj` type that you need to cast to the enum type. You can do that using `:?>` or `downcast`. In your case the type is known so you can use `downcast`.
See the Casting and Conversions docs for more.
clickedCircle <- {X = txtBoxVal2; Y = txtBoxVal3; Diameter = txtBoxVal1; Color = downcast txtBoxVal4} | stackexchange-stackoverflow | {
"answer_score": 1,
"question_score": 1,
"tags": "parsing, colors, f#"
} |
Is it possible to debug Javascript running in an iFrame in IE9
I have a facebook app using a lot of Javascript that doesn't work correctly in IE (8 and 9), so I'd like to use a debugger. Unfortunately, the IE JS debugger doesn't allow you to choose Javascript files running in an iFrame, and I can't run it directly since then the facebook autorization doesn't work.
Is there a way to get the IE developer tools to recognize Javascript running inside an iFrame? | First make sure you are debugging under the script tab, then search for the function you want to set a breakpoint on. It should highlight/find the script file.
I use IE Developer Tools to debug a IFrame based application on a regular basis.
Do the scripts from other domains show up in the source explorer (beside the debugging button) under the script tab?
Edit:
Using a this simple test I confirmed IE Developer Tools will load scripts on external domains:
<html>
<head>
</head>
<body>
<iframe src=" height="400" width="400" />
<body>
</html> | stackexchange-stackoverflow | {
"answer_score": 2,
"question_score": 3,
"tags": "javascript, facebook, internet explorer, debugging"
} |
Underscore.js _.map function : skip a value
I am trying to use underscore.js `_.map` function on an array of objects, to get an array with a property of each object. That's the usual scenario, so :
var finalArray = _.map(myArray, function(obj) {
return obj.myProperty;
});
But in some cases I need that _nothing_ be added in the array. It could be something like :
var finalArray = _.map(myArray, function(obj) {
if (!obj.ignore) {
return obj.myProperty;
}
});
The result of this is that an `undefined` value is pushed into the array, which is not the same as not pushing anything at all.
Is there a way for the map function not to push a value, or do I need to post-process my `finalArray` to remove the unwanted `undefined`'s? | you should use _.filter() before _.map()
var filteredArray = _.filter(myArray,function(obj) {
return !obj.ignore;
});
var finalArray = _.map(filteredArray, function(obj) {
return obj.myProperty;
}); | stackexchange-stackoverflow | {
"answer_score": 32,
"question_score": 32,
"tags": "javascript, underscore.js"
} |
I want to find the $\cos ({\hat{BCD}})$. However, I don't have any idea about how to. Can you assist?
$. However, I don't have any idea about how to. Can you assist?
I'm too grateful. | $$AC=\sqrt{13+12}=5,$$ which gives $$\measuredangle ACD=90^{\circ}.$$ Id est, $$\cos\measuredangle BCD=\cos\left(90^{\circ}+\arcsin\frac{2\sqrt3}{5}\right)=-\frac{2\sqrt3}{5}.$$ | stackexchange-math | {
"answer_score": 1,
"question_score": 0,
"tags": "geometry, trigonometry, euclidean geometry, triangles, quadrilateral"
} |
Can I get a virus from connecting to a WiFi network?
Let's say I connect to a local WiFi hotspot with a particularly bad security.
I am aware that a hacker may be able to perform the following:
* Man-in-the-middle attack
* Snoop on an unencrypted network traffic
But my question is: can a hacker distribute a virus to my device via the WiFi network?
And, if so, what can I do to protect myself? | Depends on your OS and a lot of variables but in general yes.
Because the attacker may perform a man in the middle attack on a poorly designed update mechanism (not windows update) and or (again depending on your setup) abuse windows' local features like printer sharing as an attack vector.
As with everything there is no 100% solution but a very good start is using a VPN in order to fully encrypt all in/outgoing traffic and verify its integrity. | stackexchange-security | {
"answer_score": 4,
"question_score": 7,
"tags": "network, wifi, network scanners"
} |
How to use the same traits for different item
we have a smart tub with a pump and a blower. I need to be able to say:
turn the pump/blower on/off (using the same trait)
but google refuse us to have more than one id
Is there a way to to it without more than 1 id ? | If you want to have a device with multiple things that can toggle on and off, you can use the Toggle trait:
> This trait belongs to any devices with settings that can only exist in one of two states. In other words, this trait covers all available custom binary settings on a device. | stackexchange-stackoverflow | {
"answer_score": 0,
"question_score": 0,
"tags": "google smart home"
} |
Matching all words except one
Say I have a sentence:
> I am a good buy and bad boy too
How to select every word except boy in this sentence using regular expression ? | You can use **negative look behind** :
\w+\b(?<!\bboy)
Or **negative look ahead** since not all support negative look behind
(?!boy\b)\b\w+
You can read about negative look ahead here | stackexchange-stackoverflow | {
"answer_score": 64,
"question_score": 38,
"tags": "regex"
} |
When exactly did everyone figure out about Lucy?
So I've been playing through the Assassins Creed series recently, all for the first time.
Spoilers below:
> I managed to figure out that Lucy was a templar, because of what Juno says when she forces Desmond to stab her (plus, it was also a lucky guess). However, as far as I can remember, the characters never figured this out.
> But, then, in Assassins Creed III, they just casually mention that she had betrayed them and was a Templar. When did they figure this out? I assume that it'd have to be in Revelations, but I don't remember that happening (or really, much of anything with any present-day characters but Desmond).
> Did I just completely miss something? Or did they just figure it out offscreen based on what Juno said (though, then again, they couldn't hear her, and Desmond went into a coma right after, so I guess not). | Well in Assassin's Creed Revelations they gave us a DLC called **The Lost Archive**
> **The Lost Archive** is a downloadable content addition for Assassin's Creed: Revelations, with gameplay similar to the Desmond's Journey sequences. It follows the life of Clay Kaczmarek, also known as Subject 16 of the Animus Project.
In this DLC we also find that
**[SPOILER]**
> Lucy was all along a Templar working for Vidic. And you have access to interesting dialog between them and everything. I was jaw dropped when I played it.
Basically if you want more defined answers by playing the game I would highly recommend playing Revelations and this DLC.
More Info on **The Lost Archive** here. | stackexchange-gaming | {
"answer_score": 2,
"question_score": 2,
"tags": "assassins creed series"
} |
Calculate age given the birth date in the format yyyy-mm-dd
How can I calculate an age in years and months, given a birth date of format YYYY-MM-DD? Is it possible using the Date() function?
I have done in php. Below is my code
$dateOfBirth = date("Y-m-d", strtotime($post->date_of_birth));
$today = date("Y-m-d");
$age= $diff->format("%Y Years, %M Months");
echo $age;
I am getting the results in json.Can i embed the php code in json while diplaying or how can i get the age in years and months using date of birth....?? | In php you can do this using the datetime object:
$dateOfBirth = new DateTime($post->date_of_birth);
$today = new DateTime();
$diff = $today->diff($dateOfBirth);
//echo $diff->format("%Y Years, %M Months");
Then if you want to output that as json you can just:
echo json_encode(['diffString' => $diff->format("%Y Years, %M Months")]); | stackexchange-stackoverflow | {
"answer_score": 1,
"question_score": -3,
"tags": "javascript, php, jquery, json, datetime"
} |
Looping through dictionary and updating in python List Comprehension
I have the following two lists
`states = ('ab',['rose','cose'])`
`flowers = {'rose':0,'cose:0','mose:0'}`
Now need the `flowers` dictionary to be changed to
`flowers = {'rose':1,'cose:1','mose:0'}`
after I loop th `states`
I tried this but some syntax seems to be a problem!
`[flowers[i] = 1 for i in states[1] if i in flowers.keys()]`
Help is really appreciated! I am not able to understand, I kept the expression first and the conditional in the last! :/ | You shouldn't be using list comprehension for this problem, as you are modifying your existing list not making a new one.
for i in states[1]:
flowers[0][i] += 1
flowers
>>>[{'rose':1,'cose':1,'mose':0}]
If you insist on list comprehension:
new_flowers = [{i:states[1].count(i) for i in flowers[0]}]
new_flowers
>>>[{'rose': 1, 'cose': 1, 'mose': 0}]
Note this doesn't modify your original dict of flowers but instead makes a new one. | stackexchange-stackoverflow | {
"answer_score": 3,
"question_score": 0,
"tags": "python, list comprehension"
} |
Find $ \lim\limits_{x\to \infty} \left(x-x^2 \ln (1+\frac{1}{x})\right) $ with Taylor
I have to calculate some limits and try to solve them in use of taylor.
$$ \lim\limits_{x\to \infty} \left(x-x^2 \ln (1+\frac{1}{x})\right) $$
In taylor pattern I have $x_0$ to put, but there $x_0$ is $\infty$ so I want to replace it with something other $$ y = \frac{1}{x} \\\ \lim_{y\to 0^+} \left(\frac{1}{y}-\frac{1}{y^2} \ln (1+y)\right) $$
Let $$ f(y) = \frac{1}{y}-\frac{1}{y^2} \ln (1+y) $$ $$f'(y) = -\frac{1}{y^2} + \left(-\frac{2}{y^3}\ln (1+y) - \frac{y^2}{1+y}\right) $$
but $f'(0)$ does not exists because I have $0$ in denominator. | Proceeding with your substitution, since $\log \left( 1+y\right) =y-\frac{1}{ 2}y^{2}+O\left( y^{3}\right) $, we have:
\begin{eqnarray*} \frac{1}{y}-\frac{1}{y^{2}}\log \left( 1+y\right) &=&\frac{1}{y}-\frac{1}{ y^{2}}\left( y-\frac{1}{2}y^{2}+O\left( y^{3}\right) \right) &=&\frac{1}{2}+O\left( y\right) \overset{y\rightarrow 0}{\longrightarrow } \frac{1}{2}. \end{eqnarray*} | stackexchange-math | {
"answer_score": 2,
"question_score": 4,
"tags": "real analysis, limits, taylor expansion"
} |
How much time do researchers spend on writing grants?
As a potential future researcher I would like to know how much I could focus on my research and how much distraction grants cause. My research interest lie in theoretical cs and logic, however the answers should include other areas so that they may be useful to other readers too.
Specifically, how many hours of your working day on average is dedicated to grant related issues - searching a grant, writing a grant proposal, writing the final report for the funded projects, etc.
I heard in an informal talk that this can be as much as half of the time of the researcher, say 5 hours, Monday to Friday. In such circumstance, I do not think I would be able to focus on the research. | In my case (pure mathematics) it is about two or three weeks of hectic activity before the October 1 NSF deadline once every 2-3 years. I cannot say that I do nothing else during that time but it definitely distracts me quite a bit. What helps is that we (I and a few my colleagues and friends) often apply for collaborative research grants (so we have well-established separation of labor when writing, which increases the speed noticeably).
The reports are easy if you have something real to show. I would say it takes me at most a couple of hours to write mine. Recommendation letters and reviews usually take much more time. | stackexchange-academia | {
"answer_score": 6,
"question_score": 4,
"tags": "research process, funding"
} |
does a consistent closed theory in a finite languge, which is not finitely axiomatizable has an infinite model?
does a consistent closed theory in a finite languge, which is not finitely axiomatizable has an infinite model? i need help to know if this is true or not. and also if it is true can i prove it by compactness? | _Hint_ : Use compactness to prove that if a theory has arbitrarily large finite models, then it has an infinite model. Now observe that for every finite $n$, there are finitely many structures of size $n$ up to isomorphism (since the language is finite). | stackexchange-math | {
"answer_score": 2,
"question_score": 3,
"tags": "logic, first order logic, model theory"
} |
Configuring a two node hazelcast cluster - avoiding multicast
**The context**
* Two nodes of a Hazelcast cluster, each on a discrete subnet so multicast is not suitable nor working for node location.
* I should like to employ the most minimal XML configuration file, say `hazelcast.xml`, to configure Hazelcast to use TCP/IP to connect the two nodes. Ideally a directory of the IP addresses of the two nodes.
**The question**
The Hazelcast docs do a good job of showing how this can be achieved programatically, and how `hazelcast.jar/hazelcast-default.xml` holds the (considerable) default configuration.
What is unclear is: is any XML configuration I supply overlaid upon the settings within `hazelcast-default.xml` \- or simply used in its stead? | I have both my answers, and should like to share them
1. Just like the programatic API, the XML configuration overlays the defaults found in `hazelcast.jar/hazelcast-default.xml`, consequently ...
2. I can establish a very simple two-member cluster with this `hazelcast.xml` in the classpath
<hazelcast>
<network>
<join>
<multicast enabled="false"></multicast>
<tcp-ip enabled="true">
<member>192.168.100.001</member> <!-- server A -->
<member>192.168.102.200</member> <!-- server B, on separate subnet -->
</tcp-ip>
</join>
</network>
</hazelcast> | stackexchange-stackoverflow | {
"answer_score": 14,
"question_score": 9,
"tags": "hazelcast"
} |
Most Instructive Open Source Android Projects?
I'm looking to compile a list of instructive open-source Android projects.
My criteria for instructiveness:
* High code quality
* Good API coverage, demonstrating how various parts of the API interact
* Continually improved, showing that the designs are in fact maintainable
* Good aesthetic quality
In other words, the apps that as _intermediate to advanced_ Android developers we should be looking to for guidance, and not simply tutorials that demo a few concepts. | I found that I learned a lot going through the K9 Email Client. | stackexchange-stackoverflow | {
"answer_score": 3,
"question_score": 2,
"tags": "android"
} |
Can I safely interpret ISO-8859-1 strings as Win1252 when parsing e-mail?
I need to support decoding ISO-8859-1 in my e-mail client. Specifically sometimes messages contain attaches that have filenames starting with "?iso-8859-1?".
Wikipedia says ISO-8859-1 is pretty much the same as Windows 1252. I already have good tested code for decoding Win1252. Can I just use it directly and expect no problems? | Yes. The Windows-1252 codepage coincides with ISO-8859-1 in the code ranges 0x00 to 0x7F and 0xA0 to 0xFF, but not for the range 0x80 to 0x9F. Since ISO-8859-1 has no characters defined for the range 0x80 to 0x9F, this is not a problem. ISO-8859-1 is thus a subset of Windows-1252. | stackexchange-stackoverflow | {
"answer_score": 2,
"question_score": 1,
"tags": "email, encoding, character encoding"
} |
Securely partitioning multiple Windows installations that are completely separate
Can anyone explain how to install multiple instances of Windows 7 so that both instances are isolated from each other?
I have a new computer with two partitions on the same drive. One partition is for work (coding, graphics etc), the other partition is for home usage (web surfing, occasional gaming etc).
I would like to set this up so that the home partition will not have any rights to the work partition. Other than installing Windows 7 on both partitions what steps could I take to restrict access to the work partition from the home partition?
The main idea is that the home partition will run less secure software and is not as trusted as the work partition. Therefore it should not be able to modify anything except itself. | I believe the only way to do this is with encryption. You may want to look into TrueCrypt. | stackexchange-superuser | {
"answer_score": 1,
"question_score": 0,
"tags": "windows 7, windows, security, partitioning"
} |
Issue with a date extraction in SQL Server
I'm trying to list the dates registered in a table with SQL Server, but my problem is all the dates I'm extracting differs of 2 days with the dates in the table.
For example, I got 2012-12-25 in my database and when I retrieve it and cast it to a Java.util.Date, it becames 2012-12-23...
I've got processes on dates in another table which are working fine.
I'm using SQL Server 2008, Hibernate 3 and Spring 3.
Edit:
The column data type for the table is date, I'm retrieving it using hibernate so here is my hibernate query call:
public List<Holiday> retrieveAllHolidays() {
return (List<Holiday>) sessionFactory.getCurrentSession().createQuery("from Holiday")
.list();
}
The holiday object got two attributes: a String and a Date (this one is incorrect after retrieving from database). | The problem was linked with the JRE 7 support of the JDBC Driver (a problem with the getDate() function).
See this post for more informations: Microsoft JDBC driver team blog
Thanks again Martin smith for pointing to that other issue! | stackexchange-stackoverflow | {
"answer_score": 4,
"question_score": 6,
"tags": "java, sql server, hibernate, spring"
} |
How can I restrict my app for iPhone's only, excluding iPod touch?
How can I restrict my app for iPhone's only, excluding iPod touch ?
I don't want my app available on iPod Touch, is there a property in the info.plist I can use to specify this or is this something I will encounter during the setup on itunesconnect ? | You could add **gps** as a required device capability simply to exclude devices without the GPS hardware, which would rule out iPod touches.
**Edit:** Actually, the correct way to do this is to include for the **UIRequiredDeviceCapabilities** entry (a dictionary), the **telephony** key with a value of **YES** , meaning, only devices that support telephony can use the app.
Also, check out the complete reference of what keys are available for use with **UIRequiredDeviceCapabilities**. | stackexchange-stackoverflow | {
"answer_score": 12,
"question_score": 9,
"tags": "ios, xcode, itunes, device"
} |
¿Cómo traducir aplicación Universal de Windows10 (UWP) usando XAML?
No consigo poder implementar traducción en las (UWP) aplicaciones universales de windows10.
He creado una carpeta y creado el archivo de recurso .resw, con las siguiente estructura **Resources/es-ES/Resources.resw** dentro de Resources.resw solo tengo _String1_ con el valor "Hola Mundo" y en la plantilla XAML indico la carga del recurso con **x:Uid** `<TextBlock x:Uid="String1" text="hi" />` Pero cuando compilo el texto muestra _hi_ , que es el especificado inicialmente, como puedo que se muestre _Hola Mundo_ , el idioma del dispositivo ya está especificado en español de España, es decir que use "es-ES" | **Solucionado!**
La traducción de recursos en las aplicaciones universales de windows10 las (UWP), en el identificador del recurso de traducción además de especificar un identificador se debe especificar a que propiedad afectará, es decir si el destinatario és un `textblock` para cambiar el texto se requiere modificar la propiedad `text`, por lo cual dentro de `Resources.resw` `idRecurso.Text` y el valor a remplazar.
**Resources.resw**
helloWorld.Text => Hola mundo
En el layout XAML se debe especificar la relación con el recurso con `x:Uid`:
<TextBlock x:Uid="helloWorld" /> | stackexchange-es_stackoverflow | {
"answer_score": 2,
"question_score": 4,
"tags": "xaml, uwp"
} |
css border problem
For some reason I have a very ugly orange part of a border around a image.
Can anyone see why this is?
This is the HTML
<div class="preview">
<a href="images/foto/full/280899624_6_5_j6.jpeg" title="Sportschool Raymond Snel" rel="lightbox"><img src="images/foto/full/280899624_6_5_j6.jpeg" alt="text" /></a>
</div>
This is the css
.preview {
width: 85px;
height: 85px;
overflow: hidden;
border: 3px solid #2e2a26;
}
The color code = FF6a00 but appears only one time in the css file.
a {
color: #ff6a00;
text-decoration: none;
border: 0px;
}
As you can see I already gave it a 0px, but for some reason the border is still there. | Try this:
.preview a:link img, .preview a:active img, .preview a:hover img, .preview a:selected img, .preview a:visited img{border-style:none;} | stackexchange-stackoverflow | {
"answer_score": 1,
"question_score": 0,
"tags": "css, border"
} |
Firebug CSS strike-through
I've made an global css that I used in two page (basic search and advance search page). I use it in advance search page, and the css script is running well. But when I move to basic search page (by click a link), the css not working. I used firebug to see what happen, and then I found that the css script is strike-through. !css strike-through How can I solve it,.? | That basically means that your CSS property is being overriden by another CSS.
See where that property is defined, and you'll probably need to fix the order of the CSS inclusion on your web-page. | stackexchange-stackoverflow | {
"answer_score": 11,
"question_score": 7,
"tags": "css, firebug, strikethrough"
} |
Small turkey for practice
Thanksgiving is getting closer and I want to cook a turkey. However, I want to cook a test turkey first.
Problem is, the turkeys in the grocery stores will be massive, and I just want to practice on a small turkey.
I was wondering if I can just use a chicken for practice? What do you do when you want to practice something before serving it to guests? | I like to practice too if it's something I've never made before. Roasting a chicken will give you an opportunity to practice the all-important skill of correctly placing the thermometer, but chicken has a different flavor than turkey.
One option is to get the smallest turkey you can find, experiment with a brine (which I highly recommend for roasted turkey) and perhaps go into Thanksgiving with a bit more confidence.
You can always cut up the turkey meat and freeze it for sometime after Thanksgiving when you're no longer sick of turkey. Leftover turkey makes great tamales or enchiladas. | stackexchange-cooking | {
"answer_score": 4,
"question_score": 3,
"tags": "turkey"
} |
An Euclidean style construction
Given a right angle at $O$ (Origin), a point $B$ on one arm, and a point $A$, construct with ruler and compass a circle with center $O$, meeting the arms of the right angle at $C,\, D,$ such that $AD$ is parallel to $BC$. (par 9)
Its not so hard to construct a parallel line passing through $A$ where one side touch's a point on the radius of circle but both is alot harder. we will want the angle to be $45^°$ but I am not sure how to construct it in only nine steps where neither of the parallel lines count as a step.
This is exercie 13.18 in geometry from Hartshorne. | First, consider the analytic solution of the problem.
Let the coordinates of the points in the figure below be: $B=(b,0)$, $A=(u,v)$, $D=(R,0)$, and $C=(0,R)$.
.$$ This formula shows that the segment of length $R$ can be constructed if segments of lengths $u,v$ and $b$ are given.
See this article to learn how to multiply segments. See this answer to learn how to take square roots. Addition, subtraction, and halving must be obvious. | stackexchange-math | {
"answer_score": 3,
"question_score": 0,
"tags": "geometry, euclidean geometry"
} |
Why is parent showing child's offsetTop value?
I have a div element (parent) which contains another div element (child).
The child element has `margin-top : 30px` set via CSS. When I calculate the `offsetTop` of the parent, it reports `30px` even if the parent does not have any margin set!
What is more weird is that as soon as I put border on the parent, then `offsetTop` works as desired. Please see this jsFiddle.
Why does putting a border on the parent alter its `offsetTop` value? | That's because of _margin collapsing_
From Mozilla Developer Network :
> **Parent and first/last child**
>
> If there is no border, padding, inline content, or clearance to separate the margin-top of a block with the margin-top of its first child block, or no border, padding, inline content, height, min-height, or max-height to separate the margin-bottom of a block with the margin-bottom of its last child, then those margins collapse. The collapsed margin ends up outside the parent.
Use `outline` property to see what really happens behind the scenes...
**Demo** | stackexchange-stackoverflow | {
"answer_score": 3,
"question_score": 2,
"tags": "javascript, html, css"
} |
Some messed up words - Clue Six
<\---Previous clue
* * *
The door swings open, to reveal _[redacted]_ waiting there for you. Your jaw drops. You had no idea that this was so important, that _she_ would get involved.
_[redacted]_ steps towards you and hands you a piece of paper. It reads:
> ho an head ded ho if an ac
But you don't immediately focus on it. Instead, you focus on the _[redacted]_ family leader, A _[redacted]_ C _[redacted]_.
"What are you doing here?" you ask.
But instead of replying, she just smiled, and whispered, "You should go work on that now."
And stepping back, she disappears through a trapdoor.
You go to inspect the floor where she disappeared, but there's nothing. Those _[redacted]_ scientists are good. You settle down on the floor in defeat, staring gloomily at the paper in your hand.
* * *
Next clue--> | And the answer is
> wormwood
All you have to do is to
> add up the alphabetical value of all letters in the word to produce a new letter. | stackexchange-puzzling | {
"answer_score": 6,
"question_score": 3,
"tags": "cipher, story"
} |
What are the slots on my character information when I use cat form?
What are the slots (see pic below) that I get under my character bar when I enter cat mode? I'm a night elf restoration druid.
Also: should the bar on which my name is placed be full? does it indicate anything?

Thanks | Just do it in the UPDATE:
UPDATE table SET count = count + 1 WHERE row = 1
(Or `count = count + 5`, or whatever.) | stackexchange-stackoverflow | {
"answer_score": 3,
"question_score": 1,
"tags": "mysql"
} |
Have arrows in a category with this property a special name?
Studying posets I encountered the notation $a\prec b$. It means that $a<b$ and no $c$ exists with $a<c<b$. If $a\prec b$ then in words $a$ is _covered_ by $b$. Looking at a poset $P$ as a category you could say that for the arrow $f$ in $P\left(a,b\right)$ we have: $$f=g\circ h\Rightarrow g=1\vee h=1$$ It reminds me of elements in a ring that are irreducible.
Suppose that more generally in a category $\mathcal{C}$ there is an arrow $f$ - which is not an isomorphism itself - satisfying: $$f=g\circ h\Rightarrow g\text{ is isomorphism}\vee h\text{ is isomorphism}$$ Is there a name (p.e. _irreducible_ ) for arrows having that property? | Auslander and Reiten ( _Representation theory of artin algebras_ ) introduced the notion of an irreducible morphism, but it differs from your notion: A morphism $g$ is irreducible if $g$ is neither a split mono nor a split epi, and if, for any factorization $g=fh$, either $f$ is a split mono or $h$ is a split epi.
For monoids (regarded as categories with one object), this reads: $g$ is irreducible, if $g$ is neither left nor right invertible, and if, for any factorization $g=fh$, either $f$ is left invertible or $h$ is right invertible. But _your_ notion becomes the usual notion of irreducibility (no unit, and in every factorization a unit occurs). In the commutatice case, there is no difference.
I think it really depends on the application which notion one uses. | stackexchange-math | {
"answer_score": 4,
"question_score": 5,
"tags": "soft question, category theory, terminology"
} |
When do the "-uple"s end?
> **Possible Duplicate:**
> How to form single, double, triple… and uni-, bi-, tri-… words?
There's _single, double, triple, quadruple_... — what's next? Is there an end to the "-uple"s? | It would seem that it is tuple (or, rather, -ple) all the way beyond that:
< | stackexchange-english | {
"answer_score": 1,
"question_score": 0,
"tags": "vocabulary, numbers"
} |
In drools, how to search an object in ArrayList and add if not present
I have following model classes defined -
class A {
ArrayList<Name> listOfNames
}
class Name {
String first
String last
}
When i receive a new Name instance, i would like to check if that exists in instance of class A by comparing first/last fields for each Name in ArrayList. Also would like to put that rule in excel if possible.
Thanks | One possible way of achieving this could be:
rule "test"
when
$a: A($list: listOfNames)
$n: Name()
not Name( first == $n.first, last == $n.last) from $list
then
modify($a){
addName($n)
}
end
Hope it helps, | stackexchange-stackoverflow | {
"answer_score": 1,
"question_score": -1,
"tags": "drools"
} |
sed regex capturing group outputting whole input
I'm trying to use **sed** in order to get following output > `09 Aug 2017 14:15:11` from the string that looks like this `09/Aug/2017:14:15:11`
when I use following code
sed 's/^\(\d+\)\/\(\w+\)\/\(\d+\)\:\(.*\)$/\1 /p' <(echo "09/Aug/2017:14:15:11")
I get whole input string as an output: `09/Aug/2017:14:15:11`
Im doing this in order to execute `date -d` command on the result since `date -d 09/Aug/2017:14:15:11 +%s` is giving me this error: `date: invalid date ‘09/Aug/2017:14:15:11’`. If you have other suggestion rather than using **sed** dont hesitate to make an suggestion.
Thanks! | With `sed`:
$ echo "09/Aug/2017:14:15:11" | sed -e 's#/# #g' -e 's/:/ /'
09 Aug 2017 14:15:11
We use two search and replace commands here, one running after the other. The first one to replace all (notice the global flag, `g`) slashes with spaces (`/` → ``), and the second one to replace just the first colon (`:` → ``) (notice the lack of `g` flag). Both are search and replace commands (`s`), but the first one uses `#` as separator instead of the standard `/`, so we don't have to escape the slash we are searching. | stackexchange-stackoverflow | {
"answer_score": 2,
"question_score": 1,
"tags": "bash, date, sed"
} |
Match strings that might include a number
I would like to match strings that may or may not have 1 or more numbers.
Test Data:
110>=abcdef12
abcdef12>=110
110>=1332abcdef
1442abcdef>=110
110>=abcdef
abcdef>=110
Desired Matches:
abcdef12
abcdef12
1332abcdef
1442abcdef
abcdef
abcdef
I have tried `[a-zA-Z_\d*]+` but this also matches the `110` on each line. Is there a way to exclude just numbers?
I am using python though I believe this to be irrelevant. | Looking at your sample data, I would do it following way:
import re
data = '''110>=abcdef12
abcdef12>=110
110>=1332abcdef
1442abcdef>=110
110>=abcdef
abcdef>=110'''
found = re.findall(r'[a-zA-Z\d]*[a-zA-Z][a-zA-Z\d]*', data)
print(found)
output
['abcdef12', 'abcdef12', '1332abcdef', '1442abcdef', 'abcdef', 'abcdef']
Note that I did not put `_` in pattern, as I do not know if `_` is digit for you or `_` is letter for you, so you would need to adjust it accordingly. | stackexchange-stackoverflow | {
"answer_score": 1,
"question_score": -1,
"tags": "python, regex, python re"
} |
Getting a specific element from a list of tuples
In using Spacy, I have the following:
import spacy
nlp = spacy.load('en_core_web_lg')
sentence = "a quick John jumps over the lazy dog"
tag_entities = [(x, x.ent_iob_, x.ent_type_) for x in nlp(sentence)]
inputlist = tag_entities
print (inputlist)
[(a, 'O', ''), (quick, 'O', ''), (John, 'B', 'PERSON'), (jumps, 'O', ''), (over, 'O', ''), (the, 'O', ''), (lazy, 'O', ''), (dog, 'O', '')]
It is a list of tuples. I want to extract the person element. This is what I do:
for i in inputlist:
if (i)[2] == "PERSON":
print ((i)[0])
John
What would be a better way? | To keep all first element if second element is `PERSON` from first list use a list comprehension notation with a `if` at the end
filtered_taglist = [x for x,_,type in tag_entities if type == "PERSON"]
This corresponds to
filtered_taglist = []
for x,_,type in inputlist:
if type == "PERSON":
filtered_taglist.append(x) | stackexchange-stackoverflow | {
"answer_score": 2,
"question_score": 0,
"tags": "python, tuples, spacy"
} |
Как оставлять прежнее значение поля в UPDATE при передаче NULL?
В UPDATE передаю 7 параметров. Произвольное количество которых может быть null. Как построить SQL запрос таким образом, чтобы в случае значения переменной null оставалось старое значение в бд? | Можно воспользоваться функцией `COALESCE` и тем фактом, что выполнение `Value = Value` в `UPDATE` оставляет прежнее значение:
UPDATE FooTable
SET BarColumn = COALESCE(@BarColumn, BarColumn) | stackexchange-ru_stackoverflow | {
"answer_score": 5,
"question_score": 2,
"tags": "c#, sql, .net, sql server"
} |
How to query FLAG_SECURE from current APK screen via command line?
How can I query against the current window/activity of an android app to check window flag FLAG_SECURE? Is this possible using ADB or any other command line tool against an APK?
My use case is: I would like to query the device to see if FLAG_SECURE is enabled on the current screen. I do not have access to source code, I am just working with an APK as a black box acceptance tester.
Note that this other question is similar and unanswered: Android - Window Flags | You can find out if some specific window has the `FLAG_SECURE` set by just checking `mAttr` line in the `dumpsys window <window id>` output:
~$ dumpsys window com.android.settings | grep ' mAttrs='
mAttrs=WM.LayoutParams{(0,0)(fillxfill) sim=#20 ty=1 fl=#85810100 pfl=0x20000 wanim=0x103046a vsysui=0x700 needsMenuKey=2}
The `fl=` value is the `WindowManager.LayoutParams().flags` of that window in hex. `FLAG_SECURE` is a bitmask with the value of `0x2000`. This is how you can check it right in the `adb shell`:
for f in $(dumpsys window com.android.settings | grep ' mAttrs=' | grep -o ' fl=#[^ ]*'); do [[ $((16#${f#*#}&8192)) -ne 0 ]] && echo 'FLAG_SECURE is set' || echo 'FLAG_SECURE is not set'; done | stackexchange-stackoverflow | {
"answer_score": 1,
"question_score": 3,
"tags": "android, adb"
} |
Set variable as empty string in logic apps
How can I set variable as empty string in logic apps?
If I set no value in Value field I get "Error: Failed to save logic app. Definition contains invalid parameters."  like below picture.
 Special Characters
So I have set up a database in MongoDB and a majority of documents contain a special code which can begin with a * and finish with a #. When I use the following query on the MongoDb command line, it works fine but when I try to use it in a python script, it doesn't work.
cursor = collect.find({$and:[{"key":/.*\*.*/},{"key":/.*\#.*/}]})
I think the problem lies with the # in the query but when I wrap it in " ", it doesn't work.
cursor = collect.find({'$and':[{"key":'/.*\*.*/'},{"key":'/.*\#.*/'}]})
Please note that I put ' ' around $and and the first expression to match because syntax errors appear when I attempt to run it.
Thanks | If you want to query using a regular expression, then you have to create a Python regular expression object. Note that in this case the string should not be surrounded by `//`.
import re
cursor = collect.find({'$and':[{"key":re.compile('.*\*.*')},{"key":re.compile('.*\#.*')}]})
Alternatively, you can use the `$regex` operator
cursor = collect.find({'$and':[{"key": {"$regex": '.*\*.*'}},{"key": {"$regex": '.*\#.*'}}]}) | stackexchange-stackoverflow | {
"answer_score": 0,
"question_score": 0,
"tags": "python, mongodb, pymongo"
} |
Interpreting Hard Drive status from S.M.A.R.T. results
I had Windows running CHKDSK on a drive at boot recently, I had to cancel every time because it took more than a day once and I didn't have that much time. I immediately backed up the data and formatted the drive hoping it would go away.
It did, but I wanted to check if the drive was still okay. After seeing this question I installed CrystalDiskInfo and obtained these results:
!SMART results via CrystalDiskInfo
Noting the _Current Pending Sector Count_ and _Uncorrectable Sector Count_ , I'd like some advice, particularly to the obvious questions:
1. What does this mean for this drive? Googling/Wiki-ing it only leads to more HD jargon :(
2. Should I even use this drive?
3. Tools to fix?
4. Would what ever issue it is be covered by warranty? | When a sector is bad, your hard drive attempts to remap it to a spare sector (subsequent write request to the bad sector would be redirected to the remapped spare sector).
From your screenshot, _Pending Sector Count_ indicate 0xB8=184 sectors waiting to be reallocated,
and _Uncorrectable Sector Count_ indicate 0xA7=167 sectors that failed to be reallocated.
This isn't a good thing - it means possible physical damage, and your drive doesn't seem to be able to work around it.
If it's under warranty, I believe its RMA-able (this is the sort of failure that happens from regular use), but depends on the make of the drive - if its a seagate/maxtor drive, running seatools will tell you if you can get it swapped If Western Digital Data LifeGuard Diagnostics will identify an issue and provide details needed to RMA | stackexchange-superuser | {
"answer_score": 1,
"question_score": 3,
"tags": "hard drive, smart, bad sectors"
} |
iOS iPad how to create a UIPopoverController with UIActionSheet?
I'm remaking one of my iPhone apps that uses `UIActionSheet` into an iPad app and **would like to add the action sheet within a** `UIPopoverController`. I know this shouldn't be too difficult, but I'm very new to the whole popover design. Is there's an example I can take a look at? | You dont need to add it in Popover view. UIActionSheet is normally wrapped inside Popover view in iPad | stackexchange-stackoverflow | {
"answer_score": 1,
"question_score": 0,
"tags": "ios, objective c, ipad, uipopovercontroller, uiactionsheet"
} |
Which RAID setup to use for a build-computer?
I am wanting to setup a computer(actually multiple with the same setup) to build and compile programs. Security of the data is not important, and space for the most part is not important. (as in, 40G is plenty)
I have 2 40G IDE harddrives(UDMA) of different types (One is Western Digital, the other Seagate)
Which level of RAID would be the best for this setup? I will be using softraid(4) which offers RAID levels 0,1,4, and 5. | RAID0 is best for this application, since even though you will be doubling the chance of failure, you said security is not important. Compilation is very I/O-intensive (much more so than CPU-intensive), and the extra speed gain from use of RAID0 would make a big difference in your compile times. I would go with a fairly small or middle-of-the-road stripe size from the options your RAID hardware (or software) offers you. | stackexchange-superuser | {
"answer_score": 3,
"question_score": 2,
"tags": "raid, software raid, compile, openbsd"
} |
How to run crontabs with sudo R CMD BATCH?
I would like to run a crontab every day at 12h. So I defined a path to my Script with the following syntax: `00 12 * * * sudo R CMD BATCH /home/.../test.R`
In order to test that I just ran:
sudo R CMD BATCH /home/.../test.R
And get the message:
basename: extra operand ‘.R’
Try 'basename --help' for more information.
I tried many combinations but nothing seems to work. Maybe one has an advice? | Try following `Rscript filePath.R`
I mean your cron entry get modified as
00 12 * * * sudo Rscript /home/.../test.R
Let me know if any issues. | stackexchange-askubuntu | {
"answer_score": 1,
"question_score": 1,
"tags": "14.04, 12.04, command line"
} |
Question about proving $\mathbb{Z}[i]$ is not UFD
I know is a silly question, but why $10=\left(3+i\right)\left(3-i\right)=2\cdot5$ is not enough to prove that $\mathbb{Z}[i]$ is not a UFD. Thanks in advance! | Because $2=(1+i)(1-i)$ and $5=(2+i)(2-i)$, while $3+i=(1+i)(2-i)$ and $3-i=(1-i)(2+i)$. So really, you've just grouped the four prime factors of $10$ together in different ways. | stackexchange-math | {
"answer_score": 8,
"question_score": 5,
"tags": "abstract algebra, ring theory, unique factorization domains"
} |
C++ Win32 How to Create a "toggle" Pushbutton
I was originally thinking this would be extremely easy to do. Google searches returned results for everything but this.
I am trying to have a normal button that I can click, and it stays down, click again, and it rises back up.
I found one function that did what I wanted, but only worked if the button retained focus, click anywhere else and it rises again.
`Button_SetState(GetDlgItem(hwnd, IDC_BTN_SLEEPCLICK), TRUE);`
Is there any real way to do this? Or am I gonna need to do this kind of thing by hand?
Thanks. | Create a check box, then set the "push like" property for that check box to true. | stackexchange-stackoverflow | {
"answer_score": 5,
"question_score": 1,
"tags": "c++, winapi, button, toggle"
} |
Nginx rewriteurl from example.com/script.php?param=value to example.com/value
I have a PHP script that accepts a single parameter.
My project structure is like the following:
index.php
i.php
terms.php
functions
includes
icons
resources
The script that I want to rewrite its URL is `i.php` from
example.com/i.php?icon=id
to
example.com/id
While making sure everything else is normally accessible (e.g. `example.com/terms.php`).
How do I do that?
**Edit** This might be helpful. Here's my previous .htaccess that I used to use on my apache server:
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^(\w+)$ ./i.php?icon=$1 | I've got it working by using this:
location / {
try_files $uri $uri/ /i.php?icon=$uri;
} | stackexchange-stackoverflow | {
"answer_score": 0,
"question_score": 0,
"tags": "php, nginx, url rewriting"
} |
SharePoint High Trust Application - stopped being trusted - 401
We've got a high trust application which ok, in the mornings seem to 'not work' but then after the first hour was fine. But now it just blankly doesn't work with the non helpful.
System.Net.WebException: The remote server returned an error: (401) Unauthorized.
at System.Net.HttpWebRequest.GetResponse()
at Microsoft.SharePoint.Client.SPWebRequestExecutor.Execute()
at Microsoft.SharePoint.Client.ClientRequest.ExecuteQueryToServer(ChunkStringBuilder sb)
Any ideas?
* * *
Edit
Ok, so bit more information, we managed to plug in fiddler into the solution using the lines
<system.net>
<defaultProxy>
<proxy usesystemdefault="False" bypassonlocal="False" proxyaddress=" />
</defaultProxy>
</system.net>
These showed the results coming back but labelled 401. | In the end we ran
Set-SPAppPrincipalPermission -Site $web -AppPrincipal $appPrincipal -Scope Site -Right FullControl
and then did a iisreset on the share point server.
For us we have 3 iis servers for the high trust solution, load balanced and then 2 sharepoint frontend servers. We did bypass the loadbalencer for the 2 sharepoint frontends -but we'll probably bring that back into the fray for dependency. | stackexchange-sharepoint | {
"answer_score": 0,
"question_score": 0,
"tags": "401, high trust app, sql server 2016"
} |
What makes random variables exchangeable and what is implied by exchangeability?
Consider a $d$-dimensional random vector$\ X=(X_j)$. $\ X$ is called exchangeable if $\ (X_1,\ldots,X_d)\mathrel{\overset d =} ({X_{{j_1}}},\ldots,X_{j_d})$ for any permutation$\ j_1,\ldots, j_d$. If$\ X_j$ are iid,$\ X$ is exchangeable. The converse is false (correct me if I'm wrong). What can we say about just identically distributed $\ X_j$? What can we say about $\ X_j$ if we know that$\ X$ is exchangeable? | A simple and rather general way to build an exchangeable random vector $X=(X_k)_{1\leqslant k\leqslant n}$ is to start from an i.i.d. sequence $(Y_k)_{1\leqslant k\leqslant n}$ and to define, for every $k$, $X_k=\Phi(U,Y_k)$, where $U$ is a random variable independent on $(Y_k)_{1\leqslant k\leqslant n}$ and $\Phi$ a measurable function.
And, in some (loose) sense, this is the only way... as shown by Diaconis and Freedman for finite sequences, using mixtures of urn sequences rather than mixtures of i.i.d. sequences, and earlier, by de Finetti for infinite sequences. | stackexchange-math | {
"answer_score": 14,
"question_score": 20,
"tags": "probability"
} |
HCL Domino 11 - Logo not getting changed from orange to blue after domino upgrade from 8.5 to 11
We have upgraded Domino / Notes from version 8.5.3 to 11.0.1. We have around 8 servers. All servers displays new logo (blue) of Notes except one which still displays old orange one in browser. I have attached the logos of two different servers which are both on Notes 11.0.1. May I know where is this setting or configuration available ?
...
The icon is usually replaced during update. It is located in
...\Domino\Data\domino\html\favicon.ico
If it has not been replaced (showing as orange in Explorer), then most probably more then just the icon is missing: Then better install 11.0.1 again to make sure, all files are replaced properly. | stackexchange-stackoverflow | {
"answer_score": 0,
"question_score": 1,
"tags": "lotus domino, hcl notes"
} |
No query results for model [App\Models\Favourite]
public function destroy($id)
{
$bar = Favourite::findOrFail($id);
$bar->where('bar_id', $id)->delete();
}
* I am getting this error 'No query results for model [App\Models\Favourite].', when i am trying delete value with this query.
\- | You are using `findOrFail` it means if it dosen't get a result it will throw an exception, as documentation says you will get this exception:
> Illuminate\Database\Eloquent\ModelNotFoundException
>
> Message: No query results for model [App\Models\Favourite]
So the right way to do it on the controller should be:
use Illuminate\Database\Eloquent\ModelNotFoundException; //Import exception.
try {
Favourite::destroy($id);
} catch (ModelNotFoundException $e) {
// Handle the error.
}
Another way to do it is like this on the model:
public function destroy($id)
{
return Favourite::find($id)->delete();
}
But you need to control what happens when the Model is not found. | stackexchange-stackoverflow | {
"answer_score": 3,
"question_score": 1,
"tags": "php, laravel 5, eloquent"
} |
Does Stack Exchange offer internships?
As a high school student, a future college student, and someone who loves coding and answering questions on SO, I was wondering if there was a Stack Exchange internship, or perhaps something similar, for students to learn and develop their coding skills. If there were, that would be really awesome, and it would be a great experience. Is there a SE internship, and has anyone ever considered it? | We don't currently offer any internships. If we ever do, they'll be posted on Jobs and also listed here: stackoverflow.com/company/work-here.
Other companies do occasionally list internships on Jobs \- if you're interested in finding one, you might want to sign up and poke around a bit... See: Stack Overflow Careers and Internships? | stackexchange-meta | {
"answer_score": 17,
"question_score": 16,
"tags": "discussion, jobs, stack exchange team, internships"
} |
Spring Repository: get number of deleted rows
I'm in need of getting count of deleted rows by Spring Repository custom query (i'm implementing basic external lock mechanism for application and is limited to MySQL database only). How can i achieve that? | Create a repository method with the `@Modifying` annotation as described here:
@Modifying
@Query("delete from data where createdAt < ?1")
int retainDataBefore(Date retainDate);
Return value gives you the count of deleted rows. | stackexchange-stackoverflow | {
"answer_score": 35,
"question_score": 18,
"tags": "spring data"
} |
Procedure of PRESS statistic
It is not very clear for me the calculation steps of PRESS statistic. What I have found:
1)we set aside the $j_{th}$ observation $x_j,y_j$ from the training set(It means, that we just remove the point $j$ from our model)
2)we use the remaining $N−1$ observations to estimate the linear regression coefficients $β^{−j}$ (So we calculate the regression without removed point)
3)we use $β^{−j}$ to predict the target in $x_j$(Not clear what does it mean?)
4) $e^{loo}_j=y_j− \hat y^{-j}$, where loo means leave-one-out
Can you please explain what we are doing in step 3 and 4? It's not very clear for me | * in step 3 you predict the observation you left out using the model you fitted to the rest of the data (which you got back at step 2)
* in step 4 you calculate the prediction error (the omitted observation minus the prediction for it you made in step 3).
(You would then sum the squares of the prediction error)
In practice in regression you don't need to actually do the steps of omission and re-fitting and prediction, since you can calculate the PRESS from the fit to the complete data. | stackexchange-stats | {
"answer_score": 5,
"question_score": 3,
"tags": "regression, algorithms, diagnostic"
} |
How to calculate the quantum of the difference between two value of clock counter where the values are divided by 64?
I have a counter in my embedded system with `f = 64 Mhz`.
let's say its read value is $cnt_i$ where $i$ is the index of the time I sampled it. $$\Delta = cnt_{i+1} -cnt_i$$
let's say I take $\Delta^{'} = \Delta/64 = \Delta >>6$ where $>>$ is shift right operator.
I understand that the value of the actual counter now is equivalent to `1 Mhz` but How can I show that.
$\Delta^{'} = \Delta/64 $ $[\Delta^{'}]_{sec} = \frac{\Delta}{64Mhz}*\frac{1}{64}$
but it is exactly the opposite, what do I miss? | In order to show that a counter is running at a specific frequency, you need to take two readings spaced at some known time period apart and then calculate how many ticks would occur in one second. Say that you take two measurements from a monotonically-increasing counter at times $t_1$ and $t_2$. Their difference is:
$$ \Delta C = C_{t_2} - C_{t_1} $$
You can calculate the frequency of the counter from the difference as follows:
$$ f = \frac{\text{number of ticks}}{\text{time period}} = \frac{\Delta C}{\Delta t} = \frac{C_{t_2} - C_{t_1}}{t_2 - t_1} $$
In your example, if you divide both counter values $C_{t_1}$ and $C_{t_2}$ by a factor of 64 (for instance, by right-shifting by 6 bits), then the above equation becomes:
$$ f = \frac{1}{64}\frac{C_{t_2} - C_{t_1}}{t_2 - t_1} $$
Therefore, the action of dividing the counter's output value by 64 has the likewise action of dividing its output frequency by the same factor. | stackexchange-dsp | {
"answer_score": 1,
"question_score": 0,
"tags": "frequency, sampling"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.