qid
int64
1
74.7M
question
stringlengths
0
58.3k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
2
48.3k
response_k
stringlengths
2
40.5k
7,876,341
I am working on an EE 1.7.1 site and need to display the two most recent article entries on the home page. The challenge is that I also need to link those entries back to their respective category pages to display properly. Here is the code I have so far: ``` {exp:weblog:entries weblog="articles" limit="2"} <p><a ...
2011/10/24
[ "https://Stackoverflow.com/questions/7876341", "https://Stackoverflow.com", "https://Stackoverflow.com/users/152205/" ]
Another way: ``` If Range("Table2").Rows.Count > 1 Then Range("Table2").EntireRow.Delete End If ```
``` Sub delete_rows_blank() t = 1 lastrow = ActiveSheet.UsedRange.Rows.Count Do Until t = lastrow If Cells(t, "A") = "" Then Rows(t).Delete End If t = t + 1 Loop End Sub ```
15,919,723
With the JQuery DataTables plugin I am using mRender to add buttons to my dynamically added rows. This part works great, but how can I get the rowID of the current row the buttons are added to? I need this to create unique IDs for the buttons. What do I need to use in place of ???? in the code below? **JavaScript:** ...
2013/04/10
[ "https://Stackoverflow.com/questions/15919723", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2159828/" ]
The properties of `String` are all non-enumerable, which is why your loop does not show them. You can see the own properties in an ES5 environment with the [`Object.getOwnPropertyNames`](https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/getOwnPropertyNames) function: ``` Object.getOwn...
try using the console in developer tools in Chrome or Firebug in Firefox. and try this ``` for (x in new String()) { console.log(x); } ```
15,919,723
With the JQuery DataTables plugin I am using mRender to add buttons to my dynamically added rows. This part works great, but how can I get the rowID of the current row the buttons are added to? I need this to create unique IDs for the buttons. What do I need to use in place of ???? in the code below? **JavaScript:** ...
2013/04/10
[ "https://Stackoverflow.com/questions/15919723", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2159828/" ]
First It must be declared as Object,(may be using 'new' keyword) ``` s1 = "2 + 2"; s2 = new String("2 + 2"); console.log(eval(s1)); console.log(eval(s2)); ``` OR ``` console.log(eval(s2.valueOf())); ```
try using the console in developer tools in Chrome or Firebug in Firefox. and try this ``` for (x in new String()) { console.log(x); } ```
15,919,723
With the JQuery DataTables plugin I am using mRender to add buttons to my dynamically added rows. This part works great, but how can I get the rowID of the current row the buttons are added to? I need this to create unique IDs for the buttons. What do I need to use in place of ???? in the code below? **JavaScript:** ...
2013/04/10
[ "https://Stackoverflow.com/questions/15919723", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2159828/" ]
The properties of `String` are all non-enumerable, which is why your loop does not show them. You can see the own properties in an ES5 environment with the [`Object.getOwnPropertyNames`](https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/getOwnPropertyNames) function: ``` Object.getOwn...
This should do the job : ``` var StringProp=Object.getOwnPropertyNames(String); document.write(StringProp); -->> ["length", "name", "arguments", "caller", "prototype", "fromCharCode"] ``` But you might be more interested by : ``` var StringProtProp=Object.getOwnPropertyNames(String.prototype); document.w...
15,919,723
With the JQuery DataTables plugin I am using mRender to add buttons to my dynamically added rows. This part works great, but how can I get the rowID of the current row the buttons are added to? I need this to create unique IDs for the buttons. What do I need to use in place of ???? in the code below? **JavaScript:** ...
2013/04/10
[ "https://Stackoverflow.com/questions/15919723", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2159828/" ]
The properties of `String` are all non-enumerable, which is why your loop does not show them. You can see the own properties in an ES5 environment with the [`Object.getOwnPropertyNames`](https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/getOwnPropertyNames) function: ``` Object.getOwn...
First It must be declared as Object,(may be using 'new' keyword) ``` s1 = "2 + 2"; s2 = new String("2 + 2"); console.log(eval(s1)); console.log(eval(s2)); ``` OR ``` console.log(eval(s2.valueOf())); ```
15,919,723
With the JQuery DataTables plugin I am using mRender to add buttons to my dynamically added rows. This part works great, but how can I get the rowID of the current row the buttons are added to? I need this to create unique IDs for the buttons. What do I need to use in place of ???? in the code below? **JavaScript:** ...
2013/04/10
[ "https://Stackoverflow.com/questions/15919723", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2159828/" ]
First It must be declared as Object,(may be using 'new' keyword) ``` s1 = "2 + 2"; s2 = new String("2 + 2"); console.log(eval(s1)); console.log(eval(s2)); ``` OR ``` console.log(eval(s2.valueOf())); ```
This should do the job : ``` var StringProp=Object.getOwnPropertyNames(String); document.write(StringProp); -->> ["length", "name", "arguments", "caller", "prototype", "fromCharCode"] ``` But you might be more interested by : ``` var StringProtProp=Object.getOwnPropertyNames(String.prototype); document.w...
9,035,501
Is there a way to test if a custom attribute is a function? I've tried using jquery's isFunction method, but it doesn't seem to work with this scenario. For example: ``` <input id="test" class='date' oncomplete="function() { alert('i am a function'); }" type="text" /> <script> $(".date").livequery(function () {...
2012/01/27
[ "https://Stackoverflow.com/questions/9035501", "https://Stackoverflow.com", "https://Stackoverflow.com/users/508536/" ]
Look at your requirements: > > * One image should be stored on a one node. Otherwise, if it is partitioned, image response latency could drop down dramatically > * Fault tolerance is not the case > > > Why would you go with a distributed file system in this situation?
I think MogileFs would be the good choice for you. But it has redundancy if you set it. <https://github.com/mogilefs/>
11,548
I have purchased my first DSLR (a Canon 500D) and have been playing around quite a lot within the aperture priority mode, with auto shutter speed and ISO. Anyways as I would like to become a better photographer I would like to start taking *all* my photos in Full Manual mode. Are there any general rules that I should...
2011/05/03
[ "https://photo.stackexchange.com/questions/11548", "https://photo.stackexchange.com", "https://photo.stackexchange.com/users/4990/" ]
Shooting manual mode doesn't make you a better photographer, understanding what all the settings effectively do will. Your camera has three basic settings: * **Aperture**: Use this to control depth of field (DoF). This is usually the most important setting to most photographers, as it influences both subject matter an...
In general you want to use as low an ISO setting as you can to avoid noise. If the lowest ISO means shooting at a low shutter speed, say 1/15th then you may bump up the ISO a bit so that you can shoot at a faster shutter speed. If the light isn't changing, setting everything manually means that you get consistent exp...
11,548
I have purchased my first DSLR (a Canon 500D) and have been playing around quite a lot within the aperture priority mode, with auto shutter speed and ISO. Anyways as I would like to become a better photographer I would like to start taking *all* my photos in Full Manual mode. Are there any general rules that I should...
2011/05/03
[ "https://photo.stackexchange.com/questions/11548", "https://photo.stackexchange.com", "https://photo.stackexchange.com/users/4990/" ]
First, stay away from the "icons" on your 500D. These are the automated settings, and offer no freedom to choose your aperture and shutter speed. Once you do that, here are four simple rules I follow: Rule #1: stay above 1/60. ------------------------- If you are using a tripod, you can go below this speed, but when...
Exposure ======== There are several technical factors that will affect your images directly which you have control over. Depending on each situation that you want to shoot, you may want to have the others adjusted automatically by your camera, or adjust all of them manually yourself. Shooting moving subjects generally...
11,548
I have purchased my first DSLR (a Canon 500D) and have been playing around quite a lot within the aperture priority mode, with auto shutter speed and ISO. Anyways as I would like to become a better photographer I would like to start taking *all* my photos in Full Manual mode. Are there any general rules that I should...
2011/05/03
[ "https://photo.stackexchange.com/questions/11548", "https://photo.stackexchange.com", "https://photo.stackexchange.com/users/4990/" ]
Taking all photos in full manual mode seems a bit extreme to me. To get proper exposure in manual mode just use the small light meter in the viewfinder or on the back screen and adjust the settings until the little arrow is in the middle - or - half press the shutter button on Auto, P, Av or Tv mode (this will show yo...
Exposure ======== There are several technical factors that will affect your images directly which you have control over. Depending on each situation that you want to shoot, you may want to have the others adjusted automatically by your camera, or adjust all of them manually yourself. Shooting moving subjects generally...
11,548
I have purchased my first DSLR (a Canon 500D) and have been playing around quite a lot within the aperture priority mode, with auto shutter speed and ISO. Anyways as I would like to become a better photographer I would like to start taking *all* my photos in Full Manual mode. Are there any general rules that I should...
2011/05/03
[ "https://photo.stackexchange.com/questions/11548", "https://photo.stackexchange.com", "https://photo.stackexchange.com/users/4990/" ]
Shooting manual mode doesn't make you a better photographer, understanding what all the settings effectively do will. Your camera has three basic settings: * **Aperture**: Use this to control depth of field (DoF). This is usually the most important setting to most photographers, as it influences both subject matter an...
I'll provide some answers for some specific situations where I find manual mode useful, with or without auto-ISO: * **Astrophotography.** For moon, I use f/8 (the sharpest aperture of the lens @ 250mm), ISO 100, 1/200 s. This provides exposure equivalent to the Looney f/11 rule, but with a sharper aperture. For milky ...
11,548
I have purchased my first DSLR (a Canon 500D) and have been playing around quite a lot within the aperture priority mode, with auto shutter speed and ISO. Anyways as I would like to become a better photographer I would like to start taking *all* my photos in Full Manual mode. Are there any general rules that I should...
2011/05/03
[ "https://photo.stackexchange.com/questions/11548", "https://photo.stackexchange.com", "https://photo.stackexchange.com/users/4990/" ]
In general you want to use as low an ISO setting as you can to avoid noise. If the lowest ISO means shooting at a low shutter speed, say 1/15th then you may bump up the ISO a bit so that you can shoot at a faster shutter speed. If the light isn't changing, setting everything manually means that you get consistent exp...
I'll provide some answers for some specific situations where I find manual mode useful, with or without auto-ISO: * **Astrophotography.** For moon, I use f/8 (the sharpest aperture of the lens @ 250mm), ISO 100, 1/200 s. This provides exposure equivalent to the Looney f/11 rule, but with a sharper aperture. For milky ...
11,548
I have purchased my first DSLR (a Canon 500D) and have been playing around quite a lot within the aperture priority mode, with auto shutter speed and ISO. Anyways as I would like to become a better photographer I would like to start taking *all* my photos in Full Manual mode. Are there any general rules that I should...
2011/05/03
[ "https://photo.stackexchange.com/questions/11548", "https://photo.stackexchange.com", "https://photo.stackexchange.com/users/4990/" ]
First, stay away from the "icons" on your 500D. These are the automated settings, and offer no freedom to choose your aperture and shutter speed. Once you do that, here are four simple rules I follow: Rule #1: stay above 1/60. ------------------------- If you are using a tripod, you can go below this speed, but when...
I'll provide some answers for some specific situations where I find manual mode useful, with or without auto-ISO: * **Astrophotography.** For moon, I use f/8 (the sharpest aperture of the lens @ 250mm), ISO 100, 1/200 s. This provides exposure equivalent to the Looney f/11 rule, but with a sharper aperture. For milky ...
11,548
I have purchased my first DSLR (a Canon 500D) and have been playing around quite a lot within the aperture priority mode, with auto shutter speed and ISO. Anyways as I would like to become a better photographer I would like to start taking *all* my photos in Full Manual mode. Are there any general rules that I should...
2011/05/03
[ "https://photo.stackexchange.com/questions/11548", "https://photo.stackexchange.com", "https://photo.stackexchange.com/users/4990/" ]
In general you want to use as low an ISO setting as you can to avoid noise. If the lowest ISO means shooting at a low shutter speed, say 1/15th then you may bump up the ISO a bit so that you can shoot at a faster shutter speed. If the light isn't changing, setting everything manually means that you get consistent exp...
Exposure ======== There are several technical factors that will affect your images directly which you have control over. Depending on each situation that you want to shoot, you may want to have the others adjusted automatically by your camera, or adjust all of them manually yourself. Shooting moving subjects generally...
11,548
I have purchased my first DSLR (a Canon 500D) and have been playing around quite a lot within the aperture priority mode, with auto shutter speed and ISO. Anyways as I would like to become a better photographer I would like to start taking *all* my photos in Full Manual mode. Are there any general rules that I should...
2011/05/03
[ "https://photo.stackexchange.com/questions/11548", "https://photo.stackexchange.com", "https://photo.stackexchange.com/users/4990/" ]
Shooting manual mode doesn't make you a better photographer, understanding what all the settings effectively do will. Your camera has three basic settings: * **Aperture**: Use this to control depth of field (DoF). This is usually the most important setting to most photographers, as it influences both subject matter an...
Exposure ======== There are several technical factors that will affect your images directly which you have control over. Depending on each situation that you want to shoot, you may want to have the others adjusted automatically by your camera, or adjust all of them manually yourself. Shooting moving subjects generally...
11,548
I have purchased my first DSLR (a Canon 500D) and have been playing around quite a lot within the aperture priority mode, with auto shutter speed and ISO. Anyways as I would like to become a better photographer I would like to start taking *all* my photos in Full Manual mode. Are there any general rules that I should...
2011/05/03
[ "https://photo.stackexchange.com/questions/11548", "https://photo.stackexchange.com", "https://photo.stackexchange.com/users/4990/" ]
First, stay away from the "icons" on your 500D. These are the automated settings, and offer no freedom to choose your aperture and shutter speed. Once you do that, here are four simple rules I follow: Rule #1: stay above 1/60. ------------------------- If you are using a tripod, you can go below this speed, but when...
In general you want to use as low an ISO setting as you can to avoid noise. If the lowest ISO means shooting at a low shutter speed, say 1/15th then you may bump up the ISO a bit so that you can shoot at a faster shutter speed. If the light isn't changing, setting everything manually means that you get consistent exp...
11,548
I have purchased my first DSLR (a Canon 500D) and have been playing around quite a lot within the aperture priority mode, with auto shutter speed and ISO. Anyways as I would like to become a better photographer I would like to start taking *all* my photos in Full Manual mode. Are there any general rules that I should...
2011/05/03
[ "https://photo.stackexchange.com/questions/11548", "https://photo.stackexchange.com", "https://photo.stackexchange.com/users/4990/" ]
Shooting manual mode doesn't make you a better photographer, understanding what all the settings effectively do will. Your camera has three basic settings: * **Aperture**: Use this to control depth of field (DoF). This is usually the most important setting to most photographers, as it influences both subject matter an...
First, stay away from the "icons" on your 500D. These are the automated settings, and offer no freedom to choose your aperture and shutter speed. Once you do that, here are four simple rules I follow: Rule #1: stay above 1/60. ------------------------- If you are using a tripod, you can go below this speed, but when...
7,499,757
I'm starting to write new application and want to make it full ajax style :) I'm using Jquery to make ajax requests. Main JS file gets some variable from pressed link and according to that link goes to some php files grabs some data comes back and puts everything in pre prepared html tags. This is the way I see this ...
2011/09/21
[ "https://Stackoverflow.com/questions/7499757", "https://Stackoverflow.com", "https://Stackoverflow.com/users/678855/" ]
I've used [jQuery BBQ: Back Button & Query Library](http://benalman.com/projects/jquery-bbq-plugin/) in the past for just this purpose. Specifically, the [basic AJAX](http://benalman.com/code/projects/jquery-bbq/examples/fragment-basic) example looks to be what you're after. The rest of the [examples](http://benalman....
I think you should take a look at backbone.js <http://documentcloud.github.com/backbone/>. It has a router based application structure, where each route is actually a different /#'ed url. Like this when you have an item list, you could display it in route /#itemsList, and each item details page could be on /#items/id....
35,769,135
I'm creating a C# WPF MVVM application and currently busy with adding different languages. Right now I use a xaml file which contains a lot of rows like: ``` <system:String x:Key="btnNew">New</system:String> <system:String x:Key="btnEdit">Edit</system:String> ``` The program reads a specific folder, gets the differ...
2016/03/03
[ "https://Stackoverflow.com/questions/35769135", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5023972/" ]
Rather than define the strings in XAML use a resource (.resx) files. You have a default (ResourceFile.resx) file and then language specific ones (ResourceFile.nl.resx for Dutch, ResourceFile.en-US.resx for US English, etc). The system picks the correct resource file based on the current culture settings. The [MSDN has...
Thanks for your answer, i did make it work like you told me and the MSDN page:) So, right now i have one default "LanguageResource.resx" file added to my resources and did test it with a second "LanguageResource.nl.resx" file, and changed the language with CultureInfo("nl"). But, my customer wants a folder where he c...
1,392,457
How do I decode a whole feed (around 10k items) without memory limit of php? I found code which breaks the feed into parts: <http://pastebin.com/m43c3384f> How do I modify the code to work with the feed below: ``` GAF_update_projects_vertical_callback({"projects":{"count":2,"items":[{"id":502817,"name":"SEO","url":"h...
2009/09/08
[ "https://Stackoverflow.com/questions/1392457", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
First of all, escape your json string. Like this: ``` $json_string = "{\"projects\":{\"count\":2,\"items\":[{\"id\":502817,\"name\":\"SEO\",\"url\":\"http:\/\/www.getafreelancer.com\/affiliates\/ref.php?u=boon86&l=http%3A%2F%2Fwww.getafreelancer.com%2Fprojects%2FSEO%2FSEO.502817.html\",\"start_unixtime\":1252386582,\"...
If you're just running out of memory, try changing the `memory_limit` parameter in `php.ini` to something larger than the default (the default might be 8 MB, but I'm not certain). The [Increase PHP memory limit](http://drupal.org/node/207036) page on drupal.org has examples of other ways to increase the memory limit.
35,373,935
I want to let user add another input file immediately next down the button, so he can select and send "x" number of files [![image](https://i.stack.imgur.com/TI4eJ.png)](https://i.stack.imgur.com/TI4eJ.png) Ive been using these answers while searching with no luck ``` http://stackoverflow.com/a/19200323/5586647 htt...
2016/02/12
[ "https://Stackoverflow.com/questions/35373935", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5586647/" ]
I've found the error. I'm initializing the Provider with an empty object, and should be initialized with an empty array. So `clusterProvider = new H.clustering.Provider({});` should be `clusterProvider = new H.clustering.Provider([]);` Question is, should it be allowed to initialize the provider with the wrong s...
In my case, it was not allowing me to initialize cluster provider like without clusteringOptions, but when I provided clusteringOptions is worked : ``` clusterProvider = new H.clustering.Provider([], { clusteringOptions: { eps: 32, minWeight: 2 } }); ```
13,651,599
Using the twitter bootstrap framework for web application. I am using a modal in which I call another modal, having 1 modal on top of the other modal. Currently if you click the close 'x' button it closes both modal windows. I only want to close the top modal. The Modal class Definition starts on line 750 in bootstrap...
2012/11/30
[ "https://Stackoverflow.com/questions/13651599", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1214858/" ]
In your modal definition where you have `data-dismiss="modal"`, add `data-target="#theIdOfTheModal"` This will tell it to only close that specific modal I created a fiddle demonstrating this and it actually works with or without data-target: [Fiddle!](http://jsfiddle.net/Nv9dd/1/)
Add to modal hide method (top most line) ``` e & e.stopPropogation(); ``` This will stop from bubbling event to parents and rest of children. Also, pass event param in `hide()` (so that it becomes `hide(e)`) inside escape method.
13,651,599
Using the twitter bootstrap framework for web application. I am using a modal in which I call another modal, having 1 modal on top of the other modal. Currently if you click the close 'x' button it closes both modal windows. I only want to close the top modal. The Modal class Definition starts on line 750 in bootstrap...
2012/11/30
[ "https://Stackoverflow.com/questions/13651599", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1214858/" ]
In your modal definition where you have `data-dismiss="modal"`, add `data-target="#theIdOfTheModal"` This will tell it to only close that specific modal I created a fiddle demonstrating this and it actually works with or without data-target: [Fiddle!](http://jsfiddle.net/Nv9dd/1/)
1. In cancel and close button remove this: data-dismiss="modal"; 2. Then add a class, for example: "close\_modal"; 3. In javascript create a delegate function like below: Javascript: ``` $(document).on('click', 'button:button.close_modal', function ( event ) { event.preventDefault(); var $this = $(event.currentTa...
13,651,599
Using the twitter bootstrap framework for web application. I am using a modal in which I call another modal, having 1 modal on top of the other modal. Currently if you click the close 'x' button it closes both modal windows. I only want to close the top modal. The Modal class Definition starts on line 750 in bootstrap...
2012/11/30
[ "https://Stackoverflow.com/questions/13651599", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1214858/" ]
In your modal definition where you have `data-dismiss="modal"`, add `data-target="#theIdOfTheModal"` This will tell it to only close that specific modal I created a fiddle demonstrating this and it actually works with or without data-target: [Fiddle!](http://jsfiddle.net/Nv9dd/1/)
Alternative ``` $('#myModal .close').click(); ```
13,651,599
Using the twitter bootstrap framework for web application. I am using a modal in which I call another modal, having 1 modal on top of the other modal. Currently if you click the close 'x' button it closes both modal windows. I only want to close the top modal. The Modal class Definition starts on line 750 in bootstrap...
2012/11/30
[ "https://Stackoverflow.com/questions/13651599", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1214858/" ]
Add to modal hide method (top most line) ``` e & e.stopPropogation(); ``` This will stop from bubbling event to parents and rest of children. Also, pass event param in `hide()` (so that it becomes `hide(e)`) inside escape method.
Alternative ``` $('#myModal .close').click(); ```
13,651,599
Using the twitter bootstrap framework for web application. I am using a modal in which I call another modal, having 1 modal on top of the other modal. Currently if you click the close 'x' button it closes both modal windows. I only want to close the top modal. The Modal class Definition starts on line 750 in bootstrap...
2012/11/30
[ "https://Stackoverflow.com/questions/13651599", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1214858/" ]
1. In cancel and close button remove this: data-dismiss="modal"; 2. Then add a class, for example: "close\_modal"; 3. In javascript create a delegate function like below: Javascript: ``` $(document).on('click', 'button:button.close_modal', function ( event ) { event.preventDefault(); var $this = $(event.currentTa...
Alternative ``` $('#myModal .close').click(); ```
30,783,570
According to [mdn](https://developer.mozilla.org/en-US/docs/Web/CSS/display) `display: table-column` should > > behave like HTML elements. > > > But as far as I know, `<col>` elements have no display mode, they're actually just a rough edge of html which defines style in markup. So what in the world is `table-co...
2015/06/11
[ "https://Stackoverflow.com/questions/30783570", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5056/" ]
Whilst you're correct they simply define the styles for every `td` and `th` within that column, they themselves technically do have a `display` mode because it's the `display: table-column` that gives them this ability. If you set a `<col>` to be `display: none`, the corresponding table elements no longer have the sty...
It allows you to treat other HTML elements as `<col>` elements -------------------------------------------------------------- Because [`<col>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/col) elements belong to no content category and they aren't permitted to contain any content, they are essentially re...
39,685,803
My Rails 5 App only permits an admin or support user to create a user, when the user is created a password is generated and emailed to the user, on the first user login the app forces them to change the password. I have a password\_updated field in my schema that I want to be filled to true when the password is updat...
2016/09/25
[ "https://Stackoverflow.com/questions/39685803", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4825744/" ]
Another answer, since it is with another solution. Instead of using a SQLite3 database, I used our [TDynArray wrapper](http://synopse.info/files/html/Synopse%20mORMot%20Framework%20SAD%201.18.html#TITL_48), and its sorting and binary search methods. ``` type TEntry = record Key: RawUTF8; Value: RawUTF8; e...
Since this is One-time task. Fastest way is to load whole file into memory, scan memory line by line, parse key and compare it with search key(keys) and print(save) found positions. UPD: If you have sorted list in source file. And assume you have 411000keys to lookup. You can use this trick: Sort you search keys in sa...
39,685,803
My Rails 5 App only permits an admin or support user to create a user, when the user is created a password is generated and emailed to the user, on the first user login the app forces them to change the password. I have a password\_updated field in my schema that I want to be filled to true when the password is updat...
2016/09/25
[ "https://Stackoverflow.com/questions/39685803", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4825744/" ]
Use memory-mapped files. Just think your file is already read into the memory in its entirety and do that very binary search in memory that you wanted. Let Windows care about reading the portions of file when you do your in-memory search. * <https://en.wikipedia.org/wiki/Memory-mapped_file> * <https://msdn.microsoft.c...
Idea based on Aleksey Kharlanov answer. I accepted his answer. I only copy his idea here because he did not elaborate it (no pseudo-code or deeper analysis of the algorithm). I want to confirm it works before implementing it. We sort both files (once). We load Big file in memory (once). We read Small file lin...
39,685,803
My Rails 5 App only permits an admin or support user to create a user, when the user is created a password is generated and emailed to the user, on the first user login the app forces them to change the password. I have a password\_updated field in my schema that I want to be filled to true when the password is updat...
2016/09/25
[ "https://Stackoverflow.com/questions/39685803", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4825744/" ]
A method that needs the file to be sorted, but avoids data structures entirely: You only care about one line, so why even read the bulk of the file? Open the file and move the "get pointer" (apologies for talking C) halfway through the file. You'll have to figure out if you're at a number or a word, but a number shou...
If I were doing this as a one-time thing, I'd create a set with all the keys I need to look up. Then read the file line-by line, check to see if the key exists in the set, and output the value if so. Briefly, the algorithm is: ``` mySet = dictionary of keys to look up for each line in the file key = parse key fro...
39,685,803
My Rails 5 App only permits an admin or support user to create a user, when the user is created a password is generated and emailed to the user, on the first user login the app forces them to change the password. I have a password\_updated field in my schema that I want to be filled to true when the password is updat...
2016/09/25
[ "https://Stackoverflow.com/questions/39685803", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4825744/" ]
A method that needs the file to be sorted, but avoids data structures entirely: You only care about one line, so why even read the bulk of the file? Open the file and move the "get pointer" (apologies for talking C) halfway through the file. You'll have to figure out if you're at a number or a word, but a number shou...
Idea based on Aleksey Kharlanov answer. I accepted his answer. I only copy his idea here because he did not elaborate it (no pseudo-code or deeper analysis of the algorithm). I want to confirm it works before implementing it. We sort both files (once). We load Big file in memory (once). We read Small file lin...
39,685,803
My Rails 5 App only permits an admin or support user to create a user, when the user is created a password is generated and emailed to the user, on the first user login the app forces them to change the password. I have a password\_updated field in my schema that I want to be filled to true when the password is updat...
2016/09/25
[ "https://Stackoverflow.com/questions/39685803", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4825744/" ]
Since this is One-time task. Fastest way is to load whole file into memory, scan memory line by line, parse key and compare it with search key(keys) and print(save) found positions. UPD: If you have sorted list in source file. And assume you have 411000keys to lookup. You can use this trick: Sort you search keys in sa...
Use memory-mapped files. Just think your file is already read into the memory in its entirety and do that very binary search in memory that you wanted. Let Windows care about reading the portions of file when you do your in-memory search. * <https://en.wikipedia.org/wiki/Memory-mapped_file> * <https://msdn.microsoft.c...
39,685,803
My Rails 5 App only permits an admin or support user to create a user, when the user is created a password is generated and emailed to the user, on the first user login the app forces them to change the password. I have a password\_updated field in my schema that I want to be filled to true when the password is updat...
2016/09/25
[ "https://Stackoverflow.com/questions/39685803", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4825744/" ]
Use memory-mapped files. Just think your file is already read into the memory in its entirety and do that very binary search in memory that you wanted. Let Windows care about reading the portions of file when you do your in-memory search. * <https://en.wikipedia.org/wiki/Memory-mapped_file> * <https://msdn.microsoft.c...
A method that needs the file to be sorted, but avoids data structures entirely: You only care about one line, so why even read the bulk of the file? Open the file and move the "get pointer" (apologies for talking C) halfway through the file. You'll have to figure out if you're at a number or a word, but a number shou...
39,685,803
My Rails 5 App only permits an admin or support user to create a user, when the user is created a password is generated and emailed to the user, on the first user login the app forces them to change the password. I have a password\_updated field in my schema that I want to be filled to true when the password is updat...
2016/09/25
[ "https://Stackoverflow.com/questions/39685803", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4825744/" ]
Instead of re-inventing the wheel of binary search or B-Tree, try with an existing implementation. Feed the content into a SQLite3 in-memory DB (with the proper index, and with a transaction every 10,000 INSERT) and you are done. Ensure you target Win64, to have enough space in RAM. You may even use a file-based stora...
Since this is One-time task. Fastest way is to load whole file into memory, scan memory line by line, parse key and compare it with search key(keys) and print(save) found positions. UPD: If you have sorted list in source file. And assume you have 411000keys to lookup. You can use this trick: Sort you search keys in sa...
39,685,803
My Rails 5 App only permits an admin or support user to create a user, when the user is created a password is generated and emailed to the user, on the first user login the app forces them to change the password. I have a password\_updated field in my schema that I want to be filled to true when the password is updat...
2016/09/25
[ "https://Stackoverflow.com/questions/39685803", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4825744/" ]
Instead of re-inventing the wheel of binary search or B-Tree, try with an existing implementation. Feed the content into a SQLite3 in-memory DB (with the proper index, and with a transaction every 10,000 INSERT) and you are done. Ensure you target Win64, to have enough space in RAM. You may even use a file-based stora...
If I were doing this as a one-time thing, I'd create a set with all the keys I need to look up. Then read the file line-by line, check to see if the key exists in the set, and output the value if so. Briefly, the algorithm is: ``` mySet = dictionary of keys to look up for each line in the file key = parse key fro...
39,685,803
My Rails 5 App only permits an admin or support user to create a user, when the user is created a password is generated and emailed to the user, on the first user login the app forces them to change the password. I have a password\_updated field in my schema that I want to be filled to true when the password is updat...
2016/09/25
[ "https://Stackoverflow.com/questions/39685803", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4825744/" ]
Since this is One-time task. Fastest way is to load whole file into memory, scan memory line by line, parse key and compare it with search key(keys) and print(save) found positions. UPD: If you have sorted list in source file. And assume you have 411000keys to lookup. You can use this trick: Sort you search keys in sa...
A method that needs the file to be sorted, but avoids data structures entirely: You only care about one line, so why even read the bulk of the file? Open the file and move the "get pointer" (apologies for talking C) halfway through the file. You'll have to figure out if you're at a number or a word, but a number shou...
39,685,803
My Rails 5 App only permits an admin or support user to create a user, when the user is created a password is generated and emailed to the user, on the first user login the app forces them to change the password. I have a password\_updated field in my schema that I want to be filled to true when the password is updat...
2016/09/25
[ "https://Stackoverflow.com/questions/39685803", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4825744/" ]
Another answer, since it is with another solution. Instead of using a SQLite3 database, I used our [TDynArray wrapper](http://synopse.info/files/html/Synopse%20mORMot%20Framework%20SAD%201.18.html#TITL_48), and its sorting and binary search methods. ``` type TEntry = record Key: RawUTF8; Value: RawUTF8; e...
Idea based on Aleksey Kharlanov answer. I accepted his answer. I only copy his idea here because he did not elaborate it (no pseudo-code or deeper analysis of the algorithm). I want to confirm it works before implementing it. We sort both files (once). We load Big file in memory (once). We read Small file lin...
43,819,143
I've got a vertical nav-menu on which I have parent and non-parent items. I want parents to reveal their children pages when hovered on and I want this to push down the items above. HTML: ``` <nav class="main"> <ul> <li> <a href="">Lorem</a> <ul> <li><a href="">Ipsu...
2017/05/06
[ "https://Stackoverflow.com/questions/43819143", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7962954/" ]
Well there is no need of using `position:absolute` on `ul`, as you are using that thus it is creating another layer of `menu`. You have used `css hover selector`, which works or `performs` certain `styling` till your `mouse` is on targeted `element` as soon as it goes out-of range it hide `lorem li` elements `something...
CSS ```css nav.main ul ul { height: 0; box-sizing: border-box; list-style: none; padding: 0; opacity: 0; visibility: hidden; //padding: 10px; background-color: rgba(92, 91, 87, 0.9); -webkit-transition: opacity 600ms, height 600ms; transition: opacity 600ms, he...
43,819,143
I've got a vertical nav-menu on which I have parent and non-parent items. I want parents to reveal their children pages when hovered on and I want this to push down the items above. HTML: ``` <nav class="main"> <ul> <li> <a href="">Lorem</a> <ul> <li><a href="">Ipsu...
2017/05/06
[ "https://Stackoverflow.com/questions/43819143", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7962954/" ]
Well there is no need of using `position:absolute` on `ul`, as you are using that thus it is creating another layer of `menu`. You have used `css hover selector`, which works or `performs` certain `styling` till your `mouse` is on targeted `element` as soon as it goes out-of range it hide `lorem li` elements `something...
**1 )** use of `display` instead of `visibility` **2)** use of `position: relative` instead of `position: absolute;` **Full Code :** ```css nav.main ul ul { position: relative; list-style: none; opacity: 0; display: none; padding: 10px; background-color: rgba(92, 91, 87, 0.9); -we...
16,022,385
I have an HTML page built in jquery Mobile, that pulls Data from a database using AJAX, JSON and php. It then loops through the Database/Table, and populates the table. All is working and going well there. However, I cannot seem to figure out how to change the Table DATA Cell Background color, once the Table Data Cell ...
2013/04/15
[ "https://Stackoverflow.com/questions/16022385", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2283723/" ]
Try this: ``` $("#output td:contains(RUNNING)").attr("style","background-color:green"); $("#output td:contains(CANCELLED)").attr("style","background-color:red"); ``` **jsFiddle**: <http://jsfiddle.net/hescano/LfnQs/>
You can apply `class` attribute based on your value ("RUNNING" or "CANCELLED") on the fly. Since you are using `<table>` element and jQuery, it may look something like this: ``` $row = $('<tr />'); $row.append($('<td />', { text: item[1], class: item[0] })); $('#sampleTable').append($row); ``` [**FIDDLE ...
11,673,635
``` $("#btnAdd").click(function () { $.ajax({ type: "POST", url: "View.aspx/AddResponsibility", data: '{"ClientCode":"' + $("#hfClientCode").val() + '","ResponsibilityCode":"' + $("#txtResponsibility").val() + '"}', async: true, contentType: "application/json; charset=utf-8", d...
2012/07/26
[ "https://Stackoverflow.com/questions/11673635", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1207033/" ]
You need to use [.on()](http://api.jquery.com/on/) function like this: ``` $("#tblRespon").on("click",".delete",function(){ ```
If I am correct, you need to reasign the *remove* handler to the added elements: ``` success: function (msg) { $('#tblRespon > tbody:last').append("<tr><td>" + $("#txtResponsibility").val() + "</td><td>" + $("#txtFullName").val() + "</td><td><a class='delete' id='btnDelete' name='btnDelete' value='" + $("#txtR...
11,673,635
``` $("#btnAdd").click(function () { $.ajax({ type: "POST", url: "View.aspx/AddResponsibility", data: '{"ClientCode":"' + $("#hfClientCode").val() + '","ResponsibilityCode":"' + $("#txtResponsibility").val() + '"}', async: true, contentType: "application/json; charset=utf-8", d...
2012/07/26
[ "https://Stackoverflow.com/questions/11673635", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1207033/" ]
It is because that anchor tag you are injecting to the DOM later. That means wherever you binded your click functionality, it wont have any effect on the newly injected elements. The solution is to use [jQuery on](http://api.jquery.com/on/). `on` will work for current and futere elements. Change this ``` $(".delete...
If I am correct, you need to reasign the *remove* handler to the added elements: ``` success: function (msg) { $('#tblRespon > tbody:last').append("<tr><td>" + $("#txtResponsibility").val() + "</td><td>" + $("#txtFullName").val() + "</td><td><a class='delete' id='btnDelete' name='btnDelete' value='" + $("#txtR...
56,733,975
I'm trying to install and use [express-validator](https://express-validator.github.io/docs/) package. I've installed the package version (6.0.0) and then in my server.js file the code is: ``` const bodyParser = require('body-parser') const expressValidator = require('express-validator') const express = require('expres...
2019/06/24
[ "https://Stackoverflow.com/questions/56733975", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3972499/" ]
Express Validator has been updated therefore, you can't use it this way [This is a new way](https://express-validator.github.io/docs/) to use the express validator Weather stick with the previous version or use the current syntex of it. ``` npm uninstall express-validator npm install express-validator@5.3.0 ```
``` //just pass the checking as middleware not in the callback //see here I've just passed an array for checking as middleware // as the middleware is an array therefore you can add multiple checks in the array router.post("/", [check('email', "your custom error message").isEmail()], (req, res) => { const errors = v...
56,733,975
I'm trying to install and use [express-validator](https://express-validator.github.io/docs/) package. I've installed the package version (6.0.0) and then in my server.js file the code is: ``` const bodyParser = require('body-parser') const expressValidator = require('express-validator') const express = require('expres...
2019/06/24
[ "https://Stackoverflow.com/questions/56733975", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3972499/" ]
Express Validator has been updated therefore, you can't use it this way [This is a new way](https://express-validator.github.io/docs/) to use the express validator Weather stick with the previous version or use the current syntex of it. ``` npm uninstall express-validator npm install express-validator@5.3.0 ```
``` just update the express validator , will do the tri ``` `npm install express-validator@5.3.1 --save-exact`
56,733,975
I'm trying to install and use [express-validator](https://express-validator.github.io/docs/) package. I've installed the package version (6.0.0) and then in my server.js file the code is: ``` const bodyParser = require('body-parser') const expressValidator = require('express-validator') const express = require('expres...
2019/06/24
[ "https://Stackoverflow.com/questions/56733975", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3972499/" ]
``` const { check, validationResult } = require('express-validator'); router.post('/finished', function (req, res) { let email = req.body.email check('email', 'Email required').isEmail() var errors = validationResult(req) if (errors) { req.session.errors = errors req.session.success = false res.redirect('/email...
This happened to me because I was following an outdated (2019) tutorial. It works if you install an older version (5.3.1 worked for me). I ran into this working along with the book "**Get Programming with Node.js**" by **Jonathan Wexler**.
56,733,975
I'm trying to install and use [express-validator](https://express-validator.github.io/docs/) package. I've installed the package version (6.0.0) and then in my server.js file the code is: ``` const bodyParser = require('body-parser') const expressValidator = require('express-validator') const express = require('expres...
2019/06/24
[ "https://Stackoverflow.com/questions/56733975", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3972499/" ]
Go to package.json change "express-validator": "^6.6.0" to "express-validator": "^5.3.0", manually then run npm i
This happened to me because I was following an outdated (2019) tutorial. It works if you install an older version (5.3.1 worked for me). I ran into this working along with the book "**Get Programming with Node.js**" by **Jonathan Wexler**.
56,733,975
I'm trying to install and use [express-validator](https://express-validator.github.io/docs/) package. I've installed the package version (6.0.0) and then in my server.js file the code is: ``` const bodyParser = require('body-parser') const expressValidator = require('express-validator') const express = require('expres...
2019/06/24
[ "https://Stackoverflow.com/questions/56733975", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3972499/" ]
Express Validator has been updated therefore, you can't use it this way [This is a new way](https://express-validator.github.io/docs/) to use the express validator Weather stick with the previous version or use the current syntex of it. ``` npm uninstall express-validator npm install express-validator@5.3.0 ```
Go to package.json change "express-validator": "^6.6.0" to "express-validator": "^5.3.0", manually then run npm i
56,733,975
I'm trying to install and use [express-validator](https://express-validator.github.io/docs/) package. I've installed the package version (6.0.0) and then in my server.js file the code is: ``` const bodyParser = require('body-parser') const expressValidator = require('express-validator') const express = require('expres...
2019/06/24
[ "https://Stackoverflow.com/questions/56733975", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3972499/" ]
Go to package.json change "express-validator": "^6.6.0" to "express-validator": "^5.3.0", manually then run npm i
``` just update the express validator , will do the tri ``` `npm install express-validator@5.3.1 --save-exact`
56,733,975
I'm trying to install and use [express-validator](https://express-validator.github.io/docs/) package. I've installed the package version (6.0.0) and then in my server.js file the code is: ``` const bodyParser = require('body-parser') const expressValidator = require('express-validator') const express = require('expres...
2019/06/24
[ "https://Stackoverflow.com/questions/56733975", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3972499/" ]
``` const { check, validationResult } = require('express-validator'); router.post('/finished', function (req, res) { let email = req.body.email check('email', 'Email required').isEmail() var errors = validationResult(req) if (errors) { req.session.errors = errors req.session.success = false res.redirect('/email...
``` app.use(expressValidator()); ``` Replace this line with ``` app.use(expressValidator); ```
56,733,975
I'm trying to install and use [express-validator](https://express-validator.github.io/docs/) package. I've installed the package version (6.0.0) and then in my server.js file the code is: ``` const bodyParser = require('body-parser') const expressValidator = require('express-validator') const express = require('expres...
2019/06/24
[ "https://Stackoverflow.com/questions/56733975", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3972499/" ]
Go to package.json change "express-validator": "^6.6.0" to "express-validator": "^5.3.0", manually then run npm i
``` app.use(expressValidator()); ``` Replace this line with ``` app.use(expressValidator); ```
56,733,975
I'm trying to install and use [express-validator](https://express-validator.github.io/docs/) package. I've installed the package version (6.0.0) and then in my server.js file the code is: ``` const bodyParser = require('body-parser') const expressValidator = require('express-validator') const express = require('expres...
2019/06/24
[ "https://Stackoverflow.com/questions/56733975", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3972499/" ]
Yeah! Even I had the same problem. You can change the version by writing the command in root folder. Command: ``` npm install express-validator@5.3.1 --save-exact ```
This happened to me because I was following an outdated (2019) tutorial. It works if you install an older version (5.3.1 worked for me). I ran into this working along with the book "**Get Programming with Node.js**" by **Jonathan Wexler**.
56,733,975
I'm trying to install and use [express-validator](https://express-validator.github.io/docs/) package. I've installed the package version (6.0.0) and then in my server.js file the code is: ``` const bodyParser = require('body-parser') const expressValidator = require('express-validator') const express = require('expres...
2019/06/24
[ "https://Stackoverflow.com/questions/56733975", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3972499/" ]
Yeah! Even I had the same problem. You can change the version by writing the command in root folder. Command: ``` npm install express-validator@5.3.1 --save-exact ```
``` const { check, validationResult } = require('express-validator'); router.post('/finished', function (req, res) { let email = req.body.email check('email', 'Email required').isEmail() var errors = validationResult(req) if (errors) { req.session.errors = errors req.session.success = false res.redirect('/email...
67,240,666
Say I have a list of 50 random numbers. I want to group the numbers in a way that each subset has a min-max gap less than a cutoff 0.05. Below is my code. ``` import random def cluster(data, cutoff): data.sort() res = [] old_x = -10. for x in data: if abs(x - old_x) > cutoff: res.a...
2021/04/24
[ "https://Stackoverflow.com/questions/67240666", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13860719/" ]
By default the parameters of the model are in FloatTensor datatype. ``` inputs = batch["image"].type(torch.cuda.FloatTensor).to(device) labels = batch["label"].type(torch.cuda.FloatTensor).to(device) ``` should rectify this error or you can modify your dataloader class itself.
i wont recommend your first edit instead change the type of model to LongTensor using `model = model.type(torch.cuda.LongTensor)`
13,464
Can the size of molecule oxygen reduce smaller? If yes, how is that possible? Is it related to proton and electron surrounding the nucleus?
2014/06/09
[ "https://chemistry.stackexchange.com/questions/13464", "https://chemistry.stackexchange.com", "https://chemistry.stackexchange.com/users/6795/" ]
Surprisingly enough, the answer is **yes**, though it would be extremely difficult in practice to reduce the size of a molecule as large as $\ce{O\_2}$ by the method I will describe here. First, I must be clear that "shrinking" as seen in many science-fiction stories is completely impossible. Size is not some arbitrar...
If you could eliminate the Pauli exclusion principle then the size of all atoms and molecules would collapse. Because electrons cannot have the same four quantum numbers in an atom, $n$, $l$, $m\_l$, and $m\_s$, the electrons in multi-electron atoms and molecules are forced to occupy the higher energy and larger radius...
13,464
Can the size of molecule oxygen reduce smaller? If yes, how is that possible? Is it related to proton and electron surrounding the nucleus?
2014/06/09
[ "https://chemistry.stackexchange.com/questions/13464", "https://chemistry.stackexchange.com", "https://chemistry.stackexchange.com/users/6795/" ]
Surprisingly enough, the answer is **yes**, though it would be extremely difficult in practice to reduce the size of a molecule as large as $\ce{O\_2}$ by the method I will describe here. First, I must be clear that "shrinking" as seen in many science-fiction stories is completely impossible. Size is not some arbitrar...
This is going to sound simplistic relative to the previous 2 answers, but what about putting a crystal of solid oxygen into an anvil at a temperature below its solidification point, and compressing it. Phase diagrams (e.g. [http://commons.wikimedia.org/wiki/File:Phase\_diagram\_of\_solid\_oxygen.svg](http://commons.wik...
37,889,673
The following code snippet will print every 4 character long combination (without repetition) of the elements of an array. ``` for (int i = 0; i < len; i++) for (int j = i + 1; j < len; j++) for (int k = j + 1; k < len; k++) for (int l = k + 1; l < len; l++) printf("%c%c%c%c\n"...
2016/06/17
[ "https://Stackoverflow.com/questions/37889673", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5858118/" ]
The recursive version of your function would work like this: ``` void recur (char* arr, int i, int len, char *x, int k, int n) { if (k==n) { // the last inner loop x[k]=0; printf ("%s\n", x); } else { for (int j=i+1; j<len; j++) { // recursive loop x[k]=arr[j]; ...
Without recursion, you can use this (len = length of the array) : ``` int i, j, w, x; for(i=0; i<pow(len,len); i++){ //n^n possibilities / combinaisons w = i; for(j=0; j<len; j++){ //Show the combinaison x = w%len; //We have juste to calculate the correct position with some modulos printf("%c",...
37,889,673
The following code snippet will print every 4 character long combination (without repetition) of the elements of an array. ``` for (int i = 0; i < len; i++) for (int j = i + 1; j < len; j++) for (int k = j + 1; k < len; k++) for (int l = k + 1; l < len; l++) printf("%c%c%c%c\n"...
2016/06/17
[ "https://Stackoverflow.com/questions/37889673", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5858118/" ]
Without recursion, you can use this (len = length of the array) : ``` int i, j, w, x; for(i=0; i<pow(len,len); i++){ //n^n possibilities / combinaisons w = i; for(j=0; j<len; j++){ //Show the combinaison x = w%len; //We have juste to calculate the correct position with some modulos printf("%c",...
Well, instead of N loops - you just need one. Within this main loop you have to have just two inner loops for incrementing array of indices and for printing values: ``` int increment(int* index, int N, int len) { for (int i = N - 1; i >= 0; --i) { ++index[i]; if (index[i] < len) ret...
37,889,673
The following code snippet will print every 4 character long combination (without repetition) of the elements of an array. ``` for (int i = 0; i < len; i++) for (int j = i + 1; j < len; j++) for (int k = j + 1; k < len; k++) for (int l = k + 1; l < len; l++) printf("%c%c%c%c\n"...
2016/06/17
[ "https://Stackoverflow.com/questions/37889673", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5858118/" ]
The recursive version of your function would work like this: ``` void recur (char* arr, int i, int len, char *x, int k, int n) { if (k==n) { // the last inner loop x[k]=0; printf ("%s\n", x); } else { for (int j=i+1; j<len; j++) { // recursive loop x[k]=arr[j]; ...
Well, instead of N loops - you just need one. Within this main loop you have to have just two inner loops for incrementing array of indices and for printing values: ``` int increment(int* index, int N, int len) { for (int i = N - 1; i >= 0; --i) { ++index[i]; if (index[i] < len) ret...
66,085,627
i want to add some additional fields in odoo signup form/view like address and also wants to know where it is saving signup data (table) so i can reference / track to it for user related activities. please guide the steps i have to done to achieve this. regards
2021/02/07
[ "https://Stackoverflow.com/questions/66085627", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3851683/" ]
You need to inherit [auth\_signup.fields](https://github.com/odoo/odoo/blob/14.0/addons/auth_signup/views/auth_signup_login_templates.xml#L12) template to add the field to the sign-up page. The following code add the `street` to the signup fields. ``` <odoo> <template id="signup_fields" inherit_id="auth_signup.fie...
please check following, file names with path, in models.py file inherit res.users and add 2 fields, in main.py file added 'contact\_no', 'address' and in template.xml file as per your code, added 2 fields but still i failed to have these on signup form. custom\_addons/tests/models/models.py: ``` class ResUsersExt(mod...
1,496,521
Consider: $$\lim\limits\_{n\to +\infty}\sqrt[n]{|\sin(n+1)|+|\sin(n)|}=1$$ I figured out that $$\lim\limits\_{n\to +\infty}\sqrt[n]{|\sin(n+1)|+|\sin(n)|}\leqslant\lim\_{n\to +\infty}\sqrt[n]{2}=1$$ What about the other side inequality?
2015/10/25
[ "https://math.stackexchange.com/questions/1496521", "https://math.stackexchange.com", "https://math.stackexchange.com/users/190802/" ]
We show that $|\sin(n+1)|+|\sin(n)|$ is never tiny, by finding a crude lower bound. Suppose that $|\sin(n)|\lt 0.3$. By the addition formula, we have $\sin(n+1)=\sin n \cos 1+\cos n\sin 1$. Thus $$|\sin(n+1)|\ge |\cos n\sin 1|-|\sin n\cos 1|.\tag{1}$$ We have $|\cos n|\gt \sqrt{1-(0.3)^2}\gt 0.8$ and since $\sin 1\gt ...
You have $2>|\sin(n+1)|+|\sin(n)|>0$ is continuous and periodic, so there is an $a$ witch satisfies $a>0$ and $2>|\sin(n+1)|+|\sin(n)|>a$, now you can take the n-th root of a, bacause $\lim\_{n\to +\infty}\sqrt[n]{a}=1$
1,496,521
Consider: $$\lim\limits\_{n\to +\infty}\sqrt[n]{|\sin(n+1)|+|\sin(n)|}=1$$ I figured out that $$\lim\limits\_{n\to +\infty}\sqrt[n]{|\sin(n+1)|+|\sin(n)|}\leqslant\lim\_{n\to +\infty}\sqrt[n]{2}=1$$ What about the other side inequality?
2015/10/25
[ "https://math.stackexchange.com/questions/1496521", "https://math.stackexchange.com", "https://math.stackexchange.com/users/190802/" ]
You have $2>|\sin(n+1)|+|\sin(n)|>0$ is continuous and periodic, so there is an $a$ witch satisfies $a>0$ and $2>|\sin(n+1)|+|\sin(n)|>a$, now you can take the n-th root of a, bacause $\lim\_{n\to +\infty}\sqrt[n]{a}=1$
It is enough to study $f(x)=\left|\sin(x)\right|+\left|\sin(x+1)\right|$ over $[0,\pi]$ to be able to state that: $$\forall x\in\mathbb{R},\qquad \left|\sin(x)\right|+\left|\sin(x+1)\right|\geq \sin(1). $$ Equality is attained at $x\in\pi\mathbb{Z}$ and at $x\in -1+\pi\mathbb{Z}$. We may also improve the upper bound ...
1,496,521
Consider: $$\lim\limits\_{n\to +\infty}\sqrt[n]{|\sin(n+1)|+|\sin(n)|}=1$$ I figured out that $$\lim\limits\_{n\to +\infty}\sqrt[n]{|\sin(n+1)|+|\sin(n)|}\leqslant\lim\_{n\to +\infty}\sqrt[n]{2}=1$$ What about the other side inequality?
2015/10/25
[ "https://math.stackexchange.com/questions/1496521", "https://math.stackexchange.com", "https://math.stackexchange.com/users/190802/" ]
You have $2>|\sin(n+1)|+|\sin(n)|>0$ is continuous and periodic, so there is an $a$ witch satisfies $a>0$ and $2>|\sin(n+1)|+|\sin(n)|>a$, now you can take the n-th root of a, bacause $\lim\_{n\to +\infty}\sqrt[n]{a}=1$
It is known that the zeroes of $\sin$ are at the point $n\pi$ for integer $n$. In particular, $\sin x$ and $\sin(x+1)$ cannot both be zero, that is, $|\sin x| + |\sin (x+1)| > 0$. The function $f(x) = |\sin x| + |\sin (x+1)|$ is positive and periodic with period $2\pi$, so due to compactness it attains its minimum some...
1,496,521
Consider: $$\lim\limits\_{n\to +\infty}\sqrt[n]{|\sin(n+1)|+|\sin(n)|}=1$$ I figured out that $$\lim\limits\_{n\to +\infty}\sqrt[n]{|\sin(n+1)|+|\sin(n)|}\leqslant\lim\_{n\to +\infty}\sqrt[n]{2}=1$$ What about the other side inequality?
2015/10/25
[ "https://math.stackexchange.com/questions/1496521", "https://math.stackexchange.com", "https://math.stackexchange.com/users/190802/" ]
We show that $|\sin(n+1)|+|\sin(n)|$ is never tiny, by finding a crude lower bound. Suppose that $|\sin(n)|\lt 0.3$. By the addition formula, we have $\sin(n+1)=\sin n \cos 1+\cos n\sin 1$. Thus $$|\sin(n+1)|\ge |\cos n\sin 1|-|\sin n\cos 1|.\tag{1}$$ We have $|\cos n|\gt \sqrt{1-(0.3)^2}\gt 0.8$ and since $\sin 1\gt ...
It is enough to study $f(x)=\left|\sin(x)\right|+\left|\sin(x+1)\right|$ over $[0,\pi]$ to be able to state that: $$\forall x\in\mathbb{R},\qquad \left|\sin(x)\right|+\left|\sin(x+1)\right|\geq \sin(1). $$ Equality is attained at $x\in\pi\mathbb{Z}$ and at $x\in -1+\pi\mathbb{Z}$. We may also improve the upper bound ...
1,496,521
Consider: $$\lim\limits\_{n\to +\infty}\sqrt[n]{|\sin(n+1)|+|\sin(n)|}=1$$ I figured out that $$\lim\limits\_{n\to +\infty}\sqrt[n]{|\sin(n+1)|+|\sin(n)|}\leqslant\lim\_{n\to +\infty}\sqrt[n]{2}=1$$ What about the other side inequality?
2015/10/25
[ "https://math.stackexchange.com/questions/1496521", "https://math.stackexchange.com", "https://math.stackexchange.com/users/190802/" ]
We show that $|\sin(n+1)|+|\sin(n)|$ is never tiny, by finding a crude lower bound. Suppose that $|\sin(n)|\lt 0.3$. By the addition formula, we have $\sin(n+1)=\sin n \cos 1+\cos n\sin 1$. Thus $$|\sin(n+1)|\ge |\cos n\sin 1|-|\sin n\cos 1|.\tag{1}$$ We have $|\cos n|\gt \sqrt{1-(0.3)^2}\gt 0.8$ and since $\sin 1\gt ...
It is known that the zeroes of $\sin$ are at the point $n\pi$ for integer $n$. In particular, $\sin x$ and $\sin(x+1)$ cannot both be zero, that is, $|\sin x| + |\sin (x+1)| > 0$. The function $f(x) = |\sin x| + |\sin (x+1)|$ is positive and periodic with period $2\pi$, so due to compactness it attains its minimum some...
1,496,521
Consider: $$\lim\limits\_{n\to +\infty}\sqrt[n]{|\sin(n+1)|+|\sin(n)|}=1$$ I figured out that $$\lim\limits\_{n\to +\infty}\sqrt[n]{|\sin(n+1)|+|\sin(n)|}\leqslant\lim\_{n\to +\infty}\sqrt[n]{2}=1$$ What about the other side inequality?
2015/10/25
[ "https://math.stackexchange.com/questions/1496521", "https://math.stackexchange.com", "https://math.stackexchange.com/users/190802/" ]
It is enough to study $f(x)=\left|\sin(x)\right|+\left|\sin(x+1)\right|$ over $[0,\pi]$ to be able to state that: $$\forall x\in\mathbb{R},\qquad \left|\sin(x)\right|+\left|\sin(x+1)\right|\geq \sin(1). $$ Equality is attained at $x\in\pi\mathbb{Z}$ and at $x\in -1+\pi\mathbb{Z}$. We may also improve the upper bound ...
It is known that the zeroes of $\sin$ are at the point $n\pi$ for integer $n$. In particular, $\sin x$ and $\sin(x+1)$ cannot both be zero, that is, $|\sin x| + |\sin (x+1)| > 0$. The function $f(x) = |\sin x| + |\sin (x+1)|$ is positive and periodic with period $2\pi$, so due to compactness it attains its minimum some...
55,695,696
I'm aware this is kind of vague but I've been trying to implement the rules for Conway's Game of Life in JS but the result I get back is a mess (isn't a correct Conway's Game of Life frame). Can anyone tell me what's wrong with my implementation of the rules? ``` // Update state of selected cell if ((neig...
2019/04/15
[ "https://Stackoverflow.com/questions/55695696", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9963945/" ]
You are updating the same grid that you read. You might want to start out by having two grids, the current state and the new state. Iterate over the cells in the current state to calculate the new state, then use the new state for the next iteration and so on. There's lots of optimizations you can do, but this will gi...
You're calculating the amount of neighbors with the same data that you are mutating. The effect of this is that a cell can change state between dead/alive and then that cell's new data can be used in the "neighbors" calculation of another cell.
55,695,696
I'm aware this is kind of vague but I've been trying to implement the rules for Conway's Game of Life in JS but the result I get back is a mess (isn't a correct Conway's Game of Life frame). Can anyone tell me what's wrong with my implementation of the rules? ``` // Update state of selected cell if ((neig...
2019/04/15
[ "https://Stackoverflow.com/questions/55695696", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9963945/" ]
You are updating the same grid that you read. You might want to start out by having two grids, the current state and the new state. Iterate over the cells in the current state to calculate the new state, then use the new state for the next iteration and so on. There's lots of optimizations you can do, but this will gi...
You need two copies of the grid to do it properly. When you're calculating the new generation of a cell, you have to use the value of all the neighboring cells from the previous generation. But you're overwriting each cell during the loop, so some of the neighbors will have their new values instead of the old values. ...
23,496
I remember that every tribe has his own symbol, e.g. Benjamin's symbol is a wolf. What are the symbols of the 12 tribes? (I am especially interested in knowing what the symbol is for Levi.)
2013/01/10
[ "https://judaism.stackexchange.com/questions/23496", "https://judaism.stackexchange.com", "https://judaism.stackexchange.com/users/2268/" ]
Fascinating! I've always wondered about this myself. [***BaMidbar Rabbah* 2:7**](http://hebrewbooks.org/pdfpager.aspx?req=14384&pgnum=7) has a list of each tribe and its flag, with the colour, stone, and symbol associated with it, which I believe is probably the original source (or one of the earliest that we'll find)...
[Revach.net](http://revach.net/lists/article.php?id=42) has a nice table of the tribes populations, flags, symbols, and camp locations. Levi's symbol was the Urim V'tumim (High Preist's [breastplate](http://en.wikipedia.org/wiki/Hoshen)). This is based on the Meam Loez (Bamidbar 2:2).
23,496
I remember that every tribe has his own symbol, e.g. Benjamin's symbol is a wolf. What are the symbols of the 12 tribes? (I am especially interested in knowing what the symbol is for Levi.)
2013/01/10
[ "https://judaism.stackexchange.com/questions/23496", "https://judaism.stackexchange.com", "https://judaism.stackexchange.com/users/2268/" ]
Update on the stones of the hoshen / 12 Tribes, and their identification. This information is from my father's book "The Natural Bible: Judaism and the Environment", which will be published (be"h) by Berman House this spring. * *Odem*: clearly a red stone. Scholars suggest either red jasper, or carnelian sard (a type...
[Revach.net](http://revach.net/lists/article.php?id=42) has a nice table of the tribes populations, flags, symbols, and camp locations. Levi's symbol was the Urim V'tumim (High Preist's [breastplate](http://en.wikipedia.org/wiki/Hoshen)). This is based on the Meam Loez (Bamidbar 2:2).
23,496
I remember that every tribe has his own symbol, e.g. Benjamin's symbol is a wolf. What are the symbols of the 12 tribes? (I am especially interested in knowing what the symbol is for Levi.)
2013/01/10
[ "https://judaism.stackexchange.com/questions/23496", "https://judaism.stackexchange.com", "https://judaism.stackexchange.com/users/2268/" ]
Fascinating! I've always wondered about this myself. [***BaMidbar Rabbah* 2:7**](http://hebrewbooks.org/pdfpager.aspx?req=14384&pgnum=7) has a list of each tribe and its flag, with the colour, stone, and symbol associated with it, which I believe is probably the original source (or one of the earliest that we'll find)...
The [Targum Yonasan on Chapter 2 of BaMidbar](http://hebrewbooks.org/pdfpager.aspx?req=14084&pgnum=17) mentions the flags for each "super-tribe", i.e. cluster of three tribes that camped together: * (2:3) Camp Judah's flag had stripes corresponding to the member tribes' stones [on the breastplate], namely red, green, ...
23,496
I remember that every tribe has his own symbol, e.g. Benjamin's symbol is a wolf. What are the symbols of the 12 tribes? (I am especially interested in knowing what the symbol is for Levi.)
2013/01/10
[ "https://judaism.stackexchange.com/questions/23496", "https://judaism.stackexchange.com", "https://judaism.stackexchange.com/users/2268/" ]
Update on the stones of the hoshen / 12 Tribes, and their identification. This information is from my father's book "The Natural Bible: Judaism and the Environment", which will be published (be"h) by Berman House this spring. * *Odem*: clearly a red stone. Scholars suggest either red jasper, or carnelian sard (a type...
The [Targum Yonasan on Chapter 2 of BaMidbar](http://hebrewbooks.org/pdfpager.aspx?req=14084&pgnum=17) mentions the flags for each "super-tribe", i.e. cluster of three tribes that camped together: * (2:3) Camp Judah's flag had stripes corresponding to the member tribes' stones [on the breastplate], namely red, green, ...
23,496
I remember that every tribe has his own symbol, e.g. Benjamin's symbol is a wolf. What are the symbols of the 12 tribes? (I am especially interested in knowing what the symbol is for Levi.)
2013/01/10
[ "https://judaism.stackexchange.com/questions/23496", "https://judaism.stackexchange.com", "https://judaism.stackexchange.com/users/2268/" ]
Fascinating! I've always wondered about this myself. [***BaMidbar Rabbah* 2:7**](http://hebrewbooks.org/pdfpager.aspx?req=14384&pgnum=7) has a list of each tribe and its flag, with the colour, stone, and symbol associated with it, which I believe is probably the original source (or one of the earliest that we'll find)...
Update on the stones of the hoshen / 12 Tribes, and their identification. This information is from my father's book "The Natural Bible: Judaism and the Environment", which will be published (be"h) by Berman House this spring. * *Odem*: clearly a red stone. Scholars suggest either red jasper, or carnelian sard (a type...
71,084,516
``` public class Libro { public string Titolo { get; set; } public string Autore { get; set; } public string Editore { get; set; } public int ISBN { get; set; } public int Pagine { get; set; } public decimal Prezzo { get; set; } public int Quantità { get; set;...
2022/02/11
[ "https://Stackoverflow.com/questions/71084516", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18163671/" ]
### Foreword **The question has been edited massively since this answer was posted**. I've advised that the edits should be reverted so this answer remains valid for the question as posted prior to the edit on Feb 14th (Revision 3), and a new question posted containing Rev 3's text ### Original advice for Revision 2 ...
There are many ways to parse information out of a string. I would sugest using regex. For example with the following regex you could parse three strings separated by a \*: ``` (?'Title'[^*]+)[*](?'Author'[^*]+)[*](?'ISBN'[^*]+) ``` The Advantage of using regex is, that you check if the string is valid while the str...
24,951
My [4yr old son](https://nationalbikechallenge.org/rider/39497) has a [16in Bikestar](http://amzn.com/B003YT1B8E) and at times he maxes out the gearing on it trying to keep up with his old man. How feasible is it to add either a 2 or 3 speed hub to such a bike? I'm concerned about how much space the hub is going to tak...
2014/10/01
[ "https://bicycles.stackexchange.com/questions/24951", "https://bicycles.stackexchange.com", "https://bicycles.stackexchange.com/users/6782/" ]
It's pretty easy if you have a spoke cutter and are willing to run a funny spoke pattern. I suggest buying (ideally second hand) a three speed hub and lacing it into the 16" rim yourself. With a wheel that small and a child on it there's not enough load to make strength an issue, so you can reasonably either lace a 20 ...
I don't think that its a good idea given that in a few months, you're going to want a 20 inch bicycle for the child. IGH's wouldn't work since the hub width is likely smaller than standard, and mounting a derailleur would be a problem as well. Also, if you were to find a compatible hub or whatever (given the 20 spoke c...
24,951
My [4yr old son](https://nationalbikechallenge.org/rider/39497) has a [16in Bikestar](http://amzn.com/B003YT1B8E) and at times he maxes out the gearing on it trying to keep up with his old man. How feasible is it to add either a 2 or 3 speed hub to such a bike? I'm concerned about how much space the hub is going to tak...
2014/10/01
[ "https://bicycles.stackexchange.com/questions/24951", "https://bicycles.stackexchange.com", "https://bicycles.stackexchange.com/users/6782/" ]
I don't think that its a good idea given that in a few months, you're going to want a 20 inch bicycle for the child. IGH's wouldn't work since the hub width is likely smaller than standard, and mounting a derailleur would be a problem as well. Also, if you were to find a compatible hub or whatever (given the 20 spoke c...
Old thread but why don’t you think the other way and do a “dingle” , put in a double chainring and shift on that rather than the sprocket.... too simple folks.
24,951
My [4yr old son](https://nationalbikechallenge.org/rider/39497) has a [16in Bikestar](http://amzn.com/B003YT1B8E) and at times he maxes out the gearing on it trying to keep up with his old man. How feasible is it to add either a 2 or 3 speed hub to such a bike? I'm concerned about how much space the hub is going to tak...
2014/10/01
[ "https://bicycles.stackexchange.com/questions/24951", "https://bicycles.stackexchange.com", "https://bicycles.stackexchange.com/users/6782/" ]
It's pretty easy if you have a spoke cutter and are willing to run a funny spoke pattern. I suggest buying (ideally second hand) a three speed hub and lacing it into the 16" rim yourself. With a wheel that small and a child on it there's not enough load to make strength an issue, so you can reasonably either lace a 20 ...
A [Brompton](https://en.wikipedia.org/wiki/Brompton_Bicycle) uses a 16" wheel size, which means you could get a used Brompton wheel with Sturmey Archer 3-speed hub and swap it out. The only problem is that such wheels are rather expensive even used.
24,951
My [4yr old son](https://nationalbikechallenge.org/rider/39497) has a [16in Bikestar](http://amzn.com/B003YT1B8E) and at times he maxes out the gearing on it trying to keep up with his old man. How feasible is it to add either a 2 or 3 speed hub to such a bike? I'm concerned about how much space the hub is going to tak...
2014/10/01
[ "https://bicycles.stackexchange.com/questions/24951", "https://bicycles.stackexchange.com", "https://bicycles.stackexchange.com/users/6782/" ]
It's pretty easy if you have a spoke cutter and are willing to run a funny spoke pattern. I suggest buying (ideally second hand) a three speed hub and lacing it into the 16" rim yourself. With a wheel that small and a child on it there's not enough load to make strength an issue, so you can reasonably either lace a 20 ...
You could buy a rear wheel from Woom with the Scram automatic 2 speed rear hub. It shifts gears when the hub reaches a certain speed. I am in the same boat as you trying to modify a 16" bike for my 4 year old
24,951
My [4yr old son](https://nationalbikechallenge.org/rider/39497) has a [16in Bikestar](http://amzn.com/B003YT1B8E) and at times he maxes out the gearing on it trying to keep up with his old man. How feasible is it to add either a 2 or 3 speed hub to such a bike? I'm concerned about how much space the hub is going to tak...
2014/10/01
[ "https://bicycles.stackexchange.com/questions/24951", "https://bicycles.stackexchange.com", "https://bicycles.stackexchange.com/users/6782/" ]
It's pretty easy if you have a spoke cutter and are willing to run a funny spoke pattern. I suggest buying (ideally second hand) a three speed hub and lacing it into the 16" rim yourself. With a wheel that small and a child on it there's not enough load to make strength an issue, so you can reasonably either lace a 20 ...
Old thread but why don’t you think the other way and do a “dingle” , put in a double chainring and shift on that rather than the sprocket.... too simple folks.
24,951
My [4yr old son](https://nationalbikechallenge.org/rider/39497) has a [16in Bikestar](http://amzn.com/B003YT1B8E) and at times he maxes out the gearing on it trying to keep up with his old man. How feasible is it to add either a 2 or 3 speed hub to such a bike? I'm concerned about how much space the hub is going to tak...
2014/10/01
[ "https://bicycles.stackexchange.com/questions/24951", "https://bicycles.stackexchange.com", "https://bicycles.stackexchange.com/users/6782/" ]
A [Brompton](https://en.wikipedia.org/wiki/Brompton_Bicycle) uses a 16" wheel size, which means you could get a used Brompton wheel with Sturmey Archer 3-speed hub and swap it out. The only problem is that such wheels are rather expensive even used.
Old thread but why don’t you think the other way and do a “dingle” , put in a double chainring and shift on that rather than the sprocket.... too simple folks.
24,951
My [4yr old son](https://nationalbikechallenge.org/rider/39497) has a [16in Bikestar](http://amzn.com/B003YT1B8E) and at times he maxes out the gearing on it trying to keep up with his old man. How feasible is it to add either a 2 or 3 speed hub to such a bike? I'm concerned about how much space the hub is going to tak...
2014/10/01
[ "https://bicycles.stackexchange.com/questions/24951", "https://bicycles.stackexchange.com", "https://bicycles.stackexchange.com/users/6782/" ]
You could buy a rear wheel from Woom with the Scram automatic 2 speed rear hub. It shifts gears when the hub reaches a certain speed. I am in the same boat as you trying to modify a 16" bike for my 4 year old
Old thread but why don’t you think the other way and do a “dingle” , put in a double chainring and shift on that rather than the sprocket.... too simple folks.
4,814,808
Ok first I must preface this question with a disclaimer, I'm really new to threading so this may be a 'newbie' question but I searched google and couldn't find an answer. As I understand it a critical section is code that can be accessed by two or more threads, the danger being one thread will overwrite a value before ...
2011/01/27
[ "https://Stackoverflow.com/questions/4814808", "https://Stackoverflow.com", "https://Stackoverflow.com/users/349877/" ]
Rather than using the **lock()** keywords I'd suggested seeing if you can use the [Interlocked](http://msdn.microsoft.com/en-us/library/system.threading.interlocked.aspx) class which is designed for small operations. It's got much less overhead than lock, in fact can be down to a single CPU instruction on some CPUs. ...
You want to look into the [`Lock`](http://msdn.microsoft.com/en-us/library/c5kehkcz%28v=vs.71%29.aspx) keyword. Also you might want to this tutorial to [Threading in C#](http://www.albahari.com/threading/part2.aspx).
4,814,808
Ok first I must preface this question with a disclaimer, I'm really new to threading so this may be a 'newbie' question but I searched google and couldn't find an answer. As I understand it a critical section is code that can be accessed by two or more threads, the danger being one thread will overwrite a value before ...
2011/01/27
[ "https://Stackoverflow.com/questions/4814808", "https://Stackoverflow.com", "https://Stackoverflow.com/users/349877/" ]
Rather than using the **lock()** keywords I'd suggested seeing if you can use the [Interlocked](http://msdn.microsoft.com/en-us/library/system.threading.interlocked.aspx) class which is designed for small operations. It's got much less overhead than lock, in fact can be down to a single CPU instruction on some CPUs. ...
As Filip said, lock is useful here. Not only should you lock on provider.SetNumber(currentNumber), you also need to lock on any conditional that the setter depends on. ``` lock(someObject) { if(provider.CanPassNumber(false, currentNumber)) { currentNumber++; provider.SetNumber(currentNumber); } } ``` a...
4,814,808
Ok first I must preface this question with a disclaimer, I'm really new to threading so this may be a 'newbie' question but I searched google and couldn't find an answer. As I understand it a critical section is code that can be accessed by two or more threads, the danger being one thread will overwrite a value before ...
2011/01/27
[ "https://Stackoverflow.com/questions/4814808", "https://Stackoverflow.com", "https://Stackoverflow.com/users/349877/" ]
Rather than using the **lock()** keywords I'd suggested seeing if you can use the [Interlocked](http://msdn.microsoft.com/en-us/library/system.threading.interlocked.aspx) class which is designed for small operations. It's got much less overhead than lock, in fact can be down to a single CPU instruction on some CPUs. ...
You can use the `lock` statement, to enter a critical section with mutual exclusion. The `lock` will use the object's reference to differentiate one critical section from another, you must have the same reference for all your `lock` if it accesses to the same elements. ``` // Define an object which can be locked in yo...
4,814,808
Ok first I must preface this question with a disclaimer, I'm really new to threading so this may be a 'newbie' question but I searched google and couldn't find an answer. As I understand it a critical section is code that can be accessed by two or more threads, the danger being one thread will overwrite a value before ...
2011/01/27
[ "https://Stackoverflow.com/questions/4814808", "https://Stackoverflow.com", "https://Stackoverflow.com/users/349877/" ]
Rather than using the **lock()** keywords I'd suggested seeing if you can use the [Interlocked](http://msdn.microsoft.com/en-us/library/system.threading.interlocked.aspx) class which is designed for small operations. It's got much less overhead than lock, in fact can be down to a single CPU instruction on some CPUs. ...
Well first of im not so good with threading but a critical section is a part of your code that can only be accessed my one thread at a time not the other way around.. To create a critical section is easy ``` Lock(this) { //Only one thread can run this at a time } ``` note: that **this** should be replaced with ...
4,814,808
Ok first I must preface this question with a disclaimer, I'm really new to threading so this may be a 'newbie' question but I searched google and couldn't find an answer. As I understand it a critical section is code that can be accessed by two or more threads, the danger being one thread will overwrite a value before ...
2011/01/27
[ "https://Stackoverflow.com/questions/4814808", "https://Stackoverflow.com", "https://Stackoverflow.com/users/349877/" ]
Rather than using the **lock()** keywords I'd suggested seeing if you can use the [Interlocked](http://msdn.microsoft.com/en-us/library/system.threading.interlocked.aspx) class which is designed for small operations. It's got much less overhead than lock, in fact can be down to a single CPU instruction on some CPUs. ...
In your SetNumber method you can simply use a lock statement: ``` public class MyProvider { object numberLock = new object(); ... public void SetNumber(int num) { lock(numberLock) { // Do Stuff } } } ``` Also, note that in your example `currentNumber` is a primi...
41,006,241
I want to implement a generic function in Java8, that verifies that a collection has no null members and returns a type with @NonNull annotation. input type: T extends Collection, where T+U are nullable. result type: @NonNull T, with @NonNull U For array this would look like this: ``` public static <T> @NonNull T...
2016/12/06
[ "https://Stackoverflow.com/questions/41006241", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2436083/" ]
Unfortunately there's no way in Java to alter a generic type parameter of a generic type, like the `U` in `T extends Collection<U>`. The equivalent of your array method would be a method that takes and returns Collection instances, like so: ``` public static <E> @NonNull Collection<@NonNull E> collectionHasNoNullMembe...
This is about as close as you can get: ``` public static <T extends Collection<@NonNull U>, U> @NonNull T collectionHasNoNullMember(@NonNull T col) { ```
20,943,459
I am trying to create a table named EMPLOYEE. When I use the following statements without "ON DELETE SET DEFAULT" it is working. Here is the Error I get with "ON DELETE SET DEFAULT": ``` ERROR 1005 (HY000): Can't create table 'COMPANY.EMPLOYEE' (errno: 150) ``` Here is the DDL ``` CREATE TABLE EMPLOYEE ( Fna...
2014/01/06
[ "https://Stackoverflow.com/questions/20943459", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2790046/" ]
You can't use `ON DELETE SET DEFAULT` or `ON UPDATE SET DEFAULT` with InnoDB > > **[InnoDB and FOREIGN KEY Constraints](http://dev.mysql.com/doc/refman/5.5/en/innodb-foreign-key-constraints.html)** > > While SET DEFAULT is allowed by the MySQL Server, **it is rejected as > invalid by InnoDB**. CREATE TABLE and A...
> > You delete your parent table, which triggers the set default in the > child. The DB tries to set the child records to their default 0. But > there's no 0 record in the parent table, triggering the foreign key > violation. > > > Check out the MySQL manual about [foreign key constrains](http://dev.mysql.com/d...
20,943,459
I am trying to create a table named EMPLOYEE. When I use the following statements without "ON DELETE SET DEFAULT" it is working. Here is the Error I get with "ON DELETE SET DEFAULT": ``` ERROR 1005 (HY000): Can't create table 'COMPANY.EMPLOYEE' (errno: 150) ``` Here is the DDL ``` CREATE TABLE EMPLOYEE ( Fna...
2014/01/06
[ "https://Stackoverflow.com/questions/20943459", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2790046/" ]
just use SET NULL rule and define trigger which will try to set to default value with exception handler if your default value has been deleted from master table
> > You delete your parent table, which triggers the set default in the > child. The DB tries to set the child records to their default 0. But > there's no 0 record in the parent table, triggering the foreign key > violation. > > > Check out the MySQL manual about [foreign key constrains](http://dev.mysql.com/d...
20,943,459
I am trying to create a table named EMPLOYEE. When I use the following statements without "ON DELETE SET DEFAULT" it is working. Here is the Error I get with "ON DELETE SET DEFAULT": ``` ERROR 1005 (HY000): Can't create table 'COMPANY.EMPLOYEE' (errno: 150) ``` Here is the DDL ``` CREATE TABLE EMPLOYEE ( Fna...
2014/01/06
[ "https://Stackoverflow.com/questions/20943459", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2790046/" ]
You can't use `ON DELETE SET DEFAULT` or `ON UPDATE SET DEFAULT` with InnoDB > > **[InnoDB and FOREIGN KEY Constraints](http://dev.mysql.com/doc/refman/5.5/en/innodb-foreign-key-constraints.html)** > > While SET DEFAULT is allowed by the MySQL Server, **it is rejected as > invalid by InnoDB**. CREATE TABLE and A...
just use SET NULL rule and define trigger which will try to set to default value with exception handler if your default value has been deleted from master table
8,024,030
It is weird. Here is the problem: I have some text within 'span' tag, whenever I put some special characters in the text, these characters will be shown in weird places! suppose I have this: ``` <span>Your birthday</span> <span>(must be in the format of MM/DD/YYYY)</span> ``` it will be rendered like this: ``` (Yo...
2011/11/05
[ "https://Stackoverflow.com/questions/8024030", "https://Stackoverflow.com", "https://Stackoverflow.com/users/376753/" ]
Use `<div>`, or add `display:block` to your span. "It" is happening, because `<span>` elements are inline elements. Inline elements allow other inline elements at the same line. All of the following lines will produce: ``` Foo Bar <div>Foo</div> <div>Bar</div> <span style="display:block;">Foo</span> <span style="d...
Works OK in JSFiddle: <http://jsfiddle.net/simply_simpy/fmE5j/> Can you replicate?
462,731
> > Осознав, что **взболтнул лишнего**, Буаробер, придвинув стул, уселся рядом с Тео, положив ладони на колени, разглаживая ветхий бархат своих потертых кюлотов. > > [С. Арденн. Черный граф](https://books.google.ee/books?id=0CvKDwAAQBAJ&pg=PT72&lpg=PT72&dq=%D0%B2%D0%B7%D0%B1%D0%BE%D0%BB%D1%82%D0%BD%D1%83%D0%BB%20%D...
2020/12/07
[ "https://rus.stackexchange.com/questions/462731", "https://rus.stackexchange.com", "https://rus.stackexchange.com/users/185295/" ]
Я думаю, что тут дело не в глаголе. Само по себе использование глагола взболтать (взболтнуть) в таком значении вызывает вопросы, новояз какой-то, но в принципе ничего принципиально отличного от общей схемы тут быть не должно. Общий же подход допускает двоякое управление. Сказать, выпить, съесть лишнее - сказать, выпить...
Вообще, есть примеры использования обоих вариантов, но на мой взгляд тут имеет место редкий лишительный падеж, возникающий у существительных при отрицающих глаголах: "сказать лишн**ее**" (винительный: кого? что?), но "не сказать лишн**его**" (лишительный: без кого? без чего?). То есть в современном русском это весь...
462,731
> > Осознав, что **взболтнул лишнего**, Буаробер, придвинув стул, уселся рядом с Тео, положив ладони на колени, разглаживая ветхий бархат своих потертых кюлотов. > > [С. Арденн. Черный граф](https://books.google.ee/books?id=0CvKDwAAQBAJ&pg=PT72&lpg=PT72&dq=%D0%B2%D0%B7%D0%B1%D0%BE%D0%BB%D1%82%D0%BD%D1%83%D0%BB%20%D...
2020/12/07
[ "https://rus.stackexchange.com/questions/462731", "https://rus.stackexchange.com", "https://rus.stackexchange.com/users/185295/" ]
Я думаю, что тут дело не в глаголе. Само по себе использование глагола взболтать (взболтнуть) в таком значении вызывает вопросы, новояз какой-то, но в принципе ничего принципиально отличного от общей схемы тут быть не должно. Общий же подход допускает двоякое управление. Сказать, выпить, съесть лишнее - сказать, выпить...
Текст данного ответа удален автором.
49,585,017
I want to implement the dropdown lists in bootstrap modal. I have already a demo code but I don't know how to implement it in the bootstrap modal. In The bootstrap modal form will be open with 2 dependent dropdowns and after submitting the values will be saved to database. Thanks a lot in advance. **index.php** ```...
2018/03/31
[ "https://Stackoverflow.com/questions/49585017", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2696856/" ]
**index.php** ``` <?php include("db/db.php"); $select_country = "SELECT country_id,country_name from country"; $result_country = mysqli_query($con,$select_country); ?> <!DOCTYPE html> <html> <head> <title>ADDRESS FORM</title> <script type="text/javascript" src="js/jquery.3.2.1.js"></script> <s...
Just add bootstrap modal instead of `panel` and a button for open that modal and add your form in a modal body. Your code of `index.php` looks like below: ``` <!DOCTYPE html> <html> <head> <title>PHP - dependent dropdown list</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-wid...
30,535,362
I've the below code which I find verbose: ``` #{bean.value eq 'S' || bean.value eq 'C'} ``` Can we simplify this using something like the SQL `IN` clause? Fictive example below: ``` #{bean.value in ('S','C')} ```
2015/05/29
[ "https://Stackoverflow.com/questions/30535362", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4214860/" ]
If you're using EL 3.0 (Java EE 7), then you can simply construct a `Collection` using `#{[x,y,z]}` syntax and perform a `contains()` on it. Provided that the desired bean property returns a `String` (and thus not `char` or `enum`), then this should do: ``` #{['S','C'].contains(bean.value)} ``` Or if you're only on ...
AFAIK You can't . But you can hold values to be checked against in a HashMap . And you can then check as ``` #{pageFlowScope.beanName.mapVar[bindings.Dept.attributeValue] == null} ``` You can check whether the value returned is null/empty or not. Sid
51,287,958
I am using JupyterHub with custom authenticator. It sets auth\_state with access token, which then can be copied into environment inside `pre_spawn_start` method like in the example: ``` class MyAuthenticator(Authenticator): @gen.coroutine def authenticate(self, handler, data=None): username = yield id...
2018/07/11
[ "https://Stackoverflow.com/questions/51287958", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4483840/" ]
you can force stop servers and ask for login when token gets expired, it can achieved by following steps, 1. Write refresh\_user method to get new token(attached sample code) 2. Set time for refresh\_user. * c.MyAuthenticator.auth\_refresh\_age = 30 #This could be the time of validity of token in seconds ```js impor...
Seems this c.Authenticator.refresh\_pre\_spawn = True, as suggestes by Eos Antigen solves the question: everytime you log in again the pre-spawn defined function executes again.
9,476,465
I'm trying to submit a Mac app for Approval in the App Store, but linking with Growl is causing a validation error. I'm trying to re-codesign from the command line, but I'm getting the following error: ``` Ashs-MacBook-Pro:500px Uploader ash$ codesign -f -v -s "3rd Party Mac Developer Application: 500px Inc." ./Growl....
2012/02/28
[ "https://Stackoverflow.com/questions/9476465", "https://Stackoverflow.com", "https://Stackoverflow.com/users/516359/" ]
Really strange, I've managed to resign the framework like this: ``` codesign -fs "3rd Party Mac Developer Application: Future Simple" Growl.framework/Versions/A/Growl Growl.framework/Versions/A/Growl: replacing existing signature ``` (BTW: I'm working with Xcode 4.3.1 and Growl 1.3.1)
It looks like the error might have been trying to sign a bundle that was already signed; I fixed the issue by downloading the Growl framework source and compiling it with my own signature instead. If I find a better answer that will work for frameworks for which you don't have the ability to compile, I'll post it her...
9,476,465
I'm trying to submit a Mac app for Approval in the App Store, but linking with Growl is causing a validation error. I'm trying to re-codesign from the command line, but I'm getting the following error: ``` Ashs-MacBook-Pro:500px Uploader ash$ codesign -f -v -s "3rd Party Mac Developer Application: 500px Inc." ./Growl....
2012/02/28
[ "https://Stackoverflow.com/questions/9476465", "https://Stackoverflow.com", "https://Stackoverflow.com/users/516359/" ]
I just spent the day working through the "bundle format unrecognized, invalid, or unsuitable" error when codesigning a framework. In my case I'm using XCode 4.6.1 and I was trying to code sign Qt frameworks. First note that the Apple documentation ([TN2206](http://developer.apple.com/library/mac/technotes/tn2206/_inde...
It looks like the error might have been trying to sign a bundle that was already signed; I fixed the issue by downloading the Growl framework source and compiling it with my own signature instead. If I find a better answer that will work for frameworks for which you don't have the ability to compile, I'll post it her...
9,476,465
I'm trying to submit a Mac app for Approval in the App Store, but linking with Growl is causing a validation error. I'm trying to re-codesign from the command line, but I'm getting the following error: ``` Ashs-MacBook-Pro:500px Uploader ash$ codesign -f -v -s "3rd Party Mac Developer Application: 500px Inc." ./Growl....
2012/02/28
[ "https://Stackoverflow.com/questions/9476465", "https://Stackoverflow.com", "https://Stackoverflow.com/users/516359/" ]
Would it be better if we shipped the sdk unsigned? It'd be a simple change, I'm hesitant to do so now since it's been like this for a little while.
It looks like the error might have been trying to sign a bundle that was already signed; I fixed the issue by downloading the Growl framework source and compiling it with my own signature instead. If I find a better answer that will work for frameworks for which you don't have the ability to compile, I'll post it her...
9,476,465
I'm trying to submit a Mac app for Approval in the App Store, but linking with Growl is causing a validation error. I'm trying to re-codesign from the command line, but I'm getting the following error: ``` Ashs-MacBook-Pro:500px Uploader ash$ codesign -f -v -s "3rd Party Mac Developer Application: 500px Inc." ./Growl....
2012/02/28
[ "https://Stackoverflow.com/questions/9476465", "https://Stackoverflow.com", "https://Stackoverflow.com/users/516359/" ]
Really strange, I've managed to resign the framework like this: ``` codesign -fs "3rd Party Mac Developer Application: Future Simple" Growl.framework/Versions/A/Growl Growl.framework/Versions/A/Growl: replacing existing signature ``` (BTW: I'm working with Xcode 4.3.1 and Growl 1.3.1)
I just spent the day working through the "bundle format unrecognized, invalid, or unsuitable" error when codesigning a framework. In my case I'm using XCode 4.6.1 and I was trying to code sign Qt frameworks. First note that the Apple documentation ([TN2206](http://developer.apple.com/library/mac/technotes/tn2206/_inde...
9,476,465
I'm trying to submit a Mac app for Approval in the App Store, but linking with Growl is causing a validation error. I'm trying to re-codesign from the command line, but I'm getting the following error: ``` Ashs-MacBook-Pro:500px Uploader ash$ codesign -f -v -s "3rd Party Mac Developer Application: 500px Inc." ./Growl....
2012/02/28
[ "https://Stackoverflow.com/questions/9476465", "https://Stackoverflow.com", "https://Stackoverflow.com/users/516359/" ]
Really strange, I've managed to resign the framework like this: ``` codesign -fs "3rd Party Mac Developer Application: Future Simple" Growl.framework/Versions/A/Growl Growl.framework/Versions/A/Growl: replacing existing signature ``` (BTW: I'm working with Xcode 4.3.1 and Growl 1.3.1)
Would it be better if we shipped the sdk unsigned? It'd be a simple change, I'm hesitant to do so now since it's been like this for a little while.