INSTRUCTION
stringlengths 25
999
| RESPONSE
stringlengths 0
999
| SOURCE
stringlengths 16
38
| METADATA
dict |
---|---|---|---|
Shell scripting: die on any error
Suppose a shell script (/bin/sh or /bin/bash) contained several commands. How can I cleanly make the script terminate if any of the commands has a failing exit status? Obviously, one can use if blocks and/or callbacks, but is there a cleaner, more concise way? Using && is not really an option either, because the commands can be long, or the script could have non-trivial things like loops and conditionals.
|
With standard `sh` and `bash`, you can
set -e
It will
$ help set
...
-e Exit immediately if a command exits with a non-zero status.
It also works (from what I could gather) with `zsh`. It also should work for any Bourne shell descendant.
With `csh`/`tcsh`, you have to launch your script with `#!/bin/csh -e`
|
stackexchange-stackoverflow
|
{
"answer_score": 67,
"question_score": 39,
"tags": "bash, shell, scripting"
}
|
Integrate WordPress in Yii
I'm developing a web application in Yii, now the client wants to integrate WordPress in it so he can manage contents on his own.
So how can I integrate WordPress in Yii?
|
I don't have any experience with Yii, but looking at their Wiki there are already some solutions:
1. Integrating Wordpress and Yii,Working Out The Details.
2. Integrating Wordpress and Yii: still another approach, using Yii as the router/controller
3. Integrating Wordpress and Yii: yet another approach
4. Integrating Yii with Wordpress
5. Run an Yii Application inside an Wordpress page
Please take a look at the above 5 links, they probably contain a suitable solution for you.
|
stackexchange-wordpress
|
{
"answer_score": 2,
"question_score": 1,
"tags": "php"
}
|
Count number of items per ID
I have a table as below
**INPUT**
ID ITEM
1 Apple
1 Banana
1 Orange
2 Pear
3 Apple
3 Pear
I want to count the items per id, such as
**OUTPUT**
ID ITEM ITEMS_PER_ID
1 Apple 3
1 Banana 3
1 Orange 3
2 Pear 1
3 Apple 2
3 Pear 2
Using count with group by does not achieve the desire result. What would be the best way to do this?
|
Use `COUNT()`:
select *, count(item) over(partition by id) as items_per_id from t
Result:
id item items_per_id
-- ------ ------------
1 Apple 3
1 Banana 3
1 Orange 3
2 Pear 1
3 Apple 2
3 Pear 2
For reference, the data script I used is:
create table t (
id int,
item varchar(10)
);
insert into t (id, item) values
(1, 'Apple'),
(1, 'Banana'),
(1, 'Orange'),
(2, 'Pear'),
(3, 'Apple'),
(3, 'Pear');
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 0,
"tags": "sql, postgresql"
}
|
Please burn some [jrxml] weed under my oak
jrxml is the file format of jasper-reports. If it is jrxml, you can be sure it is a Jasper report.
The all-time top answerer of jasper-reports is making a great effort to edit and remove or replace jrxml with jasper-reports. jrxml is an unnecessary tag, that doesn't provide additional information. I did an effort to remove the last 12...
So let's just **burn this weed away** , once and for all...
|
I totally agree with Petter. It is an absolutely useless tag. In case of using this tag the author of question talking about the _JasperReports_ framework
|
stackexchange-meta_stackoverflow
|
{
"answer_score": 13,
"question_score": 25,
"tags": "discussion, status completed, burninate request"
}
|
How to accept multiple input into a same script
How can I accept multiple-line input into a same script. Or in other words to process multiple files with the following script:
#!/bin/bash
echo 'Enter file names (wild cards OK)'
read input_source
if test -f "$input_source"
then
sort $var | uniq -c | head -10
fi
|
Add a for loop:
#!/bin/bash
echo 'Enter file names (wild cards OK)'
read files
for input_source in $files ; do
if test -f "$input_source" ; then
sort $var | uniq -c | head -10 # You probably should include $input_source somewhere
fi
done
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "bash, unix"
}
|
React-Native: How do I find file info for a ph:// uri?
I'm using the CameraRoll in React-Native 0.59.3 to fetch photos from the library. I get back the following information:
height: 3024
isStored: true
playableDuration: 0
uri: "ph://CC95F08C-88C3-4012-9D6D-64A413D254B3/L0/001"
width: 4032
How do I get the filename, filesize, mimetype, and normal URI from this information? What is the purpose of this new `ph://` uri?
|
once you get those details successfully you can return promise to set the uri to your local state so you can use it.
something like:
this.setState({imageSrc: uri})
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "react native, photokit, camera roll"
}
|
find the derivative of function at given point
> Find $f^{(2012)}(\pi/6)$ if $f(x)=\sin x$
>
> Here's the hint from the question paper: You may use Maclaurin series of $\sin x$ and $\cos x$; the formula $\sin(a+b) = \sin a \cos b + \cos a \sin b$ may be useful.
It is quite complicated to me. Btw this is my math graded homework. I know how to find derivative when $x = 0$, but i can't proceed with this qn coz of the $\pi/6$. Any ideas?
|
Notice $f(x) = \sin x$, $f'(x) = \cos x$, $f''(x) = - \sin x$, $f'''(x) = - \cos x$ and $f^{(IV)}(x) = \sin x$. How can you use this information to find the nth derivative of $f$ ? This is a hint.
|
stackexchange-math
|
{
"answer_score": 7,
"question_score": 1,
"tags": "sequences and series"
}
|
What's the easiest way to validate this date format, eg, 31-JUL-2010 (and only this fmt)
I would like to easily validate dates in this format and only this format. Any otehr format should be considered invalid.
|
You use `DateTime.ParseExact` or `DateTime.TryParseExact`. You pass through the exact format string.
In your case the format string would be `d-MMM-yyyy` (see here) and can be used as follows:
string dateString = "31-JUL-2010";
string format = "d-MMM-yyyy";
DateTime result = DateTime.ParseExact(dateString, format, CultureInfo.InvariantCulture);
|
stackexchange-stackoverflow
|
{
"answer_score": 5,
"question_score": 3,
"tags": "vb.net"
}
|
Asp .NET Identity Cookie Authentication
I'm using MVC 5 default template with "Individual Accounts" selected for authentication. it uses ASP .NET Identity with Entity Framework.
Using Chrome I opened the app and Registered a user and then login with the user. I accidentally deleted the database. Now when I open the app again in Chrome it still shows me signed in since auth cookie persists in browser. However the user that is logged in doesn't exists in the database.
Is it the correct behavior?
If not then any suggestions on how to prevent it?
|
That's correct behaviour. As long as the auth cookie is valid and not expired your app assumes the user is authenticated.
When you disable or (soft) delete a user, you should call `UserManager.UpdateSecurityStamp(string userId)` which causes the auth cookie to be invalid on next check.
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 1,
"tags": "authentication, asp.net identity"
}
|
Introduction to SQL triggers?
I am a student, with decent knowledge of SQL, but have had very little to do with triggers in the past. I've looked at a few sites for guidance, but comprehensive explanation on all commonly used statements seems fairly sparse.
Is there a 'definitive' site for this kind of thing? Perhaps like a w3chools for advanced SQL?
|
Once you know a little SQL, try to check out Joe Celko's books. Advanced SQL Programming has a short section on triggers. Since you're a student, you can probably get a copy at the library. If you think you're going to be doing deeper SQL dev work, you'll be glad to score your own personal copy of the book. You can get the relational DB engine to do a significant amount of work in a small amount of code - thinking that way will make you a much more efficient programmer. Most book stores (my local Borders always has a couple copies) will have a copy on the shelf, so browse before you buy.
Also, check out the online manuals for the database you're using as itsmatt suggests.
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": -2,
"tags": "sql, database, triggers"
}
|
How do you install mtop on 12.04 LTS?
I'd like to examine some live MySQL queries so have just tried installing `mtop` on a Ubuntu 12.04 LTS box.
However when I try and install it using `apt-get` I get:
sudo apt-get install mtop
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package mtop
Given that apt-get returns `Unable to locate` how do I install `mtop` for Ubuntu 12.04?!
|
install mytop instead of mtop <
|
stackexchange-stackoverflow
|
{
"answer_score": 12,
"question_score": 8,
"tags": "mysql, ubuntu"
}
|
logic error trying to find average of 2d array
this always outputs 1 and i dont know why, im trying to make a method that takes the average of the elements of a 2d array. this is part of a class and im calling it from a main class.
public static double Ave(Array_two a) {
int average = 0;
int total = a.rows * a.cols;
for (int i = 0; i < a.rows; i++) {
for (int j = 0; j < cols; j++) {
average = a.values[i][j] / total;
}
}
return average;
|
There are multiple problems with your code.
First, I guess `j < cols` in the inner loop should be `j < a.cols`.
Second, and most important, this is not how you calculate the average of a set of numbers.
You should first sum them, then divide the total by the number of samples. Like this, for example
public static double Ave(Array_two a) {
double sum = 0; // you want to return a double
double total = a.rows * a.cols;
if (total == 0) return 0; // watch out for possible division by 0
for (int i = 0; i < a.rows; i++) {
for (int j = 0; j < a.cols; j++) {
sum += a.values[i][j];
}
}
return sum / total;
}
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 2,
"tags": "java"
}
|
Going from a waking state into the dream state while being conscious
I just listened to a audio dhamma talk by Ajahn Punnadhammo. Its called _"Stop thinking"_ and can be found here.
In the last 5 minutes of the talk Ajahn Punnadhammo mentions some good exercises for learning about reality. He says that a good exercise is to try to be conscious while entering the dream state from waking state **because the stages of falling asleep exactly mirror the stages of dying!** He says its like a sneak preview of what happens when one dies.
My question is; if one trains in this and succeeds in being aware and conscious throughout the death process and into the next life will one then be able to remember the previous (this) life?
Thank you for your time.
Lanka
|
If one is truly mindful during the process of death, then one of two possibilities exist; either one will pass away into complete liberation as an enlightened being or, if there is still some substratum of clinging, one will be reborn as a deva or brahma and be fully conscious of one's previous life.
|
stackexchange-buddhism
|
{
"answer_score": 3,
"question_score": 4,
"tags": "personal practice, rebirth, sleep"
}
|
$(f_n(x))$ converges to a discontinuous function Counterexample
If the sequence of functions $(f_n(x))$ converges to a discontinuous function $f(x)$ on a set S, then the sequence does not converge uniformly on S.
If a function $f(x)$ is defined on [−1, 1] and continuous at $x = 0$, then f is continuous on some open interval containing zero
Can anyone show me a counter example to these? I am struggling to find one, thank you.
|
Take $f_n=x^n$ on $[0,1]$.
This converges to $f(x)=0$ for $x<1$, and $f(1)=1$.
So this functioon is discontinuous, and the convergence isn't uniform.
|
stackexchange-math
|
{
"answer_score": 1,
"question_score": 1,
"tags": "uniform convergence"
}
|
Handle kafka broker full disk space
We have setup a zookeeper quorum (3 nodes) and 3 kafka brokers. The producers can't able to send record to kafka --- data loss. During investigation, we (can still) SSH to that broker and observed that the broker disk is full. We deleted topic logs to clear some disk space and the broker function as expected again.
Given that we can still SSH to that broker, (we can't see the logs right now) but I assume that zookeeper can hear the heartbeat of that broker and didn't consider it down? What is the best practice to handle such events?
|
The best practice is to avoid this from happening!
You need to monitor the disk usage of your brokers and have alerts in advance in case available disk space runs low.
You need to put retention limits on your topics to ensure data is deleted regularly.
You can also use Topic Policies (see `create.topic.policy.class.name`) to control how much retention time/size is allowed when creating/updating topics to ensure topics can't fill your disk.
The recovery steps you did are ok but you really don't want to fill the disks to keep your cluster availability high.
|
stackexchange-stackoverflow
|
{
"answer_score": 3,
"question_score": 1,
"tags": "apache kafka"
}
|
How should we write the phrase "one of a kind"?
I have seen both forms, so I am confused. Which of the following is the most appropriate way to write the phrase?
> "one of a kind"
or
> "one-of-a-kind"
|
I see no justification for the hyphens, except in the unlikely circumstance of the phrase being used adjectivally.
|
stackexchange-english
|
{
"answer_score": 5,
"question_score": 6,
"tags": "idioms, writing style, hyphenation, compounds"
}
|
How do I remove extra luminescence in a image which cause feature lost in a image?
I am having a person's face image which has extra luminescence while capturing the photo. I want reduce or remove the luminescence of the image so that face is clearly visible.
Example of the Image is :
 whose members I would like to have visible in a DataGridView on a selective basis.
Here is my class:
class MyClass
{
public int X;
public int Y;
public int Z;
}
Is it possible to have just the `X` and `Y` members visible in the grid without the use of accessors? I tried adding columns to the DataGridView but the data wasn't being filled (but I could have been doing this wrong. I just created a column with the same name as the field).
I am binding the list to the control with the following code:
datagrid.DataSource = list;
Any help on this would be amazing.
|
The problem is with your class; you are having public members but not public properties. Bindable controls such as DataGridView bind with public properties with `get; set;`
In short you need to change your class
class MyClass
{
public int X
{
get;
set;
}
public int Y
{
get;
set;
}
public int Z
{
get;
set;
}
}
And then in designer specify column's `DataPropertyName` to respectively
DataPropertyName = X
DataPropertyName = Y
DataPropertyName = Z
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "c#, winforms, datagridview"
}
|
How do I delete columns where the average of the column already exists
In the example below, Column C should be deleted because it already exists (Column A should remain)
type(df): pandas.core.frame.DataFrame
A B C
1 2 1
0 2 0
3 2 3
I tried creating a dictionary to later delete repeated values but got stuck
dict_test = {}
for each_column in df:
dict_test[each_column] = df[[each_column]].mean()
dict_test
The result came out to be dtype: float64, 'A' : A 1.33333
The problem above is that the dictionary is storing the 'Key and Value' in the Value section so I can't compare Values to one another
|
You can use `df.mean().drop_duplicates()` and pandas indexing:
In [30]: df[df.mean().drop_duplicates().index]
Out[30]:
A B
0 1 2
1 0 2
2 3 2
|
stackexchange-stackoverflow
|
{
"answer_score": 3,
"question_score": 1,
"tags": "python, python 3.x, pandas, dataframe"
}
|
mysql select 3 items from each group and output result set in multiple columns
I have a table "Product" like this:
store_id product
----------------------------------
1 A
1 B
1 C
1 D
1 E
2 AA
2 BB
2 CC
2 DD
What's the mysql query to randomly select 3 products from each store, AND place the product on its own column for each store so I get a result set like:
store_id product_1 product_2 product_3
------------------------------------------------
1 A D E
2 BB CC DD
???
Thanks,
Commonboy
|
This should give you the result you need:
SELECT
store_id,
MAX(CASE WHEN row=1 THEN product END) product_1,
MAX(CASE WHEN row=2 THEN product END) product_2,
MAX(CASE WHEN row=3 THEN product END) product_3
FROM (
SELECT
CASE WHEN @last=store_id THEN @row:=@row+1 ELSE @row:=1 END row,
store_id,
product,
@last := store_id
FROM (
SELECT store_id, product
FROM products
ORDER BY store_id, rand()
) s
) r
WHERE
row<=3
GROUP BY
store_id
Please see fiddle here.
On the s subquery I'm ordering all products by store_id and then by random, on the r subquery I'm calculating the row number, and on the outer query I'm pivoting the result (I'm grouping by store_id, and I'm putting row 1 into column product_1, row 2 into product_2 row 3 into product_3).
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 1,
"tags": "mysql"
}
|
How to add one month to an NSDate?
How To Add Month To NSDate Object?
NSDate *someDate = [NSDate Date] + 30Days.....;
|
You need to use **NSDateComponents** :
NSDateComponents *dateComponents = [[NSDateComponents alloc] init];
[dateComponents setMonth:1];
NSCalendar *calendar = [NSCalendar currentCalendar];
NSDate *newDate = [calendar dateByAddingComponents:dateComponents toDate:originalDate options:0];
[dateComponents release]; // If ARC is not used, release the date components
|
stackexchange-stackoverflow
|
{
"answer_score": 140,
"question_score": 81,
"tags": "ios, iphone, objective c, nsdate"
}
|
tree selection for dojo
jquery has a plugin dynatree to achieve this. I want this kind of effect with dojo. Is there a plugin or something for dojo which can do this?
|
< I used this.
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "jquery, dojo, dynatree"
}
|
Got a minus one from a read call
I connect to a database with read only access using SQL developer. It's a TNS connection. I use a tnsnames.ora, forwarding port script and SQL Developer.
In the past, occasionally, when connecting, I get a error message Got a minus one from a read call. Vendor Code 0
If I do a reboot, it goes away. Another friend suggested changed the forwarding port which worked for him.
I recently upgraded to a new computer and now it seems that I am getting the error message consistently. Reboot or changing forwarding port does not help at all.
The port forwarding script contains something like this
putty -L (port):(machine name):1521
Does anybody have any idea? Thanks.
|
My port forwarding script forwards multiple ports. Somehow separating them into 2 smaller file, this error went away.
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 2,
"tags": "sql, oracle, putty"
}
|
Is there any tutorial where I can learn big jQuery projects or plugins?
I want to learn jQuery. I tried various books, but they only tell you about the basic functions and how to use them.
I want something like where a full fledged project of grid or table sorting, etc. is build in jQuery and then the writer tells how he build the complete application using jQuery rather than small simple selectors.
For example, I tried reading the code of the plugin FancyBox, and I learned many new concepts of how things are used in a practical way.
But there were many things which I could not understand why they used it.
|
If you understand the basics of how jQuery works, and if you know JavaScript, then you can use it to build big projects, but, if you don't know JavaScript then any reading of jQuery books won't help you much.
If you are having a hard time understanding what is being done then you may need to spend more time learning JavaScript, as jQuery is just some utility functions, basically, to help hide issues about cross-browser concerns from developers.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "jquery"
}
|
SSRS ignores sort in a recursive hierarchy
I've got a SSRS report that builds a recursive hierarchy using the Recursive Parent property. I need to sort by a field in the dataset (not interactive sorting, just plain sorting). I've set it on the Details group but Reporting Services won't do the sort.
If I remove the recursive grouping and return it to a flat dataset, the sort works as expected, so I know it is because of the hierarchy. Anyone else ever run into this?
|
Sorting within a recursive hierarchy will only affect the order of items at the same level, within the same node.
So, for example, if Peter is the manager of Fred and Sid, then sorting ascending on name will produce the output:
Peter
Fred
Sid
While sorting descending on name will produce the output:
Peter
Sid
Fred
Under these circumstances, Peter can never appear between Fred and Sid because he is at a higher level within the hierarchy.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "reporting services, hierarchical data"
}
|
Hive Migrate Date Format from Greenplum SQL
I am looking for help to convert below sql query into hive supported date format. kindly assist.
GP: SQL
select to_date('19800302000000','yyyymmddhh24miss') date_of_birth
GP Output : 1980-03-02
GP query :
extract(year from age(current_date-1, to_date(b.birthday,'yyyymmddhh24miss'))) age
we are looking similar out in hive. please help us.
|
For `select to_date('19800302000000','yyyymmddhh24miss')` use this
`select from_unixtime(unix_timestamp('19800302000000','yyyyMMddhhmmSS'))`.
If you dont want time part, use this `select to_date(from_unixtime(unix_timestamp('19800302000000','yyyyMMddhhmmSS')))`.
For `extract(year from age(current_date-1, to_date(b.birthday,'yyyymmddhh24miss'))) age`
use below code. it should give difference of years between yesterday and DOB.
select
year(current_date() - interval 1 day ) -
year(from_unixtime(unix_timestamp('19800302000000','yyyyMMddhhmmSS'))) age
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "hive, hiveql, greenplum"
}
|
SQL Server query help... need to convert varchar to date
I am writing a query to fetch results for all the values in a column which is of `varchar` type.. are less than '29/08/2010' (date)
My Query:
SELECT * FROM EMPLOYEES WHERE COLUMN1 < '29/08/2010'
Here the column1 is of `varchar` type. I am using SQL Server 2005
Is there a way to make this possible..??
Pls help me.
Thanks in advance
|
Have you tried
SELECT * FROM EMPLOYEES WHERE CONVERT(datetime, COLUMN1, 103) > CONVERT(datetime, '29/08/2010', 103)
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "sql, sql server, sql server 2005"
}
|
Swift: dynamically creating and assigning delegates
MKMapView's delegate property is defined as so in swift:
@IBOutlet weak open var delegate: MKMapViewDelegate?.
If I had to dynamically create map views for each item in an array whose length/count is unknown beforehand, how I dynamically assign a unique delegate instance to each one of the maps without keeping a class variable for each delegate (since we don't know the count of items in the array). Is there something similar to Obj-C's `__Strong` ?
**Update** : I could have a class array to which I add each delegate, but still, are there any other approaches, which are more inline for example by using __Strong, if there is such a thing in Swift
|
> how I dynamically assign a unique delegate instance to each one of the maps without keeping a class variable for each delegate
There's no need for a unique delegate object for each map view. Delegate methods typically get a reference to the delegator as their first parameter, so the delegate can easily tell which map view is sending the message.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": -2,
"tags": "swift, delegates, mkmapview, weak references, strong references"
}
|
Hibernate get max value
I want to get max value of column from table.
This is SQL query I want to execute using Hibernate:
String max = //SELECT MAX(column_string) FROM table;
But I don't know how.
|
Query query = entityManager.createNativeQuery("SELECT MAX(column_string) FROM table");
String max = query.getSingleResult();
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "hibernate"
}
|
webView:shouldStartLoadWithRequest has delay before working
I would like to know why `webView:shouldStartLoadWithRequest` does not fire for about ~10 seconds when my app starts.
In my iOS using Cordova, I have a loading screen class that displays the loading view on app boot. The view intercepts the url load like this:
- (BOOL)webView:(UIWebView*)theWebView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType
{
NSURL* url = request.URL;
// do something
return TRUE;
}
But it takes time before the view begins to intercept the URL. I have confirmed this by placing a debugger in the method. It did not have this behavior before, and I haven't changed the loading screen class at all recently.
Any ideas? How might I resolve this?
|
The problem is that I did not set the delegate until later. `UIWebViewDelegate` needs delegate to work.
I my case, I had to do the following at the right time:
// ...
myLoadingView.delegate = self;
// ...
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "ios, cordova, webview"
}
|
Can a hamster run around a room instead of having a wheel?
A hamster needs to run to stay healthy and happy. I am wondering, if a hamster was given a large enclosure (like the size of a room that is 300-400 square feet / 28-37 square meters), would the hamster ever need a wheel to run in? It would seem that the hamster could just run around the room instead of ever needing a wheel.
|
No, if a hamster has sufficient space, they do not need a wheel. A wheel is just a way to work around not having enough space to exercise. I'm sure a hamster would love having a that much space to run around in!
|
stackexchange-pets
|
{
"answer_score": 5,
"question_score": 2,
"tags": "health, safety, containment, hamsters, exercise"
}
|
Detect touchpad vs mouse in Javascript
Is there any way to detect if the client is using a touchpad vs. a mouse with Javascript?
Or at least to get some reasonable estimate of the number of users that use touchpads as opposed to mice?
|
In the general case, there is no way to do what you want. ActiveX _might_ allow you to see and examine USB devices, but in the best case, even if that is somehow possible, that limits you to IE users. Beyond that, there is no way to know.
You might be able to discern patterns in how (or how often) a touchpad user moves the cursor versus how a mouse user might move the cursor. Differentiating between physical input devices in this way is an absurdly difficult prospect, and may be wholly impossible, so I include here it for completeness only.
|
stackexchange-stackoverflow
|
{
"answer_score": 4,
"question_score": 35,
"tags": "javascript, mouse, touchpad, trackpad"
}
|
How to compress image byte[] array to JPEG/PNG and return ImageSource object
I have an image (in the form of a byte[] array) and I want to get a compressed version of it. Either a PNG or JPEG compressed version.
I use the following code at the minute:
private Media.ImageSource GetImage(byte[] imageData, System.Windows.Media.PixelFormat format, int width = 640, int height = 480)
{
return System.Windows.Media.Imaging.BitmapSource.Create(width, height, 96, 96, format, null, imageData, width * format.BitsPerPixel / 8);
}
How do I extend this so that I can compress and return the compressed version of image source (with the degraded quality).
Thanks in advance!
|
Using the right encoder like PngBitMapEncoder should work:
private ImageSource GetImage(byte[] imageData, System.Windows.Media.PixelFormat format, int width = 640, int height = 480)
{
using (MemoryStream memoryStream = new MemoryStream())
{
PngBitmapEncoder encoder = new PngBitmapEncoder();
encoder.Interlace = PngInterlaceOption.On;
encoder.Frames.Add(BitmapFrame.Create(BitmapSource.Create(width, height, 96, 96, format, null, imageData, width * format.BitsPerPixel / 8)));
encoder.Save(memoryStream);
BitmapImage imageSource = new BitmapImage();
imageSource.BeginInit();
imageSource.StreamSource = memoryStream;
imageSource.EndInit();
return imageSource;
}
}
|
stackexchange-stackoverflow
|
{
"answer_score": 3,
"question_score": 3,
"tags": "c#, wpf, image, arrays, imagesource"
}
|
Convert SQL Server database to SQL Server CE?
I have a SQL Server database which I can read from, is there a quick way I can turn it into an SQL Server CE database through C# or will I have to read in all the data then output it in SQL Server CE.
|
You can use my SQL Server Compact scripting API, which will allow you to export a Server database to a script file, and run the resulting file against a SQL Server Compact database from your C# code.
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 0,
"tags": "c#, sql server, sql server 2008, compact framework, sql server ce"
}
|
Chain rule (2 variable function)
I have the function : $$g(x,y)= f'_{x}(x,y)e^{f(x,y)-5}\sin y$$
I am trying to make a Taylor expansion and I am a little bit confused how to derive the function with respect to y. (I understand how it works with 2 functions) but when it comes to 3 I have no idea how to approach this kind of problem.
|
The product rule for differentiation can be generalized to three single-variable functions: $$ (fgh)' = f(gh)' + f'(gh) = f(g'h + gh') + f'gh = f'gh + fg'h + fgh'. $$ For partial differentiation of the product of two-variable functions $f$, $g$, and $h$, this rule becomes $(fgh)_y = f_ygh + fg_yh + fgh_y$.
|
stackexchange-math
|
{
"answer_score": 0,
"question_score": 1,
"tags": "multivariable calculus, derivatives, partial derivative"
}
|
Cannot see the ObjectAid UML Explorer plugin
I managed to install the ObjectAid UML explorer in my JUNO Eclipse. Eclipse SDK Version: 4.2.1. But when I tried to create a UML diagram from the class files that I have, I cannot see the ObjectAid UML as you can see in the image here: !enter image description here
But when I try to uninstall the softwares, I can see the ObjectAid UML in the list of installed software. Does anybody know why it is so? Should I do anything to activate it? I'm 100% sure that the installation was correct as I followed the steps from the official website.
|
From the ObjectAid One-Minute Introduction user manual
> First you create an empty class diagram with the 'New' wizard. To get there, you can simply press Ctrl+N in the package or folder where you want to create your class diagram.
You should search for "Class Diagram" in the wizard.
I can't confirm this on Juno, but it works for me in Kepler.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 1,
"tags": "java, eclipse, eclipse plugin, eclipse juno, objectaid"
}
|
Refining HTML Element types in flow
Is it possible to refine a `Node` or `Element` into a specific HTML element type? For example:
function htmlToEntity: (node: HTMLAnchorElement | Node) {
if (node.tagName === "A") {
return createEntity(
"LINK",
"MUTABLE",
{ url: node.href }, // Throws error
);
}
return undefined;
}
The error it throws is:
> Cannot get `node.href` because property `href` is missing in `Node`
|
You should be able to use `instanceof` to refine it.
function htmlToEntity(node: HTMLAnchorElement | Node) {
if (node instanceof HTMLAnchorElement) {
return createEntity(
'LINK',
'MUTABLE',
{ url: node.href } // Does not throw error
)
}
return undefined
}
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "javascript, types, flowtype"
}
|
How to uninstall versions of Java openJDK
I am using Linux Mint XFCE 20.
Recently I installed Java by running `sudo apt-get install openjdk` and it automatically installed versions 8 and 11 of both JRE and JDK, including JRE headless.
It turns out that I needed only openjdk 16 to run what I wanted to, and having other versions of java are kinda pointless. My main issue is that programs default to version 8 and I can't seem to fix it.
So how can I uninstall both versions 11 and 8 and just keep 16?
|
The unwanted versions can be removed by name:
sudo apt remove openjdk-8-jdk
sudo apt remove openjdk-11-jdk
They are installed with different packages.
You can see all the openjdk packages available with this command:
sudo apt update
apt-cache search openjdk
You can see all openjdk packages in your system with:
dpkg -l | grep openjdk
_Note: I am a RedHat user, not a Mint expert but this is pretty much the same on every distro. I just checked the package names on Mint for those commands to work._
|
stackexchange-unix
|
{
"answer_score": 1,
"question_score": 0,
"tags": "java, uninstall, openjdk"
}
|
UITableview to always take full display height
is there a way in which a UITableView can always take a fixed height and can scale the static cells i'm using to the remaining height? I'm trying to achieve that my tableview layout is always visible on different devices.
|
I think I understand what you're getting at with having the table view showing on all devices. Instead of setting a specific size I'd recommend using auto layout instead! You can read more here.
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": -2,
"tags": "ios, swift"
}
|
Differentiation problem regarding unspecified variable or function.
I am given $$ y = \alpha + \frac{1}{\alpha} $$ and asked to prove that $$ \alpha^2 y'' + \alpha y-2 = 0 $$ but when I use $\alpha$ as a variable I get $y-2 = 0$. Am I missing something? No other explanation is given regarding $\alpha$ or $y$.
|
It is wrong. $y$ is a function of $\alpha$. We have $y'=1-\frac 1 {\alpha^{2}}$ and $y''=\frac 2 {\alpha^{3}}$. Hence $\alpha^{2}y''+\alpha y-2=\frac 2 {\alpha}+\alpha^{2}+1-2$ which is not $0$.
|
stackexchange-math
|
{
"answer_score": 1,
"question_score": 0,
"tags": "derivatives"
}
|
Linear Programming Model with Strict Inequality and Negative Constraint
I just want to know if it is possible to convert this LP model into a standard LP model: $\max Z = 2x_1+4x_2$
subject to
$-2x_1+3x_2<3$
$4x_1+5x_2>10$
$x_1 \leq 0$
$x_1<4$
$x_2$ unbounded
This is my first time seeing an LP model with strict inequalities and a negative constraint. I just always see the LP model with the usual inequalities and non-negative constraint and of course, I know how to convert those LP models into standard LP models
|
Replace $-2x_1+3x_2<3$ by $$ -2x_1+3x_2 \le 3-\varepsilon $$ where $\varepsilon$ is a "very small" constant. And likewise for the other constraints.
|
stackexchange-math
|
{
"answer_score": 2,
"question_score": 0,
"tags": "inequality, linear programming, mathematical modeling"
}
|
How to store a link and open that link with Selenium Webdriver?
The plan is to:
1. Open page.
2. Select and store the link class.
3. Open the stored link.
Here is what I got so far.
driver.get("
driver.findElement(By.className("button-class"));
|
You can store it as a webelement,
WebElement element = driver.findElement(By.className("button-class"));
and you can click on that element when you want to
element.click();
Or If you just wanna store the link,
String linkToOpen= driver.findElement(By.className("button-class")).getAttribute("href");
Edit: To open the stored link,
driver.get(linkToOpen);
this will open the link in the same tab.
|
stackexchange-stackoverflow
|
{
"answer_score": 4,
"question_score": 0,
"tags": "selenium, selenium webdriver"
}
|
SQLSTATE[42883]: Undefined function: 7 ERROR: function date_format(date, unknown) does not exist
I created this to compare is time now the same as time in my table row executes_at.
$dateNow = Carbon::now()->format('Y-m-d');
$hourNow = Carbon::now()->format('H');
$minuteNow = Carbon::now()->format('i');
$recordings = Recording::with('therapy')
->where(DB::raw("DATE_FORMAT(executes_at,'%Y-%m-%d')"), '=', $dateNow)
->where(DB::raw("DATE_FORMAT(executes_at,'%H')"), '=', $hourNow)
->where(DB::raw("DATE_FORMAT(executes_at,'%i')"), '=', $minuteNow)
->get();
and it worked in MySQL but because now we use PostgreSQL I have this error
> SQLSTATE[42883]: Undefined function: 7 ERROR: function date_format(date, unknown) does not exist
can somebody help me with this.
|
This can be simplified. Just generate the proper datetime format (without minutes) and use `DATE_TRUNC()` to compare it:
$dateNowToMinute = Carbon::now()->format('Y-m-d H:i');
$recordings = Recording::with('therapy')
->where(DB::raw("DATE_TRUNC('minute', executes_at)"), '=', $dateNowToMinute)
->get();
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 3,
"tags": "laravel, postgresql, pg query"
}
|
What's the revised builder pattern?
What is the difference between the original Builder pattern by GoF and the "revised GoF Builder pattern" by Joshua Bloch?
|
The GoF pattern focuses on abstracting the steps of construction so that by varying the builder you can get different results while the "revised builder" is targeting the problem of unnecessary complexity added by multiple constructors. So the GoF pattern is more about abstraction and the revised patter is more about simplicity (IMO).
Look at the examples in < and < and it should be quite clear.
|
stackexchange-stackoverflow
|
{
"answer_score": 11,
"question_score": 16,
"tags": "java, design patterns"
}
|
Finding a String from JSON in Dart
I really need to find some information inside a JSON file, in Java I can easily find a string from a JSON Object with
JSON_Object.getString("String Here");
But I cannot find anything similar in Dart. So far all I can see is:
var jsonobject = new JsonObject.fromJsonString(jsonString);
print(jsonobject.something);
but the problem with this is that I cannot find a String nested in other bits of JSON. Here is the JSON I am using: <
Thanks, Luca
|
If you know the structure of your JSON you can access it directly
var json = ...
print(json["results"][0]["formatted_address"]);
|
stackexchange-stackoverflow
|
{
"answer_score": 3,
"question_score": 2,
"tags": "json, dart"
}
|
how to plot 1 dimensional dataset
I have a series of results of some hadoop experiments. There are more than 500 datapoints (each experiment) and I want to show the overall timing. I'm asking for an effective way to plot this dataset (1 graph per experiment obviously). I'm not sure about an 'ordered' scatter plot like this (actually there is no real order but the timing order, the X value here is just a progressive number): 
t <- 40+24*rexp(520)
so something similar to your chart comes from
plot(sort(t), ylim=c(0,250), ylab="Time (s)")
while you say you do not like something like
boxplot(t, ylab="Time (s)")
and a cumulative distribution would look like a reflection of your original chart
plot.ecdf(t, xlim=c(0,250), xlab="Time (s)")
so you might consider a histogram
hist(t, breaks=10*(0:25), xlab="Time (s)")
or perhaps a rather similar smoothed density, possibly with the mean of the data shown
plot(density(t), xlim=c(0,250), xlab="Time (s)", main="Density of times")
abline(v=mean(t), col="red")
with the last of these looking something like
];
echo $member[rand(1,5)];
echo $member[rand(1,5)];
echo $member[rand(1,5)];
echo $member[rand(1,5)];
But this way, a member can show up twice or even more! What is the correct and professional way to show them only once randomly ?
|
If you want to consume the entire array at random order use `shuffle`.
shuffle($member);
foreach($member as $memberName) {
echo $memberName;
}
If you want to select one or more elements from the array at random use `array_rand`.
Let's say you want to select 3 members from the array at random, with the guarantee that you will never pick the same array value twice.
foreach(array_rand($member, 3) as $key) {
echo $member[$key];
}
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 1,
"tags": "php"
}
|
How to increase number of visible hairs in particle edit mode?
I've made some hair using 'Quick Fur' effect. I've also changed how they look (individual hairs are much wider now, because of the look I was trying to achieve) and I've reduced the number of hair, because it didn't look good with too high number anymore.
The problem is, while it looks fine in render or object mode, when I enter particle edit I can only see a couple of them. Like two orders of magnitude less. It makes it very difficult to work in this mode - since I can barely see effects before switching back to object mode or rendering.
Is hair in particle edit in some low preview (how to change it?) Or am I missing something (since I'm a almost complete newb)?
|
could it be that you have children visualized (default enabled in quick fur)?
this is with children, as in quick fur, and they are visible only in object/render mode (I think there's no way to visualize children during editmode). You could convert from the modifier panel to a real mesh, perhaps, so that children become "real", but you'll loose particle behaviour...
;
die "Impossible time" unless $dt;
You could use other format modules, such as D::F::Strptime, but you will wind up recreating what ISO8601 formatter already does.
|
stackexchange-stackoverflow
|
{
"answer_score": 11,
"question_score": 4,
"tags": "perl, validation, datetime"
}
|
How to change the size and/or color of intersection points in Illustrator?
Is there any way to make these blue dots smaller or lighter? Its not anchor point. They are intersections between grid lines...
Checked the preference but don't know where to look or what to change.
;
max_level = double(max(im(:)));
min_level = double(min(im(:)));
lev = graythresh(double(im)/max_level) * max_level;
bw = (im>=lev);
|
Proof that you are doing EXACTLY Otsu:
im = (imread('coins.png'));
max_level = double(max(im(:)));
min_level = double(min(im(:)));
lev1 = graythresh(double(im)/max_level) * max_level;
%// if instead of offseting and scalling we just put the image
lev2=graythresh(im);
% // and as graythresh returns the value between 0-1 we scale it between 0-255
lev2=lev2*255;
Both levels are 126. You are not using any variation of Otsu, but Otsu itself.
|
stackexchange-stackoverflow
|
{
"answer_score": 4,
"question_score": 0,
"tags": "matlab, image processing, image segmentation"
}
|
Substrate validators election failing and connectivy lost
Hey so I have been running a custom substrate chain with 3 validators. But recently the chain got crashed with a log ` election provider failed due to ElectionError::Fallback("NoFallback.")`
But the chain continued to run after getting this error in chain and in the explorer `stakingElectionfailed`
But after some time the peers connected to validators went from 2 to 0. And when I checked the logs, the validators started forking each other and lost the connectivity.
Trying to debug this. Anyone faced any similar issue or any hints that I can use? I'm stuck nowhere now :(
|
This is because for some reason your `pallet-election-provider-multi-phase` failed, without a proper fallback configured. The reason for the failure can be multiple things, but the most common one is that you don't have enough validators candidates, compared to how many you want.
In other words, if you check the storage item `Staking::validator_count`, and for example if this value is 4, but you only have 3 candidates, your election will always fail.
We are working on relaxing this condition in this pull request.
The easiest fix for a failing election, specially for test networks, is to change `type Fallback` to something that doesn't fail as easy. An example of this is `frame_election_provider_support::OnchainSequentialPhragmen`.
Although, using this in production can be problematic. This is also something that another pull request is trying to tackle.
|
stackexchange-substrate
|
{
"answer_score": 3,
"question_score": 1,
"tags": "runtime, election"
}
|
Remover tags JQUERY
Preciso remover as tags HTML de uma variável, ou então não interpretar o HTML dessa variável. O problema é que a variável tem seu valor vindo de um input, logo:
var msg = $('input').val();
Como não há como pegar o .text() do input, eu não sei como retirar ou pelo menos não interpretar as tags HTML aí! Alguma ajuda ?
|
Se quiser manter as tags sem que elas sejam interpretadas, você pode substituir o `<` e o `>` por sua entidade HTML `<` e `>` respectivamente. O resultado o navegador irá interpretar como um texto comum:
var msg = $('input').val();
msg = msg.replace(/</g, '<').replace(/>/g, '>');
$("body").append(msg);
<script src="
<input value="<b>abc</b>">
**Removendo tags com`.replace` e expressão regular**
var msg = $('input').val();
msg = msg.replace(/<.+?>/g, '');
console.log(msg)
<script src="
<input value="<i class='classe'>abc1</i> <b>def2</b>">
A expressão `<.+?>` captura tudo que for `<nome da tag, atributos, fechamento etc.>` e o `.replace` remove da string.
|
stackexchange-pt_stackoverflow
|
{
"answer_score": 2,
"question_score": 2,
"tags": "html, jquery"
}
|
How can we check in PHP that we have permissions to file_put_contents() into a file?
When i am trying to execute `file_put_contents` function to change the content of a text file, it is showing me following error :
Warning: file_put_contents(somefile.txt) [function.file-put-contents]: failed to open stream: Permission denied in path/to/changecontent.php
Is there any way to check whether we have permission to change a file contents or not?
|
You can use `is_writable` to check if a file or directory is writable.
|
stackexchange-stackoverflow
|
{
"answer_score": 4,
"question_score": 1,
"tags": "php, file permissions"
}
|
Entries search without using asset fields
I have a search form on a website to search through all the entries of the website and return the entries that match the search query.
But the search query is also used on asset fields within an entry. Which for the companies channel results in many entries found when you search on the word: logo.
I like to know if there is a way to search through all the fields of an entry, but without looking through the asset field type?
So for the companies example, I only want to find entries that match the word: logo. When that word is in the content text, and not in an asset name/title.
My code now is this, but it returns the asset fieldtype result as well:
{% set entries = craft.entries({ section: 'not comments' }).search( query ).order('score') %}
|
As suggested in this stack post, you could specify each field individually. I haven't done this with fields, but often do so with sections and entry types in global site searches. It is kind of annoying, but I'm not sure there is a way to do this using Craft's API.
|
stackexchange-craftcms
|
{
"answer_score": 1,
"question_score": 1,
"tags": "entries, assets, search"
}
|
Directory excluding in sonar-project.properties file doesn't work (for me)
I have excluded the directory in my project properties but sonar doesn't exclude it. Can anyone help me to find problem?
sonar.sources=./
sonar.exclusions=./utility/Excel/**
|
I realized that first I should have written directory name Like below to exclude all folders and file on that directory:
sonar.exclusions=utility/Excel/**/*
Second I should have used comma separated directory names to exclude more than one directory:
sonar.exclusions=utility/Excel/**/* , utility/mailer/**/*
|
stackexchange-stackoverflow
|
{
"answer_score": 44,
"question_score": 28,
"tags": "sonarqube, sonar runner"
}
|
Intermittent SQL Insert Error
I am working on a system where we do a monthly job of inserting about a million records into a table. It has been working without any errors and generally continues to do so. Strangely it seems to hit a hump at some point. This month the records up until the 13th September at 21:15:12 for only one of many similar productIDs inserted fine but then suddenly stopped inserting for just productID 37.
The code which fails is:
INSERT INTO tblFooBar (productID, dDate, dTime) VALUES (37,'2017-09-13','21:15:12')
It gives this error:
> Microsoft OLE DB Provider for SQL Server error '80040e07' Conversion failed when converting date and/or time from character string.
If I remove the productID field it enters without any problem:
INSERT INTO tblFooBar (dDate, dTime) VALUES ('2017-09-13','21:15:12')
|
I am glad to say I have resolved the issue. It was not really a SQL Server issue.
The problem was to do with the source dates that I was copying into the SQL statement. They had spurious ï, » and ¿ characters that a third party program had added to the dates and that I had not detected because of encoding.
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "sql server"
}
|
Maven dependency not propagated to dependent project
I have two Maven projects in my Eclipse workspace, `datastore` and `service`.
`datastore` has HSQLDB as a Maven dependency with scope `compile`.
Since `service` depends on `datastore`, I have added `datastore` as a required project for it in **Properties > Java Build Path > Projects**.
However, when I now run `service`, I get a `ClassNotFoundException` for the HSQLDB JDBC driver (in one of `datastore`’s classes called from `service`).
If I add HSQLDB as a dependency to `service` everything works as it should—though I understand I should not need this, as Maven dependencies with scope `compile` should get propagated to dependent projects.
Also, I notice the `pom.xml` for `service` contains no reference to `datastore`.
Where’s the error, if any?
|
**Properties > Java Build Path > Projects** is an Eclipse mechanism and will not propagate Maven dependencies. In order for dependency propagation to work as intended, `datastore` needs to be a Maven dependency.
Add `datastore` as a Maven dependency, using the group ID, artifact ID and version from its `pom.xml`. After that, the project can be removed from **Properties > Java Build Path > Projects**.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "eclipse, maven, dependencies"
}
|
При скроллинге до блока применяется стиль что написать в условии?
Что написать в условии, чтобы когда верхняя часть(граница) браузера достигла блока с классом block приминился стиль?
$(window).scroll(function(){
if ( //Если "верхушка" окна коснулась блок с классом .block){
$('.block').addClass("fixed");
}
});
|
С помощью jQuery:
$(window).scroll(function () {
var position = $('.block').position().top - $(window).scrollTop();
if (position <= 0) $('.block').addClass("fixed");
});
Пример на JSFiddle
|
stackexchange-ru_stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "javascript, html, jquery, css"
}
|
SQL - check if a value is in column list
what is the SQL WHERE clause which checks if a column TopicID('1,5,14,18') has the value '1'?
SELECT TOP 10 *
FROM topics
WHERE {TopicID has the value '1'}
thanks.
|
May be I just interpret your question incorrectly. I think you need `like`:
SELECT TOP 10 *
FROM topics
WHERE TopicID like '1,%' or TopicID like '%,1' or TopicID like '%,1,%' or TopicID = '1'
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "sql"
}
|
Android: How to delete after so many characters?
I need to delete coma(,) after so many. Say there a string with 4 coma's "i , am , ok, today, hello" and i want to delete reset after 2 comans but leave the the text alone just delete comans after first 2?
|
Something like this should do it.
public string StripCommas(string str, int allowableCommas) {
int comma;
int found = 0;
comma = str.indexOf(",");
while (comma >= 0) {
found++;
if (found == allowableCommas) {
return str.substring(0, comma) + str.substring(comma + 1).replaceAll(",", "");
}
comma = str.indexOf(",", comma + 1);
}
return str;
}
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "java"
}
|
If we have a non-constant entire function $f(z)$ show that $u(z)$ is not bounded.
$F(z)$ = $u(z)$ + $iv(z)$ where $F(z)$ is non-constant and entire. Show that $u(z)$ is not bounded.
My intuition is that Liouville's theorem should help or I should make $F(z)$ equal a non-constant function then go from there.
Any pointers would be appreciated, thanks!
|
Consider the function
$G(z) = e^{F(z)}; \tag 1$
since $F(z)$ is entire, so is $G(z)$; furthermore, with
$F(z) = u(z) + iv(z), \tag 2$
we have
$G(z) = e^{u(z) + iv(z)} = e^{u(z)} e^{iv(z)}, \tag 3$
whence
$\vert G(z) \vert = \vert e^{u(z)} e^{iv(z)} \vert = \vert e^{u(z)} \vert \; \vert e^{iv(z)} \vert = \vert e^{u(z)} \vert, \tag 4$
since
$\vert e^{iv(z)} \vert = \vert \cos v(z) + i \sin v(z) \vert = 1;\tag 5$
since $u(z)$ is bounded, (4) shows that $G(z)$ is also bounded; so $G(z)$ is a bounded entire function, hence is a constant by Liouiville's theorem. Then (1) shows that $F(z)$ must be constant well, in contradiction to the hypothesis that $F(z)$ is a non-constant entire function; hence $u(z)$ cannot be bounded.
|
stackexchange-math
|
{
"answer_score": 0,
"question_score": 1,
"tags": "complex analysis"
}
|
Structuring the WinForms in my presentation layer
At our company we are developing an application that has a large number of winforms that are all created in the same UI layer, namespace and assembly. Is there a decent way / design pattern to structure this layer?
Our UI layer communicates with the business layer wich consists of mutiple namespace like business.calculation and business.logistics. Can this structure also be used in the UI layer? It just doesn't feel right to create 100+ winforms in the same winform project.
Cheers!
|
Yes. A good structure will help keep your sanity as the applcation grows. You'll have some challenges:
1. Identifying good namespaces
2. Finding depdencies between them, which results in a logical build order
3. Maintaining the namespaces as developers add new forms
For example, you might consider grouping the forms into namespaces like:
business.library.ui -- common, reusable UI components might go here
business.calculation.ui -- UI related to the calculation, which depends on the library UI
business.logistics.ui -- UI related to the logistics business area, which depends on the library and calculation UI
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 1,
"tags": "winforms, architecture, user interface, layer"
}
|
Feedback on my solution "Determine a set compact or not"
Let $X :=\\{(x_1,0,x_2) \in \mathbb{R^3}, x_1, x_2 \in \mathbb{R}\\}$ $\mathcal{T}$ be subsapce topology coming from standard topology on $\mathbb{R^3}$.
My answer is that it's compact. Reason:
Define $f : \mathbb{R^3} \to \mathbb{R}$ by $f(x_1,x_2,x_3) = x_1x_2x_3$. This function is continuous. Now, restricting the domain to $X$, we have $f(X) = {0}$ which is also continuous. Now, $f^{-1} := \\{x \in \mathbb{R^3} : f(x) \in \\{0\\} \\}$ compact for codomain is Hausdorff . This pre-image contains X. and since $\\{0\\}$ is compact, then the pre-image is compact. Then its subset is compact? (this part confuses me, although, intuition tells me that, if a set of finite open covers covers big set, it undoubtedly covers the smaller one.)
|
In $\Bbb R^3$, a set is compact if and only if it is closed and bounded, and your set there is not bounded. So it is **not** compact. Pre-images of compact sets by functions (even continuous ones) need not be compact, that's the mistake in your proof.
|
stackexchange-math
|
{
"answer_score": 0,
"question_score": 0,
"tags": "general topology"
}
|
FLAnimatedImage animates when returned from viewcontroller
I have a screen that has a UITableView and in that UITableView is a cell that has a FLAnimatedImageView that upon displaying doesn't animate until the user clicks on a play button or the image itself (much like how Facebook functions).
This all works very well, until the user clicks on a button in the cell that pushes them into a new ViewController.
When the user pops out of that ViewController, the once stopped animation is now animating, I have no idea how to prevent it from doing that, it should _not_ be animating when it comes back from the previous screen.
I've tried adding a check to the said button above but that doesn't stop the animation.
|
I've found a solution, though not completely happy with it to be honest but it works.
if you set Image, it'll disable the animation. Not as smooth as I'd like but it works. Maybe the people behind the library can add a property that'll allow us to disable autoplay in the future.
if anyone gets stuck on this, this is how I solved it.
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "xamarin.ios, animated gif"
}
|
What is this "1;#" for when get column as string in workflow?
I have a list ClientList which includes some companies info. Now, I create an approval workflow on a library which has a column 'Client'. At the end of workflow, I need to lookup the client column in ClientList, and then get the ApprovedLibrary column value.
!enter image description here
**The above is the ClientList. The title is 'Sun'.**
!enter image description here
But then if I log the lookup result, I noticed that the title value becomes **1;#Sun** . A
Anyone knows why? Where does this 1;# come from?
Thanks
|
It is the id of listitem "Sun". This is how SharePoint stores lookup values internally.
If you want to get rid of the preceding characters, refer
<
|
stackexchange-sharepoint
|
{
"answer_score": 1,
"question_score": 0,
"tags": "2010, 2013, sharepoint enterprise, sharepoint designer"
}
|
Sass parent selector and hover?
Is it possible to trigger a parent's class when on hover? I know it can be done with jquery but I want to do a pure css solution.
My code:
.navbar-form{
padding-left: 55px;
.input-group{
width: 200px;
.form-control{
border-right: none;
width: 350px;
&:hover & {
border-color: blue;
}
}
.input-group-addon{
background-color: white;
border-left: none;
}
}
}
FIDDLE: <
Looking to have that when I focus on the `input`, `.input-group-addon` would do something. `input` and the icon are children of the input-group.
|
If I understand it right, here is my interpretation of the DOM interaction you're describing.
.parent
* .child1
* .child2
A hover on .child1 affects .child2
If yeah, then here:
.form-control {
... //your CSS for this
input {
//CSS for input
&:hover ~ .input-group-addon {
//CSS for .input-group-addon when input is hovered
}
}
}
OR, if `.input-group-addon` is right after `input` (adjacent sibling), then you could use the following:
.form-control {
... //your CSS for this
input {
//CSS for input
&:hover + .input-group-addon {
//CSS for .input-group-addon when input is hovered
}
}
}
As @Martin suggested.
|
stackexchange-stackoverflow
|
{
"answer_score": 11,
"question_score": 9,
"tags": "css, sass"
}
|
extra_context function for simple generic view in django
I have my page where I have my posts list, and I also want to have sidebar with suggestions. I used generic ListView for my posts, and needed to pass suggestions somehow so I used extra_context which should(?) work like that according to few examples I've read, but in template there is no 'suggestions' object.
class PostList(generic.ListView):
model = models.Post
paginate_by = 10
context_object_name = 'mj'
def get_queryset(self):
return models.Post.objects.filter(user = self.request.user)
def extra_context(self):
return {'suggestions':models.Pla.objects}
I don't have experience in django so maybe there is better way to pass suggestions for sidebar. Maybe it's possible to do this with wrapping view function since I want to have suggestions..
|
Class-based views don't use `extra_context` the way the older function-based generic views did. Instead, the usual way to do this is with a custom `get_context_data` call as shown in the docs:
<
The example in the docs is almost exactly what you're trying to do. You may want to follow its example further and pass in a queryset (`models.Pla.objects.all()`) rather than the manager object (`models.Pla.objects`).
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 1,
"tags": "python, django, generics, view, django context"
}
|
Monetary symbol (not $) in DataGridView field values
I'm building an application that is for a non-profit in Guatemala. Everything in the system is in Quetzales, which is denoted with a Q (i.e. Q100.00) is 100 Quetzales.
I need to be able to modify the monetary values in any DataGridView column, but I've been unable to figure out an easy way to do it with formatting like you can with a dollar sign. I don't want to use computer region settings because some people using the system, use computers from the US.
Not sure if it's important, but values come out of a sql server database from a 'money' type field.
|
When formatting a string you can specify which culture you want to use:
decimal cost = 1500m;
string s = cost.ToString("C", CultureInfo.GetCultureInfo("es-GT"));
Result
Q1,500.00
|
stackexchange-stackoverflow
|
{
"answer_score": 4,
"question_score": 1,
"tags": "c#, datagridview, currency, number formatting"
}
|
Why does transaction fails with already rolled back when user inputs in wrong email
I'm authorizing emails in the database but when I input wrong email it throws Transaction cannot be rolled back because it has been finished with state: commit
export const signin = async (req, res) => {
const { email, password } = req.body;
const transaction = await db.sequelize.transaction();
try {
const user = await db.User.findOne({ where: { email } }, { transaction });
await transaction.commit();
const passBool = Auth.comparePassword(password, user.password);
if (user && passBool) {
return res.json({
success: 1,
user,
message: 'signed in'
});
}
res.json({ success: 0, message: 'wrong username or password' });
} catch (ex) {
await transaction.rollback();
res.json({ success: 0, message: 'wrong username or password' });
}
};
|
solved this, it would fail if i had inserted in wrong request body params
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "node.js, postgresql, sequelize.js"
}
|
get values from dynamically generated drop down
I'm trying to get all `selected` values from `dropdown` that is being populated after accessing some value from first `select box`(`ajax` call).
here what I've tried so far,
$(document).on('change', '#modal', function(){
obj.push($('#modal').val());
});
console.log(obj);
`#modal` is the `id` of newly populated `select` box.
`#make` is the `id` of main `select`.
I've tried these two as well
$('#make').on('change', '#modal', function(){
and
$('#modal').on('change', '#modal', function(){
but no luck by far
PS. I'm using `select2`
|
You can retrieve the `selected` values from your `#modal select` in your `ajax success callback` after populating the select.
For example <
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 1,
"tags": "javascript, jquery, select, drop down menu, jquery select2"
}
|
Transferring Australian superannuation to United Kingdom (for Australian citizen)
I am an Australian citizen now permanently resident in the UK, while I lived and worked in Australia my employers contributed to my superannuation fund.
A) Is it possible to transfer my superannuation to a UK Pension fund?
B) How to do so?
|
No. Only temporary residents can access their super when leaving Australia permanently. That includes transferring the benefit out of an Australian super fund. Australian citizens and Australian permanent residents cannot access their superannuation because they can always chose to retire in Australia.
A recent rule that allows an exception is the Trans-Tasman retirement savings portability scheme for individuals.
> From 1 July 2013, individuals may transfer retirement savings between Australia and New Zealand after their emigration from one country to the other.
This QA covers the issue of accessing super early.
There are special conditions for individuals who are over the preservation age that are living overseas, who can cash out super under some circumstances.
|
stackexchange-expatriates
|
{
"answer_score": 2,
"question_score": 4,
"tags": "united kingdom, australia, pension"
}
|
Simulating side-effects with threads
I was watching this Channel 9 talk and a very interesting statement is made in the around the 60 minutes in.
He said that even with completely pure functions once you introduce threads you can simulate side effects.
The way he outlined this was using C-omega notation, which I'm not familiar with, and this already has the relevant language support to do this.
The problem I have is how do you implement the get and set message handlers without assignments? Surely the handlers would have to change a value so that the thread's internal loop can record a new value?
What am I missing? How would I implement that in LISP, for example, that has no special constructs?
|
> The problem I have is how do you implement the get and set message handlers without assignments? Surely the handlers would have to change a value so that the thread's internal loop can record a new value?
Yes you are correct. Erik is assuming that each thread has its own message queue. Sending a message with `Value(n)` clearly changes the state of the message queue. He makes it sound more mysterious than it is: he is simply trading assignments for another form of mutable state. He is taking advantage of the 'precondition' feature of the language to make it syntactically clean.
As he says, you can use conventional IO (he mentions console IO) to do the same thing. Imagine `Value(n)` writes `n` to a file and the precondition `Value(T t)` checks whether the current value of the state is `t` (in the file). Voilà, mutable state without assignments (but IO is involved now!).
|
stackexchange-stackoverflow
|
{
"answer_score": 6,
"question_score": 3,
"tags": "functional programming"
}
|
proving that $\lim \frac{x^2 - 1}{x - 1} =2$ as $x \rightarrow 1.$ by definition
proving that $\lim \frac{x^2 - 1}{x - 1} =2$ as $x \rightarrow 1.$ by limit definition.
**My answer:** take $\delta \leq \epsilon$, am I correct?
|
> am I correct?
Your idea is correct however you'll have to **write much more**.
You first have to **repeat** the definition used by you:
> The definition of a $\lim\limits_{x \to a}$ ... is:
>
> For every value $\epsilon > 0$ there is a value $\delta > 0$ that ...
Otherwise the other people will ask you:
> What is $\delta$ and what is $\epsilon$?
At least one user already did this in the comment.
Then you claim that any $\delta \leq \epsilon$ satisfies this condition so for every $\epsilon$ such a $\delta$ exists.
You also have to **prove this**.
Otherwise I will claim that there is some value $x \in [0.6,1.4]$ which satisfies $\frac{x^2-1}{x-1}=100000$. If you don't prove your claim I won't prove mine either.
If my claim was right this would mean that the value $\delta = 0.5$ would not fulfill the condition for $\epsilon = 1$ so your claim that any $\delta\leq\epsilon$ fulfils the conditions would be wrong.
|
stackexchange-math
|
{
"answer_score": 1,
"question_score": -1,
"tags": "limits"
}
|
Cache Busting images inside CSS
**My situation
** I am currently using Cache Busting when I include CSS files like this:
`echo "<link href='stylesheet.css?" . filemtime('stylesheet.css') . "' />"`
**My goal
** Now I would like to do something similar for the images I am including inside my CSS file.
**The problem
** The problem is that I cannot use PHP inside my CSS files and I would rather keep my CSS files seperated.
**My question
** How can I add the `filemtime()` to the images inside my CSS files while keeping the files seperated?
**Edit
** I would like to use Far Future Expires headers to cache the files.
|
You could actually rename your css files as style.css.php and then use PHP inside them. As long as the post-processing result is in the proper CSS format, it should work. I've done it in the past. I'm not sure if it's necessary, but if that gives you problems, you can use a header('Content-type...') kind of thing and ensure it's sent as a CSS file.
|
stackexchange-stackoverflow
|
{
"answer_score": 3,
"question_score": 4,
"tags": "php, css, cache control, filemtime"
}
|
Find high correlations in a large coefficient matrix
I have a dataset with 56 numerical features. Loading it to `pandas`, I can easily generate a correlation coefficients matrix.
However, due to its size, I'd like to find coefficients higher (or lower) than a certain threshold, e.g. >0.8 or <-0.8, and list the corresponding pairs of variables. Is there a way to do it? I figure it would require selecting by value across all columns, then returning, not the row, but the column name and row index of the value, but I have no idea how to do either!
Thanks!
|
I think you can do `where` and `stack()`: this:
np.random.seed(1)
df = pd.DataFrame(np.random.rand(10,3))
coeff = df.corr()
# 0.3 is used for illustration
# replace with your actual value
thresh = 0.3
mask = coeff.abs().lt(thresh)
# or mask = coeff < thresh
coeff.where(mask).stack()
Output:
0 2 -0.089326
2 0 -0.089326
dtype: float64
Output:
0 1 0.319612
2 -0.089326
1 0 0.319612
2 -0.687399
2 0 -0.089326
1 -0.687399
dtype: float64
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 1,
"tags": "python, pandas, correlation, pearson correlation"
}
|
Как указать путь к ssl сертефикату в Git [Windows]
Переустанавливал _git_ и похоже настройки криво встали, теперь при `Git PUSH` выдает вот такое сообщение
$ git push -u origin master
> fatal: unable to access '< error setting certificate verify locations: CAfile: C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt CApath: none
Как указать путь к этим библиотекам?( _Git_ установлен в _"C:/Git"_ )
|
из комментария:
* * *
Решил проблему просто скопировав сертификаты из "C:/Git/mingw64/ssl/certs/" в "C:/Program Files/Git/mingw64/ssl/certs/".
|
stackexchange-ru_stackoverflow
|
{
"answer_score": 1,
"question_score": 3,
"tags": "git, github, git push"
}
|
Disable Case sensitive URLs for wso2 am
I created an api in wso2 api manager 2.0 publisher. When I publish this api, I have some resource /Some/things In the wso2 store. If I keep the case as is in the URL, then my api works. If I use any other tool to call and change the case in url to then I get a 202 error.
I know the WSO2 API Manager is handling the API URL correctly but i want to disable these feature.
how can i do this??
|
There is no option to disable case-sensitive in api manager. But you can rewrite the request url by any reverse proxy and send the request to apim. e.g nginx url redirect[1]
[1] <
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "wso2, wso2 api manager, case sensitive, api manager"
}
|
Should I first stop all local servers running on localhost before starting Tor?
If I have apache/mysql and the PHP built-in server running on localhost, should I first stop the local server before starting Tor, or is it totally safe? As in, can someone access my computer/sever/whatever if I connect to Tor while my local server is running?
PS: It's just a regular server I use for developing sites for work, not a hidden service.
Thanks!
|
Unless you edit your tor configuration (your `torrc` file) to add an onion service, tor won't run any onion services and no one will be able to connect to any of your local servers, so you're safe. Even if you accidentally set up a v3 onion service, anyone who wishes to connect to your service would need to know the full 32-byte public identity key of the service in order to connect.
|
stackexchange-tor
|
{
"answer_score": 3,
"question_score": 2,
"tags": "security, server"
}
|
What was the symbolism behind Tantalus's punishment?
Tantalus, who was a bad person, was sent to the fields of punishment.
He stood in a pool, with a fruit tree above him, but the food and drink would always go away from him when he tried to eat it.
So what was symbolized of this punishment, to starve and thirst forevermore?
|
There are two main reasons attributed to Tantalus's punishment, sources from theoi.com:
* He was invited to Olympus by Zeus, ate the food of the gods (ambrosia and nectar), and was given divine secrets, which he then blabbed (Hom. Od. xi. 582).
* He wanted to test the gods and see how perceptive they were, so he invited them to his home for dinner, and killed his son Pelops and cooked and served the boy to the gods. (Hygin. Fab. 83 ; Serv. ad Aen. vi. 603, ad Georg. iii. 7.)
Theoi mentions other stories which I've never heard before, so I don't know how common they are (including one which says he fell in love with Zeus's cup-bearing boy Ganymede and carried him off!).
In any case, the punishment is that food and drink always seem to be within his grasp but are never attainable, and his two major sins both involved food which should not have been eaten.
|
stackexchange-mythology
|
{
"answer_score": 10,
"question_score": 6,
"tags": "greek, symbolism"
}
|
Is this enough to make intransitive use of the transitive 設ける?
The sentence in question:
For Full context: <
My attempt at translation: "The...hospital has made preparations/prepared itself."
On < is a transitive verb, but here it seems to be used in an intransitive way since there is no + object phrase attached. Did I interprete this correctly? I didnt see this pattern before, I think, so I wanted to have it confirmed ^^
|
>
() is transitive. The object of is in the previous sentence. It's left out since it's obvious from the context.
=
The hospital provided (it = time to spend with the stillborn baby).
|
stackexchange-japanese
|
{
"answer_score": 2,
"question_score": 1,
"tags": "grammar, transitivity"
}
|
Why will a dropped object land at the same time as a sideways thrown one?
My textbook says that a ball dropped vertically and a ball thrown sideways will not only both land simultaneously but their height will be corresponding for the entire fall, as shown in a diagram which has a ball falling vertically and a ball with an arch landing simultaneously.
This has really struck me as it feels intuitive that the ball dropped vertically would land faster, perhaps due to it traveling a shorter distance.
When I tried to think about it for myself, I came to the thought that perhaps it was due to gravity constantly pulling both of the balls, however would the sideways velocity not slow it downwards speed? For eg wouldn't a bullet take longer to land than a dropped bullet as it is traveling straight?
` in python and I have read that:
> A deep copy constructs a new compound object and then, recursively, _**inserts copies**_ into it of the objects found in the original.
However, In my code below, I can see that IDs for `x[0] = y[0]` and `x[1] = y[1]`, but ID for `x[2] != y[2]`, which makes sense because it inserts copies of the object. But why is ID of `x[0]` equals `y[0]` and `x[1]` equals `y[1]`?
This is the code that I tried:
x=[1,2,[3,4]]
y=cp.deepcopy(x)
print(id(x),id(y))
for i in range(len(x)):
print(id(x[i]),id(y[i]))
Output:
923236765248 923256513088
140729072564000 140729072564000
140729072564032 140729072564032
923256458496 923256516928
|
In this exanple, I am using `obj` as a wrapper around another value:
import copy as cp
class obj:
def __init__(self, i):
self.i = i
def __repr__(self):
return f'obj({self.i})'
x=[obj(1),obj(2),[obj(3),obj(4)]]
y=cp.deepcopy(x)
print(id(x),id(y))
for i in range(len(x)):
print(id(x[i]),id(y[i]))
Output shows all different numbers.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": -1,
"tags": "python, list, copy, nested lists, deep copy"
}
|
How can i use model in Javascript?
Example :
<script type="text/javascript">
function abc() {
var t = document.getElementById("name").value;
@foreach(Player pl in Model){
if (t == pl.Name) {
alert("This name is already use!");
}
}
</script>
Error : t - cannot resolve symbol How can i use JavaScript variable in C# code? Is it possible in this example?
|
You cannot use JS variables in C# code , but you can use C# variables in the code. In most cases C# is used to render HTML or JS.
In your case it would be best if you render your C# serverside model as a JS array , which you can later on iterate.
1. make an action that returns your list (assuming it's a list) as a JSON
2. fetch the data with an AJAX get call to your action.
Cheers!
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 0,
"tags": "c#, javascript, asp.net mvc, razor"
}
|
How to enable mysqlnd for php?
I have PHP installed and running (version: 5.3.17) and I want to switch to mysqlnd (in the phpinfo mysqlnd does not exist at all).
I read that in order to set it, you need to update the `./configure` command:
./configure --with-mysql=mysqlnd \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
When I tried installing it with `yum install php-mysqlnd` I get an error:
---> Package php-mysqlnd.x86_64 0:5.3.17-1.26.amzn1 will be installed
--> Processing Conflict: php-mysql-5.3.17-1.26.amzn1.x86_64 conflicts php-mysqlnd
--> Finished Dependency Resolution
Error: php-mysql conflicts with php-mysqlnd
|
The `./configure` command is part of the compilation process from source code.
You can either compile from source or install via package manager. I guess in your case the package manager is preferable.
As the package manager complains, you can’t have both `php-mysql` and `php-mysqlnd` installed.
So you can
yum remove php-mysql
before
yum install php-mysqlnd
Then check for success via
php -m | grep mysqlnd
or
php -i | grep mysqlnd
|
stackexchange-stackoverflow
|
{
"answer_score": 52,
"question_score": 49,
"tags": "php, mysql, linux, yum, mysqlnd"
}
|
Playback of Reaper and other applications simultaeously
I am using Reaper on an HP laptop running Windows 7. The soundcard is integrated with the motherboard and I am using Asio4All to avoid latency issues.
On my old PC running Windows XP, I would often play jam tracks from my browser (Google Chrome), while jamming to the track with my guitar using effects through Reaper, all through my headphones.
On my current PC (described in first paragraph), I am experiencing an issue where if I try to do the same, audio from Reaper is played through the headphones, _but_ the sound from my browser gets "bumped" to my laptop's speakers.
Can anyone shed some light as to why this is happening and how it would be possible to rectify the situation?
|
This answer worked for me (windows 10). I haven't yet tested it on a heavy project, but it's enough to get other audio inputs like a browser to be audible.
> I believe that the asio4all driver can only play sound from one application at a time. ... However there is a simple answer if you just want to play youtube videos and play along with reaper at the same time. In reaper/preferences/audio/device change the audio system from asio to one of the other choices. Thats what i do, i dont need super low latency for just following along with tutorial videos.
Source: < from Rodal
|
stackexchange-sound
|
{
"answer_score": 1,
"question_score": 2,
"tags": "reaper"
}
|
DELETE using LEFT JOIN with LIMIT in MySQL
I'm trying to delete orphan posts in my database and I have created this query:
DELETE post.*
FROM foro_post AS post
LEFT JOIN foro_thread AS thread USING(threadid)
WHERE thread.threadid IS NULL
The problem is that I want to limit because my table has over 7,000,000 records.
As I can't use LIMIT with the query, I tried this and actually worked, but I'm not sure if is an efficient solution or if it could be done better.
DELETE post.*
FROM foro_post AS post
LEFT JOIN foro_thread AS thread USING(threadid)
WHERE thread.threadid IS NULL
AND post.postid < 500
// Where < 500 should be increasing as I delete records
How can I do this more efficiently?
|
You can't use `LIMIT` directly within DELETE when you're referencing multiple tables at the same time, but you can get around that by encasing what you want to delete within a subselect:
DELETE po
FROM foro_post po
JOIN (
SELECT p.postid
FROM foro_post p
LEFT JOIN foro_thread t ON p.threadid = t.threadid
WHERE t.threadid IS NULL
ORDER BY p.postid
LIMIT 50
) pp ON po.postid = pp.postid
|
stackexchange-stackoverflow
|
{
"answer_score": 27,
"question_score": 16,
"tags": "mysql, left join"
}
|
Problems uploading file via FTP
I am following the example exposed in the PHP manual <
$upload = ftp_put($conn_id, $destination_file, $source_file, FTP_BINARY);
What do you mean by $ destination_file and $ source_file?
I have little experience with this, thanks!
|
As it says in the documentation:
> remote_file: The remote file path.
>
> local_file: The local file path.
In other words, `$destination_file` is the location and filename of where you want to write to the FTP server. `$source_file` is the location and filename of the file you want to upload.
Also, I'd strongly recommend using something other than FTP whenever possible. FTP has numerous security vulnerabilities, the worst of which is the fact that your username/password are not encrypted. It also runs into challenges with NAT and some firewall software as its commands and data transfers use independent TCP connections. Use SCP or something else.
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": -1,
"tags": "php, file, ftp, upload"
}
|
ASP.NET Core and SignalR Documentation
Where Can I find full documentation for the SignalR? And how can I solve my problem? For example - I don't know how is work this method
`app.UseEndpoints(endpoint => endpoint.MapHub<ChatHub>("/chat"));`
How can I call this method like another way, not a lambda.
|
To avoid a lambda, simply write a function with the same content, and put the name of the function here.
In your case, to avoid lambda for:
app.UseEndpoints(endpoint => endpoint.MapHub<ChatHub>("/chat"));
Change it to
// Start up.cs begin
using Microsoft.AspNetCore.Builder;
// Put this somewhere in your StartUp class
public void OnEndpointConfigure(IEndpointRouteBuilder endpoint)
{
endpoint.MapHub<ChatHub>("/chat");
}
app.UseEndpoints(OnEndpointConfigure);
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": -2,
"tags": "asp.net, asp.net core, signalr"
}
|
iOS Keyboard Colour Changes - keyboardAppearance dark color doesn't stick
In our app, we set the keyboardAppearance to dark. This produces a black keyboard, as expected. However, if the keyboard is showing, and we press the home button, and then go back into the app, the keyboard turns white, as shown. Any ideas why?
!wrong colored dark keyboard
|
It may have todo with the fact that the keyboard is a global object. There's only ever one keyboard in memory at any given time. Also, the OS will automatically change the keyboard color based on the background. Therefore, your setting is probably just getting overridden. I would suggest hiding the keyboard when your app enters the background, and then re-show it when it re-enters the foreground. Then when you re-show the keyboard reset the keyboard appearance via code.
|
stackexchange-stackoverflow
|
{
"answer_score": 3,
"question_score": 8,
"tags": "ios, cocoa touch, uiview, keyboard, uikit"
}
|
Brand Links as a Subdomain
I have a link about Acana. Link is listing all Acana branded products. Here it is; <
I want to change it to acana.solempet.com for seo reasons.
How can i do this? I couldn't find any guides for it.
|
As far as we know you can't due to Magento redirecting to base url. We have this ourselves but it's part of a complete architecture so wouldn't work for you.
|
stackexchange-magento
|
{
"answer_score": 0,
"question_score": 0,
"tags": "url rewrite"
}
|
In-app purchase for physical goods - forbidden or not recommended?
Is selling of physical goods via Android in-app purchase forbidden or just not recommended?
I know that there is a problem with shipping, but one can easily make final price increased by shipping costs. What if there is not shipping cost?
Please share your experiences with me.
Thanks in advance
|
Here's a quote from In-App Billing Overview from developer.android.com:
> You can use in-app billing to sell only digital content. You cannot use in-app billing to sell physical goods, personal services, or anything that requires physical delivery.
|
stackexchange-stackoverflow
|
{
"answer_score": 6,
"question_score": 2,
"tags": "android, in app purchase, google checkout, in app billing"
}
|
Trigger alarm if pilot is already killed/unconscious
Can the guards of the enemy spaceship still trigger the alarm if the pilot is already dead or unconscious?
This matters especially for the "Silence Clause" missions, after those missions you get a bonus when no alarm was triggered.
|
No, that doesn't count as a silenced alarm.
I've tested this myself in game today; letting the enemy alert; and even toss me off the ship while the captain was dead. I still received the bonus.
Without the pilot, the alarms on ships no longer work.
Here are some images to show this: =\frac{1}{\pi}\sqrt{\frac{x}{3}}K_{1/3}\left(\frac{2}{3}x^{\frac{3}{2}}\right) $$
The question is: how can the Airy function retrieve a 0.3550 value when evaluated in $ x = 0 $, if
$$ K_{1/3}\left(\frac{2}{3}0^{\frac{3}{2}}\right) = \infty $$
It's probably a naive question but I would say that
$$ Ai(0) = 0*\infty = NaN$$
looking at the above equivalence.
I thank you in advance for supporting.
|
For fixed $\nu>0\;$ and from the reference DLMF you have the equivalence for $z$ near $0$ : $$\operatorname{K}_{\nu}(z)\sim \frac{\Gamma(\nu)}2\left(\frac z2\right)^{-\nu}$$ From this you may deduce that near $0$ the Airy function $\operatorname{Ai}(x)$ is equivalent to : \begin{align} \frac{1}{\pi}\sqrt{\frac{x}{3}}\operatorname{K}_{1/3}\left(\frac{2}{3}x^{\frac{3}{2}}\right)&\sim \frac{\Gamma(1/3)}{2\pi}\sqrt{\frac{x}{3}}\left(\frac{1}{3}x^{\frac{3}{2}}\right)^{-1/3}\\\ &\\\ &\sim \frac{\sqrt[3]{3}\ \Gamma(1/3)}{\sqrt{3}\;2\,\pi}\\\ &\\\ &\sim 0.355028053887817239260063186\cdots \end{align} Getting even a closed form for the limit.
|
stackexchange-math
|
{
"answer_score": 3,
"question_score": 3,
"tags": "special functions"
}
|
Proving that the set of all integers cannot be a vector space whatever the fields are
Let Z be the set of all integers. Prove that there doesn't exist a field F and a way to define a scalar multiplication on Z over F such that Z is a vector space over F (the vector addition is the usual addition)
|
Assume there is a field $F$ such that $\mathbb Z/F$ is a vector space.
Let $e$ be the field's multiplicative identity and $\theta$ its additive identity (i.e. its zero).
Denote the elements of $\mathbb Z$ by their integer representation.
Apply the standard vector space principles and integer addition.....
$e.1 = 1$
$1 + 1 = 2 = e.1 + e.1 = (e + e).1$
So, there is some element $\alpha = e + e \in F$ that satisfies $\alpha.1 = 2$, and $\alpha \ne \theta $ because $\theta.1 = 0 $
Then $\alpha $ has a field inverse $\beta = e/\alpha$
By closure then $\beta.1 \in \mathbb Z$ and is therefore an integer.
Also, $ 1 = e. 1 = \alpha.\beta. 1 = (e + e).\beta.1 = e.\beta.1 + e.\beta.1 = \beta.e.1 + \beta.e.1 = \beta.1 + \beta.1$
So, $\beta.1$ must be an integer, say $p$, which satisfies $p + p = 1$
This is a contradiction, so there is no such field.
|
stackexchange-math
|
{
"answer_score": 3,
"question_score": 2,
"tags": "linear algebra"
}
|
Bootstrap how to create right column on form group
I have a `bootstrap` form like the one below.
I want to make the `width` of that column to be 9 so in the left 3 I can add a button to the top-right of the `textarea`.
![enter image description here](
The form HTML is:
<div class="form-group">
<label>Compose Message</label>
<textarea class="form-control" rows="5" value="" />
</div>
![enter image description here](
I have tried using `<div class="col-md-9">` and `<div class="col-md-3">` but no success.
> Any clue?
|
This should do the trick:
<div class="row">
<div class="col-md-9">
<div class="form-group">
<label>Compose Message</label>
<textarea class="form-control" rows="5" value="" />
</div>
</div>
<div class="col-md-3">
<button class="btn">Button</button>
</div>
</div>
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "css, twitter bootstrap, twitter bootstrap 3"
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.