qid
int64
1
74.7M
question
stringlengths
15
58.3k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
4
30.2k
response_k
stringlengths
11
36.5k
32,902
`dsm` requires the devel module but I guess you have that installed anyway if your developing modules. `debug` and `watchdog` having the advantage that is writes to the log file. I can see the advantage of `watchdog` on a live site so users don't get bugged by messages while debugging the site. but is harder to use ( ...
2012/06/01
[ "https://drupal.stackexchange.com/questions/32902", "https://drupal.stackexchange.com", "https://drupal.stackexchange.com/users/3482/" ]
If devel is available, i use mostly `dpm`. If not, I use `drupal_set_message(print_r($array, true))`. This helps me in the most cases. If both are not available or visible, I use the Watchdog.
I realize this is extremely late, but another option is the [devel\_debug\_log](https://www.drupal.org/project/devel_debug_log) module. It still requires the devel module, but it allows you to log your devel related messages.
32,902
`dsm` requires the devel module but I guess you have that installed anyway if your developing modules. `debug` and `watchdog` having the advantage that is writes to the log file. I can see the advantage of `watchdog` on a live site so users don't get bugged by messages while debugging the site. but is harder to use ( ...
2012/06/01
[ "https://drupal.stackexchange.com/questions/32902", "https://drupal.stackexchange.com", "https://drupal.stackexchange.com/users/3482/" ]
`watchdog` has always been a preference for me. Most of the situations my troubles involve checking values before submit or redirects and using `dpm` and `dsm` to check debugging info in the message tab seem a bit out of place. Checking the logs in the admin end and having the ability to filter seems a better thought f...
I realize this is extremely late, but another option is the [devel\_debug\_log](https://www.drupal.org/project/devel_debug_log) module. It still requires the devel module, but it allows you to log your devel related messages.
62,434,544
I’m wanting to use Styled Components and Framer Motion Together to style and animate.... Can I use a variable from SC or FM to style and animate it? What is a example?
2020/06/17
[ "https://Stackoverflow.com/questions/62434544", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13313696/" ]
You should be able to use styled function as a HOC for any motion component ```js import styled from "styled-components"; import { motion } from "framer-motion"; const AnimatedDiv = styled(motion.div)` background-color: rebeccapurple; width: 200px; height: 200px; `; ``` This allows you to use the Component as...
The best method is to use the `as` prop: ``` <StyledComponent as={motion.div}/> ``` This maintains the `framer-motion` intent of "variability" as you put it, in being able to easily replace DOM elements with their motion counterparts. This was unusually hard to find online so I want to post it.
66,781,770
I am learning to use stl vector and It is odd that this program cannot work. What is wrong with it? How should I do if I want to implement the same function with vector? ``` #include <vector> #include <iostream> using namespace std; int main() { vector<int> vec; vector<int>::iterator it; vector<int>::ite...
2021/03/24
[ "https://Stackoverflow.com/questions/66781770", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15469822/" ]
`vec.insert(it, -1);` invalidates `it`. You should rather use `it = vec.insert(it, -1);` which will keep `it` valid. You can see the documentation: <https://en.cppreference.com/w/cpp/container/vector> section called "Iterator invalidation" or look at this great question and answer: [Iterator invalidation rules](htt...
On executing the code ``` vector<int> vec; ``` You created an object named vec, it has no elements and `vec.size()` will be zero. So what `vec.begin()` returns is the same as what `vec.end()` returns. > > By doing `vec.insert(it, -1);` you are inserting a value out of `vec`'s range. > That is undefined behavior. ...
34,417,038
If i run this in IE11 the `fieldset` stays at 300px width, but in Edge, FF and Chrome it just expands until it can fit the entire content is there any way to make this behave the same way in Edge, FF and Chrome as it does in IE11? (the idea here was that I define the LabelWidth with one class and the total width with ...
2015/12/22
[ "https://Stackoverflow.com/questions/34417038", "https://Stackoverflow.com", "https://Stackoverflow.com/users/58553/" ]
Reading more carefully [specs](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/fieldset) I think you can just add `min-width: 0` to `fieldset` element: ```css * { box-sizing: border-box; } .Width300 { width: 300px; padding: 5px; } fieldset { border: black 1px solid; min-width: 0; } .Fiel...
There are a few type errors here like using Fields instead of Field and you have more code than you need. ``` fieldset { border: black 1px solid; max-width: 300px; } .Field input, span { display: inline-block; width:80%; } .Field label { width: 20%; } table { border: 1px solid black; margin: 5px; ...
8,575,122
I'm attempting to create a gallery/gridview that is loaded with images from a specific folder that resides on an SDCard. The path to the folder is known, ("mnt/sdcard/iWallet/Images") , but in the examples I've seen online I am unsure how or where to specify the path to the pictures folder I want to load images from. I...
2011/12/20
[ "https://Stackoverflow.com/questions/8575122", "https://Stackoverflow.com", "https://Stackoverflow.com/users/454936/" ]
You can directly create Bitmaps from [decodeFile (String pathName)](http://developer.android.com/reference/android/graphics/BitmapFactory.html#decodeFile%28java.lang.String%29) that will give you Bitmap object that can be set on ImageView **Update:** Below is sudo code with minor errors modify it to suit your needs `...
Actually, you are wrong to mention fixed path to access SD-card directory, because in some device it is **/mnt/sdcard** and in other **/sdcard**. so to access root directory of sd-card, use the [getExternalStorageDirectory()](http://developer.android.com/reference/android/os/Environment.html#getExternalStorageDirector...
8,575,122
I'm attempting to create a gallery/gridview that is loaded with images from a specific folder that resides on an SDCard. The path to the folder is known, ("mnt/sdcard/iWallet/Images") , but in the examples I've seen online I am unsure how or where to specify the path to the pictures folder I want to load images from. I...
2011/12/20
[ "https://Stackoverflow.com/questions/8575122", "https://Stackoverflow.com", "https://Stackoverflow.com/users/454936/" ]
Actually, you are wrong to mention fixed path to access SD-card directory, because in some device it is **/mnt/sdcard** and in other **/sdcard**. so to access root directory of sd-card, use the [getExternalStorageDirectory()](http://developer.android.com/reference/android/os/Environment.html#getExternalStorageDirector...
You can access your directory using `File` java class, then iterate through all the files in there, create a bitmap for each file using `Bitmapfactory.decodeFile()` then add the bitmaps to your gallery.
8,575,122
I'm attempting to create a gallery/gridview that is loaded with images from a specific folder that resides on an SDCard. The path to the folder is known, ("mnt/sdcard/iWallet/Images") , but in the examples I've seen online I am unsure how or where to specify the path to the pictures folder I want to load images from. I...
2011/12/20
[ "https://Stackoverflow.com/questions/8575122", "https://Stackoverflow.com", "https://Stackoverflow.com/users/454936/" ]
Actually, you are wrong to mention fixed path to access SD-card directory, because in some device it is **/mnt/sdcard** and in other **/sdcard**. so to access root directory of sd-card, use the [getExternalStorageDirectory()](http://developer.android.com/reference/android/os/Environment.html#getExternalStorageDirector...
This function will resturn all the files from specific folder you need to pass path till ur folder ``` public static List getFilesFromDir(File aStartingDir) { List result = new ArrayList(); File[] filesAndDirs = aStartingDir.listFiles(); List filesDirs = Arrays.asList(filesAndDirs); It...
8,575,122
I'm attempting to create a gallery/gridview that is loaded with images from a specific folder that resides on an SDCard. The path to the folder is known, ("mnt/sdcard/iWallet/Images") , but in the examples I've seen online I am unsure how or where to specify the path to the pictures folder I want to load images from. I...
2011/12/20
[ "https://Stackoverflow.com/questions/8575122", "https://Stackoverflow.com", "https://Stackoverflow.com/users/454936/" ]
You can directly create Bitmaps from [decodeFile (String pathName)](http://developer.android.com/reference/android/graphics/BitmapFactory.html#decodeFile%28java.lang.String%29) that will give you Bitmap object that can be set on ImageView **Update:** Below is sudo code with minor errors modify it to suit your needs `...
You can access your directory using `File` java class, then iterate through all the files in there, create a bitmap for each file using `Bitmapfactory.decodeFile()` then add the bitmaps to your gallery.
8,575,122
I'm attempting to create a gallery/gridview that is loaded with images from a specific folder that resides on an SDCard. The path to the folder is known, ("mnt/sdcard/iWallet/Images") , but in the examples I've seen online I am unsure how or where to specify the path to the pictures folder I want to load images from. I...
2011/12/20
[ "https://Stackoverflow.com/questions/8575122", "https://Stackoverflow.com", "https://Stackoverflow.com/users/454936/" ]
You can directly create Bitmaps from [decodeFile (String pathName)](http://developer.android.com/reference/android/graphics/BitmapFactory.html#decodeFile%28java.lang.String%29) that will give you Bitmap object that can be set on ImageView **Update:** Below is sudo code with minor errors modify it to suit your needs `...
This function will resturn all the files from specific folder you need to pass path till ur folder ``` public static List getFilesFromDir(File aStartingDir) { List result = new ArrayList(); File[] filesAndDirs = aStartingDir.listFiles(); List filesDirs = Arrays.asList(filesAndDirs); It...
8,575,122
I'm attempting to create a gallery/gridview that is loaded with images from a specific folder that resides on an SDCard. The path to the folder is known, ("mnt/sdcard/iWallet/Images") , but in the examples I've seen online I am unsure how or where to specify the path to the pictures folder I want to load images from. I...
2011/12/20
[ "https://Stackoverflow.com/questions/8575122", "https://Stackoverflow.com", "https://Stackoverflow.com/users/454936/" ]
This function will resturn all the files from specific folder you need to pass path till ur folder ``` public static List getFilesFromDir(File aStartingDir) { List result = new ArrayList(); File[] filesAndDirs = aStartingDir.listFiles(); List filesDirs = Arrays.asList(filesAndDirs); It...
You can access your directory using `File` java class, then iterate through all the files in there, create a bitmap for each file using `Bitmapfactory.decodeFile()` then add the bitmaps to your gallery.
28,993
I tried to use `xmodmap` to map `META\_L` to the `MENU` key but it doesn't seem to be accepted by `bash` as the meta key. So, I am wondering how these components (keyboard, X, xterm, bash) relate to each in regard the the Meta- and Super-Keys. Any explanation would be appreciated. Let me put this another way. The bash...
2012/01/13
[ "https://unix.stackexchange.com/questions/28993", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/14258/" ]
The mapping from keyboard keys to modifiers like `Meta` and `Control` is handled by the X server (i.e. the low-level part of the GUI). This mapping can be manipulated through the old-style [`xmodmap`](http://www.x.org/archive/current/doc/man/man1/xmodmap.1.xhtml) command or the new-style [XKB](http://en.wikipedia.org/w...
The key event is generated by the X server (as configured by `xmodmap`), and is sent to your X application. Your window manager could intercept this before it is sent to xterm. XTerm, in turn, translates the event to some bytes and sends the bytes to the pseudo-tty allocated by your shell, bash. Please note that not a...
28,993
I tried to use `xmodmap` to map `META\_L` to the `MENU` key but it doesn't seem to be accepted by `bash` as the meta key. So, I am wondering how these components (keyboard, X, xterm, bash) relate to each in regard the the Meta- and Super-Keys. Any explanation would be appreciated. Let me put this another way. The bash...
2012/01/13
[ "https://unix.stackexchange.com/questions/28993", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/14258/" ]
The mapping from keyboard keys to modifiers like `Meta` and `Control` is handled by the X server (i.e. the low-level part of the GUI). This mapping can be manipulated through the old-style [`xmodmap`](http://www.x.org/archive/current/doc/man/man1/xmodmap.1.xhtml) command or the new-style [XKB](http://en.wikipedia.org/w...
Bash's *meta key* originally was defined like this ([`lib/readline/ChangeLog`](http://git.savannah.gnu.org/cgit/bash.git/tree/lib/readline/ChangeLog)): ``` Mon Jul 13 11:34:07 1992 Brian Fox (bfox@cubit) * readline.c: (rl_variable_bind) New variable "meta-flag" if "on" means force the use of the 8th ...
4,180,063
I'm looking for good examples of multithreading practices in C#. I'd like to see common methods of executing multithreading processes.
2010/11/14
[ "https://Stackoverflow.com/questions/4180063", "https://Stackoverflow.com", "https://Stackoverflow.com/users/494818/" ]
I've been doing the same type of research. I've come across a free eBook on threading which has been fantastic. It's from Joseph Albahari, the author of several books and LinqPad. Excellent resource. ``` http://www.albahari.com/threading/ ```
If you're talking about what kind of patterns and problems you might stumble into when doing multithreaded concurrent programming in general I've heard a lot of good about. For C# specifics Albahari's book or C# 4.0 in a nutshell is a good reference [http://www.amazon.com/Concurrent-Programming-Windows-Joe-Duffy/dp/0...
57,796,961
I want to use 'react-native-image-picker' in my application. After importing and following the install instructions from the github instructions. I get a metro bundler crash on run. It can't seem to locate the 'react-image-picker' or it's dependencies? I have tried initializing a new project and ONLY installing image...
2019/09/05
[ "https://Stackoverflow.com/questions/57796961", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6323386/" ]
I also faced the similar issue with latest release. I changed the version to 0.28.0. ``` npm install react-native-image-picker@0.28.0 npx react-native link react-native-image-picker ``` Please see if it works for you.
the answer is [here](https://github.com/react-native-community/react-native-image-picker/issues/1165) simply is: 2. Second solution Import library from lib/common/js import ImagePicker from 'react-native-image-picker/lib/commonjs';
28,641,296
I have a table called `Stores` which has a key called `store_id` and a table called `Sales` which contains a `store_id` reference and a json field called `sales_json`. `sales_json` looks something like this: ``` [{'start_date': '2-20-15', 'end_date': '2-21-15', 'start_time': '11:00 AM', 'end_time': '11:00 PM', 'di...
2015/02/21
[ "https://Stackoverflow.com/questions/28641296", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4530891/" ]
The error was caused by a function I wrote that appends a json array to `sales_json`. I fixed it and now it looks like this: ``` CREATE OR REPLACE FUNCTION add_sales (insertion_id smallint, new_sales_json json) RETURNS void AS $$ BEGIN UPDATE Sales SET sales_json = array_to_json(ARRAY(SELECT * FROM json_array_...
Besides the [mix-up of element and array input](https://stackoverflow.com/questions/28621738/update-json-array-using-aggregrate-function/28622080#28622080) that you sorted out yourself, you can also largely simplify your `SELECT` statement: ```sql SELECT store_id , EXISTS ( SELECT 1 FROM jso...
9,404,688
I have ported/repackaged my free Android app to BlackBerry Playbook. Before publishing it to the AppWorld I removed AdMob from it as it wasn't clear at that point if that was going to be approved. Now, developers trying to use AdMob on PlayBook report that ads are not being served on the platform, presumably due to la...
2012/02/22
[ "https://Stackoverflow.com/questions/9404688", "https://Stackoverflow.com", "https://Stackoverflow.com/users/300886/" ]
what you would need is to write your own extension to fullcalendar (similar to the gcal.js which is provided with fullcalendar) something you could call ical.js You should know that writting an complete ical parser can be quite draining so you may want to consider sticking with google calendar for your back-end unless...
if you have a wordpress website, there's an app for that. <http://wordpress.org/extend/plugins/amr-ical-events-list/> if you don't have a wordpress website, please provide some more information so that people can advise more adequately with respect to your situation - there are some dedicated icalendar scripts - I hav...
9,404,688
I have ported/repackaged my free Android app to BlackBerry Playbook. Before publishing it to the AppWorld I removed AdMob from it as it wasn't clear at that point if that was going to be approved. Now, developers trying to use AdMob on PlayBook report that ads are not being served on the platform, presumably due to la...
2012/02/22
[ "https://Stackoverflow.com/questions/9404688", "https://Stackoverflow.com", "https://Stackoverflow.com/users/300886/" ]
I manage to do it. Not as hard as I thought. I use [ical.js](https://mozilla-comm.github.io/ical.js/) as ics parser. After parsing, I get a json object which contains all the information in the ics. And then traverse it and construct event object according to [the definition of FullCalendar Event object](https://fullca...
if you have a wordpress website, there's an app for that. <http://wordpress.org/extend/plugins/amr-ical-events-list/> if you don't have a wordpress website, please provide some more information so that people can advise more adequately with respect to your situation - there are some dedicated icalendar scripts - I hav...
9,404,688
I have ported/repackaged my free Android app to BlackBerry Playbook. Before publishing it to the AppWorld I removed AdMob from it as it wasn't clear at that point if that was going to be approved. Now, developers trying to use AdMob on PlayBook report that ads are not being served on the platform, presumably due to la...
2012/02/22
[ "https://Stackoverflow.com/questions/9404688", "https://Stackoverflow.com", "https://Stackoverflow.com/users/300886/" ]
There is support for iCalendar as an event source as of V 5.5.0. You can view the docs here: <https://fullcalendar.io/docs/icalendar> Example: ``` import dayGridPlugin from '@fullcalendar/daygrid' import iCalendarPlugin from '@fullcalendar/icalendar' var calendar = new Calendar(calendarEl, { plugins: [dayGridPlug...
if you have a wordpress website, there's an app for that. <http://wordpress.org/extend/plugins/amr-ical-events-list/> if you don't have a wordpress website, please provide some more information so that people can advise more adequately with respect to your situation - there are some dedicated icalendar scripts - I hav...
9,404,688
I have ported/repackaged my free Android app to BlackBerry Playbook. Before publishing it to the AppWorld I removed AdMob from it as it wasn't clear at that point if that was going to be approved. Now, developers trying to use AdMob on PlayBook report that ads are not being served on the platform, presumably due to la...
2012/02/22
[ "https://Stackoverflow.com/questions/9404688", "https://Stackoverflow.com", "https://Stackoverflow.com/users/300886/" ]
what you would need is to write your own extension to fullcalendar (similar to the gcal.js which is provided with fullcalendar) something you could call ical.js You should know that writting an complete ical parser can be quite draining so you may want to consider sticking with google calendar for your back-end unless...
You can import it into Google Calendar and then import Google Calendar into FullCalendar.
9,404,688
I have ported/repackaged my free Android app to BlackBerry Playbook. Before publishing it to the AppWorld I removed AdMob from it as it wasn't clear at that point if that was going to be approved. Now, developers trying to use AdMob on PlayBook report that ads are not being served on the platform, presumably due to la...
2012/02/22
[ "https://Stackoverflow.com/questions/9404688", "https://Stackoverflow.com", "https://Stackoverflow.com/users/300886/" ]
what you would need is to write your own extension to fullcalendar (similar to the gcal.js which is provided with fullcalendar) something you could call ical.js You should know that writting an complete ical parser can be quite draining so you may want to consider sticking with google calendar for your back-end unless...
There is support for iCalendar as an event source as of V 5.5.0. You can view the docs here: <https://fullcalendar.io/docs/icalendar> Example: ``` import dayGridPlugin from '@fullcalendar/daygrid' import iCalendarPlugin from '@fullcalendar/icalendar' var calendar = new Calendar(calendarEl, { plugins: [dayGridPlug...
9,404,688
I have ported/repackaged my free Android app to BlackBerry Playbook. Before publishing it to the AppWorld I removed AdMob from it as it wasn't clear at that point if that was going to be approved. Now, developers trying to use AdMob on PlayBook report that ads are not being served on the platform, presumably due to la...
2012/02/22
[ "https://Stackoverflow.com/questions/9404688", "https://Stackoverflow.com", "https://Stackoverflow.com/users/300886/" ]
I manage to do it. Not as hard as I thought. I use [ical.js](https://mozilla-comm.github.io/ical.js/) as ics parser. After parsing, I get a json object which contains all the information in the ics. And then traverse it and construct event object according to [the definition of FullCalendar Event object](https://fullca...
You can import it into Google Calendar and then import Google Calendar into FullCalendar.
9,404,688
I have ported/repackaged my free Android app to BlackBerry Playbook. Before publishing it to the AppWorld I removed AdMob from it as it wasn't clear at that point if that was going to be approved. Now, developers trying to use AdMob on PlayBook report that ads are not being served on the platform, presumably due to la...
2012/02/22
[ "https://Stackoverflow.com/questions/9404688", "https://Stackoverflow.com", "https://Stackoverflow.com/users/300886/" ]
There is support for iCalendar as an event source as of V 5.5.0. You can view the docs here: <https://fullcalendar.io/docs/icalendar> Example: ``` import dayGridPlugin from '@fullcalendar/daygrid' import iCalendarPlugin from '@fullcalendar/icalendar' var calendar = new Calendar(calendarEl, { plugins: [dayGridPlug...
You can import it into Google Calendar and then import Google Calendar into FullCalendar.
9,404,688
I have ported/repackaged my free Android app to BlackBerry Playbook. Before publishing it to the AppWorld I removed AdMob from it as it wasn't clear at that point if that was going to be approved. Now, developers trying to use AdMob on PlayBook report that ads are not being served on the platform, presumably due to la...
2012/02/22
[ "https://Stackoverflow.com/questions/9404688", "https://Stackoverflow.com", "https://Stackoverflow.com/users/300886/" ]
I manage to do it. Not as hard as I thought. I use [ical.js](https://mozilla-comm.github.io/ical.js/) as ics parser. After parsing, I get a json object which contains all the information in the ics. And then traverse it and construct event object according to [the definition of FullCalendar Event object](https://fullca...
There is support for iCalendar as an event source as of V 5.5.0. You can view the docs here: <https://fullcalendar.io/docs/icalendar> Example: ``` import dayGridPlugin from '@fullcalendar/daygrid' import iCalendarPlugin from '@fullcalendar/icalendar' var calendar = new Calendar(calendarEl, { plugins: [dayGridPlug...
24,225,608
I'm trying to create a class function but somehow it won’t work and I can’t figure out what’s the problem. Is it the way I declare the variable or what so ever? ``` <?php class Car{ var $model; var $make; var $speed; function Car ( $model, $make, $speed) { $this->model = $model; $this->make = $make; $t...
2014/06/15
[ "https://Stackoverflow.com/questions/24225608", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3544721/" ]
Lots of issues with your code. But at least this cleaned up version should work without the script dying completely. Here is a breakdown of what I did: * Set the variables that were set as `var` to `public` since that is the preferred method of setting variables. * In `function Car`, I set default values for `$model`,...
When concatenating strings, you must use the dot operator: ``` echo "abcd" . "efgh"; ```
24,225,608
I'm trying to create a class function but somehow it won’t work and I can’t figure out what’s the problem. Is it the way I declare the variable or what so ever? ``` <?php class Car{ var $model; var $make; var $speed; function Car ( $model, $make, $speed) { $this->model = $model; $this->make = $make; $t...
2014/06/15
[ "https://Stackoverflow.com/questions/24225608", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3544721/" ]
Lots of issues with your code. But at least this cleaned up version should work without the script dying completely. Here is a breakdown of what I did: * Set the variables that were set as `var` to `public` since that is the preferred method of setting variables. * In `function Car`, I set default values for `$model`,...
Add a constructor like this: ``` public function __construct($model = 0, $make = 0, $speed = 0) { $this->model = $model; $this->make = $make; $this->speed = $speed; } ``` <http://us3.php.net/manual/en/language.oop5.decon.php>
229,446
I have a Fourier series which produces an impulse train of period `j+1`. In principle, it is given by ``` f[x_, j_] := (-1 + E^(2*I*Pi*x))/((-1 + E^((2*I*Pi*x)/(1 + j)))*(1 + j)) ``` However, this produces `1/0` at integer values of `x` - the limiting value needs to be taken at these points, as the following tables ...
2020/09/03
[ "https://mathematica.stackexchange.com/questions/229446", "https://mathematica.stackexchange.com", "https://mathematica.stackexchange.com/users/57910/" ]
``` r[[## & @@ pos[[1]]]] = vals[[1]]; r ``` > > > ``` > {{100, 3, 4}, {3, 4, 5}, {4, 5, 6}} > > ``` > > ``` r = Array[Plus, {3, 3}]; Do[r[[## & @@ pos[[i]]]] = vals[[i]], {i, 2}]; r ``` > > > ``` > {{100, 3, 4}, {3, 200, 5}, {4, 5, 6}} > > ``` > > Additional methods: ``` r = Array[Plus, {3, 3}]; MapTh...
`ReplacePart[r, Thread[pos -> vals]]`
1,830,498
I am trying to minimise the following cost function with respect to $X$: $\mathbf{C}(X) = ||{M \cdot X \cdot \mathbf{1}\_{N \times 1} - T}||\_{2}^{2}$ Here, $M$, $X$, $T$ are matrices of dimensions $a \times b$, $b \times n$ and $a \times 1$ respectively. $\mathbf{1}\_{N \times 1}$ is a column vector containing all va...
2016/06/18
[ "https://math.stackexchange.com/questions/1830498", "https://math.stackexchange.com", "https://math.stackexchange.com/users/186953/" ]
For convenience, define a new variable $$\eqalign{ Y &= M\cdot X\cdot 1-T \cr dY &= M\cdot dX\cdot 1 \cr }$$ Use this new variable and the [Frobenius (:) Inner Product](https://en.wikipedia.org/wiki/Matrix_multiplication#Frobenius_product) to write the cost function, differential and gradient as $$\eqalign{ C &= Y:...
Basically, you require derivative of a vector w.r.t. a matrix. As per wiki, there is no agreement on what the result of differentiation will look like [source](https://en.wikipedia.org/wiki/Matrix_calculus#Other_matrix_derivatives). Still, here is an ans. Derivative of $AXB$ w.r.t. $X$ is $B^T\otimes A$. Now, you repla...
3,635,732
This question has probably been asked in various ways before, but here is what I want to do. I am going to have a Windows form with many tabs. Each tab will contain a grid object. For each tab/grid that is created by the user, I would like a spawn off a dedicated thread to populate the contents of that grid with consta...
2010/09/03
[ "https://Stackoverflow.com/questions/3635732", "https://Stackoverflow.com", "https://Stackoverflow.com/users/163534/" ]
Inside the initialization for the tab (assuming WinForms until I see otherwise): ``` Thread newThread = new Thread(() => { // Get your data dataGridView1.Invoke(new Action(() => { /* add data to the grid here */ } ); }); newThread.Start(); ``` That is obviously the most simple example. You could also spawn...
You should have an array of threads, to be able to control them ``` List<Thread> tabs = new List<Thread>(); ``` ... To add a new one, would be like: ``` tabs.Add( new Thread( new ThreadStart( TabRefreshHandler ) ); //Now starting: tabs[tabs.Count - 1].Start(); ``` And finally, in the TabRefreshHandler you should...
3,635,732
This question has probably been asked in various ways before, but here is what I want to do. I am going to have a Windows form with many tabs. Each tab will contain a grid object. For each tab/grid that is created by the user, I would like a spawn off a dedicated thread to populate the contents of that grid with consta...
2010/09/03
[ "https://Stackoverflow.com/questions/3635732", "https://Stackoverflow.com", "https://Stackoverflow.com/users/163534/" ]
Inside the initialization for the tab (assuming WinForms until I see otherwise): ``` Thread newThread = new Thread(() => { // Get your data dataGridView1.Invoke(new Action(() => { /* add data to the grid here */ } ); }); newThread.Start(); ``` That is obviously the most simple example. You could also spawn...
There are two basic approaches you can use. Choose the one that makes the most sense in your situation. Often times there is no right or wrong choice. They can both work equally well in many situations. Each has its own advantages and disadvantages. Oddly the community seems to overlook the pull method too often. I am ...
3,635,732
This question has probably been asked in various ways before, but here is what I want to do. I am going to have a Windows form with many tabs. Each tab will contain a grid object. For each tab/grid that is created by the user, I would like a spawn off a dedicated thread to populate the contents of that grid with consta...
2010/09/03
[ "https://Stackoverflow.com/questions/3635732", "https://Stackoverflow.com", "https://Stackoverflow.com/users/163534/" ]
There are two basic approaches you can use. Choose the one that makes the most sense in your situation. Often times there is no right or wrong choice. They can both work equally well in many situations. Each has its own advantages and disadvantages. Oddly the community seems to overlook the pull method too often. I am ...
You should have an array of threads, to be able to control them ``` List<Thread> tabs = new List<Thread>(); ``` ... To add a new one, would be like: ``` tabs.Add( new Thread( new ThreadStart( TabRefreshHandler ) ); //Now starting: tabs[tabs.Count - 1].Start(); ``` And finally, in the TabRefreshHandler you should...
47,077,829
I want to send a post request to an external API (<https://example.com/api/jobs/test>) every hour. The Lambda Function that I used is as follows: ``` Handler: index.lambda_handler python: 3.6 ``` index.py ``` import requests def lambda_handler(event, context): url="https://example.com/api/jobs/test" response =...
2017/11/02
[ "https://Stackoverflow.com/questions/47077829", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5946384/" ]
Vendored `requests` are now removed from `botocore`. Consider packaging your Lambda code with `requirements.txt` using CloudFormation package or SAM CLI packaging functionality. > > My older answer from before vendored `requests` deprecation: > You may be able to leverage `requests` module from the `boto` library w...
You need to install `requests` module to your project directory and create a lambda deployment package. See [this](https://docs.aws.amazon.com/lambda/latest/dg/lambda-python-how-to-create-deployment-package.html) link for details. In short, you need to create your index.py file on you development system (PC or mac), i...
47,077,829
I want to send a post request to an external API (<https://example.com/api/jobs/test>) every hour. The Lambda Function that I used is as follows: ``` Handler: index.lambda_handler python: 3.6 ``` index.py ``` import requests def lambda_handler(event, context): url="https://example.com/api/jobs/test" response =...
2017/11/02
[ "https://Stackoverflow.com/questions/47077829", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5946384/" ]
You need to install `requests` module to your project directory and create a lambda deployment package. See [this](https://docs.aws.amazon.com/lambda/latest/dg/lambda-python-how-to-create-deployment-package.html) link for details. In short, you need to create your index.py file on you development system (PC or mac), i...
You need to install requests module. Type : ``` pip install requests ``` into your terminal, or after activating virtual environment if you are using one.
47,077,829
I want to send a post request to an external API (<https://example.com/api/jobs/test>) every hour. The Lambda Function that I used is as follows: ``` Handler: index.lambda_handler python: 3.6 ``` index.py ``` import requests def lambda_handler(event, context): url="https://example.com/api/jobs/test" response =...
2017/11/02
[ "https://Stackoverflow.com/questions/47077829", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5946384/" ]
Vendored `requests` are now removed from `botocore`. Consider packaging your Lambda code with `requirements.txt` using CloudFormation package or SAM CLI packaging functionality. > > My older answer from before vendored `requests` deprecation: > You may be able to leverage `requests` module from the `boto` library w...
You need to install requests module. Type : ``` pip install requests ``` into your terminal, or after activating virtual environment if you are using one.
9,321,558
We have css file. Let's say we change it with jquery like that `$('body').css('color':'red');`. Is it possible to retrieve current .css file? If not, how would you try to do that?
2012/02/17
[ "https://Stackoverflow.com/questions/9321558", "https://Stackoverflow.com", "https://Stackoverflow.com/users/237681/" ]
A CSS file is static - if you change an element's style with jQuery that changes the element in the DOM, but not in the loaded CSS files. If you are interested in getting the current CSS style for a given property of an element, you can use jQuery's [`css()`](http://api.jquery.com/css/) method. If you are interested i...
jQuery will only change the style attribute/property of the node, your css file won't change. Of course you can alter css files ([Totally Pwn CSS with Javascript](http://www.hunlock.com/blogs/Totally_Pwn_CSS_with_Javascript)/[MDN](https://developer.mozilla.org/en/DOM/CSSStyleSheet), or simpler with [`.cssText`](https:...
577,877
I'm looking for a VM program like VMware, LXC, or KVM, which stores the whole hard drive of the guest OS on the host HDD. `LXC` for instance does this, it stores in `/var/lib/lxc/<machine_name>/rootfs/`, which mounts as `/` on the guest OS. I don't like LXC however because the VMs are not portable at all. VMware and ...
2013/04/04
[ "https://superuser.com/questions/577877", "https://superuser.com", "https://superuser.com/users/104673/" ]
A VM and a host OS cannot share block devices and file systems natively, it's completely corrupt the file system within minutes. It'll probably make more sense to share a directory in your host file system via NFS and have the VM PXE NetBoot from it. But if you just wanna R/W access to a project tree rather than th...
Haven't tried this feature but in VBOX you can as demonstrated here: 1. <http://2stech.ca/index.php/linux/linuxtutotials/readmes/128-mount-a-physical-disk-in-virtualbox> 2. <http://www.sysprobs.com/access-physical-disk-virtualbox-desktop-virtualization-software> The Second link is for windows, just in case would look ...
17,611,677
I have a background image in body. What I want to achieve is that: 1) - Calculate the visitor screen resolution. 2) - based on that resolution I want to resize my background image. I know get the screen resolution as a ``` Display display = getWindowManager().getDefaultDisplay(); width_screen = display.getWidth()...
2013/07/12
[ "https://Stackoverflow.com/questions/17611677", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2447386/" ]
Put a ImageView in your layout file and set ``` android:layout_width="match_parent" android:layout_height="match_parent" ``` If you want to keep the aspect use: ``` android:scaleType="centerInside" ``` If you dont care about the aspect ratio use: ``` android:scaleType="fitXY" ```
you may have to write a custom view to do this. Overide onDraw method in it to copy your bitmap as many times as needed.
25,334,067
Here is the code that keeps saying illegal start of expression: ``` public static conversionRate= 4.546; ``` Here is the full code: ``` /** * Write a description of class VolumeConversion here. * * @author (Aneeqa Rustam) * @version (07/08/2014) */ public class VolumeConversion { // instance variables -...
2014/08/15
[ "https://Stackoverflow.com/questions/25334067", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3922365/" ]
You need a type for the variable. For example: ``` public static float conversionRate = 4.546f; ``` You also want to place that outside of the constructor, as a class level variable.
The variable `conversionRate` doesn't have a type in its declaration. Possible solutions: ``` public static float conversionRate = 4.546f; public static double conversionRate = 4.546; ``` Besides that you try to declare this variable in the constructor (a "method"). That does not work. It has to be declared within ...
25,334,067
Here is the code that keeps saying illegal start of expression: ``` public static conversionRate= 4.546; ``` Here is the full code: ``` /** * Write a description of class VolumeConversion here. * * @author (Aneeqa Rustam) * @version (07/08/2014) */ public class VolumeConversion { // instance variables -...
2014/08/15
[ "https://Stackoverflow.com/questions/25334067", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3922365/" ]
You need a type for the variable. For example: ``` public static float conversionRate = 4.546f; ``` You also want to place that outside of the constructor, as a class level variable.
Type is missing in the variable declaration
25,334,067
Here is the code that keeps saying illegal start of expression: ``` public static conversionRate= 4.546; ``` Here is the full code: ``` /** * Write a description of class VolumeConversion here. * * @author (Aneeqa Rustam) * @version (07/08/2014) */ public class VolumeConversion { // instance variables -...
2014/08/15
[ "https://Stackoverflow.com/questions/25334067", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3922365/" ]
You need a type for the variable. For example: ``` public static float conversionRate = 4.546f; ``` You also want to place that outside of the constructor, as a class level variable.
Well, this one is quite obvious - you haven't defined the datatype for your `conversionRate` variable. What you'd probably want to use here is the [double](http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html) datatype, but I'd also suggest looking into [BigDecimals](http://docs.oracle.com/javase/7/d...
25,334,067
Here is the code that keeps saying illegal start of expression: ``` public static conversionRate= 4.546; ``` Here is the full code: ``` /** * Write a description of class VolumeConversion here. * * @author (Aneeqa Rustam) * @version (07/08/2014) */ public class VolumeConversion { // instance variables -...
2014/08/15
[ "https://Stackoverflow.com/questions/25334067", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3922365/" ]
The variable `conversionRate` doesn't have a type in its declaration. Possible solutions: ``` public static float conversionRate = 4.546f; public static double conversionRate = 4.546; ``` Besides that you try to declare this variable in the constructor (a "method"). That does not work. It has to be declared within ...
Well, this one is quite obvious - you haven't defined the datatype for your `conversionRate` variable. What you'd probably want to use here is the [double](http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html) datatype, but I'd also suggest looking into [BigDecimals](http://docs.oracle.com/javase/7/d...
25,334,067
Here is the code that keeps saying illegal start of expression: ``` public static conversionRate= 4.546; ``` Here is the full code: ``` /** * Write a description of class VolumeConversion here. * * @author (Aneeqa Rustam) * @version (07/08/2014) */ public class VolumeConversion { // instance variables -...
2014/08/15
[ "https://Stackoverflow.com/questions/25334067", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3922365/" ]
Type is missing in the variable declaration
Well, this one is quite obvious - you haven't defined the datatype for your `conversionRate` variable. What you'd probably want to use here is the [double](http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html) datatype, but I'd also suggest looking into [BigDecimals](http://docs.oracle.com/javase/7/d...
37,690,338
Say I have the size `(2,3,2)` array `a` and the size `(2)` array b below. ``` import numpy as np a = np.array([[[1, 2], [3, 4], [5, 6]], [[7, 8], [9, 10], [11, 12]]]) b = np.array([0.2, 0.8]) ``` Array `a` looks like this: [![array a](https://i.stack.imgur.com/MmZOu.png)](https://i.stack.imgur.com/MmZOu.png) I'd ...
2016/06/07
[ "https://Stackoverflow.com/questions/37690338", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2032413/" ]
Try this: ``` np.concatenate(([[b]]*2,a),axis=1) # Result: array([[[ 0.2, 0.8], [ 1. , 2. ], [ 3. , 4. ], [ 5. , 6. ]], [[ 0.2, 0.8], [ 7. , 8. ], [ 9. , 10. ], [ 11. , 12. ]]]) ```
This works: ``` np.insert(a.astype(float), 0, b, 1) ``` Output: ``` array([[[ 0.2, 0.8], [ 1. , 2. ], [ 3. , 4. ], [ 5. , 6. ]], [[ 0.2, 0.8], [ 7. , 8. ], [ 9. , 10. ], [ 11. , 12. ]]]) ``` If you don't cast with `astype()` first, you j...
44,701,325
I have a form and it has text inputs and file input for upload an image. I tried to send values to my php page but i couldnt do it. Here is my ajax codes. ``` function sendval() { var form = $('#user_update_form')[0]; var form_data = new FormData(); $.ajax({ type: 'POST', url: 'user_update.php', pro...
2017/06/22
[ "https://Stackoverflow.com/questions/44701325", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4437111/" ]
Use [`lstrip()`](https://docs.python.org/3/library/stdtypes.html#str.lstrip) > > Return a copy of the string with leading characters removed. The *chars* argument is a string specifying the set of characters to be removed. > > > ``` >>> "@@@@b@@".lstrip("@") 'b@@' ```
``` def remove(S): return S[4:] if S.startswith('@@@@') else S >>> remove('@@@@b@@') 'b@@' >>> remove('@@@b@@') '@@@b@@' ```
44,701,325
I have a form and it has text inputs and file input for upload an image. I tried to send values to my php page but i couldnt do it. Here is my ajax codes. ``` function sendval() { var form = $('#user_update_form')[0]; var form_data = new FormData(); $.ajax({ type: 'POST', url: 'user_update.php', pro...
2017/06/22
[ "https://Stackoverflow.com/questions/44701325", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4437111/" ]
Use [`lstrip()`](https://docs.python.org/3/library/stdtypes.html#str.lstrip) > > Return a copy of the string with leading characters removed. The *chars* argument is a string specifying the set of characters to be removed. > > > ``` >>> "@@@@b@@".lstrip("@") 'b@@' ```
**Python 3.9** There are two new string methods, removesuffix() and removeprefix() ``` "HelloWorld".removesuffix("World") ``` > > Output: "Hello" > > > ``` "HelloWorld".removeprefix("Hello") ``` > > Output: "World" > > > **Before Python 3.9** 1. Using lstrip() (See Christians answer) Be careful us...
31,841,371
Good day! I'm into video chat streaming this morning and I've bumped into a problem with the incoming ArrayBuffer which contains binary data of an audio. Here is the code I found for playing binary audio data (Uint8Array): ``` function playByteArray(byteArray) { var arrayBuffer = new ArrayBuffer(byteArray.length)...
2015/08/05
[ "https://Stackoverflow.com/questions/31841371", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5195434/" ]
I found a solution to this problem by making an audio buffer queueing. Most of the code is from here: [Choppy/inaudible playback with chunked audio through Web Audio API](https://stackoverflow.com/questions/20475982/choppy-inaudible-playback-with-chunked-audio-through-web-audio-api) Thanks.
Not sure if this is the problem, but perhaps instead of source.start(0), you should use source.start(time), where time is where you want to start the source. source.start(0) will start playing immediately. If your byte array comes in faster than real-time, the sources might overlap because you start them as soon as pos...
20,726,342
I'm learning task-parallel-library. I have some old code that use WebClient class to download data from web. I want to convert my previous code that using [Event-based Asynchronous Pattern(EAP)](http://msdn.microsoft.com/en-us/library/ms228969%28v=vs.110%29.aspx) to [Task-based Asynchronous Pattern (TAP)](http://msdn.m...
2013/12/22
[ "https://Stackoverflow.com/questions/20726342", "https://Stackoverflow.com", "https://Stackoverflow.com/users/885152/" ]
You can extend WebClient: ``` public static class WebClientExtensions { public static async Task<byte[]> DownloadDataTaskAsync(this WebClient webClient, string address, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); using (cancellationToken.Register(we...
There are no overloads that support cancellation so you can't cancel that async action (You may want to read [How do I cancel non-cancelable async operations?](http://blogs.msdn.com/b/pfxteam/archive/2012/10/05/how-do-i-cancel-non-cancelable-async-operations.aspx)). You can however add a timeout or cancellation on top...
20,726,342
I'm learning task-parallel-library. I have some old code that use WebClient class to download data from web. I want to convert my previous code that using [Event-based Asynchronous Pattern(EAP)](http://msdn.microsoft.com/en-us/library/ms228969%28v=vs.110%29.aspx) to [Task-based Asynchronous Pattern (TAP)](http://msdn.m...
2013/12/22
[ "https://Stackoverflow.com/questions/20726342", "https://Stackoverflow.com", "https://Stackoverflow.com/users/885152/" ]
You can extend WebClient: ``` public static class WebClientExtensions { public static async Task<byte[]> DownloadDataTaskAsync(this WebClient webClient, string address, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); using (cancellationToken.Register(we...
``` public static async Task<byte[]> DownloadDataTaskAsync(this WebClient obj, Uri address, CancellationToken cancellationToken) { var tcs = new TaskCompletionSource<bool>(); var task = obj.DownloadDataTaskAsync(address); using (cancellationToken.Register(s => ((TaskCompletionSource<bool>)...
62,135,423
Let's say I have a cloud function like this ``` export const setData = functions.https.onCall(async (data, context) => { await admin.firestore().doc("myPath").set({data: "myData"}) return {success: true} }) ``` If I don't care about the firestore set call is successful or not, can I remove the await? So the ...
2020/06/01
[ "https://Stackoverflow.com/questions/62135423", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5695336/" ]
**You will have problems if you remove the await.** Without it, the function will return immediately with the return value without waiting for the set() to complete. The function will terminate along with any asynchronous work that's not finished. With a callable function, the function must return with a promise that ...
This is more like JS question than Firebase itself. If you **really** don't care, no problem but you'll **never** know if anything returned or not, even if the function could be called normally as the return might just finish everything before the Firebase call is complete. > > "returns earlier and reduces CPU usage...
54,956,906
I'm using Puppeteer to create a 30-page long pdf and a few of the pages need to be landscape orientated. How can I specify it only for page x and page y ?
2019/03/02
[ "https://Stackoverflow.com/questions/54956906", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11139526/" ]
Pseudo Selectors for @page ========================== According to the [documentation](https://developer.mozilla.org/en-US/docs/Web/CSS/@page) or [CSS spec](https://drafts.csswg.org/css-page-3/#at-page-rule), you can set up different orientation to some pages using CSS. ``` @page :pseudo-selector{ size: landscape; }...
We need to set '**landscape**' property to '**true**' in options. ``` var options = { ... landscape: true } page.pdf(options); ```
54,956,906
I'm using Puppeteer to create a 30-page long pdf and a few of the pages need to be landscape orientated. How can I specify it only for page x and page y ?
2019/03/02
[ "https://Stackoverflow.com/questions/54956906", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11139526/" ]
Pseudo Selectors for @page ========================== According to the [documentation](https://developer.mozilla.org/en-US/docs/Web/CSS/@page) or [CSS spec](https://drafts.csswg.org/css-page-3/#at-page-rule), you can set up different orientation to some pages using CSS. ``` @page :pseudo-selector{ size: landscape; }...
Well, according to caniuse, [you can use the page property with Chrome 85 and up](https://caniuse.com/mdn-css_properties_page) So you can use **@page** followed by a "named page name" in combination with **the page property** to set a different orientation (or any other properties) to any page you want. example: ```...
54,956,906
I'm using Puppeteer to create a 30-page long pdf and a few of the pages need to be landscape orientated. How can I specify it only for page x and page y ?
2019/03/02
[ "https://Stackoverflow.com/questions/54956906", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11139526/" ]
Well, according to caniuse, [you can use the page property with Chrome 85 and up](https://caniuse.com/mdn-css_properties_page) So you can use **@page** followed by a "named page name" in combination with **the page property** to set a different orientation (or any other properties) to any page you want. example: ```...
We need to set '**landscape**' property to '**true**' in options. ``` var options = { ... landscape: true } page.pdf(options); ```
26,980,758
Probably the question title is nonsensical so let me explain what I am trying to do! I have this template class ``` template <class TBase> class A : public TBase { public: A() { /* some initialization */ } }; ``` the "inner" class can be either of these 2: ``` class B1 {// no constructor required }; class B2 { ...
2014/11/17
[ "https://Stackoverflow.com/questions/26980758", "https://Stackoverflow.com", "https://Stackoverflow.com/users/272325/" ]
All sub-object must be constructible in the manner selected by your derived constructor, and all must have an accessible destructor. Any sub-object neither explicitly constructed in the ctor-init-list nor by an in-class initializer will be default-constructed. (Which is forbidden for references.) Thus, your `B2` n...
In many cases, depending on how complex the base classes are and how many specializations you would end up needing, I'd prefer to use a class factory: ``` class B1 { }; class B2 { public: B2 (int& m) : m_mode (m) {}; protected: int& m_mode; }; class B1Factory { public: B1 Make () const { return B1(); } }; cla...
26,980,758
Probably the question title is nonsensical so let me explain what I am trying to do! I have this template class ``` template <class TBase> class A : public TBase { public: A() { /* some initialization */ } }; ``` the "inner" class can be either of these 2: ``` class B1 {// no constructor required }; class B2 { ...
2014/11/17
[ "https://Stackoverflow.com/questions/26980758", "https://Stackoverflow.com", "https://Stackoverflow.com/users/272325/" ]
All sub-object must be constructible in the manner selected by your derived constructor, and all must have an accessible destructor. Any sub-object neither explicitly constructed in the ctor-init-list nor by an in-class initializer will be default-constructed. (Which is forbidden for references.) Thus, your `B2` n...
No big deal, B can have two constructors: ``` template <class TBase> class A : public TBase { public: A() { /* some initialization */ } A(int & ri) : TBase(ri) { /* some other initialization */ } }; ``` Unused members just aren't instantiated. Of course, you get a compile time error if you use the wrong ctor.
26,980,758
Probably the question title is nonsensical so let me explain what I am trying to do! I have this template class ``` template <class TBase> class A : public TBase { public: A() { /* some initialization */ } }; ``` the "inner" class can be either of these 2: ``` class B1 {// no constructor required }; class B2 { ...
2014/11/17
[ "https://Stackoverflow.com/questions/26980758", "https://Stackoverflow.com", "https://Stackoverflow.com/users/272325/" ]
You could specialize `A`: ``` class B1 { }; class B2 { public: B2 (int& m) : m_mode (m) {}; protected: int& m_mode; }; template <class TBase> class A; template <> class A <B2> : public B2 { public: A(int& m) : B2 (m) {} }; template <class TBase> class A : public TBase { public: A() : TBase () {}; }; int...
In many cases, depending on how complex the base classes are and how many specializations you would end up needing, I'd prefer to use a class factory: ``` class B1 { }; class B2 { public: B2 (int& m) : m_mode (m) {}; protected: int& m_mode; }; class B1Factory { public: B1 Make () const { return B1(); } }; cla...
26,980,758
Probably the question title is nonsensical so let me explain what I am trying to do! I have this template class ``` template <class TBase> class A : public TBase { public: A() { /* some initialization */ } }; ``` the "inner" class can be either of these 2: ``` class B1 {// no constructor required }; class B2 { ...
2014/11/17
[ "https://Stackoverflow.com/questions/26980758", "https://Stackoverflow.com", "https://Stackoverflow.com/users/272325/" ]
You could specialize `A`: ``` class B1 { }; class B2 { public: B2 (int& m) : m_mode (m) {}; protected: int& m_mode; }; template <class TBase> class A; template <> class A <B2> : public B2 { public: A(int& m) : B2 (m) {} }; template <class TBase> class A : public TBase { public: A() : TBase () {}; }; int...
No big deal, B can have two constructors: ``` template <class TBase> class A : public TBase { public: A() { /* some initialization */ } A(int & ri) : TBase(ri) { /* some other initialization */ } }; ``` Unused members just aren't instantiated. Of course, you get a compile time error if you use the wrong ctor.
26,980,758
Probably the question title is nonsensical so let me explain what I am trying to do! I have this template class ``` template <class TBase> class A : public TBase { public: A() { /* some initialization */ } }; ``` the "inner" class can be either of these 2: ``` class B1 {// no constructor required }; class B2 { ...
2014/11/17
[ "https://Stackoverflow.com/questions/26980758", "https://Stackoverflow.com", "https://Stackoverflow.com/users/272325/" ]
Here is my C++11 approach, using variadic templates ``` template <typename TBase, typename... Args> class A : public TBase { public: A(Args... args): TBase(args...) { /* some initialization */ } }; class B1 {// no constructor required }; class B2 { public: B2(int& m) : m_mode(m) { } protected: int& m_mode; };...
In many cases, depending on how complex the base classes are and how many specializations you would end up needing, I'd prefer to use a class factory: ``` class B1 { }; class B2 { public: B2 (int& m) : m_mode (m) {}; protected: int& m_mode; }; class B1Factory { public: B1 Make () const { return B1(); } }; cla...
26,980,758
Probably the question title is nonsensical so let me explain what I am trying to do! I have this template class ``` template <class TBase> class A : public TBase { public: A() { /* some initialization */ } }; ``` the "inner" class can be either of these 2: ``` class B1 {// no constructor required }; class B2 { ...
2014/11/17
[ "https://Stackoverflow.com/questions/26980758", "https://Stackoverflow.com", "https://Stackoverflow.com/users/272325/" ]
Here is my C++11 approach, using variadic templates ``` template <typename TBase, typename... Args> class A : public TBase { public: A(Args... args): TBase(args...) { /* some initialization */ } }; class B1 {// no constructor required }; class B2 { public: B2(int& m) : m_mode(m) { } protected: int& m_mode; };...
No big deal, B can have two constructors: ``` template <class TBase> class A : public TBase { public: A() { /* some initialization */ } A(int & ri) : TBase(ri) { /* some other initialization */ } }; ``` Unused members just aren't instantiated. Of course, you get a compile time error if you use the wrong ctor.
23,311,690
In a Zend application with an example url like this one: ``` http://example.com/profile/423423(some id) ``` How do I get param from url? I try to use: ``` $this->getRequest()->getParam('action'); ``` But I get action does not exist. then I try something like this: ``` protected function _initRouter() { $ro...
2014/04/26
[ "https://Stackoverflow.com/questions/23311690", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3571514/" ]
I have a concern named "Concerns::CoursePhotoable". Here's the two models that include it: ``` > ActiveRecord::Base.descendants.select{|c| \ c.included_modules.include?(Concerns::CoursePhotoable)}.map(&:name) => ["Course", "ProviderCourse"] ``` To clarify, my concern is really named "Concerns::CoursePhotoable"....
If it's your own Concern, you could add code to track when it's included: ``` require 'active_support/concern' module ChildTrackable extend ActiveSupport::Concern # keep track of what classes have included this concern: module Children extend self @included_in ||= [] def add(klass) @included...
32,817,027
I have arrays such as ``` var arrayVal_Int = ["21", "53", "92", "79"]; var arrayVal_Alpha = ["John", "Christine", "Lucy"]; var arrayVal_AlphaNumeric = ["CT504", "AP308", "NK675"]; ``` * Above `arrayVal_Int` should be considered as (purely) numeric. * `arrayVal_Alpha` and `arrayVal_AlphaNumeric` should be consid...
2015/09/28
[ "https://Stackoverflow.com/questions/32817027", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2361134/" ]
Shortest solution, evals to `true` if and only if every item is (coercible to) a number: ``` !yourArray.some(isNaN) ```
Using simple JavaScript, you can do something like this: ``` var IsNumericString = ["21","53","92","79"].filter(function(i){ return isNaN(i); }).length > 0; ``` It will return true;
32,817,027
I have arrays such as ``` var arrayVal_Int = ["21", "53", "92", "79"]; var arrayVal_Alpha = ["John", "Christine", "Lucy"]; var arrayVal_AlphaNumeric = ["CT504", "AP308", "NK675"]; ``` * Above `arrayVal_Int` should be considered as (purely) numeric. * `arrayVal_Alpha` and `arrayVal_AlphaNumeric` should be consid...
2015/09/28
[ "https://Stackoverflow.com/questions/32817027", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2361134/" ]
I had a similar need but wanted to verify if a list *contained only integers* (i.e., no decimals). Based on the above answers here's a way to do that, which I posting in case anyone needs a similar check. Thanks @Touffy, for your suggestion. ``` let x = [123, 234, 345]; let y = [123, 'invalid', 345]; let z = [123, 23...
Using simple JavaScript, you can do something like this: ``` var IsNumericString = ["21","53","92","79"].filter(function(i){ return isNaN(i); }).length > 0; ``` It will return true;
32,817,027
I have arrays such as ``` var arrayVal_Int = ["21", "53", "92", "79"]; var arrayVal_Alpha = ["John", "Christine", "Lucy"]; var arrayVal_AlphaNumeric = ["CT504", "AP308", "NK675"]; ``` * Above `arrayVal_Int` should be considered as (purely) numeric. * `arrayVal_Alpha` and `arrayVal_AlphaNumeric` should be consid...
2015/09/28
[ "https://Stackoverflow.com/questions/32817027", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2361134/" ]
Using simple JavaScript, you can do something like this: ``` var IsNumericString = ["21","53","92","79"].filter(function(i){ return isNaN(i); }).length > 0; ``` It will return true;
Try this: ``` let x = [1,3,46,7,7,8]; let y = [1,354,"fg",4]; let z = [1, 3, 4, 5, "3"]; isNaN(x.join("")) // false isNaN(y.join("")) // true isNaN(z.join("")) // false ```
32,817,027
I have arrays such as ``` var arrayVal_Int = ["21", "53", "92", "79"]; var arrayVal_Alpha = ["John", "Christine", "Lucy"]; var arrayVal_AlphaNumeric = ["CT504", "AP308", "NK675"]; ``` * Above `arrayVal_Int` should be considered as (purely) numeric. * `arrayVal_Alpha` and `arrayVal_AlphaNumeric` should be consid...
2015/09/28
[ "https://Stackoverflow.com/questions/32817027", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2361134/" ]
Shortest solution, evals to `true` if and only if every item is (coercible to) a number: ``` !yourArray.some(isNaN) ```
I had a similar need but wanted to verify if a list *contained only integers* (i.e., no decimals). Based on the above answers here's a way to do that, which I posting in case anyone needs a similar check. Thanks @Touffy, for your suggestion. ``` let x = [123, 234, 345]; let y = [123, 'invalid', 345]; let z = [123, 23...
32,817,027
I have arrays such as ``` var arrayVal_Int = ["21", "53", "92", "79"]; var arrayVal_Alpha = ["John", "Christine", "Lucy"]; var arrayVal_AlphaNumeric = ["CT504", "AP308", "NK675"]; ``` * Above `arrayVal_Int` should be considered as (purely) numeric. * `arrayVal_Alpha` and `arrayVal_AlphaNumeric` should be consid...
2015/09/28
[ "https://Stackoverflow.com/questions/32817027", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2361134/" ]
Shortest solution, evals to `true` if and only if every item is (coercible to) a number: ``` !yourArray.some(isNaN) ```
Try this: ``` let x = [1,3,46,7,7,8]; let y = [1,354,"fg",4]; let z = [1, 3, 4, 5, "3"]; isNaN(x.join("")) // false isNaN(y.join("")) // true isNaN(z.join("")) // false ```
32,817,027
I have arrays such as ``` var arrayVal_Int = ["21", "53", "92", "79"]; var arrayVal_Alpha = ["John", "Christine", "Lucy"]; var arrayVal_AlphaNumeric = ["CT504", "AP308", "NK675"]; ``` * Above `arrayVal_Int` should be considered as (purely) numeric. * `arrayVal_Alpha` and `arrayVal_AlphaNumeric` should be consid...
2015/09/28
[ "https://Stackoverflow.com/questions/32817027", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2361134/" ]
I had a similar need but wanted to verify if a list *contained only integers* (i.e., no decimals). Based on the above answers here's a way to do that, which I posting in case anyone needs a similar check. Thanks @Touffy, for your suggestion. ``` let x = [123, 234, 345]; let y = [123, 'invalid', 345]; let z = [123, 23...
Try this: ``` let x = [1,3,46,7,7,8]; let y = [1,354,"fg",4]; let z = [1, 3, 4, 5, "3"]; isNaN(x.join("")) // false isNaN(y.join("")) // true isNaN(z.join("")) // false ```
179,889
I am planning to install prefinished solid 3 1/4" wide by 3/4" thick ash hardwood in my home using 2" cleats. I live in Canada, so the average indoor humidity difference between winter and summer is quite high, maybe 50%. I don't use air-con in the summer. It is early December now, so I expect each board to expand in w...
2019/12/07
[ "https://diy.stackexchange.com/questions/179889", "https://diy.stackexchange.com", "https://diy.stackexchange.com/users/109878/" ]
Do NOT install expansion spaces between each board. You want a very tight fit between each board and then leave an expansion space around the perimeter of each room. First you’ll need to acclimate the wood to your house. This may vary by location and season, but generally the manufacturers recommend about 10 days. ...
Wood gives, and takes.... In my opinion, wood will compress when needed. Picture a hammer striking a board and leaving a mark, it compresses. This is quite the exaggeration, but for a point. The wood in the center of your floor, held in place by all the other nails surrounding it will compress. Although I do not know ...
44,681,595
I would like to test simple angular component with input. So an example in the bottom has little preparation for the test, and in a component should occur `test` function on blur, which shows log, but I have no logs in console. I tried 2 cases: getting div native element and click it and use `blur()` function for inpu...
2017/06/21
[ "https://Stackoverflow.com/questions/44681595", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5264317/" ]
You can use `dispatchEvent` to emulate a blur: ``` inp.dispatchEvent(new Event('blur')); ```
Use ``` dispatchFakeEvent(inp, 'blur'); ``` and here is dispatchFakeEvent: ``` export function createFakeEvent(type: string) { const event = document.createEvent('Event'); event.initEvent(type, true, true); return event; } export function dispatchFakeEvent(node: Node | Window, type: string) { node.dispatchEv...
55,789,760
I want to find out how long a person has been a customer. I mean I simply want to subtract current date from start date. However I can't understand what I am doing wrong. ``` customerStartDate: String; currentDate: any = ''; this.customerStartDate = this.sampleData1.customerStartDate; this.currentDate = new Date()...
2019/04/22
[ "https://Stackoverflow.com/questions/55789760", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8880204/" ]
First, you should convert `customerStartDate` to a [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) object: ``` this.customerStartDate = new Date(this.sampleData1.customerStartDate); ``` Then, you get the difference between today's date and `customerStartDate`, which w...
``` customerStartDate: any; currentDate: any; this.customerStartDate = this.sampleData1.customerStartDate; this.currentDate = new Date(); // Get Customer Age in Days var diff=this.currentDate.getTime() - new Date(this.customerStartDate).getTime() ...
59,139,618
In a class component when the state or props was changed the render method will execute, but I don't know in a functional component when the same happens which part of the code is rerendered?
2019/12/02
[ "https://Stackoverflow.com/questions/59139618", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8740387/" ]
If you have some expensive calculation inside your component that you want to skip, you can use the [useMemo hook](https://reactjs.org/docs/hooks-reference.html#usememo). It will do the calculation the first time, and then on subesequent times it will only recalculate if one of the dependencies change. For example: ``...
If your function component renders the same result given the same props, you can use `React.memo`. Similarly for class component React provides [PureComponent](https://reactjs.org/docs/react-api.html#reactpurecomponent). It is mentioned in [React doc](https://reactjs.org/docs/react-api.html#reactmemo): > > If your f...
15,356,290
Hi I have updated the code to have 2 divs with different sizes. They need to switch positions with animation using css floats. please see the code so far - <http://jsfiddle.net/jz5VW/> ``` jQuery(function () { jQuery('#switch').click(function () { jQuery('#one').animate({ left: jQuery("#two")....
2013/03/12
[ "https://Stackoverflow.com/questions/15356290", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2074917/" ]
This will do a trick: ``` $("#switch").on("click", function () { $(".square").each(function () { var floatEl = ($(this).css("float") == "left") ? "right" : "left"; $(this).css("float", floatEl); }); }); ``` [Example](http://jsfiddle.net/U6ADe/2/) [Example with animation](http://jsfiddle.net/...
**Switching Float Values:** There can be multiple way to do this. Check JQuery `removeClass(...)`, `addClass(...)` documentation on [JQuery Website](http://api.jquery.com) You can also check the `css(...,...)` method documentation on the same website to achieve this. To animate the divs, check the answer [here](https...
15,356,290
Hi I have updated the code to have 2 divs with different sizes. They need to switch positions with animation using css floats. please see the code so far - <http://jsfiddle.net/jz5VW/> ``` jQuery(function () { jQuery('#switch').click(function () { jQuery('#one').animate({ left: jQuery("#two")....
2013/03/12
[ "https://Stackoverflow.com/questions/15356290", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2074917/" ]
For a switch with transition animation you can use this snipped: ``` $(function() { $('#switch').click(function() { $('#one').animate({left:$("#two").offset().left}); $('#two').animate({right:$("#two").offset().left}); }); }); ``` [jsfiddel](http://jsfiddle.net/U6ADe/9/) you just have to keep in ...
This will do a trick: ``` $("#switch").on("click", function () { $(".square").each(function () { var floatEl = ($(this).css("float") == "left") ? "right" : "left"; $(this).css("float", floatEl); }); }); ``` [Example](http://jsfiddle.net/U6ADe/2/) [Example with animation](http://jsfiddle.net/...
15,356,290
Hi I have updated the code to have 2 divs with different sizes. They need to switch positions with animation using css floats. please see the code so far - <http://jsfiddle.net/jz5VW/> ``` jQuery(function () { jQuery('#switch').click(function () { jQuery('#one').animate({ left: jQuery("#two")....
2013/03/12
[ "https://Stackoverflow.com/questions/15356290", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2074917/" ]
This will do a trick: ``` $("#switch").on("click", function () { $(".square").each(function () { var floatEl = ($(this).css("float") == "left") ? "right" : "left"; $(this).css("float", floatEl); }); }); ``` [Example](http://jsfiddle.net/U6ADe/2/) [Example with animation](http://jsfiddle.net/...
Take a look at jquery .animate() This isn't pretty, and you will need to use dynamic values for the shift. [Simple dummy animation](http://jsfiddle.net/U6ADe/12/) ``` $('#switch').on("click", function () { $('#one').animate({ right: '-=500', }, 5000, function() {}) $('#two').animate({ ...
15,356,290
Hi I have updated the code to have 2 divs with different sizes. They need to switch positions with animation using css floats. please see the code so far - <http://jsfiddle.net/jz5VW/> ``` jQuery(function () { jQuery('#switch').click(function () { jQuery('#one').animate({ left: jQuery("#two")....
2013/03/12
[ "https://Stackoverflow.com/questions/15356290", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2074917/" ]
For a switch with transition animation you can use this snipped: ``` $(function() { $('#switch').click(function() { $('#one').animate({left:$("#two").offset().left}); $('#two').animate({right:$("#two").offset().left}); }); }); ``` [jsfiddel](http://jsfiddle.net/U6ADe/9/) you just have to keep in ...
**Switching Float Values:** There can be multiple way to do this. Check JQuery `removeClass(...)`, `addClass(...)` documentation on [JQuery Website](http://api.jquery.com) You can also check the `css(...,...)` method documentation on the same website to achieve this. To animate the divs, check the answer [here](https...
15,356,290
Hi I have updated the code to have 2 divs with different sizes. They need to switch positions with animation using css floats. please see the code so far - <http://jsfiddle.net/jz5VW/> ``` jQuery(function () { jQuery('#switch').click(function () { jQuery('#one').animate({ left: jQuery("#two")....
2013/03/12
[ "https://Stackoverflow.com/questions/15356290", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2074917/" ]
For a switch with transition animation you can use this snipped: ``` $(function() { $('#switch').click(function() { $('#one').animate({left:$("#two").offset().left}); $('#two').animate({right:$("#two").offset().left}); }); }); ``` [jsfiddel](http://jsfiddle.net/U6ADe/9/) you just have to keep in ...
Take a look at jquery .animate() This isn't pretty, and you will need to use dynamic values for the shift. [Simple dummy animation](http://jsfiddle.net/U6ADe/12/) ``` $('#switch').on("click", function () { $('#one').animate({ right: '-=500', }, 5000, function() {}) $('#two').animate({ ...
5,047,075
I have a wiki-type app where an administrator can create pages. Each page must be put into the menu system, which is created on-the-fly by the administrator ``` Menu Heading L Subheading L Page1 ``` However, there may be more pages for the menu such as: ``` Menu Heading L Subheading L Page1 L New Subheading ...
2011/02/18
[ "https://Stackoverflow.com/questions/5047075", "https://Stackoverflow.com", "https://Stackoverflow.com/users/623848/" ]
Well use a [hierarchical schema](http://mikehillyer.com/articles/managing-hierarchical-data-in-mysql/), add a sort order to each item and that's it.
A table structured as follows should do it. > > MenuItemId | ParentId | Order | Content > > > ``` TopLevelItem1 (MenuItemId: 1) | |-> MenuItem2 (ParentId: 1, Order 1) |-> MenuItem3 (ParentId: 2, Order 2) TopLevelItem2 (MenuItemId: 4) | |-> MenuItem4 (ParentId: 4, Order 1) ``` Etc.. Inserting items should...
5,047,075
I have a wiki-type app where an administrator can create pages. Each page must be put into the menu system, which is created on-the-fly by the administrator ``` Menu Heading L Subheading L Page1 ``` However, there may be more pages for the menu such as: ``` Menu Heading L Subheading L Page1 L New Subheading ...
2011/02/18
[ "https://Stackoverflow.com/questions/5047075", "https://Stackoverflow.com", "https://Stackoverflow.com/users/623848/" ]
The easiest way to accomplishing a system which has parent -> child -> child... relations would be a tree. Where you use a setup which could look like this: ``` id | name | parent | tree_left | tree_right ----+-----------+--------+-----------+----------- 0 | root | NULL | 0 | 9 1 | child1 |...
A table structured as follows should do it. > > MenuItemId | ParentId | Order | Content > > > ``` TopLevelItem1 (MenuItemId: 1) | |-> MenuItem2 (ParentId: 1, Order 1) |-> MenuItem3 (ParentId: 2, Order 2) TopLevelItem2 (MenuItemId: 4) | |-> MenuItem4 (ParentId: 4, Order 1) ``` Etc.. Inserting items should...
5,047,075
I have a wiki-type app where an administrator can create pages. Each page must be put into the menu system, which is created on-the-fly by the administrator ``` Menu Heading L Subheading L Page1 ``` However, there may be more pages for the menu such as: ``` Menu Heading L Subheading L Page1 L New Subheading ...
2011/02/18
[ "https://Stackoverflow.com/questions/5047075", "https://Stackoverflow.com", "https://Stackoverflow.com/users/623848/" ]
Well use a [hierarchical schema](http://mikehillyer.com/articles/managing-hierarchical-data-in-mysql/), add a sort order to each item and that's it.
What you are looking for, is called recursion, here is related question [example](https://stackoverflow.com/questions/607052/hierarchical-recursion-menu-with-php-mysql), also I would recommend to read [this article](http://articles.sitepoint.com/print/hierarchical-data-database).
5,047,075
I have a wiki-type app where an administrator can create pages. Each page must be put into the menu system, which is created on-the-fly by the administrator ``` Menu Heading L Subheading L Page1 ``` However, there may be more pages for the menu such as: ``` Menu Heading L Subheading L Page1 L New Subheading ...
2011/02/18
[ "https://Stackoverflow.com/questions/5047075", "https://Stackoverflow.com", "https://Stackoverflow.com/users/623848/" ]
Well use a [hierarchical schema](http://mikehillyer.com/articles/managing-hierarchical-data-in-mysql/), add a sort order to each item and that's it.
Exactly what are you wanting to know? If you are interested in structure, check out [this article on hierarchical data](http://mikehillyer.com/articles/managing-hierarchical-data-in-mysql/) on the MySQL website.
5,047,075
I have a wiki-type app where an administrator can create pages. Each page must be put into the menu system, which is created on-the-fly by the administrator ``` Menu Heading L Subheading L Page1 ``` However, there may be more pages for the menu such as: ``` Menu Heading L Subheading L Page1 L New Subheading ...
2011/02/18
[ "https://Stackoverflow.com/questions/5047075", "https://Stackoverflow.com", "https://Stackoverflow.com/users/623848/" ]
The easiest way to accomplishing a system which has parent -> child -> child... relations would be a tree. Where you use a setup which could look like this: ``` id | name | parent | tree_left | tree_right ----+-----------+--------+-----------+----------- 0 | root | NULL | 0 | 9 1 | child1 |...
What you are looking for, is called recursion, here is related question [example](https://stackoverflow.com/questions/607052/hierarchical-recursion-menu-with-php-mysql), also I would recommend to read [this article](http://articles.sitepoint.com/print/hierarchical-data-database).
5,047,075
I have a wiki-type app where an administrator can create pages. Each page must be put into the menu system, which is created on-the-fly by the administrator ``` Menu Heading L Subheading L Page1 ``` However, there may be more pages for the menu such as: ``` Menu Heading L Subheading L Page1 L New Subheading ...
2011/02/18
[ "https://Stackoverflow.com/questions/5047075", "https://Stackoverflow.com", "https://Stackoverflow.com/users/623848/" ]
The easiest way to accomplishing a system which has parent -> child -> child... relations would be a tree. Where you use a setup which could look like this: ``` id | name | parent | tree_left | tree_right ----+-----------+--------+-----------+----------- 0 | root | NULL | 0 | 9 1 | child1 |...
Exactly what are you wanting to know? If you are interested in structure, check out [this article on hierarchical data](http://mikehillyer.com/articles/managing-hierarchical-data-in-mysql/) on the MySQL website.
57,524,210
Currently, i'm trying to understand observables. I'm using zen-observables. Following code is not doing what i expect. ``` import Observable from "zen-observable"; const foobar = []; Observable.from(foobar).subscribe(x => console.log(x)); foobar.push("test"); foobar.push("foobar"); setTimeout(() => { foobar.push...
2019/08/16
[ "https://Stackoverflow.com/questions/57524210", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3469153/" ]
You are using backslash characters '\' in your paths. While this is OK on the command line, it is (mostly) not correct in source code. The backslash character is used as escape character to change the meaning of the following character. In your case the trailing apostroph is escaped so that the path string is not close...
You are missing a single quote at the end of the line: ``` if choice == "1": print("Checking Files ... (The process wont take long !") os.chdir 'C:\Users\alexa\Desktop\Core_Files\Projects\S1mpl3 Antivirus\Check\Files\File_Check.vbs\ **<---here** menu() ```
57,524,210
Currently, i'm trying to understand observables. I'm using zen-observables. Following code is not doing what i expect. ``` import Observable from "zen-observable"; const foobar = []; Observable.from(foobar).subscribe(x => console.log(x)); foobar.push("test"); foobar.push("foobar"); setTimeout(() => { foobar.push...
2019/08/16
[ "https://Stackoverflow.com/questions/57524210", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3469153/" ]
You are using backslash characters '\' in your paths. While this is OK on the command line, it is (mostly) not correct in source code. The backslash character is used as escape character to change the meaning of the following character. In your case the trailing apostroph is escaped so that the path string is not close...
I have a similar problem while opening a directory. I used raw string and double backslashes and it works. Example: ```py os.chdir(r"C:\\Users\\alexa\Desktop\\Core_Files\\Projects\\S1mpl3Antivirus\\Check\\Files\\") ```
10,774,206
How does java.util.Date.getTime method convert a given date & time into long number? Java API documents say that - "Returns the number of milliseconds since January 1, 1970, 00:00:00 GMT represented by this Date object." Appreciate any help.
2012/05/27
[ "https://Stackoverflow.com/questions/10774206", "https://Stackoverflow.com", "https://Stackoverflow.com/users/734284/" ]
Check out the [Date.java](http://www.docjar.com/html/api/java/util/Date.java.html) source code. You'll see that in the simplest case, the `Date` object stores the number of milliseconds since 1970, rather than the date/time etc.
Actually, despite the apparently unambiguous definition in the Java API doc, it is interesting to note that the number of milliseconds reported is not the actual number of physical milliseconds, or seconds for that matter, that have elapsed since January 1st 1970 00:00:00 GMT. It is really the number of physical second...
37,738
I managed to install bazaar on slicehost - but I am not sure how to make the repository web accessible. Any suggestions?
2009/07/08
[ "https://serverfault.com/questions/37738", "https://serverfault.com", "https://serverfault.com/users/-1/" ]
For read-only repositories, you just need to put the directory containing the .bzr folder in a web-accessible directory. There is no web server module like subversion uses (though of course mod\_dav\_svn is what allows for read/write access over HTTP, which Bazaar does not do. You should create the directory in the we...
With ssh. You can do bzr command ssh://server.com/path/to/repo This happens automatically since ssh just works. Just setup keys and such so you can skip out on all passwords and such
5,070
I'm working on a plywood bunk bed for our two 4 year olds. Obviously I need it to look cool, but more importantly not collapse on their impressionable skulls. I plan on using 3/4 plywood (.706 or so) with 3/8" dowels and some pocket screws (as well as titebond). I don't want to over or under engineer it. The width an...
2016/12/04
[ "https://woodworking.stackexchange.com/questions/5070", "https://woodworking.stackexchange.com", "https://woodworking.stackexchange.com/users/3008/" ]
The easiest way to prevent racking would be to replace the slats at the head and foot of the mattress supports with a solid piece of plywood approx 1' wide that is solidly connected to the three sides of the bed frame it contacts. I would also suggest that the pocket screws could be replaced with solid dowels as well. ...
While this is a great design overall, I'd be a tiny bit concerned about the pocket screws resisting side to side racking. If you could make one (long) side out of a single sheet of ply, the other side could be pieced together. In place of pocket screws, you could probably find a strong mechanical connector -- one for...
5,070
I'm working on a plywood bunk bed for our two 4 year olds. Obviously I need it to look cool, but more importantly not collapse on their impressionable skulls. I plan on using 3/4 plywood (.706 or so) with 3/8" dowels and some pocket screws (as well as titebond). I don't want to over or under engineer it. The width an...
2016/12/04
[ "https://woodworking.stackexchange.com/questions/5070", "https://woodworking.stackexchange.com", "https://woodworking.stackexchange.com/users/3008/" ]
> > I plan on using 3/4 plywood (.706 or so) with 3/8" dowels and some pocket screws (as well as titebond). I don't want to over or under engineer it. > > > Actually you should seek to over-engineer this, or at least err on the side of stronger than you think you need, because it can't hurt given the dynamic force...
While this is a great design overall, I'd be a tiny bit concerned about the pocket screws resisting side to side racking. If you could make one (long) side out of a single sheet of ply, the other side could be pieced together. In place of pocket screws, you could probably find a strong mechanical connector -- one for...
5,070
I'm working on a plywood bunk bed for our two 4 year olds. Obviously I need it to look cool, but more importantly not collapse on their impressionable skulls. I plan on using 3/4 plywood (.706 or so) with 3/8" dowels and some pocket screws (as well as titebond). I don't want to over or under engineer it. The width an...
2016/12/04
[ "https://woodworking.stackexchange.com/questions/5070", "https://woodworking.stackexchange.com", "https://woodworking.stackexchange.com/users/3008/" ]
> > I plan on using 3/4 plywood (.706 or so) with 3/8" dowels and some pocket screws (as well as titebond). I don't want to over or under engineer it. > > > Actually you should seek to over-engineer this, or at least err on the side of stronger than you think you need, because it can't hurt given the dynamic force...
The easiest way to prevent racking would be to replace the slats at the head and foot of the mattress supports with a solid piece of plywood approx 1' wide that is solidly connected to the three sides of the bed frame it contacts. I would also suggest that the pocket screws could be replaced with solid dowels as well. ...
1,677,156
I am using the US default keyboard on Linux but sometimes need German special characters. I made my own version of the `us` file in the `usr/share/X11/xkb/symbols` folder that has the characters added. That works but always gets overwritten when there are updates. I saw that there is e.g. a "German, Swedish and Finnis...
2021/09/20
[ "https://superuser.com/questions/1677156", "https://superuser.com", "https://superuser.com/users/420337/" ]
You can use the free [AutoHotkey](https://www.autohotkey.com/). The following AutoHotkey script will use the following keys to modify the currently active window: * `Ctrl`+`F11` : remove minimize and maximize buttons, set the window to be always on top, start a timer to test if it's minimized and then restore it * `C...
It's not possible because the minimize button is shown and developed by the author of the app. But you can switch to tablet mode so that you can disable window minimizing, behaving like a tablet. It's even better if your device has touch capabilities. How to enable? ============== Go to Start -> Settings -> System ->...
18,762,995
You have interface. ``` public interface Group { public void assemble(); } ``` You have two classes that implements that interface. ``` public class Block implements Group { public void assemble() { System.out.println("Block"); } } public class Structure implements Group { // Collection of ...
2013/09/12
[ "https://Stackoverflow.com/questions/18762995", "https://Stackoverflow.com", "https://Stackoverflow.com/users/447163/" ]
You are **not** passing `ArrayList` you are passing `Structure`. `Structure` is no `ArrayList` it's a descendant of `Group` . And this structure has it's own `list` inside. With it's own implementation of `assemble()` method.
Because you use addAll method. You added a list to another list. Why did you confuse? ``` /** * Appends all of the elements in the specified collection to the end of * this list, in the order that they are returned by the * specified collection's Iterator. The behavior of this operation is * undefined if the ...
18,762,995
You have interface. ``` public interface Group { public void assemble(); } ``` You have two classes that implements that interface. ``` public class Block implements Group { public void assemble() { System.out.println("Block"); } } public class Structure implements Group { // Collection of ...
2013/09/12
[ "https://Stackoverflow.com/questions/18762995", "https://Stackoverflow.com", "https://Stackoverflow.com/users/447163/" ]
You are **not** passing `ArrayList` you are passing `Structure`. `Structure` is no `ArrayList` it's a descendant of `Group` . And this structure has it's own `list` inside. With it's own implementation of `assemble()` method.
The two examples do very different things. When you do ``` structure.add(structure1); ``` You've added two levels of hierarchy here because you added *structure1* `Group` at level one below the `structure` itself if you think of this as a tree. The `Block`s that belong to `structure1` are at level two here still att...
18,762,995
You have interface. ``` public interface Group { public void assemble(); } ``` You have two classes that implements that interface. ``` public class Block implements Group { public void assemble() { System.out.println("Block"); } } public class Structure implements Group { // Collection of ...
2013/09/12
[ "https://Stackoverflow.com/questions/18762995", "https://Stackoverflow.com", "https://Stackoverflow.com/users/447163/" ]
You are **not** passing `ArrayList` you are passing `Structure`. `Structure` is no `ArrayList` it's a descendant of `Group` . And this structure has it's own `list` inside. With it's own implementation of `assemble()` method.
Because you instantiate groups1 as an ArrayList. When you created a Structure this is not an ArrayList. I think what you "Could" be indicating is that you want do this: ``` public List<Group> groups = new ArrayList<Group>(); ``` Change the access modifier of the above to public. You will then be able to do som...
2,853,532
UPDATE (Added the code for the class that does the read/write) ``` <?php error_reporting(E_ALL); class dbSession { function dbSession($gc_maxlifetime = "", $gc_probability = "", $gc_divisor = "") { if ($gc_maxlifetime != "" && is_integer($gc_maxlifetime)) { @ini_set('session.gc_maxlifetime...
2010/05/17
[ "https://Stackoverflow.com/questions/2853532", "https://Stackoverflow.com", "https://Stackoverflow.com/users/249034/" ]
To access the session data on PHP you need session\_start before.
Look at the serialize() function, and consider using it before writing to the database; and the corresponding unserialize() when reading
13,972,194
I have a group of file input fields and I want all to be disabled except for the first one. When the first one is set (onchanged), the next file field is unlocked. How do I do this? I have tried: ``` $('#topperform input').change(function(){ $(this).next('label').css('color', 'red') ; }) ``` Which does nothing. ...
2012/12/20
[ "https://Stackoverflow.com/questions/13972194", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1320129/" ]
***[Check the working demo](http://jsfiddle.net/MVmr6/)***: ``` var inputs = $('#topperform').find('input'); inputs.not(':first').prop('disabled',true); inputs.change(function() { $(this).parent().next().find('input').prop('disabled', false); }); ```
``` $(this).parent().next('label').css('color', 'red'); ``` `$(this)` is the input, you need the next sibling of the input's parent (The label). **[Working sample](http://fiddle.jshell.net/N3R6v/)**
13,972,194
I have a group of file input fields and I want all to be disabled except for the first one. When the first one is set (onchanged), the next file field is unlocked. How do I do this? I have tried: ``` $('#topperform input').change(function(){ $(this).next('label').css('color', 'red') ; }) ``` Which does nothing. ...
2012/12/20
[ "https://Stackoverflow.com/questions/13972194", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1320129/" ]
***[Check the working demo](http://jsfiddle.net/MVmr6/)***: ``` var inputs = $('#topperform').find('input'); inputs.not(':first').prop('disabled',true); inputs.change(function() { $(this).parent().next().find('input').prop('disabled', false); }); ```
use css-classes to check current state of your entry. when you just set the class of your label elements to "disabled" (for example ;)) you remove this class from your label after editing the input field. and enable the next field by selecting it with: $('.disabled')
13,972,194
I have a group of file input fields and I want all to be disabled except for the first one. When the first one is set (onchanged), the next file field is unlocked. How do I do this? I have tried: ``` $('#topperform input').change(function(){ $(this).next('label').css('color', 'red') ; }) ``` Which does nothing. ...
2012/12/20
[ "https://Stackoverflow.com/questions/13972194", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1320129/" ]
***[Check the working demo](http://jsfiddle.net/MVmr6/)***: ``` var inputs = $('#topperform').find('input'); inputs.not(':first').prop('disabled',true); inputs.change(function() { $(this).parent().next().find('input').prop('disabled', false); }); ```
I suggest to add ids to the inputs (`f1` for the first...`f10` for the last). After that you can use this script: ``` $('#topperform input').attr('disabled', 'disabled'); $('#topperform input').change(function () { var id = parseInt(this.id.replace(/^f/, ''), 10); $('#f' + (id + 1)).removeAttr('disabled'); });...
13,972,194
I have a group of file input fields and I want all to be disabled except for the first one. When the first one is set (onchanged), the next file field is unlocked. How do I do this? I have tried: ``` $('#topperform input').change(function(){ $(this).next('label').css('color', 'red') ; }) ``` Which does nothing. ...
2012/12/20
[ "https://Stackoverflow.com/questions/13972194", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1320129/" ]
***[Check the working demo](http://jsfiddle.net/MVmr6/)***: ``` var inputs = $('#topperform').find('input'); inputs.not(':first').prop('disabled',true); inputs.change(function() { $(this).parent().next().find('input').prop('disabled', false); }); ```
HTML ``` <form id="topperform" method="post"> <label>Main image <input type="file"/></label> <label>2nd image <input type="file" disabled = "disabled" /></label> <label>3rd image <input type="file" disabled = "disabled" /></label> <label>4th image <input type="file" disabled = "disabled" /></label> <label>5th image <...
32,661,873
I'm using node v0.12.7 and want to stream directly from a database to the client (for file download). However, I am noticing a large memory footprint (and possible memory leak) when using streams. With express, I create an endpoint that simply pipes a readable stream to the response as follows: ```js app.post('/query...
2015/09/18
[ "https://Stackoverflow.com/questions/32661873", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1370556/" ]
It appears you are doing everything correctly. I copied your test case and am experiencing the same issue in v4.0.0. Taking it out of objectMode and using `JSON.stringify` on your object appeared to prevent both high memory and high cpu. That lead me to the built in `JSON.stringify` which appears to be the root of the ...
To me it looks like you are load testing multiple stream modules. That is a nice service to provide for the Node community, but you may also consider just caching the postgres data dump to a file, gzip, and serve a static file. Or maybe make your own Readable that uses a cursor and outputs CSV (as string/text).
32,661,873
I'm using node v0.12.7 and want to stream directly from a database to the client (for file download). However, I am noticing a large memory footprint (and possible memory leak) when using streams. With express, I create an endpoint that simply pipes a readable stream to the response as follows: ```js app.post('/query...
2015/09/18
[ "https://Stackoverflow.com/questions/32661873", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1370556/" ]
It appears you are doing everything correctly. I copied your test case and am experiencing the same issue in v4.0.0. Taking it out of objectMode and using `JSON.stringify` on your object appeared to prevent both high memory and high cpu. That lead me to the built in `JSON.stringify` which appears to be the root of the ...
Just try this before all: 1. Add [manual/explicit garbage collection calls](http://devjar.me/post/22886448979/manually-run-gc-in-nodejs) to your app, and 2. Add [heapdump](https://github.com/bnoordhuis/node-heapdump) `npm install heapdump` 3. Add code to clean garbage and dump the rest to find a leak: ``` var heapdum...
32,661,873
I'm using node v0.12.7 and want to stream directly from a database to the client (for file download). However, I am noticing a large memory footprint (and possible memory leak) when using streams. With express, I create an endpoint that simply pipes a readable stream to the response as follows: ```js app.post('/query...
2015/09/18
[ "https://Stackoverflow.com/questions/32661873", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1370556/" ]
**Update 2**: Here's a history of various Stream APIs: <https://medium.com/the-node-js-collection/a-brief-history-of-node-streams-pt-2-bcb6b1fd7468> 0.12 uses Streams 3. **Update**: This answer was true for old node.js streams. New Stream API has a mechanism to *pause* readable stream if writable stream can't keep u...
It appears you are doing everything correctly. I copied your test case and am experiencing the same issue in v4.0.0. Taking it out of objectMode and using `JSON.stringify` on your object appeared to prevent both high memory and high cpu. That lead me to the built in `JSON.stringify` which appears to be the root of the ...
32,661,873
I'm using node v0.12.7 and want to stream directly from a database to the client (for file download). However, I am noticing a large memory footprint (and possible memory leak) when using streams. With express, I create an endpoint that simply pipes a readable stream to the response as follows: ```js app.post('/query...
2015/09/18
[ "https://Stackoverflow.com/questions/32661873", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1370556/" ]
It appears you are doing everything correctly. I copied your test case and am experiencing the same issue in v4.0.0. Taking it out of objectMode and using `JSON.stringify` on your object appeared to prevent both high memory and high cpu. That lead me to the built in `JSON.stringify` which appears to be the root of the ...
It's too easy to have a memory leak in Node.js Usually, it's a minor thing, like declaring variable after creating anonymous function or using a function argument inside a callback. But it makes a huge difference on closure context. Thus some variables can never be freed. [This article](https://auth0.com/blog/four-ty...