qid int64 1 74.7M | question stringlengths 0 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 2 48.3k | response_k stringlengths 2 40.5k |
|---|---|---|---|---|---|
812,571 | Normally, the practice or very old way of displaying some profile page is like this:
```
www.domain.com/profile.php?u=12345
```
where `u=12345` is the user id.
In recent years, I found some website with very nice urls like:
```
www.domain.com/profile/12345
```
How do I do this in PHP?
Just as a wild guess, is i... | 2009/05/01 | [
"https://Stackoverflow.com/questions/812571",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/87473/"
] | It's actually not PHP, it's apache using mod\_rewrite. What happens is the person requests the link, www.example.com/profile/12345 and then apache chops it up using a rewrite rule making it look like this, www.example.com/profile.php?u=12345, to the server. You can find more here: [Rewrite Guide](http://httpd.apache.or... | There are lots of different ways to do this. One way is to use the RewriteRule techniques mentioned earlier to mask query string values.
One of the ways I really like is if you use the [front controller](http://martinfowler.com/eaaCatalog/frontController.html) pattern, you can also use urls like <http://yoursite.com/i... |
812,571 | Normally, the practice or very old way of displaying some profile page is like this:
```
www.domain.com/profile.php?u=12345
```
where `u=12345` is the user id.
In recent years, I found some website with very nice urls like:
```
www.domain.com/profile/12345
```
How do I do this in PHP?
Just as a wild guess, is i... | 2009/05/01 | [
"https://Stackoverflow.com/questions/812571",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/87473/"
] | I recently used the following in an application that is working well for my needs.
.htaccess
```
<IfModule mod_rewrite.c>
# enable rewrite engine
RewriteEngine On
# if requested url does not exist pass it as path info to index.php
RewriteRule ^$ index.php?/ [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{R... | There are lots of different ways to do this. One way is to use the RewriteRule techniques mentioned earlier to mask query string values.
One of the ways I really like is if you use the [front controller](http://martinfowler.com/eaaCatalog/frontController.html) pattern, you can also use urls like <http://yoursite.com/i... |
812,571 | Normally, the practice or very old way of displaying some profile page is like this:
```
www.domain.com/profile.php?u=12345
```
where `u=12345` is the user id.
In recent years, I found some website with very nice urls like:
```
www.domain.com/profile/12345
```
How do I do this in PHP?
Just as a wild guess, is i... | 2009/05/01 | [
"https://Stackoverflow.com/questions/812571",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/87473/"
] | According to [this article](https://web.archive.org/web/20140220075845/http://www.phpriot.com/articles/search-engine-urls), you want a mod\_rewrite (placed in an `.htaccess` file) rule that looks something like this:
```
RewriteEngine on
RewriteRule ^/news/([0-9]+)\.html /news.php?news_id=$1
```
And this maps reques... | Simple way to do this. Try this code. Put code in your `htaccess` file:
```
Options +FollowSymLinks
RewriteEngine on
RewriteRule profile/(.*)/ profile.php?u=$1
RewriteRule profile/(.*) profile.php?u=$1
```
It will create this type pretty URL:
>
> <http://www.domain.com/profile/12345/>
>
>
>
For more htac... |
812,571 | Normally, the practice or very old way of displaying some profile page is like this:
```
www.domain.com/profile.php?u=12345
```
where `u=12345` is the user id.
In recent years, I found some website with very nice urls like:
```
www.domain.com/profile/12345
```
How do I do this in PHP?
Just as a wild guess, is i... | 2009/05/01 | [
"https://Stackoverflow.com/questions/812571",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/87473/"
] | Simple way to do this. Try this code. Put code in your `htaccess` file:
```
Options +FollowSymLinks
RewriteEngine on
RewriteRule profile/(.*)/ profile.php?u=$1
RewriteRule profile/(.*) profile.php?u=$1
```
It will create this type pretty URL:
>
> <http://www.domain.com/profile/12345/>
>
>
>
For more htac... | ModRewrite is not the only answer. You could also use Options +MultiViews in .htaccess and then check `$_SERVER REQUEST_URI` to find everything that is in URL. |
812,571 | Normally, the practice or very old way of displaying some profile page is like this:
```
www.domain.com/profile.php?u=12345
```
where `u=12345` is the user id.
In recent years, I found some website with very nice urls like:
```
www.domain.com/profile/12345
```
How do I do this in PHP?
Just as a wild guess, is i... | 2009/05/01 | [
"https://Stackoverflow.com/questions/812571",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/87473/"
] | I try to explain this problem step by step in following example.
**0) Question**
I try to ask you like this :
i want to open page like facebook profile www.facebook.com/kaila.piyush
it get id from url and parse it to profile.php file and return featch data from database and show user to his profile
normally when ... | It's actually not PHP, it's apache using mod\_rewrite. What happens is the person requests the link, www.example.com/profile/12345 and then apache chops it up using a rewrite rule making it look like this, www.example.com/profile.php?u=12345, to the server. You can find more here: [Rewrite Guide](http://httpd.apache.or... |
812,571 | Normally, the practice or very old way of displaying some profile page is like this:
```
www.domain.com/profile.php?u=12345
```
where `u=12345` is the user id.
In recent years, I found some website with very nice urls like:
```
www.domain.com/profile/12345
```
How do I do this in PHP?
Just as a wild guess, is i... | 2009/05/01 | [
"https://Stackoverflow.com/questions/812571",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/87473/"
] | I recently used the following in an application that is working well for my needs.
.htaccess
```
<IfModule mod_rewrite.c>
# enable rewrite engine
RewriteEngine On
# if requested url does not exist pass it as path info to index.php
RewriteRule ^$ index.php?/ [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{R... | I try to explain this problem step by step in following example.
**0) Question**
I try to ask you like this :
i want to open page like facebook profile www.facebook.com/kaila.piyush
it get id from url and parse it to profile.php file and return featch data from database and show user to his profile
normally when ... |
812,571 | Normally, the practice or very old way of displaying some profile page is like this:
```
www.domain.com/profile.php?u=12345
```
where `u=12345` is the user id.
In recent years, I found some website with very nice urls like:
```
www.domain.com/profile/12345
```
How do I do this in PHP?
Just as a wild guess, is i... | 2009/05/01 | [
"https://Stackoverflow.com/questions/812571",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/87473/"
] | I try to explain this problem step by step in following example.
**0) Question**
I try to ask you like this :
i want to open page like facebook profile www.facebook.com/kaila.piyush
it get id from url and parse it to profile.php file and return featch data from database and show user to his profile
normally when ... | Simple way to do this. Try this code. Put code in your `htaccess` file:
```
Options +FollowSymLinks
RewriteEngine on
RewriteRule profile/(.*)/ profile.php?u=$1
RewriteRule profile/(.*) profile.php?u=$1
```
It will create this type pretty URL:
>
> <http://www.domain.com/profile/12345/>
>
>
>
For more htac... |
812,571 | Normally, the practice or very old way of displaying some profile page is like this:
```
www.domain.com/profile.php?u=12345
```
where `u=12345` is the user id.
In recent years, I found some website with very nice urls like:
```
www.domain.com/profile/12345
```
How do I do this in PHP?
Just as a wild guess, is i... | 2009/05/01 | [
"https://Stackoverflow.com/questions/812571",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/87473/"
] | Simple way to do this. Try this code. Put code in your `htaccess` file:
```
Options +FollowSymLinks
RewriteEngine on
RewriteRule profile/(.*)/ profile.php?u=$1
RewriteRule profile/(.*) profile.php?u=$1
```
It will create this type pretty URL:
>
> <http://www.domain.com/profile/12345/>
>
>
>
For more htac... | It looks like you are talking about a RESTful webservice.
<http://en.wikipedia.org/wiki/Representational_State_Transfer>
The .htaccess file does rewrite all URIs to point to one controller, but that is more detailed then you want to get at this point. You may want to look at [Recess](http://www.recessframework.org/)
... |
812,571 | Normally, the practice or very old way of displaying some profile page is like this:
```
www.domain.com/profile.php?u=12345
```
where `u=12345` is the user id.
In recent years, I found some website with very nice urls like:
```
www.domain.com/profile/12345
```
How do I do this in PHP?
Just as a wild guess, is i... | 2009/05/01 | [
"https://Stackoverflow.com/questions/812571",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/87473/"
] | According to [this article](https://web.archive.org/web/20140220075845/http://www.phpriot.com/articles/search-engine-urls), you want a mod\_rewrite (placed in an `.htaccess` file) rule that looks something like this:
```
RewriteEngine on
RewriteRule ^/news/([0-9]+)\.html /news.php?news_id=$1
```
And this maps reques... | It looks like you are talking about a RESTful webservice.
<http://en.wikipedia.org/wiki/Representational_State_Transfer>
The .htaccess file does rewrite all URIs to point to one controller, but that is more detailed then you want to get at this point. You may want to look at [Recess](http://www.recessframework.org/)
... |
812,571 | Normally, the practice or very old way of displaying some profile page is like this:
```
www.domain.com/profile.php?u=12345
```
where `u=12345` is the user id.
In recent years, I found some website with very nice urls like:
```
www.domain.com/profile/12345
```
How do I do this in PHP?
Just as a wild guess, is i... | 2009/05/01 | [
"https://Stackoverflow.com/questions/812571",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/87473/"
] | I recently used the following in an application that is working well for my needs.
.htaccess
```
<IfModule mod_rewrite.c>
# enable rewrite engine
RewriteEngine On
# if requested url does not exist pass it as path info to index.php
RewriteRule ^$ index.php?/ [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{R... | It looks like you are talking about a RESTful webservice.
<http://en.wikipedia.org/wiki/Representational_State_Transfer>
The .htaccess file does rewrite all URIs to point to one controller, but that is more detailed then you want to get at this point. You may want to look at [Recess](http://www.recessframework.org/)
... |
14,236,835 | I have multiple UPDATE statements inside my ExecuteSQL Task. Each one is dependent on one Vairiable e.g. MyId
```
UPDATE TABLE_A SET COL_A={Something} WHERE ID=?
UPDATE TABLE_B SET COL_B={SomeTHing} WHERE ID=?
```
This Query takes MyId Variable as Parameter.
Do i need to have as many parameters as my Update State... | 2013/01/09 | [
"https://Stackoverflow.com/questions/14236835",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1711287/"
] | Try this:
```
DECLARE @id int
SELECT @id = ?
UPDATE TABLE_A SET COL_A={Something} WHERE ID=@id
UPDATE TABLE_B SET COL_B={Something} WHERE ID=@id
``` | The other option is to change your Connection Manager from an OLE to an ADO.NET provider type. ADO.NET connection managers use [named parameters](http://technet.microsoft.com/en-us/library/cc280502.aspx) instead of `?` so you can re-use them instead of dealing with ordinal positions in the mapping tab. We often have 2 ... |
21,196,159 | I try to open other Fragment from Fragment with code:
```
btnRegister.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
register();
}
});
private void register(){
....
Intent i = new Intent(getActivity(), LoginFragment.class);
startActivity(i);
}
```
... | 2014/01/17 | [
"https://Stackoverflow.com/questions/21196159",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3099680/"
] | From the name of your class, which is the only thing we see since there is little to no code, it seems you are trying to load a `Fragment` using an `Intent`. This mechanism is what `Activities` use to start one another. Adding `Fragments` dynamically requires you use `FragmentTransaction` from `FragmentManager`.
If `... | Try this code sample.
```
private void register(){
// Create new fragment and transaction
Fragment newFragment = new LoginFragment();
FragmentTransaction transaction = getFragmentManager().beginTransaction();
// Replace whatever is in the fragment_container view with this fragment,
... |
21,196,159 | I try to open other Fragment from Fragment with code:
```
btnRegister.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
register();
}
});
private void register(){
....
Intent i = new Intent(getActivity(), LoginFragment.class);
startActivity(i);
}
```
... | 2014/01/17 | [
"https://Stackoverflow.com/questions/21196159",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3099680/"
] | It's crashing because you are trying to start a fragment using the `startActivity` function.
That's not how fragments are used. you can think of Activity as the app's window, and the Fragments as the various sections of that app, therefore if you are trying to change from one fragment to another, you need to replace t... | Try this code sample.
```
private void register(){
// Create new fragment and transaction
Fragment newFragment = new LoginFragment();
FragmentTransaction transaction = getFragmentManager().beginTransaction();
// Replace whatever is in the fragment_container view with this fragment,
... |
56,927,444 | I'm trying to reverse a string with the following code but am getting an error `Thread 1: EXC_BAD_ACCESS (code=1, address=0x0)`.
I understand that it's telling me that I'm trying to access a NULL pointer but I fail to see where:
```
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int empty(char s[]){
... | 2019/07/08 | [
"https://Stackoverflow.com/questions/56927444",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11681952/"
] | `scanf` is a standard input function in C.
The first thing you should learn about `scanf` is the 'return value'. Refer to the manual page for `scanf` by accessing `man scanf` if you're on Linux.
`scanf` returns the number of values read in from standard input. i.e your `scanf` would return 1, as only one value has be... | ```
int a; scanf("%d", &a);
```
In the above code an integer variable is declared and its address is passed to scanf function,because inside scamf function the value of a get modified.So in order to reflect the change in the main function you have to pass the address. scanf function reads input from the standard inpu... |
40,114,634 | ```
(define (element-of-set x lst1)
(cond ((null? lst1) '())
((equal? x (car lst1)) (cons (car lst1) (element-of-set x (cdr lst1))))
(else
(element-of-set x (cdr lst1)))))
(define (helper set1 set2) (append set1 set2))
(define (union-set set1 set2)
(cond ((null? set1) '())
((> (length (element-of-se... | 2016/10/18 | [
"https://Stackoverflow.com/questions/40114634",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | How about this:
```
#lang racket
(require racket/set)
(define (union-set set1 set2)
(set-union set1 set2))
(union-set '(1 2 3) '(4 3 2))
=> '(4 1 2 3)
```
FYI, `set` is a built-in data type in Racket, so it's easy to write a set union - just call the existing procedure! Anyway, if you want to roll your own versi... | Here's how I'd do it in Common Lisp if it didn't include functions for set operations.
```
(defun set-union (set1 set2)
(remove-duplicates (append set1 set2)))
```
I'll write one in Scheme. |
10,683,550 | I wonder whether someone may be able to help me please.
I've put together [this](http://www.mapmyfinds.co.uk/development/testgallery.php) gallery page.
Using the icon under each image a user can delete any image they wish. Rather than deleting the image immediately, I'me trying to implement a Modal Confirmation Dialo... | 2012/05/21 | [
"https://Stackoverflow.com/questions/10683550",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/794000/"
] | u didn't mentioned your code, but i think problem is something like ,
your class "`.hide`" is getting apply properly, which contain "`display:none`".
but
you defined "`display:block`" property "**inline**", for u r "dialog-confirm" box, in earlier code.
and
css attributes defined "**inline**" always have high priorit... | Please Remove below style definition on the page. Then it will work:
```
.hide{ display: none !important; }
```
You need to define the dialog box with option `autoOpen: false` and need to invoke with open command on click of delete button(where you used `.live` code ). Please, Modify code as below:
```
$( "... |
10,683,550 | I wonder whether someone may be able to help me please.
I've put together [this](http://www.mapmyfinds.co.uk/development/testgallery.php) gallery page.
Using the icon under each image a user can delete any image they wish. Rather than deleting the image immediately, I'me trying to implement a Modal Confirmation Dialo... | 2012/05/21 | [
"https://Stackoverflow.com/questions/10683550",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/794000/"
] | You can pass the option `autoOpen: false` instead in your dialog call to hide it until it is called;
```
$( "#dialog-confirm" ).dialog({
autoOpen: false
});
```
With this option in place, the dialog should be hidden from view until its called.
Also, you have placed the `.hide` class outside the `<style>..</styl... | Please Remove below style definition on the page. Then it will work:
```
.hide{ display: none !important; }
```
You need to define the dialog box with option `autoOpen: false` and need to invoke with open command on click of delete button(where you used `.live` code ). Please, Modify code as below:
```
$( "... |
1,119,319 | I am finding it hard to turn off the hotspots on the desktop (Ubuntu 18.04.2) at the top left corner that shows up with a miniature version of the windows I have available to switch to. The stuff I can think to search for like "activities hotspot ubuntu" are all too generic to get me there.
I checked gnome-shell exten... | 2019/02/18 | [
"https://askubuntu.com/questions/1119319",
"https://askubuntu.com",
"https://askubuntu.com/users/868842/"
] | ```
ERROR: Unable to load the 'nvidia-drm' kernel module message was accompanied with a bit more detail.
```
The problem was solved by running the driver-installer (.run) file in **rescue.terget**, with **Secure Boot disabled**.
This successfully completed the installation. However, the **NVIDIA driver works only wi... | **Note**: assuming that turning off `Secure Boot` in your BIOS didn't fix this problem...
In the `terminal`...
`cd /var/log` # change to the syslog directory
`grep -i pkcs syslog*` # search syslog and syslog.1
Notice if it finds `pkcs` in which log file... syslog... or syslog.1
`sudo -H gedit syslog` # lets look a... |
15,058,853 | I have an install.bat file and a resource folder. so long as these two files are in the same directory, if you run install.bat, it will install a my lwjgl game. so what im trying to do is make a self extracting file that when completed runs the launch.bat file. I have tried using iexpress, and got it working for the mo... | 2013/02/25 | [
"https://Stackoverflow.com/questions/15058853",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1807744/"
] | Mocha has built-in Promise support as of version 1.18.0 (March 2014). You can return a promise from a test case, and Mocha will wait for it:
```
it('does something asynchronous', function() { // note: no `done` argument
return getSomePromise().then(function(value) {
expect(value).to.equal('foo');
});
});
```
... | Then 'returns' a promise which can be used to handle the error. Most libraries support a method called `done` which will make sure any un-handled errors are thrown.
```
it('does something asynchronous', function (done) {
getSomePromise()
.then(function (value) {
value.should.equal('foo')
})
.done((... |
13,094,317 | This is probably very easy/obvious.
I'm writing a Chrome extention.
My Javascript catches the text nodes from any site and changes part of the text to something else. I would like to mark the changed text by changing its color (adding tags).
```
return "<font color = \"FF0000\">"+a+"</font>"
```
And the result:
```... | 2012/10/26 | [
"https://Stackoverflow.com/questions/13094317",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1405667/"
] | I recommend you use CSS in your chrome extension. so my solution would involve giving the DOM element (for your instance maybe its a paragraph or a span) a class. It's not good conventions to put style attributes in your HTML markup.
```
<p class="red">SomeText</p>
```
And in your CSS file
```
.red {
color: #ff... | You need to add color in your style sheet...
Like `<input type="text" style="color:red" value="sometext"/>`. |
13,094,317 | This is probably very easy/obvious.
I'm writing a Chrome extention.
My Javascript catches the text nodes from any site and changes part of the text to something else. I would like to mark the changed text by changing its color (adding tags).
```
return "<font color = \"FF0000\">"+a+"</font>"
```
And the result:
```... | 2012/10/26 | [
"https://Stackoverflow.com/questions/13094317",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1405667/"
] | ```
function newText(tag, text, style) {
var element = document.createElement(tag); //this creates an empty node of the type specified
element.appendChild(document.createTextNode(text)); //this creates a new text node and inserts it into our empty node
if (style) element.setAttribute('style... | You need to add color in your style sheet...
Like `<input type="text" style="color:red" value="sometext"/>`. |
26,968,408 | Since I am new to Jquery, I want a code in JQUERY for following function:
```
if(checkbox.checked==true)
{
checkbox.checked=false;
}
else
checkbox.checked=true;
```
please help me with this. | 2014/11/17 | [
"https://Stackoverflow.com/questions/26968408",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2554069/"
] | ```
var $checkbox = $(/*your selector*/);
$checkbox.prop("checked", !$checkbox.prop("checked" ) );
``` | You can use following code: (Using [.attr()](http://api.jquery.com/attr/) or [.prop()](http://api.jquery.com/prop/))
```
var checkbox = $('#targetId');
if(checkbox.prop('checked')==true)
checkbox.prop('checked','false');
else
checkbox.prop('checked','true');
```
OR
```
var checkbox = $('#targetId');
if(checkbox.att... |
26,968,408 | Since I am new to Jquery, I want a code in JQUERY for following function:
```
if(checkbox.checked==true)
{
checkbox.checked=false;
}
else
checkbox.checked=true;
```
please help me with this. | 2014/11/17 | [
"https://Stackoverflow.com/questions/26968408",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2554069/"
] | ```
var $checkbox = $(/*your selector*/);
$checkbox.prop("checked", !$checkbox.prop("checked" ) );
``` | ```
$(document).ready(function() {
$("#YourIdSelector,.YourClassSelector").click(function() {
$(this).prop('checked',!$(this).is(':checked'));
});
});
```
Hope it helps... |
26,968,408 | Since I am new to Jquery, I want a code in JQUERY for following function:
```
if(checkbox.checked==true)
{
checkbox.checked=false;
}
else
checkbox.checked=true;
```
please help me with this. | 2014/11/17 | [
"https://Stackoverflow.com/questions/26968408",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2554069/"
] | ```
var $checkbox = $(/*your selector*/);
$checkbox.prop("checked", !$checkbox.prop("checked" ) );
``` | See this snippet:
```js
$("#btn").on("click", function() {
$("input[type=checkbox]").each(function() {
this.checked = !this.checked;
});
});
```
```html
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<input type="checkbox" checked />
<input type="checkbo... |
39,984,444 | Original python dictionary list:
```
[
{"keyword": "nike", "country":"usa"},
{"keyword": "nike", "country":"can"},
{"keyword": "newBalance", "country":"usa"},
{"keyword": "newBalance", "country":"can"}
]
```
I would like to consolidate the python dict list and get an output like:
```
... | 2016/10/11 | [
"https://Stackoverflow.com/questions/39984444",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1551852/"
] | Here are some general pointers. I'm not going to code the whole thing for you. If you post more of what you've tried and specific code you need help with, I'd be happy to help more.
It looks like you're combining only those which have the same value for the "keyword" key. So loop over values of that key and combine th... | ```
L = [
{"keyword": "nike", "country":"usa"},
{"keyword": "nike", "country":"can"},
{"keyword": "newBalance", "country":"usa"},
{"keyword": "newBalance", "country":"can"}
]
def consolidate(L):
answer = {}
for d in L:
if d['keyword'] not in answer:
answer['keyword']... |
68,343,847 | I see `notify::` prefix in `g_signal_connect` call:
```
g_signal_connect(p_obj, "notify::ice-gathering-state", G_CALLBACK(on_ice_gathering_state_changed), p_obj);
```
What does it mean? Is this prefix required? | 2021/07/12 | [
"https://Stackoverflow.com/questions/68343847",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5447906/"
] | Since you might see this pop up in other contexts, I'll try to explain what's going on at a lower level: `notify` is the name of the signal, not a prefix.
The `notify` signal is what's known as a signal "with detail", and the `::ice-gathering-state` part is the "detail". For the [`notify` signal](https://developer.gno... | Yes, it is required. It is not for usual signals. It is for signals that notify about property change. If you check [documentation](https://gstreamer.freedesktop.org/documentation/webrtc/index.html?gi-language=c), you will see that `ice-gathering-state` is not an action signal, it is a property. Properties are usually ... |
497,702 | I was wondering if there is an OEM version of Ubuntu like that of windows which has nothing but the necessities to operate. (ex no add-ins or any thing of the likes. | 2014/07/14 | [
"https://askubuntu.com/questions/497702",
"https://askubuntu.com",
"https://askubuntu.com/users/305470/"
] | You can do an OEM install , see <https://help.ubuntu.com/community/Ubuntu_OEM_Installer_Overview>
Can you please clarify what you mean by "nothing but the necessities to operate"? If you want a bare bones install, use the mini iso
See <https://help.ubuntu.com/community/Installation/MinimalCD>
Note : a minimal instal... | Have you looked at [Installing ubuntu desktop without all the bloat](https://askubuntu.com/questions/42964/installing-ubuntu-desktop-without-all-the-bloat)? This shows you how to do an absolute bare-bones install of Gnome without anything extra installed. It sounds like what you're looking for.
Edit: I based my instal... |
117,128 | How a native speaker would ask the following sentence:
>
> * What is your field of working?
>
>
>
The second person would possibly say: "Accountancy" or "Nursing" or "Medicine" or "Engineering" etc.
For me, all of the following sentences work:
>
> * What is your field of working?
> * What is your occupation?
>... | 2017/01/26 | [
"https://ell.stackexchange.com/questions/117128",
"https://ell.stackexchange.com",
"https://ell.stackexchange.com/users/5652/"
] | In order to answer, it's worthwhile looking at the differences between *field*, *occupation* and *career*.
>
> What is your **field** of working?
>
>
>
A *field* is a particular branch of study or sphere of activity or interest. Field is often used to indicate a specific occupational area or academic branch (e.g... | You are **in** a field.
>
> What field are you in?
>
>
>
You **choose** a career as you would choose a path.
>
> What is your chosen career?
>
>
> What career did you choose?
>
>
> |
4,233,214 | I'am currently working on a project using Hadoop 0.21.0, 985326 and a cluster of 6 worker nodes and a head node.
Submitting a regular mapreduce job fails, but I have no idea why. Has anybody seen this exception before?
```
org.apache.hadoop.mapred.Child: Exception running child : java.io.IOException: Spill failed
... | 2010/11/20 | [
"https://Stackoverflow.com/questions/4233214",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/506746/"
] | Ok, all problems are solved.
The Map-Reduce serialization operation needs intern a default constructor for **org.apache.hadoop.io.ArrayWritable**.
Hadoops implementation didn't provide a default constructor for ArrayWritable.
That's why the java.lang.NoSuchMethodException: org.apache.hadoop.io.ArrayWritable.() ... | This problem came up for me when the output of one of my map jobs produced a tab character ("\t") or newline character ("\r" or "\n") - Hadoop doesn't handle this well and fails. I was able to solve this using this piece of Python code:
```
if "\t" in output:
output = output.replace("\t", "")
if "\r" in output:
ou... |
17,908,576 | I'm writing a generic library. I have a protected object that needs to be accessed by code in two packages. Both the package containing the object, and the packages that need to access it, are generic. I'll call the packages `Main_Pkg`, `Second_Pkg` and `Object_Pkg` for clarity. All three packages are instantiated with... | 2013/07/28 | [
"https://Stackoverflow.com/questions/17908576",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2627577/"
] | I think you may be able to use a [generic formal package](http://www.ada-auth.org/standards/12rm/html/RM-12-7.html).
Not bothering with the protected object (being able to access *anything* should demonstrate the point) something like
```
generic
type T is private;
package Object_Pkg is
Arr : array (1 .. 10) of... | If Main\_Pkg and Second\_Pkg are closely enough related that you're going to have one of those packages accessing something defined in the other package, then perhaps making them totally separate generic packages isn't the right way to organize them. Consider making them both children of some other package.
It sounds ... |
2,110,020 | **Update**
Hi guys!
Got the linking working but now im facing another problem. When i've clicked the link within the tab and clicks on the "Menu"-tab again, the tabs look like shit. See working example link and code below.
Rgds
muttmagandi
<http://www.vallatravet.se/thetabs/>
```
$(document).ready(function(){
$(... | 2010/01/21 | [
"https://Stackoverflow.com/questions/2110020",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/255861/"
] | I think your problem is just a missing brace and parenthesis in your JavaScript because the same code works fine with those two things added - <http://jsbin.com/eriba/2> .
```
$(document).ready(function(){
var $tabs= $("#container-1").tabs();
$('.tolast').click(function() {
$tabs.tabs('select', 2... | no, your problem is that
in here:
```
var $tabs= $("#container-1").tabs();
$('.tolast').click(function() {
$tabs.tabs('select', 2);
return false;
});
```
you have selected the elements with classname 'tolast' which the onclick points to the third tab.
here you can see you have two of that element that... |
6,043,841 | i'm trying to fit a negbin model with sqrt link. Unfortunately it seems to be that I have to specify starting values. Is anybody familiar with setting starting values when running the `glm.nb` command (package `MASS`)?
When I don't use starting values, I get an error message:
>
> no valid set of coefficients has bee... | 2011/05/18 | [
"https://Stackoverflow.com/questions/6043841",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/734124/"
] | Finding suitable starting values can be difficult for sufficiently complex problems. However for setting the starting values (the documentation of which is not great, but exists) you should learn to read the error messages. Here is a replicate of your unsuccessful attempt using `start=1` with a built-in data set:
```
... | I got similar error while doing the RR regression using log link binomial as shown below
```
adjrep <-glm(reptest ~ momagecat + paritycat + marstatcat + dept,
family = binomial(link = "log"),
data = hcm1)
> Error: no valid set of coefficients has been found: please supply
> starting values
... |
13,298,432 | I am attemping to do a nested join from 2 sets of unioned tables. I do not understand why I am getting the following errors:
>
> Msg 156, Level 15, State 1, Line 15 Incorrect syntax near the keyword
> 'INNER'. Msg 156, Level 15, State 1, Line 24 Incorrect syntax near the
> keyword 'On'.
>
>
>
I assume based on ... | 2012/11/08 | [
"https://Stackoverflow.com/questions/13298432",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/714237/"
] | I don't think you need the outer `SELECT *` statements... try changing your `FROM` to the following:
```
FROM
(
SELECT serialnoId...
FROM dbo.AcsBy320052007Hus
UNION ALL
SELECT serialnoId...
FROM dbo.AcsBy320082010Hus
) AS Hus
INNER JOIN
(
SELECT serialnoId...
FROM dbo.AcsBy320... | Have you tried adding parenthesis around the sub query?
```
SELECT TOP 1000
Pus.SerialnoId,Hus.RT,Hus.DIVISION,Hus.REGION,Hus.ADJHSG,Hus.ADJINC,Hus.WGTP,Hus.NP,Hus.TYPE,Hus.ACR,Hus.AGS,Hus.BLD,Hus.BUS,Hus.CONP,Hus.ELEP,Hus.FS,Hus.FULP,Hus.GASP,Hus.HFL,Hus.INSP,Hus.KIT,Hus.MHP,Hus.MRGI,Hus.MRGP,Hus.MRGT,Hus.MRGX,Hus.R... |
13,298,432 | I am attemping to do a nested join from 2 sets of unioned tables. I do not understand why I am getting the following errors:
>
> Msg 156, Level 15, State 1, Line 15 Incorrect syntax near the keyword
> 'INNER'. Msg 156, Level 15, State 1, Line 24 Incorrect syntax near the
> keyword 'On'.
>
>
>
I assume based on ... | 2012/11/08 | [
"https://Stackoverflow.com/questions/13298432",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/714237/"
] | I don't think you need the outer `SELECT *` statements... try changing your `FROM` to the following:
```
FROM
(
SELECT serialnoId...
FROM dbo.AcsBy320052007Hus
UNION ALL
SELECT serialnoId...
FROM dbo.AcsBy320082010Hus
) AS Hus
INNER JOIN
(
SELECT serialnoId...
FROM dbo.AcsBy320... | You have the table aliases in the wrong place, try:
```
SELECT TOP 1000
Pus.SerialnoId,Hus.RT,Hus.DIVISION,Hus.REGION,Hus.ADJHSG,Hus.ADJINC,Hus.WGTP,Hus.NP,Hus.TYPE,Hus.ACR,Hus.AGS,Hus.BLD,Hus.BUS,Hus.CONP,Hus.ELEP,Hus.FS,Hus.FULP,Hus.GASP,Hus.HFL,Hus.INSP,Hus.KIT,Hus.MHP,Hus.MRGI,Hus.MRGP,Hus.MRGT,Hus.MRGX,Hus.RNTM,... |
51,661,094 | I want to setup web app using three components that i already have:
1. Domain name registered on domains.google.com
2. Frontend web app hosted on Firebase Hosting and served from `example.com`
3. Backend on Kubernetes cluster behind Load Balancer with external static IP `1.2.3.4`
I want to serve the backend from `exa... | 2018/08/02 | [
"https://Stackoverflow.com/questions/51661094",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2445648/"
] | **Approach 1:**
```
example.com --> Firebase Hosting (A record)
api.example.com --> Kubernetes backend
```
Pro: Super-simple
Con: CORS request needed by browser before API calls can be made.
**Approach 2:**
```
example.com --> Firebase Hosting via k8s ExternalName service
example.com/api --> Kubernetes backend
`... | I would suggest creating two host paths. The first would be going to "example.com" using NodePort type. You can then use the [External Name](https://kubernetes.io/docs/concepts/services-networking/service/#externalname) service for "api.exmple.com". |
25,395,932 | Does anyone know how to make a cursor blink in the textarea even before you click on it?
Like <https://medium.com/p/new-post> | 2014/08/20 | [
"https://Stackoverflow.com/questions/25395932",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1511361/"
] | You can use `autofocus` to accomplish this, [check out w3schools for basic information on it](http://www.w3schools.com/tags/att_input_autofocus.asp).
`<input type="text" name="fname" autofocus>` | Probably the styling is set to show no cursor.
And try below examples:
[**Cursor examples in CSS**](http://www.echoecho.com/csscursors.htm) |
25,395,932 | Does anyone know how to make a cursor blink in the textarea even before you click on it?
Like <https://medium.com/p/new-post> | 2014/08/20 | [
"https://Stackoverflow.com/questions/25395932",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1511361/"
] | You can use `autofocus` to accomplish this, [check out w3schools for basic information on it](http://www.w3schools.com/tags/att_input_autofocus.asp).
`<input type="text" name="fname" autofocus>` | I would suggest that you download a blinking gif then put it as backround of your text area to make it blink. Then when you type it will go away.
Add bootstrap form like this to clone the same display: [jsfiddle](http://jsfiddle.net/v9ec3/146/)
```
<textarea class="form-control" placeholder="Tell your story.." rows=... |
25,395,932 | Does anyone know how to make a cursor blink in the textarea even before you click on it?
Like <https://medium.com/p/new-post> | 2014/08/20 | [
"https://Stackoverflow.com/questions/25395932",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1511361/"
] | Probably the styling is set to show no cursor.
And try below examples:
[**Cursor examples in CSS**](http://www.echoecho.com/csscursors.htm) | I would suggest that you download a blinking gif then put it as backround of your text area to make it blink. Then when you type it will go away.
Add bootstrap form like this to clone the same display: [jsfiddle](http://jsfiddle.net/v9ec3/146/)
```
<textarea class="form-control" placeholder="Tell your story.." rows=... |
54,425,766 | I have one model that is
```
class Retailer < ActiveRecord::Base
...
has_attached_file :onboarding_image
...
end
```
If the onboarding\_image is not present, when doing `retailer.onboarding_image_url` i'm getting: "/onboarding\_images/original/missing.png"
Is there a config to get `nil` when no image is pr... | 2019/01/29 | [
"https://Stackoverflow.com/questions/54425766",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6211950/"
] | You can set the `default_url` as outlined [here](https://github.com/thoughtbot/paperclip#models):
```
has_attached_file :onboarding_image, default_url: ''
```
Another approach is to override the `onboarding_image_url` method:
```
def onboarding_image_url(default_value=nil)
onboarding_image.present? ? onboard... | if you have this attached files on multiple models, you can create concern for all classes that have `has_attached_file` :
```
module BoardUrl
def board_url
onboarding_image.present? ? onboarding_image.url : nil
end
end
```
```
class Retailer
include BoardUrl
end
```
This way you can use your `board_url`... |
27,271,027 | JS:
```
$scope.find = function() {
$scope.onlyUsers = Users.query();
console.log(" $scope.onlyUsers-->", $scope.onlyUsers);
var len = $scope.onlyUsers.length;
console.log('length',+len);
var peruser = [{}];
if(data){
for(var x=0; x< $scope.onlyUsers.length... | 2014/12/03 | [
"https://Stackoverflow.com/questions/27271027",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4144379/"
] | Besides one wrong `&&`, reading nextInt should be done first.
```
while (true) {
System.out.print("Enter the Length of wall 1: ");
if (scan.hasNextInt()) {
length1 = scan.nextInt();
if (1 <= length1 && length1 <= 24) {
break:
}
System.out.println("Error Error");
... | Use the following Code:
```
while (length1 == Integer.MIN_VALUE) {
System.out.print("Enter the Length of wall 1: ");
if (scan.hasNextInt() && 1<=length1 && length1<=24) {
length1 = scan.nextInt();
}
else if (length1<1 || 24<length1) {
System.out.println("Error Error");
System.ou... |
453,359 | I am using ubuntu 14.04 LTS (64 bit). I could access the 4GB memory of my fujifilm AV-150 digital camera through nautilus in 13.10, but it is no longer shown in 14.04!
### `lsusb`
```
Bus 002 Device 003: ID 046d:c52f Logitech, Inc. Unifying Receiver
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matchin... | 2014/04/23 | [
"https://askubuntu.com/questions/453359",
"https://askubuntu.com",
"https://askubuntu.com/users/46933/"
] | ### It's a [bug](https://bugs.launchpad.net/ubuntu/+source/gvfs/+bug/1296275)
The camera will be detected after executing following commands
**Option One**
```
echo 'ACTION="add", ENV{ID_USB_INTERFACES}=="*:060101:*", ENV{ID_GPHOTO2}="1", ENV{GPHOTO2_DRIVER}="PTP", MODE="0664", GROUP="plugdev"' | sudo tee /lib/udev/... | I have virtually the same problem but with another camera brand. To get access to the pictures while the basic problem is not solved I use a workaround which is described in my posting:
[Canon IXUS 155 camera no longer found when connected to USB after update to 14.04](https://askubuntu.com/questions/454651/canon-ixus... |
32,520,959 | I have this format of code. Can anyone help me how can I read the array? I need to read contacts array.
```
{
"success": true,
"contacts": [
{
"username": "ceema",
"profile": {
"name": "Ceema S",
"email": "ceemas@gmail.com",
"address": "No 143, gangaeyam, Maikkad P O, Kerala",
"phone": {
... | 2015/09/11 | [
"https://Stackoverflow.com/questions/32520959",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1101520/"
] | >
> This jsonstr is json response from the site. I need to read the nested
> contacts and populate it to
>
>
>
you got it almost right. The objects you are looking for are inside profile
```
JSONObject c = contacts.getJSONObject(i);
JSONObject profile = c.getJSONObject("profile");
```
and use `profile` instead... | check this link a very simple way to parse json
<http://kylewbanks.com/blog/Tutorial-Android-Parsing-JSON-with-GSON> |
32,520,959 | I have this format of code. Can anyone help me how can I read the array? I need to read contacts array.
```
{
"success": true,
"contacts": [
{
"username": "ceema",
"profile": {
"name": "Ceema S",
"email": "ceemas@gmail.com",
"address": "No 143, gangaeyam, Maikkad P O, Kerala",
"phone": {
... | 2015/09/11 | [
"https://Stackoverflow.com/questions/32520959",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1101520/"
] | >
> This jsonstr is json response from the site. I need to read the nested
> contacts and populate it to
>
>
>
you got it almost right. The objects you are looking for are inside profile
```
JSONObject c = contacts.getJSONObject(i);
JSONObject profile = c.getJSONObject("profile");
```
and use `profile` instead... | The simplest way is to get POJO class from json using <http://www.jsonschema2pojo.org/>
You will get all the required classes to convert this json into POJO class,
and later you can use Gson library from google to convert json into Object and the other way around.
Think of this, if you get a Contact class as parent c... |
47,290,183 | Firstly,i fill in the list with some objects with different propetries and afterwards I'd like to remove all inappropriate objects from this list.
For sure, it throws an exception, saying that the list has been modified and it leads to problems with enumeration. How to manage this and remove all inappropriate objects w... | 2017/11/14 | [
"https://Stackoverflow.com/questions/47290183",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5539510/"
] | `List<T>` has a [`RemoveAll`](https://msdn.microsoft.com/en-us/library/wdka673a(v=vs.110).aspx) method that takes a predicate. You can use it like this:
```
MyList.RemoveAll(x=>x.Number != "04");
``` | Use **[`RemoveAll`](https://msdn.microsoft.com/en-us/library/wdka673a(v=vs.110).aspx)** direct method
```
MyList.RemoveAll(val=>val.Number != "04");
``` |
40,505,127 | I am trying to scrape a site but the results returned for just the links is different from when I inspect it with the browser.
In my browser I get normal links but all the a HREF links all become `javascript:void(0);` from Nokogiri.
Here is the site:
```
https://www.ctgoodjobs.hk/jobs/part-time
```
Here is my code... | 2016/11/09 | [
"https://Stackoverflow.com/questions/40505127",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4390569/"
] | is not that easy, urls are "obscured" using a js function, that's why you're getting `javascript: void(0)` when asking for the hrefs... looking at the html, there are some hidden inputs for each link, and, there is a preview url that you can use to build the job preview url (if that's what you're looking for), so you h... | Take the output of a browser and that of a tool like `wget`, `curl` or `nokogiri` and you will find the HTML the browser presents can differ drastically from the raw HTML.
Browsers these days can process DHTML, Nokogiri doesn't. You can only retrieve the *raw* HTML using something that lets you see the content withou... |
26,830,979 | I have an Asp.Net MVC 5 website and I'm using Entity Framework code first to access its database. I have a `Restaurants` table and I want to let users search these with a lot of parameters. Here's what I have so far:
```
public void FilterModel(ref IQueryable<Restaurant> model)
{
if (!string.IsNullOrWhiteSpace(Res... | 2014/11/09 | [
"https://Stackoverflow.com/questions/26830979",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/603200/"
] | You can do something like this:
```
from itertools import takewhile
def get_items_upto_count(dct, n):
data = dct.most_common()
val = data[n-1][1] #get the value of n-1th item
#Now collect all items whose value is greater than or equal to `val`.
return list(takewhile(lambda x: x[1] >= val, data))
test = Count... | For smaller sets, just write a simple generator:
```
>>> test = Counter(["A","A","A","B","B","C","C","D","D","E","F","G","H"])
>>> g=(e for e in test.most_common() if e[1]>=2)
>>> list(g)
[('A', 3), ('D', 2), ('C', 2), ('B', 2)]
```
For larger set, use [ifilter](https://docs.python.org/2/library/itertools.html#itert... |
63,033,422 | My axios response (or fetch, tried both) it's plain text (string). But I expect javaScript map. If I tried JSON.parse() (or from fetch .json()) I got error:
>
> Uncaught (in promise) SyntaxError: Unexpected token in JSON at
> position 0
> at JSON.parse ()
> at eval (List.vue?8915:66)
>
>
>
* UTF-8 without BOM
* I... | 2020/07/22 | [
"https://Stackoverflow.com/questions/63033422",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12451768/"
] | How interesting this all character escaping thing works!
I continued serching, and read everything I could find. The result is that all that should be escaped with in double quotes, are the double quotes themselves...
*(correct me if there's something I am missing, that was correct for my case)*
The resulting string ... | ```bat
rem // enable delayed expansion to expand other poison characters safely
@Echo off & setlocal EnableExtensions EnableDelayedExpansion
rem // escape % character by doubling
Set "PW=;d#se#&4~75EY(H[SM"%%cznGB"
"C:\WINDOWS\system32\inetsrv\appcmd.exe" set vdir /vdir.name:"appfolder/Files" -physicalPath:"\\serverna... |
127,071 | When I select the "Additional Drivers" program, it searches for available drivers but becomes unresponsive shortly after. I tried closing it, to try again, but now it just blinks 3 times when I select it. Any ideas to work around this? I'm unsure if there's a driver I need. My network connection seems fine, though.
Ed... | 2012/04/28 | [
"https://askubuntu.com/questions/127071",
"https://askubuntu.com",
"https://askubuntu.com/users/56988/"
] | Try starting it from a terminal: `jockey-gtk`. See if it displays any error regarding the crash.
Alternatively there is `jockey-text` if the graphical version would fail.
In case of problems you'd probably want to read the backend debug log (`/var/log/jockey.log`). Try this:
* In a terminal window type `tail -f /var... | I wasn't able to get jockey working either, no matter what i tried. However i did find a workaround. If you haven't already, install the synaptic package manager from the software center. From synaptic you can search for the driver you are trying to install and install through there.
The only downside is you have to k... |
35,220,392 | What is the proper/right resolution for Image to be put using src in ImageView to avoid stretching or unscaled images? | 2016/02/05 | [
"https://Stackoverflow.com/questions/35220392",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5870896/"
] | A key element of the [Visitor pattern](https://en.wikipedia.org/wiki/Visitor_pattern) is [double-dispatch](https://en.wikipedia.org/wiki/Double_dispatch): you need to invoke the visitor method *from the actual subclass*:
```
abstract class Animal {
abstract void accept(Visitor v);
}
class Dog extends Animal {
@Ov... | The visitor pattern is basically a many-to-many class behavior resolution mechanism. In order to be useful / applicable to your animals example, we need to add a visitor, as Andy Turner indicated.
How about including "Animal Trainers" as the visitors? Different animal trainers could get the different animals to speak ... |
38,710,304 | Just trying to run a simple function when the button "calculate" is pressed. Function won't run at all when inputs are in a form, ultimately I want to be able to modify the other inputs when the calculate button is pressed. Any help at all please!
```js
function calculate() {
alert("called");
}
```
```html
<head>... | 2016/08/02 | [
"https://Stackoverflow.com/questions/38710304",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1437728/"
] | Button HTML just need it:
```
<input type="button" onClick="calculate()" name="calculate" value="Caculate" >
```
And don't forget insert `jquery lib` in your `<head>`. | ```js
function calculate() {
alert("called");
}
document.getElementsByName("calculate")[0].addEventListener("click", calculate);
```
```html
<form name="form">
Price:
<input name="priceCAD" value="0">
<br>
<br>Markup:
<input name="percentage" value="0">
<br>
<br>Fiat:
<input name="fiat" v... |
1,431,359 | I am interested in evaluating the following infinite sum
\begin{equation}
\sum\_{n=0}^{\infty} \frac{\alpha^{n}}{n!}n^{\beta}
\end{equation}
where both $\alpha$ and $\beta$ are real numbers. However, in addition, $\alpha$ is always positive.
Clearly the sum converges for any value of $\alpha$ and $\beta$ since the fa... | 2015/09/11 | [
"https://math.stackexchange.com/questions/1431359",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/220425/"
] | $A=\begin{bmatrix}a&b\\b&-a\end{bmatrix}$ and
$A^2=(a^2 + b^2) \begin{bmatrix}1&0\\0&1\end{bmatrix}$
So $$A^{2k}=(a^2 + b^2)^k\begin{bmatrix}1&0\\0&1\end{bmatrix}$$ and $$A^{2k + 1}=A^{2k}A=(a^2 + b^2)^k\begin{bmatrix}a&b\\b&-a\end{bmatrix}$$ | You can use the diagonalization of your matrix $A$. In particular, you can found $$A = T D T^{-1},$$ where $D$ is diagonal and contains all eigenvalues of matrix $A$, while $T$'s columns are the eigenvectors of your matrix $A$.
Using this form, then:
$$A^n = T D^n T^{-1},$$
which can be really easy to compute.
In y... |
1,431,359 | I am interested in evaluating the following infinite sum
\begin{equation}
\sum\_{n=0}^{\infty} \frac{\alpha^{n}}{n!}n^{\beta}
\end{equation}
where both $\alpha$ and $\beta$ are real numbers. However, in addition, $\alpha$ is always positive.
Clearly the sum converges for any value of $\alpha$ and $\beta$ since the fa... | 2015/09/11 | [
"https://math.stackexchange.com/questions/1431359",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/220425/"
] | $A=\begin{bmatrix}a&b\\b&-a\end{bmatrix}$ and
$A^2=(a^2 + b^2) \begin{bmatrix}1&0\\0&1\end{bmatrix}$
So $$A^{2k}=(a^2 + b^2)^k\begin{bmatrix}1&0\\0&1\end{bmatrix}$$ and $$A^{2k + 1}=A^{2k}A=(a^2 + b^2)^k\begin{bmatrix}a&b\\b&-a\end{bmatrix}$$ | Take
$$
A = \pmatrix{a&b\\b&-a}
$$
The eigenvalues of $A$ are $\pm \sqrt{a^2+b^2}$, as we can note using the trace and determinant. Define $\alpha = \sqrt{a^2+b^2}$ for convenience. Assume that $\alpha \neq 0$, in which case the answer is obvious.
We note that the matrix
$$
M = \frac 1{\alpha} A
$$
has eigenvalues $\... |
449,780 | Any suggestions on which HTML template library would go well with JQuery? Googling turns up quite a number of libraries but I'm not sure whether there is a well recognized library that would stand the test of time. | 2009/01/16 | [
"https://Stackoverflow.com/questions/449780",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/51570/"
] | [jQuery Templates Plugin](http://weblogs.asp.net/scottgu/archive/2010/05/07/jquery-templates-and-data-linking-and-microsoft-contributing-to-jquery.aspx) created by Microsoft and accepted as an official jQuery plugin.
**But note** that it’s now deprecated. | You should get a look on Javascript-Templates, this is a small template engine used within the famous jQuery File Upload plugin, and developed by the same author, Sebastian Tschan (@blueimp)
<https://github.com/blueimp/JavaScript-Templates>
**Follow the usage guide made** by Sebastian, just **remove this line**
```
... |
449,780 | Any suggestions on which HTML template library would go well with JQuery? Googling turns up quite a number of libraries but I'm not sure whether there is a well recognized library that would stand the test of time. | 2009/01/16 | [
"https://Stackoverflow.com/questions/449780",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/51570/"
] | [jTemplates](http://jtemplates.tpython.com/)
>
> ### a template engine for JavaScript.
>
>
> ### Plugin to [jQuery](http://jquery.com/)...
>
>
> Features:
>
>
> * 100% in JavaScript
> * precompilator
> * Support JSON
> * Work with Ajax
> * Allow to use JavaScript code inside template
> * Allow to build cascadin... | You should get a look on Javascript-Templates, this is a small template engine used within the famous jQuery File Upload plugin, and developed by the same author, Sebastian Tschan (@blueimp)
<https://github.com/blueimp/JavaScript-Templates>
**Follow the usage guide made** by Sebastian, just **remove this line**
```
... |
449,780 | Any suggestions on which HTML template library would go well with JQuery? Googling turns up quite a number of libraries but I'm not sure whether there is a well recognized library that would stand the test of time. | 2009/01/16 | [
"https://Stackoverflow.com/questions/449780",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/51570/"
] | [jTemplates](http://jtemplates.tpython.com/)
>
> ### a template engine for JavaScript.
>
>
> ### Plugin to [jQuery](http://jquery.com/)...
>
>
> Features:
>
>
> * 100% in JavaScript
> * precompilator
> * Support JSON
> * Work with Ajax
> * Allow to use JavaScript code inside template
> * Allow to build cascadin... | [jQuery Templates Plugin](http://weblogs.asp.net/scottgu/archive/2010/05/07/jquery-templates-and-data-linking-and-microsoft-contributing-to-jquery.aspx) created by Microsoft and accepted as an official jQuery plugin.
**But note** that it’s now deprecated. |
449,780 | Any suggestions on which HTML template library would go well with JQuery? Googling turns up quite a number of libraries but I'm not sure whether there is a well recognized library that would stand the test of time. | 2009/01/16 | [
"https://Stackoverflow.com/questions/449780",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/51570/"
] | [jTemplates](http://jtemplates.tpython.com/)
>
> ### a template engine for JavaScript.
>
>
> ### Plugin to [jQuery](http://jquery.com/)...
>
>
> Features:
>
>
> * 100% in JavaScript
> * precompilator
> * Support JSON
> * Work with Ajax
> * Allow to use JavaScript code inside template
> * Allow to build cascadin... | I would check out [json2html](http://www.json2html.com), it forgoes having to write HTML snippets and relies instead on JSON transforms to convert JSON object array's into unstructured lists. Very fast and uses DOM creation. |
449,780 | Any suggestions on which HTML template library would go well with JQuery? Googling turns up quite a number of libraries but I'm not sure whether there is a well recognized library that would stand the test of time. | 2009/01/16 | [
"https://Stackoverflow.com/questions/449780",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/51570/"
] | [jQuery Templates Plugin](http://weblogs.asp.net/scottgu/archive/2010/05/07/jquery-templates-and-data-linking-and-microsoft-contributing-to-jquery.aspx) created by Microsoft and accepted as an official jQuery plugin.
**But note** that it’s now deprecated. | A couple years ago i built IBDOM: <http://ibdom.sf.net/> | As of december 2009, it supports jQuery binding if you get it straight from the trunk.
```
$("#foo").injectWith(collectionOfJavaScriptObjects);
```
or
```
$("#foo").injectWith(simpleJavaScriptObject);
```
Also, you can now put all the "data:propName" mark... |
449,780 | Any suggestions on which HTML template library would go well with JQuery? Googling turns up quite a number of libraries but I'm not sure whether there is a well recognized library that would stand the test of time. | 2009/01/16 | [
"https://Stackoverflow.com/questions/449780",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/51570/"
] | [jTemplates](http://jtemplates.tpython.com/)
>
> ### a template engine for JavaScript.
>
>
> ### Plugin to [jQuery](http://jquery.com/)...
>
>
> Features:
>
>
> * 100% in JavaScript
> * precompilator
> * Support JSON
> * Work with Ajax
> * Allow to use JavaScript code inside template
> * Allow to build cascadin... | There is a reasonable discussion document on this topic [here](http://ajaxpatterns.org/Browser-Side_Templating), which covers a range of templating tools. Not specific to jQuery, though. |
449,780 | Any suggestions on which HTML template library would go well with JQuery? Googling turns up quite a number of libraries but I'm not sure whether there is a well recognized library that would stand the test of time. | 2009/01/16 | [
"https://Stackoverflow.com/questions/449780",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/51570/"
] | Well, to be frank, client-side templating is very hot nowadays, but quite a jungle.
the most popular are, I believe:
* [pure](http://beebole.com/pure/): It use only js, not his own
"syntax"
* [mustache](http://mustache.github.com/): quite stable and nice I
heard.
* [jqote2](http://aefxx.com/jquery-plugins/jqote2/): ... | A couple years ago i built IBDOM: <http://ibdom.sf.net/> | As of december 2009, it supports jQuery binding if you get it straight from the trunk.
```
$("#foo").injectWith(collectionOfJavaScriptObjects);
```
or
```
$("#foo").injectWith(simpleJavaScriptObject);
```
Also, you can now put all the "data:propName" mark... |
449,780 | Any suggestions on which HTML template library would go well with JQuery? Googling turns up quite a number of libraries but I'm not sure whether there is a well recognized library that would stand the test of time. | 2009/01/16 | [
"https://Stackoverflow.com/questions/449780",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/51570/"
] | Well, to be frank, client-side templating is very hot nowadays, but quite a jungle.
the most popular are, I believe:
* [pure](http://beebole.com/pure/): It use only js, not his own
"syntax"
* [mustache](http://mustache.github.com/): quite stable and nice I
heard.
* [jqote2](http://aefxx.com/jquery-plugins/jqote2/): ... | I would check out [json2html](http://www.json2html.com), it forgoes having to write HTML snippets and relies instead on JSON transforms to convert JSON object array's into unstructured lists. Very fast and uses DOM creation. |
449,780 | Any suggestions on which HTML template library would go well with JQuery? Googling turns up quite a number of libraries but I'm not sure whether there is a well recognized library that would stand the test of time. | 2009/01/16 | [
"https://Stackoverflow.com/questions/449780",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/51570/"
] | Well, to be frank, client-side templating is very hot nowadays, but quite a jungle.
the most popular are, I believe:
* [pure](http://beebole.com/pure/): It use only js, not his own
"syntax"
* [mustache](http://mustache.github.com/): quite stable and nice I
heard.
* [jqote2](http://aefxx.com/jquery-plugins/jqote2/): ... | There is a reasonable discussion document on this topic [here](http://ajaxpatterns.org/Browser-Side_Templating), which covers a range of templating tools. Not specific to jQuery, though. |
449,780 | Any suggestions on which HTML template library would go well with JQuery? Googling turns up quite a number of libraries but I'm not sure whether there is a well recognized library that would stand the test of time. | 2009/01/16 | [
"https://Stackoverflow.com/questions/449780",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/51570/"
] | Well, to be frank, client-side templating is very hot nowadays, but quite a jungle.
the most popular are, I believe:
* [pure](http://beebole.com/pure/): It use only js, not his own
"syntax"
* [mustache](http://mustache.github.com/): quite stable and nice I
heard.
* [jqote2](http://aefxx.com/jquery-plugins/jqote2/): ... | You should get a look on Javascript-Templates, this is a small template engine used within the famous jQuery File Upload plugin, and developed by the same author, Sebastian Tschan (@blueimp)
<https://github.com/blueimp/JavaScript-Templates>
**Follow the usage guide made** by Sebastian, just **remove this line**
```
... |
44,943,478 | I have been trying to post URL-encoded data using below code snippet
```
$.post( "url",{param:"value"},function(data){
alert("data==="+data);
});
```
Here URL is a `restful API` URL
This one is not working. Then I tried with `$.ajax`
```
$.ajax({
url:"url",
type:"POST",
dataType:"application/json",
co... | 2017/07/06 | [
"https://Stackoverflow.com/questions/44943478",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4093604/"
] | $.ajax has a `success` param in the passed object.
To send `json` use `dataType: 'json'`.
No need for contentType, really.
Here's your updated code:
```
$.ajax({
url:"url",
type:"POST",
dataType:"json",
data:{param:'value'},
success: function( data )
{
alert("data==="+data);
}
})
```
<http://ap... | Your callback is wrong,
```
$.ajax({
url: "URL",
type: "POST",
dataType: "xml/html/script/json", // format for response
contentType: "application/json", // send as JSON
data: $.param( $(param:'value') ),
complete: function(data) {
//called when complete
console.log(data);
},
success: functio... |
164,974 | ```
Set rs = con.Execute("select IIF(MAX(bill_bno) IS NULL,1,MAX(bill_bno)+1) from rec_all where rw=0 and iif(month(bill_date)>=1 AND month(bill_date)<=3,year(bill_date)-1,year(bill_date))=" & IIf(Month(Date) >= 1 And Month(Date) <= 3, Year(Date) - 1, Year(Date)))
```
how to change vb6 code (MS a... | 2017/02/21 | [
"https://dba.stackexchange.com/questions/164974",
"https://dba.stackexchange.com",
"https://dba.stackexchange.com/users/118037/"
] | Try this:
```
SELECT COALESCE(MAX(bill_bno) + 1, 1) AS bill_bno
FROM rec_all
WHERE rw = 0
AND
(CASE WHEN MONTH(bill_date) >= 1 AND MONTH(bill_date) <= 3
THEN (YEAR(bill_date) - 1)
ELSE YEAR(bill_date) END)
=
(CASE WHEN MONTH(Date) >= 1 AND MONTH(Date) <= 3
... | this should work
```
select max( isnull(billno, 0) ) + 1 from rec_all
``` |
164,974 | ```
Set rs = con.Execute("select IIF(MAX(bill_bno) IS NULL,1,MAX(bill_bno)+1) from rec_all where rw=0 and iif(month(bill_date)>=1 AND month(bill_date)<=3,year(bill_date)-1,year(bill_date))=" & IIf(Month(Date) >= 1 And Month(Date) <= 3, Year(Date) - 1, Year(Date)))
```
how to change vb6 code (MS a... | 2017/02/21 | [
"https://dba.stackexchange.com/questions/164974",
"https://dba.stackexchange.com",
"https://dba.stackexchange.com/users/118037/"
] | Since you only gave us the line that generates your recordset, we'll assume that you are able to establish your connection successfully.
First: the following statement should be valid in SQL Server 2012:
```
select IIF(MAX(bill_bno) IS NULL,1,MAX(bill_bno)+1) from rec_all
where rw=0
and iif(month(bill_date)>=1 A... | this should work
```
select max( isnull(billno, 0) ) + 1 from rec_all
``` |
8,394,330 | I have just come across the javascript code
`file_upload_started = progress < 100;`
and I have NO idea how to read it and Google isn't really turning much up. I'm not even sure what to call it so it's hard to do a search.
If anyone has any information about this type of equation, that would be much appreciated. | 2011/12/06 | [
"https://Stackoverflow.com/questions/8394330",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/325626/"
] | It stores the result of the expression `progress < 100` (*a boolean result*) to the variable `file_upload_started`
So if `progress` is less than `100` then it will set the `file_upload_started` to `true`, otherwise to `false` | It's setting `file_upload_started` to the boolean result of `progress < 100`
So if `progress` is 99, `file_upload_started` will be `true`, and of course if progress is 100 or greater, then `file_upload_started` will be false;
Not to belabor the point, but you could write that same code as:
```
if (progress < 100)
... |
8,394,330 | I have just come across the javascript code
`file_upload_started = progress < 100;`
and I have NO idea how to read it and Google isn't really turning much up. I'm not even sure what to call it so it's hard to do a search.
If anyone has any information about this type of equation, that would be much appreciated. | 2011/12/06 | [
"https://Stackoverflow.com/questions/8394330",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/325626/"
] | It's setting `file_upload_started` to the boolean result of `progress < 100`
So if `progress` is 99, `file_upload_started` will be `true`, and of course if progress is 100 or greater, then `file_upload_started` will be false;
Not to belabor the point, but you could write that same code as:
```
if (progress < 100)
... | Read it something like this:
```
file_upload_started = (progress < 100);
```
It just returns a boolean value that is set to the variable. |
8,394,330 | I have just come across the javascript code
`file_upload_started = progress < 100;`
and I have NO idea how to read it and Google isn't really turning much up. I'm not even sure what to call it so it's hard to do a search.
If anyone has any information about this type of equation, that would be much appreciated. | 2011/12/06 | [
"https://Stackoverflow.com/questions/8394330",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/325626/"
] | It stores the result of the expression `progress < 100` (*a boolean result*) to the variable `file_upload_started`
So if `progress` is less than `100` then it will set the `file_upload_started` to `true`, otherwise to `false` | Read it something like this:
```
file_upload_started = (progress < 100);
```
It just returns a boolean value that is set to the variable. |
8,394,330 | I have just come across the javascript code
`file_upload_started = progress < 100;`
and I have NO idea how to read it and Google isn't really turning much up. I'm not even sure what to call it so it's hard to do a search.
If anyone has any information about this type of equation, that would be much appreciated. | 2011/12/06 | [
"https://Stackoverflow.com/questions/8394330",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/325626/"
] | It stores the result of the expression `progress < 100` (*a boolean result*) to the variable `file_upload_started`
So if `progress` is less than `100` then it will set the `file_upload_started` to `true`, otherwise to `false` | Standard javascript. The expression on the right hand side is evaluated and the result assigned to the left hand side, so:
```
progress < 100
```
is evaluated and will return either true or false (or an error if progress hasn't been defined). That result is assigned:
```
file_upload_started = <value of expression>;... |
8,394,330 | I have just come across the javascript code
`file_upload_started = progress < 100;`
and I have NO idea how to read it and Google isn't really turning much up. I'm not even sure what to call it so it's hard to do a search.
If anyone has any information about this type of equation, that would be much appreciated. | 2011/12/06 | [
"https://Stackoverflow.com/questions/8394330",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/325626/"
] | Standard javascript. The expression on the right hand side is evaluated and the result assigned to the left hand side, so:
```
progress < 100
```
is evaluated and will return either true or false (or an error if progress hasn't been defined). That result is assigned:
```
file_upload_started = <value of expression>;... | Read it something like this:
```
file_upload_started = (progress < 100);
```
It just returns a boolean value that is set to the variable. |
69,220 | What is exactly meant by *output compliance* of a current source? I've read that it's the range of voltage over which the current source behaves well. What exactly does ***behaving well*** mean?
---
I've got a little problem based on this concept, but Im not sure how to go about it.
*You have +5 and +15 volt regul... | 2013/05/14 | [
"https://electronics.stackexchange.com/questions/69220",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/23856/"
] | A well behaved (ideal) current source keeps the current constant no matter what its voltage is.
There are of course lots of different topologies for making current sources, just like there are lots of ways of making voltage sources. However, what this question is referring to is a special property of BJTs that can be ... | An ideal current source has infinite output resistance. A reasonable one has very very high output resistance. What this menas is that it will drive, the designed for current, into the load regardless of what that load is. In a simple model if you have a 1A source and you drive a 1 Ohm load the current source has to be... |
7,243,703 | I'm trying to find a best practice for getting values for a databound control. The way my application works now (and usually) is on page load I call a getSettings() or something and that makes a database call for each of the DropDownLists or Repeaters.
In this particular occasion I bind data to a DropDownList dependin... | 2011/08/30 | [
"https://Stackoverflow.com/questions/7243703",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/854803/"
] | This should be the safest and most universal way. It's null-safe, you don't need an extra != null check:
```
SomeClass.class.isInstance(result)
```
**Reference:**
[`Class.isInstance(Object)`](http://download.oracle.com/javase/6/docs/api/java/lang/Class.html#isInstance%28java.lang.Object%29) | You can use `result.getClass()` |
7,243,703 | I'm trying to find a best practice for getting values for a databound control. The way my application works now (and usually) is on page load I call a getSettings() or something and that makes a database call for each of the DropDownLists or Repeaters.
In this particular occasion I bind data to a DropDownList dependin... | 2011/08/30 | [
"https://Stackoverflow.com/questions/7243703",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/854803/"
] | This should be the safest and most universal way. It's null-safe, you don't need an extra != null check:
```
SomeClass.class.isInstance(result)
```
**Reference:**
[`Class.isInstance(Object)`](http://download.oracle.com/javase/6/docs/api/java/lang/Class.html#isInstance%28java.lang.Object%29) | No.
Use [Class.isAssignableFrom()](http://download.oracle.com/javase/6/docs/api/java/lang/Class.html#isAssignableFrom%28java.lang.Class%29) |
600,190 | In my application I have to maintain some global application state and global application wide methods like currently connected users, total number of answers, create an application config file etc. There are two options:
1. Make a separate appstate.py file with global variables with functions over them. It looks fine... | 2009/03/01 | [
"https://Stackoverflow.com/questions/600190",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/69746/"
] | The second approach is only significantly different from the first approach if you have application state stored in an *instance* of AppState, in which case your complaint doesn't apply. If you're just storing stuff in a class and using static/class methods, your class is no different than a module, and it would be pyt... | Why not go with an instance of that class? That way you might even be able later on to have 2 different "sessions" running, depending on what instance you use. It might make it more flexible. Maybe add some method `get_appstate()` to the module so it instanciates the class once. Later on if you might want several insta... |
600,190 | In my application I have to maintain some global application state and global application wide methods like currently connected users, total number of answers, create an application config file etc. There are two options:
1. Make a separate appstate.py file with global variables with functions over them. It looks fine... | 2009/03/01 | [
"https://Stackoverflow.com/questions/600190",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/69746/"
] | Sounds like the classic conundrum :-).
In Python, there's nothing dirty or shameful about choosing to use a module if that's the best approach. After all, modules, functions, and the like are, in fact, first-class citizens in the language, and offer introspection and properties that many other programming languages of... | Consider this example:
```
configuration
|
+-> graphics
| |
| +-> 3D
| |
| +-> 2D
|
+-> sound
```
The real question is: What is the difference between classes and modules in this hierarchy, as it could be represented by both means?
Classes represent types. If you implement your solution with classes instead... |
600,190 | In my application I have to maintain some global application state and global application wide methods like currently connected users, total number of answers, create an application config file etc. There are two options:
1. Make a separate appstate.py file with global variables with functions over them. It looks fine... | 2009/03/01 | [
"https://Stackoverflow.com/questions/600190",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/69746/"
] | The second approach is only significantly different from the first approach if you have application state stored in an *instance* of AppState, in which case your complaint doesn't apply. If you're just storing stuff in a class and using static/class methods, your class is no different than a module, and it would be pyt... | Consider this example:
```
configuration
|
+-> graphics
| |
| +-> 3D
| |
| +-> 2D
|
+-> sound
```
The real question is: What is the difference between classes and modules in this hierarchy, as it could be represented by both means?
Classes represent types. If you implement your solution with classes instead... |
600,190 | In my application I have to maintain some global application state and global application wide methods like currently connected users, total number of answers, create an application config file etc. There are two options:
1. Make a separate appstate.py file with global variables with functions over them. It looks fine... | 2009/03/01 | [
"https://Stackoverflow.com/questions/600190",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/69746/"
] | The second approach is only significantly different from the first approach if you have application state stored in an *instance* of AppState, in which case your complaint doesn't apply. If you're just storing stuff in a class and using static/class methods, your class is no different than a module, and it would be pyt... | I'd definitely go for the second option : having already used the first one, I'm now forced to refactor, as my application evolved and have to support more modular constructs, so I now need to handle multiple simulataneous 'configurations'.
The second approach is, IMO, more flexible and future proof. To avoid the long... |
600,190 | In my application I have to maintain some global application state and global application wide methods like currently connected users, total number of answers, create an application config file etc. There are two options:
1. Make a separate appstate.py file with global variables with functions over them. It looks fine... | 2009/03/01 | [
"https://Stackoverflow.com/questions/600190",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/69746/"
] | The second approach seems better. I'd use the first one only for configuration files or something.
Anyway, to avoid the problem you could always:
```
from myapp.appstate import AppState
```
That way you don't have to write the long line anymore. | Why not go with an instance of that class? That way you might even be able later on to have 2 different "sessions" running, depending on what instance you use. It might make it more flexible. Maybe add some method `get_appstate()` to the module so it instanciates the class once. Later on if you might want several insta... |
600,190 | In my application I have to maintain some global application state and global application wide methods like currently connected users, total number of answers, create an application config file etc. There are two options:
1. Make a separate appstate.py file with global variables with functions over them. It looks fine... | 2009/03/01 | [
"https://Stackoverflow.com/questions/600190",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/69746/"
] | The second approach seems better. I'd use the first one only for configuration files or something.
Anyway, to avoid the problem you could always:
```
from myapp.appstate import AppState
```
That way you don't have to write the long line anymore. | Consider this example:
```
configuration
|
+-> graphics
| |
| +-> 3D
| |
| +-> 2D
|
+-> sound
```
The real question is: What is the difference between classes and modules in this hierarchy, as it could be represented by both means?
Classes represent types. If you implement your solution with classes instead... |
600,190 | In my application I have to maintain some global application state and global application wide methods like currently connected users, total number of answers, create an application config file etc. There are two options:
1. Make a separate appstate.py file with global variables with functions over them. It looks fine... | 2009/03/01 | [
"https://Stackoverflow.com/questions/600190",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/69746/"
] | Consider this example:
```
configuration
|
+-> graphics
| |
| +-> 3D
| |
| +-> 2D
|
+-> sound
```
The real question is: What is the difference between classes and modules in this hierarchy, as it could be represented by both means?
Classes represent types. If you implement your solution with classes instead... | I'd definitely go for the second option : having already used the first one, I'm now forced to refactor, as my application evolved and have to support more modular constructs, so I now need to handle multiple simulataneous 'configurations'.
The second approach is, IMO, more flexible and future proof. To avoid the long... |
600,190 | In my application I have to maintain some global application state and global application wide methods like currently connected users, total number of answers, create an application config file etc. There are two options:
1. Make a separate appstate.py file with global variables with functions over them. It looks fine... | 2009/03/01 | [
"https://Stackoverflow.com/questions/600190",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/69746/"
] | Sounds like the classic conundrum :-).
In Python, there's nothing dirty or shameful about choosing to use a module if that's the best approach. After all, modules, functions, and the like are, in fact, first-class citizens in the language, and offer introspection and properties that many other programming languages of... | I'd definitely go for the second option : having already used the first one, I'm now forced to refactor, as my application evolved and have to support more modular constructs, so I now need to handle multiple simulataneous 'configurations'.
The second approach is, IMO, more flexible and future proof. To avoid the long... |
600,190 | In my application I have to maintain some global application state and global application wide methods like currently connected users, total number of answers, create an application config file etc. There are two options:
1. Make a separate appstate.py file with global variables with functions over them. It looks fine... | 2009/03/01 | [
"https://Stackoverflow.com/questions/600190",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/69746/"
] | Why not go with an instance of that class? That way you might even be able later on to have 2 different "sessions" running, depending on what instance you use. It might make it more flexible. Maybe add some method `get_appstate()` to the module so it instanciates the class once. Later on if you might want several insta... | I'd definitely go for the second option : having already used the first one, I'm now forced to refactor, as my application evolved and have to support more modular constructs, so I now need to handle multiple simulataneous 'configurations'.
The second approach is, IMO, more flexible and future proof. To avoid the long... |
600,190 | In my application I have to maintain some global application state and global application wide methods like currently connected users, total number of answers, create an application config file etc. There are two options:
1. Make a separate appstate.py file with global variables with functions over them. It looks fine... | 2009/03/01 | [
"https://Stackoverflow.com/questions/600190",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/69746/"
] | Sounds like the classic conundrum :-).
In Python, there's nothing dirty or shameful about choosing to use a module if that's the best approach. After all, modules, functions, and the like are, in fact, first-class citizens in the language, and offer introspection and properties that many other programming languages of... | The second approach seems better. I'd use the first one only for configuration files or something.
Anyway, to avoid the problem you could always:
```
from myapp.appstate import AppState
```
That way you don't have to write the long line anymore. |
19,349,400 | When I get a run-time error, VS normally points me to the line where error occurred.
But I cannot edit anything until the program closes. And VS doesn't close it for me.
Instead I have to manually end it in Task Manager (What I have been doing so far)
Now, there must be a more convenient way of closing to prog... | 2013/10/13 | [
"https://Stackoverflow.com/questions/19349400",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/945273/"
] | There are a couple of things that you can do to end the program. One common keyboard shortcut is Shift-F5 (stop debugging).
The other is the Stop Debugging button on the VS debugging toolbar. | There's a Stop button in the VS toolbar:
 |
19,349,400 | When I get a run-time error, VS normally points me to the line where error occurred.
But I cannot edit anything until the program closes. And VS doesn't close it for me.
Instead I have to manually end it in Task Manager (What I have been doing so far)
Now, there must be a more convenient way of closing to prog... | 2013/10/13 | [
"https://Stackoverflow.com/questions/19349400",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/945273/"
] | There is stop button in Visual Studio.
 | There are a couple of things that you can do to end the program. One common keyboard shortcut is Shift-F5 (stop debugging).
The other is the Stop Debugging button on the VS debugging toolbar. |
19,349,400 | When I get a run-time error, VS normally points me to the line where error occurred.
But I cannot edit anything until the program closes. And VS doesn't close it for me.
Instead I have to manually end it in Task Manager (What I have been doing so far)
Now, there must be a more convenient way of closing to prog... | 2013/10/13 | [
"https://Stackoverflow.com/questions/19349400",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/945273/"
] | There's a stop button (green square) on the debug toolbar. That will halt your program (in 99% of time).
The reason it is not stopped automatically, is to allow inspection of your failed program state. But that kind of speaks for itself.
Edit: (oh, sorry it's blue as Rahul's screencapture points out) | There's a Stop button in the VS toolbar:
 |
19,349,400 | When I get a run-time error, VS normally points me to the line where error occurred.
But I cannot edit anything until the program closes. And VS doesn't close it for me.
Instead I have to manually end it in Task Manager (What I have been doing so far)
Now, there must be a more convenient way of closing to prog... | 2013/10/13 | [
"https://Stackoverflow.com/questions/19349400",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/945273/"
] | There is stop button in Visual Studio.
 | There's a stop button (green square) on the debug toolbar. That will halt your program (in 99% of time).
The reason it is not stopped automatically, is to allow inspection of your failed program state. But that kind of speaks for itself.
Edit: (oh, sorry it's blue as Rahul's screencapture points out) |
19,349,400 | When I get a run-time error, VS normally points me to the line where error occurred.
But I cannot edit anything until the program closes. And VS doesn't close it for me.
Instead I have to manually end it in Task Manager (What I have been doing so far)
Now, there must be a more convenient way of closing to prog... | 2013/10/13 | [
"https://Stackoverflow.com/questions/19349400",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/945273/"
] | There is stop button in Visual Studio.
 | There's a Stop button in the VS toolbar:
 |
193,776 | I just want to get the pivot location of the 3d model!
[](https://i.stack.imgur.com/Beygz.png)
I tried to set the cursor to pivot position and print the cursor location
```
import bpy
bpy.ops.view3d.snap_cursor_to_selected()
print(bpy.context.scene... | 2020/09/07 | [
"https://blender.stackexchange.com/questions/193776",
"https://blender.stackexchange.com",
"https://blender.stackexchange.com/users/33446/"
] | Objects pivot around their origins, or (0, 0, 0) in their local space. An object's position is simply the location of its origin in world space. You can get this as a Vector from the object's location variable:
```
import bpy
obj = bpy.context.active_object
print(obj.location)
```
If you actually did want to set th... | **Global and Local**
The scene cursor location is in global coordinates.
For an object `ob`
What you see in the location field of an object is its basis matrix translation.
```
ob.matrix_basis.translation # == ob.location
```
, Rarely for an object with parents and / or constraints will `ob.location` also be the ... |
562,288 | Does a similar connection cause conflicts or damage?
[](https://i.stack.imgur.com/IphPS.png)
An example of situation in which it's used. I've seen it's common practice in RF to put an inductor (RF Choke) between the drain of a MOSFET and VDD like in ... | 2021/04/27 | [
"https://electronics.stackexchange.com/questions/562288",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/214898/"
] | As you would expect with a voltage and a current source in parallel, the current is defined by the current source, and voltage is defined by the voltage source.
The RF choke therefore constrains the DC value of the drain voltage to be equal to the supply. The FET causes its average current to flow through the RF choke... | In your circuit at DC, think of the MOSFET more like a switch than a current source since at DC you'll mostly be in the triode region. The voltage Vdd squared divided by the drain-source resistance will give you the power dissipated, and you want that to be small enough to not burn out the transistor (when using it lik... |
54,572,154 | I have question: I have stored procedure A(return three out paramters). I want to call procedure A in loop and insert these three parameters into temporaty table and return this table.
```
DECLARE
Type TestTable IS TABE OF NUMBER; -- for example one parameter!!!
myTable TestTable;
BEGIN
LOOP
A(o_param1... | 2019/02/07 | [
"https://Stackoverflow.com/questions/54572154",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8927212/"
] | write insert statement inside the loop. so for each loop you can have the values inserted to the table and give a commit after the loop.
But you cannot have a select \* from table inside the anonymous block. Remove that from the block and after end; you can try running select \* from table to see the output.
```
BEGI... | First, you cannot insert data into myTable directly (insert into myTable) because Oracle table types, declared in a declare section of the script, are not visible in sql statements (exception - insert using 'bulk collect' with types, declared in Oracle dictionary).
Even if you insert data in myTable using myTable(idx).... |
48,489 | I just bought a new electronic ballast to replace the old one for my florescent lamp. However, the connection diagram on the ballast does not indicate where I should connect the live and neutral wires. There are also no L and N markings on either side.
 and also check the permissions on the file with `ls -l`. | You might wanna do:
```
fs.readFile("./quotes.json", "utf8", function(err, data) {
if(err) console.log(err);
```
So that it shows you the Error |
55,951,264 | With this code:
```
strs = ["111", "1000", "1000", "1000"]
# count the numbers of '0' and '1' respectively for each string in strs
counts = map(lambda x: [x.count('0'), x.count('1')], strs)
cntSortBy0 = sorted(counts, key=lambda x: x[0]) # sort with counts of '0'
cntSortBy1 = sorted(counts, key=lambda x: x[1]) # ... | 2019/05/02 | [
"https://Stackoverflow.com/questions/55951264",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10870360/"
] | In Python3 `map` returns an iterator:
<https://docs.python.org/3/library/functions.html#map>
And iterators can (and should) be used only once. See official doc about iterators:
<https://docs.python.org/3/tutorial/classes.html#iterators>
In your case you need to convert `map` to `list` upon creation, that'll solve you... | Once an iterator has been exhausted (meaning, fully iterated over), there is nothing left to be iterated over, so iterating over it a second time won't yield anything. Take this example.
```
a = map(int,['1','2','3'])
for i in a:
print(i)
for i in a:
print(i)
```
This will output:
```
1
2
3
```
Whenever... |
55,951,264 | With this code:
```
strs = ["111", "1000", "1000", "1000"]
# count the numbers of '0' and '1' respectively for each string in strs
counts = map(lambda x: [x.count('0'), x.count('1')], strs)
cntSortBy0 = sorted(counts, key=lambda x: x[0]) # sort with counts of '0'
cntSortBy1 = sorted(counts, key=lambda x: x[1]) # ... | 2019/05/02 | [
"https://Stackoverflow.com/questions/55951264",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10870360/"
] | In Python3 `map` returns an iterator:
<https://docs.python.org/3/library/functions.html#map>
And iterators can (and should) be used only once. See official doc about iterators:
<https://docs.python.org/3/tutorial/classes.html#iterators>
In your case you need to convert `map` to `list` upon creation, that'll solve you... | According to the docs: <https://docs.python.org/3/library/functions.html#map>
>
> map(function, iterable, ...)
>
> Return an iterator that applies function to every item of iterable, yielding the results.
>
>
>
What a map does is returns an iterator, which you can iterate on, but once you are done iterating o... |
55,951,264 | With this code:
```
strs = ["111", "1000", "1000", "1000"]
# count the numbers of '0' and '1' respectively for each string in strs
counts = map(lambda x: [x.count('0'), x.count('1')], strs)
cntSortBy0 = sorted(counts, key=lambda x: x[0]) # sort with counts of '0'
cntSortBy1 = sorted(counts, key=lambda x: x[1]) # ... | 2019/05/02 | [
"https://Stackoverflow.com/questions/55951264",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10870360/"
] | Once an iterator has been exhausted (meaning, fully iterated over), there is nothing left to be iterated over, so iterating over it a second time won't yield anything. Take this example.
```
a = map(int,['1','2','3'])
for i in a:
print(i)
for i in a:
print(i)
```
This will output:
```
1
2
3
```
Whenever... | According to the docs: <https://docs.python.org/3/library/functions.html#map>
>
> map(function, iterable, ...)
>
> Return an iterator that applies function to every item of iterable, yielding the results.
>
>
>
What a map does is returns an iterator, which you can iterate on, but once you are done iterating o... |
69,600,941 | Using stripe's API and the Integration Builder, before you go to the checkout page, you can get the `id` of the `Ceckout Sessions` in the `create-checkout-session.php` file. (<https://stripe.com/docs/api/checkout/sessions/object?lang=php>)
My plan is to use that session ID later on to get the customer's ID and the sub... | 2021/10/17 | [
"https://Stackoverflow.com/questions/69600941",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16428646/"
] | To be clear,
* You can retrieve the full details of a [Checkout Session](https://stripe.com/docs/api/checkout/sessions) any time using the API : <https://stripe.com/docs/api/checkout/sessions/retrieve>. There is no "expiry" for this.
* You can only access the full data of an [Event](https://stripe.com/docs/api/events)... | Checkout sessions aren't stored forever. They live for short period of time and after that they expire. However, if you need the customer and subscription id, you can follow the following steps (same i use in one of my project).
1. Create Checkout Session and once user redirect back to the website after successful che... |
298,179 | My question is in the title above. I'm asking in informal way, I mean, can I use that in my daily conversation? This problem arose from learning languages app. The app said the correct answer is
>
> What are you thinking?
>
>
>
I consulted this problem to the app group, some English native speakers said it's inco... | 2021/09/21 | [
"https://ell.stackexchange.com/questions/298179",
"https://ell.stackexchange.com",
"https://ell.stackexchange.com/users/110852/"
] | '*My* favourite' means 'the one *I* like best'. 'Brooke's favourite' would be the one *she* likes best.
You could say 'It's my favourite of all Brooke's songs'. | The **'s** marker does not always indicate possession.
**My favorite song** *means* `the song that I like best.`
**Brooke's favorite song** *means* `the song that Brooke likes best.` And it means only that. It indicates nothing about the person who wrote or recorded the song, who owns the copyright, or anything like ... |
72,782,659 | I would like to install Flutter on my Apple M1 machine using [Homebrew](https://formulae.brew.sh/cask/flutter). But I am a bit hesitant because I am not sure if this will provide any benefits or it will create more trouble (e.g. permission issues). An alternative way would to be install Flutter using its installer from... | 2022/06/28 | [
"https://Stackoverflow.com/questions/72782659",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13690331/"
] | I ended up installing Flutter in with the following steps:
1. Install `Homebrew` (if you dont already have)\* - [install Homebrew](https://brew.sh/)
2. Install `fvm` using `Homebrew` - [install fvm](https://fvm.app/docs/getting_started/installation/)
3. Install your wanted `flutter` version through `fvm` - [fvm docume... | @ilpianoforte Does a great job outlining the steps, but I needed to do an additional step for macOS 13.x. So, I thought I would consolidate here.
To install Flutter via Homebrew.
1. Install `Homebrew`
```
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
```
2. Install... |
7,677,924 | I'm new to Git and I'm a little confused how to use "git fetch"
I have a central repository that I access using SSH, I have created a repository using git clone, just like this:
```
$ cd /my/local/repotest
$ git clone ssh://andre@somedomain.com/var/github/repotest .
```
Now other developer have pushed some new file... | 2011/10/06 | [
"https://Stackoverflow.com/questions/7677924",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/488735/"
] | Converting a pointer to/from an integer is implementation defined.
[Here](http://gcc.gnu.org/onlinedocs/gcc/Arrays-and-pointers-implementation.html) is how gcc does it, i.e. it sign extends if the integer type is larger than the pointer type(this'll happen regardless of the integer being signed or unsigned, just becau... | From the C99 standard (§6.3.2.3/6):
>
> Any pointer type may be converted to an integer type. Except as previously specified, **the
> result is implementation-defined**. If the result cannot be represented in the integer type,
> the behavior is undefined. The result need not be in the range of values of any integer... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.