qid int64 10 74.7M | question stringlengths 15 26.2k | date stringlengths 10 10 | metadata list | response_j stringlengths 27 28.1k | response_k stringlengths 23 26.8k |
|---|---|---|---|---|---|
69,306,523 | I have a dataset about start and end dates, and I want to expand them to consecutive dates in rows. The dataset looks like this (df1):
```
id deg from to
1 1 2010-03-01 2010-03-05
1 1 2010-03-20 2010-03-25
1 2 2010-06-01 2010-06-05
```
And this is the re... | 2021/09/23 | [
"https://Stackoverflow.com/questions/69306523",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16634627/"
] | put this code in your Podfile
```
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
target.build_configurations.each do |build_configuration|
build_configuration.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'arm64 i38... | Add the below lines to your podfile. Place the below lines in the post\_install do [installer] section at the bottom of the Podfile.
Code :
```
target.build_configurations.each do |build_configuration|
build_configuration.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'arm64 i386'
end
``` |
1,500,390 | I am trying to serialize an extended UIComponent (com.esri.ags.layers.GraphicsLayer) to send and store in a MSSQL Server database using WebOrb.
Apparently, these types of objects aren't meant to be serialized, and I haven't had much serializing/deserializing using the flash byteArray. I have also tried several other l... | 2009/09/30 | [
"https://Stackoverflow.com/questions/1500390",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/163757/"
] | Corbin's answer is the best one here.
[link text](http://developer.apple.com/mac/library/samplecode/DragNDropOutlineView/Introduction/Intro.html "DragNDropOutlineView") | I don't believe the action method is called when multiple rows are selected.
What would probably be a lot easier would be to override the `menuForEvent:` method in `NSTableView`. You'd have to create a subclass of `NSTableView` to do this, but it would be a cleaner solution.
You could also create an informal protocol... |
39,415,367 | Bear with me as this is the first time I've used Spring Boot so this is only what I *think* is happening...
I have a couple of methods which are annotated with `@Scheduled`. They work great, and I have all of the dependencies configured and injected. These dependencies are quite heavy weight, relying on internet conne... | 2016/09/09 | [
"https://Stackoverflow.com/questions/39415367",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/862410/"
] | Just add the following to your test class:
```
@MockBean
public Database d;
``` | Another alternative: use a in-memory database like h2 when testing. Create an `application-test.properties` with
```
spring.datasource.url=jdbc:h2:mem:testdb
spring.datasource.driverClassName=org.h2.Driver
spring.datasource.username=sa
spring.datasource.password=password
spring.jpa.database-platform=org.hibernate.dial... |
49,980,265 | I am trying to optimize the following query :
```
Select distinct cadData.id FROM CAD_Data cadData
INNER JOIN Sales_Data SD
ON cadData.CAD_Acct=SD.CAD_Acct
and SD.List_Date = (
select max(List_Date)
from Sales_Data
where Sales_Data.CAD_Acct=cadData.CAD_A... | 2018/04/23 | [
"https://Stackoverflow.com/questions/49980265",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4600064/"
] | if you want to remove partition expiration completely, set `NULL` for `partition_expiration_days` option
```
ALTER TABLE `project-name`.dataset_name.table_name
SET OPTIONS (partition_expiration_days=NULL);
``` | we can try updating this way:-
[set partition Expiration time on Table](https://i.stack.imgur.com/PzvS9.png) |
29,077,104 | I'm trying to configure a mapped class to use a sequence I defined in a postgres db. The ids are always zero when I try to persist any entities, if I use select nextval('item\_seq'), I'll get 1 (or the next val). I used intellij to regenerate the classes. The version of hibernate in this project is 3.6.0, if that might... | 2015/03/16 | [
"https://Stackoverflow.com/questions/29077104",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/682059/"
] | This always works for me (Hibernate 4.x though):
```
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
```
`@Id` makes the column a primary key (unique, no nulls), so you don't need the `@Column(...)` annotation. Is something setting your `itemId` somewhere? You can remove its setter if you ha... | what database u are using?
can be possibly a database that does not support sequence??
try to use strategy=auto and see how does it work
since 'select nextval(...)' works, your database (postgresql) is supporting sequence. so thats not it
maybe for some reason hibernate is threating yout `int == 0` as an id and it i... |
53,758,509 | I'm trying to upload a csv. file I have on HDFS to mongoDB. I'm using a python script for that purpose: <https://i.imgur.com/G33sDaz.png>
Using spark 2 and the command:
spark-submit --packages org.mongodb.spark:mongo-spark-connector\_2.11:2.0.0 cities\_mongodb.py
gets me the following error message: <https://i.imgur... | 2018/12/13 | [
"https://Stackoverflow.com/questions/53758509",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10785117/"
] | It is possible, but a bit hack, because is necessary converting to `object`:
```
df3['T'] = np.array([int(x) if int(x) == x else x for x in df3['T']], dtype=object)
print (df3)
T v2 v3 v4
0 11 11.0 112.1 NaN
1 22 13.0 2.0 blue
2 11.23 55.1 2.1 1
3 20.03 33.0 366.0 2
p... | Using the same idea of @jezrael but with [is\_integer](https://docs.python.org/3/library/stdtypes.html#float.is_integer):
```
import numpy as np
import pandas as pd
df3 = pd.DataFrame({
'T': [11.0, 22.0, 11.23, 20.03],
'v2': [11.0, 13.0, 55.1, 33.0],
'v3': [112.1, 2.0, 2.1, 366.0],
'v4': [np.nan, "blu... |
70,059,204 | I want to import numbers (40000 in total, space-separated) (format: 2.000000000000000000e+02) with "fscanf" and put it in a 1D-Array. I tried a lot of things, but the numbers I am getting are strange.
What I've got until now:
```
int main() {
FILE* pixel = fopen("/Users/xy/sample.txt", "r");
float arr... | 2021/11/21 | [
"https://Stackoverflow.com/questions/70059204",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17474208/"
] | Instead of:
```
fscanf(pixel,"%f", arr);
```
which is the exact equivalent of this and which read only one single value:
```
fscanf(pixel,"%f", &arr[0]);
```
you want this:
```
for(int i = 0; i<40000; i++)
fscanf(pixel,"%f", &arr[i]);
```
Complete code:
```
#include <stdio.h>
#include <stdlib.h>
int main(... | You need to call `fscanf()` in a loop. You're just reading one number.
```
int main() {
FILE* pixel = fopen("/Users/xy/sample.txt", "r");
if (!pixel) {
printf("Unable to open file\n");
exit(1);
}
float arr[40000];
for (int i = 0; i < 40000; i++) {
fscanf(pixel, "%f", &arr[i... |
649,019 | I have a WSDL file for a web service. I'm using JAX-WS/wsimport to generate a client interface to the web service. I don't know ahead of time the host that the web service will be running on, and I can almost guarantee it won't be <http://localhost:8080>. How to I specify the host URL at runtime, e.g. from a command-li... | 2009/03/16 | [
"https://Stackoverflow.com/questions/649019",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40310/"
] | The constructor should work fine for your needs, when you create MyService, pass it the url of the WSDL you want i.e. <http://someurl:someport/service?wsdl>. | In your generated code (eg: say "HelloWorldWebServiceImplService" ) look in to the static block on the top which will have reference to the WSDL url or wsdl file which is under META-INF.
```
/*
static {
URL url = null;
try {
url = new URL("http://loclahost/HelloWorld/HelloWorldWebServiceImpl?wsdl");
... |
35,070 | Is there a single English word to describe when someone has appropriated property that doesn't belong to them unintentionally?
For example, say I borrow a pen from someone and absentmindedly put it in my pocket after I finish writing. I discover the pen much later. Did I steal it, or is there a term with less harsh c... | 2011/07/21 | [
"https://english.stackexchange.com/questions/35070",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/10453/"
] | Unfortunately most terms I can think of are equally harsh.
Even **misappropriate** (to steal something that you have been trusted to take care of and use it for your own good) implies misuse of someone else's property. However it does at least imply that you were originally given the pen by the original owner rather t... | The word you are looking for is, "CONVERSION". Basically, the difference is, your intent wasn't to deprive the owner of his/her property. In an extreme case, taking a neighbors car to go joyriding with no intent to damage or cause any loss to its owner. |
28,561,470 | I have a table with multiple columns. In one of the column rows I want to add 2 elements which will be next to each other. One text element and one icon. The icon has a fixed with, the text element needs to be dynamic and has to be truncated with ... when the column cannot stretch anymore.
This is the HTML:
```
<tabl... | 2015/02/17 | [
"https://Stackoverflow.com/questions/28561470",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2247819/"
] | Suppose `df` is your data.frame. The first thing is to convert all `factors` in `character`. Then replace with the wanted values - I do this with a deep functional programming approach, so no side effect on your `df` :) and convert wanted columns to `numeric`:
```
library(functional)
df[] = lapply(df, as.character)
... | Have you tried
```
d1[d1 == "P"] <- 2
d1[d1 == "A"] <- -2
d1[d1 == "M"] <- 0
```
Then you can take rowsums of d1[, 2:5] and place then in the last column.
And finally replace again with
```
d1[,6][d1[,6] > 0] <- "P"
d1[,6][d1[,6] < 0] <- "A"
``` |
62,963 | Last year, Scott Guthrie [stated](http://weblogs.asp.net/scottgu/archive/2007/07/31/linq-to-sql-debug-visualizer.aspx) βYou can actually override the raw SQL that LINQ to SQL uses if you want absolute control over the SQL executedβ, but I canβt find documentation describing an extensibility method.
I would like to mod... | 2008/09/15 | [
"https://Stackoverflow.com/questions/62963",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5869/"
] | The ability to change the underlying provider and thus modify the SQL did not make the final cut in LINQ to SQL. | `DataContext x = new DataContext`
Something like this perhaps?
`var a = x.Where().with()`...etc
It lets you have a much finer control over the SQL. |
23,012,148 | I have a query that produces one row. I would like to output this one row multiple times, determined by a constant in this query. The query is on the format:
```
select A.a, B.b, C.c from A
inner join B ..
inner join C ..
where A.a =.. and B.b = .. and C.c = ..
```
This gives the result:
```
[A.a, B.b, C.c]
```
b... | 2014/04/11 | [
"https://Stackoverflow.com/questions/23012148",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1731401/"
] | You will need to a table to use in a [Cartesian product](http://en.wikipedia.org/wiki/Cartesian%5fproduct). Using a Cartesian product will multiply your business data results by the number of rows in the table.
I would generate the table as an in-memory table rather than a physical table. That way you don't have addi... | This is a little workaround, but you can make a table, that contains number from 1 to 10 for example. Then you can join your row with this table where number\_in\_aux\_table <= your constant. |
26,796,159 | I want to know about that how can we stream videos from one my one drive using Office 365 api, Is it possible or we have to download file first
I am exploring the following api provided by Microsoft
<http://msdn.microsoft.com/en-us/office/office365/howto/common-file-tasks-client-library#GetClient>
Thanks is advanc... | 2014/11/07 | [
"https://Stackoverflow.com/questions/26796159",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1097149/"
] | No you can't stream it using the O365 REST API, you'll have to download the file first. | You could try HTTP progressive download mechanism that doesn't require full file to be downloaded prior to playback. The media player has to be capable of playing with buffered data. On most modern players that is supported. |
426,537 | I am writing a bash script to move all images into a central file.
I create the list of image files with:
```
img_fil='/home/files/img_dump.txt'
locate -i image | grep \.jpg > "$img_fil"
locate -i image | grep \.jpeg >> "$img_fil"
locate -i image | grep \.gif >> "$img_fil"
locate -i image | grep \.tif >> "$img_fil"
l... | 2018/02/25 | [
"https://unix.stackexchange.com/questions/426537",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/72706/"
] | ```
fpath="$(dirname $fline)"
fname="$(basename $fline)"
```
Here, you need to quote `$fline` inside the command substitution. (Outside doesn't matter since it's in an assignment.) So:
```
fpath=$(dirname -- "$fline")
```
or
```
fpath=${fline%/*}
```
(Though note the minor differences between `dirname`/`basena... | Where are you using `$img_fil` in your script? Shouldn't the line `done` be `done < "$img_fil"`? |
1,676,723 | I'm taking an analysis class and I'm a little confused about this question. Also I'm mostly a computer science guy so I'm not great at proof based math so I apologize if this is ignorant
>
> Let $A = \{x : x \in \mathbb Q,\ x^3 < 2\}$
>
>
> Prove that $\sup A$ exists. Guess the value of $\sup A$.
>
>
>
So from ... | 2016/02/29 | [
"https://math.stackexchange.com/questions/1676723",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/293481/"
] | Hint:
Consider the limit of $\cos(1/x\_n)/x\_n$ as $n \to \infty$ with $x\_n = 1/(2n\pi)$ and $x\_n = 1/ (\pi/2 + 2n\pi)$. | **Not really an answer** but related: the function $$f(z) = \exp(1/z), z\in\mathbb{C}$$ is a famous example of a function having an **essential singularity** at $z = 0$. That means by the famous Casorati-Weierstrass and [Picard's theorems](https://en.wikipedia.org/wiki/Picard_theorem) it will take all possible complex ... |
2,369,939 | Has anyone ever tried to combine the use of google guice with obfuscation (in particular proguard)?
The obfuscated version of my code does not work with google guice as guice complains about missing type parameters. This information seems to be erased by the transformation step that proguard does, even when the relevan... | 2010/03/03 | [
"https://Stackoverflow.com/questions/2369939",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4497/"
] | With the current version of Proguard (4.7) I was able to get it working by adding the following:-
```
-keepattributes *Annotation*,Signature
-keep class com.google.inject.Binder
-keep public class com.google.inject.Inject
# keeps all fields and Constructors with @Inject
-keepclassmembers,allowobfuscation class ... | Following code works for me, having had the same problem.
`-keepattributes Signature` was the fix.
```
-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify
#-dontobfuscate
-repackageclasses ''
-keepattributes *Annotation*
-keepattributes Signature
-verbose
-optimizations ... |
35,775,080 | We're currently working on a query for a report that returns a series of data. The customer has specified that they want to receive 5 rows total, with the data from the previous 5 days (as defined by a start date and an end date variable). For each day, they want the data from the row that's closest to 4am.
I managed... | 2016/03/03 | [
"https://Stackoverflow.com/questions/35775080",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2228526/"
] | assuming that the #tTempData only contains the previous 5 days records
```
SELECT *
FROM
(
SELECT *, rn = row_number() over
(
partition by convert(date, recorddate)
order by ABS ( datediff(minute, convert(time, recorddate) , '04:00' )
... | Try something like this:
```
select
'W' as [RecordType]
, [WellIdentifier] as [ProductionPtID]
, t.Name as [Device Name]
, t.RecordDate --convert(varchar, t.RecordDate, 112) as [RecordDate]
, TubingPressure as [Tubing Pressure]
, Casin... |
4,963,881 | I have an aspx page which allows a user to submit modified entries into the database, but when the user clicks `Submit` to fire the stored procedure I want to first run a check to see if a modified row with the same relationship exists.
I am passing the results of the following query:
```
SELECT SwitchRoom.ModifiedID... | 2011/02/10 | [
"https://Stackoverflow.com/questions/4963881",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/606736/"
] | Try `if (!dbReader.Read() || dbreader.IsDbNull(field)} { .. }` | You're looking for the DBNull type. Databases don't send actual null-references, they send a special datatype in C# to represent a database NULL value. |
6,273,931 | The table view works fine however when I leave the view and come back to it the second time, I get a memory leak. Probably something in the viewDidLoad just not sure.
I am running the leaks tool and am getting the following notification:
```
Leaked Object # Address Size Responsible Library Responsible Frame
N... | 2011/06/08 | [
"https://Stackoverflow.com/questions/6273931",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/323698/"
] | I see most of your statement are ready for leak, e.g in the viewDidUnload method , you are not releasing any instance member properly.
you need to call release on the object which you either alloced, init or retain.
```
(void)viewDidUnload {
// Relinquish ownership of anything that can be recreated in viewDidLoa... | I heard the
>
> [UIImage imageNamed:@"contact.png"];
>
>
>
is a memory occurring line. It will create an autorelease object as the returned object. May be that can also be a problem. |
65,702,197 | I am retrieving data from firebase and storing it into list items. But I want to reverse the order, which will bring new posts at the top. What should I add to make it work that way?
[JsFiddle of my code](https://jsfiddle.net/g0eadwkL/)
This is my function for retrieving the data
```
const dbRef = firebase.database()... | 2021/01/13 | [
"https://Stackoverflow.com/questions/65702197",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13475348/"
] | This worked for me `Modifier.height(IntrinsicSize.Min)`
```
@Composable
fun content() {
return Row(
modifier = Modifier
.height(IntrinsicSize.Min)
) {
Box(
modifier = Modifier
.width(8.dp)
.fillMaxHeight()
.background(Colo... | Have a look at the Layout Composable or Modifier. You can measure the defining element first and then provide modified constraints to the dependent element. If you want to use this as a modifier you should add a size check for the list.
```kotlin
Layout(content = {
Box(modifier = Modifier
.size(width = 30.... |
273,290 | Any idea's how to prevent the title from moving in promoted links webpart and instead remain stationary? Preferably using CSS, but willing to look at other options.
using the below code i can somewhat get it to keep in the same location but it still pops up first.
```
<style type="text/css">
/* This section turn... | 2019/12/09 | [
"https://sharepoint.stackexchange.com/questions/273290",
"https://sharepoint.stackexchange.com",
"https://sharepoint.stackexchange.com/users/87908/"
] | You can create a view with the below filter options,
1. `Assigned To` is equal to `[ME]`
**OR**
2. `Created By` is equal to `[ME]`
So in this view, only the items in which the current logged in user is in "Assigned To" column or "Created By" column will only be displayed. This is a simple way to display item in whi... | You can use [Audience Targeting](https://support.office.com/en-us/article/target-files-news-and-pages-to-specific-audiences-33d84cb6-14ed-4e53-a426-74c38ea32293) to hide the other views. This will allow you to create views where you can use meta data in the list to hide list items only viewed by certain users. This inc... |
30,925,268 | I am having trouble with bash\_completion. When I expand variables, I am fine, but when I use a commands completion (such as `git` or `vim-addon-manager`), then the completion throws random characters in there. This didn't use to happen to me, I can't figure out what it is.
This is an example of what happens when I ty... | 2015/06/18 | [
"https://Stackoverflow.com/questions/30925268",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3772603/"
] | The fundamental difference between mock and stub is that mock can make your test fail. Stub can't. Stub is used to guarantee correct program flow. It is never part of assert.
Note that mock can also be used to guarantee flow. In other words, every mock is also a stub, and stub is never a mock. Because of such overlap... | As a rule of thumb, use Mocks when you need to simulate behavior, and stubs when the only thing that matters in your test is the state of the object you're communicating with.
Taking into consideration the edit you made to your post, when you need to receive an immutable object use a stub, but when you need to call op... |
16,884,746 | I have the following relationship set up in my Core Data model, in my shopping cart app.
`Menu` ->> `Product` <<- `Cart` (See picture below).

And a Objective-C category with the following code:
```
+ (Cart *)addProductToCartWithProduct:(Product *... | 2013/06/02 | [
"https://Stackoverflow.com/questions/16884746",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1723514/"
] | To display product for one specific cart, you would create the fetched results controller
as follows *(not compiler checked, there may be syntax errors!)* :
```
Cart *theCart = ... the cart that you want display products for ...
// Fetch request for "Product":
NSFetchRequest *fetchRequest = [NSFetchRequest fetchReque... | I think your new model is good.
Now that I understand your approach better, I think you do need to do a fetch kind of like your original code. I mistakenly assumed you'd want to have more than one cart - I'm thinking like a server engineer I guess.
```
+ (Cart *)addProductToCart:(Product *)theProduct inManagedObjectC... |
38,257,142 | I know some similar issues exist ([Find the field names of inputtable form fields in a PDF document?](https://stackoverflow.com/questions/3310533/find-the-field-names-of-inputtable-form-fields-in-a-pdf-document)) but my question is different:
I have all the field names (in fdf file).
I wish I could visually identify ... | 2016/07/08 | [
"https://Stackoverflow.com/questions/38257142",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2267379/"
] | Ok. I have found pdf editor where this is possible. Probably acrobat pro too...
<http://www.pdfescape.com/>
Right click on the field : unlock. Right click again : get properties. | If you're using [Apache PDFBox](https://pdfbox.apache.org/) to fill the form automatically, you can use it to fill all text fields with their name:
```
final PDDocument document = PDDocument.load(in);
final PDAcroForm acroForm = document.getDocumentCatalog().getAcroForm();
final Iterator<PDField> it = acroForm.getFiel... |
75,202 | I attached 4 10GB disks to MySQL Server and I used RAID 0:

but still MySQL performance is the same. Do I have to change configuration in `my.cnf` to let MySQL know about RAID 0?
This are my `mount` results:
;
```
Why should this work ?
* If [ISNULL(B.id)](https://dev.mysql.com/doc/refman/5.6/en/comparison-operators.html#function_isnull) ... | You should test it on you system and compare the the execution data and plans.
But the database systems I know only optimize statement by statement and not pairs and groups of statements. And for an optimal optimizer that possesses enough information about the data and optimizes statement by statement I would expect t... |
1,107,858 | I have the 'luck' of develop and enhance a legacy python web application for almost 2 years. The major contribution I consider I made is the introduction of the use of unit test, nosestest, pychecker and CI server. Yes, that's right, there are still project out there that has no single unit test (To be fair, it has a f... | 2009/07/10 | [
"https://Stackoverflow.com/questions/1107858",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/58129/"
] | Feather's [great book](https://rads.stackoverflow.com/amzn/click/com/0131177052) is the first resource I always recommend to anybody in your situation (wish I had it in hand before I faced it my first four times or so!-) -- not Python specific but a lot of VERY useful general-purpose pieces of advice.
Another techniqu... | Since it is a web app, I'm wondering whether browser-based testing would make sense for you. If so, check out [Selenium](http://seleniumhq.org/ "Selenium"), an open-source suite of test tools. Here are some items that might be interesting to you:
* automatically starts and stops browser instances on major platforms (l... |
73,816,832 | I'm new in the unit testing.
and I had an issue about asynchronous function testing.
```
func test_Repository()
{
let properEmail = ""
let properPassword = ""
let improperEmail = ""
let improperPassword = ""
let testArray = [(username : "", password : ""), // both empty
(usern... | 2022/09/22 | [
"https://Stackoverflow.com/questions/73816832",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19480198/"
] | A solution using parameter expensions.
```bash
$ filename="03 - Artist name first-middle name - Title of the Track (Original Version - Long Edit)"
$ filename="${filename#* - * - }"
$ echo "$filename"
Title of the Track (Original Version - Long Edit)
``` | Using `sed`
```
$ title=$(sed -E 's/.*- ([[:alpha:] ]+(\([^)]*\))?\..*)/\1/' input_file)
$ echo "$title"
Retrowave Mix.mp3'
Astral Dive.mp3'
Deathtouch.mp3'
A Synthwave Mix.mp3'
Eastbound Plane Mattaei (Original - Long Mix).mp3'
``` |
416,391 | I'm trying to use the [Windows 7 USB/DVD Download Tool](http://www.microsoftstore.com/store/msstore/html/pbPage.Help_Win7_usbdvd_dwnTool) from the Microsoft Store to make my new 16 GB USB Flash drive bootable to install Windows. It worked the first time that I did this (for Windows 7 Pro 32-bit), but now it keeps faili... | 2012/04/24 | [
"https://superuser.com/questions/416391",
"https://superuser.com",
"https://superuser.com/users/35950/"
] | The following description is taken from the tool's [online help](http://www.microsoftstore.com/store/msusa/html/pbPage.Help_Win7_usbdvd_dwnTool):
**When creating a bootable USB device, I am getting an error about bootsect**
To make the USB device bootable, you need to run a tool named bootsect.exe. In some cases, thi... | Try to format (FAT32) your USB drive but not using quick option !
You can then check again (using explorer or chkdsk) to see if all sectors are readable.
After formating (from Windows 7) the USB drive will have proper Windows 7 MBR and PBR.
Never had problems with Windows 7 USB/DVD Download Tool.
Help for bootsect.e... |
167,248 | Opportunity attacks have a long history in the world of tabletop games and D&D in particular. 3.5e/PF both had an exhaustive list of actions which can or can not trigger an OA.
Various games have their own OA mechanics, but one trigger always remains the same.
* 5th edition simplified things a lot. Only the [one sing... | 2020/04/06 | [
"https://rpg.stackexchange.com/questions/167248",
"https://rpg.stackexchange.com",
"https://rpg.stackexchange.com/users/27377/"
] | This is a question I've thought about a lot because I'm making my own d20 game with the aim of keeping rules as light as possible. To that end I've done away with OAs. My play testers have responded positively because they are more mobile on the battlefield.
**Play Expeerience**
With OAs in force, positioning tactic... | If we remove opportunity attacks from the game, the following scenarios can occur:
* If two creatures are the same speed, and only have melee, one can keep away from the other guaranteed with no chance for the other to continue attacking them.
* Melee rogues can now kite any creature they are faster than with their bo... |
25,525,226 | I have a table `news` with 48 columns
The table has some values like so:
```
ID|title |date |.......
1|Apple iphone 6 |2014-08-23
2|Samsung Galaxy s5|2014-08-23
3|LG G3 |2014-08-25
4|Apple iphone 6 |2014-08-25
5|HTC One m8 |2014-08-27
```
The "title" value is duplicated in ... | 2014/08/27 | [
"https://Stackoverflow.com/questions/25525226",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3982563/"
] | ```
delete from news
where id not in
(
select * from
(
select max(id)
from news
group by title
) tmp
)
```
This query groupy by the title and selects the latest `id` for every unique title. Then it deletes all records that have NOT that `id`.
I added another subquery because in MySQL you can't... | In MySQL, I would do this using a `join`:
```
delete n
from news n join
(select title, max(id) as keepid
from news
group by title
) ti
on ti.title = n.title and ti.id < keepid;
```
MySQL is finicky in `delete` and `update` statements about referring to the table being mod... |
127,357 | Iβm trying to build a world for a short story where the protagonist increasingly finds truths in Fortean-type phenomena. He witnesses proof of mythical creatures, for example. He begins investigating these things after his wife mysteriously disappears. The issue that I have is, I need her to disappear in such a way whe... | 2018/10/12 | [
"https://worldbuilding.stackexchange.com/questions/127357",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/56242/"
] | Since your protagonist is investigating Fortean phenomena is appropriate that the disappearance of his wife into parallel universe happens with that most Fortean of phenomena teleportation.
>
> Examples of the odd phenomena in Fort's books include many occurrences of the sort variously referred to as occult, supernat... | To me the best sci-fi stories are those which feature fantastical worlds with fantastical features, but with some basis in science. Some good examples are most of Dan Simmons' work especially Hyperion and Ilium. So I would suggest you start with "Let's assume parallel universes exist. How would I portray someone slippi... |
4,852,650 | I was wondering if binding a single `change()` event on form fields is enough to correctly perform a action when the value of the field changes.
Or should I bind all possible events? like this:
```
$(this).bind('change keyup focus click keydown', function(){
// ...
}).change();
```
Also, does binding... | 2011/01/31 | [
"https://Stackoverflow.com/questions/4852650",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/376947/"
] | `change` will only fire when the field loses focus (for most inputs). If you want something a little more real time, use the HTML 5 `oninput` event. This will pretty much catch any type of value change for an input element (and it bubbles, too!). It's not supported in Internet Explorer 8 and lower, though, but [I wrote... | Only listening to the `change` event *might* be sufficient for you (see also [@Andy E's answer](https://stackoverflow.com/questions/4852650/jquery-binding-multiple-events-on-input-fields/4852726#4852726)). From the [documentation](http://api.jquery.com/change/):
>
> The `change` event is sent to an element when its v... |
121,361 | Can Google Analytics and Google Search Console coexist without issues for the same website if the Google account that is used for Google Analytics is not the same as the account used for Google Search Console?
Context: I'm building a site for a client and would like to monitor the site's performance on google while le... | 2019/03/04 | [
"https://webmasters.stackexchange.com/questions/121361",
"https://webmasters.stackexchange.com",
"https://webmasters.stackexchange.com/users/98711/"
] | Not an issue at all.
They are different tools and verified differently.
Info on linking together:
Each account is not tied to only one user account.
In GA you can add other users will full access at the account or property level.
In SC you can add other *owners*.
Therefore, if any of the accounts have the same use... | Should not be an issue, however you wont be able to link the two products together though, as doing so requires the same Google Account be used. |
240,850 | I am having an issue when using `LoadControl( type, Params )`. Let me explain...
I have a super simple user control (ascx)
```
<%@ Control Language="C#" AutoEventWireup="True" Inherits="ErrorDisplay" Codebehind="ErrorDisplay.ascx.cs" EnableViewState="false" %>
<asp:Label runat="server" ID="lblTitle" />
<asp:Label ru... | 2008/10/27 | [
"https://Stackoverflow.com/questions/240850",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31128/"
] | I had a similar issue with the Calendar control DayRender event, in that I wanted to add a user control to the e.Cell.Controls collection. After trying a couple of failed approaches with the user control page\_load not firing or the listbox on the ascx throwing a null exception, I found that if I initialized my control... | Per the asp.net page lifecycle your controls are not fully added in pre-render, why don't you just load the values in page\_load? |
34,762,238 | I am looking to create a set of dates as follows.
For example, if today's date is 12/01/2016.
I need:
```
A
```
1 Jan 2016
2 Dec 2015
3 Nov 2015
4 Oct 2015
5 Sep 2015
6 August 2015
and so on.
I would appreciate all the help I can get on this matter. Thank you. | 2016/01/13 | [
"https://Stackoverflow.com/questions/34762238",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5750344/"
] | If you got `12 Jan 2016` in cell `A1` you could then use the following formula in cell `A2` and drag down the formula down for as long as needed.
```
=EDATE(A1,-1)
```
This continues to give you the previous date minus 1 month.
You could then format the cell values as `mmmm yyyy` which will give you the date format... | This code will iterate over the cells from A1 to A100, and fill them with the current month and year, and for each cell, it will subtract one month:
```
Sub test()
MyMonth = Date
For i = 1 To 100
Range("A" & i).Value = MyMonth
Range("A" & i).NumberFormat = "[$-406]mmmm yyyy;@"
MyMonth = DateAdd("m", -1,... |
27,013,044 | I am attempting to retrieve a `ListItemCollection` from a `List` of controls. This `List` contains many controls of different types - `DropDownList`, `Label`, `TextBox`.
I would like to retrieve all `ListItem` from all the `DropDownList` controls contained in the original `List` of controls.
My thought process so far... | 2014/11/19 | [
"https://Stackoverflow.com/questions/27013044",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3797366/"
] | This will do:
```
public IEnumerable<ListItem> GetListItems(ControlCollection controls)
{
return controls.OfType<DropDownList>().SelectMany(c => c.Items.OfType<ListItem>());
}
``` | Try this:
```
var ddlList = cList.OfType<DropDownList>();
ListItemCollection itemCollection = new ListItemCollection();
// option 1
var temp = ddlList.Select(ddl => ddl.Items.Cast<ListItem>()).SelectMany(li => li).ToArray();
itemCollection.AddRange(temp);
// or option 2
var temp = ddlList.Select(ddl => ddl.Ite... |
554 | Working in highly regulated environments data is classified in different ways depending on the sensitivity. In some cases, this is legally enforced and must be treated differently.
Examples of a data classification policy are:
* **Highly Restricted** Data, such as Passwords, Private Keys, SAML Tokens, and Credit Card... | 2017/03/18 | [
"https://devops.stackexchange.com/questions/554",
"https://devops.stackexchange.com",
"https://devops.stackexchange.com/users/397/"
] | I think the solution comes down to a broad spectrum of approaches that ensures data protection:
* **Data Classification**: The most efficient technical strategy is to categorise the data at the point of creation rigorously. At its core, the developers are responsible for ensuring that all logged information is assigne... | It depends on what you mean by "log files" I supposed. If you mean the telemetry data you use to verify your system is operating correctly I would say "Don't log sensitive fields." You don't need that kind of information to alert you to high or low transaction rates, response times to your dependent services, etc.
If ... |
23,938,711 | I have a problem with connection with Google maps API V2 and Android. I' ve enabled services:
* Google Maps Android API v2
* Places API
Also I've added sha1 fingerprint.

But I still get this message: **This IP, site or mobile application is not au... | 2014/05/29 | [
"https://Stackoverflow.com/questions/23938711",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1483810/"
] | You must be creating a browser key instead of an android key. I faced similar problem when I accidentely created an android key for Google Cloud Messaging instead of a server key. Please check which key is required for your purpose. For google maps v2 you need android key and for google places api you need a server key... | You don't need to create a key for using Google place API, instead just use "**Key for browser apps (with referers)**". But if you want to use Google Map API, you need to generate a Android Key, and you could find instruction here :<https://developers.google.com/maps/documentation/android/start>.
Good luck. |
37,796,453 | I'm having a hard time to understand how to work with functions - I can make then but after that I don't know how to use them. My question is how can I print this code with a function?
```
string = "Hello"
reverse = string[::-1]
print(reverse)
```
I tried putting it in a function but I cannot make it print Hello.
`... | 2016/06/13 | [
"https://Stackoverflow.com/questions/37796453",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6461005/"
] | Functions without a return value
================================
Functions that just take action or do something without returning a value (for example, `print`).
Functions that don't return a value can be defined like that:
```
def sayHello():
print "Hello!"
```
And can be used (called) like that:
```
say... | ```
# defines the 'Reverse a String' function and its arguments
def reverse_a_string():
print(string)
reverse = string[::-1]
print(reverse)
print("Type a string") # asks the user for a string input
string = input() # assigns whatever the user input to the string variable
reverse_a_string() # simply calls t... |
1,342,540 | I implemented a fonction in Visual Basic 2008 that takes the content of all the controls from a System.Winows.Form object and return a hash value corresponding to this content. The use of this function is to detect whether or not the user modified the content of the page and determine if I have to display a message box... | 2009/08/27 | [
"https://Stackoverflow.com/questions/1342540",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/164377/"
] | None of us here have the same insight into your project the way you do, the best answer in this (and so many other cases) is - "It Depends", rarely are there any cut & dry, universally accepted answers to questions like this. You have to make your choice based upon what you're objective is and what is *reasonable* to d... | First, don't store information inside a field name, I don't think it's best practice
I would create a lookup table and do
```
buildings
-----------------------------
building_id INT
date_built DATE
date_unit INT
reported_area DOUBLE
reported_unit INT
```
Why lookup table, very si... |
28,393,123 | For the past couple of days I've been playing with Ember CLI, using the SANE stack. After getting everything working and making a todo application like the one from the todo MVC website (todomvc.com), I'm now trying to validate data on my server (a sails js server).
For example, when a new todo is saved ('Do shopping... | 2015/02/08 | [
"https://Stackoverflow.com/questions/28393123",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3982479/"
] | Had similar problems after I reset my phone. Twice. And a reset for my router.
Even more, couldn't open gmail folders or receive Skype notifications on time.
Long story short, in "Menu>Security>Apps with usage access" I had Google Play Services unchecked.
So, make sure that Google Play Services is active. | I came across this spending hours searching. Almost identical problems on my S4. I downloaded "[ROOT] Disable IPv6" from the app store and it fixed my issues. |
52,218,465 | I have a dataset like this:
```
# test data
test.table <- data.frame(
id = seq(1,3),
sequence = c('HELLOTHISISASTRING','STRING|IS||18|LONG','SOMEOTHERSTRING!!!')
)
```
Each sequence has the same length (18). Now I want to create a table like this:
```
#id position letter
#1 1 H
#1 2 E
#1 3 ... | 2018/09/07 | [
"https://Stackoverflow.com/questions/52218465",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7885426/"
] | You can use `tidyverse` tools:
```r
test.table <- data.frame(
id = seq(1,3),
sequence = c('HELLOTHISISASTRING','STRING|IS||18|LONG','SOMEOTHERSTRING!!!')
)
library(tidyverse)
test.table %>%
mutate(letters = str_split(sequence, "")) %>%
unnest %>%
group_by(id, sequence) %>%
mutate(position = row_number())
... | There are some good answers here already, but here is another way to do it using `tidyverse`.
```
test.table <- data.frame(
id = seq(1,3),
sequence = c('HELLOTHISISASTRING','STRING|IS||18|LONG','SOMEOTHERSTRING!!!')
)
library(tidyverse)
library(reshape2)
test.table %>%
separate(col=sequence, into=as.character... |
9,116,395 | How to write `$('label.someClass').attr('valid', true);` in Java Script with out using jQuery? | 2012/02/02 | [
"https://Stackoverflow.com/questions/9116395",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/144140/"
] | ```
Array.prototype.forEach.call(document.querySelectorAll('label.someClass'), function( label ) {
label.setAttribute('someAttribute', 'someValue');
});
```
which implies that the browser is capable of ES5. An alternative for `.querySelectorAll` could be `.getElementsByClassName` too here. | ```
document.getElementById("myimage").setAttribute("src","another.gif")
```
[Try this Tutorial](http://www.javascriptkit.com/dhtmltutors/domattribute.shtml) |
7,244,331 | I want to build a small Silverlight application that will save a Canvas (and it's child objects) as a high-resolution JPG or PNG.
I'm not understanding how to work with the units in silverlight since they're based on pixels. How would I go about specifying the size of the Canvas object in pixels if my goal is to save ... | 2011/08/30 | [
"https://Stackoverflow.com/questions/7244331",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/919834/"
] | Try this, Click on "Fetch upstream" to sync your forked repo from upstream master.
[](https://i.stack.imgur.com/GPkH4.png) | If you want to keep your GitHub forks up to date with the respective upstreams, there also exists this probot program for GitHub specifically: <https://probot.github.io/apps/pull/> which does the job.
You would need to allow installation in your account and it will keep your forks up to date. |
49,859,734 | So at work we all share the same stash were we push and pull our branches and all that good git stuff. So i usually do my pull and push from egit in eclipse (I am not the only one most people here do it this way). but some of my branches have started giving me the [lock fail] "couldn't lock local tracking ref for updat... | 2018/04/16 | [
"https://Stackoverflow.com/questions/49859734",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9269932/"
] | ```
git remote prune origin
```
solved it for me. | For me, I encountered the lock fail problem in tags, so I do following steps:
1. Reset current branch
2. Delete all local tags.
3. Fetch
4. Pull.
It solves the problem. |
2,695,202 | If you have an HTML `<select multiple>` of a certain width and height (set in CSS), if there are more values then you can possibly fit in that height, then the browser adds a vertical scroll bar. Now if the text is longer than the available width, is it possible to instruct the browser to add a horizontal scrollbar? | 2010/04/22 | [
"https://Stackoverflow.com/questions/2695202",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5295/"
] | I think jtolle's response addressed the question best - the small reference to Application.Run may be the answer. The questioner doesn't want to use simply func1 or Module1.func1 - the reason one would want to use CallByName in the first place is that the desired function.sub name is not known at compile time. In this ... | Modules in VB6 and VBA are something like static classes, but unfortunately VB doesn't accept Module1 as an object. You can write Module1.Func1 like C.Func1 (C being an instance of some Class1), but this is obviously done by the Compiler, not at runtime.
Idea: Convert the Module1 to a class, Create a "Public Module1 a... |
656,273 | Take a look at [this video](https://youtu.be/Cg73j3QYRJc).
It shows that when 2 springs in series are transformed into 2 springs in parallel the attached mass goes up. But I'm interested in what happens in that split-second after cutting the blue cord but before the green and red ropes become taut (i.e. when the sprin... | 2021/07/30 | [
"https://physics.stackexchange.com/questions/656273",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/59692/"
] | ### Summary
**We do not know if the hanging weight will have a an instant of going downward or not**
It depends on the mass and spring constant of the lower spring and mass of the hanging weight.
### Logic
We cut the rope. There is gravitational force on the weight. The springs begin to contract rapidly and contrac... | When the blue cord is cut, several things happen very rapidly. At the instant the blue cord is cut, the two springs in series become unloaded, and they rapidly contract up until the red and green cords become taut. At that point, the springs become loaded again and their rate of contraction would change in a complicate... |
2,253,304 | What rarely used debugging tools you found useful ?
My recent debugging situation on Visual Studio required trapping the breakpoint on fresh built 32-bit DLL, which was loaded by GUI-less executable, which was spawned by COM+ server on remote x64 machine, which was called through RPC from actual GUI. As usual, all work... | 2010/02/12 | [
"https://Stackoverflow.com/questions/2253304",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | A logic analyzer plugged to CPU pins and able to disassemble executed code. I tracked a bug in the boot sequence of an embedded system. | WinDbg and other lower level debuggers are the ultimate weapon if you know the tricks and tips. |
39,397,904 | We have an MVC web application that I inherited that loads, let's call it MyCategory and all of its children into a webform, takes edit, then saves on save clicked. The way the application works is to first delete all data for the parent level entity in the model, then add everything back. We have pretty low concurrent... | 2016/09/08 | [
"https://Stackoverflow.com/questions/39397904",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4926084/"
] | Make sure you didn't **forgot** to ***commit/rollback transaction***.
**Transaction makes** your **table lock** from selecting/updating/deleting. And because of it, **your accessing** to delete **will be time out** just because for **waiting** when the **table being unlock** again. | For a specific query, you can write the below code
```
context.Database.CommandTimeout =60*3;
```
`context` is the database connection object name
`60*3` means `180` seconds, because `CommandTimeout` accepts value in `seconds`. |
10,261 | When there is one rectangular beam like below image,
[](https://i.stack.imgur.com/3kce0.png)
I would like to know how the beam is deflected according to thicknesses of top plate and bottom plate.
My concerning cross section patterns are like below.
... | 2016/06/10 | [
"https://engineering.stackexchange.com/questions/10261",
"https://engineering.stackexchange.com",
"https://engineering.stackexchange.com/users/4624/"
] | There are two things going on.
First, even if this "actuator" can produce constant torque, the torque required to keep the load spinning will be at least in part a function of the spinning speed. There will be some friction and other forces that increase with increased speed. *Viscous friction* increases linearly with... | The torque rating for the actuator depends on the speed it's running at - as it approaches its "top speed" it can't deliver the full rated torque.
The reasons depend a lot on the actuator type. For example with a DC electric motor the coil induces a back-EMF at higher speeds causing a tail off on the torque curve. For... |
24,718,071 | I'm can't seem to build a working NSTextView programmatically. Starting from a new project template I have this code (mostly coming from Apple's "Text System User Interface Layer Programming Guide"):
```
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
NSString *string = @"Here's to the ones... | 2014/07/12 | [
"https://Stackoverflow.com/questions/24718071",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3833236/"
] | The result of your `$.merge` is `[Array[2], 6, 7, 8, 9]`
`function.apply()` takes an array of items, and divide it into a number of **separate** arguments - one for each element of the array. The first argument `item` is therefore [1,2] because that is the first element of the array you passed.
apply() did take the r... | To get the whole array inside the function call **using `apply()`**, try this
```
var orig = [1, 2],
add = [6,7,8,9];
prependArgs.apply(orig, [$.merge([orig], add)]);
function prependArgs(item) {
console.log(item) //--- this prints [[1, 2], 6, 7, 8, 9]
var a = item.slice(0);
for (var i = 0; i < ... |
301,775 | I have the option to open groups of files in same window setting turned on, and this works for pictures.
However, for PDFs this setting does not seem to work.
I know opening multiple PDFs in the same window was possible at least in Sierra, I have no idea if they changed anything for High Sierra that caused this to fa... | 2017/10/11 | [
"https://apple.stackexchange.com/questions/301775",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/259197/"
] | If you have multiple PDF files that you want to open in ONE window as ONE file that you can scroll down you can do this:
1. Open ONLY ONE pdf file in previev.
2. Use Alt+Cmd+2 (it will open miniatures on the left side).
3. Select all OTHER pdf files and drag them manually into miniatures sidebar.
Now you have old vie... | You can combine pdf pages into one preview document by:
1. Open one of the docs.
2. View the thumbnail sidebar.
3. Select where you wish to add additional pdf file. (in the thumbnail sidebar)
4. Select "Edit" from menu then "Insert" and "Page from File"
5. Click on the file you wish to add.
6. Save the resulting pdf f... |
18,168,484 | I was just wondering how I could find out what the last character of the user input was using Python. I need to know whether it was an S or not. Thanks in advance..... | 2013/08/11 | [
"https://Stackoverflow.com/questions/18168484",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2671605/"
] | You can use the built-in function [`str.endswith()`](http://docs.python.org/2/library/stdtypes.html#str.endswith):
```
if raw_input('Enter a word: ').endswith('s'):
do_stuff()
```
Or, you can use [Python's Slice Notation](https://stackoverflow.com/questions/509211/the-python-slice-notation):
```
if raw_input('E... | Strings can be treated like lists of characters, and to get the last item of a list you can use `-1`, so after you convert the string to lowercase (just in case you have an uppercase s), your code will look like:
```
if (user_input.lower()[-1] == 's'):
#Do Stuff
``` |
146,316 | What number of classes do you think is ideal per one namespace "branch"? At which point would one decide to break one namespace into multiple ones? Let's not discuss the logical grouping of classes (assume they are logically grouped properly), I am, at this point, focused on the maintainable vs. not maintainable number... | 2008/09/28 | [
"https://Stackoverflow.com/questions/146316",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15497/"
] | "42? No, it doesn't work..."
Ok, let's put our programming prowess to work and see what is Microsoft's opinion:
```
# IronPython
import System
exported_types = [
(t.Namespace, t.Name)
for t in System.Int32().GetType().Assembly.GetExportedTypes()]
import itertools
get_ns = lambda (ns, typename): ns
sorted_exporte... | With modern IDEs and other dev tools, I would say that if all the classes belong in a namespace, then there is no arbitrary number at which you should break up a namespace just for maintainability. |
10,975,898 | I want to do CRUD operations on xml docs stored in Marklogic Server. Can anybody tell me please how can I perform CRUD operations in Marklogic Server ? | 2012/06/11 | [
"https://Stackoverflow.com/questions/10975898",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1326229/"
] | How are you connecting to the MarkLogic database? This may make a big difference in how you go about doing CRUD.
If you are pushing data in using an HTTP service you can use an existing REST endpoint such as the [Corona project](https://github.com/marklogic/Corona) or make your own using XQuery.
If you are using Ja... | Once the document is stored, you use functions like `xdmp:node-replace()`, `xdmp:node-insert-child()` etc. to manipulate the document node-by-node. Alternatively, you can change a document by saving a new version to the same URI via `xdmp:document-insert()`, or delete a document via `xdmp:document-delete()`.
Note that... |
1,693,412 | What can you tell about speed of couchdb and mysql databases?
I mean, very simple requests like getting one row (or one document) by unique id and simple requests like getting the 20 ids/rows/documents with the biggest date (of course, using indexes and views etc - don't really know how it works in CouchDB but I'm pre... | 2009/11/07 | [
"https://Stackoverflow.com/questions/1693412",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/145357/"
] | I found [this article](http://en.wikipedia.org/wiki/Apples_and_oranges) linked to in another SO question about MySQL vs CouchDB performance, but I don't know if it counts. | Exactly. The main diference is that: Relational vs Non Relational.
And it depends of what you need. There is a movement about this:
<http://en.wikipedia.org/wiki/NoSQL>
And, another good no-relational db:
www.mongodb.org |
380,752 | Let $K/F$ be a finite extension of local fields (of characteristic 0). Is it true that the quotient group $K^\times/ F^\times$ is always compact?
I understand that if the extension is cyclic, it is compact by Hilbert 90. But does it hold in general? | 2021/01/09 | [
"https://mathoverflow.net/questions/380752",
"https://mathoverflow.net",
"https://mathoverflow.net/users/32746/"
] | Let $K\subset L$ be a finite extension of normed non-discrete locally compact fields. Let $r>1$ be the norm of some element of $K$. Then every nonzero element of $L$ can be written as $r^nw$ with $\|w\|\in [1,r]$ and $n\in\mathbf{Z}$. Since $\{w\in L:\|w\|\in [1,r]\}$ is compact, it immediately follows that $K^\*/L^\*$... | N.B. The result is true without the assumption that the characteristic of $F$ is $0$.
You moreover have to assume that $F$ is *locally compact*.
The standard proof is reuns's one. If you already know that the projective space ${\mathbb P}(F^n )$ is compact for any $n\geqslant 0$, you can observe that
$K^\times /F^\tim... |
21,905,534 | I want to display and order a number of results to my webpage.
I'm still a starter with PHP but I have the following code to echo (all) data and that works pretty fine but I don't know if the code is good if I only want to show for example 5 results. And if that would work, how could I order them? (Like a top 5 for qu... | 2014/02/20 | [
"https://Stackoverflow.com/questions/21905534",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2086716/"
] | Try this,
```
$sql = 'SELECT name, company, `time` FROM tablename ORDER BY name ASC LIMIT 5';
``` | `$sql = SELECT name, company, time FROM tablename ORDERBY columnname LIMIT n;`
Here n refers to number of records to be shown. |
10,102,456 | I am trying to get all the images with class `front` and display their src attribute. Looking at the console it's working, but it returns images with class front and also images with class back along with the entire img code. I only want the src attribute. How can I o about doing this?
**HTML**
```
<div id="results">... | 2012/04/11 | [
"https://Stackoverflow.com/questions/10102456",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1320596/"
] | Replace
```
return $(this).parent().html();
```
With
```
return $(this).attr('src');
```
In your example you are getting the HTML code of the image parent element (i.e. the div element). This way you get the `src` attribute of the `front` img element alone. | if you want the SRC attribute only, you have to do the following:
```
$("img.front").each(function (index, element){
alert($("img.front").eq(index).attr("src"));
});
```
this will print out the SRC of each image with FRONT class. |
8,388,130 | I am facing a complex situation of SQL queries. The task is to update multiple rows, with multiple values and multiple conditions. Following is the data which I want to update;
Field to update: 'sales', condition fields: 'campid' and 'date':
```
if campid = 259 and date = 22/6/2011 then set sales = $200
else if campid... | 2011/12/05 | [
"https://Stackoverflow.com/questions/8388130",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/927924/"
] | Try this:
```
UPDATE your_table SET sales =
CASE
WHEN campid = 259 AND date = 22/6/2011 THEN 200
WHEN campid = 259 AND date = 21/6/2011 THEN 210
WHEN campid = 259 AND date = 22/6/2011 THEN 140
WHEN campid = 259 AND date = 21/6/2011 THEN 150
ELSE sales
END
```
Naturally I don't know if date fiel... | You certainly should not do these in a single query. Instead, if what you aim for is to update them atomically, all at the same time, you should issue several `UPDATE` statements in a single *transaction*.
You do not say which MySQL version you use, and not which storage engine. Assuming InnoDB - which is the standard... |
62,783,101 | I'm new to PowerShell, I need to create traces on several steps of the script below.
Here is the csv example (the real one is about a million lines)
I erased a value in the first column in order to do test
```
UCB63_DATENUM;U6618_FILENAME;UF6E8_CANAL;U65B8_IDRP
7/8/19 22:27;;ML;1367091;
9/11/19 23:03;49453878_ZN_LIQR... | 2020/07/07 | [
"https://Stackoverflow.com/questions/62783101",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13853879/"
] | You have to create a new dictionary:
```
d_original = {'2,449': 1, '11,821': 2, '26,153': 3}
sorted_items = sorted(d_original.items(), key=lambda item: int(item[0].replace(',', '')), reverse=True)
# from collections import OrderedDict
# d_new = OrderedDict(sorted_items)
d_new = dict(sorted_items)
for k,v in d_new.item... | Dictionaries in Python are unordered. If you want to access by sorted keys you could do something like this:
```
d = {"a": 4, "c": 10, "b": 11, "d" : 6}
for key in sorted(d.keys()):
print(f'{key} {d[key]}')
```
EDIT:
You can't edit the dictionary while you iterate over it. So store the values sorted in a ne... |
19,562,695 | ```
private static final byte[] BitPMC1 = { 56, 48, 40, 32, 24, 16, 8, 0, 57,
49, 41, 33, 25, 17, 9, 1, 58, 50, 42, 34, 26, 18, 10, 2, 59, 51,
43, 35, 62, 54, 46, 38, 30, 22, 14, 6, 61, 53, 45, 37, 29, 21, 13,
5, 60, 52, 44, 36, 28, 20, 12, 4, 27, 19, 11, 3 };
byte[] outData= new byte[] { 0, 0... | 2013/10/24 | [
"https://Stackoverflow.com/questions/19562695",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2915051/"
] | Your input values are all in the range 0..127 so there's no problem there.
On the output, but *only* after all the calculations are done, you need to convert the `byte` values into `int` values, whilst also converting the twos-complement negative values to positive:
```
int unsigned_value = ((int)byte_value) & 0xff;
... | You don't describe what your code should do (e.g. giving some example numbers) thus I can only guess.
Having unsigned data, it does not make sense to use an operation taking care of the sign bit (`>>`), probably the operation you need is a logical shift (`>>>`)
More details here: [Difference between >>> and >>](https... |
57,333,896 | I successfully installed Laravel and Laravel Nova in live server but when I tried to view Nova login page, I get index of/nova page and the page does not redirect any css.
Below is the screenshot of the page rendering:
[* when a person in my database has a birthday today, but nothing happens when I run my app.
EDIT: My reminder form is now showing properly, but when I try to close that f... | 2013/07/05 | [
"https://Stackoverflow.com/questions/17493988",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2554389/"
] | FYI: For Mac users: Following the link that @Bertrand Moreau shared, this worked on Mac OS X 10.7.5 and R 3.0.1:
```
cd /Users/xx/Downloads/rpy2-2.3.7
export LDFLAGS="-Wl,-rpath,/Library/Frameworks/R.framework/Resources/lib"
sudo python3.3 setup.py build --r-home /Library/Frameworks/R.framework/Resources install
sudo ... | A solution under `ubuntu 14.04` using `anaconda` and `python2.7` is the following:
`conda install -c https://conda.anaconda.org/r rpy2`
This works on the command line, and also from `pycharm` terminal for me. **However, still does not work under `pycharm`, and I get the same error as OP.**
The fact that it does now... |
10,031,756 | I am using Axlsx to create an excel file. For a small dataset, it works fine. But once the dataset gets big, it just hangs. I ran strace on the process, it was doing a lot brk.
```
a = Axlsx::Package.new
book = a.workbook
book.add_worksheet(:name => "test") do |sheet|
input_array.each do |input_data|
...# cov... | 2012/04/05 | [
"https://Stackoverflow.com/questions/10031756",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/612308/"
] | Looks like I need to start paying attention to SO!
This is randym (the author of axlsx)
There are a couple of things I'd like to point out that should help you get what you need done, well... done!
1. If you are writing to a file, consider Package#serialize - not because it is faster, but because it is less code for ... | You can try to disable RMagick, which handles column autowidth feature, since it's quite heavy process AFAIK.
```
a = Axlsx::Package.new
a.use_autowidth = false
``` |
28,995,757 | I am getting the following exception when calling OData from my Kendo ListView:
>
> "A binary operator with incompatible types was detected. Found operand
> types 'Edm.Guid' and 'Edm.String' for operator kind 'Equal'"
>
>
>
**DECODED FILTER:**
$filter=OrganizationId eq '4c2c1c1e-1838-42ca-b730-399816de85f8'
... | 2015/03/11 | [
"https://Stackoverflow.com/questions/28995757",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/312317/"
] | If the OData service is of protocol version V4, the correct query URL should be:
```
$filter=OrganizationId eq 4c2c1c1e-1838-42ca-b730-399816de85f8
```
No single quotes is required. | I ran into this error querying OData 4.0 through Microsoft Dynamics. The other answers here didn't help unfortunately, even though they are exactly right. My issue was more with handing EntityReference's in filters.
I ended up having to adjust my filter to something like this, to target the foreign key properly. In th... |
30,058,904 | I'm not familiar with DataGridViews, but I need to work with one in this case.
Basically, I have a method I want to call anytime the state of the DataGridView is changed in ANY way (cells added, removed, changed, etc). There seem to be many events, but I'm not sure which ones are relevant (I'm assuming I'll use more... | 2015/05/05 | [
"https://Stackoverflow.com/questions/30058904",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2957232/"
] | You can temporary disable it.
```
mPullToRefreshLayout.setEnabled(false);
``` | Version 1.2.0-alpha01 now respects requestDisallowInterceptTouchEvent() |
3,828,907 | Is there any way to inline just some selective calls to a particular function not all of them? cause only form I know is declaring function as such at beginning and that's supposed to effect all calls to that function. | 2010/09/30 | [
"https://Stackoverflow.com/questions/3828907",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/388056/"
] | please note that if you use the inline keyword, this is only a hint for the compiler. You cannot really control what the compiler inlines and what not.
If your compiler would follow your hints you could do:
```
inline void doItInline() {...}
void doItNonInline() {doItInline();}
```
Now you can call the method eithe... | You can try to force it the other way around.
even though if you ask the compiler to inline, it can't do so if the definition is not available in the current compilation unit and has to create a call.
if you make sure the definition IS available, the compiler MIGHT inline it. |
20,931,859 | What I'm trying to do is, load a Text file, then take the values from each line and assign them to a variable in my program. Every two lines, I will insert them into a `LinkedHashMap` (As a pair)
The problem with a buffered reader is, all I can seem to do is, read one line at a time.
Here is my current code:
```
pu... | 2014/01/05 | [
"https://Stackoverflow.com/questions/20931859",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1877059/"
] | You can overcome this issue by inserting in the List every 2 lines reading.
A description for this code is that: "Bold is the true case"
1. Read the first line (count is 0)
* **If (secondLine is false) ==> Save the line to CipherText variable, make secondLine = true**
* Else If (secondLine is true) ==> Add to lis... | See if this works for you. I just edited your code. it might not be the best answer.
```
public static void receiver(String firstArg) {// Receives
// Input
// File
String cipherText;
String key;
String inFile = new File... |
4,773,646 | If in the process of moving my prodiuct categories out of the main table into seperate tables. At the moment its stored like this:
```
ProductId Product Name Cat1 Cat2 Cat3
----------------------------------------------------------------------
1 Something One Y N ... | 2011/01/23 | [
"https://Stackoverflow.com/questions/4773646",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/263960/"
] | Sure, assuming your tables are Category, Product and CategoryXProduct (with ID definned as identity):
```
INSERT CategoryXProduct ( CatID, ProductID )
SELECT 1, ProductId FROM Product WHERE Cat1 = 'Y'
INSERT CategoryXProduct ( CatID, ProductID )
SELECT 2, ProductId FROM Product WHERE Cat2 = 'Y'
INSERT Catego... | Yes, it is possible. there is sth like INSERT from SELECT:
```
INSERT into table1(id, name, fname)
SELECT id, lname, fname
FROM authors
WHERE somecondiction
``` |
33,589,211 | So I made this java file A.java,
```
package alphabet;
public class A{
private String private_A;
String _A;
protected String protected_A;
public String public_A;
public A(){
private_A="Private A";
_A="Package Private A";
protected_A="Protected A";
public_A="Public A";
}
pu... | 2015/11/07 | [
"https://Stackoverflow.com/questions/33589211",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4539308/"
] | Problem is you are compiling it wrong. Since you are using package, while compiling you need to be outside the package.
So instead of `javac B.java`
Make a folder/directory named same as package name i.e. `alphabet` and move the java files to it.
Use `javac alphabet/B.java` | Remove the import statement in class B. You don't need to import from the same package. |
7,524,715 | The same code ran in TURBO C.
```
struct details
{
char name[20];
int year;
float price;
}my_str;
details book1[10];
```
This error is produced. How can this be fixed?
```
ram.c: In function βmainβ:
ram.c:11:1: error: βdetailsβ undeclared (first use in this function)
ram.c:11:1: n... | 2011/09/23 | [
"https://Stackoverflow.com/questions/7524715",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/940510/"
] | There are two ways to fix this:
Change second line to this:
```
struct details book1[10];
```
Or you can change the declaration to:
```
typedef struct{
char name[20];
int year;
float price;
} details;
```
C is slightly different from C++, so you can't declare structs quite the same way. | This is a a bit more correct in terms of C:
```
typedef struct _detailstype
{
char name[20];
int year;
float price;
} details;
details book1[10];
``` |
21,627,629 | I am new to servlet and making my first servlet using eclipse.I have made Index.html, Login.java and WelcomeServlet.java. But whenever I am trying to access the using
```
localhost:8080/ServletExample/
```
It shows 404 error.Here are the codes..
**Index.html**
```
<form action="Login" method="post">
Name:<input... | 2014/02/07 | [
"https://Stackoverflow.com/questions/21627629",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1707351/"
] | package java.io;
why u put this line in WelcomeServlet.java. | Make sure ur projrct name is ServletExample.
localhost:8080/ServletExample/index.html |
669,298 | I had Linux Ubuntu and Windows dual booting from my computer. I used partition manager to remove the Linux Ubuntu partitions, now I can't get into Windows.
The machine loads in to a command prompt ( GRUB )
I think I may need to remove GRUB from the MBR and install windows Boot loader using the windows repair option
... | 2013/11/04 | [
"https://superuser.com/questions/669298",
"https://superuser.com",
"https://superuser.com/users/65953/"
] | While @sgtbeano already answers the question, I'd like to provide some information on why this happens.
When you have a dual-boot for linux & windows, then it's linux bootloader, that's loaded when you start the computer.
Now when you un-install linux, that bootloader is gone and hence, you need to rebuilt/re-instant... | sgtbeano's solution is likely to work; however, I want to provide another couple of options, which work only on EFI-based computers. (The vast majority of machines that shipped with Windows 8 or later are EFI-based.) These solutions are:
* **Re-order the boot list** -- EFI-based computers store a list of boot entries ... |
57,155,636 | I need to generate random division problems for an educational game that I am building. Generating random addition, subtraction, and multiplication problems is not too difficult. But I want my division problems to not have any remainders.
With addition, subtraction and multiplication, I could just do [random number] ... | 2019/07/23 | [
"https://Stackoverflow.com/questions/57155636",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11003015/"
] | x/y = z
y\*z = x
Generate y and z as integers, then calculate x. | You can simply generate the divisor and quotient randomly and then compute the dividend. Note that the divisor must be nonzero (thanks to @o11c's remind). |
1,208,338 | In my ongoing effort to quench my undying thirst for more programming knowledge I have come up with the idea of attempting to write a (at least for now) simple programming language that compiles into bytecode. The problem is I don't know the first thing about language design. Does anyone have any advice on a methodolog... | 2009/07/30 | [
"https://Stackoverflow.com/questions/1208338",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/33911/"
] | There are so many ways...
You could look into stack languages and Forth. It's not very useful when it comes to designing other languages, but it's something that can be done very quickly.
You could look into functional languages. Most of them are based on a few simple concepts, and have simple parsing. And, yet, they... | I recommend reading the following books:
[ANTLR](http://www.pragprog.com/titles/tpantlr/the-definitive-antlr-reference)
[Language Design Patterns](http://www.pragprog.com/titles/tpdsl/language-design-patterns)
This will give you tools and techniques for creating parsers, lexers, and compilers for custom languages. |
16,658,040 | I got this HTML tags that I've pulled from a website:
```
<ul><li>Some Keys in the UL List</li>
</ul>
<li>HKEY_LOCAL_MACHINE\SOFTWARE\Description</li>
<li>HKEY_LOCAL_MACHINE\SOFTWARE\Description\Microsoft</li>
<li>HKEY_LOCAL_MACHINE\SOFTWARE\Description\Microsoft\Rpc</li>
<li>HKEY_LOCAL_MACHINE\SOFTWARE\Description\Mi... | 2013/05/20 | [
"https://Stackoverflow.com/questions/16658040",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2403166/"
] | With `BeautifulSoup`:
```
>>> html = textabove
>>> from bs4 import BeautifulSoup as BS
>>> soup = BS(html)
>>> for ultag in soup.findAll('ul'):
... for litag in ultag.findAll('li'):
... print litag.text
```
Which prints:
```
Some Keys in the UL List
Some objects in the UL LIST
```
---
To get the lat... | you do not need regular expressions to do that take a look at python's [HTMLParser](http://docs.python.org/2/library/htmlparser.html) |
2,670,012 | I've ported the non-blocking queue psuedocode [here](http://www.cs.rochester.edu/research/synchronization/pseudocode/queues.html#nbq) to C#. The code below is meant as a near verbatim copy of the paper.
What approach would you take to test the implementation?
Note: I'm running in VS2010 so I don't have CHESS support ... | 2010/04/19 | [
"https://Stackoverflow.com/questions/2670012",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/55952/"
] | Since `.apk` is a `.jar` file by another name (in other words it is a zip file with some specific definitions of where configuration files are stored inside the directory) then look at [ZipInputStream](http://java.sun.com/j2se/1.5.0/docs/api/java/util/zip/ZipInputStream.html) to read the file and walk through the conte... | Thank you very much Yishai... this was the Hint I was waiting for :)
Probably is sb out there, who needs the to do a same thing, therefore... here is my code:
```
public static boolean copyApkFile(File outputFile){
try {
FileInputStream fis = new FileInputStream(this.getClass().getResource("/resour... |
9,932,678 | Given the following array `a`:
```
a = [1, 2, 3, 4, 5]
```
How do I do:
```
a.map { |num| num + 1 }
```
using the short notation:
```
a.map(&:+ 1)
```
or:
```
a.map(&:+ 2)
```
where 1 and 2 are the arguments? | 2012/03/29 | [
"https://Stackoverflow.com/questions/9932678",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1301770/"
] | You can't do it like this. The `&` operator is for turning symbols into procs.
```
a = [1, 2, 3, 4, 5]
puts a.map(&:to_s) # prints array of strings
puts a.map(&:to_s2) # error, no such method `to_s2`.
```
`&` is a shorthand for [`to_proc`](http://ruby-doc.org/core-2.0/Symbol.html#method-i-to_proc):
```
def to_pr... | If you really need that you can use [Ampex](https://github.com/rapportive-oss/ampex) library, but I don't know if it is still maintained. |
60,516,539 | I am new to the MS Azure. I am trying to download Microsoft Academic Graph for various analysis, and they don't offer bulk-downloading the structured dataset. External sources such as openacademicgraph weren't really useful, so I thought I could try downloading the data through Azure.
Luckily, there were manuals for j... | 2020/03/03 | [
"https://Stackoverflow.com/questions/60516539",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10649974/"
] | You can try most of the examples with databricks community edition :
<https://community.cloud.databricks.com/login.html> | Using free Azure subscription and trial tier for databricks I got the same error while doing this module <https://learn.microsoft.com/en-us/learn/modules/describe-azure-databricks/>
When creating the cluster I modified the cluster mode from 'standard' to 'none', problem solved; I could run the python notebook. |
15,269,051 | I'm reading that I should use worker object and move it to thread by moveToThread instead of inherit from QThread directly. But I can't find solution how to stop loop in my object worker. For example I have test loop:
```
void CollectionWorker::doWork()
{
for (int i = 0; i < 10; ++i) {
sleep(1);
em... | 2013/03/07 | [
"https://Stackoverflow.com/questions/15269051",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/764914/"
] | I have the same problem as Dibo had. I'm running a long calculation loop inside my `doWork()` function and need to be able to stop it from my main thread.
Chadick Robbert's answers didn't do the trick for me. The first suggestion behaved just like what he describes for member functions. That is, although we're using s... | The idiomatic way in Qt to destroy a worker thread is using the signal/slot interface:
```
CollectionWorker *worker = new CollectionWorker;
QThread *workerThread = new QThread(this);
connect(workerThread, SIGNAL(started()), worker, SLOT(doWork()));
connect(workerThread, SIGNAL(finished()), worker, SLOT(deleteLate... |
42,371,783 | I know this is a duplicate question and I've tried every possible solution but not succeeded. I am using a panel in which my excel data is showing and I wanna fix the column in other words header. Every css I've tried break the panel settings and I didn't succeed. I'm using bootstrap css & have more than 1000 rows that... | 2017/02/21 | [
"https://Stackoverflow.com/questions/42371783",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7013297/"
] | If you want to associate multiple values with a key, you could just make the value part of the pair a list:
```
var dict = new Dictionary<char, List<int>>();
char key = 'D';
int value = 5;
if (!dict.ContainsKey(key))
dict[key] = new List<int>();
dict[key].Add(value);
``` | Like Adam Houldsworth said you can use `Lookup`.
Here is a snippet based on Adam Houldsworth's answer.
```
var str = @"A=1|B=2|C=3|D=4|D=5|D=5";
string[] t = str.Split(new[] { '|', '|' }, StringSplitOptions.RemoveEmptyEntries);
var message = t.ToLookup(s => s.Split('=')[0], s => Convert.ToInt32(s.Split('=')[1]));
var... |
47,987,068 | I am very new to Swift. I am creating a register page and applying validation to it. I want to validate the email and password. I am using outlet collection and I also want to know how to get a value from outlet collection. Here is the code.
```
if senderTag == 0 // Name
{
}
else if senderTag ... | 2017/12/27 | [
"https://Stackoverflow.com/questions/47987068",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9117534/"
] | ```
Actually the issue was, in the String resource if we write `<b>` its will be converted to string itself.
And when Html.fromHtml() tries to convert they found no tags,
So,
For < we have to use <
For > we have to use >
For & we have to use &
```
Retrieve the text as spanned text and pass it to drawtex... | You can do this by setting pint style to BOLD for specific characters and also the start and end index of the string i.e. to be bold should be known you can do this as-
Suppose the string is
```
<string name="bold_text">This is the Bold text</string>
```
Following is the to be done in view class
```
//create two p... |
150,414 | Using alphabetical ordering for authors' names is a long established tradition in mathematics.
In the situations of extremely unequal contributions, is it reasonable to break from this tradition? Has there been any examples? If it is common, what is the threshold for breaking from alphabetical ordering? | 2020/06/12 | [
"https://academia.stackexchange.com/questions/150414",
"https://academia.stackexchange.com",
"https://academia.stackexchange.com/users/-1/"
] | *Edit: this answer is about pure math.*
Itβs not common. In 25 years of reading math papers Iβve only ever seen one example of a paper that had a nonalphabetical author ordering. It was an English translation of a Russian paper from the 1970s written by a PhD student and his advisor. I donβt know what the story was be... | In the answers and comments, it's suggested that it's extremely rare in pure math, and there are only one or two such papers. I'd suggest that while it is rare, it's not as rare as Dan Romik's answer and a couple of comment's suggest. I myself have noticed a number of papers where the author list is non-alphabetical (a... |
12,992 | We know four trainers started in Pallet town. Three with one of the three original starters and Ash with his Pikachu. Apart from Gary, were the other two trainers ever revealed in the anime? And was it ever revealed who got which specific starter Pokemon? | 2014/07/22 | [
"https://anime.stackexchange.com/questions/12992",
"https://anime.stackexchange.com",
"https://anime.stackexchange.com/users/6166/"
] | ### The Four Trainers of Pallet Town Theory
*PokΓ©mon: Indigo League*, episode 10 "Bulbasaur And The Hidden Village": Bulbasaur protects a "spa resort for pokΓ©mon" village in which the only human there, a girl by the name of Melanie, takes care of them. By theory, we conclude that Melanie does not want to be a trainer ... | I think Damian, the original owner of Ash's Charmander (now Charizard), was one of the Pokemon trainers from Pallet Town. Firstly, because he wasn't seen at the Pokemon League. Secondly, wild Charmanders weren't seen in the anime much or maybe at all. So it's reasonable to say that he got it as his starter.
I don't kn... |
9,380 | For the moment we protect a directory on our site with .htaccess and .htpasswd. But I was wondering how secure this is? Are there things I should watch for or can do make it more secure?
I don't know why but it don't feel really confident about it. I have the feeling this kind of security is easy to crack. From what I... | 2011/12/02 | [
"https://security.stackexchange.com/questions/9380",
"https://security.stackexchange.com",
"https://security.stackexchange.com/users/6144/"
] | If all the access is via SSL, then it's reasonably secure.
Basic authentication without SSL only sends the username/password as base64 encoded - so it's trivial to extract the tokens via MITM or sniffing.
Digest authentication without SSL is a lot better (a challenge based mechanism) but still not as secure as an enc... | I would check out this resource to make sure that htaccess is properly protected:
<http://www.symantec.com/connect/articles/hardening-htaccess-part-one>
And I would check out a WAF or mod\_security if you want greater operational control:
<http://www.askapache.com/htaccess/modsecurity-htaccess-tricks.html> |
69,147,230 | [updated error image](https://i.stack.imgur.com/Jix0u.png) For some reason I can't call my commands. RuntimeError: Event loop is closed. I need help to fix it, I'm new in python programming. I want to learn how to create bots for discord on python, so I'm asking for help !
```
import discord
from discord.ext import co... | 2021/09/11 | [
"https://Stackoverflow.com/questions/69147230",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16780766/"
] | You didn't enable `Intents`. Remember to do it both in code and on your bot's dashboard on the Discord developers site if you need privileged intents enabled. This includes things like wanting access to the members in a Guild, etc.
```py
intents = discord.Intents.default()
client = commands.Bot(command_prefix="!", int... | Are you sure, that your bot is running? I'm getting this error everytime I stop my bot. |
666,872 | I'm working in Photoshop CS6 and multiple browsers a lot. I'm not using them all at once, so sometimes some applications are minimized to taskbar for hours or days.
The problem is, when I try to maximize them from the taskbar - it sometimes takes longer than starting them! Especially Photoshop feels really weird for ... | 2013/10/29 | [
"https://superuser.com/questions/666872",
"https://superuser.com",
"https://superuser.com/users/267835/"
] | ### Summary
The immediate problem is that the programs that you have minimized are being paged out to the "page file" on your hard disk. This symptom can be improved by installing a Solid State Disk (SSD), adding more RAM to your system, reducing the number of programs you have open, or upgrading to a newer system arc... | >
> when I try to maximize them from the taskbar - it sometimes takes longer than starting them
>
>
>
That's because *both* when you start it and when you maximize it from them taskbar you are reading the application from *disk* (as explained by all the others), but an application which ran for a while (opening fi... |
3,173 | As my company begins its first agile project, I'm wondering if it would be easier to have separate tasks for QA and development for each story/requirement. Is it a cleaner process or will the lack of insight into development tasks be hazardous for QA since their tasks will be separate. Any feedback would be greatly app... | 2012/05/24 | [
"https://sqa.stackexchange.com/questions/3173",
"https://sqa.stackexchange.com",
"https://sqa.stackexchange.com/users/2520/"
] | My company has been using Agile for a while so I can provide some answers.
First of all we do only black-box testing, we don't have the access to the code. Therefore each story has some technical sub-tasks defined and these tasks are handled only by developers. We don't test them.
As for the rest - we share all the t... | On a true agile project the line between development and testing can become very, very blurry. A team that is properly implementing behavior driven development (BDD) will be automating acceptance tests as part of each feature.
There are pros and cons with this approach as each feature is not done until the automation ... |
74,519,777 | Given a file tree with much dept like this:
```
βββ movepy.py # the file I want use to move all other files
βββ testfodlerComp
βββ asdas
βΒ Β βββ erwer.txt
βββ asdasdas
βΒ Β βββ sdffg.txt
βββ asdasdasdasd
βββ hoihoi.txt
βββ hoihej.txt
βββ asd
βββ dfsdf.txt
βββ dsfsdfsd.txt
```
... | 2022/11/21 | [
"https://Stackoverflow.com/questions/74519777",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5558126/"
] | Adding to xlab's solutions, you could also disable STRICT\_TRANS\_TABLES. This is particularly useful when you already have the code written and you can "allow" not to use strict inputs (if you understand the implications).
Check the accepted solution here:
[How to turn on/off MySQL strict mode in localhost (xampp)?]... | Actually I made a typo:
False:
```
public function store(Request $request)
{
$storeData = $request->validate([
'name' => 'required|max:255',
'name' => 'required|max:255',
'email' => 'required|max:255',
'phone' => 'required|numeric',
'password' => 'required|max:255',
])... |
501,845 | 1. I like to create a color change in vertical direction of the "*pump Symbol*" in the following example from black to blue to black again.
2. The symbol itself should NOT be filled with color. ONLY the drawing lines.
My mini Example doesn't work. Any ideas?
Mini Example or MWE
===================
```
\documentclass... | 2019/07/28 | [
"https://tex.stackexchange.com/questions/501845",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/193587/"
] | IMHO you need neither the `shadings` nor the `fadings` library here.
```
\documentclass[tikz,border=10pt]{standalone}
\usetikzlibrary{calc}
%% Pumpe Symbol
\tikzset{
pump/.style={
circle,
thick,
minimum size=0.5cm,
path picture={
\path[top color=black!80, bottom color=black!80,
middle color=bl... | Using `shadings` library instead of `fadings`, following code might be used.
```
\documentclass[tikz,border=10pt]{standalone}
\usetikzlibrary{shadings}
\pgfdeclareverticalshading{rainbow}{100bp}
{color(0bp)=(black);
color(40bp)=(black);
color(50bp)=(blue);
color(60bp)=(black);
color(100bp)=(blac... |
64,843,459 | SOLVED/NOTE: I have accepted the answer of adding the "accept=" option to the HTML code as a solution to the problem. It should be noted that although this does work as as a work around, the root cause is likely a Safari bug - it should NOT be a requirement to add this to your HTML to make this functionality work.
ORI... | 2020/11/15 | [
"https://Stackoverflow.com/questions/64843459",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4241666/"
] | I have run into the same issue yesterday.
Having looking into it I have found it working elsewhere and fixed it on the site I'm working on by adding an *accept* attribute with a file types list to the *input* tag.
(e.g. `<input type="file" accept=".xls,.xlsx,.xlsb,.txt,.csv,.tsv"/>`)
Works fine now in Safari version ... | Giving Safari Full Disk Access will NOT fix the problem.
I have a [test page with different attributes](https://dusty-manager.surge.sh)
Click file input 1, 3, 4 is fine.
Once clicked file input 2 with accept="image/\*;capture=camera" it will kill all file upload on the page. But not any other page in the same domain.... |
227,130 | Ok, so I have tried this quite a few times and I'm sure this is very trivial but: I am trying to SSH via command line on Ubuntu into my VM (Centos6) with an RSA key-pair I created using key-gen.
I have created the key-pair and appended the public key to authorized\_keys file and changed the permissions to `600`. After... | 2015/09/02 | [
"https://unix.stackexchange.com/questions/227130",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/72902/"
] | First generate the key-pair on your Ubuntu machine.
After, copy the contents of the generated `.pub` file in your ssh folder (`~/.ssh/id_rsa`) and paste it to the `username/.ssh/id_rsaauthorized_keys` file, on a new line, on your CentOS for the specific user you are logging in with. | If you `tailf /var/log/auth.log` on the server and login again, you should see the reason for the failure get logged. If not, kick up the verbosity in the SSH daemon config file to DEBUG and retry again. Often times it's related to file permissions. |
49,834,251 | I have a styled component that is extending a third-party component:
```
import Resizable from 're-resizable';
...
const ResizableSC = styled(Resizable)``;
export const StyledPaneContainer = ResizableSC.extend`
flex: 0 0 ${(props) => props.someProp}px;
`;
const PaneContainer = ({ children, someProp }) => (
<S... | 2018/04/14 | [
"https://Stackoverflow.com/questions/49834251",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3111255/"
] | 2020 UPDATE: Use transient props
--------------------------------
With the [release 5.1.0](https://styled-components.com/releases#v5.1.0) you can use [transient props](https://styled-components.com/docs/api#transient-props). This way you do not need an extra wrapper i.e. unnecessary code is reduced:
>
> Transient pr... | You can try with **defaultProps**:
```
import Resizable from 're-resizable';
import PropTypes from 'prop-types';
...
const ResizableSC = styled(Resizable)``;
export const StyledPaneContainer = ResizableSC.extend`
flex: 0 0 ${(props) => props.someProp}px;
`;
StyledPaneContainer.defaultProps = { someProp: 1 }
cons... |
10,739,867 | ```
select * from StudySQL.dbo.id_name n
inner join StudySQL.dbo.id_sex s
on n.id=s.id
and s.sex='f'
select * from StudySQL.dbo.id_name n
inner join StudySQL.dbo.id_sex s
on n.id=s.id
where s.sex='f'
```
The result are identical. So any difference between them?
Add
---
I made several more interesting tries.
```
s... | 2012/05/24 | [
"https://Stackoverflow.com/questions/10739867",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/264052/"
] | There's no difference while this is an `INNER JOIN` but the results would be very different if you used an `OUTER JOIN`. Used with an `LEFT OUTER JOIN` the second query would implicitly become an `INNER JOIN`.
By using `AND` the predicate is identifying when a row from s should be joined to n. In an inner join, a nega... | Some interesting discussion of this topic is found here:
[INNER JOIN ON vs WHERE clause](https://stackoverflow.com/questions/1018822/inner-join-on-vs-where-clause)
They should always return the same results, but may result in slightly different query plans and performance due to when the filtered rows are being remov... |
18,965,503 | I need some help. I write little app using ASP.NET MVC4 with JavaScript and Knockout and I can't send data from javascript to MVC Controller and conversely. For example, the part of JS looks like that:
JavaScript
----------
```js
self.Employer = ko.observable();
self.AboutEmployer = function (id) {
$.ajax... | 2013/09/23 | [
"https://Stackoverflow.com/questions/18965503",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2702323/"
] | Try below code, hope helps you
This code works %100 , please change below textbox according to your scenario
HTML
```
<input type="text" id="UserName" name="UserName" />
<input type="button" onclick="MyFunction()"value="Send" />
<div id="UpdateDiv"></div>
```
Javascript:
```
function MyFunction() {
var data... | Here is my controller action.
```
[HttpPost]
public ActionResult ActionName(string x, string y)
{
//do whatever
//return sth :)
}
```
and my post action is here.
```
<script type="text/javascript">
function BayiyeCariEkle(){
var sth= $(#itemID).text();
va... |
41,487,473 | I got this Python Code, and somehow I get the Error Message:
>
>
> ```
> File "/app/identidock.py", line 13, in mainpage
> if request.method == 'POST':
> NameError: name 'request' is not defined
>
> ```
>
>
But I really can't find my mistake. Can someone please help me with that?
```
from flask import Flask, ... | 2017/01/05 | [
"https://Stackoverflow.com/questions/41487473",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6817996/"
] | You appear to have forgotten to import the `flask.request` [*request context*](http://flask.pocoo.org/docs/0.12/reqcontext/) object:
```
from flask import request
``` | This is because you missed the import statement
```
from flask import request
``` |
30,483,121 | This little section is still a problem.
```
if (card.suit == Suit.DIAMOND || card.suit == Suit.HEART) {
g.setColor(Color.red);
} else {
g.setColor(Color.black);
}
```
The error I am getting is "**cannot find symbol**" and the symbol is "**Suit**".
And when I change it to.
```
if ... | 2015/05/27 | [
"https://Stackoverflow.com/questions/30483121",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4920432/"
] | Try to replace to this line of code:
**Swift 2**
```
UIApplication.sharedApplication().keyWindow?.rootViewController?.presentViewController(refreshAlert, animated: true, completion: nil)
```
**Swift 3**
```
UIApplication.shared.keyWindow?.rootViewController?.present(refreshAlert, animated: true, completion: nil)
... | Leo's solution worked for me. I've used it to present an AlertView from a Custom collection view cell.
Update for Swift 3.0:
```
extension UIView {
var parentViewController: UIViewController? {
var parentResponder: UIResponder? = self
while parentResponder != nil {
parentResponder = p... |
2,050,306 | I have three c# projects in my solution. One is a console app that simply calls into a class library project. The class library project does all the processing for the application. Then there is a WinForm project that displays a form and then when a button is pressed, calls the same logic in the class library project. ... | 2010/01/12 | [
"https://Stackoverflow.com/questions/2050306",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/54064/"
] | You could raise an event in the class library that is listened to/registered from whatever your UI/Console layer is. That way it can decide to act on the event if it is deemed necessary in as many places as you desire. It really depends on how your architecture is setup. | While the interface answers are probably better solutions, if it's just *one* method you could just use a delegate to pass the Console or WinForm method to the class library. |
44,535,888 | I am attempting to log the current tracker info to the console as per the Analytics documentation:
```
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g... | 2017/06/14 | [
"https://Stackoverflow.com/questions/44535888",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5645843/"
] | Please install and enable **Google** Tag Assistant from [here](https://chrome.google.com/webstore/detail/tag-assistant-by-google/kejbdjndbnbjgmefkgdddjlbokphdefk?hl=en) and start record.
Two things always remember.
* put your **ga** code in always `<head></head>` tag.
* don't put your **ga** code any core function li... | Don't forget to disable ad/tracking blockers ;)
I know that this is an old thread, however, it was the only one I found about this issue and as the others stated the code is actually correct. However, the reason it did not work for me was that I forgot to disable tracking protection. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.