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 |
|---|---|---|---|---|---|
57,762,430 | I'm new at PL/SQL. I'm trying to program a `trigger` that `insert` in a `table` A just if there is an `insert` in `table` B (to have an insert in table B, the following `select` must returns 1).
```
SELECT 1
INTO v_exists
FROM TFRG V
WHERE
SUBSTR(:NEW.COD_OBJT, 1, 2) = V.CDP
AND SUBS... | 2019/09/02 | [
"https://Stackoverflow.com/questions/57762430",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2037602/"
] | ...Or you can use **any()** operator.
>
> The any operator without an argument returns true if the collection is not empty.
>
>
>
[docs](http://docs.oasis-open.org/odata/odata/v4.0/errata03/os/complete/part2-url-conventions/odata-v4.0-errata03-os-part2-url-conventions-complete.html#_Toc371341806)
OData/v4/2.0/Ca... | The below one was working for me, hope this helps.
<https://api-uk.securitycenter.windows.com/api/machines?$filter=not> machineTags/any()
Am filtering out the results where the machine tags are empty array. |
65,523,998 | I've been fighting with awk to make this work but I've been unable to do it. I have two lines as follows:
```
= filename: /path/to/file
years="1990,2001"
```
I need to check each year between the quotes against a given value and then print the previous line if it matches and get the filename as a result (it only nee... | 2020/12/31 | [
"https://Stackoverflow.com/questions/65523998",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12234893/"
] | I'm still learning AWK but IIUC you want something similar to the
following `script.awk`:
```
#!/usr/bin/awk -f
BEGIN {
FS = "= filename:"
}
{
if ( NF == 2 ) {
filename = $2
getline
}
}
/^years="1990,2001"$/ \
{
print "filename: " filename
}
```
Run with the following `input`:
```... | Assumptions:
* OP will always be searching for dates **less than** (`<`) a given target date (eg, `2000` in OP's example)
* a line starting with `^= filename:` is always followed by a line starting with `^years=` (otherwise we would need more sample input data before adding more logic)
Sample data:
```
$ cat file_ye... |
6,836 | What food stuffs pair well with **orange wine**?
This website has a little information on orange wines: [Crushing: Orange Wines](http://blog.cookingchanneltv.com/2010/10/19/orange-wine-in-time-for-halloween/).
But what I would like to know is what foods go well with these orange wine and why they are paired as such? | 2017/05/13 | [
"https://beer.stackexchange.com/questions/6836",
"https://beer.stackexchange.com",
"https://beer.stackexchange.com/users/5064/"
] | I tend to think of drinks with scary names. Specifically you could serve [Zombie Dust](https://www.3floyds.com/beer/zombie-dust/) from 3 Floyds Brewing which has the advantage of being a really [excellent beer](https://www.beeradvocate.com/beer/profile/26/64228/).
[
>
> “That’s right: red, pink and white have company,” exclaimed a recent newsletter from the Chelse... |
31,416,496 | I'm using Symfony 2.6 and I'm trying to use translations inside my \Twig\_Extension but translator always use and return the default\_locale translated text. (in my case "EN")
I created a service in services.yml:
```
utils.twig_extension:
class: Skaphandrus\AppBundle\Twig\UtilsExtension
public: false
argu... | 2015/07/14 | [
"https://Stackoverflow.com/questions/31416496",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3157658/"
] | I agree with the others stating to use jQuery or straight DOM calls.
Here is another shot at the jQuery solution - very similar to the one above. I went ahead and presented it because it targets the images directly - in case that's what you're really trying to accomplish.
```
$(function()
{ var mainDiv = $('div.pin... | You have a mix of jQuery and DOM methods calls. Note also that for attaching event listeners, you should wait for all HTML document to be ready.
I'd recommend using either DOM methods ot jquery methods. Following is an example of jquery:
```
$(function(){
$('.pink:first').on("click", function(e) {
alert(... |
19,982,085 | This is my first post in this forum. I am facing a problem in splitting the below string.
String in a File with leading space, multiple spaces in between and pipe symbol:
```
$str= | U-mom | 9.2 | 2.30E-04 | 9.60E-04 | 1.04E-04 OK |;
```
I could not place multiple spaces in my string shown above, but there... | 2013/11/14 | [
"https://Stackoverflow.com/questions/19982085",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2992395/"
] | Remember that `split`'s first parameter is a regular expression and not a string. (Or, it should be a regular expression). You can do something like this:
```
my @values = split /\s+\|\s+/, "$string";
```
Note that this will make `$values[0]` a null string since there's a `|` with blank spaces at the beginning of yo... | The split function accepts a regular expression. If you know that there are going to be leading and trailing spaces, just build that into your regular expression to split on.
```
my $str = "| U-mom | 9.2 | 2.30E-04 | 9.60E-04 | 1.04E-04 OK |";
print "$_\n" for split(/\s*\|\s*/, $str);
# output:
# U-mom
# 9.2
# 2.30E... |
453,418 | How can I do this on the command line?
e.g. copy `/dir/another/file` to `/tmp/` so I have `/tmp/dir/another/file` | 2012/07/25 | [
"https://superuser.com/questions/453418",
"https://superuser.com",
"https://superuser.com/users/139884/"
] | [rsync](http://linux.die.net/man/1/rsync) can be a good help for this :
```
rsync -Ravz my/first/dir/file.txt another_dir
```
will gave as result
```
another_dir/my/first/dir/file.txt
``` | You can use `tar` to preserve paths while copying files:
```
tar cf - /dir/another/file | (cd /tmp && tar xf -)
``` |
11,243,714 | I'm porting our existing web application from Wicket 1.4 to 1.5. In the app there are two template pages which are children of a base page. The templates are named secure and unsecure, and they define pages for authenticated and unauthenticated users. Any pages in the app inherit from these templates. In Wicket 1.4 thi... | 2012/06/28 | [
"https://Stackoverflow.com/questions/11243714",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1444622/"
] | Make sure that if you are overriding `viewWillAppear` that you call
```
[super viewWillAppear:animated];
```
If you don't, the Scroll View will not scroll up properly.
**Swift**
```
super.viewWillAppear(animated)
``` | >
> If the auto scroll of UITableViewController doesn't work with the
> UITextFields in cells or scroll weirdly, do these steps. **Swift 5 iOS
> 13.2 tested 100%**
>
>
>
First implement **viewWillAppear** but don't call **super.viewWillAppear** (this will **stop** auto scroll)
```
override func viewWillAppear(_... |
40,082 | How is it possible to check in JS/jQuery if the user is on the root site of the root sitecollection in the webapplication? (Sharepoint 2010)
Thanks!
**Example:**
* <http://www.mysite.com/Pages/Whatever.aspx> -> ROOT WEB & ROOT SITECOLLECTION
* <http://www.mysite.com/subsite/Pages/Test.aspx> -> **NOT** ROOT WEB & ROO... | 2012/07/03 | [
"https://sharepoint.stackexchange.com/questions/40082",
"https://sharepoint.stackexchange.com",
"https://sharepoint.stackexchange.com/users/3692/"
] | You can use ECMAScript to achieve it.
```
var clientContext = new SP.ClientContext();
var rootWeb = clientContext.get_site().get_rootWeb(); //always return the root web of the site collection
```
See some examples [here](http://antoniolanaro.blogspot.se/2011/05/ecmascript-how-to-get-lists.html). | I've solved this by adding a usercontrol to the masterpage where I check the current url. If it passes as rootweb from sitecollection, then I use the scriptmanager to write a clientscriptblock into the page. I guess using a webservice was also a possibility, but the fastest way for me was this one... |
59,389,208 | I am building an angular app. I am navigating from first component to second through click event. While navigating to the second component I am wiling to pass some data from first component to the second component. I have followed a tutorial to achieve this but couldn't do it. Below is my code
First component.ts
```
... | 2019/12/18 | [
"https://Stackoverflow.com/questions/59389208",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8957025/"
] | You can use a shared service to pass data between components. When you have data that changes over time, RxJS BehaviorSubject will be very useful in this case.That it will ensures that the component always receives the most recent data.
To do so,
you need first to create a service in which you will add a private Beha... | [in this demo, I am passing a value from app.component.ts to view component.component.ts using test.service](https://stackblitz.com/edit/angular-641dln?file=src%2Fapp%2Fapp.component.ts)
Here, in the constructor of app.component.ts giving a value to a variable which is in test.service, then assigning that value to a v... |
22,871,206 | I am a huge fan of open source contributions square has done to the Android community and was looking into their latest contribution Otto (event bus )
<http://square.github.io/otto/>
Digging deeper I see that Otto uses reflection and there is no ordered broadcast ( a pattern where a unconsumed message is handed down... | 2014/04/04 | [
"https://Stackoverflow.com/questions/22871206",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1172805/"
] | >
>
> >
> > Both Otto and LBM are within the same process space so in terms of speed i guess both would be same .
> >
> >
> >
>
>
>
I've found that registering Otto events are quite expensive, sometimes it takes more than 16 milliseconds to register event subscribers (That means you drop 1 FPS!). That's somew... | 1. otto makes code cleaner, smaller
2. otto makes testing easier |
8,741,142 | I want to send a large amount of cached json data from an import process to an MVC controller which will in turn respond with a text file in CSV format.
The problem is if I use an AJAX call, there is no way for the browser to handle the response and download the file.
If I use a regular form post, then the browser wo... | 2012/01/05 | [
"https://Stackoverflow.com/questions/8741142",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/306098/"
] | Just my two cents. If you don't want to create a file, just cache data in session (or wherever you like).
So:
1. perform ajax post of json data
2. in the Controller Action store the data somewhere (e.g. Session) and create a key to access it later (a guid) and return it as a json object.
3. in the success ajax functi... | Actually, I think the best solution is the following:
1. Do an AJAX POST which fetches the CSV from the server
2. Use the `data:` URI scheme to view the CSV:
Either directly
```
location.href = "data:text/csv;charset=utf-8,Value 1, Value 2, Value 3";
```
or prepare a link when the AJAX finishes, something like thi... |
59,931,770 | I have a pyspark dataframe:
```
id | column
------------------------------
1 | [0.2, 2, 3, 4, 3, 0.5]
------------------------------
2 | [7, 0.3, 0.3, 8, 2,]
------------------------------
```
I would like to create a 3 columns:
* `Column 1`: contain the sum of the elements < 2
* `Column 2`: contain the... | 2020/01/27 | [
"https://Stackoverflow.com/questions/59931770",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11709732/"
] | For Spark 2.4+, you can use [`aggregate`](https://docs.databricks.com/_static/notebooks/apache-spark-2.4-functions.html) and [`filter`](https://docs.databricks.com/_static/notebooks/apache-spark-2.4-functions.html) higher-order functions like this:
```
df.withColumn("column<2", expr("aggregate(filter(column, x -> x < ... | Here's a way you can try:
```
import pyspark.sql.functions as F
# using map filter the list and count based on condition
s = (df
.select('column')
.rdd
.map(lambda x: [[i for i in x.column if i < 2],
[i for i in x.column if i > 2],
[i for i in x.column if i =... |
7,777 | I need to install modules so that the database changes happen. I can't just let it be an install on logging to admin type of approach as I have a bash script that I am using to provision my test servers. It seems that as I clone modules from my git repo some of them are not installed so I need to forcefully install the... | 2013/09/10 | [
"https://magento.stackexchange.com/questions/7777",
"https://magento.stackexchange.com",
"https://magento.stackexchange.com/users/2242/"
] | Answer
======
It turns out that just clearing the cache and doing a wget, or login a user in programmatically, or even both was not enough to trigger the code to install a module.
This is what works.
```
rm -rf var/cache/*
php "/srv/www/mage/index.php"
```
Where `/mage` is the store root folder, I just needed to e... | Not sure if I got your question right but if you want to trigger setup script w/o opening the website in your browser why not just create the shell script which will just `wget` the home page of your Magento installation? |
5,300,070 | For a "dashboard" module I need to dynamically load user controls based on criteria as the user enters the page (role, etc). The problem is that the events are not being fired at all from the controls
As I understand it I need to load the controls in the OnPreInit method of the dashboard page, however I cannot get a ... | 2011/03/14 | [
"https://Stackoverflow.com/questions/5300070",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40667/"
] | Use String.Equals() specifying case insensitivity. | Something like this?
```
var res = (from p in list where
(p.FirstName ?? "").ToUpper() == (firstName ?? "").ToUpper() ||
(p.LastName ?? "").ToUpper() == (lastName ?? "").ToUpper() select p)
.ToList<Client>();
```
It really depends on what you want to do when either is `null`. This should treat `null` a... |
10,651,161 | I have a class that uses a nested class, and want to use the nested class `operator<<` to define `operator<<` in the upper class. Here is how my code looks like:
```
#include <memory>
#include <iostream>
template<typename T>
struct classA {
struct classB
{
template<typename U>
friend inline std::ostream& ... | 2012/05/18 | [
"https://Stackoverflow.com/questions/10651161",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/760721/"
] | Bo provided the *reason* why this is happening (the type `T` is not deducible in the call to the nested `operator<<`. A simple workaround for this, and something that I recommend in general, not only here, is not befriending a template, but rather a single free function. For that you will need to *define* the function ... | Try this:
```
template<typename T>
inline std::ostream& operator<< (std::ostream &out,
const classA<T> &tree)
{
//out << tree.root;
::operator<<( out, tree.root);
return out;
}
```
and then you will get a straightforward confession of ineptitude:
```
test.cpp:34:3: error: no ma... |
44,275,882 | I am getting the response from ajax as json:
```
{"checkin_date":["2017-05-11","2017-05-18","2017-05-23","2017-05-25"]}
```
I need to separate these values in javascript like 2017-05-11, 2017-05-18, etc.
I tried split function in javascript but it failed. How do I achieve it?
I need the dates separately in a loop. | 2017/05/31 | [
"https://Stackoverflow.com/questions/44275882",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5576232/"
] | You just use method parse of JSON. After that, you receive array value for property "checkin\_date". Just use it as normal array. See code below:
```js
var json = '{"checkin_date":["2017-05-11","2017-05-18","2017-05-23","2017-05-25"]}';
var result = JSON.parse(json);
var checkin_date = result['checkin_date'];
for(... | If you need to loop through each value as a date, you first need to convert the values. Take a look:
```js
var dates = {"checkin_date":["2017-05-11","2017-05-18","2017-05-23","2017-05-25"]};
dates
.checkin_date
.map(date => new Date(date)) // here you convert the string dates to values of type Date
.forEach... |
315,637 | In ARCGis its possible to Clip your Data Frame so you just see the Data within the defined area. Like shown here:
<https://www.cdc.gov/dhdsp/maps/pdfs/GIS-Tips-Data-Frame-Clip-Function.pdf>
With this functions the loading of large WMS Basemaps Speeds up.
Is this possible in QGIS Map View? | 2019/03/15 | [
"https://gis.stackexchange.com/questions/315637",
"https://gis.stackexchange.com",
"https://gis.stackexchange.com/users/138792/"
] | In QGIS, you have powerful styling possibility called inverted polygons. Just take the clip polygon you need. Style it the way you want the outside. Then change the style to invert polygon. Screenshot is in french, please tell me if you need the same in english. Below I used a 80% opacity white inverted polygon.
The o... | Perhaps **GDAL** helps here.
You can create a basemap using the GDAL WMS driver and clip it with *gdalwarp* to a virtual format file (**VRT**).
To increase loading performance, enable local caching inside the WMS description XML (<https://gdal.org/drivers/raster/wms.html>).
In the following example (basemap of Vienna... |
50,540,742 | I have an `OnLongClickListener` attached to a view within my list item view (not on the `ListView` itself). Even though I return true in the `onLongClick` callback, `onItemClick` on the `ListView` is also called once the finger leaves the screen. Normally this doesn't happen but the long press triggers a `notifyDataSet... | 2018/05/26 | [
"https://Stackoverflow.com/questions/50540742",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/210130/"
] | I got the same issue while using docker toolbox. Using one more '/' before your source path as well as before your target path will resolve this problem. In your case it will look like this:
```
docker run -ti -h python -v /${pwd}://root/docker -p 9999:9999 ubuntu:latest /bin/bash
```
if this doesn't work then try u... | I suggest you to use absolute path in windows, Something like:
```
docker run -ti -h python -v /c/path_to_application:/root/docker -p 9999:9999 ubuntu:latest /bin/bash
```
Add `/c/then_remaining_part_to_your_app`, note that `/c/` is the drive. |
152,070 | After installing CentOS 6.5 I removed Gnome Desktop Environment by running
```
yum groupremove Desktop
```
Now everything works fine, but whenever the computer starts there is no log-in prompt. The screen just shows CentOS progress bar. I have to press `Alt`+`Ctrl`+`F6` in order to switch to terminal and see the lo... | 2014/08/25 | [
"https://unix.stackexchange.com/questions/152070",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/60154/"
] | Found the clean answer. Background - when installing the GUI by doing the
groupintstall remember that you had to set id:3:initdefault to id:5:initdefault in /etc/inittab before typing init 6 for root to boot the GUI.
So just reset /etc/iniittab back to id:3:initedefault BEFORE! for doing
groupremove.
What appears to ... | Although not a good solution, but adding `chvt 2` (or any other valid virtual terminal number instead of 2) to `/etc/rc.local`
seems to work as a temporary solution for me. This makes OS to switch to tty2 automatically.
I'm still looking for a better solution (showing a log-in shell on tty1 instead of CentOS progre... |
9,137,706 | I have a BizTalk orchestration with an expression. The expression has the following:
```
construct msg_mymessage { msg_mymessage = msgInputXML; }
```
msgInputXML and msg\_mymessage use the same schema, same message type and both show up under the Messages in Orchestration view.
After the expression I have a Constr... | 2012/02/04 | [
"https://Stackoverflow.com/questions/9137706",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32892/"
] | Make sure that you use an assignment shape (inside a construct message wrapper) when you create msg\_mymessage. Then just copy the code in the expression shape (msg\_mymessage = msgInputXML;)
<http://msdn.microsoft.com/en-us/library/ee253499(v=bts.10).aspx> | In your constructed messages shape, you need to define the message type you are going to create. when you drop the shape, the drop down dialog will ask you what type of message you are constructing. You can select more than one. so if you happen to have a message checked that isnt being constructed in this shape, you w... |
26,240,304 | I am experiencing a weird issue on an iOS app that I have never seen before.
Push notifications are coming through when the user is in the application. I have logic that draws a custom view when the proper method is triggered in the AppDelegate upon receiving the push notification.
However, if the user backs out of t... | 2014/10/07 | [
"https://Stackoverflow.com/questions/26240304",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2913347/"
] | Apple change the way push notifications request permissions in iOS 8.
Seems like you are partially there as you receive the push when your app is open but this bit is extracted from the iOS SDK documentation.
If you want your app’s push notifications to display alerts, play sounds, or perform other user-facing action... | This is a sample of push notification. If the field alert is empty, the push notification will not display a banner. When you're inside the app it will trigger the "didReceivePushNotification". Maybe the problem is alert field is empty. Im using this tool that simulates push. <https://github.com/noodlewerk/NWPusher>
`... |
74,860 | I recently upgraded from an iPhone 4s to iPhone 5. **How do I transfer all my apps to the new iPhone 5?** I have tried two times without success:
*First attempt:*
1. From iTunes, make "a full backup" of the 4s on "this computer."
2. From iTunes, restore the backup to the iPhone 5
This transferred all my contacts, ca... | 2012/12/14 | [
"https://apple.stackexchange.com/questions/74860",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/14309/"
] | I had the same issue (I use iTunes on Windows 7). I Bought a new iPhone 5 and used the Backup / Restore method to move my stuff from the old iPhone 4S to the new one. The process only restored all the Apple apps, plus Contacts, Phone Calls, and Messages. When I tried to backup again - hoping it would restore the rest -... | Apps purchased are not contained in the backup, therefore they will not restore. They can be found in your iTunes, under apps purchased and can be downloaded again to your device. Appdata however is found in the backup - it can be extracted with software such as iPhone Backup Extractor, and then imported back to the de... |
12,825,826 | I have a piece of code that hides an element on mouseout.
The code looks like this:
```
var myMouseOutFunction = function (event) {
setTimeout(function () {
$(".classToHide").hide();
$(".classToShow").show();
}, 200);
};
```
This produces a result very close to what I want to do. However, I wan... | 2012/10/10 | [
"https://Stackoverflow.com/questions/12825826",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1434239/"
] | Assign the timeout's return value to a variable, then use `clearTimeout` in the onmouseover event. | You should use `mouseenter` and `mouseleave` of jquery. mouseenter and mouseleave will get called only once.and use a flag if to check if `mouseenter` again called.
```
var isMouseEnter ;
var mouseLeaveFunction = function (event) {
isMouseEnter = false;
setTimeout(function () {
if(isM... |
6,485,705 | Tried the following example compiled with `g++ -std=gnu++0x t1.cpp` and `g++ -std=c++0x t1.cpp` but both of these result in the example aborting.
```
$ ./a.out
terminate called after throwing an instance of 'std::system_error'
what():
Aborted
```
Here is the sample:
```
#include <thread>
#include <iostream>
v... | 2011/06/26 | [
"https://Stackoverflow.com/questions/6485705",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13022/"
] | You have to `join` `std::thread`s, just like you have to join `pthreads`.
```
int main( int argc, char *argv[] )
{
std::thread t( doSomeWork );
t.join();
return 0;
}
```
**UPDATE:** [This Debian bug report](http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=576485) pointed me to the solution: add `-pthread... | For what it's worth, I had **different issue** with **similar code** using [threads](https://stackoverflow.com/questions/32580527/issue-with-stdthread-when-using-g-in-32-bit-mingw-4-8-0) in g++ (MinGW). Work-around was to put some "delay" between creating a thread and joining it.
Code with infrequently failing asserti... |
33,716,978 | I am trying to toggle between a couple of texts, where the only one that shows is the one that was "turn on" most recently. For example, the default would look something like this:
Click A
Click B
If you click 'Click B', the text for that will toggle to something else, let's say "You've clicked B".
Click A
You've Cl... | 2015/11/15 | [
"https://Stackoverflow.com/questions/33716978",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5447028/"
] | It's because you're calling `itertor.next()` twice inside your loop for every `iterator.hasNext()`.
You should do:
```
while(iterator.hasNext()) {
TrueFalseQuestion trueFalseQuestion = iterator.next();
System.out.println(trueFalseQuestion);
System.out.println(trueFalseQuestion.getPoints());
}
```
What happens... | array value in your program can not found your array so it display null pointer exception
notice that your array index start with 0 |
35,752,870 | I have a problem adding scrollbar to my JPanel. This is my code but it isn't working! I need help!
---
```
public class DocumentView extends JPanel implements EventListener,MouseListener{
public String name;
private Document document;
private Dimension dim;
public DocumentView dv;
JScrollPane sc... | 2016/03/02 | [
"https://Stackoverflow.com/questions/35752870",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6008928/"
] | When adding a scrollbar, you need a panel and a scrollpane:
```
scrollPanel = new JPanel();
scrollPane = new JScrollPane(scrollPanel);
```
From now on, components added to the scollPanel will create a scrollbar(vertically and/or horizontally). The scrollbar will automatically adjust its height when new components ar... | Welcome to StackOverflow!
I'd like to give you some hints, so that you could solve your problem by yourself.
* The value of *dv* is empty when you it gets passed to the constructor of JScrollPane
* Take a look at the control hierarchy. You are creating a class for your DocumentView that will contain a JScrollPane tha... |
56,871,202 | I need to export from Excel as CSV using VBScript. The database I'm importing the CSV into wants the data to be in quotes.
```
' Set output type constant
Const xlCSV = 23
Const xlYes = 1
Const xlAscending = 1
Const xlDescending = 2
' Open Excel in background
Set objExcel = CreateObject("Excel.Application")
objExcel.D... | 2019/07/03 | [
"https://Stackoverflow.com/questions/56871202",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11504559/"
] | `kubectl` expects exactly one namespace:
```
➜ / kubectl create ns
error: exactly one NAME is required, got 0
```
depending on your shell you could pack it into a loop. here's an example for bash and zsh:
```
➜ / foreach ns (ns1 ns2 ns3); kubectl create ns $ns; end
``` | You could chain together 2 kubectl commands like so:
```
kubectl create ns app1 && kubectl create ns app2...
``` |
16,023,657 | I would like migrate this code with ARC.
I know I have to use :
```
@autoreleasepool {}
```
But I have a problem with the two pool drain, I don't know how to do.
```
- (void)downloadImageToCache:(NSString*)_urlImage
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
if (!(_urlImage) || (_urlIma... | 2013/04/15 | [
"https://Stackoverflow.com/questions/16023657",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2123039/"
] | You can just "early-return" from the autorelease pool, that will release
all objects from the pool:
```
- (void)downloadImageToCache:(NSString*)_urlImage
{
@autoreleasepool {
if (!(_urlImage) || (_urlImage == nil))
{
// no need (not allowed) to call `drain`
return;
}... | With the new @autorelease block syntax, the pool will be drained when execution exits the block. So you can just do this:
```
- (void)downloadImageToCache:(NSString*)_urlImage
{
@autoreleasepool {
if (!(_urlImage) || (_urlImage == nil))
{
return; //leaves @autoreleasepool block, autom... |
64,880,675 | I see a lot of exercises that put onComplete but with my code this is the error
The getter 'onComplete' isn't defined for the type 'UploadTask'.
Try importing the library that defines 'onComplete', correcting the name to the name of an existing getter, or defining a getter or field named 'onComplete'
WHY ??
```
void... | 2020/11/17 | [
"https://Stackoverflow.com/questions/64880675",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13181371/"
] | Thank you very much it works. This is the final code
```
print(sampleImage);
UploadTask uploadTask =
postImageRef.child(timeKey.toString() + ".jpg").putFile(sampleImage);
print('aaa');
print(uploadTask);
var imageUrl = await (await uploadTask).ref.getDownloadURL();
url = imageUrl.toString();
print(... | Use the TaskSnapshot class instead. You don't need onComplete.
Example:
```
TaskSnapshot taskSnapshot = await uploadTask;
``` |
9,739,223 | How to find the below pattern is there or not in a given string using Regex or any other methods in C#
```
NAME <some text here> RANK
```
The spaces coming after NAME,before RANK and after RANK should be considered. The text between <> will vary. | 2012/03/16 | [
"https://Stackoverflow.com/questions/9739223",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1127849/"
] | Use:
```
var result = Regex.IsMatch(input, @"NAME\s.*?\sRANK\s{3}");
``` | From the requirements, these might work (I'm still not sure about some of the boundry conditions in your description).
`NAME(?=[ ]).+?(?<=[ ])RANK(?=[ ])`
or
`(?<=^|[ ])NAME(?=[ ]).+?(?<=[ ])RANK(?=[ ]|$)`
The dot doesen't include newlines. It can be replaced with [\s\S] or you can simply add (?s) at the begining... |
44,624,495 | I have one simple json
```
{
"subjectObj": [{
"id": "1",
"option": "java"
}, {
"id": "2",
"option": "c++"
},{
"id": "3",
"option": "c"
}]
}
```
I just want to display this json as `ul`.I did this using jquery but I want to do it java script.
```
function OnSuccess(data) {
$.each(data, function() ... | 2017/06/19 | [
"https://Stackoverflow.com/questions/44624495",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7378551/"
] | The DOM way ("pure javascript way") for this would be (assuming ES5!):
```js
function OnSuccess(data) { // assuming data is the array from subjectObj, otherwhise use data data.subjectObj for the loop
var ulCategory = document.getElementById('ulCategory');
for (var i = 0; i < data.length; i++) { // rep... | change your function as below, You need to loop through the array that is `data.subjectObj`
```
function OnSuccess(data) {
$.each(data.subjectObj, function(index) {
debugger;
$("#ulCategory").append("<li>" + this.option + "</li>");
});
}
``` |
6,931,951 | Is there some function, similar to `srand()`, that I need to call to make sure that `std::random_shuffle()` always produces different results? i.e. if I call it several times with the same data, I want the order to be different every time. How can I make sure of that? | 2011/08/03 | [
"https://Stackoverflow.com/questions/6931951",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/561309/"
] | random\_shuffle is deprecated since C++14 (removed in C++17) and replaced with shuffle (exists since C++11)
<http://en.cppreference.com/w/cpp/algorithm/random_shuffle>
possible usage:
```
shuffle(items.begin(), items.end(), std::default_random_engine(std::random_device()()));
``` | Generally call `srand(time(NULL))` **before** calling `std::random_shuffle()` would give you what you need, it give you different result each time you call `std::random_shuffle()`. It's because `std::random_shuffle()` internally calls `rand()` in many popular implementations (e.g. VS-2008 and GCC).
Of course you can s... |
2,686,032 | Please help I am in major trouble with our production database. I had accidentally inserted a key with a very large value into an autoincrement column, and now I can't seem to change this value without a huge rebuild time.
```
ALTER TABLE tracks_copy AUTO_INCREMENT = 661482981
```
Is super-slow.
How can I fix this ... | 2010/04/21 | [
"https://Stackoverflow.com/questions/2686032",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/120237/"
] | After struggling with this for hours, I was finally able to resolve it. The auto\_increment info for myISAM is stored in TableName.MYI, see state->auto\_increment in <http://forge.mysql.com/wiki/MySQL_Internals_MyISAM>. So fixing that file was the right way to go.
However, myisamchk definitely has an overflow bug som... | Have you dropped the record with the very large key? I don't think you can change the auto\_increment to a lower value if that record still exists.
From the [docs on myisamchk](http://dev.mysql.com/doc/refman/5.1/en/myisamchk-other-options.html):
>
> Force AUTO\_INCREMENT numbering for new records to start at the gi... |
22,934,823 | An `Intent` is a passive data structure that carries information from one `Activity` to another. An `Intent` is also capable of holding data in the form of name-value pairs (via `putExtra()`).
But while overriding the `onCreate()` method we pass a `Bundle` as the parameter, which ultimately also holds values in the for... | 2014/04/08 | [
"https://Stackoverflow.com/questions/22934823",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/605123/"
] | From the source of **Intent** class, there really is no difference between the two. Check below code from Intent class:
```
public Intent putExtra(String name, String value) {
if (mExtras == null) {
mExtras = new Bundle();
}
mExtras.putString(name, value);
return this;
}
... | I think you already have understood what a `Bundle` is: a collection of key-value pairs.
However, an Intent is much more. It contains information about an operation that should be performed. This new operation is defined by the action it can be used for, and the data it should show/edit/add. The system uses this infor... |
44,581 | I heard a lot about what food goes well with some sauce or drink. Why does someone say that? Based on what? Do they only try those foods together or is there any sort of property on the food that indicates what it goes well with? | 2014/06/01 | [
"https://cooking.stackexchange.com/questions/44581",
"https://cooking.stackexchange.com",
"https://cooking.stackexchange.com/users/22942/"
] | They say this because it is statistically very likely that, when a person with the same cultural background as the sayer eats the combination, that person will like what they eat.
This is *not* a restatement of your question: "A goes well with B" suggests that there is some quality in A and in B which determines how ... | There are a lot of books/articles out there now that outline flavour pairings based on chemical components. While I agree with the original answer (great detail, carefully considered) I think food science (especially chemistry) deserves a bigger profile. Think of it like the periodic table of elements. There are only s... |
220,611 | For the console version of *Witcher 3*, is it possible to sort Inventory items like it is on the PC version? And if so, how do I do it?
As far as I know, at least, you can sort the Inventory as I recall seeing a "Sort" button at the bottom-left corner. | 2015/05/24 | [
"https://gaming.stackexchange.com/questions/220611",
"https://gaming.stackexchange.com",
"https://gaming.stackexchange.com/users/14598/"
] | On PS4, press L3 (clicking the left joy stick) then you'll get sorting options. It's a bit odd because it only sorts once you close. I usually hit L3 then close which defaults "sorting by type". You must of course be in the inventory view for this option.
I'm sure there is an equivalent for Xbox. Not sure what console... | On the PS4 version of *Witcher 3: Wild Hunt*, you must open the inventory and press R3, which is pressing down on the right joystick. I'm not sure how to do it on the XBox version. |
1,764,970 | Can linq somehow be used to find the index of a value in an array?
For instance, this loop locates the key index within an array.
```
for (int i = 0; i < words.Length; i++)
{
if (words[i].IsKey)
{
keyIndex = i;
}
}
``` | 2009/11/19 | [
"https://Stackoverflow.com/questions/1764970",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/193315/"
] | For arrays you can use:
[`Array.FindIndex<T>`](http://msdn.microsoft.com/en-us/library/03y7c6xy.aspx):
```
int keyIndex = Array.FindIndex(words, w => w.IsKey);
```
---
For lists you can use [`List<T>.FindIndex`](http://msdn.microsoft.com/en-us/library/0k601hd9.aspx):
```
int keyIndex = words.FindIndex(w => w.IsKey... | This solution helped me more, from [msdn microsoft](https://social.msdn.microsoft.com/Forums/vstudio/en-US/3d02c96a-b3db-4e67-9b54-c08dbb5cc988/row-number-in-linq-query?forum=csharpgeneral):
```
var result = query.AsEnumerable().Select((x, index) =>
new { index,x.Id,x.FirstName});
```
`query` is your ... |
27,641,524 | I am trying to create a function which will dynamically set the value of whatever global variable is passed as a parameter. It's not working, and I'm trying to figure out why. Can someone please explain why this doesn't work:
```
var things = 5;
function setup(variable) {
variable = 7;
}
setup(things);
console.... | 2014/12/24 | [
"https://Stackoverflow.com/questions/27641524",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2864935/"
] | Javascript is pass-by-value. (Objects, arrays, and other non-primitives are passed by value-of-reference.) That means that the value of the variable (or reference) is passed to the function, but the function parameter does not become an alias for the actual argument. Thus, you cannot change a variable outside a functio... | When variables are passed as arguments to functions, a copy of their value is made and assigned to the name of the argument in the function.
For example:
```
function foo(a) {
a = 7; // sets the temporary variable(argument) a to 7
}
var bar = 24;
foo(bar); // copies bar's value and passes in the copy to foo
``... |
315,778 | I just started using CCNet, and in the process of getting my build projects set up I racked up a lot of build history from trial and error. I really don't want to keep that old stuff around, but I can't seem to see where/how to get rid of it. I'm sure this is a silly question, and I apologize if I'm overlooking somethi... | 2008/11/24 | [
"https://Stackoverflow.com/questions/315778",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4296/"
] | Don't forget you can use [Artifact Cleanup Publisher](http://www.cruisecontrolnet.org/projects/ccnet/wiki/Artifact_Cleanup_Publisher) to keep your build history from growing to the size of Mars over time. | The logs are stored in the artifacts directories under artifacts\MyProjectName\Build\log\*.xml.
The State file stores things like the last build date, time, info.
Best to stop the service, and then delete the *.state in ProgFiles\CC.net\server and also delete the artifacts\MyProjectName\Build\log*.xml files. |
811,548 | I'm using sqlite3 in python 2.5. I've created a table that looks like this:
```
create table votes (
bill text,
senator_id text,
vote text)
```
I'm accessing it with something like this:
```
v_cur.execute("select * from votes")
row = v_cur.fetchone()
bill = row[0]
senator_id = row[1]
vote = row... | 2009/05/01 | [
"https://Stackoverflow.com/questions/811548",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I know you're not asking this, but why not just use sqlalchemy to build an orm for the database? then you can do things like,
```
entry = model.Session.query(model.Votes).first()
print entry.bill, entry.senator_id, entry.vote
```
as an added bonus your code will be easily portable to an alternative database, and co... | I use something like this:
```
class SqliteRow(object):
def __init__(self):
self.fields = []
def add_field(self, name, value):
self.fields.append(name)
setattr(self, name, value)
def to_tuple(self):
return tuple([getattr(self, x) for x in self.fields])
```
with this:
``... |
41,513,597 | I found that static files served from a Rails application running in `/home/pupeno/projectx` take more or less half as much time than the ones served from `/mnt/c/Users/pupeno/projectx`. It's almost acceptable. I tried webrick and puma (as well as passenger and unicorn, which don't work yet).
So, if I'm going to host ... | 2017/01/06 | [
"https://Stackoverflow.com/questions/41513597",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6068/"
] | With Windows 10 [version 1903 and later](https://devblogs.microsoft.com/commandline/whats-new-for-wsl-in-windows-10-version-1903/), WSL filesystems are available in Windows via the `\\wsl$` mount. Either browse there manually or launch `explorer.exe` from a WSL path:
```sh
$ cd /home/me
$ explorer.exe .
```
If you h... | fire the CLI command **explorer.exe \\wsl$** in Windows powershell/cmd |
41,905,253 | I am implementing a feature on the collectionView where user scrolls the collectionView at the bottom (20 items) and it requests another set of data (20 more items) from the server.
I have implemented the following two approaches. But I wonder which approach is better? or is there any other better approach which I am... | 2017/01/28 | [
"https://Stackoverflow.com/questions/41905253",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1669996/"
] | I do this thing through CollectionViewDelegate method like:
```
- (void)collectionView:(UICollectionView *)collectionView
willDisplayCell:(UICollectionViewCell *)cell
forItemAtIndexPath:(NSIndexPath *)indexPath{
if indexPath.row == numberOfitem.count-1 && !self.waiting {
waitin... | **Swift 3 :** CollectionView Delegate method
```
func collectionView(_ collectionView: UICollectionView, willDisplay cell: UICollectionViewCell, forItemAt indexPath: IndexPath) {
if indexPath.row == numberofitem.count - 1 { //numberofitem count
updateNextSet()
}
}
func updateNextSet(){
... |
7,143,805 | I user the innerHTML for the code:
```
<div>
<span id="tag"></span>
</div>
var i = 15;
function timer(){
var div = document.getElementById("tag");
i--;
setInterval(function(){
div.innerHTML = i;// use innerHTML
//div.removeChild(div.childNodes[0]);
//div.appendChild(document.createTextNo... | 2011/08/22 | [
"https://Stackoverflow.com/questions/7143805",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/767177/"
] | It gets executed even if you return inside the try block. I put one return statement inside try as well as one inside finally and the value returned was from finally, not from try.
```
public class HelloWorld{
public static void main(String args[]){
System.out.println(printSomething());
}
public static... | When ever a method tries to return to the caller, via an uncaught exception or an explicit return statement, the finally clause is also executed just before the method returns. |
4,113,469 | I am going to import some data, and I have the data available in either a JSON feed or a XML feed. I can't decide if I should use the XML or the JSON feed.
What are the pros and cons of choosing either feed, and what is your prefered choice? | 2010/11/06 | [
"https://Stackoverflow.com/questions/4113469",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/79465/"
] | XML mean more bytes on the wire: closing tags, by definition, mean XML will be larger than JSON for the same data.
XML tags are human readable meta-data for the data you send. If humans aren't reading it, what does it matter?
XML has XSD schemas for validation.
XML parsers are standard and ubiquitous.
I see both. J... | If you are importing/exporting data, and it needs to be in a reliable format, then I would suggest XML. Yes it is very bloaty, compared to JSON, but you do have the power of XSD Schemas, to make sure the data is in the correct format before you waste time importing it.
However, if you don't have XSD schemas, go with J... |
2,665,846 | Snippets:
```
private double memberVal;
public double MemberVal
{
get { return memberVal; }
set { memberVal= value; }
}
```
and
```
public double MemberVal
{
get; set;
}
``` | 2010/04/19 | [
"https://Stackoverflow.com/questions/2665846",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/205595/"
] | Almost. In the second example, `MemberVal` is not publicly accessible. | ```
private double memberVal;
public double MemberVal
{
get { return memberVal; }
set { memberVal= value; }
}
public double MemberVal
{
get; set;
}
```
second of the code-snippets is not supposed work on .net 2.0, coz it was introduced in .net 3.0.
The second is the short-hand notation for the first on... |
28,049,177 | I am not able to create vector mbtiles files for my city region (Nashik, Maharashtra, India), I am using nutiteq SDK for displaying Offline Maps. I have tried creating mbtiles using Mobile Atlas creator, but the output .mbtile file does not works in Nutiteq SDK.
Please assist on this. I only want to display a specific... | 2015/01/20 | [
"https://Stackoverflow.com/questions/28049177",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4474556/"
] | MBTiles is general format which can contain also vector data (tiles), not only raster . Both TileMill and Mobile Atlas Creator can create only rasters, first one from vector data, and second one by scraping it from on-line APIs. You can use raster MBTiles with Nutiteq SDK, iOS sample:
```
// file-based local offline d... | You can create MBTiles from any .osm.pbf file using this tool - <https://github.com/systemed/tilemaker>
1. Download .osm.pbf file from [Geofabric](https://download.geofabrik.de/). To download for a custom area, you can use [Protomaps](https://protomaps.com/extracts) or [BBBike Extract](https://extract.bbbike.org/)
2. ... |
137,574 | I'm interested in compiling a list of bookstores around the world that stock a good selection of high-level mathematical books. The aim is so that a mathematician travelling, or on holiday, can easily check the list to see if there is a book store nearby that she or he could happily spend an hour browsing in.
Some par... | 2013/07/24 | [
"https://mathoverflow.net/questions/137574",
"https://mathoverflow.net",
"https://mathoverflow.net/users/23572/"
] | Two in **New York City**: The Strand, Broadway and 12th Street, and the original Barnes and Noble, 5th Avenue and 18th Street. | The obverse of a bookstore, but still somehow relevant:
The (excellent) [Harvard Birkoff "noncirculating library"](http://www.math.harvard.edu/graduate/):
 |
55,375,124 | I required my `SimpleXLS` package class that I installed via composer but when I try to test it my `SimpleXLSX` looks like it's undefined.
```
<?php
include './_inc/bootstrap.php';
require_once('./vendor/shuchkin/simplexls/src/SimpleXLS.php');
if ( $xlsx = SimpleXLSX::parse('book.xlsx') ) {
print_r( $xlsx->rows()... | 2019/03/27 | [
"https://Stackoverflow.com/questions/55375124",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11148364/"
] | Change,
```
if ( $xlsx = SimpleXLSX::parse('book.xlsx') ) {
```
To,
```
if ( $xlsx = SimpleXLS::parse('book.xlsx') ) {
```
Change any references of `SimpleXLSX` to `SimpleXLS` because according to [this](https://github.com/shuchkin/simplexls/blob/master/src/SimpleXLS.php#L36), the class is called `SimpleXLS`, not... | When using Composer, you should generally not be including specific files inside packages, only the Composer-generated autoloader:
```
require_once './vendor/autoload.php';
```
This only needs to be run once, so could be inside your existing `_inc/bootstrap.php` file, where you'll need to go one directory up, so the... |
105,873 | My problem is that Windows 7 won't update - legal MSDN copy.
It says: "the update service is not started", and if I start it, it immediately shuts itself down. In the event viewer is nothing interesting to see, no fatals and no warnings, only start/stop events.
I've got no clue from where to start looking, so here's an... | 2010/02/07 | [
"https://superuser.com/questions/105873",
"https://superuser.com",
"https://superuser.com/users/27500/"
] | The following is from Microsoft. The 1st solution fixed my problem:
>
> From the case log, I understand that the error code 80072EFE was
> received when trying to perform Windows Update. If there has been any
> misunderstanding, please let me know. I fully understand the
> inconvenience you have experienced. We wi... | With windows 10, Microsoft has been trying to "bully" other users to upgrade to 10. One form that this has taken has been to given Windows 7 machines low priority on their update servers. And I mean *really* low priority. Also, some updates seemed to turn off updates for who-knows-why if later updates weren't also done... |
23,265,645 | *[Similar question](https://stackoverflow.com/questions/5012480/8-bit-char-to-hex-representation) however, I'm looking for a qt solution.*
I'm looking for a way convert a 8 bit negative int into a hex representation. The example will explain it better.
```
qint8 width = - 100;
qDebug() << QString::number(width, 16);
... | 2014/04/24 | [
"https://Stackoverflow.com/questions/23265645",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1214214/"
] | The problem is that `QString::number` can accept `int` or `uint` types. It doesn't have versions for 8-bit integers, so they are implicitly casted to larger integers. It works fine with signed integer because leading zeros are removed.
You can however use `QDataStream`, it provides `operator <<` for large variety of t... | `QString::number` only takes `int`s and `long`s so both times `width` was promoted to a qint and quint resp
Unsigned promotion does not extend the sign bit while signed promotion does.
and documentation of [QString::number says](http://qt-project.org/doc/qt-5/qstring.html#number)
>
> The base is 10 by default and m... |
27,362,971 | I'm trying to add the new Android 5.0 Material Design Datepicker to my pre 5.0 application using AppCompat. I've added
```
compile "com.android.support:appcompat-v7:21.0.0"
```
to my build.gradle file and updated my Theme to:
```
<?xml version="1.0" encoding="utf-8"?>
```
```
<style name="AppTheme.Base" parent="... | 2014/12/08 | [
"https://Stackoverflow.com/questions/27362971",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3449811/"
] | Material components is the recommended way for date picker
----------------------------------------------------------
With the `Material Components for Android` you can use the new `MaterialDatePicker`.
add the following to your build.gradle
```
implementation 'com.google.android.material:material:1.1.0'
```
**For... | I liked [this](https://github.com/jaydeep17/datetimepicker) library. It's a clone of [Flavien Laurent Date and Time Picker](https://github.com/flavienlaurent/datetimepicker) with some improvements. Both of them are based on [Official Google Date and Time Picker for Android 4.3+](https://android.googlesource.com/platfor... |
818 | Since I'm not a Magic player, I have that tag ignored. When I called up the site I was met with a huge wall of greyed out questions. It seems a whole bunch of Magic questions where re-tagged with "Rules".
That got me thinking. A large percentage of questions on this site are going to be rules questions. I'd even go so... | 2012/06/16 | [
"https://boardgames.meta.stackexchange.com/questions/818",
"https://boardgames.meta.stackexchange.com",
"https://boardgames.meta.stackexchange.com/users/2733/"
] | Given the way the tag is *used*, I'm gonna say **NO**.
The excerpt for the tag states,
>
> Objective questions about a game's official rules.
>
>
>
Now, there are two ways you could interpret that...
1. Questions on interpreting or applying *specific rules* during gameplay.
2. Any question where the rules of a... | My view is that the [rules](https://boardgames.stackexchange.com/questions/tagged/rules "show questions tagged 'rules'") tag is a meta tag and is mostly unnecessary.
Here is the "official" stance on [meta tags](http://blog.stackoverflow.com/2010/08/the-death-of-meta-tags/), straight from the horse's mouth.
---
Is it... |
53,721,733 | I’m a Python newbie and have the following Pandas dataframe - I’m trying to write code that populates the ‘signal’ column as it is below:
| Days | long\_entry\_flag | long\_exit\_flag | signal |
| --- | --- | --- | --- |
| 1 | FALSE | TRUE | |
| 2 | FALSE | FALSE | |
| 3 | TRUE | FALSE | 1 |
| 4 | TRUE | FALSE | 1 |... | 2018/12/11 | [
"https://Stackoverflow.com/questions/53721733",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10569839/"
] | You can do
```
# Assuming we're starting from the "outside"
inside = False
for ix, row in df.iterrows():
inside = (not row['long_exit_flag']
if inside
else row['long_entry_flag']
and not row['long_exit_flag']) # [True, True] case
df.at[ix, 'signal'] = 1 if inside e... | ```
#let the long_exit_flag equal to 0 when the exit is TRUE
df['long_exit_flag_r'] = ~df.long_exit_flag_r
df.temp = ''
for i in range(1, len(df.index)):
df.temp[i] = (df.signal[i-1] + df.long_entry_flag[i])*df.long_exit_flag_r
```
If the temp is positive then the signal should be 1, and if the temp is negative ... |
7,874,972 | How is the lexicographic order defined in Java especially in reference to special characters like `!`, `.` and so on?
An examplary order can be found [here](http://sheepsystems.com/bookdog/HelpBook/LexicalOrder.html)
But how does Java define it's order? I ask because I'm sorting Strings on Java and on Oracle and come... | 2011/10/24 | [
"https://Stackoverflow.com/questions/7874972",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/256853/"
] | From the docs for [`String.compareTo`](http://download.oracle.com/javase/7/docs/api/java/lang/String.html#compareTo%28java.lang.String%29):
>
> Compares two strings lexicographically. The comparison is based on the Unicode value of each character in the strings.
>
>
>
and
>
> This is the definition of lexicogr... | In Java it's based on the Unicode value of the string:
<http://download.oracle.com/javase/1.4.2/docs/api/java/lang/String.html#compareTo(java.lang.String>)
In Oracle, it will depend on the charset you are using on your database. You'll want it to be UTF-8 to have consistent behavior with Java.
To check the character... |
235,182 | 1. They have tried Democracy
2. The civilization is very much similar to human civilizations but I want it to stay as a monarchy yet still have technology advanced enough to travel around the galaxy.
Is it even possible? | 2022/09/04 | [
"https://worldbuilding.stackexchange.com/questions/235182",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/98219/"
] | **We can learn a thing or two from good old Earth**
>
> It’s good to be the king. But, when it comes to a nation’s economic health, it’s also good to have a king — or queen — on hand. Monarchs open economic doors.
>
>
> “In the presence of royalty, companies can enter circles they wouldn’t be able to get in by them... | Aristoi + Eugenics
==================
Your aliens have selected a genetic class that systematically weeds out people with "undesirable" traits. With genetic engineering and social programming, they have created a class of people who are genetically and educationally "optimized" (at least in their minds) for rulership.... |
250,591 | Early in spring, when the ground was frozen and there was still a feet of snow in the yard, heavy rain filled my basement window well with water. The ground around my house is very sandy, so the water carried sand into the well.
As you can see on this picture, there is a drain, but I suspect it got clogged with sand. ... | 2022/06/06 | [
"https://diy.stackexchange.com/questions/250591",
"https://diy.stackexchange.com",
"https://diy.stackexchange.com/users/757/"
] | I would first see that the well is sealed to the building. It seems that the sand is washing into the well where the well meets the building. Second I would see that the ground is pitched away from the building so when it rains water does not run towards the building. Third I would insure that the gutters are clear and... | >
> So now, how should I proceed?
>
>
>
A shovel, wheelbarrow, and some sweat.
If the sand is not supposed to be in the gravel then you need to remove the contaminated gravel and shake/wash the sand off of it before storing it in a pile. There is no magic vacuum for this. Just keep shoveling until you hit dirt.
... |
78 | I was quite excited to see that the linguistics SE had begun public beta. However, I must admit that I'm a bit disappointed by the level of the questions on the front page. I guess I was under the impression that the site would be more focused on research-level Linguistics, not just languages in general. Was I wrong ab... | 2011/09/21 | [
"https://linguistics.meta.stackexchange.com/questions/78",
"https://linguistics.meta.stackexchange.com",
"https://linguistics.meta.stackexchange.com/users/230/"
] | Research-level linguistics questions are certainly welcome.
A natural problem the site may face is that research-level interests may prompt big, involved questions that don't have a quick answer, and those who contribute such questions may not have new questions frequently. Conversely, shorter, more frequent, and easi... | Please feel free to ask more questions on research-level linguistics. I'm sure many of us are interested to see them.
In the mean time the questions come from whoever is asking and we all have different interests and knowledge. |
26,918,775 | I'm using fgets to read a string in a char array, and then I want to move the pointer over 5 indices and copy the rest of the array into a separate array, BUT I don't want it to copy a newline character; so I've got something like this:
```
char str1[45], str2[50];
fgets(str2, 50, stdin);
*str2 += 5;
sprintf(str1, "%[... | 2014/11/13 | [
"https://Stackoverflow.com/questions/26918775",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4143072/"
] | The pattern `%[^n]s` is valid format for `scanf` but it is not a valid format specifier for `printf` (or `sprintf`).
Additionally, `*str2 += 5` does not skip the first 5 characters (as it appears to be the intention) but instead adds 5 for the byte stored in the first element of `str2`. `str2 = str2 + 5` will not comp... | Try removing the final "s" in "%[^\n]s" |
1,360,383 | I have a string like following:
`CREATE GLOBAL TEMPORARY TABLE **some\_temp\_table\_name**`
or
`CREATE GLOBAL TEMPORARY TABLE **some\_temp\_table\_name** something else`
with the regex I want to strip out whatever is in bold letters.
I have the following regex
```
([a-z].*[\s]*)
```
what should I change in the... | 2009/09/01 | [
"https://Stackoverflow.com/questions/1360383",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/44286/"
] | Try this:
>
> `([A-Z\s]+)[a-z_]+\s?([a-z\s]+)`
>
>
>
In Groovy you would do something like this:
```
String clean
= yourString.replaceAll("([A-Z\s]+)[a-z_]+\s?([a-z\s]+)", "$1$2");
``` | try? :
```
([a-zA-Z\s]+TABLE)\s\b[a-zA-Z_]+\b(.*)
``` |
152,559 | ### Background
*You can skip to the end for a (very) short summary though...*
We are a group of good friends, we've all known each other for 7+ years, since high school, and have been playing DnD since then, first 3.5 and then recently 5th edition. Currently, there are 6 players, including the PC "played" by the GM i... | 2019/07/27 | [
"https://rpg.stackexchange.com/questions/152559",
"https://rpg.stackexchange.com",
"https://rpg.stackexchange.com/users/57093/"
] | The way I understand it
-----------------------
Your problem player rejects your concerns when you try to address behaviours that the whole group agree are problematic **and** would also be problematic for the problem player if one of his players had the same behaviours in the game he masters?
Seems to me like he is ... | It sounds like the problem is not how he plays; that is just a symptom. The problems are:
1. He does not care about the enjoyment of others in the group.
2. He does not take criticism like an adult.
So that is what you should be talking to him about. He is not being self-aware, whether intentionally or not.
Asking h... |
343,393 | An example of what I'm talking about is on some political candidate websites, like BJ Lawson or Ron Paul's old site.
When you donate, it shows your name in Flash as a recent donor. It might also show a "goal" and how far along you are. Just curious if you can give me ideas on how to accomplish something similar, start... | 2008/12/05 | [
"https://Stackoverflow.com/questions/343393",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | The safest method is to have the application(s) that put files in the directory first put them in a different, temporary directory, and then move them to the real one (which should be an atomic operation even when using FTP or file shares). You could also use naming conventions to achieve the same result within one dir... | One simple possibility would be to poll at a fairly large interval (2 to 5 minutes) and only acknowledge the new file the second time you see it.
I don't know of a way in any OS to determine whether a file is still being copied, other than maybe checking if the file is locked. |
371,581 | How would I show that there is a ring $R$ with identity $1\_R$ and a subring $S$ not containing $1\_R$, but such that $S$ has its own identity $1\_S$ not equal to $1\_R$? | 2013/04/24 | [
"https://math.stackexchange.com/questions/371581",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/72195/"
] | A simple example (related to the one by **Alex P.**) is given by the rings of matrices
$$
\left\{
\begin{bmatrix}a&0\\0&0\end{bmatrix} : a \in F
\right\}
= S \subseteq
R = \left\{
\begin{bmatrix}a&b\\c&d\end{bmatrix} : a, b, c, d \in F
\right\}
$$
where $F$ might be $\Bbb{Z}, \Bbb{Q}, \Bbb{R}, \dots$.
Here
$$
\begin... | The rings of the form $(\mathbb Z\_n,\oplus,\odot)$ are quite simple, so let us try them.
If $R=\mathbb Z\_n$ then $1\_R=1$. A candidate for $1\_S$ can be only an element such that $1\_S\odot 1\_S=1\_S$.
In $\mathbb Z\_2$, $\mathbb Z\_3$, $\mathbb Z\_5$ we do not have non-trivial subrings.
In $\mathbb Z\_4$ the only... |
43,040,026 | I'm a little bit stuck on animations, so I have a div that is added dynamically using jQuery `.append()` so when the page is loaded the div content will be added and from css I'll apply some animations using `@keyframes`. My problem is when the div content is closed using jQuery `.remove()` because if the div content i... | 2017/03/27 | [
"https://Stackoverflow.com/questions/43040026",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1057912/"
] | You must add a class to handle a new "state" of your element in css.
But you shouldn't use animation and keyframe for that. Instead, use transition. Exemple :
```
.myElement {
top: 0;
transition: top 0.4s linear;
}
.meElementOpened {
top: 50%;
}
```
We set the transition on the element's default class ... | You don't need to use `keyframes` for this sort of animation. What you should rather do is toggle a class with changing `top` properties of your `.child-container` element and apply a `transition`.
Add the `initial` class with a `setTimeout` so that the class is applied and the animation happens. And remove the class ... |
46,275,479 | I cannot achieve this one.
I want viewB to follow the start of viewA.
Then I want to create a constraint to have a space from the start of viewA to its parent.
[](https://i.stack.imgur.com/GeIg7.png)
.
Code I tried:
```
<android.support.constraint.C... | 2017/09/18 | [
"https://Stackoverflow.com/questions/46275479",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8258130/"
] | Do not use `match_parent`. Instead, start using "0dp" for `match_parent` and define left/right or top/bottom parent constraints
Here is working code:
```
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
... | >
> try this :
>
>
>
```
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_co... |
26,232,428 | I am trying to make a regex on field which accepts in the following:
Where X is a numerical value between 0-9 so 3 numbers before the - and three after the dash.
I started with the following but I got lost in adding validation after the dash.
```
([0-9-])\w+([0-9-])
``` | 2014/10/07 | [
"https://Stackoverflow.com/questions/26232428",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1440586/"
] | ```
var example = "123-455";
var pattern = @"\A(\d){3}-(\d){3}\Z";
var result = Regex.Match(example, pattern);
```
This will not only search for the pattern within your string, but also make sure that the beginning and end of the pattern is at the beginning and end of your target string. This ensures that you won't g... | ```
string pattern = @"^([0-9]{3})-([0-9]{3})$";
Regex rgx = new Regex(pattern);
``` |
1,523 | I've set up a channel using categories to distinguish between different blog post types. The majority will probably be in one category, so it would be great to be able to specify a default category. However, as far as I can see the Category field type (unlike, say, the Drop Down field type) doesn't give you the option ... | 2014/07/30 | [
"https://craftcms.stackexchange.com/questions/1523",
"https://craftcms.stackexchange.com",
"https://craftcms.stackexchange.com/users/328/"
] | You could output the categories in a way that makes them look like they are from a specific category when they don't have any categories assigned to them.
When you're outputting any of the entries, just add a custom link if there isn't a category assigned:
```twig
{% if entry.categories|length %}
{% for category ... | Not with the out-of-the-box field types. You could create a field type that is category+default. The [Default Color](https://github.com/marionnewlevant/craft-defaultcolor) plugin might be a good place to start. |
8,703,496 | I want to implement a HashMap in Python. I want to ask a user for an input. depending on his input I am retrieving some information from the HashMap. If the user enters a key of the HashMap, I would like to retrieve the corresponding value.
How do I implement this functionality in Python?
```
HashMap<String,String> s... | 2012/01/02 | [
"https://Stackoverflow.com/questions/8703496",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1118984/"
] | [Python dictionary](http://docs.python.org/library/stdtypes.html#dict) is a built-in type that supports key-value pairs.
```
streetno = {"1": "Sachin Tendulkar", "2": "Dravid", "3": "Sehwag", "4": "Laxman", "5": "Kohli"}
```
as well as using the dict keyword:
```
streetno = dict({"1": "Sachin Tendulkar", "2": "Drav... | All you wanted (at the time the question was originally asked) was a hint. Here's a hint: In Python, you can use [dictionaries](http://docs.python.org/tutorial/datastructures.html#dictionaries). |
668,825 | On a standard computer, I change the size of the desktop icons by pressing Ctrl + rolling the scroll wheel (the same operation for zooming in or out in most applications).
But how can I change the icons' size on a touch device, like a Surface tablet, without a mouse ? I tried the "pinch-to-zoom" gesture, which works f... | 2013/11/02 | [
"https://superuser.com/questions/668825",
"https://superuser.com",
"https://superuser.com/users/233470/"
] | For the Surface tablet, you can hold your finger on a blank area of the desktop screen for a few seconds, and a menu window pops up. Pick `Personalize` > `Display` and choose the size of all items on the desktop. There's an option to choose "Custom sizing options" and pick a larger size (up to 200% of the default). [Th... | Its really simple,
press the CTRL key on your keyboard, and roll the mouse scroll up and down to change the icons of desktop screen.
This method works for every page, if you are on desktop, explorer, or webpage. |
71,617,117 | If i write code line like
```
string employeeName= objEmp?.EmployeeName;
```
then this line is not being considered by code coverage because of `?.`.
What i will have to do to consider this line by code coverage in .net core. | 2022/03/25 | [
"https://Stackoverflow.com/questions/71617117",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10683751/"
] | using data.table:
```
library(data.table)
setDT(x)[grepl("^Page.",section)==F, header:=section] %>%
.[,header:=zoo::na.locf(header)] %>%
.[section!=header,header:=paste0(header, " / ",section)] %>%
.[,.(section = header)] %>%
.[]
1: BOOK I: Introduction
2: BOOK I: Int... | An slightly simpler `data.table` approach:
```
library(data.table)
setDT(x)
x[, g := cumsum(grepl('(BOOK|MAGAZINE)', section))]
x[, section := ifelse(seq_along(section) == 1,
section, paste(section[1], section, sep = ' / ')), by = .(g)]
x[, g := NULL]
```
The output is:
```
> x
... |
727,534 | I have been pondering over this question for a few months now. Why exactly do quintic equations have no closed *general* expression for their roots? Looking at graphs and reading about it hasn't really convinced me.
---
<http://en.wikipedia.org/wiki/Quintic_function>
---
Post scriptum: Pardon me if this question i... | 2014/03/26 | [
"https://math.stackexchange.com/questions/727534",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/98900/"
] | The short answer, is *why should they*?
Radicals are solutions to special equations of the form $$
?^n = x
$$
which we commonly abbreviate as $\sqrt[n]{x}$, whereas you are looking at arbitrary equations of the form $$
\sum\_{i=0}^n \lambda\_n x^n = 0 \text{.}
$$
Why would you even expect that you can find roots of... | There are different reasons for insolvability of quinitics in radicals (or in elementary numbers): e.g. algebraic independence, symmetry restrictions, topological restrictions.
Chow [Chow 1999] gives his
Corollary 1:
"If Schanuel's conjecture is true, then the algebraic numbers in" the explicit [elementary numbe... |
15,309,077 | I have string:
```
<p justify;"="">Verslo centrai Lietuvos nekilnojamojo turto plėtros asociacijos konkurse ...</p>
```
and want want remove tag
```
<p justify;"=""></p>
```
my code:
```
$content = strip_tags($text, '<p>');
```
but i get empty string: `string(0) ""` , what I do wrong ? | 2013/03/09 | [
"https://Stackoverflow.com/questions/15309077",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1067795/"
] | Since your HTML is not properly formatted you could choose a `preg_replace()` approach:
```
$text = '<p justify;"="">Verslo centrai Lietuvos nekilnojamojo turto plėtros asociacijos konkurse ... </p>';
$content = preg_replace('/<[^>]*>/', '', $text);
var_dump($content);
// string(108) "Verslo centrai ... | From PHP 7.4.0 the strip\_tags() alternatively accepts an array with allowable tags,
then this:
```
<?php
$html = '<div id="my-div"><p>text<strong><a href="#link"></a></strong></p></div>';
echo strip_tags($html, ['p', 'a']); //accept p and a tags
```
Return this:
```
<p>text<a href="#link"></a></p>
```
Note th... |
45,647,200 | I have a problem with creating GlobalVariables for my webform app.
I am creating a webform app with Visual Studio 2015, VB.net, ASP.net
I followed the instruction that I found on this and other sites but with no successs.
I did the folowwing:
1 Create the module file: Module1.vb
With this scripts:
Public Module Globa... | 2017/08/12 | [
"https://Stackoverflow.com/questions/45647200",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8157587/"
] | Using SimpleXML, you can build up the hierarchy of the XML document using...
```
$data = 'Rajeet Singh|email@gmail.com|0123456789|Delhi
Abhishek|email2@gmail.com|0123456987|Pune';
$lines = explode(PHP_EOL, $data);
$xml = new SimpleXMLElement('<user />');
$root = $xml->user;
foreach($lines as... | For example, you can write as follows.
```
<?php
$string = <<<EOM
Rajeet Singh|email@gmail.com|0123456789|Delhi
Abhishek|email2@gmail.com|0123456987|Pune
EOM;
$line = explode(PHP_EOL, $string);
$tags = ['name', 'email', 'mobile', 'address'];
$xml = '';
$xml .= "<user>" . PHP_EOL;
foreach($line as $key => $row){
... |
38,944,442 | I followed [draft-js document](https://facebook.github.io/draft-js/docs/overview.html#content) to create a very simple demo of draft-js.
Everything seems work well, but when I open the url in Chrome, I can only see a white blank page (there is a hidden editor component there but is not visible)
There is no error on t... | 2016/08/14 | [
"https://Stackoverflow.com/questions/38944442",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/342235/"
] | If you just use the sample code on the official website of Draft.js, you will see nothing on the page. It's just a blank text input field. If you click that field, you could type something. Draft.js is not a out of the box plugin, but a "a framework for building rich text editors in React".
![enter image description h... | Actually, I tried a lot to solve this problem but in vain. What I did is using another package that is built on the top of draft js, and It's working fine.
you can find it here:<https://jpuri.github.io/react-draft-wysiwyg/#/> |
1,275,724 | I've read the SVN red-bean book, and research how people layout their SVN repos, we're thinking of using SVN for our product, so would like suggestions on a repos layout.
The product is a desktop application, consisting of a number of .exe, graphics, etc. The current source layout is something like:
```
Program 1
Pro... | 2009/08/14 | [
"https://Stackoverflow.com/questions/1275724",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26305/"
] | For every project I've worked in that's been managed by Subversion, the trunk has held the "development" branch. Each release gets a tag (or branch, should it end up being maintained further). Any changes to the branches that are relevant to the devel branch are merged in as necessary. | For what your doing your better off going with GIT, for each major release do a branch. This way if any bug comes up in a major release you can switch back to the branch and then cherry pic different commits in your GIT repository into your release branch. |
4,392,552 | How can I program hourglass behavior (similar like on picture) for my game?

Should I make something like gravitation and process each grain of sand?
What about digital hourglass (like on this clocks)?
 | 2010/12/08 | [
"https://Stackoverflow.com/questions/4392552",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/446876/"
] | Tangentially, you can model falling sand with [cellular automata](http://www.openprocessing.org/visuals/?visualID=6622). I'd not considered using it for an hourglass simulation, but in principle it might work quite nicely, and be a fun project.
Looking at your digital hourglass -- either the grains move in set pattern... | Modelling it is making a rod for your own back, you'd be better off just drawing the frames by hand and playing them back.
But -- if maths is your thing you could:
* work out the volume of sand in the top.
* define a rate of volume flow through the neck (keep this arbitrary as you'll want to tweak it).
* at any giv... |
69,741,708 | I am attempting to reference a column in another dataframe (df2) based on a column of column names in my primary dataframe (df1$reference) to return the extact value where the ID and column name match in a new column (df1$new\_col). Here is a simplified example of my data and the desired outcome:
[![enter image descri... | 2021/10/27 | [
"https://Stackoverflow.com/questions/69741708",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15453998/"
] | We may use `row/column` indexing
```
DF1$new_col <- DF2[-1][cbind(seq_len(nrow(DF1)),
match(DF1$reference, names(DF2)[-1]))]
```
-output
```
> DF1
ID value reference new_col
1 1 4 colD no
2 2 5 colD no
3 3 6 colE no
```
### data
```
DF1 <- structure(list(I... | Maybe something like this?
```
library(dplyr)
left_join(DF1, DF2, by="ID") %>%
mutate(New_col = case_when(reference=="colD" ~ colD,
reference=="colE" ~ colE,
reference=="colF" ~ colF)) %>%
select(ID, value, reference, New_col)
```
```
ID value referen... |
1,792,471 | I've been thinking about the access web-based applications have to an OS.
I'm curious:
1. What is the best way of determining
this as it currently stands?
2. Is the trend leaning toward more, or
less access?
3. What functionalities should be
open/closed?
A simple example would be.. say your g-mail alerted you in th... | 2009/11/24 | [
"https://Stackoverflow.com/questions/1792471",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13954/"
] | ```
string[] s = initialize the array...
var subset = s.Skip(1).Take(s.Length - 2).ToArray();
``` | If you want to avoid manually indexing the array. Don't try to pull request that anywhere though:
```
var newArray = oldArray.Skip(1).Reverse().Skip(1).Reverse().ToArray()
``` |
11,179,853 | I've this string which I'm displaying in my xhtml page.
I want to cut it down to some limit and put three or four dots at the end of the string.
This is the ui:repeat code:
```xhtml
<ui:repeat var="userMsg" value="#{messagesManagedBean.paginator1.model}">
<center><img class="h-diff" src="../images/differentiator-... | 2012/06/24 | [
"https://Stackoverflow.com/questions/11179853",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1291826/"
] | For `text-overflow: ellipsis;` to work, three things are required:
* `overflow` must be set to `hidden`, `scroll`, or `auto`
* `white-space: nowrap;`
* the text must be longer than the element is wide
Demo: <http://jsfiddle.net/ThinkingStiff/mCJCR/>
```css
#message-text {
overflow: hidden;
text-overflow: ell... | `text-overflow: ellipsis` only works if you have a defined width/height constraint and `overflow: hidden`. |
47,257,273 | I want to use the [Factory Pattern](https://www.tutorialspoint.com/design_pattern/factory_pattern.htm) using TypeScript to convert raw data into a `User`. I have two different types of `User`s: `Employee` and `Customer`. Both extend the base class and compile without problems. Below is an extremely simplified version o... | 2017/11/13 | [
"https://Stackoverflow.com/questions/47257273",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3263719/"
] | [](https://i.stack.imgur.com/LB4QQ.gif)
If this is what you want, I will update both this answer and the demo serveral hours later.
I write the demo in a hurry, so apologize for the ugly UI and the code style.
The demo project is on [Github](https://... | Custom UIViewController transition - Like today tab of appstore app
Try This : -
<https://github.com/MilanSavaliya321/appstore-clone>
[](https://i.stack.imgur.com/vE9ts.gif) |
464,326 | Does existence of a limit at a point not necessarily mean that it's differentiable at that point?
Take this function:
$$f(x) = \frac{(x - 1)^{2}}{x - 1}$$
The function is not defined at x = 1, but as x approaches 1, f(x) goes to 0; i.e., a "removable discontinuity." But the function is not differentiable at 1, righ... | 2013/08/10 | [
"https://math.stackexchange.com/questions/464326",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/89812/"
] | Continuity is necessary for the existence of a $f'$, that means if a function $f$ has discontinuity at $x=a$ then $f$ is not differentiable at $x=a$. Your function is not continuous at $x=1$, therefore it's not differentiable at $x=1$. Moreover, continuity is not a sufficient condition.For example $|x|$ is continuous o... | I think it depends on the domain of the function.
1. if the domain is $\mathbb{R}$, then $f(x)$ is not defined at $x=1$, so it's not continuous and not differentiable;
2. if the domain is $\mathbb{R}$ but $x\ne 1$, then it's continuous and differentiable in its domain. |
72,677,634 | I have been working on a flutter project and I have noticed ***Avoid using private types in public APIs***.
Is there a way to fix this warning?
```
class SubCategoriesPage extends StatefulWidget {
final MainModel mainModel;
// final Ads ad;
const SubCategoriesPage(this.mainModel, {Key? key}) : super(key: key)... | 2022/06/19 | [
"https://Stackoverflow.com/questions/72677634",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13057145/"
] | Since this is a `StatefulWidget`, I'm guessing the `_SubCategoriesPage` class inherits from `State`, since it's being returned by `createState()`.
If so, the return type can be changed to `State`. Since `State` is public, it can safely be returned from the public `createState()` method. | I had the same issue using this code
```
class MyPage extends StatefulWidget {
const MyPage({super.key});
@override
_MyPageState createState() => _MyPageState();
}
```
I tried using this method - State createState() { // Avoid using private types in public APIs.
return \_MyPageState();
but than I got this e... |
3,351,417 | I've got an ajax loaded image gallery that loads an image to the dom and then removes it and loads in the next one and rotates in that way.
Next to where the image comes in i've got a list of static names (they're there on page load and don't do anything) for the images.
What i want to do is as the image is loaded in... | 2010/07/28 | [
"https://Stackoverflow.com/questions/3351417",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/209986/"
] | Without all complex Regex in the way you can use id/rel attributes as you suggested initially. With this method you would not be matching the images src tag but matching it's ID attribute.
Here are your descriptions
```
<p id="item_desc_5">Plane</p>
<p id="item_desc_6">Car</p>
```
Here is your CSS class for the und... | EDITED - I'd do something like this
```
$('#imageid').load(function(){
// image was loaded
part = /some regex/.exec($(this).attr('src'));
if(part != null) $('p').filter('[src*="'+part+'"]').addClass('underline');
}).attr('src','new_src.jpg');
```
the /some regex/ should return the part you want to match |
7,390,496 | I am creating a simple data frame like this:
```
qcCtrl <- data.frame("2D6"="DNS00012345", "3A4"="DNS000013579")
```
My understanding is that the column names should be "2D6" and "3A4", but they are actually "X2D6" and "X3A4". Why are the X's being added and how do I make that stop? | 2011/09/12 | [
"https://Stackoverflow.com/questions/7390496",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/908431/"
] | I do not recommend working with column names starting with numbers, but if you insist, use the `check.names=FALSE` argument of `data.frame`:
```
qcCtrl <- data.frame("2D6"="DNS00012345", "3A4"="DNS000013579",
check.names=FALSE)
qcCtrl
2D6 3A4
1 DNS00012345 DNS000013579
```
One of the... | The X is being added because R does not like having a number as the first character of a column name. To turn this off, use `as.character()` to tell R that the column name of your data frame is a character vector. |
2,805,678 | Here's my attempt at limiting the number of characters entered into a text area:
```
var limit = 255;
var txt = $('textarea[id$=txtPurpose]');
$(txt).keyup(function() {
var len = $(this).val().length;
if (len > limit) {
//this.value = this.value.substring(0, 50);
$(this).addClass('goRed');
... | 2010/05/10 | [
"https://Stackoverflow.com/questions/2805678",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/275390/"
] | ```
$(this).val( $(this).val().substring(0, limit) );
``` | ```
var limit="NO of characters";<br><br>
$(this).val( $(this).val().substring(0, limit) );
``` |
37,921,865 | I'm doing a query on a really simple table in a typo 3 task. However, only the fields "uid" and "pid" are returned, the other fields are `NULL`.
My Entity:
```
<?php
namespace Name\SampleExtension\Domain\Model;
use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;
class MailAgent extends AbstractEntity
{
/**
... | 2016/06/20 | [
"https://Stackoverflow.com/questions/37921865",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/983869/"
] | It's hard to say how you'd want your Layout to load sometimes, but at the top of your view you can check criteria:
```
@{
if (/* your criteria here */) {
Layout = "path to your layout file";
} else {
Layout = null;
}
}
``` | You must delete Layout at the View or \_ViewStart. |
49,259 | Solzhenitsyn is a dissident writer in the former Soviet Union. He's famous for writing the *Gulag Archipelago*. I recall that he eventually managed to escape to the West, in fact to the USA where after taking a good look around he denounced the the West too.
Once a dissident, always a dissident I suppose. I also reca... | 2018/11/08 | [
"https://history.stackexchange.com/questions/49259",
"https://history.stackexchange.com",
"https://history.stackexchange.com/users/994/"
] | The speech can be read in it's entirety here. **[A World Split Apart](https://www.americanrhetoric.com/speeches/alexandersolzhenitsynharvard.htm)**. delivered 8 June 1978, Harvard University and is well worth reading.
Solzhenitsyn was a Russian Conservative who's ideology was formed through Orthodox Christianity, Slav... | He accuses West of being spiritually void
-----------------------------------------
[Full text is here](https://www.americanrhetoric.com/speeches/alexandersolzhenitsynharvard.htm) . I will skip parts about Soviet Union , Third World and concentrate on critique of the West .
>
> It has become possible to raise young ... |
9,120,874 | I have a created a multithreaded application that executes different tasks with the same ScheduledExecutorService (method scheduleAtFixedRate and a fixed threadpool of 10 threads). However all threads except one main task (not to be confused with the main thread!) are asleep most of the time, until there is user input.... | 2012/02/02 | [
"https://Stackoverflow.com/questions/9120874",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1186155/"
] | there is a tutorial linked in the emberjs wiki that uses another library for RESTful communication with Rails: <https://github.com/emberjs/ember.js/wiki/Links>
I have used the old sproutcore-datastore ( back in the Sproutcore 2 days... ;-) ) along a very nice post from Peter Wagenet on the Sproutcore blog: <http://blo... | Here's an example of an Emberjs app using Ember data adapter to make it works with a REST API.
<https://github.com/dgeb/ember_data_example> |
41,024 | I want to listen to music while running, but I have a hard time finding a good way to do so.
My phone is quite big, and my watch is a standard running watch, not a smart watch. I live in a place with lots of rain, so the equipment must be water resistant.
I'm guessing wireless earbuds, but how can I bring the music w... | 2019/10/01 | [
"https://fitness.stackexchange.com/questions/41024",
"https://fitness.stackexchange.com",
"https://fitness.stackexchange.com/users/10745/"
] | Here are some options:
* Get a small MP3 player. Anything from an IPod nano to knockoffs that sell on Amazon. [This one has a screen and is less than $20.](https://amzn.to/2nRI0hl) While you will still have to carry it, you can probably fit it in one of the super secret pockets many running shorts have. Some of my sho... | I regularly listen to music while running. I am using spotify on my mobile phone. Even if your phone is big, I would use it and try to get either something like an arm holder for the phone or have it in my hands. Carrying even more devices would not solve it for me.
In addition I am using wired headphones and locally ... |
8,103,296 | Following this Android tutorial: <http://developer.android.com/resources/tutorials/hello-world.html> I added two lines which should cause null pointer exception:
```
Object o = null;
o.toString();
```
Now I set breakpoint on the second line and start debugger. When debugger breaks, I click "Step over" and applicati... | 2011/11/12 | [
"https://Stackoverflow.com/questions/8103296",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/279313/"
] | After exception occurs you should check Logcat window for details: there you find the entire stack leading to the line of code where exception is. In some cases exception will occur in some other class (not yours) - then you should look for your package/class name in the stack to find otu whether you're "responsible" f... | Try something like this...
```
try {
Object o = null;
o.toString();
}
catch (Exception e) {
e.printStackTrace();
}
```
...and use the DDMS perspective in eclipse.
Ideally you want to catch specific exceptions so the `catch` block would be...
```
catch (NullPointerException npe {
npe.printStackTrace... |
2,529,498 | >
> $y\geq 3$, $y>3$
>
>
>
Implication and equality, is in the region of logic than mathematics.
If we take something easy like Germany and the EU:
>
> Germany ⇒ EU
>
>
>
Because Germany is in the EU but the EU might be the UK or Sweden. (narrow goes to broad)
If we change it a bit:...
>
> Germany ⇒ UK, ... | 2017/11/20 | [
"https://math.stackexchange.com/questions/2529498",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/504700/"
] | It is true that $y>3 \Rightarrow y\ge 3$ for all $y$, but most of everything else you have written fails to make sense.
---
Writing "Germany $\Rightarrow$ EU" or "Germany $\Rightarrow$ EU, Germany Sweden" makes no sense.
The symbol $\Rightarrow$ is used between *propositions*, claims that can be true or false. But "... | The fact that $y>3 \implies y\geq3$ is an example of the logical rule of inference known as *disjunction introduction*. For more info on this and other rules see [here](https://en.wikipedia.org/wiki/Disjunction_introduction). Disjunction introduction states that for any statements $A,B$ (a statement is a true or false ... |
58,655,329 | I need to convert following:
```
Map<Long,Map<String,String>> mapOfMaps
```
to
```
List<List<String>> listOflists
```
where keys of outer map (`mapOfMaps`) are redundant (for this operation). So basically , I can just use `mapOfMaps.values().stream()` to start with.
And for each map object e.g.:
>
> {"apple":... | 2019/11/01 | [
"https://Stackoverflow.com/questions/58655329",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2458858/"
] | Below is my version of solution. You can iterate over entry and add values to desired list accordingly.
```
List<List<String>> list = map.
values()
.stream()
.map(value -> {
List<String> list1 = new ArrayList<>();
for (Map.... | If you're open to using a third-party library the following will work using [Eclipse Collections](https://github.com/eclipse/eclipse-collections):
```
@Test
public void mapOfMapsToListOfLists()
{
MutableMap<Long, MutableSortedMap<String, String>> map = Maps.mutable.with(
1L, SortedMaps.mutable.with("ke... |
443,210 | I'm trying to program an access database but I'm using SQL for all my querying. I've got the database almost complete but I have one query that has me stumped. It is a database which contains recipes. I have a table in which I have all the conversions for cooking (Tablespoon to Teaspoon, Teaspoon to Cup, etc.). The use... | 2009/01/14 | [
"https://Stackoverflow.com/questions/443210",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I think for cooking you have to separate two different types of units
1. by weight
2. by volume
You can't standardize these units, or what sense does it make to know that you need 2 cups of meet?
Then when you differentiate those two different types of units, you can standardize them two one unit. Maybe:
1. cups, t... | The user would have to provide you with the unit, and evey unit would have a type (weight, volume, etc.) Your "conversion table" would just need to include a baseline for every unit type. i.e. 8 oz to a cup, 128oz to a gallon. Knowing those two things you can convert cups to gallons.
Doing this in access in a single q... |
19,325,102 | I want to get the name of the month in JavaScript in capitals.
I know I can use the `getMonth()` method to get the current month and use the number to extract the month name in capitals from an array, but is there a built-in method to do the same? | 2013/10/11 | [
"https://Stackoverflow.com/questions/19325102",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1732772/"
] | Like this, see [`toLocaleString`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleString?redirectlocale=en-US&redirectslug=JavaScript/Reference/Global_Objects/Date/toLocaleString)
While this method has been around for quite some time, it is only recently that browsers have... | ```
const today = new Date();
const options = {month: 'long'};
today.toLocaleDateString('it-IT', options);
```
A way for getting the month from a Date Object. |
510,441 | I have a networking Linux application which receives RTP streams from multiple destinations, does very simple packet modification and then forwards the streams to the final destination.
How do I decide how many threads I should have to process the data? I suppose, I cannot open a thread for each RTP stream as there co... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510441",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/48461/"
] | It is important to understand the purpose of using multiple threads on a server; many threads in a server serve to decrease [latency](http://en.wikipedia.org/wiki/Latency_(engineering)) rather than to increase speed. You don't make the cpu more faster by having more threads but you make it more likely a thread will alw... | I'd say, try using just ONE thread; it makes programming much easier. Although you'll need to use something like libevent to multiplex the connections, you won't have any unexpected synchronisation issues.
Once you've got a working single-threaded implementation, you can do performance testing and make a decision on w... |
1,282,718 | There's a website ([example](https://www.angst-panik-hilfe.de/medikamente-angstbehandlung.html)) that somehow blocks selecting text. Also it blocks `Ctrl`+`A` to select everything, there is also no “Copy” in the popup menu.
What I have tried:
Some sites use JavaScript to block selection. So I disabled all JavaScript ... | 2018/01/05 | [
"https://superuser.com/questions/1282718",
"https://superuser.com",
"https://superuser.com/users/616229/"
] | [<https://www.angst-panik-hilfe.de/angst-panik.css>](https://www.angst-panik-hilfe.de/angst-panik.css) shows:
```
body{-webkit-user-select:none;-moz-user-select:-moz-none;
-ms-user-select:none;user-select:none}
```
So, that effect applies to the entire BODY tag.
Documentation on this CSS: [Mozilla Developer Site: u... | I'm using Stylus (<https://add0n.com/stylus.html>) and I made a style to apply to all websites, and thus I am ensuring everything is selectable:
```
* {
-webkit-user-select: auto !important;
-moz-user-select: inherit !important;
-ms-user-select: inherit !important;
user-select: auto !important;
}
```
The ... |
24,837,898 | I have created this function in a Python file:
```
def abc (xyz):
return xyz
```
I saved the file in `/var/www/` with the file name `a.py`.
Now I want to run this function in an Ubuntu console and pass a parameter to this function. How can I do this? I have tried this:
```
jaskaran@jaskaran-Vostro-1550:/var/ww... | 2014/07/19 | [
"https://Stackoverflow.com/questions/24837898",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3425009/"
] | ```
$ python
Python 2.7.6 (default, Mar 22 2014, 22:59:56)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from a import abc
>>> abc(123)
123
>>>
``` | Try using something like this:
```
def abc(xyz):
print(xyz)
if __name__ == "__main__":
abc(input("Enter something: "))
```
This will print in the console what you enter as input! ;)
i hope this helps |
1,940,112 | I'm using this script
<http://mondaybynoon.com/2009/02/23/creating-custom-form-elements-using-jquery-selects/>
to create custom css select boxes in my page. Javascript code that is used to apply the css styles on selectboxes, uses their id as a parameter:
```
$(document).ready(function() {
$('#cont').selectbox({debu... | 2009/12/21 | [
"https://Stackoverflow.com/questions/1940112",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/236021/"
] | This isn't exactly concatenation but it will do the job you want to do:
```
puts " Total Revenue of East Cost: #{total_revenue_of_east_cost}"
```
Technically, this is interpolation. The difference is that concatenation adds to the end of a string, where as interpolation evaluates a bit of code and inserts it into th... | Stephen Doyle's answer, using a technique known as "String interpolation" is correct and probably the easiest solution, however there is another way. By calling an objects to\_s method that object can be converted to a string for printing. So the following will also work.
```
puts " Total Revenue of East Cost: " + tot... |
2,837,515 | I wonder if, when you call something like that
>
> time();
>
>
>
it returns the timestamp relatively to your time zone setting or to UTC ?
For example, when syncing two agents, that must be important to take care of it, doesn't it ? | 2010/05/14 | [
"https://Stackoverflow.com/questions/2837515",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/341603/"
] | I don't know about an add-in for VS but anytime I want to try something quickly (and don't want to fire up VS and create a console app) I use [Snippet Compiler](http://www.sliver.com/dotnet/SnippetCompiler/). It gets the job done as far as quickly testing methods and what not. I usually use it for things like testing a... | [LinqPad](http://www.linqpad.net/) will execute C# snippets as well as LINQ. Nice except that autocompletion is not included in the free version. Of course you can write statements in VS with autocompletion, then copy/paste them into Linqpad. |
128,635 | I can connect remotely to my unix server via SSH, both ftp and shell mode using port 22. However I am not able to do so in Visual Studio. I want to be able to edit files live in a GUI interface.
Any solutions for this?
Thanks! | 2010/04/07 | [
"https://superuser.com/questions/128635",
"https://superuser.com",
"https://superuser.com/users/-1/"
] | I found the correct solution via a [similar (but slightly different) question](https://superuser.com/questions/106947/make-firefox-open-new-windows-as-new-tabs-but-open-javascript-popups-as-popups):
* Type `about:config` \* into the address bar.
* Dismiss the warning.
* Change [browser.link.open\_newwindow.restriction... | I use the [Tab Mix Plus](https://addons.mozilla.org/en-US/firefox/addon/1122) extension for this. It has tons of options for tweaking tabs to work exactly how you want. I have it set to "single window" mode which makes everything open in a new tab, no matter what. |
564,684 | How is the password I enter in, say a Gmail login form, transferred to the web server securely?
* What does the browser or any client application do?
* What does the web server do? | 2009/02/19 | [
"https://Stackoverflow.com/questions/564684",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7205/"
] | By using [SSL](http://en.wikipedia.org/wiki/Secure_Sockets_Layer).
**EDIT**
A nice resource of information about security and encryption is the [Security Now!](http://www.grc.com/securitynow.htm) podcast by Steve Gibson and Leo Laporte. Steve can explain very thouroughly how security works, so go check it out!
The... | This depends entirely on whether it's an HTTPS or HTTP request. In general, HTTP authentication requests are sent in what's called "plaintext equivalent". It's Encoded in Base-64, which is easily reversed so it's basically plaintext - meaning it's not secure.
Some browsers, like Internet Explorer have some extensions ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.