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 |
|---|---|---|---|---|---|
8,902,406 | I have a solution with differents projects in it, One those is an MVC 3 project, and the other is a test project.
From the test project, I'm trying to test my controllers behavior. But when I'm running a test the system throws an error telling me this:
>
> System.IO.FileNotFoundException: Could not load file or asse... | 2012/01/17 | [
"https://Stackoverflow.com/questions/8902406",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/925714/"
] | In case anyone is looking for a solution to this problem in Visual Studio 2012, this website helped me out:
<http://www.yeronimo.nl/post/2013/03/27/Error-1-Referencesvcmap-Could-not-load-file-or-assembly-xxxxxxx-etc>
(also: <http://www.christowles.com/2012/08/could-not-load-file-or-assembly.html>)
Right-click on the... | Or you can add a reference to the correct dll version in the test project. |
33,606 | The BBC's [Milky Way's centre exploded 3.5 million years ago](https://www.bbc.com/news/science-environment-49955468) says:
>
> A cataclysmic energy flare ripped through our galaxy, the Milky Way, about 3.5 million years ago, a team of astronomers say.
>
>
> They say the so-called Sifter flare started near the super... | 2019/10/07 | [
"https://astronomy.stackexchange.com/questions/33606",
"https://astronomy.stackexchange.com",
"https://astronomy.stackexchange.com/users/7982/"
] | As has now been corrected, BBC has misunderstood term "Seyfert flare", instead calling it a "*Sifter* flare".
---
A "Seyfert flare", is not really a common term, but the authors refer to an energetic outburst from the type of active galaxies called [Seyfert galaxies](https://en.wikipedia.org/wiki/Seyfert_galaxy) (aft... | Answering the who is part of the question.
[Carl Seyfert](https://en.wikipedia.org/wiki/Carl_Keenan_Seyfert) (1911-1960) was a US astronomer.
>
> He is best known for his 1943 research paper on high-excitation line emission from the centers of some spiral galaxies, which are named Seyfert galaxies after him. [Seyfe... |
33,769,708 | I came across Project Oxford and became really interested in it and using its API, specifically the emotion one. Microsoft provides sample code
```
########### Python 2.7 #############
import httplib, urllib, base64
headers = {
# Request headers
'Content-Type': 'application/json',
'Ocp-Apim-Subscription-K... | 2015/11/18 | [
"https://Stackoverflow.com/questions/33769708",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5574418/"
] | You need to pass `str(body)` to the request.
Also, make sure to not include `params` if you don't have any face rectangles. | The following works for me (Python 2.7), also based on the sample code provided by MSDN. You don't need to specify faceRectangles (unless you want to because they've already been detected, to save compute time).
```
import httplib, urllib, base64
# Image to analyse (body of the request)
body = '{\'URL\': \'https:/... |
10,468 | I've just pulled some beetroot out of my garden.
I've never cooked beetroot before so would love a few suggestions. | 2010/12/24 | [
"https://cooking.stackexchange.com/questions/10468",
"https://cooking.stackexchange.com",
"https://cooking.stackexchange.com/users/1410/"
] | Basically you boil them or roast them until tender, then let them cool and peel them. It is better not to cut or peel them before cooking, they will bleed lots of color and flavor. Some classic things to do with them: puree into a soup called borscht, slice them in a salad (particularly nice with goat cheese), serve as... | I like them steamed: Steam , unpeeled, for around 35 minutes depending on size. Use paper towel to rub off the peel after it's cooked, and then slice.
They're very likely to stain your nice towels, clothing, and counter-tops .... a cutting board is recommended. |
10,468 | I've just pulled some beetroot out of my garden.
I've never cooked beetroot before so would love a few suggestions. | 2010/12/24 | [
"https://cooking.stackexchange.com/questions/10468",
"https://cooking.stackexchange.com",
"https://cooking.stackexchange.com/users/1410/"
] | I like them steamed: Steam , unpeeled, for around 35 minutes depending on size. Use paper towel to rub off the peel after it's cooked, and then slice.
They're very likely to stain your nice towels, clothing, and counter-tops .... a cutting board is recommended. | The only way i have beets is roasted with a little olive oil, salt and pepper(fresh cracked of course). I find that if steamed or boiled, the beet flavor gets watered down. Sometimes i make a relish like dish with with the baked beets sliced along with parsely, garlic,onions, and a light drizzle of white vinegar, letti... |
10,468 | I've just pulled some beetroot out of my garden.
I've never cooked beetroot before so would love a few suggestions. | 2010/12/24 | [
"https://cooking.stackexchange.com/questions/10468",
"https://cooking.stackexchange.com",
"https://cooking.stackexchange.com/users/1410/"
] | Basically you boil them or roast them until tender, then let them cool and peel them. It is better not to cut or peel them before cooking, they will bleed lots of color and flavor. Some classic things to do with them: puree into a soup called borscht, slice them in a salad (particularly nice with goat cheese), serve as... | The only way i have beets is roasted with a little olive oil, salt and pepper(fresh cracked of course). I find that if steamed or boiled, the beet flavor gets watered down. Sometimes i make a relish like dish with with the baked beets sliced along with parsely, garlic,onions, and a light drizzle of white vinegar, letti... |
10,468 | I've just pulled some beetroot out of my garden.
I've never cooked beetroot before so would love a few suggestions. | 2010/12/24 | [
"https://cooking.stackexchange.com/questions/10468",
"https://cooking.stackexchange.com",
"https://cooking.stackexchange.com/users/1410/"
] | Basically you boil them or roast them until tender, then let them cool and peel them. It is better not to cut or peel them before cooking, they will bleed lots of color and flavor. Some classic things to do with them: puree into a soup called borscht, slice them in a salad (particularly nice with goat cheese), serve as... | My Russian Flatmate inspired me to try 'beetroot chocolate cake'. The beetroot keeps the cake really moist but without the need to use much butter/oil. It's really healthy and tastes very rich and moist, almost similar to chocolate browny. I made two of them in the last couple of weeks and will make another one tomorro... |
10,468 | I've just pulled some beetroot out of my garden.
I've never cooked beetroot before so would love a few suggestions. | 2010/12/24 | [
"https://cooking.stackexchange.com/questions/10468",
"https://cooking.stackexchange.com",
"https://cooking.stackexchange.com/users/1410/"
] | My Russian Flatmate inspired me to try 'beetroot chocolate cake'. The beetroot keeps the cake really moist but without the need to use much butter/oil. It's really healthy and tastes very rich and moist, almost similar to chocolate browny. I made two of them in the last couple of weeks and will make another one tomorro... | The only way i have beets is roasted with a little olive oil, salt and pepper(fresh cracked of course). I find that if steamed or boiled, the beet flavor gets watered down. Sometimes i make a relish like dish with with the baked beets sliced along with parsely, garlic,onions, and a light drizzle of white vinegar, letti... |
7,147,147 | I have a form with add, edit, and save buttons. The form also has a datagridview.
I have done this to update existing product entities and to add new product entities, then display the altered data in the datagridview.
When I click on edit button, the save button will be displayed and the statements that I have writt... | 2011/08/22 | [
"https://Stackoverflow.com/questions/7147147",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/899271/"
] | This is just an example. What your need to do is pull the current object from collection you are editing/saving using linq and then make the changed on the retrieved object and then update i.e.
```
public bool UpdateCustomer(Customer customer){
Customer cust = entities.Customers.FirstOrDefault(c => c.ID == cust... | Have you checked the event handlers for those buttons? Are they wired into the correct buttons? It sounds like your edit button is firing the event handler for new products and it sounds like the add button is firing the event handler for editing a product. I would definitely check that first instead of looking for a w... |
12,838,322 | I want to show a ProgressDialog when pressing any item of my listview while the Detail class is turning in background, i know that i have to use asyncTask but i can't figure out how, can any one help me please?
This is my fragment where i went to show the ProgressDialog
```
public class FeedPlayerIndexFragment extend... | 2012/10/11 | [
"https://Stackoverflow.com/questions/12838322",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1400646/"
] | You can try this code
```
public class DetailActivity extends Activity
{
String descriptionFinale = null,imageFinale = null,url;
int position;
TextView description_,titre,date;
ImageView image_;
ArrayList<Article> feeds ;
WebView contentWebView;
ProgressDialog dialog;
@Override
protected void onCreate(Bundl... | this is an example of asynctask hope this will help
```
class NewCouponsTask extends AsyncTask<String, Void, ArrayList<NewCoupons>>
{
NewCouponsScreen parentActivity;
public NewCouponsTask(NewCouponsScreen parent) {
// TODO Auto-generated constructor stub
parentActivity = parent;
}
@Override
protected vo... |
44,548,908 | Im trying to figure out the basics of joining Observables in Angular. I've found several examples but can't seem to figure out how to get it working efficiently.
I have the following datastructure:
```
- courses
- $courseid1
- $courseid2
- $courseid3
- ...
- teachers
- $teacherid1
- $teacheri... | 2017/06/14 | [
"https://Stackoverflow.com/questions/44548908",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1306861/"
] | What I would do is something along the following lines.
First I would build the method to query the courses, something like yours
```
getFullCourseBySlug(slug:string) {
return this.db.list('academy/courses', {
query: {
orderByChild: 'slug',
equalTo: slug
}
}).map((courses) => courses[0]);
}
```
Th... | Picci's answer helped me in the right direction, this is my final solution:
```
getTeachersPerCourse(courseid:string):Observable<Teacher[]> {
return this.db.list(`academy/teachersPerCourse/${courseid}`)
.switchMap( (teachers) => {
let teacherObservables = [];
for(let teacher of teachers){
teacherObse... |
30,559,374 | how can I select a subset of the data and plot it using `shiny` & `ggvis`?
As the ggvis [documentation](http://ggvis.rstudio.com/interactivity.html) states, it is not possible to swap the dataset using `ggvis` `input_select`. Besides this limitation it would be awesome if the data preprocessing & filtering would have t... | 2015/05/31 | [
"https://Stackoverflow.com/questions/30559374",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2587904/"
] | Your code has a few problems and doesn't run... why are you returning from the main server function? And you're using two variables `dataFiltered` and `rawData` that aren't defined anywhere.
Here is the solution of what you're trying to do
```
runApp(shinyApp(
ui = fluidPage(
uiOutput("choose_dataset"),
gg... | @daattali - I have a suggested improvement to your solution. You use filter in the observeEvent, which introduces NA's to the solution and causes the event to fire incorrectly. Instead, use subset as shown below:
```
runApp(shinyApp(
ui = fluidPage(
uiOutput("choose_dataset"),
ggvisOutput("plot1")
),
ser... |
62,099,799 | I would like to convert the string values in column b to float. Wondering how should I make it.
```
A B
1 16-1/4
2 3-1/4
3 21-1/4
4 8-1/4
``` | 2020/05/30 | [
"https://Stackoverflow.com/questions/62099799",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8189399/"
] | You actually don't need to even use a `CASE` expression here:
```
SELECT *
FROM yourTable
WHERE (some_condition AND a < b) OR (!some_condition AND a > b);
```
That being said, I am surprised that an index cannot be used, because in general your logic can probably be optimized to something like the above, without nee... | Your query is not so much clear.But as per assumption,you can do something like this
SELECT
CASE WHEN table.col && object = true THEN true ELSE false END as
INTO #TEMP\_TABLE
FROM table
Then you can create a CLUSTERED/NON\_CLUSTERED INDEX
CREATE INDEX idx\_col on TABLE #TEMP\_TABLE()
Then you can select the res... |
62,099,799 | I would like to convert the string values in column b to float. Wondering how should I make it.
```
A B
1 16-1/4
2 3-1/4
3 21-1/4
4 8-1/4
``` | 2020/05/30 | [
"https://Stackoverflow.com/questions/62099799",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8189399/"
] | I am guessing that there is not situation where a `case` expression would use an index in Postgres. This is because the `case` expression enforces an order of evaluation -- which is quite hard to ensure once indexes are involved.
There might be some exceptions where the compiler recognizes that the `case` expression i... | Your query is not so much clear.But as per assumption,you can do something like this
SELECT
CASE WHEN table.col && object = true THEN true ELSE false END as
INTO #TEMP\_TABLE
FROM table
Then you can create a CLUSTERED/NON\_CLUSTERED INDEX
CREATE INDEX idx\_col on TABLE #TEMP\_TABLE()
Then you can select the res... |
68,956,201 | I'm using bootstrap 3.3.7 and my navbar is not collapsing on smaller devices. Navbar does appear, but clicking on the `navbar-toggle` button does not bring any options up.
```html
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" ... | 2021/08/27 | [
"https://Stackoverflow.com/questions/68956201",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16768548/"
] | You can `split` when the character is not a number.
The 'max splits' method is used for performance, so you don't unnecessarily split part of the input you don't need. There are also preconditions to handle any bad input.
```
func substringLength(of input: String, at index: Int) -> Int {
precondition(index >= 0, ... | If the sign (operator) is fixed then you can replace all signs with a common one sign and split the string by a common sign.
Here is the example
```
extension String {
func getSubStrings() -> [String] {
let commonSignStr = self.replacingOccurrences(of: "+", with: "-").replacingOccurrences(of: "*", with: "... |
68,956,201 | I'm using bootstrap 3.3.7 and my navbar is not collapsing on smaller devices. Navbar does appear, but clicking on the `navbar-toggle` button does not bring any options up.
```html
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" ... | 2021/08/27 | [
"https://Stackoverflow.com/questions/68956201",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16768548/"
] | ### ⚠️ Be aware of using `replacingOccurrences`!
Although this method (mentioned by @Raja Kishan) may work in some cases, it's not forward compatible and will fail if you have unhandled characters (like other expression operators)
---
### ✅ Just write it as you say it:
```
let numbers = "90000+8000-1000*10".split {... | If the sign (operator) is fixed then you can replace all signs with a common one sign and split the string by a common sign.
Here is the example
```
extension String {
func getSubStrings() -> [String] {
let commonSignStr = self.replacingOccurrences(of: "+", with: "-").replacingOccurrences(of: "*", with: "... |
68,956,201 | I'm using bootstrap 3.3.7 and my navbar is not collapsing on smaller devices. Navbar does appear, but clicking on the `navbar-toggle` button does not bring any options up.
```html
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" ... | 2021/08/27 | [
"https://Stackoverflow.com/questions/68956201",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16768548/"
] | ### ⚠️ Be aware of using `replacingOccurrences`!
Although this method (mentioned by @Raja Kishan) may work in some cases, it's not forward compatible and will fail if you have unhandled characters (like other expression operators)
---
### ✅ Just write it as you say it:
```
let numbers = "90000+8000-1000*10".split {... | You can `split` when the character is not a number.
The 'max splits' method is used for performance, so you don't unnecessarily split part of the input you don't need. There are also preconditions to handle any bad input.
```
func substringLength(of input: String, at index: Int) -> Int {
precondition(index >= 0, ... |
68,956,201 | I'm using bootstrap 3.3.7 and my navbar is not collapsing on smaller devices. Navbar does appear, but clicking on the `navbar-toggle` button does not bring any options up.
```html
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" ... | 2021/08/27 | [
"https://Stackoverflow.com/questions/68956201",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16768548/"
] | You can `split` when the character is not a number.
The 'max splits' method is used for performance, so you don't unnecessarily split part of the input you don't need. There are also preconditions to handle any bad input.
```
func substringLength(of input: String, at index: Int) -> Int {
precondition(index >= 0, ... | I'd assume that the separators are not numbers, regardless of what they are.
```
let str = "90000+8000-1000*10"
let arr = str.split { !$0.isNumber }
let substringLength = arr.map { $0.count }
print(substringLength) // [5, 4, 4, 2]
print(substringLength[0]) //Show 5
print(substringLength[1]) //Show 4
``` |
68,956,201 | I'm using bootstrap 3.3.7 and my navbar is not collapsing on smaller devices. Navbar does appear, but clicking on the `navbar-toggle` button does not bring any options up.
```html
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" ... | 2021/08/27 | [
"https://Stackoverflow.com/questions/68956201",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16768548/"
] | You can `split` when the character is not a number.
The 'max splits' method is used for performance, so you don't unnecessarily split part of the input you don't need. There are also preconditions to handle any bad input.
```
func substringLength(of input: String, at index: Int) -> Int {
precondition(index >= 0, ... | Don't use [isNumber](https://developer.apple.com/documentation/swift/character/3127015-isnumber) Character property. This would allow fraction characters as well as many others that are not single digits 0...9.
>
> **Discussion**
>
> For example, the following characters all represent numbers:
>
> “7” (U+0037 D... |
68,956,201 | I'm using bootstrap 3.3.7 and my navbar is not collapsing on smaller devices. Navbar does appear, but clicking on the `navbar-toggle` button does not bring any options up.
```html
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" ... | 2021/08/27 | [
"https://Stackoverflow.com/questions/68956201",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16768548/"
] | ### ⚠️ Be aware of using `replacingOccurrences`!
Although this method (mentioned by @Raja Kishan) may work in some cases, it's not forward compatible and will fail if you have unhandled characters (like other expression operators)
---
### ✅ Just write it as you say it:
```
let numbers = "90000+8000-1000*10".split {... | I'd assume that the separators are not numbers, regardless of what they are.
```
let str = "90000+8000-1000*10"
let arr = str.split { !$0.isNumber }
let substringLength = arr.map { $0.count }
print(substringLength) // [5, 4, 4, 2]
print(substringLength[0]) //Show 5
print(substringLength[1]) //Show 4
``` |
68,956,201 | I'm using bootstrap 3.3.7 and my navbar is not collapsing on smaller devices. Navbar does appear, but clicking on the `navbar-toggle` button does not bring any options up.
```html
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" ... | 2021/08/27 | [
"https://Stackoverflow.com/questions/68956201",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16768548/"
] | ### ⚠️ Be aware of using `replacingOccurrences`!
Although this method (mentioned by @Raja Kishan) may work in some cases, it's not forward compatible and will fail if you have unhandled characters (like other expression operators)
---
### ✅ Just write it as you say it:
```
let numbers = "90000+8000-1000*10".split {... | Don't use [isNumber](https://developer.apple.com/documentation/swift/character/3127015-isnumber) Character property. This would allow fraction characters as well as many others that are not single digits 0...9.
>
> **Discussion**
>
> For example, the following characters all represent numbers:
>
> “7” (U+0037 D... |
23,586,404 | I am having trouble using the `asdf` build tools with common lisp. Here is my `fractals.asd` file:
```
(defpackage :fractals
(:use :cl :asdf :cl-opengl :cl-glu :cl-glut)
(:export :frac-tree :draw-tree))
(in-package :fractals)
;----------------------------------------------------------
(defsystem fractals
:name ... | 2014/05/10 | [
"https://Stackoverflow.com/questions/23586404",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1104823/"
] | You need to declare your dependencies in the `defsystem` with a `:depends-on` clause. The `:use` clause of the `defpackage` only makes names of already loaded packages available, but won't load them.
BTW, your `.asd` file should not include the `defpackage` of the main package. While it makes sense to declare a specia... | 1- Looks like you were using the undefined fractals:defsystem instead of asdf:defsystem
2- the ASDF DSL accepts the directive (:directory (:home "lisp\_proj/fractals\_2"))
3- Starting with 3.1.2, you can put everything under ~/common-lisp/
4- For God's Sake, RTFM! |
72,739,136 | I am using following snippet to add timestamp to console output
```
command | gawk '{ print strftime("[%Y-%m-%d %H:%M:%S]"), $0 }'
```
how to add milliseconds to it? | 2022/06/24 | [
"https://Stackoverflow.com/questions/72739136",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11602793/"
] | Why not a simple bash solution? You can read each line and prepend a timestamp using the `date` command, e.g.
```bash
command | while read -r line; do printf "%s %s\n" "$(date +'%F %T.%03N')" "$line"; done
```
**Example Use/Output**
Sample lines:
```none
$ cat dat/captnjack.txt
This is a tale
Of Captain Jack Sparr... | Coming back to the original `date` idea:
```
echo -ne "[$( date '+%Y-%m-%d %H:%M:%S,%3N')] "; command
``` |
72,739,136 | I am using following snippet to add timestamp to console output
```
command | gawk '{ print strftime("[%Y-%m-%d %H:%M:%S]"), $0 }'
```
how to add milliseconds to it? | 2022/06/24 | [
"https://Stackoverflow.com/questions/72739136",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11602793/"
] | Why not a simple bash solution? You can read each line and prepend a timestamp using the `date` command, e.g.
```bash
command | while read -r line; do printf "%s %s\n" "$(date +'%F %T.%03N')" "$line"; done
```
**Example Use/Output**
Sample lines:
```none
$ cat dat/captnjack.txt
This is a tale
Of Captain Jack Sparr... | @Rohit : unless I'm missing something from the `gawk` manual, I don't see it, unless you want to use the `gawk` extension `time`. Otherwise, this is how I get `microsecs` for my various `awk`s :
```
{m,g}awk '{ OFMT="%.15f"
print substr("",(__="gdate +\47%s.%N\47" \ # gnu-date
)|getlin... |
105,036 | Background:
===========
For the following older questions, I found them by using the search noted in [Let's clean up the "this is a duplicate" answers](https://meta.stackexchange.com/q/103632/152009):
[`is:answer isaccepted:1 body:"duplicate" url:"*stackoverflow.com/*"`](https://stackoverflow.com/search?q=is%3Aanswer... | 2011/09/04 | [
"https://meta.stackexchange.com/questions/105036",
"https://meta.stackexchange.com",
"https://meta.stackexchange.com/users/152009/"
] | To answer your original questions:
* I think these should be closed, no matter how old they are.
* The hesitation to close-vote is mainly caused by people not knowing that these are duplicates ... and nobody looks at old questions.
* Whether you should flag these for moderator attention, I'm not sure. Wait for a moder... | About #17 ($this in PHP):
-------------------------
There are more similar posts.
1. [what does $this mean within a class definition?](https://stackoverflow.com/questions/3776696/what-does-this-mean-within-a-class-definition) (accepted answer mentions 2. and 3.)
2. [What does the variable $this mean in PHP?](https://... |
7,550,376 | I've heard (and I know I've seen examples too, if only I can remember where) that `sbt` can obtain dependencies from a git repo.
I am looking to obtain the dependency [harrah/up](https://github.com/harrah/up) from github. The repository does not provide any artifact JAR files, only a source tree which is set up to be ... | 2011/09/26 | [
"https://Stackoverflow.com/questions/7550376",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/371739/"
] | Yes indeed. You can give your `Project` a dependency with the `dependsOn` operator, and you can reference a Github project by its URI, for example `RootProject(uri("git://github.com/dragos/dupcheck.git"))`. Alternatively, you can `git clone` the project, and then reference your local copy with `RootProject(file(...))`.... | Since I had problems getting the dependencies of my library resolved (using the suggested `RootProject`) I'd like to point out to the object called `ProjectRef`. Thus, if one need to depend on a library residing in git, I suggest to do so as follows:
```
import sbt.Keys._
import sbt._
object MyBuild extends Build {
... |
7,550,376 | I've heard (and I know I've seen examples too, if only I can remember where) that `sbt` can obtain dependencies from a git repo.
I am looking to obtain the dependency [harrah/up](https://github.com/harrah/up) from github. The repository does not provide any artifact JAR files, only a source tree which is set up to be ... | 2011/09/26 | [
"https://Stackoverflow.com/questions/7550376",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/371739/"
] | Yes indeed. You can give your `Project` a dependency with the `dependsOn` operator, and you can reference a Github project by its URI, for example `RootProject(uri("git://github.com/dragos/dupcheck.git"))`. Alternatively, you can `git clone` the project, and then reference your local copy with `RootProject(file(...))`.... | I wanted to add an answer for sbt 0.13+. Just put something like this to your `build.sbt` on project root folder (not `Build.scala`):
```
lazy val root = (project in file(".")).dependsOn(playJongo)
lazy val playJongo = RootProject(uri("https://github.com/bekce/play-jongo.git"))
``` |
7,550,376 | I've heard (and I know I've seen examples too, if only I can remember where) that `sbt` can obtain dependencies from a git repo.
I am looking to obtain the dependency [harrah/up](https://github.com/harrah/up) from github. The repository does not provide any artifact JAR files, only a source tree which is set up to be ... | 2011/09/26 | [
"https://Stackoverflow.com/questions/7550376",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/371739/"
] | You can import unpackaged dependencies into your project from GitHub by treating them as project dependencies, using the `dependsOn` operator. (This is distinct from the way that precompiled library dependencies are included).
Note that you can specify which branch to pull using `#` notation. Here's some Scala SBT cod... | Since I had problems getting the dependencies of my library resolved (using the suggested `RootProject`) I'd like to point out to the object called `ProjectRef`. Thus, if one need to depend on a library residing in git, I suggest to do so as follows:
```
import sbt.Keys._
import sbt._
object MyBuild extends Build {
... |
7,550,376 | I've heard (and I know I've seen examples too, if only I can remember where) that `sbt` can obtain dependencies from a git repo.
I am looking to obtain the dependency [harrah/up](https://github.com/harrah/up) from github. The repository does not provide any artifact JAR files, only a source tree which is set up to be ... | 2011/09/26 | [
"https://Stackoverflow.com/questions/7550376",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/371739/"
] | You can import unpackaged dependencies into your project from GitHub by treating them as project dependencies, using the `dependsOn` operator. (This is distinct from the way that precompiled library dependencies are included).
Note that you can specify which branch to pull using `#` notation. Here's some Scala SBT cod... | I wanted to add an answer for sbt 0.13+. Just put something like this to your `build.sbt` on project root folder (not `Build.scala`):
```
lazy val root = (project in file(".")).dependsOn(playJongo)
lazy val playJongo = RootProject(uri("https://github.com/bekce/play-jongo.git"))
``` |
878,960 | I found that SO put the search input inside a form tag, and i found some other websites do the same, such as google, they put the search input and search button inside this:
```
<form action="/search" method="get" name="gs" id="tsf">
```
I want to just know the benefits of doing so, because it seems common and I mis... | 2009/05/18 | [
"https://Stackoverflow.com/questions/878960",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20126/"
] | The `action` attribute of the `<form>` element tells the browser which URL on the server is responsible for handling the form. | How else would you transmit the search term to the server? The reason the input in inside a form tag is so that the browser can POST the value to the server for processing.
**Edit:** In order to understand better I would suggest that you read [HTML Forms and Input](http://www.w3schools.com/html/html_forms.asp). |
878,960 | I found that SO put the search input inside a form tag, and i found some other websites do the same, such as google, they put the search input and search button inside this:
```
<form action="/search" method="get" name="gs" id="tsf">
```
I want to just know the benefits of doing so, because it seems common and I mis... | 2009/05/18 | [
"https://Stackoverflow.com/questions/878960",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20126/"
] | How about you read a [tutorial on HTML forms](http://www.w3schools.com/html/html_forms.asp)?
The data entered in the form must be send to a server. The `action` attribute tells the browser *which* server.
Also, there are two common ways to send the data: through `POST` (in the [`HTTP`](http://en.wikipedia.org/wiki/HT... | How else would you transmit the search term to the server? The reason the input in inside a form tag is so that the browser can POST the value to the server for processing.
**Edit:** In order to understand better I would suggest that you read [HTML Forms and Input](http://www.w3schools.com/html/html_forms.asp). |
878,960 | I found that SO put the search input inside a form tag, and i found some other websites do the same, such as google, they put the search input and search button inside this:
```
<form action="/search" method="get" name="gs" id="tsf">
```
I want to just know the benefits of doing so, because it seems common and I mis... | 2009/05/18 | [
"https://Stackoverflow.com/questions/878960",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20126/"
] | The `action` attribute of the `<form>` element tells the browser which URL on the server is responsible for handling the form. | The search input is just a generic text box, and the only way to get the information (what you're searching for) from the page to the server is to send it via a form.
www.w3schools.com and others have some great tutorials on building forms.
Theoretically you can use JavaScript to submit the information without explic... |
878,960 | I found that SO put the search input inside a form tag, and i found some other websites do the same, such as google, they put the search input and search button inside this:
```
<form action="/search" method="get" name="gs" id="tsf">
```
I want to just know the benefits of doing so, because it seems common and I mis... | 2009/05/18 | [
"https://Stackoverflow.com/questions/878960",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20126/"
] | How about you read a [tutorial on HTML forms](http://www.w3schools.com/html/html_forms.asp)?
The data entered in the form must be send to a server. The `action` attribute tells the browser *which* server.
Also, there are two common ways to send the data: through `POST` (in the [`HTTP`](http://en.wikipedia.org/wiki/HT... | The `action` attribute of the `<form>` element tells the browser which URL on the server is responsible for handling the form. |
878,960 | I found that SO put the search input inside a form tag, and i found some other websites do the same, such as google, they put the search input and search button inside this:
```
<form action="/search" method="get" name="gs" id="tsf">
```
I want to just know the benefits of doing so, because it seems common and I mis... | 2009/05/18 | [
"https://Stackoverflow.com/questions/878960",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20126/"
] | The `action` attribute of the `<form>` element tells the browser which URL on the server is responsible for handling the form. | This may be a bit of a stretch, but based on your website www.igurr.com, I think what you're really asking is:
>
> Why don't I have to put a form tag on my page to get it to post back?
>
>
>
This is because ASP.NET automatically adds a `form` tag for you right after the `body` tag:
```
<form name="aspnetForm" m... |
878,960 | I found that SO put the search input inside a form tag, and i found some other websites do the same, such as google, they put the search input and search button inside this:
```
<form action="/search" method="get" name="gs" id="tsf">
```
I want to just know the benefits of doing so, because it seems common and I mis... | 2009/05/18 | [
"https://Stackoverflow.com/questions/878960",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20126/"
] | The `action` attribute of the `<form>` element tells the browser which URL on the server is responsible for handling the form. | I understood the reason, which is very simple:
instead of putting a big general form tag for all the page, these websites just put form around the parts which will go back to the server, but why not put everything inside a form, that what i am trying to understand now. |
878,960 | I found that SO put the search input inside a form tag, and i found some other websites do the same, such as google, they put the search input and search button inside this:
```
<form action="/search" method="get" name="gs" id="tsf">
```
I want to just know the benefits of doing so, because it seems common and I mis... | 2009/05/18 | [
"https://Stackoverflow.com/questions/878960",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20126/"
] | How about you read a [tutorial on HTML forms](http://www.w3schools.com/html/html_forms.asp)?
The data entered in the form must be send to a server. The `action` attribute tells the browser *which* server.
Also, there are two common ways to send the data: through `POST` (in the [`HTTP`](http://en.wikipedia.org/wiki/HT... | The search input is just a generic text box, and the only way to get the information (what you're searching for) from the page to the server is to send it via a form.
www.w3schools.com and others have some great tutorials on building forms.
Theoretically you can use JavaScript to submit the information without explic... |
878,960 | I found that SO put the search input inside a form tag, and i found some other websites do the same, such as google, they put the search input and search button inside this:
```
<form action="/search" method="get" name="gs" id="tsf">
```
I want to just know the benefits of doing so, because it seems common and I mis... | 2009/05/18 | [
"https://Stackoverflow.com/questions/878960",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20126/"
] | How about you read a [tutorial on HTML forms](http://www.w3schools.com/html/html_forms.asp)?
The data entered in the form must be send to a server. The `action` attribute tells the browser *which* server.
Also, there are two common ways to send the data: through `POST` (in the [`HTTP`](http://en.wikipedia.org/wiki/HT... | This may be a bit of a stretch, but based on your website www.igurr.com, I think what you're really asking is:
>
> Why don't I have to put a form tag on my page to get it to post back?
>
>
>
This is because ASP.NET automatically adds a `form` tag for you right after the `body` tag:
```
<form name="aspnetForm" m... |
878,960 | I found that SO put the search input inside a form tag, and i found some other websites do the same, such as google, they put the search input and search button inside this:
```
<form action="/search" method="get" name="gs" id="tsf">
```
I want to just know the benefits of doing so, because it seems common and I mis... | 2009/05/18 | [
"https://Stackoverflow.com/questions/878960",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20126/"
] | How about you read a [tutorial on HTML forms](http://www.w3schools.com/html/html_forms.asp)?
The data entered in the form must be send to a server. The `action` attribute tells the browser *which* server.
Also, there are two common ways to send the data: through `POST` (in the [`HTTP`](http://en.wikipedia.org/wiki/HT... | I understood the reason, which is very simple:
instead of putting a big general form tag for all the page, these websites just put form around the parts which will go back to the server, but why not put everything inside a form, that what i am trying to understand now. |
26,641,728 | Im using [this](http://flask.pocoo.org/snippets/8/) Flask code. Its working fine till now, but what if I wanna logout. I would like to have a button on my html code, and when I logout to request auth again.
How can I impliment this code
```
def check_auth(username, password):
"""This function is called to check if... | 2014/10/29 | [
"https://Stackoverflow.com/questions/26641728",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3207652/"
] | You are using Basic auth. It doesn't have the concept of "log out", but, you can simulate one by sending wrong credentials (for instance a username with an invalid password) and returning `401` instead of `200`. There are multiple ways to implement a logout, but for keeping it simple you could render a template view or... | You can create a session with the auth data (no matter whether use basic auth), and when you want log out simply delete the session data. |
26,641,728 | Im using [this](http://flask.pocoo.org/snippets/8/) Flask code. Its working fine till now, but what if I wanna logout. I would like to have a button on my html code, and when I logout to request auth again.
How can I impliment this code
```
def check_auth(username, password):
"""This function is called to check if... | 2014/10/29 | [
"https://Stackoverflow.com/questions/26641728",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3207652/"
] | You are using Basic auth. It doesn't have the concept of "log out", but, you can simulate one by sending wrong credentials (for instance a username with an invalid password) and returning `401` instead of `200`. There are multiple ways to implement a logout, but for keeping it simple you could render a template view or... | If your using the nice flask-login extension you can use the logout\_user function
```
from flask_login import login_user, logout_user
```
Then just create an endpoint (url) for it
```
@expose('/logout/')
def logout(self):
logout_user()
return redirect(url_for('index')
``` |
64,273 | I keep hearing that **users are stupid idiots** alot, and that being said it is also used as a reason to have everyone's experience crap now and in the future.
For example: not enough options for things that would enhance the overall user experience, because it might allow stupid users to do stupid things.
**Is user ... | 2014/09/11 | [
"https://ux.stackexchange.com/questions/64273",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/16138/"
] | Users aren't stupid. They approach the application in different ways and with different expectations. One of the beautiful thing about the web is that one can get to the same information in different ways - one way is not necessarily better than another.
I'm pretty much an "expert" user by every standard one can give ... | Following the "users aren't stupid" crowd, I'll add this "but very many UX coders are quite stupid".
Programmers write interfaces they are comfortable with because they often have little evidence to the contrary. This implies "If they are too busy to understand the entire system as well as I do, they're ignorable insi... |
64,273 | I keep hearing that **users are stupid idiots** alot, and that being said it is also used as a reason to have everyone's experience crap now and in the future.
For example: not enough options for things that would enhance the overall user experience, because it might allow stupid users to do stupid things.
**Is user ... | 2014/09/11 | [
"https://ux.stackexchange.com/questions/64273",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/16138/"
] | Users aren't stupid, they just have more important things to do than focus on the interface you're designing.
=============================================================================================================
For you, the interface represents a lot of thought and work, and you care about getting it right. B... | I upvoted Peter's and Mayo's answers and would like to add this:
There are different groups of users. **One interface can't possibly satisfy everyone** or be optimally easy for everyone to use. **Do user research** and determine what the common shared qualities are within each user group. That will result in *data-dri... |
64,273 | I keep hearing that **users are stupid idiots** alot, and that being said it is also used as a reason to have everyone's experience crap now and in the future.
For example: not enough options for things that would enhance the overall user experience, because it might allow stupid users to do stupid things.
**Is user ... | 2014/09/11 | [
"https://ux.stackexchange.com/questions/64273",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/16138/"
] | One can be a trained musician, artist or a doctor but may not be trained to use computers. Not knowing to use a computer interface does not mean one is stupid.
>
> They want to get in, get out, and move on with their own tasks
>
>
>
<http://www.nngroup.com/articles/are-users-stupid/> | Is there any reason for doing bad job which results in *bad* UX? No. |
64,273 | I keep hearing that **users are stupid idiots** alot, and that being said it is also used as a reason to have everyone's experience crap now and in the future.
For example: not enough options for things that would enhance the overall user experience, because it might allow stupid users to do stupid things.
**Is user ... | 2014/09/11 | [
"https://ux.stackexchange.com/questions/64273",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/16138/"
] | Users aren't stupid, they just have more important things to do than focus on the interface you're designing.
=============================================================================================================
For you, the interface represents a lot of thought and work, and you care about getting it right. B... | One can be a trained musician, artist or a doctor but may not be trained to use computers. Not knowing to use a computer interface does not mean one is stupid.
>
> They want to get in, get out, and move on with their own tasks
>
>
>
<http://www.nngroup.com/articles/are-users-stupid/> |
64,273 | I keep hearing that **users are stupid idiots** alot, and that being said it is also used as a reason to have everyone's experience crap now and in the future.
For example: not enough options for things that would enhance the overall user experience, because it might allow stupid users to do stupid things.
**Is user ... | 2014/09/11 | [
"https://ux.stackexchange.com/questions/64273",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/16138/"
] | Users aren't stupid, they just have more important things to do than focus on the interface you're designing.
=============================================================================================================
For you, the interface represents a lot of thought and work, and you care about getting it right. B... | Following the "users aren't stupid" crowd, I'll add this "but very many UX coders are quite stupid".
Programmers write interfaces they are comfortable with because they often have little evidence to the contrary. This implies "If they are too busy to understand the entire system as well as I do, they're ignorable insi... |
64,273 | I keep hearing that **users are stupid idiots** alot, and that being said it is also used as a reason to have everyone's experience crap now and in the future.
For example: not enough options for things that would enhance the overall user experience, because it might allow stupid users to do stupid things.
**Is user ... | 2014/09/11 | [
"https://ux.stackexchange.com/questions/64273",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/16138/"
] | One can be a trained musician, artist or a doctor but may not be trained to use computers. Not knowing to use a computer interface does not mean one is stupid.
>
> They want to get in, get out, and move on with their own tasks
>
>
>
<http://www.nngroup.com/articles/are-users-stupid/> | Following the "users aren't stupid" crowd, I'll add this "but very many UX coders are quite stupid".
Programmers write interfaces they are comfortable with because they often have little evidence to the contrary. This implies "If they are too busy to understand the entire system as well as I do, they're ignorable insi... |
64,273 | I keep hearing that **users are stupid idiots** alot, and that being said it is also used as a reason to have everyone's experience crap now and in the future.
For example: not enough options for things that would enhance the overall user experience, because it might allow stupid users to do stupid things.
**Is user ... | 2014/09/11 | [
"https://ux.stackexchange.com/questions/64273",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/16138/"
] | Users aren't stupid, they just have more important things to do than focus on the interface you're designing.
=============================================================================================================
For you, the interface represents a lot of thought and work, and you care about getting it right. B... | Is there any reason for doing bad job which results in *bad* UX? No. |
64,273 | I keep hearing that **users are stupid idiots** alot, and that being said it is also used as a reason to have everyone's experience crap now and in the future.
For example: not enough options for things that would enhance the overall user experience, because it might allow stupid users to do stupid things.
**Is user ... | 2014/09/11 | [
"https://ux.stackexchange.com/questions/64273",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/16138/"
] | "Users are stupid" is a programmer's mantra. I think it has persisted because it inspires [defensive programming](http://en.wikipedia.org/wiki/Defensive_programming) and defensive design, which is usually a good route to take. However, **it's not true**, and it's a little bit harmful. I think the sentiment should be br... | I upvoted Peter's and Mayo's answers and would like to add this:
There are different groups of users. **One interface can't possibly satisfy everyone** or be optimally easy for everyone to use. **Do user research** and determine what the common shared qualities are within each user group. That will result in *data-dri... |
64,273 | I keep hearing that **users are stupid idiots** alot, and that being said it is also used as a reason to have everyone's experience crap now and in the future.
For example: not enough options for things that would enhance the overall user experience, because it might allow stupid users to do stupid things.
**Is user ... | 2014/09/11 | [
"https://ux.stackexchange.com/questions/64273",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/16138/"
] | "Users are stupid" is a programmer's mantra. I think it has persisted because it inspires [defensive programming](http://en.wikipedia.org/wiki/Defensive_programming) and defensive design, which is usually a good route to take. However, **it's not true**, and it's a little bit harmful. I think the sentiment should be br... | Following the "users aren't stupid" crowd, I'll add this "but very many UX coders are quite stupid".
Programmers write interfaces they are comfortable with because they often have little evidence to the contrary. This implies "If they are too busy to understand the entire system as well as I do, they're ignorable insi... |
64,273 | I keep hearing that **users are stupid idiots** alot, and that being said it is also used as a reason to have everyone's experience crap now and in the future.
For example: not enough options for things that would enhance the overall user experience, because it might allow stupid users to do stupid things.
**Is user ... | 2014/09/11 | [
"https://ux.stackexchange.com/questions/64273",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/16138/"
] | Users aren't stupid, they just have more important things to do than focus on the interface you're designing.
=============================================================================================================
For you, the interface represents a lot of thought and work, and you care about getting it right. B... | Users aren't stupid. They approach the application in different ways and with different expectations. One of the beautiful thing about the web is that one can get to the same information in different ways - one way is not necessarily better than another.
I'm pretty much an "expert" user by every standard one can give ... |
49,959,771 | ```
var user = {};
var usernameList = document.querySelectorAll('.msg.g_bot.bot.private.i ~ .msg .usr');
for (i of usernameList) {
if (i.childNodes[0].nodeName === 'SPAN') {
var theUser = (user[i.childNodes[0].innerHTML] !== undefined) ? user[i.childNodes[0].innerHTML] : user[i.childNodes[0].innerHTML] = {}... | 2018/04/21 | [
"https://Stackoverflow.com/questions/49959771",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4641680/"
] | `theUser.msg = [];` does create a new array on every iteration. Just like you create a new `theUser` object only when it doesn't exist already, you should only create the `msg` array only once.
```
var users = {};
var usernameList = document.querySelectorAll('.msg.g_bot.bot.private.i ~ .msg .usr');
for (var i of usern... | You could modify your code to verify if the array was already created:
```
var user = {};
var usernameList = document.querySelectorAll('.msg.g_bot.bot.private.i ~ .msg .usr');
for (i of usernameList) {
if (i.childNodes[0].nodeName === 'SPAN') {
var theUser = (user[i.childNodes[0].innerHTML] !== undefined) ... |
49,959,771 | ```
var user = {};
var usernameList = document.querySelectorAll('.msg.g_bot.bot.private.i ~ .msg .usr');
for (i of usernameList) {
if (i.childNodes[0].nodeName === 'SPAN') {
var theUser = (user[i.childNodes[0].innerHTML] !== undefined) ? user[i.childNodes[0].innerHTML] : user[i.childNodes[0].innerHTML] = {}... | 2018/04/21 | [
"https://Stackoverflow.com/questions/49959771",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4641680/"
] | `theUser.msg = [];` does create a new array on every iteration. Just like you create a new `theUser` object only when it doesn't exist already, you should only create the `msg` array only once.
```
var users = {};
var usernameList = document.querySelectorAll('.msg.g_bot.bot.private.i ~ .msg .usr');
for (var i of usern... | A clearer way of doing it would be to use `.reduce`:
```
const user = [...document.querySelectorAll('.msg.g_bot.bot.private.i ~ .msg .usr')]
.reduce((userObj, i) => {
if (i.childNodes[0].nodeName !== 'SPAN') return userObj;
const childHtml = i.childNodes[0].innerHTML;
const theUser = userObj[childHtml] |... |
49,959,771 | ```
var user = {};
var usernameList = document.querySelectorAll('.msg.g_bot.bot.private.i ~ .msg .usr');
for (i of usernameList) {
if (i.childNodes[0].nodeName === 'SPAN') {
var theUser = (user[i.childNodes[0].innerHTML] !== undefined) ? user[i.childNodes[0].innerHTML] : user[i.childNodes[0].innerHTML] = {}... | 2018/04/21 | [
"https://Stackoverflow.com/questions/49959771",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4641680/"
] | A clearer way of doing it would be to use `.reduce`:
```
const user = [...document.querySelectorAll('.msg.g_bot.bot.private.i ~ .msg .usr')]
.reduce((userObj, i) => {
if (i.childNodes[0].nodeName !== 'SPAN') return userObj;
const childHtml = i.childNodes[0].innerHTML;
const theUser = userObj[childHtml] |... | You could modify your code to verify if the array was already created:
```
var user = {};
var usernameList = document.querySelectorAll('.msg.g_bot.bot.private.i ~ .msg .usr');
for (i of usernameList) {
if (i.childNodes[0].nodeName === 'SPAN') {
var theUser = (user[i.childNodes[0].innerHTML] !== undefined) ... |
3,312,239 | Here *len* is at A[10] and *i* is at A[11]. Is there a way to catch these errors??
I tried compiling with gcc -Wall -W but no warnings are displayed.
```
int main()
{
int A[10];
int i, len;
len = sizeof(A) / sizeof(0[A]);
printf("Len = %d\n",len);
for(i = 0; i < len; ++i){
A[i] = i*19%7;
}
A[i] = 5;
... | 2010/07/22 | [
"https://Stackoverflow.com/questions/3312239",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/399451/"
] | C does not generally do bounds-checking, but a number of people have implemented bounds-checking for C. For instance there is a patch for GCC at <http://sourceforge.net/projects/boundschecking/>. Of course bounds-checking does have some overhead, but it can often be enabled and disabled on a per-file basis. | The short answer is that local variables are al-located on stack, and indexing is just like \*(ptr + index). So it could happen that the room for int y[N] is adjacent to the room for another int x; e.g. x is located after the last y. So, y[N-1] is this last y, while y[N] is the int past the last y, and in this case, by... |
3,312,239 | Here *len* is at A[10] and *i* is at A[11]. Is there a way to catch these errors??
I tried compiling with gcc -Wall -W but no warnings are displayed.
```
int main()
{
int A[10];
int i, len;
len = sizeof(A) / sizeof(0[A]);
printf("Len = %d\n",len);
for(i = 0; i < len; ++i){
A[i] = i*19%7;
}
A[i] = 5;
... | 2010/07/22 | [
"https://Stackoverflow.com/questions/3312239",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/399451/"
] | The array allocation of A is adjacent in memory to i and len. Remember that when you address via an array, it's exactly like using pointers, and you're walking off the end of the array, bumping into the other stuff you put there.
C by default does not do bounds checking. You're expected to be careful as a programmer; ... | i's location in memory is just past the end of A. That's not guaranteed with every compiler and every architecture, but most probably wouldn't have a reason to do it any other way.
Note that counting from 0 to 9, you have 10 elements. |
3,312,239 | Here *len* is at A[10] and *i* is at A[11]. Is there a way to catch these errors??
I tried compiling with gcc -Wall -W but no warnings are displayed.
```
int main()
{
int A[10];
int i, len;
len = sizeof(A) / sizeof(0[A]);
printf("Len = %d\n",len);
for(i = 0; i < len; ++i){
A[i] = i*19%7;
}
A[i] = 5;
... | 2010/07/22 | [
"https://Stackoverflow.com/questions/3312239",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/399451/"
] | You are accessing memory outside the bounds of the array; in C, there is no bounds checking done on array indices.
Accessing memory beyond the end of the array technically results in *undefined behavior*. This means that there are no guarantees about what happens when you do it. In your example, you end up overwriting... | The array allocation of A is adjacent in memory to i and len. Remember that when you address via an array, it's exactly like using pointers, and you're walking off the end of the array, bumping into the other stuff you put there.
C by default does not do bounds checking. You're expected to be careful as a programmer; ... |
3,312,239 | Here *len* is at A[10] and *i* is at A[11]. Is there a way to catch these errors??
I tried compiling with gcc -Wall -W but no warnings are displayed.
```
int main()
{
int A[10];
int i, len;
len = sizeof(A) / sizeof(0[A]);
printf("Len = %d\n",len);
for(i = 0; i < len; ++i){
A[i] = i*19%7;
}
A[i] = 5;
... | 2010/07/22 | [
"https://Stackoverflow.com/questions/3312239",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/399451/"
] | You are accessing memory outside the bounds of the array; in C, there is no bounds checking done on array indices.
Accessing memory beyond the end of the array technically results in *undefined behavior*. This means that there are no guarantees about what happens when you do it. In your example, you end up overwriting... | The short answer is that local variables are al-located on stack, and indexing is just like \*(ptr + index). So it could happen that the room for int y[N] is adjacent to the room for another int x; e.g. x is located after the last y. So, y[N-1] is this last y, while y[N] is the int past the last y, and in this case, by... |
3,312,239 | Here *len* is at A[10] and *i* is at A[11]. Is there a way to catch these errors??
I tried compiling with gcc -Wall -W but no warnings are displayed.
```
int main()
{
int A[10];
int i, len;
len = sizeof(A) / sizeof(0[A]);
printf("Len = %d\n",len);
for(i = 0; i < len; ++i){
A[i] = i*19%7;
}
A[i] = 5;
... | 2010/07/22 | [
"https://Stackoverflow.com/questions/3312239",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/399451/"
] | You are accessing memory outside the bounds of the array; in C, there is no bounds checking done on array indices.
Accessing memory beyond the end of the array technically results in *undefined behavior*. This means that there are no guarantees about what happens when you do it. In your example, you end up overwriting... | Array indexing starts from 0. Hence the size of array is equal to one less than the declared value. You are overwriting the memory beyond what is allowed.
These errors may not be reported as warnings but you can use tools like prevent, sparrow, Klockworks or purify to find such "malpractices" if i may call them that. |
3,312,239 | Here *len* is at A[10] and *i* is at A[11]. Is there a way to catch these errors??
I tried compiling with gcc -Wall -W but no warnings are displayed.
```
int main()
{
int A[10];
int i, len;
len = sizeof(A) / sizeof(0[A]);
printf("Len = %d\n",len);
for(i = 0; i < len; ++i){
A[i] = i*19%7;
}
A[i] = 5;
... | 2010/07/22 | [
"https://Stackoverflow.com/questions/3312239",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/399451/"
] | You are accessing memory outside the bounds of the array; in C, there is no bounds checking done on array indices.
Accessing memory beyond the end of the array technically results in *undefined behavior*. This means that there are no guarantees about what happens when you do it. In your example, you end up overwriting... | C does not generally do bounds-checking, but a number of people have implemented bounds-checking for C. For instance there is a patch for GCC at <http://sourceforge.net/projects/boundschecking/>. Of course bounds-checking does have some overhead, but it can often be enabled and disabled on a per-file basis. |
3,312,239 | Here *len* is at A[10] and *i* is at A[11]. Is there a way to catch these errors??
I tried compiling with gcc -Wall -W but no warnings are displayed.
```
int main()
{
int A[10];
int i, len;
len = sizeof(A) / sizeof(0[A]);
printf("Len = %d\n",len);
for(i = 0; i < len; ++i){
A[i] = i*19%7;
}
A[i] = 5;
... | 2010/07/22 | [
"https://Stackoverflow.com/questions/3312239",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/399451/"
] | The array allocation of A is adjacent in memory to i and len. Remember that when you address via an array, it's exactly like using pointers, and you're walking off the end of the array, bumping into the other stuff you put there.
C by default does not do bounds checking. You're expected to be careful as a programmer; ... | The short answer is that local variables are al-located on stack, and indexing is just like \*(ptr + index). So it could happen that the room for int y[N] is adjacent to the room for another int x; e.g. x is located after the last y. So, y[N-1] is this last y, while y[N] is the int past the last y, and in this case, by... |
3,312,239 | Here *len* is at A[10] and *i* is at A[11]. Is there a way to catch these errors??
I tried compiling with gcc -Wall -W but no warnings are displayed.
```
int main()
{
int A[10];
int i, len;
len = sizeof(A) / sizeof(0[A]);
printf("Len = %d\n",len);
for(i = 0; i < len; ++i){
A[i] = i*19%7;
}
A[i] = 5;
... | 2010/07/22 | [
"https://Stackoverflow.com/questions/3312239",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/399451/"
] | The array allocation of A is adjacent in memory to i and len. Remember that when you address via an array, it's exactly like using pointers, and you're walking off the end of the array, bumping into the other stuff you put there.
C by default does not do bounds checking. You're expected to be careful as a programmer; ... | Array indexing starts from 0. Hence the size of array is equal to one less than the declared value. You are overwriting the memory beyond what is allowed.
These errors may not be reported as warnings but you can use tools like prevent, sparrow, Klockworks or purify to find such "malpractices" if i may call them that. |
3,312,239 | Here *len* is at A[10] and *i* is at A[11]. Is there a way to catch these errors??
I tried compiling with gcc -Wall -W but no warnings are displayed.
```
int main()
{
int A[10];
int i, len;
len = sizeof(A) / sizeof(0[A]);
printf("Len = %d\n",len);
for(i = 0; i < len; ++i){
A[i] = i*19%7;
}
A[i] = 5;
... | 2010/07/22 | [
"https://Stackoverflow.com/questions/3312239",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/399451/"
] | You are accessing memory outside the bounds of the array; in C, there is no bounds checking done on array indices.
Accessing memory beyond the end of the array technically results in *undefined behavior*. This means that there are no guarantees about what happens when you do it. In your example, you end up overwriting... | i's location in memory is just past the end of A. That's not guaranteed with every compiler and every architecture, but most probably wouldn't have a reason to do it any other way.
Note that counting from 0 to 9, you have 10 elements. |
3,312,239 | Here *len* is at A[10] and *i* is at A[11]. Is there a way to catch these errors??
I tried compiling with gcc -Wall -W but no warnings are displayed.
```
int main()
{
int A[10];
int i, len;
len = sizeof(A) / sizeof(0[A]);
printf("Len = %d\n",len);
for(i = 0; i < len; ++i){
A[i] = i*19%7;
}
A[i] = 5;
... | 2010/07/22 | [
"https://Stackoverflow.com/questions/3312239",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/399451/"
] | C does not generally do bounds-checking, but a number of people have implemented bounds-checking for C. For instance there is a patch for GCC at <http://sourceforge.net/projects/boundschecking/>. Of course bounds-checking does have some overhead, but it can often be enabled and disabled on a per-file basis. | i's location in memory is just past the end of A. That's not guaranteed with every compiler and every architecture, but most probably wouldn't have a reason to do it any other way.
Note that counting from 0 to 9, you have 10 elements. |
51,902,805 | This is a python grammar question.
Why is it not possible to run `if test: for list: one-statement` in one line in python? e.g.:
```
a=1
b=[1, 2]
if a: for x in b: print(x)
File "<ipython-input-52-8abcd450fc7a>", line 3
if a: for x in b: print(x)
^
SyntaxError: invalid syntax
```
I understand that... | 2018/08/17 | [
"https://Stackoverflow.com/questions/51902805",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9201239/"
] | I think the the solution you propose is a hint as to why it was never implemented. The change would add a lot of complexity to the grammar with very little real benefit. A few simple statements could be shoe-horned into a single line, but the change would create a number of confusing edge cases.
The [Python docs](http... | The problem is not the if statement, it is the for statement.
What you want to want can be do as follows
```
a = True
b = [1,2,3]
if a: [print(x) for x in b]
``` |
166,876 | I'd like to disable the NVidia GTX 750M GPU on my MacBook Pro 15" (Retina, Mid 2014, Mac OS X 10.10 Yosemite). I know I can use GfxCardStatus but I read I could have a more permanent solution by changing some EFI flag.
**My question is:**
* **How can I disable the discrete GPU from EFI?**
I assume this is persistent... | 2015/01/11 | [
"https://apple.stackexchange.com/questions/166876",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/22634/"
] | ### Your Dilemma
I'm in full sympathy with your wish "save on battery and reduce heat, without paying the noise cost" of using the discrete graphics card inside a MacBook Pro.
### Warning
Before you do anything which will disable your display, please make sure you are able to [log in to your MacBook Pro using SSH](h... | Belated answer to one of your side questions: You probably need the discrete GPU enabled to use an external display. The reason why should be in how the GPUs and the video outputs are wired.
(I'm half-guessing, half-extrapolating from how the PC laptop graphics switching technology works. It's not an unreasonable ass... |
166,876 | I'd like to disable the NVidia GTX 750M GPU on my MacBook Pro 15" (Retina, Mid 2014, Mac OS X 10.10 Yosemite). I know I can use GfxCardStatus but I read I could have a more permanent solution by changing some EFI flag.
**My question is:**
* **How can I disable the discrete GPU from EFI?**
I assume this is persistent... | 2015/01/11 | [
"https://apple.stackexchange.com/questions/166876",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/22634/"
] | You can **permanently disable discrete graphics card** following next steps:
### UPDATE! Try to edit NVRAM variable from Single-User mode
The procedure described in the steps 1-3 worked for me until macOS Sierra, but with the upgrade to High Sierra, I started getting a pinkish/reddish screen and I was unable to enter... | Belated answer to one of your side questions: You probably need the discrete GPU enabled to use an external display. The reason why should be in how the GPUs and the video outputs are wired.
(I'm half-guessing, half-extrapolating from how the PC laptop graphics switching technology works. It's not an unreasonable ass... |
166,876 | I'd like to disable the NVidia GTX 750M GPU on my MacBook Pro 15" (Retina, Mid 2014, Mac OS X 10.10 Yosemite). I know I can use GfxCardStatus but I read I could have a more permanent solution by changing some EFI flag.
**My question is:**
* **How can I disable the discrete GPU from EFI?**
I assume this is persistent... | 2015/01/11 | [
"https://apple.stackexchange.com/questions/166876",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/22634/"
] | **Your planned procedure is possible. Your planned procedure is not that difficult. Your planned procedure is not the best option.**
**Why this route is suboptimal**
MacBook Pros will and have to switch to discrete GPU (dGPU) once an external display is connected. Therefore, an installed but disabled dGPU takes away ... | Belated answer to one of your side questions: You probably need the discrete GPU enabled to use an external display. The reason why should be in how the GPUs and the video outputs are wired.
(I'm half-guessing, half-extrapolating from how the PC laptop graphics switching technology works. It's not an unreasonable ass... |
166,876 | I'd like to disable the NVidia GTX 750M GPU on my MacBook Pro 15" (Retina, Mid 2014, Mac OS X 10.10 Yosemite). I know I can use GfxCardStatus but I read I could have a more permanent solution by changing some EFI flag.
**My question is:**
* **How can I disable the discrete GPU from EFI?**
I assume this is persistent... | 2015/01/11 | [
"https://apple.stackexchange.com/questions/166876",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/22634/"
] | ### Your Dilemma
I'm in full sympathy with your wish "save on battery and reduce heat, without paying the noise cost" of using the discrete graphics card inside a MacBook Pro.
### Warning
Before you do anything which will disable your display, please make sure you are able to [log in to your MacBook Pro using SSH](h... | If anyone is still looking for ways to do this, please check out this MacRumors forum post.
I followed the steps mentioned in that forum post and my 15" MacBook Pro 2011 is working perfectly using only its Integrated Graphic. The worthless AMD graphic card was disabled successfully.
<https://forums.macrumors.com/thr... |
166,876 | I'd like to disable the NVidia GTX 750M GPU on my MacBook Pro 15" (Retina, Mid 2014, Mac OS X 10.10 Yosemite). I know I can use GfxCardStatus but I read I could have a more permanent solution by changing some EFI flag.
**My question is:**
* **How can I disable the discrete GPU from EFI?**
I assume this is persistent... | 2015/01/11 | [
"https://apple.stackexchange.com/questions/166876",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/22634/"
] | You can **permanently disable discrete graphics card** following next steps:
### UPDATE! Try to edit NVRAM variable from Single-User mode
The procedure described in the steps 1-3 worked for me until macOS Sierra, but with the upgrade to High Sierra, I started getting a pinkish/reddish screen and I was unable to enter... | ### Your Dilemma
I'm in full sympathy with your wish "save on battery and reduce heat, without paying the noise cost" of using the discrete graphics card inside a MacBook Pro.
### Warning
Before you do anything which will disable your display, please make sure you are able to [log in to your MacBook Pro using SSH](h... |
166,876 | I'd like to disable the NVidia GTX 750M GPU on my MacBook Pro 15" (Retina, Mid 2014, Mac OS X 10.10 Yosemite). I know I can use GfxCardStatus but I read I could have a more permanent solution by changing some EFI flag.
**My question is:**
* **How can I disable the discrete GPU from EFI?**
I assume this is persistent... | 2015/01/11 | [
"https://apple.stackexchange.com/questions/166876",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/22634/"
] | ### Your Dilemma
I'm in full sympathy with your wish "save on battery and reduce heat, without paying the noise cost" of using the discrete graphics card inside a MacBook Pro.
### Warning
Before you do anything which will disable your display, please make sure you are able to [log in to your MacBook Pro using SSH](h... | **Your planned procedure is possible. Your planned procedure is not that difficult. Your planned procedure is not the best option.**
**Why this route is suboptimal**
MacBook Pros will and have to switch to discrete GPU (dGPU) once an external display is connected. Therefore, an installed but disabled dGPU takes away ... |
166,876 | I'd like to disable the NVidia GTX 750M GPU on my MacBook Pro 15" (Retina, Mid 2014, Mac OS X 10.10 Yosemite). I know I can use GfxCardStatus but I read I could have a more permanent solution by changing some EFI flag.
**My question is:**
* **How can I disable the discrete GPU from EFI?**
I assume this is persistent... | 2015/01/11 | [
"https://apple.stackexchange.com/questions/166876",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/22634/"
] | You can **permanently disable discrete graphics card** following next steps:
### UPDATE! Try to edit NVRAM variable from Single-User mode
The procedure described in the steps 1-3 worked for me until macOS Sierra, but with the upgrade to High Sierra, I started getting a pinkish/reddish screen and I was unable to enter... | If anyone is still looking for ways to do this, please check out this MacRumors forum post.
I followed the steps mentioned in that forum post and my 15" MacBook Pro 2011 is working perfectly using only its Integrated Graphic. The worthless AMD graphic card was disabled successfully.
<https://forums.macrumors.com/thr... |
166,876 | I'd like to disable the NVidia GTX 750M GPU on my MacBook Pro 15" (Retina, Mid 2014, Mac OS X 10.10 Yosemite). I know I can use GfxCardStatus but I read I could have a more permanent solution by changing some EFI flag.
**My question is:**
* **How can I disable the discrete GPU from EFI?**
I assume this is persistent... | 2015/01/11 | [
"https://apple.stackexchange.com/questions/166876",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/22634/"
] | **Your planned procedure is possible. Your planned procedure is not that difficult. Your planned procedure is not the best option.**
**Why this route is suboptimal**
MacBook Pros will and have to switch to discrete GPU (dGPU) once an external display is connected. Therefore, an installed but disabled dGPU takes away ... | If anyone is still looking for ways to do this, please check out this MacRumors forum post.
I followed the steps mentioned in that forum post and my 15" MacBook Pro 2011 is working perfectly using only its Integrated Graphic. The worthless AMD graphic card was disabled successfully.
<https://forums.macrumors.com/thr... |
166,876 | I'd like to disable the NVidia GTX 750M GPU on my MacBook Pro 15" (Retina, Mid 2014, Mac OS X 10.10 Yosemite). I know I can use GfxCardStatus but I read I could have a more permanent solution by changing some EFI flag.
**My question is:**
* **How can I disable the discrete GPU from EFI?**
I assume this is persistent... | 2015/01/11 | [
"https://apple.stackexchange.com/questions/166876",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/22634/"
] | You can **permanently disable discrete graphics card** following next steps:
### UPDATE! Try to edit NVRAM variable from Single-User mode
The procedure described in the steps 1-3 worked for me until macOS Sierra, but with the upgrade to High Sierra, I started getting a pinkish/reddish screen and I was unable to enter... | **Your planned procedure is possible. Your planned procedure is not that difficult. Your planned procedure is not the best option.**
**Why this route is suboptimal**
MacBook Pros will and have to switch to discrete GPU (dGPU) once an external display is connected. Therefore, an installed but disabled dGPU takes away ... |
240,876 | I have some plots created with TikZ and `pgfplots`. In the captions, I use `\ref{...}` with plot labels in order to get the marker printed there; a neat feature indeed.
Now, when submitting to arXiv one has to jump some hoops in order to make the document compile with their horribly outdated TeX Live (2011 at the time... | 2015/04/27 | [
"https://tex.stackexchange.com/questions/240876",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/3213/"
] | The current (3.0.0) TikZ manual has this to say:
>
> [`\label` in the externalized graphics which is referenced in the main document] is realized automatically by the external library. In detail, a `\label` inside of an externalized
> graphics causes the external library to generate separate auxiliary files for ever... | Raphael's self-answer shows how to properly do that.
---
Unfortunately, we sometimes have to deal with systems that are (for questionable security reasons) restrictive in the types of files they allow to upload (e.g. “editorial manager” does not allow file names ending with .dpth) or use a prehistoric LaTeX version t... |
1,582,160 | I have a question about using databases...
```
string node = Session["node"].ToString();
SqlConnection dataConnection = new SqlConnection();
dataConnection.ConnectionString = ConfigurationManager.ConnectionStrings["SumooHAgentDBConnectionString"].ConnectionString;
SqlCommand dataCommand = new SqlCommand();
dataC... | 2009/10/17 | [
"https://Stackoverflow.com/questions/1582160",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/175084/"
] | You can add them to a `DataTable` - then you'll have a `.Rows` property with 5 rows, and each `DataRow` in the `.Rows` property has five columns which holds those values. Almost like a database in memory.
To do that, just use the `SqlDataAdapter` and its `Fill` method:
```
DataTable myTable = new DataTable();
SqlData... | Instead of dataCommand.ExecuteNonQuery(), you need:
```
SqlDataAdapter a = new SqlDataAdapter(dataCommand);
DataTable resultsTable = new DataTable();
a.Fill(resultsTable);
```
The data will then be in the resultsTable object.
Sounds like you need to read up on ADO.NET generally ... DataTables are covered [here](htt... |
1,582,160 | I have a question about using databases...
```
string node = Session["node"].ToString();
SqlConnection dataConnection = new SqlConnection();
dataConnection.ConnectionString = ConfigurationManager.ConnectionStrings["SumooHAgentDBConnectionString"].ConnectionString;
SqlCommand dataCommand = new SqlCommand();
dataC... | 2009/10/17 | [
"https://Stackoverflow.com/questions/1582160",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/175084/"
] | Instead of dataCommand.ExecuteNonQuery(), you need:
```
SqlDataAdapter a = new SqlDataAdapter(dataCommand);
DataTable resultsTable = new DataTable();
a.Fill(resultsTable);
```
The data will then be in the resultsTable object.
Sounds like you need to read up on ADO.NET generally ... DataTables are covered [here](htt... | You may want to use the [`ExecuteReader`](http://msdn.microsoft.com/en-us/library/9kcbe65k.aspx) method instead of `ExecuteNonQuery`. |
1,582,160 | I have a question about using databases...
```
string node = Session["node"].ToString();
SqlConnection dataConnection = new SqlConnection();
dataConnection.ConnectionString = ConfigurationManager.ConnectionStrings["SumooHAgentDBConnectionString"].ConnectionString;
SqlCommand dataCommand = new SqlCommand();
dataC... | 2009/10/17 | [
"https://Stackoverflow.com/questions/1582160",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/175084/"
] | Instead of dataCommand.ExecuteNonQuery(), you need:
```
SqlDataAdapter a = new SqlDataAdapter(dataCommand);
DataTable resultsTable = new DataTable();
a.Fill(resultsTable);
```
The data will then be in the resultsTable object.
Sounds like you need to read up on ADO.NET generally ... DataTables are covered [here](htt... | You can make use of [Data Access Application Block](http://msdn.microsoft.com/en-us/library/dd203144.aspx) released by Microsoft Patterns & Practices if you don't want to do all the low level ADO.NET plumbing work. |
1,582,160 | I have a question about using databases...
```
string node = Session["node"].ToString();
SqlConnection dataConnection = new SqlConnection();
dataConnection.ConnectionString = ConfigurationManager.ConnectionStrings["SumooHAgentDBConnectionString"].ConnectionString;
SqlCommand dataCommand = new SqlCommand();
dataC... | 2009/10/17 | [
"https://Stackoverflow.com/questions/1582160",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/175084/"
] | You can add them to a `DataTable` - then you'll have a `.Rows` property with 5 rows, and each `DataRow` in the `.Rows` property has five columns which holds those values. Almost like a database in memory.
To do that, just use the `SqlDataAdapter` and its `Fill` method:
```
DataTable myTable = new DataTable();
SqlData... | You may want to use the [`ExecuteReader`](http://msdn.microsoft.com/en-us/library/9kcbe65k.aspx) method instead of `ExecuteNonQuery`. |
1,582,160 | I have a question about using databases...
```
string node = Session["node"].ToString();
SqlConnection dataConnection = new SqlConnection();
dataConnection.ConnectionString = ConfigurationManager.ConnectionStrings["SumooHAgentDBConnectionString"].ConnectionString;
SqlCommand dataCommand = new SqlCommand();
dataC... | 2009/10/17 | [
"https://Stackoverflow.com/questions/1582160",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/175084/"
] | You can add them to a `DataTable` - then you'll have a `.Rows` property with 5 rows, and each `DataRow` in the `.Rows` property has five columns which holds those values. Almost like a database in memory.
To do that, just use the `SqlDataAdapter` and its `Fill` method:
```
DataTable myTable = new DataTable();
SqlData... | You can make use of [Data Access Application Block](http://msdn.microsoft.com/en-us/library/dd203144.aspx) released by Microsoft Patterns & Practices if you don't want to do all the low level ADO.NET plumbing work. |
1,582,160 | I have a question about using databases...
```
string node = Session["node"].ToString();
SqlConnection dataConnection = new SqlConnection();
dataConnection.ConnectionString = ConfigurationManager.ConnectionStrings["SumooHAgentDBConnectionString"].ConnectionString;
SqlCommand dataCommand = new SqlCommand();
dataC... | 2009/10/17 | [
"https://Stackoverflow.com/questions/1582160",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/175084/"
] | You may want to use the [`ExecuteReader`](http://msdn.microsoft.com/en-us/library/9kcbe65k.aspx) method instead of `ExecuteNonQuery`. | You can make use of [Data Access Application Block](http://msdn.microsoft.com/en-us/library/dd203144.aspx) released by Microsoft Patterns & Practices if you don't want to do all the low level ADO.NET plumbing work. |
13,423,221 | I am using EntityFramework 4.3.1 and Database first with dbcontext.
Let's say I have 2 tables:
**Customer**
and
**Order**
with a 1 to many relationship between Customer and Order.
I have two queries that I want to run using EntityFramework to get back specific information for different web pages.
**The first is:**
*... | 2012/11/16 | [
"https://Stackoverflow.com/questions/13423221",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1521661/"
] | Your SQL also contains a nested collection, so your LINQ will be the same. Something along the lines of `.Where(c => c.Orders.Any(order => order.OrderDate > someDate));` | `int noOfRecords = _dbContext.Customer.Count();`
this will return the number of records in a table in Entity framework. |
1,359,473 | Does anyone know of a good way to automatically run certain file types through a processing script on upload? I'm trying to accomplish automatically minifying CSS and Javascript when I upload them to the server, keeping a nice, human-readable version on the local side while keeping a minified one on the server. I'm cur... | 2009/08/31 | [
"https://Stackoverflow.com/questions/1359473",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15882/"
] | I suggest compressing (by all means in some automated way) on your development machine and testing it there before uploading to your live server. Fundamentally changing your JavaScript as the last stage of your deployment process is an obvious risk for introducing errors. | There's an even lighter solution for both (JS and CSS) so you can "minify on the fly". You should be able to port it easily to any language (it's currently in PHP). It's really a fragment and an integral part of the PHP Fat-Free Framework. Follow this link and have a look at my code. It's just a single function. Don't ... |
1,359,473 | Does anyone know of a good way to automatically run certain file types through a processing script on upload? I'm trying to accomplish automatically minifying CSS and Javascript when I upload them to the server, keeping a nice, human-readable version on the local side while keeping a minified one on the server. I'm cur... | 2009/08/31 | [
"https://Stackoverflow.com/questions/1359473",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15882/"
] | Well, to minify CSS is just a couple of regexes.
```
// (PHP) but should be easily portable to any language
function compressCSS($css) {
return
preg_replace(
array('@\s\s+@','@(\w+:)\s*([\w\s,#]+;?)@'),
array(' ','$1$2'),
str_replace(
array("\r","\n","\t... | I just wrote this minfier script in python. Like Bills solution, it uses the YUI compressor, but will work in a make-less environment. It assumes that the raw (unminifie) files will be in /some/path/src/, and that the minified versions should go in /some/path/. It also assumes that the yuicompressor jar file is in the ... |
1,359,473 | Does anyone know of a good way to automatically run certain file types through a processing script on upload? I'm trying to accomplish automatically minifying CSS and Javascript when I upload them to the server, keeping a nice, human-readable version on the local side while keeping a minified one on the server. I'm cur... | 2009/08/31 | [
"https://Stackoverflow.com/questions/1359473",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15882/"
] | I recommend creating a makefile to solve this particular problem, here's a quick and dirty makefile I'm using for a site of mine:
```
PUBDIR=../../static/js/
OUTDIR=./build/
COMPRESSOR=../yui/build/yuicompressor-2.4.2.jar
ARGS=
VPATH=${OUTDIR}
INST_TARGETS=${OUTDIR}jgblue.js
jgblue.js: combined.js
java -jar ${COM... | There's an even lighter solution for both (JS and CSS) so you can "minify on the fly". You should be able to port it easily to any language (it's currently in PHP). It's really a fragment and an integral part of the PHP Fat-Free Framework. Follow this link and have a look at my code. It's just a single function. Don't ... |
1,359,473 | Does anyone know of a good way to automatically run certain file types through a processing script on upload? I'm trying to accomplish automatically minifying CSS and Javascript when I upload them to the server, keeping a nice, human-readable version on the local side while keeping a minified one on the server. I'm cur... | 2009/08/31 | [
"https://Stackoverflow.com/questions/1359473",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15882/"
] | I recommend creating a makefile to solve this particular problem, here's a quick and dirty makefile I'm using for a site of mine:
```
PUBDIR=../../static/js/
OUTDIR=./build/
COMPRESSOR=../yui/build/yuicompressor-2.4.2.jar
ARGS=
VPATH=${OUTDIR}
INST_TARGETS=${OUTDIR}jgblue.js
jgblue.js: combined.js
java -jar ${COM... | Well, to minify CSS is just a couple of regexes.
```
// (PHP) but should be easily portable to any language
function compressCSS($css) {
return
preg_replace(
array('@\s\s+@','@(\w+:)\s*([\w\s,#]+;?)@'),
array(' ','$1$2'),
str_replace(
array("\r","\n","\t... |
1,359,473 | Does anyone know of a good way to automatically run certain file types through a processing script on upload? I'm trying to accomplish automatically minifying CSS and Javascript when I upload them to the server, keeping a nice, human-readable version on the local side while keeping a minified one on the server. I'm cur... | 2009/08/31 | [
"https://Stackoverflow.com/questions/1359473",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15882/"
] | I just wrote this minfier script in python. Like Bills solution, it uses the YUI compressor, but will work in a make-less environment. It assumes that the raw (unminifie) files will be in /some/path/src/, and that the minified versions should go in /some/path/. It also assumes that the yuicompressor jar file is in the ... | Realy cool solution whice make serving js and css automagically like a dream.
Check: <http://code.google.com/p/minify/>
Features
* Combines and minifies multiple CSS or JavaScript files into a single download
+ Uses an enhanced port of Douglas Crockford's JSMin library and custom classes to minify CSS and HTML
+ C... |
1,359,473 | Does anyone know of a good way to automatically run certain file types through a processing script on upload? I'm trying to accomplish automatically minifying CSS and Javascript when I upload them to the server, keeping a nice, human-readable version on the local side while keeping a minified one on the server. I'm cur... | 2009/08/31 | [
"https://Stackoverflow.com/questions/1359473",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15882/"
] | Well, to minify CSS is just a couple of regexes.
```
// (PHP) but should be easily portable to any language
function compressCSS($css) {
return
preg_replace(
array('@\s\s+@','@(\w+:)\s*([\w\s,#]+;?)@'),
array(' ','$1$2'),
str_replace(
array("\r","\n","\t... | There's an even lighter solution for both (JS and CSS) so you can "minify on the fly". You should be able to port it easily to any language (it's currently in PHP). It's really a fragment and an integral part of the PHP Fat-Free Framework. Follow this link and have a look at my code. It's just a single function. Don't ... |
1,359,473 | Does anyone know of a good way to automatically run certain file types through a processing script on upload? I'm trying to accomplish automatically minifying CSS and Javascript when I upload them to the server, keeping a nice, human-readable version on the local side while keeping a minified one on the server. I'm cur... | 2009/08/31 | [
"https://Stackoverflow.com/questions/1359473",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15882/"
] | I just wrote this minfier script in python. Like Bills solution, it uses the YUI compressor, but will work in a make-less environment. It assumes that the raw (unminifie) files will be in /some/path/src/, and that the minified versions should go in /some/path/. It also assumes that the yuicompressor jar file is in the ... | I suggest compressing (by all means in some automated way) on your development machine and testing it there before uploading to your live server. Fundamentally changing your JavaScript as the last stage of your deployment process is an obvious risk for introducing errors. |
1,359,473 | Does anyone know of a good way to automatically run certain file types through a processing script on upload? I'm trying to accomplish automatically minifying CSS and Javascript when I upload them to the server, keeping a nice, human-readable version on the local side while keeping a minified one on the server. I'm cur... | 2009/08/31 | [
"https://Stackoverflow.com/questions/1359473",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15882/"
] | Since you're on shared hosting, I'd just suggest using the [YUICompressor](http://developer.yahoo.com/yui/compressor/), and running your css/js files through it prior to uploading them. Be sure not to lose your original files - it could be a pain making future changes.
You could also place a script on your server that... | There's an even lighter solution for both (JS and CSS) so you can "minify on the fly". You should be able to port it easily to any language (it's currently in PHP). It's really a fragment and an integral part of the PHP Fat-Free Framework. Follow this link and have a look at my code. It's just a single function. Don't ... |
1,359,473 | Does anyone know of a good way to automatically run certain file types through a processing script on upload? I'm trying to accomplish automatically minifying CSS and Javascript when I upload them to the server, keeping a nice, human-readable version on the local side while keeping a minified one on the server. I'm cur... | 2009/08/31 | [
"https://Stackoverflow.com/questions/1359473",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15882/"
] | Since you're on shared hosting, I'd just suggest using the [YUICompressor](http://developer.yahoo.com/yui/compressor/), and running your css/js files through it prior to uploading them. Be sure not to lose your original files - it could be a pain making future changes.
You could also place a script on your server that... | Realy cool solution whice make serving js and css automagically like a dream.
Check: <http://code.google.com/p/minify/>
Features
* Combines and minifies multiple CSS or JavaScript files into a single download
+ Uses an enhanced port of Douglas Crockford's JSMin library and custom classes to minify CSS and HTML
+ C... |
1,359,473 | Does anyone know of a good way to automatically run certain file types through a processing script on upload? I'm trying to accomplish automatically minifying CSS and Javascript when I upload them to the server, keeping a nice, human-readable version on the local side while keeping a minified one on the server. I'm cur... | 2009/08/31 | [
"https://Stackoverflow.com/questions/1359473",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15882/"
] | Since you're on shared hosting, I'd just suggest using the [YUICompressor](http://developer.yahoo.com/yui/compressor/), and running your css/js files through it prior to uploading them. Be sure not to lose your original files - it could be a pain making future changes.
You could also place a script on your server that... | I like [Minify](http://code.google.com/p/minify/). It supports compressing and trimming html, javascript and css on the fly.
It is quite flexible, an can be integrated into existing apps.
Some of the more *advanced* features is combining multiple javascript files into one, same for css. It has multiple ways of defini... |
56,063,717 | I have a moderation model :
```
class ItemModeration(models.Model):
class Meta:
indexes = [
models.Index(fields=['object_id', 'content_type']),
]
unique_together = ('content_type', 'object_id')
content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE)
obj... | 2019/05/09 | [
"https://Stackoverflow.com/questions/56063717",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/755371/"
] | Django has a great built in answer for this: the [GenericRelation](https://docs.djangoproject.com/en/1.11/ref/contrib/contenttypes/#reverse-generic-relations). Instead of your descriptor, just define a generic relation on your `Product` model and use it as a normal related field:
```
from django.contrib.contenttypes.f... | You'll have to use the `content_type` to query the table by specific model type.
like this:
```
product_type = ContentType.objects.get_for_model(Product)
unpublished_products = ItemModeration.objects.filter(content_type__pk=product_type.id, published=False)
```
For more details on the topic check [contenttypes doc... |
949,471 | Can I authenticate credentials with Office365 based on NTLMv2.
Microsoft describes on [*Authentication and EWS in Exchange*](https://docs.microsoft.com/en-us/exchange/client-developer/exchange-web-services/authentication-and-ews-in-exchange) that clients can authenticate with Exchange based on NTLM, but My program con... | 2019/01/17 | [
"https://serverfault.com/questions/949471",
"https://serverfault.com",
"https://serverfault.com/users/505689/"
] | No, you cannot. O365 uses modern claims based auth, so WS\* and SAML. Possibly OAUTH or OPENID too.
If you have on-prem AD, ADFS, you can probably auth to that, and get a token to pass to O365. | According the article you provided, it seems NTLM authentication is only available for Exchange on-premises servers. |
1,013,796 | I'm using an HDMI monitor with my Windows 10 tablet, with the `Show only on 2` option.
While it works fine, I can see that the display on the tablet itself is still on with a but with no image - really annoying in the dark and wasting battery/screen life for no good reason.
How can I turn it off?
BTW:
* The touchsc... | 2015/12/15 | [
"https://superuser.com/questions/1013796",
"https://superuser.com",
"https://superuser.com/users/486881/"
] | Russel, this is completely achievable on a low level. Most hard drives are actually larger then what is displayed to the end user even on a whole disk view, not just a partition view.
These settings are managed in the Host Protected Area (HPA) or it is sometimes called the Disk Configuration Overlay (DCO)
<https://... | You will need to create a single partition sized to 100gb and ignore the other free space.
There is a basic guide titled "[How to Manage Partitions on Windows without downloading other software](http://www.howtogeek.com/101862/how-to-manage-partitions-on-windows-without-downloading-any-other-software/)" if you would ... |
36,834,786 | I'm having trouble printing a table to a file with lua (and I'm new to lua).
Here's some code [I found here](https://coronalabs.com/blog/2014/09/02/tutorial-printing-table-contents/) to print the table;
```
function print_r ( t )
local print_r_cache={}
local function sub_print_r(t,indent)
if (print_... | 2016/04/25 | [
"https://Stackoverflow.com/questions/36834786",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1601928/"
] | You could change the working directory. Get the address in the beginning `getwd()`, replace it by your project folder with `setwd()`. Then, when accessing a file just use `read.table("./folder/file.R")`. | The so-called [here](https://github.com/r-lib/here) package is really useful for avoiding absolute paths in (as well as outside of) RStudio. Suppose you have an RStudio project and want to access the file `/data/file.txt`. This would be done as follows. This way, you don't have to mess around with `getwd()`, just work ... |
4,345,002 | I think I proved this but I am not to confident in my proof. I am also not that good at formating my proofs so any feedback would be appreciated :)
Let $P(n)=9|10^n-1$
Base Case:
$9|10^1-1\implies9|9\checkmark$
So we have proven the base case.
Induction Step:
$$9|10^n-1\implies9k=10^n-1\implies10^n=9k+1$$
$$9|10^{n+... | 2021/12/30 | [
"https://math.stackexchange.com/questions/4345002",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/975093/"
] | I think you're almost all the way there-- the main feedback I'd give is around your final statement:
$$9|10^{n+1}-1\implies9|(9k+1)\cdot10-1\implies9|90k+9$$
Above you're assuming what you want to prove. Try working backwards starting with what you *know* to get to what you want to prove. Here, try the following to g... | When you write $9\mid10^n-1\implies9k=10^n-1$, you should say what that $k$ is. Something like “$9k=10^n-1$” for some non-negative integer $k$.
And then your aim is to *prove* that $9\mid10^{n+1}-1$. That's not what you do. You *start* from $9\mid10^{n+1}-1$ and then you see what you can conclude from that. |
40,882,648 | I have an enum for tagged values (this is from a toy Scheme interpreter project), like this:
```
enum Value {
case int(Int)
case float(Float)
case bool(Bool)
...
}
```
I wrote an initializer for it:
```
init?(value:Any) {
switch v {
case let v as Int: self = .int(v)
case let v as Float: self = .fl... | 2016/11/30 | [
"https://Stackoverflow.com/questions/40882648",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7229380/"
] | The default inferred type for floating point constants is `Double`, not `Float`. It's defined by the swift standard library here: <https://developer.apple.com/reference/swift/floatliteraltype> using the compiler-known `FloatLiteralType` typealias. | The documentation of [type inference](https://developer.apple.com/library/content/documentation/Swift/Conceptual/Swift_Programming_Language/TheBasics.html#//apple_ref/doc/uid/TP40014097-CH5-ID322) says:
>
> Swift always chooses `Double` (rather than `Float`) when inferring the
> type of floating-point numbers.
>
> ... |
40,882,648 | I have an enum for tagged values (this is from a toy Scheme interpreter project), like this:
```
enum Value {
case int(Int)
case float(Float)
case bool(Bool)
...
}
```
I wrote an initializer for it:
```
init?(value:Any) {
switch v {
case let v as Int: self = .int(v)
case let v as Float: self = .fl... | 2016/11/30 | [
"https://Stackoverflow.com/questions/40882648",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7229380/"
] | The default inferred type for floating point constants is `Double`, not `Float`. It's defined by the swift standard library here: <https://developer.apple.com/reference/swift/floatliteraltype> using the compiler-known `FloatLiteralType` typealias. | Btw, it looks like you want to be able to init your `Value` type with literals, so you may try conforming your type to `ExpressibleBy*` protocols.
Like:
```
extension Value: ExpressibleByIntegerLiteral {
init(integerLiteral value: Int) {
self = .int(value)
}
}
let v1: Value = 42 // v1 == Value.int(42... |
40,882,648 | I have an enum for tagged values (this is from a toy Scheme interpreter project), like this:
```
enum Value {
case int(Int)
case float(Float)
case bool(Bool)
...
}
```
I wrote an initializer for it:
```
init?(value:Any) {
switch v {
case let v as Int: self = .int(v)
case let v as Float: self = .fl... | 2016/11/30 | [
"https://Stackoverflow.com/questions/40882648",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7229380/"
] | The documentation of [type inference](https://developer.apple.com/library/content/documentation/Swift/Conceptual/Swift_Programming_Language/TheBasics.html#//apple_ref/doc/uid/TP40014097-CH5-ID322) says:
>
> Swift always chooses `Double` (rather than `Float`) when inferring the
> type of floating-point numbers.
>
> ... | Btw, it looks like you want to be able to init your `Value` type with literals, so you may try conforming your type to `ExpressibleBy*` protocols.
Like:
```
extension Value: ExpressibleByIntegerLiteral {
init(integerLiteral value: Int) {
self = .int(value)
}
}
let v1: Value = 42 // v1 == Value.int(42... |
893,321 | Is it possible to force LS to print output without line breaks? I need output without formatting. I tried to use --format=horizontal switch but it still puts lf signs. Maybe formatting only with spaces? | 2015/03/24 | [
"https://superuser.com/questions/893321",
"https://superuser.com",
"https://superuser.com/users/421645/"
] | You can print files without line breaks and spaces instead, but notice that a filename can contain a space. That file would then be treated as two files. If you want to loop trough files in a script, you should prefer that:
```
for f in *; do
echo "$f";
# further processing
done
```
If is must be with spaces ins... | or use `printf "$f ";` if you need it without line break |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.