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 |
|---|---|---|---|---|---|
45,292,230 | I know that Python can be a server-side language but is there a way to make python act like a client side language (like javascript) i just want to try it out if its possible thank you | 2017/07/25 | [
"https://Stackoverflow.com/questions/45292230",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8068744/"
] | Try <http://www.skulpt.org/> it is an entirely in the browser implementation of Python. | >
> Pyodide gives you a full, standard Python interpreter that runs
> entirely in the browser, with full access to the browser’s Web APIs.
>
>
>
article
<https://hacks.mozilla.org/2019/04/pyodide-bringing-the-scientific-python-stack-to-the-browser/>
download
<https://github.com/iodide-project/pyodide> |
20,840,807 | So far i have the code below:
```
$('.pagination').each(function(){
var paginationWidth = $(this).width();
var pixelOffset = '-' + paginationWidth + 'px';
console.log(paginationWidth.css('margin-left', pixelOffset ));
});
```
Console log shows "Object 57 has no method 'css'", the number being the width. ... | 2013/12/30 | [
"https://Stackoverflow.com/questions/20840807",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1341935/"
] | Try this,
```
$('.pagination').each(function(){
var page=$(this);
var paginationWidth = page.width();
var pixelOffset = '-' + paginationWidth + 'px';
console.log(page.css('margin-left', pixelOffset ));
});
```
`$(this).width()` is not returns an object.It returns an integer number which representing ... | jQuery works like
$(selector).function/event(.....
but paginationWidth is not a selector. selectors are objects to be selected.
Better to use
```
$('any-selector-to apply-margin-left').css('margin-left', pixelOffset );
``` |
24,937,871 | I want to change the for-loop to block scheme
I have this for loop that does this:
let say n = 8
and node = 4
>
> n: [1][2][3][4][5][6][7][8]
>
>
> id: 0 1 2 3 0 1 2 3
>
>
>
```
id = 0;
while (id < node){
for (i = id + 1; i <= n; i = i + node)
{
//do stuff here
id = i;
}enter code ... | 2014/07/24 | [
"https://Stackoverflow.com/questions/24937871",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2891901/"
] | Just swap the order of `field` declaration before `Default`.
So your lines:
```
public static SomeSingleton Default = new SomeSingleton();
private static int field = 0;
```
should be:
```
private static int field = 0;
public static SomeSingleton Default = new SomeSingleton();
```
The reason is due to field init... | This is because the ordering of the `static` variables. If you switch the two statements, the output becomes `1`:
```
private static int field = 0;
public static SomeSingleton Default = new SomeSingleton();
```
This is expected behavior as documented in [MSDN: Static field initialization](http://msdn.microsoft.com/... |
2,557 | I'm creating an SSL cert for my IIS server and need to know when I should choose the `Microsoft RSA SChannel Cryptographic Provider` or the `Microsoft DH SChannel Cryptographic Provider`.
**Question 1** Why would someone still need (what I assume is) a legacy certificate of 'DH'?
Given that the default is RSA/1024, I... | 2011/03/16 | [
"https://security.stackexchange.com/questions/2557",
"https://security.stackexchange.com",
"https://security.stackexchange.com/users/396/"
] | This page has some interesting benchmarks that show the effect of key size on performance: <https://securitypitfalls.wordpress.com/2014/10/06/rsa-and-ecdsa-performance/> | 1. Because many clients don't support better technology.
2. Yes there is. By now RSA/2048 is considered default secure bit-length. There are conversion tables for bit-rate security for different PKC algorithms, but those are not really sepcific cause every new research in the field changes those. There are approximate ... |
17,133 | Is USB or WIFI faster when syncing an iPhone 4 with iOS 5 to iTunes?
This SuperUser answer suggests that Wireless N might be faster than USB 2:
<https://superuser.com/questions/288705/speed-comparison-usb-vs-wireless-n-vs-cat-6>
Note: iPhone 4 is 802.11b/g/n Wi-Fi (802.11n 2.4GHz only) | 2011/07/08 | [
"https://apple.stackexchange.com/questions/17133",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/1262/"
] | USB 2.0 is faster, but Wi-Fi is better.
In practice, Wi-Fi will be superior to USB for syncing and backup since you don't have to worry about plugging it in. It can start as soon as you enter the network, throttle itself based on CPU/iOS activity. You can even start on WiFi and connect your iOS 5 device to USB and syn... | In my experience, USB sync is much faster than WiFi sync over my 802.11n AirPort, which can become an issue when I've recorded video. I was hoping that WiFi syncing meant my phone would auto-sync whenever I arrive home, but in reality it does not start syncing until you plug it in to charge within WiFi range. The upsid... |
9,252 | In order to encourage and motivate students to work harder and study more, it seems the teacher can use various competitions in class or after class. But on the other hand, competitions could cause jealousy and other destructive emotions among students and therefore affect the performance of some students adversely. Du... | 2013/04/09 | [
"https://academia.stackexchange.com/questions/9252",
"https://academia.stackexchange.com",
"https://academia.stackexchange.com/users/-1/"
] | I often have competitions in class. I try to use them primarily for motivation, not assessment.
Let me give an example: I was teaching an image processing class and we had some images of x-rays of "old master" canvas paintings. The goal was to create an algorithm that could count the density of the thread weave patte... | One key thing to consider is whether you are encouraging your students to do better for themselves or if you are encouraging them to harm other students to look *relatively* better. Clearly, you must decide how to structure the class to achieve what you want.
I've seen many teachers take the stance: I will give 10% A'... |
635,093 | I have been attempting to connect my Ubuntu 12.04 Virtual Machine to the internet. I have been searching and found some information but have not been successful so far. I have also tried Linux Mint and no network connectivity there either.
My Adapter Settings:

... | 2013/08/22 | [
"https://superuser.com/questions/635093",
"https://superuser.com",
"https://superuser.com/users/247490/"
] | Well, I figured it out. I had to create an Internal Virtual Switch and then go to the External Virtual switch and share its connection with the Internal Virtual Switch.
 | A solution without having to start/restart the guest OS.
1] Delete all the virtual switches and star over.
2] Create an External switch with external network selected either Ethernet or WiFi. (wait for a minute)
3] Now create an Internal switch. (again wait for a minute)
4] Go to Control Panel\Network and ... |
10,975,752 | One common thing I see developers doing in WinForms is forms/controls subscribing to their own events so you get
```
this.Load += new System.EventHandler(this.WelcomeQuickViewWF_Load);
this.Activated += new System.EventHandler(this.WelcomeQuickViewWF_Activated);
```
rather than
```
protected override void OnActiva... | 2012/06/11 | [
"https://Stackoverflow.com/questions/10975752",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1006869/"
] | Usually you would use AsyncTask for such a thing on Android..
***Intro:*** By default all code you write not using threads,services,etc.. will execute in `UI thread`.. That means that if you do some expensive work there, user interface will be blocked (not responsive). Good practise is to move such a expensive task to... | Use `Asyntask`, put that code in `doInBackground` , start `processbar` in `onPreExecute()` , dimiss in `onPostExecute()` |
39,367,423 | I am trying to understand OnInit functionality in angular2 and read the documentation:
>
> Description
>
>
> Implement this interface to execute custom initialization logic after
> your directive's data-bound properties have been initialized.
>
>
> ngOnInit is called right after the directive's data-bound prope... | 2016/09/07 | [
"https://Stackoverflow.com/questions/39367423",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1743843/"
] | When you have a component
```ts
@Component({
selector: 'my-component'
})
class MyComponent {
@Input() name:string;
ngOnChanges(changes) {
}
ngOnInit() {
}
}
```
you can use it like
```ts
<my-component [name]="somePropInParent"></my-component>
```
This make `name` a data-bound property.
When the val... | data-bound properties are just properties of the class |
29,021,629 | I am trying to do a code in an asynctask that takes a picture from the camera and send it to a server over UDP 100 times. However, the PictureCallback isn't called. Can someone please help me?
this is what i tried:
```
public class MainAsyncTask extends AsyncTask<Void, String, Void> {
protected static final String T... | 2015/03/12 | [
"https://Stackoverflow.com/questions/29021629",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4651619/"
] | I don't think that `AsyncTask` is the most convenient tool to do the job.
You need a `SurfaceView` that is not simply created out of nowhere, but connected to the screen. You should initialize your **camera** only once, and you cannot call `camera.takePicture()` in a loop. You can call `takePicture()` from `onPictureT... | Do you call to your AsyncTask like this? Just to create the AsyncTask is not enouge.
```
new MainAsyncTask(ActivityContext).execute();
``` |
61,394,350 | I am supposed to create 49 threads in a certain process( there are multiple processes here in my problem, so let's call the process P3). I have created those threads but the issue presents itself here: at any time, at most 5 threads are allowed to run in P3 without counting the main process. Thread 13 from P3 is allowe... | 2020/04/23 | [
"https://Stackoverflow.com/questions/61394350",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12586342/"
] | You need to call the parent class initializer to the child class initializer, like :
```
class Apple:
def __init__(self):
self.year_established = 1976
def background(self):
return ('it is established in {}'.format(self.year_established))
class Macbook(Apple):
def __init__(self):
... | Use `Base-Class (or iterface) / Inherit-Class` insted of `Child / Parent`, that whuld describe a "ownership" of classes like in this example
```
class Apple:
def __init__(self, parent=None):
self.parent = parent
class Macbook(Apple):
def __init__(self, **kwargs):
super(Macbook, self).__init__... |
57,081,653 | I am trying to copy a column of data from one dataframe to another, using the index as a reference. When copying the column, I want to fill any entry that does not appear in both dataframes with a NaN.
For example, I have these two dummy dfs:
```
df1 =
col_1 col_2 col_3 col_4
index
A 1 4 ... | 2019/07/17 | [
"https://Stackoverflow.com/questions/57081653",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4343815/"
] | Wanted to add to this as this is the only result for the Google search "tft.apply\_buckets" :)
The example for me did not work in the latest version of TFT. The following code did work for me.
Note that the buckets are specified as a rank 2 tensor, but with only one element in the inner dimension.
(I'm using the wr... | I love this answer, just wanted to add some simplification as enabling eager execution, casting, and numpy aren't really needed. Note that casting below for the float case is done by making one of the scalars a float, tensorflow standardizes on the highest fidelity data type.
The code below shows how this mapping work... |
5,696,675 | >
> **Possible Duplicate:**
>
> [How should I store GUID in MySQL tables?](https://stackoverflow.com/questions/412341/how-should-i-store-guid-in-mysql-tables)
>
>
>
Hello,
To represent a GUID in MySQL, should I just use varchar? Also, since it is something that will be used to recognize a user, should it be e... | 2011/04/17 | [
"https://Stackoverflow.com/questions/5696675",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/478573/"
] | Yes, a varchar would be a good choice. Maybe even char, because the length is fixed, tough I don't know if you'd gain anything.
And I can't see why you would want to encrypt it. | I guess you're coming from a SQL Server background. In MySQL you generally use an INTEGER(10) field with AUTO\_INCREMENT as primary key. There's not really any reason to *encrypt* that value in any way. |
1,097,969 | Can web technologies be used for a desktop application written in a traditional language like C++? I'd guess that they can, though I've not been able to find any evidence of this. I understand Adobe Air can make desktop apps using Flash, but it uses web languages like php etc. What I'd like to do is to be able to build... | 2009/07/08 | [
"https://Stackoverflow.com/questions/1097969",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/134919/"
] | An application I've been involved in , TomTom HOME 2 is built as a big C++ plugin in the Mozilla XulRunner framework. This framework is shared with Mozilla FireFox so there is a lot of commonality. TomTom HOME is a free (as in beer) download and the model part is in readable Javascript, so you can have a look to see ho... | As a sideline, I have built an effictive application using an IE form control, basically embedding a web browser into my app, which served my purposes at the time.
Edit:
<http://msdn.microsoft.com/en-ca/library/aa770041(VS.85).aspx>
<https://stackoverflow.com/questions/tagged/mshtml> |
62,621,858 | I'm new to dependency injection in .net core.
So far i was using interface and was easily able to inject dependencies via DI framework.
Now, I have one external library which holds mongo DB connection and provides necessary database operation calls.
The class accepts two parameters i.e connection string and database ... | 2020/06/28 | [
"https://Stackoverflow.com/questions/62621858",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4592855/"
] | Give this a try
```
setMenuOpen(prevMenuOpenState => !prevMenuOpenState);
```
or
```
<div
onClick={() => setMenuOpen(!menuOpen)}
>
``` | The Answer is just refactoring the code into class Component without using hooks useState. Using state and setState to update. The Problem will solve.
But If I use useState hooks the problem remains the same Whatever I do with the code. |
260,824 | When I am in battle, before I attack, it keeps saying I am feeling funky. What does that mean? Does it have any effect on my character? | 2016/03/30 | [
"https://gaming.stackexchange.com/questions/260824",
"https://gaming.stackexchange.com",
"https://gaming.stackexchange.com/users/-1/"
] | This is a status condition called **Mushroomized** that comes from mushroom type enemies. It's very similar to "confusion" in most other games where it can cause the infected player to unwantedly attack allies.
You should be able to remove the effect by visiting the hospital. IIRC there is a man in the lobby that you... | There is a second effect to confusion, your character will eventually run in directions that are not the direction you are pointing. Sometimes, the control is flipped-down is up, left is right. Other times, it is 1/4 turned-up is right, right is down, down is left, left is up. Better to get rid of it as soon as possibl... |
55,899,896 | ```
def myFunction(cond_list, input_list):
res = []
data = list(set(input_list)) # filter duplicate elements
for i in cond_list:
for j in data:
if i in j:
res.append(i)
return res
cond = ['cat', 'rabbit']
input_list = ['', 'cat 88.96%', '.', 'I have a dog', '', 'r... | 2019/04/29 | [
"https://Stackoverflow.com/questions/55899896",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9061561/"
] | You can use [itertools.product](https://docs.python.org/3/library/itertools.html#itertools.product) to generate the pairs for comparison:
```
>>> product = itertools.product(cond, input_list)
>>> [p for (p, q) in product if p in q]
['cat', 'rabbit']
``` | ```
cond = ['cat', 'rabbit'] # filter duplicate elements
input_list = ['', 'cat 88.96%', '.', 'dog 40.12%', '', 'rabbit 12.44%', '', 'tiger
85.44%']
matching = list(set([s for s in input_list if any(xs in s for xs in cond)]))
for i in matching:
print(i)
``` |
159,199 | I'm trying to find where my prints screens are going in South Park Stick of Truth.
So far I've searched in My Pictures, My Documents and the location of the game, but I've had no luck so far. :(
I'm using Windows 7. | 2014/03/08 | [
"https://gaming.stackexchange.com/questions/159199",
"https://gaming.stackexchange.com",
"https://gaming.stackexchange.com/users/30762/"
] | Assuming you have actually taken any screenshots (that is, by default, using the `F12` key), your screenshots should be stored in `{steam root}\userdata\{user id}\760\remote\213670\screenshots`
`{steam root}` is, by default, `C:\Program Data (x86)`.
`{user id}` is most likely the only directory on that level anyway.
... | The easiest way to view your screenshots is to go to `view --> screenshots` in Steam, then select the game.
Once there, you can click *"show on disk"* if you need access to the actual image file. |
73,007,498 | I'm working on PHP to output the email content. I want to check the width size through on the style of the html tag that if the width size which is greater than 400, I want to change it to 306px.
Example:
```
style="width: 406px;
```
If the width value is greater than 300, I want to change it to:
```
style="width:... | 2022/07/16 | [
"https://Stackoverflow.com/questions/73007498",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12632670/"
] | Perhaps add this somewhere:
```
<style>
div {
max-width: 306px !important;
}
</style>
``` | u can try and use max width set to 306px for that part |
196,600 | I'm testing for resilience against injection attacks on an SQL Server database.
All table names in the db are lower case, and the collation is case-sensitive, *Latin1\_General\_CS\_AS*.
The string I can send in is forced to uppercase, and can be a maximum of 26 characters in length. So I can't send in a DROP TABLE be... | 2018/01/30 | [
"https://dba.stackexchange.com/questions/196600",
"https://dba.stackexchange.com",
"https://dba.stackexchange.com/users/3752/"
] | Easy:
```
GRANT EXECUTE TO LowlyDBA
```
Or, I guess in this case it'd be
```
grant execute to lowlydba
```
Take your pick of variations on this.
In all likelihood you may be able to test this now against your current system, but any number of small changes in the database over time could invalidate your testin... | You could create a table that you then fill up until the end of time or disk space runs out whichever comes first.
```
declare @S char(26);
set @S = 'create table t(c char(99))';
exec (@S);
set @S = 'insert t values('''')'
exec (@S);
set @S = 'insert t select c from t'
exec (@S);
exec (@S);
exec (@S);
exec (@S);
--... |
412,610 | I'm trying to find a word or short phrase that generally describes *people* that have dietary requirements, food restrictions, sensitivities, and even preferences. The phrase might apply to different kinds of restrictions, might include taste likes / dislikes, etc.
Instead of saying something like "we help people with... | 2017/10/03 | [
"https://english.stackexchange.com/questions/412610",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/260272/"
] | There is **no good word** for these.
There are obviously conditions (diabetes, celiac disease, acid reflux, etc.) that limit what people can eat, but most people do not want to define themselves by their conditions, any more than they want to define themselves by gender, age, or other things that are *attributes* of ... | I shall probably regret this when I see how many points I lose . . .
When there is no suitable word for something, it is time to expand the English language and develop a new word.
I propose the word 'digestic'.
I cannot see any connotations to the word and nobody should be offended by it or embarrassed to say, 'I ... |
743,108 | I have a CISCO ASA 5506-X with 4 configured interfaces and a set of access-lists etc. It is configured via CLI and is running in routed mode, not transparent. Everything is running well, but now I have a problem I could not yet solve:
One of the interfaces contains a subnet (192.168.2.\*) with devices that send out a ... | 2015/12/15 | [
"https://serverfault.com/questions/743108",
"https://serverfault.com",
"https://serverfault.com/users/11877/"
] | I think the issues here is that you misunderstand what 255.255.255.255 means. Its not a "global Broadcast". The definition from the RFC (<https://www.rfc-editor.org/rfc/rfc919>):
>
> "The address 255.255.255.255 denotes a broadcast on a local hardware
> network, which must not be forwarded. This address may be used, ... | There is no feature for this in the current version (probably for security reasons). Cisco implemented "dhcprelay" instead and didn't provide a means for more general broadcast forwarding.
I'd suggest adding another device outside the ASA FW that could perform the same role (A Cisco router or a Linux machine perhaps).... |
18,271,282 | I saw a few questions in stackoverflow, but they all refer to old answers (from 2004) and using hibernate xml mappings.
I am writing an API in Java, which will return products which are stored in the database based on an algorithm.
The API would also get a locale and decide to return the name in the locale language.
... | 2013/08/16 | [
"https://Stackoverflow.com/questions/18271282",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/264419/"
] | Try [bringSubviewToFront](http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIView_Class/UIView/UIView.html#//apple_ref/occ/instm/UIView/bringSubviewToFront%3a)
```
[youtView bringSubviewToFront:youtBtn];
``` | Use :
```
[self.view bringSubviewToFront:button];
```
Use your parent view on which buttons are added instead of self.view.
And make sure the order of above code for buttons.
Above code for latest button will come above of all buttons(view). |
17,369 | Is the quest "You Only Die Once a Night" even possible without Celerity? I'm running back and forth between the two gates, and no matter how fast I blast these Zombies heads off, I'm just wasting too much time going back and forth, and they're making it out of the cemetery around the 2 minute mark every time?
I'm play... | 2011/02/28 | [
"https://gaming.stackexchange.com/questions/17369",
"https://gaming.stackexchange.com",
"https://gaming.stackexchange.com/users/3129/"
] | I just beat it as a Tremere, and it was incredibly difficult. For most of it, I used a pistol, walking up close to each zombie allowing me to pop them in the head, which is a 1-hit kill no matter your firearms skill. At about 1:30 left, things started to get crazy and I ended up having to run back and forth between gat... | It's possible. I beat it with Malkavian. What I did was use Auspex and only target the light blue color zombies - those are the only zombie that will attack the gate. and once more than 3 zombie at the gate I drop Mass Hysteria and it stun them long enough for me to run to and back both gates to stun lock them. And cle... |
30,435,134 | I am integrating Map Annotation in my app. I am Adding Annotations on Map as below. All annotations are added successfully on MAP.
```
func mapView(mapView: MKMapView!, viewForAnnotation annotation: MKAnnotation!) -> MKAnnotationView! {
if (annotation is MKUserLocation) {
return nil
}
... | 2015/05/25 | [
"https://Stackoverflow.com/questions/30435134",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2530594/"
] | After spending hours to try to figure out the problem, I updated R (v 3.2.0) and everything works fine now.
It is not clear if the problem was due to some packages conflict, for sure it wasn't an `RStudio` problem (as I had initially thought). | To add a little to this: It seems to be a bug with the `echo` parameter which defaults to `TRUE`. Setting it to false with `knitr` and `pdfLaTeX` as a renderer worked for me. In case you're in a situation where you can't update because of dependencies and/or rights issues, this input might be a helpful adhoc fix, since... |
15,261,876 | I am normally pretty good with this, but I am having trouble with the `NSDate` object. I need a `NSDate` object set for tomorrow at 8am (relatively). How would I do this and what is the simplest method? | 2013/03/07 | [
"https://Stackoverflow.com/questions/15261876",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1740273/"
] | Here's how [WWDC 2011 session 117 - Performing Calendar Calculations](https://developer.apple.com/videos/wwdc/2011/?id=117) taught me:
```
NSDate* now = [NSDate date] ;
NSDateComponents* tomorrowComponents = [NSDateComponents new] ;
tomorrowComponents.day = 1 ;
NSCalendar* calendar = [NSCalendar currentCalendar] ;
NS... | **Swift 3+**
```
private func tomorrowMorning() -> Date? {
let now = Date()
var tomorrowComponents = DateComponents()
tomorrowComponents.day = 1
let calendar = Calendar.current
if let tomorrow = calendar.date(byAdding: tomorrowComponents, to: now) {
let components: Set<Calendar.Component> =... |
97,996 | How can an ultra-deep hole or canyon form naturally on an earth like world?
By ultra-deep I’m thinking something like the Marianas Trench but on land and not filled with water.
If it’s not possible why not and what would be a more realistic depth be?
If it is possible how much deeper might it realistically become?
... | 2017/11/15 | [
"https://worldbuilding.stackexchange.com/questions/97996",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/42450/"
] | The fundamental problem is that as the trench becomes deeper and deeper, the walls will tend to crumble because of the hydrostatic pressure pushing sideways. Underwater trenches can be deeper than trenches on land because the pressure of column of water in the trench serves to counter in part the pressure of the column... | I would suggest you consider tectonic plates splitting apart. The plates would perhaps have first pushed against each other, and now they are moving away from each other. Of course, the area would be very seismically active. |
102,674 | As a nonnative speaker, I have been curious about the difference between "what car" and "what kind of car". To me, these two seem exactly similar.
For example, when I go to the car dealership, a salesman asks, "what car would you like to buy?" or "what kind of car would you like to buy?"
What is the difference betwe... | 2016/09/04 | [
"https://ell.stackexchange.com/questions/102674",
"https://ell.stackexchange.com",
"https://ell.stackexchange.com/users/27282/"
] | Yes, there is a difference.
*What kind of car* involves questions such as the following: Do you want to buy a Kia, an Acura, a BMW, or a Ford? Do you want to by coupe, a sedan, or an SUV? Do you want the car to have a manual or automatic transmission? Do you want two-wheel or four-wheel drive? Etc.
*What car* in you... | The first question asks what particular car (*any* make or model) would you like to buy, and the second question asks what kind of car (a *specific* make or model) would you like to buy.
This is summary of your sentences.
What car would you like to buy? = You would like to buy what car.
You | would like | to buy wha... |
20,613,056 | I'm writing a program with AmMaps where I want a user to click on a map of a country, and to be able to select and save locations.
I'm stuck on getting data back after the user clicks on the map. I used the "clickMapObject" event on another page, but in this case they aren't clicking anything.
```
<script>
var ma... | 2013/12/16 | [
"https://Stackoverflow.com/questions/20613056",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1098100/"
] | If you really really really want to do it:
```
static_cast<_T*>(this)->f2();
```
As people have mentioned, this is the [curiously recuring template pattern](https://en.wikipedia.org/wiki/Curiously_recurring_template_pattern)! | A base class should have no notion of its children. Attempt to call a child method from base class is a sure sign of bad architecture. Virtual functions will not help you here by the way.
If you **have to** call a child's function from the base class you can do so just like you would do from any other function in you... |
185,870 | In fiction, beings that can change shape can do so extremely rapidly and are immediately able to function in their new shape. While there is some precedent for the latter in nature (butterflies can *fly* more or less on emergence from their cocoon, and most ungulates can run within hours of birth), these critters are "... | 2020/09/19 | [
"https://worldbuilding.stackexchange.com/questions/185870",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/43697/"
] | ### 3 weeks.
I had the misfortune of recently having a condition known as "Bells Palsy". Its when nerves on half of your face seize up and you loose control of many of your facial muscles. I looked like a stroke victim.
I had a week with a totally paralysed half face (couldn't even shut my left eye to sleep), about 3... | I'm going to post this as an answer rather than a post-mortem, as it's going to be on the lengthy side. Thank you everyone that answered! I consider all of the answers *useful*, and most were helpful. (Willk's is the exception because it operates on an incorrect assumption, which was totally my fault. As I already note... |
261,655 | I have a list of tuples like this:
```
[
('a', 1),
('a', 2),
('a', 3),
('b', 1),
('b', 2),
('c', 1),
]
```
I want to iterate through this keying by the first item, so, for example, I could print something like this:
```
a 1 2 3
b 1 2
c 1
```
How would I go about doing this without keeping an item to track whether... | 2008/11/04 | [
"https://Stackoverflow.com/questions/261655",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18909/"
] | Slightly simpler...
```py
from collections import defaultdict
fq = defaultdict(list)
for n, v in myList:
fq[n].append(v)
print(fq) # defaultdict(<type 'list'>, {'a': [1, 2, 3], 'c': [1], 'b': [1, 2]})
``` | A solution using groupby
```
from itertools import groupby
l = [('a',1), ('a', 2),('a', 3),('b', 1),('b', 2),('c', 1),]
[(label, [v for l,v in value]) for (label, value) in groupby(l, lambda x:x[0])]
```
Output:
```
[('a', [1, 2, 3]), ('b', [1, 2]), ('c', [1])]
```
`groupby(l, lambda x:x[0])` gives you an iterato... |
89,405 | I am flying from the US in May and I have a golfing size umbrella as a souvenir which I want to bring back but I already have 2 luggages and can't bring the umbrella as a carry on for safety reasons. Will they allow it be checked it in? | 2017/03/07 | [
"https://travel.stackexchange.com/questions/89405",
"https://travel.stackexchange.com",
"https://travel.stackexchange.com/users/58317/"
] | Ok, so I have done some research and so far cheapest way is to get a Revolut card.
On 504 USD from EUR, the exchange loss was 2.19 EUR compared to the rate at Google (Google rate is 475.85, Revolut 478.04) which is way better than I would get at any local bank in UK.
The bank of choice is [Union Commercial bank](htt... | Last time I was in Cambodia, which was a few years ago, Vattanak Bank was free, for European cards only. As the article says Canadia used be free but that was some years ago. According to the article you linked though, Maybank is still free, so I'd give them a go.
I have never paid an ATM fee in Cambodia, I was always... |
44,826,568 | Users owns licenses, and a plan is a combination of licenses.
Sometimes a user owns an individual license, which is not part of a plan.
I want to count the number of users per plan. In the exemple below, it should return :
```
PlanName | Number of Users
P1 | 1
P2 | 2
```
Tables :
```
Users ... | 2017/06/29 | [
"https://Stackoverflow.com/questions/44826568",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8231785/"
] | I think you're printing the whole response, when really you want to drill down and get elements inside it. Try this:
```
print(info[0]["faceAttributes"]["glasses"])
```
I'm not sure how the API works so I don't know what your specified params are actually doing, but this should work on this end.
EDIT: Thank you to ... | This looks more like a dictionary than a list. Dictionaries are defined using the { key: value } syntax, and can be referenced by the value for their key. In your code, you have `faceAttributes` as a key that for value contains another dictionary with a key `glasses` leading to the last value that you want.
Your info ... |
413,915 | I have a df which looks like that:
| ID | Happy |
| --- | --- |
| 0 | Very |
| 1 | Little |
I'm trying to convert it into an attribute table:
```
headers = [col for col in df.columns]
fieldlist = QgsFields()
fieldlist.append(QgsField(headers[0],QVariant.Int))
for name in headers[1:]:
fieldlist.append(QgsField(na... | 2021/10/14 | [
"https://gis.stackexchange.com/questions/413915",
"https://gis.stackexchange.com",
"https://gis.stackexchange.com/users/187914/"
] | My suggested process is to run a Minimum Bounding Geometry, rectangle by width across the buildings to get a polygon with four corners. Connect the four corners in a cross (using a script). Finally clip the cross with the building footprint to ensure the crossed lines are only within the building footprint.
The script... | Variation of Mark answer, but without scripting. So, convert minimum bounding rectangles to vertices and select them by attribute:
```
mod( "OBJECTID",5)=1 OR mod( "OBJECTID",5)=3
```
It will select 2 opposite corners of individual rectangles, because each is made of 5 points. Use points to line tool with ORIG\_FID ... |
219,184 | I am using a desktop with a wired connection. I can use Skype, surf the web. I can login to Steam on the browser.
I can't connect to League of Legends (logging in gives me a "Can't connect to maestro server" error). I can't connect to Steam (which gives me a "Can't connect to servers. Check your connection." error). I... | 2015/05/12 | [
"https://gaming.stackexchange.com/questions/219184",
"https://gaming.stackexchange.com",
"https://gaming.stackexchange.com/users/112594/"
] | According to the League of Legends Forums ([here](http://forums.na.leagueoflegends.com/board/showthread.php?t=2648025)) you can try this:
Some sort of Maestro Error
--------------------------
1. Restart your computer
2. Temporarily Disable/Make exceptions in your Anti-virus/Anti-spyware software
3. Temporarily Disabl... | That thing happend to me before and there is MANY reasons why you can't connect to maestro server but you have to check 1 thing right now it might be sound but most people even programmers Don't check it first.
(Register The one and the only)
No matter how many times you will delete a file or reinstall it
as long... |
214,611 | To me, as a macroscopic observer of light, it appears that light moves in straight lines. If I shine a light at object A and object B moves between me and object A, the light hits, i.e. gets blocked by object B and no longer hits object A.
However, since light is a transverse wave, doesn't that mean it is oscillating ... | 2015/10/26 | [
"https://physics.stackexchange.com/questions/214611",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/96629/"
] | >
> Thus, say there was a radio wave with a wavelength of 1 meter. Could this radio wave then dodge around object B and still hit object A, assuming object B is smaller than 1 meter, say a basketball?
>
>
>
Waves of large wave lengths can indeed 'wash around' an object that is sufficiently smaller than the wave le... | [Aragos or Poisson spot](https://en.wikipedia.org/wiki/Arago_spot)
During the 19th century scientists were still undecided if light is a wave
phenomenon or consisting of particles. Poisson thought he refuted the wave
theory by predicting correctly that a bright point should appear in the middle
of a shadow if the ligh... |
9,066,640 | Hi I have a like box on my website scoreoid.net which already has 97 likes I'm using the Open Graph API however my Facebook is not showing the same amount of likes. I'm not sure why is it possible to have both the site and the Facebook company page match makes no sense that there different. | 2012/01/30 | [
"https://Stackoverflow.com/questions/9066640",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1178416/"
] | The first `if` statement looks good - you're checking to see if the longitude of the point lies within the longitude of the polygon segment.
The second `if` should be interpolating the intercept of the segment with the exact longitude of the point, and determining if that intercept is above or below the point. I don't... | You can use my clone of the libkml variant which I have mirrored in github here: <https://github.com/gumdal/libkml-pointinpolygon>
With help of the author of this open source, a module is designed which will indicate whether the given point is inside the KML polygon or not. Make sure that you check the branch "libkml-... |
10,344,316 | i have already read the spring social document but the part of configuration is Java based, but my project's configuration is xml based. so please tell me how config spring social in spring xml config file. thank you and sorry for my poor english | 2012/04/27 | [
"https://Stackoverflow.com/questions/10344316",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1360170/"
] | You need call the containableBehaivor on your model
```
<?php
class Item extends AppModel {
public $actsAs = array('Containable');
}
```
in your controller you can make the query
```
$items = $this->Item->find('all', array(
'contain'=>array(
'ItemDetail', ... | You could also try something like this:
```
$this->Item->hasMany['Favorite']['conditions']['member_id'] = 8;
```
Which has the same effect as rebinding the model with the condition.
Just a possible issue. The above will add the condition for the rest of the request, if you want to rollback to the previous behavior,... |
273,450 | Has anybody implemented a feature where if the user has not touched the screen for a certain time period, you take a certain action? I'm trying to figure out the best way to do that.
There's this somewhat-related method in UIApplication:
```
[UIApplication sharedApplication].idleTimerDisabled;
```
It'd be nice if y... | 2008/11/07 | [
"https://Stackoverflow.com/questions/273450",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/544/"
] | Here's the answer I had been looking for:
Have your application delegate subclass UIApplication. In the implementation file, override the sendEvent: method like so:
```
- (void)sendEvent:(UIEvent *)event {
[super sendEvent:event];
// Only want to reset the timer on a Began touch or an Ended touch, to reduce ... | Actually the subclassing idea works great. Just don't make your delegate the `UIApplication` subclass. Create another file that inherits from `UIApplication` (e.g. myApp). In IB set the class of the `fileOwner` object to `myApp` and in myApp.m implement the `sendEvent` method as above. In main.m do:
```
int retVal = U... |
1,644,656 | Suppose $x$ and $y$ are some integers satisfying $$x^2-16=y^3.$$ I'm trying to show that $x+4$ and $x-4$ are both perfect cubes.
I know that the greatest common divisor of $x+4$ and $x-4$ must divide $8$, but I don't know where to go from there. Would anyone be able to help? | 2016/02/07 | [
"https://math.stackexchange.com/questions/1644656",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/304680/"
] | If prime $p$ divides $x^2-16=(x+4)(x-4),$
$p^3$ must divide $(x+4)(x-4)$
But if $p$ divides both, $p$ must divide $x+4-(x-4)=8$
So, if $p>2,p^3$ must divide exactly one of $x+4,x-4$
For $p=2,$
if the highest power of $2$ that divides $x+4$ is $a$ and $x+4=c2^a$ where $c$ is odd
If $a>3, x-4=8(c2^{a-3}-1),$ then $... | We rewrite the equation as $(x-4)(x+4)=y^3$. We know that $\gcd(x-4,x+4) \mid 8$, so for every prime $p>2$ the factors $p$ are either in $x-4$ or $x+4$.
If $y$ is even, at least one of $x-4$ and $x+4$ is divisble by 4, and hence they are both divisible by 4. But then $4 \mid y$, so one of them is divisible by 8 and he... |
2,186,525 | This is what I have:
```
glob(os.path.join('src','*.c'))
```
but I want to search the subfolders of src. Something like this would work:
```
glob(os.path.join('src','*.c'))
glob(os.path.join('src','*','*.c'))
glob(os.path.join('src','*','*','*.c'))
glob(os.path.join('src','*','*','*','*.c'))
```
But this is obvio... | 2010/02/02 | [
"https://Stackoverflow.com/questions/2186525",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/169175/"
] | Here is my solution using list comprehension to search for **multiple** file extensions **recursively** in a directory and all subdirectories:
```
import os, glob
def _globrec(path, *exts):
""" Glob recursively a directory and all subdirectories for multiple file extensions
Note: Glob is case-insensitive, i. e. ... | I modified the top answer in this posting.. and recently created this script which will loop through all files in a given directory (searchdir) and the sub-directories under it... and prints filename, rootdir, modified/creation date, and size.
Hope this helps someone... and they can walk the directory and get fileinfo... |
38,846,414 | I was trying to write a small perl script to understand `Getopt::Long`.
Below is the script:
```
#!/usr/bin/perl
use strict;
use Getopt::Long;
my $op_type = "";
my @q_users;
GetOptions (
'query' => $op_type = "query",
'create' => $op_type = "create",
'modify' => $op_type = "modify",
'delete' => $op_type = ... | 2016/08/09 | [
"https://Stackoverflow.com/questions/38846414",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1984289/"
] | You were very close, but I think you slightly misread the [Getopt::Long documentation](https://metacpan.org/pod/Getopt::Long). Any code that you want to run when an option is found needs to be in a subroutine.
```
#!/usr/bin/perl
use strict;
use Getopt::Long;
my $op_type = "";
my @q_users;
GetOptions (
'query' =... | **Explanation of what your code does**
You are misunderstanding the syntax. Let's add some parenthesis to clarify how Perl sees this code.
```
GetOptions(
'query' => ( $op_type = "query" ),
'create' => ( $op_type = "create" ),
'modify' => ( $op_type = "modify" ),
'delete' => ( $op_type = "delete" ),
'user... |
765,090 | I believe that the best way to save your application state is to a traditional relational database which most of the time its table structure is pretty much represent the data model of our system + meta data.
However other guys in my team think that today it's best to simply serialize the entire object graph to a bina... | 2009/04/19 | [
"https://Stackoverflow.com/questions/765090",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/55373/"
] | For transfer and offline storage, serialization is fine; but for active use, some kind of database is far preferable.
Typically (as you say), without a database, you need to deserialize the entire stream to perform any query, which makes it hard to scale. Add the inherent issues with threading etc, and you're asking f... | Yes propably true. The downside is that you must retrieve the whole object which is like retrieving all rows from a table. And if it's big it will be a downside. But if it ain't so big and with my hobbyprojects they are not, so maybe they should be a perfect match? |
96 | I have deleted a validation rule in my dev environment. Is there any way to comunicate this through a change set to our QA environment or will this have to be done manualy? | 2012/08/01 | [
"https://salesforce.stackexchange.com/questions/96",
"https://salesforce.stackexchange.com",
"https://salesforce.stackexchange.com/users/43/"
] | Using the ANT-based [Force.com Migration Tool](http://www.salesforce.com/us/developer/docs/daas/index.htm) you can build deployments that can add, change or delete objects as well as test changes. The download comes with a sample build.xml file and has an entry for removing code. You will have to build an XML file desc... | I prefer change sets over Ant, but as Mike Chale pointed out, you lose the ability to handle any form of deletes and even renaming of picklist values. I keep track of these in Evernote and reproduce them in Production during deployment. |
19,339,022 | I have a lot of constant variables in my application. In this application I import a module. As part of testing I would like to call from a function in said imported module that prints out the variable's name and their values.
OK so this is not my code but this shows the concept of what I would like to do:
```
-main.... | 2013/10/12 | [
"https://Stackoverflow.com/questions/19339022",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/34475/"
] | Using [`inspect` module](http://docs.python.org/2/library/inspect.html):
```
import inspect
def ShowVars(varlist):
frame = inspect.currentframe().f_back
g = frame.f_globals
l = frame.f_locals
for name in varlist:
print('{} -> {}'.format(name, l.get(name, g.get(name))))
```
---
**ALTERNATIVE... | ```
members = dir(module)
for item in members:
if not eval('hasattr(module.%s, "__call__")' % item):
print item, eval("module.%s" % item)
```
Should give you a first pass but you might wish to filter out things that start with \_ and other items. |
69,192,163 | How can I get the value of a cookie in oracle from a request that was originated with ajax from a non-apex page (inside an apex server)?
I wanted to start by creating a function that returns the value of the login cookie and use that function to return the value to the browser to see that it can be done.
So I created... | 2021/09/15 | [
"https://Stackoverflow.com/questions/69192163",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3133418/"
] | This is what I think is happening: The cookie is sent as part of the http request header of your apex application call. The rest call is *another* http request, unrelated to your apex http request and I don’t believe the header of that request includes the cookie. So in the database session that is created as part of y... | To get a cookie from an AJAX request within APEX, you can use the `OWA_COOKIE` package, but you do not need to define any templates or handlers. It can all be done from within the page (or calling an external procedure from within the page). Below are the steps I used to get the JSESSIONID cookie.
I have built an [exa... |
14,361,022 | Say I have the following function:
```
sqrt_x = function(x) {
sqrtx = x^0.5
return(list("sqrtx" = sqrt))
}
attr(sqrt_x, "comment") <- "This is a comment to be placed on two different lines"
```
if I type
```
comment(sqrt_x)
```
I get
```
[1] "This is a comment to be placed on two different lines"
`... | 2013/01/16 | [
"https://Stackoverflow.com/questions/14361022",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1889612/"
] | You can use `\n` to insert a newline. The `cat` method shows this in the way you want:
```
attr(sqrt_x, "comment") <- "This is a comment to be placed on two\ndifferent lines"
cat(comment(sqrt_x))
This is a comment to be placed on two
different lines
``` | This is a bit of a hack, and maybe not what you want, but if you provide a multi-element `character` vector, and the lines are long enough that R's default formatting decides they should be on multiple lines, you may get what you want:
```
comment(sqrt_x) <- c("This is a comment ",
... |
2,314,500 | We're using git with a central repo (using Gitosis). I've created a post-receive hook to generate an email to the dev mailing list whenever changes are pushed to the central repo, and to generate documentation from the documentation folder in the git repo.
Therefore, in ~git/ I've got a directory, we'll call it 'a' th... | 2010/02/22 | [
"https://Stackoverflow.com/questions/2314500",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2933/"
] | You need more diagnostics, e.g.,
```
function die {
echo "$*" >&2; exit 1
}
function checkgit {
[ -d "$1/.git" ] || die "$1 could not possibly be a git repo; $1/.git is not a dir"
}
```
At this point, in the subshell right after the parenthesis, you can try stuff like
```
set -x # show exactly what's executed ... | `unset GIT_DIR` is a solution which works for the fatal error you are seeing.
This applies to all scripts in hooks (post-update is another common one), which uses the git command inside it. git command uses the GIT\_DIR from env instead of pwd.
See <https://stackoverflow.com/a/4100577> for further explanation. |
16,473,798 | The EDIT of all edits: after literally months working on it, the issue seems to be when some/all of the elements inside the current element are floated/absolutely positioned. This seems to interfere with the sliding.
If you have this same problem, I wish you luck in resolving your issue.
Original Post:
Pretty simple... | 2013/05/10 | [
"https://Stackoverflow.com/questions/16473798",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1851509/"
] | If your slides are positioned absolutely, animate them using the left property. If they're relative, then switch out the left for margin-left.
Considering your HTML looks similar to this:
```
<div id="mainContainer">
<div class="slide"></div>
<div class="slide"></div>
</div>
#mainContainer {}
.slide {position:... | Include the jquery as well as jquery ui js and css files
there is no need for custom js files.
then the codes below can be used :
**$(this).effect( "slide", "right" ); or
$(this).effect('slide', { direction: 'down'}, 500);** |
2,727,526 | I have to compute $\lim\_{n\rightarrow\infty}\frac{n^n}{(n!)^2}$.
I tried say that this limit exists and it's l, so we have $\lim\_{n\rightarrow\infty}\frac{n^n}{(n!)^2} = L$ then I rewrited it as:
$\lim\_{n\rightarrow\infty}(\frac{\sqrt n}{\sqrt[n]{n!}})^{2n}$ then I used natural log over the whole expresion but did... | 2018/04/08 | [
"https://math.stackexchange.com/questions/2727526",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/547191/"
] | By ratio test
$$\frac{(n+1)^{n+1}}{((n+1)!)^2}\frac{(n!)^2}{n^n}=\frac1{n+1}\left(1+\frac1n\right)^n\to 0$$
then
$$\lim\_{n\rightarrow\infty}\frac{n^n}{(n!)^2}=0$$ | By the root test, the limit is
$n/(n!)^{2/n}$.
By looking at the last 2/3 of 1 to n,
$n! > (n/3)^{2n/3}$
so $(n!)^{2/n} > (n/3)^{4/3}$
so the ratio is less than
$3^{4/3}/n^{1/3}$
which goes to zero.
This method csn be used to shiw that
$n^n/(n!)^a \to 0$
for any $a > 1$. |
12,613,620 | I am a beginner in jQuery and I was wondering how to validate the form before submission specifically for check boxes.
I am creating a simple check list form where my user would tick a check box if he finished that step. What I am planning to do is that, the script would prevent the form submission if there is an "unt... | 2012/09/27 | [
"https://Stackoverflow.com/questions/12613620",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1699078/"
] | You have multiple elements with identical `id` attributes. `id`s are unique and should refer to one element. If you plan on grouping multiple elements together, use a `class` attribute instead.
Also, don't bind events using `onclick`. Just use the jQuery `.on('click'` handler.
**HTML**:
```
<div class="container">
... | A couple of things:
1.) you have multiple elements with the same ID (container). That is not valid html and jquery will only return the first element it finds when searching by ID.
2.) You are binding an event to the change only after the user clicks the check button. I think you could just bind to the .tick change e... |
52 | Since this is one of the [7 Essential Meta Questions of Every Beta](http://blog.stackoverflow.com/2010/07/the-7-essential-meta-questions-of-every-beta/)...
**What should go in our FAQ?**
Most of the FAQ is boilerplate, but we need to determine the on-topic and off-topic subjects that go into that particular section o... | 2010/07/17 | [
"https://gamedev.meta.stackexchange.com/questions/52",
"https://gamedev.meta.stackexchange.com",
"https://gamedev.meta.stackexchange.com/users/321/"
] | **{Off-topic}**
Hints, tips, strategies or cheat codes for games
------------------------------------------------ | **{On-topic}**
**Programming questions *unique* to video game development, or where a professional game developer would give a *substantially different* answer than other programmers (general programming questions should be asked on [StackOverflow](http://stackoverflow.com))**
([Taken from the bullet list in my answe... |
47,925 | Consider the following puzzle type proposed by [JonMark Perry](https://puzzling.stackexchange.com/a/47842/5373).
>
> Start with a square grid of arrows, each one pointing in one of the four cardinal directions. For example:
>
>
> [](https://i.stack.imgur.com/QvVF1.png)... | 2017/01/12 | [
"https://puzzling.stackexchange.com/questions/47925",
"https://puzzling.stackexchange.com",
"https://puzzling.stackexchange.com/users/5373/"
] | No it's not always solvable... consider
>
> all arrows pointing upwards. Then you keep going upwards until you 'fall off' i.e run out of room. As for solvability, I have no idea for simple conditions. For grid size, case bash small grids maybe?
>
>
>
I'll post here as I investigate. | For a grid of any size there are trivial examples where one reaches the bottom right corner, and trivial examples where one doesn't.
>
> If the top left arrow points up you're off the grid immediately.
>
>
>
>
> If all the arrows of the rightmost column point down and the top row of all columns bar the rightmos... |
40,904,446 | I've been trying to validate a password text in a Modal window. When I enter the the incorrect password the alert keeps on displaying "Login is incorrect" message. Seems the while loop I am using, keeps continuing. How do I make the alert message display only once. But the Modal window should keep displaying
```js
var... | 2016/12/01 | [
"https://Stackoverflow.com/questions/40904446",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5588792/"
] | First you need to replace
```
<button onclick="promptPassword()">Submit</button>
```
to
```
<button onclick="return promptPassword()">Submit</button>
```
Then you need to use only this
```
function promptPassword( )
{
var pwd = document.getElementById("pwdText").value;
if(pwd != 'P@ssw0rd'){
al... | You're using a while loop, which will keep repeating until the condition is no longer met.
What you need is an if statement.
```
function promptPassword( ) {
if(document.getElementById("pwdText").value != 'P@ssw0rd'){
alert("Login is incorrect");
document.getElementById('pwdText').value = "";
... |
13,535,742 | ```
$insert = "INSERT INTO event_tracker_table (event_name, event_location, location_number, event_creator_username, event_creator_email)
VALUES (
'".$_POST['event_name']."',
'".$_POST['event_location']."',
'".$_POST['location_number']."',
... | 2012/11/23 | [
"https://Stackoverflow.com/questions/13535742",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1509580/"
] | Insert id is a property of the MYSQLI object and not the MYSQLI result object:
```
$statement = $mysqli->query($insert);
echo $mysqli->insert_id; // correct
echo $statement->insert_id; //not correct
```
<http://php.net/manual/en/mysqli.insert-id.php> | You can get the auto\_increment value with
```
$id = mysqli_insert_id($mysqli);
```
See [mysqli\_insert\_id](http://php.net/manual/de/mysqli.insert-id.php) for more info. |
1,438,464 | I am trying develop a SharePoint WebPart with "Visual Studio 2008 Extensions, Version 1.3".
When I try deploy or quick deploy or package or anything about deployment for my WebPart I am getting this message:
**The HTTP request is unauthorized with client authentication scheme 'Negotiate'. The authentication header r... | 2009/09/17 | [
"https://Stackoverflow.com/questions/1438464",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/60107/"
] | You may not use a sequence in a WHERE clause - it does look natural in your context, but Oracle does not allow the reference in a comparison expression.
[Edit]
This would be a PL/SQL implementation:
```
declare
v_custID number;
cursor custCur is
select customerid, name from customer
where customerid = v_custID;... | You have not created any
```
sequence
```
First create any sequence its cycle and cache. This is some basic example
```
Create Sequence seqtest1
Start With 0 -- This Is Hirarchy Starts With 0
Increment by 1 --Increments by 1
Minvalue 0 --With Minimum value 0
Maxvalue 5 ... |
2,193,231 | I am working in the Python Interactive Shell (ActiveState ActivePython 2.6.4 under Windows XP). I created a function that does what I want. However, I've cleared the screen so I can't go back and look at the function definition. It is also a multiline function so the up arrow to redisplay lines is of minimal value. Is ... | 2010/02/03 | [
"https://Stackoverflow.com/questions/2193231",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/245029/"
] | No, not really. You could write yourfunc.func\_code.co\_code (the actually compiled bytecode) to a file and then try using decompyle or unpyc to decompile them, but both projects are old and unmaintained, and have never supported decompiling very well.
It's infinitely easier to simply write your function to a file to ... | Unless there is a way of doing it on the activestate shell, no, there is no way to retrieve the exact code you've typed on the shell. At least on Linux, using the Python Shell provided by CPython there is no special way to achieve this. Maybe using iPython.
The func\_code attribute is an object representing the functi... |
4,569,730 | I have the following code for converting the integer(a score) into the character and then appending it with the player's name (player1). It gets displayed after that. It is a part of a bigger project :
```
#include <iostream>
#include <string.h>
using namespace std;
char* convertIntTochar(int number)
{
char t... | 2010/12/31 | [
"https://Stackoverflow.com/questions/4569730",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/262588/"
] | ```
char str11[] = "Player1: ";
```
This is the problem. There is not enough room for string concatenation. Try this:
```
char str11[100] = "Player1: ";
```
Better yet, use `std::string` instead of C-like `char*`. Smallest possible changes that fix string problems are these (because there exist `using namesp... | To convert int to `char *` see if you can use `itoa` with your compiler.
If it is not supported you can find its implemenation to do what you want.
That is if you have to do it using C-strings |
193,059 | Since the dawn of time, mermaids have been able to make pearls through magic. (Mermen create seashells, and these are what the mermaids wear.) These pearls form in the center of their seashell top, right over their heart, over and over throughout their lifetime, and hold a bit of the mermaid's essence (they literally p... | 2020/12/31 | [
"https://worldbuilding.stackexchange.com/questions/193059",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/80953/"
] | They just need to found a new religion, based on the worship of dragons. The dragons will reward the true faithful and punish the blasphemous ones.
* The method must result in uncontested ownership-the humans must not question that they belong to their dragon. Indoctrination is likely. **Check**
Religion and indoctri... | **Newsflash $-$ They Already Did.**
Dragons are the dominant species on the planet. The leaders of the major nations are dragons. This is a closely guarded secret, known only to the higher council mages who are paid a handsome sum for their cooperation, and for hunting down rogue anti-establishment mages.
Dragons liv... |
10,714,958 | I've implemented the Channel API w/ persistence. When I make a channel and connect the socket (this is on the real app, not the local dev\_appserver), Firebug goes nuts with log messages. I want to turn these off so I can see my OWN logs but cant find any documentation on how to disable the Channel API console logging.... | 2012/05/23 | [
"https://Stackoverflow.com/questions/10714958",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/130221/"
] | you can use `str_replace('admin','',$var_name);` if you have variable of this html. | Try using position relative with a negative left position, I don't know if you can apply those styles with no problem in your Drupal site, but at least it works in the fiddle.
<http://jsfiddle.net/cadence96/M5pfV/1/>
First give a relative position to the container moving it away of the view applying a css style of ... |
45,941,090 | The docs are not clear on this as they mention fov and viewport suggesting a portion of the entire spherical image.
Does the Google Street View API support retrieving the **entire** 360 degree equi-rectangular (lat/lon) image? | 2017/08/29 | [
"https://Stackoverflow.com/questions/45941090",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/116169/"
] | Division in Python 2.x is integer division by default.
```
>>> (15. / 8) * 0.00167322032899 ** 2
5.2493742550226314e-06
>>> from __future__ import division
>>> (15 / 8) * 0.00167322032899 ** 2
5.2493742550226314e-06
``` | Doing `15 / 8` in Python (python2) does integer division. So you get `1`, whereas Excel evaluates that to `1.875`
I assume you want a fraction, so in python use `15.0 / 8` (or `15 / 8.0` or `15.0 / 8.0`) to force a fraction instead of integer division |
22,309,362 | I have this code:
```
Ext.define('innerWindow', {
extend: 'Ext.window.Window',
title: 'title',
height: 200,
width: 500,
modal: true
});
tb = Ext.getCmp('head-toolbar');
tb.add({
text: 'Export',
menu: Ext.create('Ext.menu.Menu', {
items: [
{
text: 'Export',
... | 2014/03/10 | [
"https://Stackoverflow.com/questions/22309362",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1960836/"
] | In your code change
```
var win = new innerWindow();
```
to
```
var win = Ext.create('innerWindow');
```
Then just define your window with the form inside:
```
Ext.define('innerWindow', {
extend: 'Ext.window.Window',
title: 'title',
height: 200,
width: 500,
modal: true,
items: [{
xtyp... | **Set Extjs Script**
```
<script type='text/javascript' src='http://cdn.sencha.io/ext-4.2.0-gpl/ext-all.js'></script>
```
**Set Extjs CSS**
```
<link href="http://cdn.sencha.com/ext/gpl/4.2.0/resources/css/ext-all.css" rel="stylesheet"/>
```
**Set Code**
```
<script type='text/javascript'>
Ext.onReady(function()... |
3,523,985 | Does there exist a differentiable function with the following properties:
$f(0) = 1$
$0 < f(x) < 1$ for $ 0 < x < 1$
$f(x) = 0$ for $x \geq 1$
$f'(0) = 0$
and lastly, $f'(p) = f(p)$ for at least one value of $p$ between $0$ and $1$. | 2020/01/27 | [
"https://math.stackexchange.com/questions/3523985",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/353055/"
] | The function equal to $(x-1)^2(2x+1)$ for $x\leq 1$ and zero elsewhere satisfies all conditions except the last one ($p=1$ satisfies the condition, but no $p$ between $0$ and $1$).
However, you can modify this function by adding a continuously differentiable [bump function](https://en.wikipedia.org/wiki/Bump_function)... | Define $f(x) = \begin{cases} {1 \over 2} (54 x^3 -27 x^2 +2), & x \in [0, {1 \over 3}) \\
{1 \over 2} + {1 \over 8} (1-\cos (24 \pi (x-{1 \over 3}))),& x\in [{1 \over 3}, {2 \over 3})\\
{27 \over 2} (x-1)^2(2x-1), & x \in [{2 \over 3},1] \\
0, & x>1\end{cases}$.
Check that $f(0)=1$, $f'(0) = 0$, $f(x) = 0$ for $x \ge ... |
1,337,253 | How to show that for a cone with given volume and least curved surface area the altitude is equal to $\sqrt2$ times the radius of the base, using concept of maxima and minima? | 2015/06/24 | [
"https://math.stackexchange.com/questions/1337253",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/249868/"
] | Volume of a right circular cone, $$\mathbf{V = \frac{1}{3}\pi r^2h}$$ where **r** is the radius and **h** the altitude of the cone. Its curved surface area, $$\mathbf{CSA = \pi r\sqrt{r^2 + h^2}}$$ Now to make calculations easier we take our functions as $$\mathbf{(CSA)^2 = \pi^2 r^4 + \pi^2 r^2h^2}$$ and substitute $$... | Given with a hope to induce interest for learning the more powerful Lagrange multiplier when there are two variables.
$$ A = r \sqrt {r^2+h^2},\, V = r^2h\,$$
the method requires taking a Lagrangian like $(A- \lambda V),$
$$ \dfrac{A\_r}{A\_h}= \dfrac{V\_r}{V\_h} $$
where these are partial derivatives of $ A,V $ w.... |
55,100,098 | I want to create a line chart in `ggplot2` with 350 beer breweries. I want to count per year how many active breweries there are. I only have the start and end date of brewery activity. `tidyverse` answers prefered.
`begin_datum_jaar` is year the brewery started. `eind_datum_jaar` is in which year the brewery has ende... | 2019/03/11 | [
"https://Stackoverflow.com/questions/55100098",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5816847/"
] | Could try:
```
library(tidyverse)
df %>%
rowwise %>%
do(data.frame(brouwerij = .$brouwerijnaam,
Year = seq(.$begin_datum_jaar, .$eind_datum_jaar, by = 1))) %>%
count(Year, name = "Active breweries") %>%
ggplot(aes(x = Year, y = `Active breweries`)) +
geom_line() +
theme_minimal()
```
Or... | ```
df1 <- data.frame(year=1000:2020) # Enter range for years of choice
df1 %>%
rowwise()%>%
mutate(cnt=nrow(df %>%
filter(begin_datum_jaar<year & eind_datum_jaar>year)
)
)
``` |
1,358,539 | I have a situation where I have an Oracle procedure that is being called from at least 3 or 4 different places. I need to be able to be able to call custom-code depending on some data. The custom-code is customer-specific - so, customer A might want to do A-B-C where customer B might want to do 6-7-8 and customer C doe... | 2009/08/31 | [
"https://Stackoverflow.com/questions/1358539",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/166123/"
] | The final solution that we went with was to store the name of a procedure in a database table. We then build the SQL call and use an EXECUTE statement. | Your solution seems reasonable given the requirements, so I voted it up.
Another option would be to loop through the results from your table look-up and put calls to the procedures inside a big case statement. It would be more code, but it would have the advantage of making the dependency chain visible so you could m... |
131,021 | What's the meaning of 90-plus? More than 90? If so, please tell me more ways to say "more than 90". Thank you! | 2013/10/11 | [
"https://english.stackexchange.com/questions/131021",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/53794/"
] | *#-plus* is used typically when quantifying something with a rough estimate. Typically, when using the phrase, the implication is that there are *at least* that many. Using your example, if someone told you there were *90-plus* grapefruits, you could likely count on there being at least 90, plus a little more.
Other e... | Yes, it means more than (greater than) 90.
Example usages:
>
> * There are 90 plus dogs in that basket.
> * It'll cost 90 plus dollars to buy that dog.
> * The dog is 90 plus years old.
>
>
> |
23,692,846 | I want to click on a 3D plane with my mouse. When I do this, I want it to return a `Vector3` of where I clicked. When I use:
```
Vector3 point = Camera.main.ScreenToWorldPoint(Input.mousePosition);
```
then, it gives me the `Vector3` of the center of the plane. Not what I want. I want it to be at the position I clic... | 2014/05/16 | [
"https://Stackoverflow.com/questions/23692846",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1889720/"
] | I would guess SQL is converting it to an integer.
Code like this `select cast('00000' as varchar)` returns as you wish (00000, 00035) but `select cast('00000' as int)` returns your results (0, 35 etc) | My understanding is that you are using MSSQL server. If, yes then the default datatype for any variable or nullable column is INT |
401,117 | I just accidentally pressed Ctrl+Shift+W again and lost some work. I like using CTRL+W for individual windows, but I never want to close everything. Is there a way to disable this on Chrome? | 2012/03/15 | [
"https://superuser.com/questions/401117",
"https://superuser.com",
"https://superuser.com/users/119475/"
] | Complete version of this script. Works on new AHK versions.
* Works with any input language (assigned to key code, not key as letter)
* Only one running instance (SingleInstance force)
* Doesn't recording history of pressed keys (KeyHistory 0)
* Prevents from Ctrl+Shift+W and Ctrl+Shift+Q in Chrome
```
#NoEnv ; Rec... | Here is the autohotkey code to disable ctrl+w and ctrl+q for the tab named test1 and test2 (test1 is the title that appears on your tab. You can use also use autohotkey spy to figure out more stuff)
```
SetTitleMatchMode, Regex
#If WinActive("test1 ahk_class Chrome_WidgetWin_1") || WinActive("test2 ahk_class Chrome_W... |
34,493,305 | I just started to learn Swift and xcode and the first problem that I'm facing is how and where should I place the json file ? And how to use those files? Should I place the .json files within Assets folder ? Since I find it difficult, I would love to hear some tips or examples from you ! | 2015/12/28 | [
"https://Stackoverflow.com/questions/34493305",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3264924/"
] | Please review the below image to check where to place the file.
I suggest you to create a group and add the file in that.[](https://i.stack.imgur.com/Jy7nb.png)
After that, review the below could for using that file.
Edit: This is the updated code fo... | As per your requirement, you want to read json from that json file.
I am using SWIFTY JSON Library for that.
Find below the link for that
<https://github.com/SwiftyJSON/SwiftyJSON>
Add this library to your project.
After adding it, now review the below code:-
```
let json = JSON(data: jsonData!)
for (index, subjs... |
1,301,581 | The behaviour of `git commit -a` seems to be to include changes to submodules, if they have new commits inside them. This isn't what I normally want, and I sometimes find myself accidentally pushing a commit with submodule changes that I didn't intend to include.
Is there a way to set `git commit -a` to ignore submodu... | 2018/03/08 | [
"https://superuser.com/questions/1301581",
"https://superuser.com",
"https://superuser.com/users/414722/"
] | You can set the submodule.ignore in git config or in the .gitmodules file.
NOTE: GIT is kind of stupid with this. If you set ignore = all, to get sane behavior with git commit -a, it will ALSO ignore the submodule in git show/diff when you EXPLICITLY add them. The only way to work-around the latter is using the comman... | If you don't have a ton of submodules, what I found the most convenient is to first commit all, then run
>
> git reset HEAD^1 submodule\_path
>
>
>
You can always get a reminder of this command syntax if you run git commit --amend without any change. It will show up near the top of the commented instructions. |
21,964,936 | I'm a newbie to design pattern. And I'm trying to learn some design patterns.
I read blogs online and most of them directly show me that: this is the simple factory and this is how we use it.
I understand inheritance and interfaces, and I'm using Java, of course, I don't have a lot of experience in design systems.
M... | 2014/02/23 | [
"https://Stackoverflow.com/questions/21964936",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3342557/"
] | Because it's the most reasonable & useful thing that could happen when you only have 8 bits of space.
Discarding the *lowermost* bit would be a bad idea because now you can no longer increment the integer to get the next integer mod 28, etc... it would become useless as soon as it overflowed.
Discarding any other b... | C is a low level language, which maps closely to actual hardware. Underneath the type `char`, there is an assumption that the CPU has an 8-bit register, consisting of fixed amount of transistors and wires.
As the computer can't grow the number of physical resources, the type `char` is chosen to represent integers *mod... |
11,143,892 | I have a question about string in TCL:
```
HANDLE_NAME "/group1/team1/RON"
proc HANDLE_NAME {playerName} {
#do something here
}
```
we pass the string "/group1/team1/RON" to the proc, but somewhere inside of the HANDLE\_NAME, we only need the last part which is "RON", how to operate the input string and get the... | 2012/06/21 | [
"https://Stackoverflow.com/questions/11143892",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | ```
proc HANDLE_NAME {playerName} {
set lastPart [lindex [split $playerName "/"] end]
# ...
}
``` | Using string last to find the last forward slash. Then use string range to get the text after that.
<http://tcl.tk/man/tcl8.5/TclCmd/string.htm>
```
set mystring "/group1/team1/RON"
set slash_pos [string last "/" $mystring]
set ron_start_pos [incr slash_pos]
set ron [string range $mystring $ron_start_pos end]
``` |
1,558,243 | I need to store the datetime in CST timezone regardless of any timezone given.
The Clients who access the application are from from various time zones, like IST, CST, EST,...
I need to store all the datetime entered by the client in CST timezone to my database. And while retrieving, i need to convert back to there lo... | 2009/10/13 | [
"https://Stackoverflow.com/questions/1558243",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/111435/"
] | It is generally accepted to store all datetime values in your DB in the GMT/UTC format.
For those who want to render the UTC value to a particular time zone for different users of the application, like wilpeck mentioned, it's suggested that you determine the end users locale and:
* when persisting, store the locale ... | **Try like this.**
```
DateTime clientDateTime = DateTime.Now;
DateTime centralDateTime = TimeZoneInfo.ConvertTimeBySystemTimeZoneId(clientDateTime, "Central Standard Time");
```
**Time Zone Id**
```
DateTime currentTime = DateTime.Now;
Console.WriteLine("Current Times:");
Console.WriteLine();
Console.WriteLine("Lo... |
22,773,929 | I received a memory error while working on a project with Table View.
I replicated the storyboard on a new project and received the same error.
---
**Here's the storyboard layout:**
[01 - The Storyboard](http://i93.photobucket.com/albums/l47/carlodurso/Capturadepantalla2014-03-31alas173248_zps6ff44ae4.png)
**If t... | 2014/03/31 | [
"https://Stackoverflow.com/questions/22773929",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1672895/"
] | >
> I'm following the spec here and I'm not sure whether it allows onFulfilled to be called with multiple arguments.
>
>
>
Nope, just the first parameter will be treated as resolution value in the promise constructor. You can resolve with a composite value like an object or array.
>
> I don't care about how any... | The fulfillment value of a promise parallels the return value of a function and the rejection reason of a promise parallels the thrown exception of a function. Functions cannot return multiple values so promises must not have more than 1 fulfillment value. |
184,017 | A program that will count up the number of words in a text, as well as counting how many times a certain character shows up in the text. Only ignore spaces.
This gave me a lot of trouble as I grappled with list comprehension syntax errors.
```
class TextAnalyzer:
def __init__(self, txtFile):
self.txtConten... | 2018/01/01 | [
"https://codereview.stackexchange.com/questions/184017",
"https://codereview.stackexchange.com",
"https://codereview.stackexchange.com/users/85459/"
] | ### Incorrect counting
For a text file that ends with a space or newline character,
the `countWords` function counts 1 more word than there really are.
Before giving away the fix, I would point out a few things about this implementation:
>
>
> ```
> totalWords = 0
> for b, a in enumerate(self.txtStream):
> if ... | For the counting of characters, you could use the [`collections.Counter`](https://docs.python.org/3/library/collections.html#collections.Counter) class, which was introduced for exactly this. It even has a method [`most_common`](https://docs.python.org/3/library/collections.html#collections.Counter.most_common), which ... |
32,244,745 | I save users in a DB table via Hibernate and I am using Spring Security to authenticate:
```
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.*;
import org.springframework.security.config.annotation.authentication.builders.*;
import org.springframework.secur... | 2015/08/27 | [
"https://Stackoverflow.com/questions/32244745",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1850412/"
] | You can use [Spring Data JPA](https://docs.spring.io/spring-data/jpa/docs/current/reference/html/#reference) for user creation.
```
@Repository
public interface UserRepository extends JpaRepository<User, Long> {
}
```
usage:
```
User user = new User();
userRepository.save(user);
```
How to authenticate above user... | use this code to add authority to current user:
```
List<GrantedAuthority> authorities = new ArrayList<>();
authorities.add(new SimpleGrantedAuthority("ROLE_NEWUSERROLE');
SecurityContextHolder.getContext().setAuthentication(
new UsernamePasswordAuthenticationToken(
SecurityContextHolder.getCo... |
2,044,629 | I have the following function defined on $\mathbb{R}$:
$$f(x) = \begin{cases}
0 & \text{if $x$ irrational} \\
1/n & \text{if $x = m/n$ where $m, n$ coprime}
\end{cases}$$
I want to show that $f$ is continuous at every irrational point, and has a simple discontinuity at every rational point. **I was able to show th... | 2016/12/05 | [
"https://math.stackexchange.com/questions/2044629",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/391885/"
] | Take any $x$. Let $\epsilon > 0$, and find $N$ such that $\frac1 N < \epsilon$.
Now, I claim that there is a $\delta>0$ such that if $y \in (x-\delta,x+\delta) \backslash \{ x\}$, then $y$ is not of the form $\frac mN$ for any integer $m$. Suppose not. Then, considering $\delta$ going to zero and repeatedly contradict... | HINTS: observe that there are **a finite number** of rationals $n/m<1$ for any fixed $m$ (observe that Im not taking into account if $n$ and $m$ are coprime or not).
Now remember that exists infinite rationals of the kind $n/p<1$ where $p$ is prime.
What happen with $m$ when you approximate a number $x$ with a ration... |
23,879,410 | For example: if I want the function `equal?` recognize my own type or record, can I add a new behavior of `equal?`? without erasing or overwriting the old one?
Or for example if I want to make the function `"+"` accept also string? | 2014/05/27 | [
"https://Stackoverflow.com/questions/23879410",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/450148/"
] | So far the solutions work less than optimal in an R6RS / R7RS environment. I was thinking generics when I started playing around with this, but I didn't want to roll my own type system. Instead you supply a predicate procedure that should ensure the arguments are good for this particular procedure. It's not perfect but... | In R7RS-large (or in any Scheme, really), you can use SRFI 128 comparators, which package up the ideas of equality, ordering, and hashing, in order to make generic comparisons possible. SRFI 128 allows you to create your own comparators and use them in comparator-aware functions. For example, `<?` takes a comparator ob... |
15,990,344 | I want to select a date (my column is a timestamp type). But when in column is a NULL date, I want to return an empty string. How to do this? I wrote this:
```
SELECT
CASE WHEN to_char(last_post, 'MM-DD-YYYY HH24:MI:SS') IS NULL THEN ''
ELSE to_char(last_post, 'MM-DD-YYYY HH24:MI:SS') AS last_post END
to_c... | 2013/04/13 | [
"https://Stackoverflow.com/questions/15990344",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1612090/"
] | Using the `COALESCE()` function is the nicest approach, as it simply swaps in a substitute value in the case of a NULL. Readability is improved greatly too. :)
```
SELECT COALESCE(to_char(last_post, 'MM-DD-YYYY HH24:MI:SS'), '') AS last_post, content FROM topic;
``` | ```
select coalesce(to_char(last_post, 'MM-DD-YYYY HH24:MI:SS'), '') as last_post, content
from topic;
``` |
3,314,479 | This is a very unspecific and maybe stupid question, so I apologize for that. We recently had an exam that I failed, because I had pretty much no time to practice before that. Now I got to learn all that stuff that I should've known, yet there was one exercise where I have no clue how one would get a result.
>
> Calc... | 2019/08/05 | [
"https://math.stackexchange.com/questions/3314479",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/693803/"
] | $$\lim\_{n \to \infty}\sqrt{n} \cdot (\sqrt{n+1} - \sqrt{n})=
\lim\_{n \to \infty}\sqrt{n} \cdot \frac{(\sqrt{n+1} - \sqrt{n})}{1}=
\lim\_{n \to \infty}\sqrt{n} \cdot \frac{(\sqrt{n+1} - \sqrt{n})(\sqrt{n+1} + \sqrt{n})}{(\sqrt{n+1} + \sqrt{n})}=
\lim\_{n \to \infty}\sqrt{n}\cdot \frac{n+1-n}{\sqrt{n+1}+\sqrt n}=
\li... | $$\lim\_{h\to0^+}\frac{\sqrt{\dfrac 1h+1}-\sqrt{\dfrac 1h}}{\sqrt h}=\lim\_{h\to0}\frac{\sqrt{h+1}-1}h=\left.(\sqrt{x+1})'\right|\_{x=0}=\frac12.$$ |
23,808,808 | I want to create a dynamic variable in the loop.
I found something about eval and window but I don't know how to use this.
This is my loop and i want to create a 9 variables names from m1 to m9. I mean that the name of variable must be m1 to m9
```
for(i=1; i<10; i++){
var m+i = "Something"
}
```
Please help me... | 2014/05/22 | [
"https://Stackoverflow.com/questions/23808808",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3422998/"
] | You don't want to create 9 variables. Trust me. You want to create an object.
```
var m = {};
for(var i=1; i<10; i++){
m[i] = "Something";
}
```
You can also create an array (`m = []`), but since you are starting at `1` and not `0`, I'd suggest an object. | ```
var object = {};
var name = "m";
for(i=1; i<10; i++){
object[name+i] = "Something";
}
console.log(object.m1); // "Something", same for m2,m3,m4,m5...,m9
```
However consider if the `"m"` is really necessary, arrays are way faster:
```
var array = [];
for(i=1; i<10; i++){
array.push("Something");
}
conso... |
158,808 | The same chip can be run at 5v or 3.3v so it's tolerant to 5v so why when I run it at 3.3v can't I send in a 5v signal on an input pin? Curious on what's in the chip that makes this a bad idea. | 2015/03/08 | [
"https://electronics.stackexchange.com/questions/158808",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/61951/"
] | This is to expand on [Olin's comment about protection diodes](https://electronics.stackexchange.com/questions/158808/why-cant-the-atmega328p-accept-5-and-3-3v-signals-at-the-same-time#comment322573_158808).
The protection diode will clamp the 5V input, and it can be damaged in the process.
![enter image description... | Look at Table 28.1 Absolute Maximum Ratings - in that table, it says
"Voltage on any Pin except RESET
with respect to Ground ................................-0.5V to VCC+0.5V"
There will be protection diodes on the I/O pins that will prevent the voltage on the pin from going outside those limits. The "Vcc+0.5" limit... |
6,261,906 | I got a form with multiple comboboxes, where each combobox can be set to different values. Based on the combobox value I want to create a query filter. I want to iterate through all comboboxes and add its value to the filter if it dont say "All".
I want to do something like this:
```
XElement root = XElement.Loa... | 2011/06/07 | [
"https://Stackoverflow.com/questions/6261906",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/787007/"
] | compute how many seconds until the next minute starts, then using `setTimeout` begin rotating the pictures. Use `setInterval` to do so every 60000 milliseconds.
```
var seconds = 60 - new Date().getSeconds();
setTimeout(function(){
console.log('start');
setInterval(function(){
console.log ('iterate... | Place the code below in the BODY of a page:
```
<img />
<script>
var start = new Date().getTime(),
i = 0,
//get the node of the image to change
img = document.getElementsByTagName('IMG')[0];
setInterval(function(){
//what time is now
var now = new Date().getTime();
... |
7,403 | I've been working on a semi-awkward query in that it uses a very high number of functions given its relatively small size and scope. I was hoping to get some feedback on any ways I could format or re-factor this better?
```
select Name ,
avg(TimeProcessing / 1000 + TimeRendering / 1000 + TimeDataRetrieval / 1... | 2012/01/03 | [
"https://codereview.stackexchange.com/questions/7403",
"https://codereview.stackexchange.com",
"https://codereview.stackexchange.com/users/9360/"
] | You might want to use Common Table Expression or Should use meaningful table alias in Join.
You might also want to use indexes on your date column with <= and >= operator instead of between.
Surround your column names in [] instead of single quotes. | I agree with Nil; it seems like this might be a good situation to use a Common Table Expression.
I haven't tested this out, but below is my attempt to rewrite this query using a CTE:
```
with ReportByMonth (ReportID, [Year], [Month], [Avg Exec], [Sample]) as
(
select ReportID ,
avg(TimeProcessing / 1... |
9,709,374 | I'm just getting started with Knockout.js (always wanted to try it out, but now I finally have an excuse!) - However, I'm running into some really bad performance problems when binding a table to a relatively small set of data (around 400 rows or so).
In my model, I have the following code:
```
this.projects = ko.obs... | 2012/03/14 | [
"https://Stackoverflow.com/questions/9709374",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/392044/"
] | A solution to avoid locking up the browser when rendering a very large array is to 'throttle' the array such that only a few elements get added at a time, with a sleep in between. Here's a function which will do just that:
```
function throttledArray(getData) {
var showingDataO = ko.observableArray(),
show... | **If using IE, try closing the dev tools.**
Having the developer tools open in IE significantly slows this operation down. I'm adding ~1000 elements to an array. When having the dev tools open, this takes around 10 seconds and IE freezes over while it is happening. When i close the dev tools, the operation is instant ... |
8,223,570 | Here's my string:
`NANA TEKA KAOE FLASK LSKK`
How do I make it so that it'll look like this:
`HASH = {NANA => undef, TEKA => undef, KAOE => undef, ...`
Of course I could always split this into an array first
then loop through each value then assign them as hash
keys... but If there's a shorter/simpler w... | 2011/11/22 | [
"https://Stackoverflow.com/questions/8223570",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/423856/"
] | `@hash{ split /\s+/, $string } = ();` | I doubt if this is the most succinct way to do it, but it seems to work:
```
use warnings;
use strict;
my $string = "NAN TEKA KAOE FLASK LSKK";
my %hash = map { ($_ => undef) } split /\s+/, $string;
foreach my $key (keys %hash)
{
printf "$key => %s\n", (defined($hash{$key})) ? $hash{$key} : "undef";
}
``` |
1,856 | I have an autoranging multimeter and many AA batteries.... how do I interpret the readings when deciding to keep or discard AA (1.5 volt) batteries? | 2010/03/13 | [
"https://electronics.stackexchange.com/questions/1856",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/-1/"
] | Look up voltage curves for the chemistry of your batteries. Depends on the exact battery, but you can gauge how much power is left based on the voltage:

From this graph, when it reads 1.0V, there is roughly 20% power left, and when it reads 0.8V, roughly 5% powe... | I am assuming Alkaline batteries -- In the Energizer datasheets
the capacity is specified down to 0.8V. I would discard them
if they are less the 0.8V. If it is a battery that I may not
check too often then I might set the limit at a volt or so. |
575,647 | According to [Merriam-Webster](https://www.merriam-webster.com/words-at-play/sympathy-empathy-difference):
>
> In general, 'sympathy' is when you share the feelings of another; 'empathy' is when you understand the feelings of another but do not necessarily share them.
>
>
>
This seems at odds with the information... | 2021/09/26 | [
"https://english.stackexchange.com/questions/575647",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/97984/"
] | Merriam-Webster's view of how *sympathy* and *empathy* differ has evolved over time. In the past eighty years, MW has attempted on three occasions (that I'm aware of) to distinguish between the two terms, and each time it has thoroughly revamped its explanation.
---
***'Sympathy' and 'empathy' in Webster's Dictionary... | Etymology:
----------
Sympathy:
`2 Greek words`
1. *Sym*: Together
2. *Pathos*: Emotion
Empathy: `Ancient Greek`
From *empatheia*, denoting physical affection or passion [[source]](https://www.etymonline.com/word/empathy)
---
Cambridge Dictionary:
---------------------
Sympathy:
>
> (an expression of) understa... |
1,423,876 | Given this expression
$\displaystyle{8 \over {\sqrt 5 + 1}}$
I multiply the nominator and denominator by the conjugate:
$\displaystyle{{8 \over {\sqrt 5 + 1}} \times {{\sqrt 5 - 1}\over{\sqrt 5 -1}}}$
$\displaystyle={{8\sqrt 5 - 8} \over {\sqrt 25 - \sqrt 5 + \sqrt 5 - 1}}$
$\displaystyle={{8 \sqrt 5 - 8} \over 4}... | 2015/09/06 | [
"https://math.stackexchange.com/questions/1423876",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/248332/"
] | We can write $\displaystyle \frac{8}{\sqrt{5}+1} = \frac{8}{\sqrt{5}+1} \times \frac{\left(\sqrt{5}-1\right)}{\left(\sqrt{5}-1\right)} = \frac{8(\sqrt{5}-1)}{(\sqrt{5})^2-(1)^2} = \frac{8(\sqrt{5}-1)}{4}= 2\sqrt{5}-2$ | \begin{align}
\ {{8 \over {\sqrt 5 + 1}} \times {{\sqrt 5 - 1}\over{\sqrt 5 -1}}}
\\ \ 8 \times {(\sqrt 5 - 1)} \over {(\sqrt 5 + 1)\times {(\sqrt 5 - 1)}}
\\ \ 8 \times \sqrt 5 - 8 \over {(\sqrt 5)^2 - 1^2}
\\ \ 8 \times \sqrt 5 - 8 \over {4}
\\ \ 2 \times \sqrt 5 - 2
\end{align} |
59,230,929 | I want to initialize `true` for `checkForBST(node* rootptr)` function. What should i do? I know variable initialization but I always get confused in function initialization. Below is my `checkForBST(node* rootptr)` function:
```
bool checkForBST(node* rootptr){
queue <node*> Q;
int parent;
int ... | 2019/12/07 | [
"https://Stackoverflow.com/questions/59230929",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11781785/"
] | * You want to put the CSV values to the active Spreadsheet.
+ In your situation, the CSV values are large which is 106,974 rows and 13 columns.
* You want to achieve this using Google Apps Script.
If my understanding is correct, how about this answer? In this answer, I would like to propose 2 patterns. Please think o... | This function allows you to break up your array as you requested. You need to run initializeForAppCSVData first and setup the page length. It will setup the timebased trigger for you and you can adjust the time if necessary. Once the function gets to array.length it automatically deletes the trigger.
If you wish you c... |
59,414,874 | i am stuck with this issue:
i configured kubeadm (cluster on one dedicated server for now).
And i installed elasticsearch using helm. it is nearly working fine, except for storage. The chart is using the default StorageClass for dynamic provisioning of PVs.
So i created a default StorageClass (kubernetes.io/gce-pd / ... | 2019/12/19 | [
"https://Stackoverflow.com/questions/59414874",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/299674/"
] | The one that you must use is `std::vector::size_type`. it is usually `std::size_t` but standard doesn't specify it. it is possible one implementation uses another type. You should use it whenever you want to refer to `std::vector` size.
`uint`, `uint64_t` and even `size_t` must not be used because in every implementat... | If you need an equality or ordinal comparison only, the best type would be the one used by vector's implementation, meaning
```
std::vector<MyType>::size_type compareVar
```
This guarantees that the type you use matches the type of vector's implementation regardless of the platform.
Note that since the type is unsi... |
14,935,323 | In my app , I am displaying all audio files using `MediaStore` and `ListAdaptor` and `CursorLoader` . But it shows all audio files (m4a,wav,ogg). I only want to show mp3 files . How can I do so ?
```
String[] from = {MediaStore.MediaColumns.TITLE};
int[] to = {android.R.id.text1};
CursorLoader cursorLoader = new Cur... | 2013/02/18 | [
"https://Stackoverflow.com/questions/14935323",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/971683/"
] | Please try below code
```
ContentResolver cr = context.getContentResolver();
Uri uri = MediaStore.Files.getContentUri("external");
String[] projection = null;
String sortOrder = null;
String selectionMimeType = MediaStore.Files.FileColumns.MIME_TYPE + "=?";
String mimeType = MimeTypeMap.getSingleton().getMimeType... | See [THIS](http://alvinalexander.com/blog/post/java/how-implement-java-filefilter-list-files-directory) example, which displays only provided file extensions list. |
2,231 | It would be neat if you could see a users "User Rank" or "User Percentile Rating" within their profile. It could just be something like "Top 25%", "Within Top 250 Users", or "Rank: 4500 out of 6500 users", and would easily tell you where you rank based on score compared to all other users of SO.
This would increase th... | 2009/07/03 | [
"https://meta.stackexchange.com/questions/2231",
"https://meta.stackexchange.com",
"https://meta.stackexchange.com/users/7831/"
] | I was going to ask for the same feature and I found this as a related question. I think it would be fun to have the following variables:
* Reputation
* Rank
* Percentile rank
With the following values available:
* Current
* Highest | I like the numeric ranks.
I think named ranks would work too, but I can't really come up with suitable ones that I like other than **Newbie**, **Student** and **Freshman** (these aren't meant to be programming specific)
I was thinking something like
```
Newbie 1-500
Student 500-1k
Freshman 1k-5k
Grad... |
6,051 | I am wondering if it is better to start to ride a fixie with a relatively low gear, and as experience comes, switch to a higher gear, or if the advised practice would be to start with a higher gear, and then perhaps change it to a lower gear.
I know you need to be strong to go uphill with a high gear, but you also nee... | 2011/09/13 | [
"https://bicycles.stackexchange.com/questions/6051",
"https://bicycles.stackexchange.com",
"https://bicycles.stackexchange.com/users/2355/"
] | In general I would recommend starting low. Your legs will go through an adjustment period and you may find that your knees get sore from a larger gear. After you've ridden for a few weeks pay attention to how you're riding. If you're in a hilly area are you struggling to get up the hills? Do you find that your cadence ... | Just to provide a little perspective, track bikes on velodrome run 81" (=48x16) at a minimum. This is used as a "warm-up" gear ratio and is considered very light. After the warm-up the gears go into the 90's for specific work-outs or competition. Generally speaking, higher gear ratios are used for solo time-trial event... |
44,429,996 | I'm trying to use a component I created inside the AppModule in other modules. I get the following error though:
>
> "Uncaught (in promise): Error: Template parse errors:
>
>
> 'contacts-box' is not a known element:
>
>
> 1. If 'contacts-box' is an Angular component, then verify that it is part of this module.
> ... | 2017/06/08 | [
"https://Stackoverflow.com/questions/44429996",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6213413/"
] | In my case, my app had multiple layers of modules, so the module I was trying to import had to be added into the module parent that actually used it `pages.module.ts`, instead of `app.module.ts`. | The problem in my case was missing component declaration in the module, but even after adding the declaration the error persisted. I had stop the server and rebuild the entire project in VS Code for the error to go away. |
41,157,092 | ```
vector<int> input = {1, 2, 3, 4, 17, 117, 517, 997};
cout<< "input vector at index -1 is: " << input[-1] <<endl;
```
Using the above the code, the result will be: input at index -1 is: 0.
However, if we use follwoing :
```
vector<int> input = {1, 2, 3, 4, 17, 117, 517, 997};
cout<< "input vector at index -1 is:... | 2016/12/15 | [
"https://Stackoverflow.com/questions/41157092",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7300250/"
] | The `at` member does range-checks and responds appropriately.
The `operator []` does not. This is undefined behavior and a bug in your code.
This is explicitly stated in the docs. | The first is undefined behavior. Anything could happen. You aren't allowed to complain, no matter what happens.
The second, an exception is thrown and you don't catch it, so `std::terminate()` is called and your program dies. The end. |
18,591 | I know i am going to make a very basic question, but: how to you manage
all sound effects recorded on the dialogue mono track with the boom mic, do they stay there while everything else is rerecorded in stereo ?
the issue is about creating a stereo image of all ambients effects etc
(the final target is a 2.1 mix) | 2013/03/18 | [
"https://sound.stackexchange.com/questions/18591",
"https://sound.stackexchange.com",
"https://sound.stackexchange.com/users/5697/"
] | There is a small sample from the Purcell book available that covers PFX and guide tracks. It is available form the Focal site: <http://www.focalpress.com/uploadedFiles/Books/Book_Media/Film_and_Video/Dialogue%20Editing.pdf> | You might want to read the Book by John Purcell 'Dialogue editing...' which is about cutting and editing dialogue tracks.
If you cut out PFX from the dialogue track, you should fill that gap with roomtone. That way you can mix (and pan) those PFX independently from the dialogue track. |
54,380,301 | the following code throws a NullPointerException and I'm not sure why. If someone could point me to the error it would be much apprecciated.
The code from the MainActivity, the error is in line 4:
```
private void init(){
this.createClassifier();
this.takePhoto();
}
private void createClassifier(){
try... | 2019/01/26 | [
"https://Stackoverflow.com/questions/54380301",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10956565/"
] | We don't really have all of the pieces together for that – yet.
I'd take a look through this issue: <https://github.com/dart-lang/sdk/issues/34343>
I'll find the right person on the team to reply here with more details. | We can build Dart project to a native app via `dart2native`.
For example we have `main.dart`:
```
import 'package:ansicolor/ansicolor.dart';
main(List<String> arguments) {
AnsiPen greenPen = AnsiPen()..green();
AnsiPen greenBackGroundPen = AnsiPen()..green(bg: true);
AnsiPen redTextBlueBackgroundPen = AnsiPen... |
62,914,318 | I came across this code snippet from a blog who was asking for it's output and an explanation.
```
#include<stdio.h>
int main()
{
int *const volatile p = 5;
printf("%d\n",5/2+p);
return 0;
}
```
Here's what I understand so far:
1.The const and volatile keywords don't contribute in context of the output... | 2020/07/15 | [
"https://Stackoverflow.com/questions/62914318",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6698587/"
] | It is undefined behavior indeed, but not due to the arithmetic. Due to the wrong conversion specifier to print a pointer - `%d` instead of `%p` with an argument cast to `void *` - and to initialize a pointer by an non-zero `int` value.
To the arithmetic itself:
If the size of an `int` is `4`/ `sizeof(int) == 4` (as i... | Depending on the fact that the sizeof(int) == 4, then the command
```
int *const volatile p = 5;
```
assigns to the pointer, as initial address, (something like) 0x0005
5 is not a value, but the address, as you have not allocated some memory for it. Then, on the result of printf(), the result is 2+p, which means poi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.