qid
int64
1
74.7M
question
stringlengths
15
58.3k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
4
30.2k
response_k
stringlengths
11
36.5k
4,479,004
I have some code that moves files to the same directory. What would be a good strategy to: * Detect if a file is a duplicate of an existing file in the directory? This is to decide whether to delete the source or simply leave it. * Rename the source file if a destination file with the same name but different content a...
2010/12/18
[ "https://Stackoverflow.com/questions/4479004", "https://Stackoverflow.com", "https://Stackoverflow.com/users/225899/" ]
> > Detect duplicate files? > > > Most programming languages will have a function called something similar to `FileExists` taking a filename and returning a boolean indicating whether a file with the given name exists on the file system. > > Handle files which have identical names but different content? > > > ...
If you don't need the original file names, as a handy way, just calculate MD5 or SHA1 hash of the file "content" and rename the file to it. :-)
11,757,948
In JDBC literatur I often encounter snippets like ``` void databaseCall() { Connection con = null; Statement statement = null try { con = getConnection(...); statement = con.createStatement(...); // do some query } catch (SQLException e) { ...
2012/08/01
[ "https://Stackoverflow.com/questions/11757948", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1180720/" ]
No, they wouldn't be closed. If `getConnection()` creates a new Connection, then the only thing that will happen at the end of the method is that the Connection could be garbage collected. But the GC won't call the close() method for you. And, anyway, you want to close as soon as possible. Most of the time, `getConn...
Suppose you have brought 20 connection for ekart application.That means connection pool has only 20 connections.If you send request to server, pool provides a connection for every request.If you wont close the connection, after 20th request you gets 'OutOfConnectionError',even you cannt handle this error and you cannot...
208,362
[I asked a question on Stack Overflow yesterday](https://stackoverflow.com/questions/20111366/how-to-update-a-combobox-from-a-window-when-closing-another-window/) and I got 4 answers. Of this four: 1. One got deleted after some time (don't know why) 2. One of them involved a three-line piece of code 3. The other two i...
2013/11/21
[ "https://meta.stackexchange.com/questions/208362", "https://meta.stackexchange.com", "https://meta.stackexchange.com/users/242464/" ]
It's really up to you if you want or not to ignore the other answers. If you find that the other answers actually would have helped you solve the problem, it would be a good idea to upvote those. The proper way to handle this situation is to upvote the good answers, it is the best you can do. I wouldn't try all the an...
If you think about SO as a place where others look for answers to the same question you asked, or similar ones, then your rating (both acceptance and voting) of all the answers is useful. Voting by the rest of the community is useful as well. As you said, to evaluate all the answers and give a faithful representation ...
28,295,984
I am wondering if anyone knows a way to change the JQueryUI Datepicker to update the date text as soon as the year dropdown is changed. The basics of what I am using is shown in <http://jsfiddle.net/H94cc/238/> ``` <input type="text" name="DOB" id="DOB" class="cat_textbox datepicker" value="10/10/1976" /> // UI Da...
2015/02/03
[ "https://Stackoverflow.com/questions/28295984", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3578432/" ]
Use onChangeMonthYear event as follows: ``` <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>jQuery UI Datepicker - On change month,year</title> <link rel="stylesheet" href="//code.jquery.com/ui/1.11.2/themes/smoothness/jquery-ui.css"> <script src="//code.jquery.com...
Use the setDate event in datepicker, when your change event happens. ``` $target_node.change(function() { $your_date_node.datepicker({your_config}) .datepicker('setDate', your_date); }); ```
28,295,984
I am wondering if anyone knows a way to change the JQueryUI Datepicker to update the date text as soon as the year dropdown is changed. The basics of what I am using is shown in <http://jsfiddle.net/H94cc/238/> ``` <input type="text" name="DOB" id="DOB" class="cat_textbox datepicker" value="10/10/1976" /> // UI Da...
2015/02/03
[ "https://Stackoverflow.com/questions/28295984", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3578432/" ]
Use onChangeMonthYear event as follows: ``` <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>jQuery UI Datepicker - On change month,year</title> <link rel="stylesheet" href="//code.jquery.com/ui/1.11.2/themes/smoothness/jquery-ui.css"> <script src="//code.jquery.com...
In my case, from some reason "i" variable was not populating; also it was "datepick()" and not "datepicker()" - not sure what plugin was used. This is what I got working in the end: ``` var datepicker = $('.datepicker').datepick({ changeYear: true, changeMonth: true, onChangeMonthYear: functi...
36,830,275
Here is my routes file ``` Route::resource('item', 'ItemController'); Route::get('welcome', function() { return view('welcome'); }); Route::auth(); Route::get('/home', 'HomeController@index'); Route::get('/item', 'ItemController@store'); //Route Route::post('/item', ['as' => 'item.store', 'uses' => 'ItemControl...
2016/04/24
[ "https://Stackoverflow.com/questions/36830275", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5116000/" ]
Does the `<form>` have `enctype="multipart/form-data"` on it? It needs this to send the files properly. It's practically an error whenever a `<form>` has `<input type="file">` elements in it, but doesn't have that attribute. This is a pretty common mistake, gets people all the time.
You forgot a coma and a key ``` {!! Form::open(['url' =>'route' **, 'key'** => 'item.store', 'files' => true]) !!} ``` and you should use url or route, but not both. ``` {!! Form::open(['route' => 'item.store', 'files' => true]) !!} ```
36,830,275
Here is my routes file ``` Route::resource('item', 'ItemController'); Route::get('welcome', function() { return view('welcome'); }); Route::auth(); Route::get('/home', 'HomeController@index'); Route::get('/item', 'ItemController@store'); //Route Route::post('/item', ['as' => 'item.store', 'uses' => 'ItemControl...
2016/04/24
[ "https://Stackoverflow.com/questions/36830275", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5116000/" ]
Does the `<form>` have `enctype="multipart/form-data"` on it? It needs this to send the files properly. It's practically an error whenever a `<form>` has `<input type="file">` elements in it, but doesn't have that attribute. This is a pretty common mistake, gets people all the time.
If everything seems fine, then you need to check your file. Test your upload with a different file with a lower size. For me, it was solved when I resized the image.
36,830,275
Here is my routes file ``` Route::resource('item', 'ItemController'); Route::get('welcome', function() { return view('welcome'); }); Route::auth(); Route::get('/home', 'HomeController@index'); Route::get('/item', 'ItemController@store'); //Route Route::post('/item', ['as' => 'item.store', 'uses' => 'ItemControl...
2016/04/24
[ "https://Stackoverflow.com/questions/36830275", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5116000/" ]
Another reason for this is PHP max upload size. Increase value and try again.
Does the `<form>` have `enctype="multipart/form-data"` on it? It needs this to send the files properly. It's practically an error whenever a `<form>` has `<input type="file">` elements in it, but doesn't have that attribute. This is a pretty common mistake, gets people all the time.
36,830,275
Here is my routes file ``` Route::resource('item', 'ItemController'); Route::get('welcome', function() { return view('welcome'); }); Route::auth(); Route::get('/home', 'HomeController@index'); Route::get('/item', 'ItemController@store'); //Route Route::post('/item', ['as' => 'item.store', 'uses' => 'ItemControl...
2016/04/24
[ "https://Stackoverflow.com/questions/36830275", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5116000/" ]
Another reason for this is PHP max upload size. Increase value and try again.
You forgot a coma and a key ``` {!! Form::open(['url' =>'route' **, 'key'** => 'item.store', 'files' => true]) !!} ``` and you should use url or route, but not both. ``` {!! Form::open(['route' => 'item.store', 'files' => true]) !!} ```
36,830,275
Here is my routes file ``` Route::resource('item', 'ItemController'); Route::get('welcome', function() { return view('welcome'); }); Route::auth(); Route::get('/home', 'HomeController@index'); Route::get('/item', 'ItemController@store'); //Route Route::post('/item', ['as' => 'item.store', 'uses' => 'ItemControl...
2016/04/24
[ "https://Stackoverflow.com/questions/36830275", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5116000/" ]
Another reason for this is PHP max upload size. Increase value and try again.
If everything seems fine, then you need to check your file. Test your upload with a different file with a lower size. For me, it was solved when I resized the image.
49,872,839
I'm using the quanteda dictionary lookup. I'll try to formulate entries where i can lookup logical combinations of words. For example: ``` Teddybear = (fluffy AND adorable AND soft) ``` Is this possible? I only found a solution yet to test for phrases like `(Teddybear = (soft fluffy adorable))`. But then it has t...
2018/04/17
[ "https://Stackoverflow.com/questions/49872839", "https://Stackoverflow.com", "https://Stackoverflow.com/users/306938/" ]
This is not currently something that is directly possible in **quanteda** (v1.2.0). However, there are workarounds in which you create dictionary sequences that are permutations of your desired sequence. Here is one such solution. First, I will create some example texts. Note that the sequences are separated by either...
If you want to know which documents have all the words, just do: ``` require(quanteda) txt <- c("The toy was fluffy, adorable and soft, he said.", "The soft, adorable, fluffy toy was on the floor.", "The fluffy, adorable toy was shaped like a bear.") dict <- dictionary(list(teddybear = list(c1 = "fl...
1,064,268
Suppose that two polar curves are given by: $R\_1 = \cos(2\theta)$ and $R\_2 = \sin(3\theta)$. Find the smallest positive solution exactly. I know that we are looking for the smallest positive value where the two functions intersect. But I graphed it on a polar coordinate grapher, and I don't know how you would determ...
2014/12/12
[ "https://math.stackexchange.com/questions/1064268", "https://math.stackexchange.com", "https://math.stackexchange.com/users/198341/" ]
Using formulas: $$\sin{(3\theta)}=3\sin{(\theta)}-4\sin^3{(\theta)}$$ $$\cos{(2\theta)}=1-2\sin^2{(\theta)}$$ We can find a cubic equation for $\sin{(\theta)}$. We have; \begin{equation} \begin{aligned} \cos{(2\theta)}&=\sin{(3\theta)} \\ \cos{(2\theta)}-\sin{(3\theta)} &= 0 \\ 1-2\sin^2{(\theta)} - 3\sin{(\theta)}+...
$$\cos2\theta=\sin3\theta=\cos\left(90^\circ-3\theta\right)$$ $$\implies2\theta=360^\circ m\pm(90^\circ-3\theta)$$ where $m$ is any integer Taking the '+' sign, $$\implies2\theta=360^\circ m+(90^\circ-3\theta)\iff\theta=72^\circ m+18^\circ$$ Taking the '-' sign, $$\implies2\theta=360^\circ m-(90^\circ-3\theta)\iff-\...
11,685,325
Suppose you have got a list of items along with their `Weights[]` and `Price[]`. Now given two integers `N<=100` and `K<=100` you have to find the minimum amount of money you should spend such that total weight of the items you have bought is exactly equal to K and number of items do not exceed N and if it is not possi...
2012/07/27
[ "https://Stackoverflow.com/questions/11685325", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1437473/" ]
Anyway, you could just load your assembly into *another* AppDomain. ``` var domain = AppDomain.CreateDomain("tmp"); var version = domain.Load().GetName(path).Version; ``` --- **EDIT:** You are targeting Windows CE, so can use the [GetFileVersionInfo](http://msdn.microsoft.com/en-us/library/aa910661.aspx) function....
Example code to find version of DLL library: ``` Version ver = Assembly.LoadFrom("Library.dll").GetName().Version; ``` Edit 1: OK, for getting already executing assembly you can try this example: ``` Assembly SampleAssembly; SampleAssembly = Assembly.GetAssembly(ObjectLoadedFromDLL.GetType()); Version ver = Assembl...
11,685,325
Suppose you have got a list of items along with their `Weights[]` and `Price[]`. Now given two integers `N<=100` and `K<=100` you have to find the minimum amount of money you should spend such that total weight of the items you have bought is exactly equal to K and number of items do not exceed N and if it is not possi...
2012/07/27
[ "https://Stackoverflow.com/questions/11685325", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1437473/" ]
Anyway, you could just load your assembly into *another* AppDomain. ``` var domain = AppDomain.CreateDomain("tmp"); var version = domain.Load().GetName(path).Version; ``` --- **EDIT:** You are targeting Windows CE, so can use the [GetFileVersionInfo](http://msdn.microsoft.com/en-us/library/aa910661.aspx) function....
You can use `AssemblyName` : ``` var assemblyName = AssemblyName.GetAssemblyName(assemblyPath); System.Diagnostics.Debug.WriteLine(assemblyName.Version); ```
1,580,635
I'm wondering if there's a jQuery-like css selector that can be used in C#. Currently, I'm parsing some html strings using regex and thought it would be much nicer to have something like the css selector in jQuery to match my desired elements.
2009/10/16
[ "https://Stackoverflow.com/questions/1580635", "https://Stackoverflow.com", "https://Stackoverflow.com/users/150094/" ]
Not quite jQuery like, but this may help: <http://www.codeplex.com/htmlagilitypack>
For XML you might use XPath...
1,580,635
I'm wondering if there's a jQuery-like css selector that can be used in C#. Currently, I'm parsing some html strings using regex and thought it would be much nicer to have something like the css selector in jQuery to match my desired elements.
2009/10/16
[ "https://Stackoverflow.com/questions/1580635", "https://Stackoverflow.com", "https://Stackoverflow.com/users/150094/" ]
You should definitely see @jamietre's [CsQuery](https://github.com/jamietre/CsQuery). Check out his answer to this question! [Fizzler](http://code.google.com/p/fizzler/) and [Sharp-Query](http://code.google.com/p/sharp-query/) provide similar functionality, but the projects seem to be abandoned.
For XML you might use XPath...
1,580,635
I'm wondering if there's a jQuery-like css selector that can be used in C#. Currently, I'm parsing some html strings using regex and thought it would be much nicer to have something like the css selector in jQuery to match my desired elements.
2009/10/16
[ "https://Stackoverflow.com/questions/1580635", "https://Stackoverflow.com", "https://Stackoverflow.com/users/150094/" ]
*Update 10/18/2012* [CsQuery](https://github.com/jamietre/CsQuery) is now in release 1.3. The latest release incorporates a C# port of the [validator.nu](http://about.validator.nu/htmlparser/) HTML5 parser. As a result CsQuery will now produce a DOM that uses the HTML5 spec for invalid markup handling and is completel...
For XML you might use XPath...
1,580,635
I'm wondering if there's a jQuery-like css selector that can be used in C#. Currently, I'm parsing some html strings using regex and thought it would be much nicer to have something like the css selector in jQuery to match my desired elements.
2009/10/16
[ "https://Stackoverflow.com/questions/1580635", "https://Stackoverflow.com", "https://Stackoverflow.com/users/150094/" ]
Not quite jQuery like, but this may help: <http://www.codeplex.com/htmlagilitypack>
I'm not entirely clear as to what you're trying to achieve, but if you have a HTML document that you're trying to extract data from, I'd recommend loading it with a [parser](https://stackoverflow.com/questions/100358/looking-for-c-html-parser), and then it becomes fairly trivial to query the object to pull desired elem...
1,580,635
I'm wondering if there's a jQuery-like css selector that can be used in C#. Currently, I'm parsing some html strings using regex and thought it would be much nicer to have something like the css selector in jQuery to match my desired elements.
2009/10/16
[ "https://Stackoverflow.com/questions/1580635", "https://Stackoverflow.com", "https://Stackoverflow.com/users/150094/" ]
You should definitely see @jamietre's [CsQuery](https://github.com/jamietre/CsQuery). Check out his answer to this question! [Fizzler](http://code.google.com/p/fizzler/) and [Sharp-Query](http://code.google.com/p/sharp-query/) provide similar functionality, but the projects seem to be abandoned.
I'm not entirely clear as to what you're trying to achieve, but if you have a HTML document that you're trying to extract data from, I'd recommend loading it with a [parser](https://stackoverflow.com/questions/100358/looking-for-c-html-parser), and then it becomes fairly trivial to query the object to pull desired elem...
1,580,635
I'm wondering if there's a jQuery-like css selector that can be used in C#. Currently, I'm parsing some html strings using regex and thought it would be much nicer to have something like the css selector in jQuery to match my desired elements.
2009/10/16
[ "https://Stackoverflow.com/questions/1580635", "https://Stackoverflow.com", "https://Stackoverflow.com/users/150094/" ]
*Update 10/18/2012* [CsQuery](https://github.com/jamietre/CsQuery) is now in release 1.3. The latest release incorporates a C# port of the [validator.nu](http://about.validator.nu/htmlparser/) HTML5 parser. As a result CsQuery will now produce a DOM that uses the HTML5 spec for invalid markup handling and is completel...
I'm not entirely clear as to what you're trying to achieve, but if you have a HTML document that you're trying to extract data from, I'd recommend loading it with a [parser](https://stackoverflow.com/questions/100358/looking-for-c-html-parser), and then it becomes fairly trivial to query the object to pull desired elem...
1,580,635
I'm wondering if there's a jQuery-like css selector that can be used in C#. Currently, I'm parsing some html strings using regex and thought it would be much nicer to have something like the css selector in jQuery to match my desired elements.
2009/10/16
[ "https://Stackoverflow.com/questions/1580635", "https://Stackoverflow.com", "https://Stackoverflow.com/users/150094/" ]
You should definitely see @jamietre's [CsQuery](https://github.com/jamietre/CsQuery). Check out his answer to this question! [Fizzler](http://code.google.com/p/fizzler/) and [Sharp-Query](http://code.google.com/p/sharp-query/) provide similar functionality, but the projects seem to be abandoned.
Not quite jQuery like, but this may help: <http://www.codeplex.com/htmlagilitypack>
1,580,635
I'm wondering if there's a jQuery-like css selector that can be used in C#. Currently, I'm parsing some html strings using regex and thought it would be much nicer to have something like the css selector in jQuery to match my desired elements.
2009/10/16
[ "https://Stackoverflow.com/questions/1580635", "https://Stackoverflow.com", "https://Stackoverflow.com/users/150094/" ]
*Update 10/18/2012* [CsQuery](https://github.com/jamietre/CsQuery) is now in release 1.3. The latest release incorporates a C# port of the [validator.nu](http://about.validator.nu/htmlparser/) HTML5 parser. As a result CsQuery will now produce a DOM that uses the HTML5 spec for invalid markup handling and is completel...
Not quite jQuery like, but this may help: <http://www.codeplex.com/htmlagilitypack>
1,580,635
I'm wondering if there's a jQuery-like css selector that can be used in C#. Currently, I'm parsing some html strings using regex and thought it would be much nicer to have something like the css selector in jQuery to match my desired elements.
2009/10/16
[ "https://Stackoverflow.com/questions/1580635", "https://Stackoverflow.com", "https://Stackoverflow.com/users/150094/" ]
You should definitely see @jamietre's [CsQuery](https://github.com/jamietre/CsQuery). Check out his answer to this question! [Fizzler](http://code.google.com/p/fizzler/) and [Sharp-Query](http://code.google.com/p/sharp-query/) provide similar functionality, but the projects seem to be abandoned.
*Update 10/18/2012* [CsQuery](https://github.com/jamietre/CsQuery) is now in release 1.3. The latest release incorporates a C# port of the [validator.nu](http://about.validator.nu/htmlparser/) HTML5 parser. As a result CsQuery will now produce a DOM that uses the HTML5 spec for invalid markup handling and is completel...
1,265,854
I have Windows 7 Japanese Version on Fujitsu monitor computer- The keyboard is mostly a normal QWERTY with extra keys for Japanese Input. At the moment it is fine except that the key (\_) next to the left Shift key in direct entry to Chrome produces a yen symbol which copies as the correct back slash. However sometimes...
2017/11/06
[ "https://superuser.com/questions/1265854", "https://superuser.com", "https://superuser.com/users/511314/" ]
`Shift`+`2` giving `@` is likely the English setting and you want something else. Check if you have this icon in the tray. If so, click it and select the correct language that matches your keyboard. (It may show different languages on your PC of course) [![Language setting](https://i.stack.imgur.com/d0iSB.png)](https...
Hmmm, maybe my suggestion is strange but try to press strg and left shift. I cannot say that it is 100% the right thing but I had smth similar to what you have described.
1,265,854
I have Windows 7 Japanese Version on Fujitsu monitor computer- The keyboard is mostly a normal QWERTY with extra keys for Japanese Input. At the moment it is fine except that the key (\_) next to the left Shift key in direct entry to Chrome produces a yen symbol which copies as the correct back slash. However sometimes...
2017/11/06
[ "https://superuser.com/questions/1265854", "https://superuser.com", "https://superuser.com/users/511314/" ]
The keyboard layout is a Japanese layout. This wiki section <https://en.wikipedia.org/wiki/Keyboard_layout#Japanese> have some related background about the layout. Because symbols placement in the layout is different from keyboards from other part of the world, so when improperly configured it might yield some unexpec...
Hmmm, maybe my suggestion is strange but try to press strg and left shift. I cannot say that it is 100% the right thing but I had smth similar to what you have described.
1,265,854
I have Windows 7 Japanese Version on Fujitsu monitor computer- The keyboard is mostly a normal QWERTY with extra keys for Japanese Input. At the moment it is fine except that the key (\_) next to the left Shift key in direct entry to Chrome produces a yen symbol which copies as the correct back slash. However sometimes...
2017/11/06
[ "https://superuser.com/questions/1265854", "https://superuser.com", "https://superuser.com/users/511314/" ]
I can't say for sure that whether these are definitive solutions since the problem hasn't reoccurred but they are the ones listed on Google Forums click on chrome anywhere to focus the window, then press Alt+Shift once press Ctrl+Shift once I click on the blue hammer thing on the right of the address bar. Then i cl...
Hmmm, maybe my suggestion is strange but try to press strg and left shift. I cannot say that it is 100% the right thing but I had smth similar to what you have described.
8,262,502
I decided my software needs to go international, so I made one of the classes prompt the user which locale to use. To the 7 other classes I added a parameter to take this info in. Now, somehow this doesn't feel right. It seems to complicate things. It seems more natural to make the chosen Locale a 'global' variable, i...
2011/11/24
[ "https://Stackoverflow.com/questions/8262502", "https://Stackoverflow.com", "https://Stackoverflow.com/users/921282/" ]
Let's assume you want to create a GlobalSettings class. You can do the following. ``` class GlobalSettings { private static Locale locale = Locale.US; public static Locale getLocale() { return locale; } public static void setLocale(Locale newValue) { locale = newValue; } } ``` then, from anywhere...
If its a web application you could put the locale into your HTTP session. If you are using JSF or Portlets you have built in locale support.
63,954,216
I am building a react application that gets data from Firestore. I am stuck with getting values from a Key: value pair in which the key is more than one word. I create my component like so: ``` const MyComponent = ({theData}) => { return ( <div> <p>theData.name</p> <p>theData.Special Pass</p> </di...
2020/09/18
[ "https://Stackoverflow.com/questions/63954216", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12504861/" ]
Try `theData["Special Pass"]`
``` const MyComponent = ({theData}) => { return ( <div> <p>{theData.name}</p> <p>{theData["Special Pass"]}</p> </div> ) } ```
34,757,517
I am getting the following error in Chrome browser in 'development' mode while upgrading our app to 2.0.0-rc4 from Router: > > Uncaught RangeError: Maximum call stack size exceeded > > > [![enter image description here](https://i.stack.imgur.com/0KbHZ.png)](https://i.stack.imgur.com/0KbHZ.png) This looks to be c...
2016/01/13
[ "https://Stackoverflow.com/questions/34757517", "https://Stackoverflow.com", "https://Stackoverflow.com/users/246983/" ]
The iCalendar data itself seems to be fine, since it works for me. I can upload your event to my account and it appears in my calendar. Please make sure that 1. you specify the correct content-type `text/calendar` when you `PUT` the event. 2. the collection that you're writing to actually supports events. iCloud uses...
Just ran into the same error message. The fix for me was to switch to `POST` rather than `PUT`. `POST` is the appropriate HTTP method when you're creating a new resource, while PUT is for replacing an existing resource. Changing the method resolved the issue for me. In the above case, the curl command would begin as f...
11,566,299
I'm attempting to add an item to a `ttk.Treeview` instance in my Python script that builds a basic UI. The insertion code looks like this: ``` tree.insert(my_id, 'end', todo_id, text="Line " + str(line_num), values=(str(todo_text), owner), # I have 2 cols, 'text' and...
2012/07/19
[ "https://Stackoverflow.com/questions/11566299", "https://Stackoverflow.com", "https://Stackoverflow.com/users/562139/" ]
At it's core, Tkinter is a wrapper around a Tcl interpreter. To Tcl, curly braces are special unless they are escaped. Curly braces are the most common way to create a Tcl list. If you see `unmatched open brace in list`, that's a Tcl error related to the fact that you have unbalanced braces. This looks like a Tkinter...
Tkinter sits on top of Tcl, which uses braces as a kind of quote. It looks like Tkinter is quoting the string with braces for Tcl, but not escaping any which happen to be in the string itself.
30,070,358
I want to get the vector like: `v:[1.0, 2.0, 3.0]` Here is my code: ``` class VECTOR(list) : def _init_ (self,x=0.0,y=0.0,z=0.0,vec=[]) : list._init_(self,[float(x),float(y),float(z)]) if vec : for i in [0,1,2] : self[i] = vec[i] ``` But when I typed: `a ...
2015/05/06
[ "https://Stackoverflow.com/questions/30070358", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4459942/" ]
The problem is that you've misspelled the name of the constructor. Replace `_init_` with `__init__`. Here's the fixed code: ``` class VECTOR(list) : def __init__ (self,x=0.0,y=0.0,z=0.0,vec=[]) : list.__init__(self,[float(x),float(y),float(z)]) if vec : for i in [0,1,2] : ...
EDIT if you call using `super(VECTOR, list).__init__()` you don't need to pass self. ~~Also you need to pass 1,2,3 as a list [1,2,3]~~
25,998,374
Wonder if someone can point me in the right direction. I have a spreadsheet of 200,000 + rows example below. (The part number is alphanumeric) ``` Part Number Areacode Description 1 1 Table 2 1 Chair 3 1 Book...
2014/09/23
[ "https://Stackoverflow.com/questions/25998374", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2685323/" ]
I have completed the task but I am sure there may be quicker ways to achieve this. The solution was to download the Ablebits Combine Rows program from <https://www.ablebits.com/> This allowed me to concatenate the part numbers based on area code so in my main table I now have for area code 3. Part number = 3 , 8 and D...
``` Sub Tester() Dim rngIn, rngOut Set rngIn = Sheets("Data") Set rngOut = Sheets("Pivoted") rngOut.CurrentRegion.ClearContents PivotRange rngIn, 2, 3, 1, rngOut End Sub Function PivotRange(rngIn, rowCol, catCol, valCol, rngOut) Dim dictRows, dictCols, r, nR, nC, arr, kR, kC Set dictRow...
50,955,781
I want to do Unix script, witch print a list of uniq words form file and print list of numbers of rows where this word appearing. For eample file.txt ``` Lorem ipsum dolor elit, Lorem elit. ``` Output ``` Lorem 1,3 ipsum 2 dolor 2 elit 2,3 ``` My code: ``` cat file.txt | tr '[:space:]' '[\n*]'| tr '[:digit:]' ...
2018/06/20
[ "https://Stackoverflow.com/questions/50955781", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9969417/" ]
This awk codes works for your example: ``` awk '{for(i=1;i<=NF;i++){ gsub(/[.,:;]/,"",$i) a[$i]=($i in a)?a[$i]","NR:NR}} END{for(x in a)print x,a[x]}' file ```
some write-only perl: ``` perl -nE ' push @{$refs{$_}}, $. for /(\w+)/g } END { say $_, "\t", join(",", @{$refs{$_}}) for keys %refs ' file ``` ``` elit 2,3 Lorem 1,3 ipsum 2 dolor 2 ``` It does not output the order of words as "when they when they were encountered in the file": the order is u...
50,955,781
I want to do Unix script, witch print a list of uniq words form file and print list of numbers of rows where this word appearing. For eample file.txt ``` Lorem ipsum dolor elit, Lorem elit. ``` Output ``` Lorem 1,3 ipsum 2 dolor 2 elit 2,3 ``` My code: ``` cat file.txt | tr '[:space:]' '[\n*]'| tr '[:digit:]' ...
2018/06/20
[ "https://Stackoverflow.com/questions/50955781", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9969417/" ]
This awk codes works for your example: ``` awk '{for(i=1;i<=NF;i++){ gsub(/[.,:;]/,"",$i) a[$i]=($i in a)?a[$i]","NR:NR}} END{for(x in a)print x,a[x]}' file ```
If you don't care that the words are in a different order than encountered in the file: ``` awk -F[^[:alpha:]] '{for (i=1; i<=NF;i++) if ($i) a[$i]=a[$i]?a[$i] "," NR:NR} END {for (e in a) print e,a[e]}' file ``` Or, if you want in the order encountered in the file: ``` awk...
50,955,781
I want to do Unix script, witch print a list of uniq words form file and print list of numbers of rows where this word appearing. For eample file.txt ``` Lorem ipsum dolor elit, Lorem elit. ``` Output ``` Lorem 1,3 ipsum 2 dolor 2 elit 2,3 ``` My code: ``` cat file.txt | tr '[:space:]' '[\n*]'| tr '[:digit:]' ...
2018/06/20
[ "https://Stackoverflow.com/questions/50955781", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9969417/" ]
some write-only perl: ``` perl -nE ' push @{$refs{$_}}, $. for /(\w+)/g } END { say $_, "\t", join(",", @{$refs{$_}}) for keys %refs ' file ``` ``` elit 2,3 Lorem 1,3 ipsum 2 dolor 2 ``` It does not output the order of words as "when they when they were encountered in the file": the order is u...
If you don't care that the words are in a different order than encountered in the file: ``` awk -F[^[:alpha:]] '{for (i=1; i<=NF;i++) if ($i) a[$i]=a[$i]?a[$i] "," NR:NR} END {for (e in a) print e,a[e]}' file ``` Or, if you want in the order encountered in the file: ``` awk...
365,811
I'm building a REST service in java that does basic CRUD operations on Customers. The easy way would be for me to create one Customer model, and annotate it with JPA annotations so my persistence layer knows how to map it to the DB and add some jackson annotations so that my web layer knows how to deserialize it from h...
2018/02/12
[ "https://softwareengineering.stackexchange.com/questions/365811", "https://softwareengineering.stackexchange.com", "https://softwareengineering.stackexchange.com/users/295991/" ]
> > I'm building a REST service [...] that does basic CRUD operations [...] > > > This is the key to your question: if you're just doing simple CRUD on your entities with maybe a little bit of simple validation, a full blown rich domain model is most likely overkill for your application. I would recommend to star...
> > This seems like a lot of versions of the same thing, does anyone do things this way? > > > It does seem like a lot of versions that are *currently* the same thing. Logically, you really have three different things going on. You've got the model's own understanding of its domain. Part of the motivation for in...
1,612
I have a site for a musician that includes music in `mp3` format, but these are played through a Flash file ([xspfplayer](http://musicplayer.sourceforge.net/)). Of course, without Flash this is useless. Is there a better future-proof, and reasonably backwards-compatible way to include mp3 audio snippets on a page with...
2010/07/26
[ "https://webmasters.stackexchange.com/questions/1612", "https://webmasters.stackexchange.com", "https://webmasters.stackexchange.com/users/26/" ]
Your best bet is to continue to use the Flash player and use the [HTML5 audio tag](http://w3schools.com/html5/tag_audio.asp), for any browsers that supports it. Eventually, all browsers will support HTML5 and you will be able to kill off the flash audio player. There is a great document on the HTML5 audio tag and how...
I believe this solution matches your requirements more exactly: Create an M3U playlist file which points to the MP3's URL, upload the M3U to your server, and then create a link to the M3U file on your page. When the visitor clicks the link to the M3U file the (tiny) M3U file will be downloaded and he or she will have...
1,612
I have a site for a musician that includes music in `mp3` format, but these are played through a Flash file ([xspfplayer](http://musicplayer.sourceforge.net/)). Of course, without Flash this is useless. Is there a better future-proof, and reasonably backwards-compatible way to include mp3 audio snippets on a page with...
2010/07/26
[ "https://webmasters.stackexchange.com/questions/1612", "https://webmasters.stackexchange.com", "https://webmasters.stackexchange.com/users/26/" ]
Another solution is to use a JavaScript library called [Sound Manager](http://www.schillmania.com/projects/soundmanager2/). By default, it embeds an invisible Flash object in the page and uses it to play audio files (including MP3s). The newest version includes the ability to use HTML5's `audio` tag when available. Y...
Your best bet is to continue to use the Flash player and use the [HTML5 audio tag](http://w3schools.com/html5/tag_audio.asp), for any browsers that supports it. Eventually, all browsers will support HTML5 and you will be able to kill off the flash audio player. There is a great document on the HTML5 audio tag and how...
1,612
I have a site for a musician that includes music in `mp3` format, but these are played through a Flash file ([xspfplayer](http://musicplayer.sourceforge.net/)). Of course, without Flash this is useless. Is there a better future-proof, and reasonably backwards-compatible way to include mp3 audio snippets on a page with...
2010/07/26
[ "https://webmasters.stackexchange.com/questions/1612", "https://webmasters.stackexchange.com", "https://webmasters.stackexchange.com/users/26/" ]
Another solution is to use a JavaScript library called [Sound Manager](http://www.schillmania.com/projects/soundmanager2/). By default, it embeds an invisible Flash object in the page and uses it to play audio files (including MP3s). The newest version includes the ability to use HTML5's `audio` tag when available. Y...
I believe this solution matches your requirements more exactly: Create an M3U playlist file which points to the MP3's URL, upload the M3U to your server, and then create a link to the M3U file on your page. When the visitor clicks the link to the M3U file the (tiny) M3U file will be downloaded and he or she will have...
51,966,458
I have the following question: Having an Option of List of elements I want to transform it into a List of elements by avoiding the use of .get on the Option. Below is the snippet of code that I want to change : Any idea how to modify this please : ``` val receivedMessages = PubSubClient.getPulledMessages(client,subscr...
2018/08/22
[ "https://Stackoverflow.com/questions/51966458", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9845366/" ]
You can traverse the centerboxes and then find the p tag inside each box. Based on the p tag you can color the centerbox. HTML ``` <div class="centerbox"> <div> <p>1</p> </div> </div> <div class="centerbox"> <div> <p>3</p> </div> </div> ``` CSS ``` .centerbox { width:90px; height:90px; bord...
the solution here is quite simple really. Remember when working with getElement**s**ByClassName, javascript will return an array as there can be multiple classes. The solution is to use `getElementsByClassName[0]` as this will specifically return the first element that has that class in the array, obviously this also ...
55,981,556
I am using codeIgniter and ajax to implement cascading select, unfortunately not performing and gives this error on chrome `w3dev.js:3355 POST http://schools.phlitz.org/academic/student_add/request_districts 500 (Internal Server Error)` and this one on Firefox `Empty string passed to getElementById().` My controller f...
2019/05/04
[ "https://Stackoverflow.com/questions/55981556", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8525965/" ]
We can achieve this without using script task. First of all you need to create a table in `SQL Server` ``` CREATE TABLE folder_Name (id INT IDENTITY(1,1) , folder VARCHAR(512) , depth INT) ``` and then run the below `SQL` statement to insert the folder name into the table **folder\_Name**. ``` INSERT IN...
You can use a Script Task to achieve that: 1. In the package, create a variable of type string (example: `@[User::FolderPath]`) 2. Add a Script Task 3. Select `@[User:FolderPath` as `ReadWriteVariable` 4. Use a similar Script : *First you have to add `using System.Linq;` to use Linq functionalities within the script*...
15,617,638
I have a global variable called `var` and a function `foo`. (I know it's a bad practice but sometimes it's unavoidable) I'm wondering if the C standard (I'm compiling using c99) says what happens to `var` if I try to execute: ``` long foo(){ return var++; } ``` Thanks.
2013/03/25
[ "https://Stackoverflow.com/questions/15617638", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1219515/" ]
As `var++` is a post-increment, it is basically something like this: ``` long foo(){ long tmp = var; var++; return tmp; } ``` If you use `++var` instead, it will return the incremented value (as it will increment the variable *before* returning its value).
`foo()` will return the current value of `var`, and `var` gets increased.
15,617,638
I have a global variable called `var` and a function `foo`. (I know it's a bad practice but sometimes it's unavoidable) I'm wondering if the C standard (I'm compiling using c99) says what happens to `var` if I try to execute: ``` long foo(){ return var++; } ``` Thanks.
2013/03/25
[ "https://Stackoverflow.com/questions/15617638", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1219515/" ]
Short answer: It will return a copy of `var` and then immediately afterwards increment the global `var`. Long answer: C11 6.5.2.4 > > "The result of the postfix ++ operator is the value of the operand. As > a side effect, the value of the operand object is incremented..". /--/ > The value computation of the re...
`foo()` will return the current value of `var`, and `var` gets increased.
15,617,638
I have a global variable called `var` and a function `foo`. (I know it's a bad practice but sometimes it's unavoidable) I'm wondering if the C standard (I'm compiling using c99) says what happens to `var` if I try to execute: ``` long foo(){ return var++; } ``` Thanks.
2013/03/25
[ "https://Stackoverflow.com/questions/15617638", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1219515/" ]
Short answer: It will return a copy of `var` and then immediately afterwards increment the global `var`. Long answer: C11 6.5.2.4 > > "The result of the postfix ++ operator is the value of the operand. As > a side effect, the value of the operand object is incremented..". /--/ > The value computation of the re...
As `var++` is a post-increment, it is basically something like this: ``` long foo(){ long tmp = var; var++; return tmp; } ``` If you use `++var` instead, it will return the incremented value (as it will increment the variable *before* returning its value).
20,367,715
We have a multisite solution . It looks like ``` Sitecore - Contenent -Country one -Country Two .... -Contry X ``` We have shared events for country sites: ``` /Global/Events/Event One /Global/Events/Events Two .... /Global/Events/Events X ``` These events are displayed on C...
2013/12/04
[ "https://Stackoverflow.com/questions/20367715", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
For your scope I suggest you to use Computed index field. You can read on next [link](http://www.sitecore.net/Community/Technical-Blogs/John-West-Sitecore-Blog/Posts/2013/03/Sitecore-7-Computed-Index-Fields.aspx) about Computed Index Field. Just follow steps from link and you get needed result.
did you make sure the root of the shared content (/Global/Events/) is included in the index root? You can verify the items in the index using Luke. Also make sure the search is not performed based on the current item as the start/root of the search (because that's different from the root of the shared content).
245,909
Consider the following linear model under classical Gauss-Markov assumtions: $$Y = X\beta + e$$ where $\mathbb{E}X'e = 0$ Consider the following estimator $$\tilde\beta = \left(\sum\_{i=1}^{N}x\_ix\_i' + \lambda I\_k\right)^{-1}\left(\sum\_{i+1}^Nx\_iy\_i\right)$$ where $x\_i$ is a column vector $k\times1$ from $X$ an...
2016/11/14
[ "https://stats.stackexchange.com/questions/245909", "https://stats.stackexchange.com", "https://stats.stackexchange.com/users/109798/" ]
According to the cardinal's hint. We want to show that $(X'X)^{-1} - WX'XW$ is psd. Denote $X'X = S$. Then, $S^{-1} - WSW = WW^{-1}S^{-1}W^{-1}W - WSW= W(W^{-1}S^{-1}W^{-1} - S)W$. Take expression in the brackets and simplify \begin{equation} \begin{aligned} W^{-1}S^{-1}W^{-1} - S &= (S+\lambda I)S^{-1}(S+\lambda ) - S...
We can write $W = \lambda^{-1} (\lambda^{-1}X'X + I)^{-1}$. Set for compactness $P\equiv\lambda^{-1} X'X$. Then you want to examine the expression $$\lambda^{-1}P^{-1} - \lambda^{-1}(P+I)^{-1}\lambda P\lambda^{-1}(P+I)^{-1}$$ and you can simplify and ignore $\lambda^{-1}$ (which is positive). So we are examining $$P...
245,909
Consider the following linear model under classical Gauss-Markov assumtions: $$Y = X\beta + e$$ where $\mathbb{E}X'e = 0$ Consider the following estimator $$\tilde\beta = \left(\sum\_{i=1}^{N}x\_ix\_i' + \lambda I\_k\right)^{-1}\left(\sum\_{i+1}^Nx\_iy\_i\right)$$ where $x\_i$ is a column vector $k\times1$ from $X$ an...
2016/11/14
[ "https://stats.stackexchange.com/questions/245909", "https://stats.stackexchange.com", "https://stats.stackexchange.com/users/109798/" ]
According to the cardinal's hint. We want to show that $(X'X)^{-1} - WX'XW$ is psd. Denote $X'X = S$. Then, $S^{-1} - WSW = WW^{-1}S^{-1}W^{-1}W - WSW= W(W^{-1}S^{-1}W^{-1} - S)W$. Take expression in the brackets and simplify \begin{equation} \begin{aligned} W^{-1}S^{-1}W^{-1} - S &= (S+\lambda I)S^{-1}(S+\lambda ) - S...
[As](https://math.stackexchange.com/questions/435831/if-a-and-b-are-positive-definite-then-is-b-1-a-1-positive-semidef) $A\geq B\Leftrightarrow B^{-1}\geq A^{-1}$, we may also establish \begin{align\*} W^{-1}(X'X)^{-1}W^{-1}-X'X\geq0 \end{align\*} Plug in to get \begin{align\*} (X'X+\lambda I)(X'X)^{-1}(X'X+\lambda I)-...
26,854,028
I'm trying to configure redirects to prepare the switch from an ASP to an MVC website. The IIS wildcard redirects are working fine, but I cannot figure out how to preserve the query parameters. Example: ``` <system.webServer> <httpRedirect enabled="true" exactDestination="true" httpResponseStatus="Permanent"> <...
2014/11/10
[ "https://Stackoverflow.com/questions/26854028", "https://Stackoverflow.com", "https://Stackoverflow.com/users/386413/" ]
So this configuration was working perfectly! I just had to clear my browser cache since the redirection is `Permanent` and the browser 'remembered' my previous configuration while I was playing with the config file. My bad!
Y̶o̶u̶ ̶h̶a̶v̶e̶ ̶e̶x̶a̶c̶t̶D̶e̶s̶t̶i̶n̶a̶t̶i̶o̶n̶=̶"̶t̶r̶u̶e̶"̶.̶ However, more importantly, when you want to have more granular control with redirects, you're much better off using the [URL Rewrite module](http://www.iis.net/downloads/microsoft/url-rewrite). Your bit would be something like the following (not tested ...
15,939,399
This seems like a common question, but I have been web searching and can't find the answers. I want to reserve something for a number of days (no partial days), so I guess I need a table something like: ``` CREATE TABLE reservations ( item int, customer int, startDate date, endDate date ...
2013/04/11
[ "https://Stackoverflow.com/questions/15939399", "https://Stackoverflow.com", "https://Stackoverflow.com/users/192910/" ]
``` SELECT item FROM reservations WHERE (endDate BETWEEN start AND end) OR (startDate BETWEEN start AND end) OR (startDate<start AND endDate>end) ``` by @Strawberry suggestions a better query will look like this ``` SELECT item FROM reservations WHERE start<endDate AND end>startDate ``` This will give You items t...
This would be pretty easy to do outside of the database - select all reservations in the time period you're willing to consider placing a reservation in, use the result to populate an array where a day is either 1 (filled) or 0 (unfilled) and scan the array for gaps of the desired size. O(n) but there are only 365 days...
15,939,399
This seems like a common question, but I have been web searching and can't find the answers. I want to reserve something for a number of days (no partial days), so I guess I need a table something like: ``` CREATE TABLE reservations ( item int, customer int, startDate date, endDate date ...
2013/04/11
[ "https://Stackoverflow.com/questions/15939399", "https://Stackoverflow.com", "https://Stackoverflow.com/users/192910/" ]
It's not critical to my approach, but I'm going to assume that you have an `items` table. I'll also provide a query that doesn't need an items table. The advantage of a separate items table is that you can easily add or retire items over time. They'll automatically show up in the reservation query results, and you can ...
This would be pretty easy to do outside of the database - select all reservations in the time period you're willing to consider placing a reservation in, use the result to populate an array where a day is either 1 (filled) or 0 (unfilled) and scan the array for gaps of the desired size. O(n) but there are only 365 days...
15,939,399
This seems like a common question, but I have been web searching and can't find the answers. I want to reserve something for a number of days (no partial days), so I guess I need a table something like: ``` CREATE TABLE reservations ( item int, customer int, startDate date, endDate date ...
2013/04/11
[ "https://Stackoverflow.com/questions/15939399", "https://Stackoverflow.com", "https://Stackoverflow.com/users/192910/" ]
``` SELECT item FROM reservations WHERE (endDate BETWEEN start AND end) OR (startDate BETWEEN start AND end) OR (startDate<start AND endDate>end) ``` by @Strawberry suggestions a better query will look like this ``` SELECT item FROM reservations WHERE start<endDate AND end>startDate ``` This will give You items t...
As others have pointed out, you may not *need* this to be too efficient. That said, here's one approach (depending on what your ratio of reads to writes is): One way would be to have a table which tracks unbooked blocks of time (during whatever time horizon you're interested in, say from 2000 to 2020). Initially, it w...
15,939,399
This seems like a common question, but I have been web searching and can't find the answers. I want to reserve something for a number of days (no partial days), so I guess I need a table something like: ``` CREATE TABLE reservations ( item int, customer int, startDate date, endDate date ...
2013/04/11
[ "https://Stackoverflow.com/questions/15939399", "https://Stackoverflow.com", "https://Stackoverflow.com/users/192910/" ]
It's not critical to my approach, but I'm going to assume that you have an `items` table. I'll also provide a query that doesn't need an items table. The advantage of a separate items table is that you can easily add or retire items over time. They'll automatically show up in the reservation query results, and you can ...
As others have pointed out, you may not *need* this to be too efficient. That said, here's one approach (depending on what your ratio of reads to writes is): One way would be to have a table which tracks unbooked blocks of time (during whatever time horizon you're interested in, say from 2000 to 2020). Initially, it w...
15,939,399
This seems like a common question, but I have been web searching and can't find the answers. I want to reserve something for a number of days (no partial days), so I guess I need a table something like: ``` CREATE TABLE reservations ( item int, customer int, startDate date, endDate date ...
2013/04/11
[ "https://Stackoverflow.com/questions/15939399", "https://Stackoverflow.com", "https://Stackoverflow.com/users/192910/" ]
``` SELECT item FROM reservations WHERE (endDate BETWEEN start AND end) OR (startDate BETWEEN start AND end) OR (startDate<start AND endDate>end) ``` by @Strawberry suggestions a better query will look like this ``` SELECT item FROM reservations WHERE start<endDate AND end>startDate ``` This will give You items t...
If you can spare the cash, [Joe Celko's SQL for Smarties](https://rads.stackoverflow.com/amzn/click/com/0123820227) might have what you need.
15,939,399
This seems like a common question, but I have been web searching and can't find the answers. I want to reserve something for a number of days (no partial days), so I guess I need a table something like: ``` CREATE TABLE reservations ( item int, customer int, startDate date, endDate date ...
2013/04/11
[ "https://Stackoverflow.com/questions/15939399", "https://Stackoverflow.com", "https://Stackoverflow.com/users/192910/" ]
``` SELECT item FROM reservations WHERE (endDate BETWEEN start AND end) OR (startDate BETWEEN start AND end) OR (startDate<start AND endDate>end) ``` by @Strawberry suggestions a better query will look like this ``` SELECT item FROM reservations WHERE start<endDate AND end>startDate ``` This will give You items t...
If lookup efficiency is paramount, you'd be better off using a schema more like... ``` CREATE TABLE items ( id INT NOT NULL AUTO_INCREMENT, name VARCHAR(255) NOT NULL, PRIMARY KEY (id) ); CREATE TABLE reservations ( item_id INT NOT NULL, customer_id INT ...
15,939,399
This seems like a common question, but I have been web searching and can't find the answers. I want to reserve something for a number of days (no partial days), so I guess I need a table something like: ``` CREATE TABLE reservations ( item int, customer int, startDate date, endDate date ...
2013/04/11
[ "https://Stackoverflow.com/questions/15939399", "https://Stackoverflow.com", "https://Stackoverflow.com/users/192910/" ]
``` SELECT item FROM reservations WHERE (endDate BETWEEN start AND end) OR (startDate BETWEEN start AND end) OR (startDate<start AND endDate>end) ``` by @Strawberry suggestions a better query will look like this ``` SELECT item FROM reservations WHERE start<endDate AND end>startDate ``` This will give You items t...
It's not critical to my approach, but I'm going to assume that you have an `items` table. I'll also provide a query that doesn't need an items table. The advantage of a separate items table is that you can easily add or retire items over time. They'll automatically show up in the reservation query results, and you can ...
15,939,399
This seems like a common question, but I have been web searching and can't find the answers. I want to reserve something for a number of days (no partial days), so I guess I need a table something like: ``` CREATE TABLE reservations ( item int, customer int, startDate date, endDate date ...
2013/04/11
[ "https://Stackoverflow.com/questions/15939399", "https://Stackoverflow.com", "https://Stackoverflow.com/users/192910/" ]
It's not critical to my approach, but I'm going to assume that you have an `items` table. I'll also provide a query that doesn't need an items table. The advantage of a separate items table is that you can easily add or retire items over time. They'll automatically show up in the reservation query results, and you can ...
If you can spare the cash, [Joe Celko's SQL for Smarties](https://rads.stackoverflow.com/amzn/click/com/0123820227) might have what you need.
15,939,399
This seems like a common question, but I have been web searching and can't find the answers. I want to reserve something for a number of days (no partial days), so I guess I need a table something like: ``` CREATE TABLE reservations ( item int, customer int, startDate date, endDate date ...
2013/04/11
[ "https://Stackoverflow.com/questions/15939399", "https://Stackoverflow.com", "https://Stackoverflow.com/users/192910/" ]
It's not critical to my approach, but I'm going to assume that you have an `items` table. I'll also provide a query that doesn't need an items table. The advantage of a separate items table is that you can easily add or retire items over time. They'll automatically show up in the reservation query results, and you can ...
If lookup efficiency is paramount, you'd be better off using a schema more like... ``` CREATE TABLE items ( id INT NOT NULL AUTO_INCREMENT, name VARCHAR(255) NOT NULL, PRIMARY KEY (id) ); CREATE TABLE reservations ( item_id INT NOT NULL, customer_id INT ...
110,956
Is the same private key using k and k\*2 respectively in two different signatures vulnerable? If yes How to calculate the key in this case Here is an example, Both signatures are valid and the nonce of r2,s2,z2 is double the first signature's nonce, how do I calculate private key from these two signatures? r1 = 0xdcf...
2021/11/27
[ "https://bitcoin.stackexchange.com/questions/110956", "https://bitcoin.stackexchange.com", "https://bitcoin.stackexchange.com/users/124971/" ]
Assuming you're talking about ECDSA signing. For BIP340/Schnorr signatures, see [this answer](https://bitcoin.stackexchange.com/questions/110811/why-is-it-important-that-nonces-when-signing-not-be-related). ### For valid signatures Let: * `d`: the private key * `P=d*G`: the public key * `k1`: the (first) nonce * `R1...
c0e2d0a89a348de88fda08211c70d1d7e52ccef2eb9459911bf977d587784c6e is the nonce for the first rsz set. a3c2dce777813dc3f0d7a105a5fd56d5894ba30ffa01ba79667cadba37a9d8df is the private key.
10,819,284
I am downloading images from skydrive folder. When the image is downloaded , I need to save it in a folder called 'pictures' But how I can get the name of the file downloaded? I tried the next code but **fs** returns **null** ``` private void download() { if (ControlBackup_ID != null) ...
2012/05/30
[ "https://Stackoverflow.com/questions/10819284", "https://Stackoverflow.com", "https://Stackoverflow.com/users/181984/" ]
Finally, I have found this solution. I have seen that I can use "**userstate**" to pass filename Solution: When i scann skydrive folder, now I store ID and filename: ``` List<KeyValuePair<string, string>> contenidoSkyPic ; void getFilesImatges_GetCompleted(object sender, LiveOperationCompletedEventArgs e) { ...
The best way to implemebt this is through the use of a background process An example implementation can be found here: <http://msdn.microsoft.com/en-us/library/hh202959(v=vs.92).aspx> But a solution that will fit your needs better, is this Skydrive browser example: <http://code.msdn.microsoft.com/MetroSky-A-Complet...
14,339,464
I have written this query on **oracle** database. ``` Select salary from emp having salary < (SELECT MAX(SALARY) FROM EMP )); ``` <http://sqlfiddle.com/#!4/47961/13> But it is not working . Where am i wrong?
2013/01/15
[ "https://Stackoverflow.com/questions/14339464", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1155739/" ]
things to do, * use `WHERE` (*use having when comparing with aggregated condition*) * remove extra parenthesis, eg. ``` Select salary FROM emp WHERE salary < (SELECT MAX(SALARY) FROM EMP ); ``` * [SQLFiddle Demo](http://sqlfiddle.com/#!4/47961/15)
``` Select salary from emp WHERE SALARY < (SELECT MAX(SALARY) FROM EMP ); ```
14,339,464
I have written this query on **oracle** database. ``` Select salary from emp having salary < (SELECT MAX(SALARY) FROM EMP )); ``` <http://sqlfiddle.com/#!4/47961/13> But it is not working . Where am i wrong?
2013/01/15
[ "https://Stackoverflow.com/questions/14339464", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1155739/" ]
things to do, * use `WHERE` (*use having when comparing with aggregated condition*) * remove extra parenthesis, eg. ``` Select salary FROM emp WHERE salary < (SELECT MAX(SALARY) FROM EMP ); ``` * [SQLFiddle Demo](http://sqlfiddle.com/#!4/47961/15)
Correct way using Having in Oracle: ``` SELECT sal FROM scott.emp GROUP BY sal HAVING sal < (SELECT MAX(SAL) FROM scott.EMP) / SELECT deptno, COUNT(*) total_emps_by_dept FROM scott.emp GROUP BY deptno HAVING COUNT(*) > 1 / ```
14,339,464
I have written this query on **oracle** database. ``` Select salary from emp having salary < (SELECT MAX(SALARY) FROM EMP )); ``` <http://sqlfiddle.com/#!4/47961/13> But it is not working . Where am i wrong?
2013/01/15
[ "https://Stackoverflow.com/questions/14339464", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1155739/" ]
Two errors: * Use `WHERE` instead of `HAVING`. * Remove the extra parenthesis. Try this: ``` SELECT salary FROM emp WHERE salary < (SELECT MAX(salary) FROM emp); ``` <http://sqlfiddle.com/#!4/47961/17>
``` Select salary from emp WHERE SALARY < (SELECT MAX(SALARY) FROM EMP ); ```
14,339,464
I have written this query on **oracle** database. ``` Select salary from emp having salary < (SELECT MAX(SALARY) FROM EMP )); ``` <http://sqlfiddle.com/#!4/47961/13> But it is not working . Where am i wrong?
2013/01/15
[ "https://Stackoverflow.com/questions/14339464", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1155739/" ]
Two errors: * Use `WHERE` instead of `HAVING`. * Remove the extra parenthesis. Try this: ``` SELECT salary FROM emp WHERE salary < (SELECT MAX(salary) FROM emp); ``` <http://sqlfiddle.com/#!4/47961/17>
Correct way using Having in Oracle: ``` SELECT sal FROM scott.emp GROUP BY sal HAVING sal < (SELECT MAX(SAL) FROM scott.EMP) / SELECT deptno, COUNT(*) total_emps_by_dept FROM scott.emp GROUP BY deptno HAVING COUNT(*) > 1 / ```
14,339,464
I have written this query on **oracle** database. ``` Select salary from emp having salary < (SELECT MAX(SALARY) FROM EMP )); ``` <http://sqlfiddle.com/#!4/47961/13> But it is not working . Where am i wrong?
2013/01/15
[ "https://Stackoverflow.com/questions/14339464", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1155739/" ]
``` Select salary from emp where salary < (SELECT MAX(SALARY) FROM EMP )); ``` you can apply `having` clause where you used group by , here there is no group by than just use `where` [**The HAVING Clause**](http://www.techonthenet.com/sql/having.php) The HAVING clause was added to SQL because the WHERE keyword coul...
``` Select salary from emp WHERE SALARY < (SELECT MAX(SALARY) FROM EMP ); ```
14,339,464
I have written this query on **oracle** database. ``` Select salary from emp having salary < (SELECT MAX(SALARY) FROM EMP )); ``` <http://sqlfiddle.com/#!4/47961/13> But it is not working . Where am i wrong?
2013/01/15
[ "https://Stackoverflow.com/questions/14339464", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1155739/" ]
``` Select salary from emp where salary < (SELECT MAX(SALARY) FROM EMP )); ``` you can apply `having` clause where you used group by , here there is no group by than just use `where` [**The HAVING Clause**](http://www.techonthenet.com/sql/having.php) The HAVING clause was added to SQL because the WHERE keyword coul...
Correct way using Having in Oracle: ``` SELECT sal FROM scott.emp GROUP BY sal HAVING sal < (SELECT MAX(SAL) FROM scott.EMP) / SELECT deptno, COUNT(*) total_emps_by_dept FROM scott.emp GROUP BY deptno HAVING COUNT(*) > 1 / ```
124,290
At the beginning of the Deathly Hallows, a whole team (13 people) comes to Privet Drive to get Harry out of there for the last time. > > Pausing only to employ a few of Uncle Vernon’s choicest swear words, he staggered back into the kitchen, clutching his head and staring out of the window into the back garden. > ...
2016/04/06
[ "https://scifi.stackexchange.com/questions/124290", "https://scifi.stackexchange.com", "https://scifi.stackexchange.com/users/64082/" ]
They didn't necessarily need to go unnoticed by the Death Eaters. The Death Eaters simply had to go unnoticed by them. The Death Eaters were there for Harry specifically, not the Order as a whole, and they needed the Order members to bring Harry outside of the protection of Privet Drive in order to move him before the...
While disillusionment charms in general are not entire invisibility strong wizards (Dumbledore for example) can turn invisible using disillusionment charms. While the Order do not have wizards of this strength in DH they have many powerful witches and wizards with them so the disillusionment charms will be very good an...
28,236,585
I use aspnetmvcturbolinks in own project and I have reload page with Turbolinks.visit(path) when user add text in input . but,when page changed I check this keyup event of input is fire more one and I add return false but not work . ``` $(document).on("ready page:load", function() { $('input[name=keyword]').ke...
2015/01/30
[ "https://Stackoverflow.com/questions/28236585", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3962193/" ]
you can do that in this delegate method of UISearchBar ``` - (void)searchDisplayControllerWillBeginSearch:(UISearchDisplayController *)controller { [theSearchBar setShowsCancelButton:YES animated:NO]; for (UIView *subView in theSearchBar.subviews){ if([subView isKindOfClass:[UIButton class]]){ ...
There are 2 solutions. 1. set key/value [self.searchController.searchBar setValue:@"취소" forKey:@"\_cancelButtonText"]; This solution works well, but you have to know that \_cancelButtonText property is not public property.(You can not find this property in the documentation page.) And It's not sure that this solutio...
28,236,585
I use aspnetmvcturbolinks in own project and I have reload page with Turbolinks.visit(path) when user add text in input . but,when page changed I check this keyup event of input is fire more one and I add return false but not work . ``` $(document).on("ready page:load", function() { $('input[name=keyword]').ke...
2015/01/30
[ "https://Stackoverflow.com/questions/28236585", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3962193/" ]
you can do that in this delegate method of UISearchBar ``` - (void)searchDisplayControllerWillBeginSearch:(UISearchDisplayController *)controller { [theSearchBar setShowsCancelButton:YES animated:NO]; for (UIView *subView in theSearchBar.subviews){ if([subView isKindOfClass:[UIButton class]]){ ...
Actually, the cancel button is not a top view in the Search bar. You should search for it recursively. ``` -(UIButton*)findButtonInView:(UIView*)v{ for (UIView *subView in v.subviews){ if([subView isKindOfClass:[UIButton class]]){ return (UIButton*)subView; }else if([subView isKindOfCla...
69,824,813
In my test 'should emit action complete', I'm trying to test that the emit function of 'bookActionCompleted' is called when the 'OnBookActionClick' method is called. This emit function is called inside a method passed into the subscribe function of a void observable returned from my service methods. Unfortunately the ...
2021/11/03
[ "https://Stackoverflow.com/questions/69824813", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10240973/" ]
This array formula should work: ``` =SUM(IFERROR(MATCH(A:A;B:B;0)/MATCH(A:A;B:B;0);0))-1 ``` When introducing the formula don't press enter. You have to press Control+Shift+Enter. It should be shown like this, with curly brackets: [![enter image description here](https://i.stack.imgur.com/QbYOd.png)](https://i.stac...
You can do something like this in column C from row 1 to 5 and sum the result of the values. ``` =ZÄHLENWENNS($B$1:$B$5;A1) //German =COUNTIF($B$1:$B$5,A1) //English ``` [![enter image description here](https://i.stack.imgur.com/SD5hR.png)](https://i.stack.imgur.com/SD5hR.png)
69,824,813
In my test 'should emit action complete', I'm trying to test that the emit function of 'bookActionCompleted' is called when the 'OnBookActionClick' method is called. This emit function is called inside a method passed into the subscribe function of a void observable returned from my service methods. Unfortunately the ...
2021/11/03
[ "https://Stackoverflow.com/questions/69824813", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10240973/" ]
This array formula should work: ``` =SUM(IFERROR(MATCH(A:A;B:B;0)/MATCH(A:A;B:B;0);0))-1 ``` When introducing the formula don't press enter. You have to press Control+Shift+Enter. It should be shown like this, with curly brackets: [![enter image description here](https://i.stack.imgur.com/QbYOd.png)](https://i.stac...
You could use `=SUMPRODUCT(--(COUNTIF(A1:A5,B1:B5)>0))`. Sumproduct does not require `ctrl+shift+enter` also not in older Excel versions. PS This solution is not case sensitive.
26,744,534
I have written a fairly basic iOS app that makes use of web content via a UIWebView element. The app needs to run in Guided Access mode as it is running in a customer-facing retail environment. Under iOS 7 all worked fine, but since updating to iOS 8 an alert "Guided Access is enabled. Triple-click the home button to ...
2014/11/04
[ "https://Stackoverflow.com/questions/26744534", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4216048/" ]
I've found a workaround thanks to Chris from Kiosk Pro App. You need to transform all requests (only when Guided Access is on) with navigation type "UIWebViewNavigationTypeLinkClicked" to navigation type "UIWebViewNavigationTypeOther" One issue with this workaround is that the Guided Access message still appears for ...
I finally found a workaround: migrate from UIWebView to WKWebView !!! Works for me !
13,725
We have just installed SDL Web 8 on a Windows Server 2012 R2 server with SQL Server 2012 SP2 for the database. We have also installed the the core content delivery standalone microservices (Discovery Service, Session-enabled Content Service, Content Deployer). But we are getting the following error with the `Add-TtmC...
2016/01/20
[ "https://tridion.stackexchange.com/questions/13725", "https://tridion.stackexchange.com", "https://tridion.stackexchange.com/users/1290/" ]
This suggests an issue with the authentication between the Topology Manager and the Discovery Service. Are your `-ClientID` and `-ClientSecret` values aligned with the `cmuser` account within your `discovery\config\cd_ambient_conf.xml` file? See the responses to [SDL web8 - Issue with adding a website](https://tridion...
Since the error occurs when adding a Topology Type (which doesn't result in communication with either CD or CM), the problem seems to be that the user who executes the PowerShell cmdlet is not authorized to perform that command. By default, you need to be in the Windows Administrators Group **and run PowerShell as Adm...
13,725
We have just installed SDL Web 8 on a Windows Server 2012 R2 server with SQL Server 2012 SP2 for the database. We have also installed the the core content delivery standalone microservices (Discovery Service, Session-enabled Content Service, Content Deployer). But we are getting the following error with the `Add-TtmC...
2016/01/20
[ "https://tridion.stackexchange.com/questions/13725", "https://tridion.stackexchange.com", "https://tridion.stackexchange.com/users/1290/" ]
I ran into this today and the solution is a little obscure: I had to shift+right-click on my PowerShell console and choose "Run as different user" and then enter my credentials again. Yes, I logged in as myself again. So even though I used *the exact same user* as when I ran it before (and who I have used successfull...
Since the error occurs when adding a Topology Type (which doesn't result in communication with either CD or CM), the problem seems to be that the user who executes the PowerShell cmdlet is not authorized to perform that command. By default, you need to be in the Windows Administrators Group **and run PowerShell as Adm...
60,420,307
I'm new to python and I have a challenge. I need to add a column in a text file delimited by ";". So far so good ... except that the value of this column depends on the value of another column. I will leave an example in case I was not clear My file looks like this: ``` Account;points 1;500 2;600 3;1500 ``` If the ...
2020/02/26
[ "https://Stackoverflow.com/questions/60420307", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12968606/" ]
File (hard drive) can't add new item between new elements. You have to read all data to memory, add new column, and write all back to file. You could use `pandas` to easily add new column based on value from other colum. In example I use `io.StringIO()` only to create minimal working code so everyone can copy it and ...
You can use python library to create csv files. Here is the link to the documentation. <https://docs.python.org/3/library/csv.html>
60,420,307
I'm new to python and I have a challenge. I need to add a column in a text file delimited by ";". So far so good ... except that the value of this column depends on the value of another column. I will leave an example in case I was not clear My file looks like this: ``` Account;points 1;500 2;600 3;1500 ``` If the ...
2020/02/26
[ "https://Stackoverflow.com/questions/60420307", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12968606/" ]
Approach without using pandas, this code assumes your points column will always be at the second position. ``` with open('stats.txt', 'r+') as file: lines = file.readlines() file.seek(0,0) for line in lines: columns = line.strip().split(";") if int(columns[1])>1000: file.write(";".jo...
You can use python library to create csv files. Here is the link to the documentation. <https://docs.python.org/3/library/csv.html>
19,380,046
**Background:** * I have 1...\* objects of the same class (X). * The objects are given a delegate that fetches data for it. * All objects of class X uses the same delegate. * Each object of class X wants a different set of data. * The SDK I'm using have declared the delegate to have no parameters. I somehow need to c...
2013/10/15
[ "https://Stackoverflow.com/questions/19380046", "https://Stackoverflow.com", "https://Stackoverflow.com/users/919798/" ]
You can wrap the code in `getRows()` into a method accepting a `parameter`, using a closure: ``` public void getTables() { foreach(X currentTable in mapper.getTables()) { MTables.Add(new X { TableName = currentTable.getName(), GetRows = getRows(currentTable.getName()), ...
If you have control over the class exposing the delegate then just change the delegate to accept an argument for the caller. Otherwise you are out of luck. Regardless, this architecture is questionable at best.
321,656
In Qt, when a widget receives focus, how can get a notification about it, so I can execute some custom code? Is there a signal or an event for that?
2008/11/26
[ "https://Stackoverflow.com/questions/321656", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Just in case anybody looking for two QMainWindow focus change . You can use ``` if(e->type() == QEvent::WindowActivate) { //qDebug() << "Focus IN " << obj << e ; } ```
QWidget::setFocus() is slot, not signal. You can check if QLineEdit is in focus with [focus property](http://doc.trolltech.com/4.4/qwidget.html#focus-prop). QLineEdit emits signals when text is changed or edited, see documentation.
321,656
In Qt, when a widget receives focus, how can get a notification about it, so I can execute some custom code? Is there a signal or an event for that?
2008/11/26
[ "https://Stackoverflow.com/questions/321656", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
There is a "focusChanged" signal sent when the focus changes, introduced in Qt 4.1. It has two arguments, he widget losing focus and the one gaining focus: ``` void QApplication::focusChanged(QWidget * old, QWidget * now) ```
Just in case anybody looking for two QMainWindow focus change . You can use ``` if(e->type() == QEvent::WindowActivate) { //qDebug() << "Focus IN " << obj << e ; } ```
321,656
In Qt, when a widget receives focus, how can get a notification about it, so I can execute some custom code? Is there a signal or an event for that?
2008/11/26
[ "https://Stackoverflow.com/questions/321656", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
The simplest way is to connect a slot to the QApplication::focusChanged signal.
QWidget::setFocus() is slot, not signal. You can check if QLineEdit is in focus with [focus property](http://doc.trolltech.com/4.4/qwidget.html#focus-prop). QLineEdit emits signals when text is changed or edited, see documentation.
321,656
In Qt, when a widget receives focus, how can get a notification about it, so I can execute some custom code? Is there a signal or an event for that?
2008/11/26
[ "https://Stackoverflow.com/questions/321656", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
You can add en `event filter`. This is an example of an application written with **QtCreator**. This form has a **QComboBox** named ***combobox***. ``` MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent),ui(new Ui::MainWindow) { ui->setupUi(this); ui->comboBox->installEventFilter(this); . ...
I'd have to play with it, but just looking at the QT Documentation, there is a "focusInEvent". This is an event handler. Here's how you find information about.... Open up "QT Assistant". Go to the Index. Put in a "QLineEdit". There is a really useful link called "List of all members, including inherited members" on al...
321,656
In Qt, when a widget receives focus, how can get a notification about it, so I can execute some custom code? Is there a signal or an event for that?
2008/11/26
[ "https://Stackoverflow.com/questions/321656", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
There is a "focusChanged" signal sent when the focus changes, introduced in Qt 4.1. It has two arguments, he widget losing focus and the one gaining focus: ``` void QApplication::focusChanged(QWidget * old, QWidget * now) ```
You have hit on of the weird splits in QT, if you look at the documentation `focusInEvent` is not a slot it is a protected function, you can override it if you are implementing a subclass of your widget. If you you just want to catch the event coming into your widget you can use [`QObject::installEventFilter`](http://d...
321,656
In Qt, when a widget receives focus, how can get a notification about it, so I can execute some custom code? Is there a signal or an event for that?
2008/11/26
[ "https://Stackoverflow.com/questions/321656", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
There is a "focusChanged" signal sent when the focus changes, introduced in Qt 4.1. It has two arguments, he widget losing focus and the one gaining focus: ``` void QApplication::focusChanged(QWidget * old, QWidget * now) ```
QWidget::setFocus() is slot, not signal. You can check if QLineEdit is in focus with [focus property](http://doc.trolltech.com/4.4/qwidget.html#focus-prop). QLineEdit emits signals when text is changed or edited, see documentation.
321,656
In Qt, when a widget receives focus, how can get a notification about it, so I can execute some custom code? Is there a signal or an event for that?
2008/11/26
[ "https://Stackoverflow.com/questions/321656", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
You can add en `event filter`. This is an example of an application written with **QtCreator**. This form has a **QComboBox** named ***combobox***. ``` MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent),ui(new Ui::MainWindow) { ui->setupUi(this); ui->comboBox->installEventFilter(this); . ...
QWidget::setFocus() is slot, not signal. You can check if QLineEdit is in focus with [focus property](http://doc.trolltech.com/4.4/qwidget.html#focus-prop). QLineEdit emits signals when text is changed or edited, see documentation.
321,656
In Qt, when a widget receives focus, how can get a notification about it, so I can execute some custom code? Is there a signal or an event for that?
2008/11/26
[ "https://Stackoverflow.com/questions/321656", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
You can add en `event filter`. This is an example of an application written with **QtCreator**. This form has a **QComboBox** named ***combobox***. ``` MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent),ui(new Ui::MainWindow) { ui->setupUi(this); ui->comboBox->installEventFilter(this); . ...
There is a "focusChanged" signal sent when the focus changes, introduced in Qt 4.1. It has two arguments, he widget losing focus and the one gaining focus: ``` void QApplication::focusChanged(QWidget * old, QWidget * now) ```
321,656
In Qt, when a widget receives focus, how can get a notification about it, so I can execute some custom code? Is there a signal or an event for that?
2008/11/26
[ "https://Stackoverflow.com/questions/321656", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
You can add en `event filter`. This is an example of an application written with **QtCreator**. This form has a **QComboBox** named ***combobox***. ``` MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent),ui(new Ui::MainWindow) { ui->setupUi(this); ui->comboBox->installEventFilter(this); . ...
Qt Designer isn't designed for this level of WYSIWYG programming. Do it in C++: ``` class LineEdit : public QLineEdit { virtual void focusInEvent( QFocusEvent* ) {} }; ```
321,656
In Qt, when a widget receives focus, how can get a notification about it, so I can execute some custom code? Is there a signal or an event for that?
2008/11/26
[ "https://Stackoverflow.com/questions/321656", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Qt Designer isn't designed for this level of WYSIWYG programming. Do it in C++: ``` class LineEdit : public QLineEdit { virtual void focusInEvent( QFocusEvent* ) {} }; ```
The simplest way is to connect a slot to the QApplication::focusChanged signal.
8,658,012
I am a newcomer to Python. I don't understand how/why the `self` argument is used: ``` class Person: def __init__(self, name): self.name = name def sayHi(self): print 'Hello, my name is', self.name p = Person('Swaroop') p.sayHi() ``` This code is from a Byte of Python. This code could have j...
2011/12/28
[ "https://Stackoverflow.com/questions/8658012", "https://Stackoverflow.com", "https://Stackoverflow.com/users/858962/" ]
Have a look at the new method `sayHiTo`: ``` class Person: def __init__(self, name): self.name = name def sayHi(self): print 'Hello, my name is', self.name def sayHiTo(self, other): print 'Hello', other.name, ' my name is', self.name p1 = Person('Swaroop') p2 = Person('codeninja') ...
The purpose is to store the reference to the name so you can reference it in another method of the class e.g. `def sayHi (self)`
8,658,012
I am a newcomer to Python. I don't understand how/why the `self` argument is used: ``` class Person: def __init__(self, name): self.name = name def sayHi(self): print 'Hello, my name is', self.name p = Person('Swaroop') p.sayHi() ``` This code is from a Byte of Python. This code could have j...
2011/12/28
[ "https://Stackoverflow.com/questions/8658012", "https://Stackoverflow.com", "https://Stackoverflow.com/users/858962/" ]
Have a look at the new method `sayHiTo`: ``` class Person: def __init__(self, name): self.name = name def sayHi(self): print 'Hello, my name is', self.name def sayHiTo(self, other): print 'Hello', other.name, ' my name is', self.name p1 = Person('Swaroop') p2 = Person('codeninja') ...
You can't compare a function in a class to just a function. Sure you can pass in name, but the idea of using a class is that you are encapsulating data. Having vars linked to self means you can pass around an object, and that object can always have access to its 'member variables'. Some other class can use an instance ...
8,658,012
I am a newcomer to Python. I don't understand how/why the `self` argument is used: ``` class Person: def __init__(self, name): self.name = name def sayHi(self): print 'Hello, my name is', self.name p = Person('Swaroop') p.sayHi() ``` This code is from a Byte of Python. This code could have j...
2011/12/28
[ "https://Stackoverflow.com/questions/8658012", "https://Stackoverflow.com", "https://Stackoverflow.com/users/858962/" ]
It seems you are oversimplifying a not so simple thing. In object-oriented programming, a Class is a Declarative Construct which gives a blueprint as to what an object (a manifestation of this blueprint) would contain (properties) and how it would behave (members). Every manifestation of such a Class is called an Obje...
Have a look at the new method `sayHiTo`: ``` class Person: def __init__(self, name): self.name = name def sayHi(self): print 'Hello, my name is', self.name def sayHiTo(self, other): print 'Hello', other.name, ' my name is', self.name p1 = Person('Swaroop') p2 = Person('codeninja') ...
8,658,012
I am a newcomer to Python. I don't understand how/why the `self` argument is used: ``` class Person: def __init__(self, name): self.name = name def sayHi(self): print 'Hello, my name is', self.name p = Person('Swaroop') p.sayHi() ``` This code is from a Byte of Python. This code could have j...
2011/12/28
[ "https://Stackoverflow.com/questions/8658012", "https://Stackoverflow.com", "https://Stackoverflow.com/users/858962/" ]
Actually no. Your second example is not correct. The 'self' keyword is a special reference that is passed to instance methods of a class. It represents the actual instance of the class at that scope. When you make a class it is just a general definition. Then you create instances of that class. Each instance is unique ...
The purpose is to store the reference to the name so you can reference it in another method of the class e.g. `def sayHi (self)`
8,658,012
I am a newcomer to Python. I don't understand how/why the `self` argument is used: ``` class Person: def __init__(self, name): self.name = name def sayHi(self): print 'Hello, my name is', self.name p = Person('Swaroop') p.sayHi() ``` This code is from a Byte of Python. This code could have j...
2011/12/28
[ "https://Stackoverflow.com/questions/8658012", "https://Stackoverflow.com", "https://Stackoverflow.com/users/858962/" ]
It seems you are oversimplifying a not so simple thing. In object-oriented programming, a Class is a Declarative Construct which gives a blueprint as to what an object (a manifestation of this blueprint) would contain (properties) and how it would behave (members). Every manifestation of such a Class is called an Obje...
The purpose is to store the reference to the name so you can reference it in another method of the class e.g. `def sayHi (self)`
8,658,012
I am a newcomer to Python. I don't understand how/why the `self` argument is used: ``` class Person: def __init__(self, name): self.name = name def sayHi(self): print 'Hello, my name is', self.name p = Person('Swaroop') p.sayHi() ``` This code is from a Byte of Python. This code could have j...
2011/12/28
[ "https://Stackoverflow.com/questions/8658012", "https://Stackoverflow.com", "https://Stackoverflow.com/users/858962/" ]
Actually no. Your second example is not correct. The 'self' keyword is a special reference that is passed to instance methods of a class. It represents the actual instance of the class at that scope. When you make a class it is just a general definition. Then you create instances of that class. Each instance is unique ...
You can't compare a function in a class to just a function. Sure you can pass in name, but the idea of using a class is that you are encapsulating data. Having vars linked to self means you can pass around an object, and that object can always have access to its 'member variables'. Some other class can use an instance ...
8,658,012
I am a newcomer to Python. I don't understand how/why the `self` argument is used: ``` class Person: def __init__(self, name): self.name = name def sayHi(self): print 'Hello, my name is', self.name p = Person('Swaroop') p.sayHi() ``` This code is from a Byte of Python. This code could have j...
2011/12/28
[ "https://Stackoverflow.com/questions/8658012", "https://Stackoverflow.com", "https://Stackoverflow.com/users/858962/" ]
It seems you are oversimplifying a not so simple thing. In object-oriented programming, a Class is a Declarative Construct which gives a blueprint as to what an object (a manifestation of this blueprint) would contain (properties) and how it would behave (members). Every manifestation of such a Class is called an Obje...
Actually no. Your second example is not correct. The 'self' keyword is a special reference that is passed to instance methods of a class. It represents the actual instance of the class at that scope. When you make a class it is just a general definition. Then you create instances of that class. Each instance is unique ...
8,658,012
I am a newcomer to Python. I don't understand how/why the `self` argument is used: ``` class Person: def __init__(self, name): self.name = name def sayHi(self): print 'Hello, my name is', self.name p = Person('Swaroop') p.sayHi() ``` This code is from a Byte of Python. This code could have j...
2011/12/28
[ "https://Stackoverflow.com/questions/8658012", "https://Stackoverflow.com", "https://Stackoverflow.com/users/858962/" ]
It seems you are oversimplifying a not so simple thing. In object-oriented programming, a Class is a Declarative Construct which gives a blueprint as to what an object (a manifestation of this blueprint) would contain (properties) and how it would behave (members). Every manifestation of such a Class is called an Obje...
You can't compare a function in a class to just a function. Sure you can pass in name, but the idea of using a class is that you are encapsulating data. Having vars linked to self means you can pass around an object, and that object can always have access to its 'member variables'. Some other class can use an instance ...
616,541
The question I have is similar to that of the Pendulum in an accelerating train problem. Where a bob is hung from the ceiling of a train that is at rest. The train then begins moving with an acceleration "a". I understand that the mass of the pendulum bob does not affect the period of the swing. This fact can be verif...
2021/02/23
[ "https://physics.stackexchange.com/questions/616541", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/269332/" ]
If you are asking how quickly the mass will respond to the train's acceleration, then the answer is *instantaneously* and this is *independent of the mass of the bob*. This is due to [inertia](https://en.wikipedia.org/wiki/Inertia) and inertia is a property of all masses. The period of a pendulum if it's in a stationa...
In the non-inertial reference frame that is the accelerating train, the bob experiences a fictitious force $-ma$ where $m$ is the mass of the bob and $a$ the acceleration of the train. This force is proportional to the mass of the bob. Assuming the bob is initially hanging vertically, as soon as the train accelerates, ...
616,541
The question I have is similar to that of the Pendulum in an accelerating train problem. Where a bob is hung from the ceiling of a train that is at rest. The train then begins moving with an acceleration "a". I understand that the mass of the pendulum bob does not affect the period of the swing. This fact can be verif...
2021/02/23
[ "https://physics.stackexchange.com/questions/616541", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/269332/" ]
In the non-inertial reference frame that is the accelerating train, the bob experiences a fictitious force $-ma$ where $m$ is the mass of the bob and $a$ the acceleration of the train. This force is proportional to the mass of the bob. Assuming the bob is initially hanging vertically, as soon as the train accelerates, ...
Previous answers are wrong in explaining when the bob starts to move... It is not instantaneous. The bob is hung from the ceiling and it is the ceiling that is accelerating. The top portion of the string accelerates along with the train... But the portions of string down the line will start to displace only when that ...
616,541
The question I have is similar to that of the Pendulum in an accelerating train problem. Where a bob is hung from the ceiling of a train that is at rest. The train then begins moving with an acceleration "a". I understand that the mass of the pendulum bob does not affect the period of the swing. This fact can be verif...
2021/02/23
[ "https://physics.stackexchange.com/questions/616541", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/269332/" ]
If you are asking how quickly the mass will respond to the train's acceleration, then the answer is *instantaneously* and this is *independent of the mass of the bob*. This is due to [inertia](https://en.wikipedia.org/wiki/Inertia) and inertia is a property of all masses. The period of a pendulum if it's in a stationa...
Previous answers are wrong in explaining when the bob starts to move... It is not instantaneous. The bob is hung from the ceiling and it is the ceiling that is accelerating. The top portion of the string accelerates along with the train... But the portions of string down the line will start to displace only when that ...
21,592,346
Coming from Java to C++ I'm attempting to understand abstraction through object orientation. To put this into a practical example, I am developing a small game using the SFML library for graphics. However this question does not relate to that, simply think of it as background info. Anyway, the way the game works is to...
2014/02/06
[ "https://Stackoverflow.com/questions/21592346", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1074266/" ]
To be short: you don't know any basics of C++, and as a beginner, you should really aproach it as a totally different language than Java or C, so you should stop your project right now and find a good book for C++ beginners. Don't try to mix your Java knowledge and just fill the gaps to reach C++ knowledge, it will not...
The "zero-size array" error is caused by `GameState game_states[];`. In C++ you have to specify the array size at declaration time, either by specifically writing the size or direct initializing it. Example: ``` GameState game_states[ ]; // Error, compiler can't know how much memory to reserve for this. GameState gam...
188,293
There are spells like [Continual Flame](https://www.dndbeyond.com/spells/continual-flame) which require ruby dust as a material component. The rules explicitly require "ruby dust worth X gp", not "ruby dust made from rubies worth X gp". Let's say we found a ruby that costs 500 gp and want to crush it to a ruby dust. H...
2021/06/18
[ "https://rpg.stackexchange.com/questions/188293", "https://rpg.stackexchange.com", "https://rpg.stackexchange.com/users/27377/" ]
It's up to the DM. Having said that, D&D pricing doesn't make economic sense, so the answer I prefer1 when I DM is that is you get 500gp worth of dust out of 500gp worth of rubies. The game also doesn't specify any other properties than value when it talks about most gems. Maybe the price is exactly proportional to w...
Unless your GM rules otherwise, you can use a real world analogy to crushed ruby, [diamond powder](https://en.wikipedia.org/wiki/Diamond#Industrial-grade_diamonds). -----------------------------------------------------------------------------------------------------------------------------------------------------------...
188,293
There are spells like [Continual Flame](https://www.dndbeyond.com/spells/continual-flame) which require ruby dust as a material component. The rules explicitly require "ruby dust worth X gp", not "ruby dust made from rubies worth X gp". Let's say we found a ruby that costs 500 gp and want to crush it to a ruby dust. H...
2021/06/18
[ "https://rpg.stackexchange.com/questions/188293", "https://rpg.stackexchange.com", "https://rpg.stackexchange.com/users/27377/" ]
### Pricing in DnD is largely just a mechanic to restrict access The 500gp is the barrier, not the mechanics by which the item is gained. Either the item is given as a reward for a task done and worth 500gp or the item is bought with 500gp worth of gold earned. Either way the DM has a method by which to reward the cha...
Unless your GM rules otherwise, you can use a real world analogy to crushed ruby, [diamond powder](https://en.wikipedia.org/wiki/Diamond#Industrial-grade_diamonds). -----------------------------------------------------------------------------------------------------------------------------------------------------------...