qid
int64
1
74.6M
question
stringlengths
45
24.2k
date
stringlengths
10
10
metadata
stringlengths
101
178
response_j
stringlengths
32
23.2k
response_k
stringlengths
21
13.2k
39,099,218
[![enter image description here](https://i.stack.imgur.com/PKlCN.png)](https://i.stack.imgur.com/PKlCN.png)I am using yii2 framework since last few weeks. But now I am getting some issues with composer itself. Just for info, I am using ubuntu 14.04 When I require some new package / extensions, I do the composer add b...
2016/08/23
['https://Stackoverflow.com/questions/39099218', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/6608101/']
I had this problem few days ago to install a package but when I installed the package all the project updated and my project became broken.So I replace my last vendor again,So I found a safe way for better and safer upgrading packages: 1. archiving your vendor to a zip or rar file and copy composer.json too. 2. add pa...
To avoid uninstallation of other extensions just do following steps. ``` 1) "dmstr/yii2-adminlte-asset" : "2.*" 2) "2amigos/yii2-file-upload-widget": "~1.0" ``` to the require section of your composer.json file. ``` 2) php composer.phar update ``` run this command in Cmd.
65,466,881
I need to recreate the `printf` function for a school project. My current function works flawlessly, except if there are two arguments. If I do the following: `ft_printf("%c%c", 'a', 'b');` it will print `aa`, instead of `ab`. If I do the following: `ft_printf("%c%d", 't', 29);` it will not print `t29` like it's su...
2020/12/27
['https://Stackoverflow.com/questions/65466881', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/14608442/']
> > If I do the following: `ft_printf("%c%c", 'a', 'b');` > > > it will print aa, instead of ab. > > > If I do the following: `ft_printf("%c%d", 't', 29);` > > > it will not print t29 like it's supposed to. Instead, it will print t116 as it does detect that I would like to print an int, but doesn't use the right...
Use `switch() case` as in this simple example ``` int ts_formatstring(char *buf, const char *fmt, va_list va) { char *start_buf = buf; while(*fmt) { /* Character needs formating? */ if (*fmt == '%') { switch (*(++fmt)) { case 'c': ...
12,795
Related: [Finding Great Books at the Right Level](https://parenting.stackexchange.com/questions/6478/finding-great-books-at-the-right-level) Of course various books have generic maturity levels. But all children are different, and so are all books; so general guidelines aren't always useful - I frequently encounter co...
2014/05/31
['https://parenting.stackexchange.com/questions/12795', 'https://parenting.stackexchange.com', 'https://parenting.stackexchange.com/users/604/']
Check out your library! * Libraries have librarians who are trained to help with reader's advisory. In a big enough library, you will find the librarians read a lot of kids' books - the will ask your child questions about what they have liked in the past and what their interests are, and they will give customized reco...
I think the Commonsense Media site that @ThomasTaylor mentioned is suitable for getting a general opinion based on an **average** child, but in reality your best bet is going to just be to try them. Libraries and bookstores usually group them by age range, so choose the first book from a series in the general age rang...
12,795
Related: [Finding Great Books at the Right Level](https://parenting.stackexchange.com/questions/6478/finding-great-books-at-the-right-level) Of course various books have generic maturity levels. But all children are different, and so are all books; so general guidelines aren't always useful - I frequently encounter co...
2014/05/31
['https://parenting.stackexchange.com/questions/12795', 'https://parenting.stackexchange.com', 'https://parenting.stackexchange.com/users/604/']
Check out your library! * Libraries have librarians who are trained to help with reader's advisory. In a big enough library, you will find the librarians read a lot of kids' books - the will ask your child questions about what they have liked in the past and what their interests are, and they will give customized reco...
I am inclined to say the biggest factor for determining if a child is ready for a certain book is their interest level. There is little harm in allowing them to *try* the first couple of pages of a book. If the content interests them they may wish to continue with the story. If they are disinterested, they'll know it a...
12,795
Related: [Finding Great Books at the Right Level](https://parenting.stackexchange.com/questions/6478/finding-great-books-at-the-right-level) Of course various books have generic maturity levels. But all children are different, and so are all books; so general guidelines aren't always useful - I frequently encounter co...
2014/05/31
['https://parenting.stackexchange.com/questions/12795', 'https://parenting.stackexchange.com', 'https://parenting.stackexchange.com/users/604/']
Check out your library! * Libraries have librarians who are trained to help with reader's advisory. In a big enough library, you will find the librarians read a lot of kids' books - the will ask your child questions about what they have liked in the past and what their interests are, and they will give customized reco...
I sometimes put aside books which I didn't think my children should have read (like a cute "middle age" where-is-charlie-kind of book, with explicit torture tools... for preschooler age O\_o). And then found out that anyway they would have not been shocked by the content. Children adapt themselves, if something is out ...
44,812,906
The general problem =================== I am trying to understand how to prevent the existence of some pattern before or after a sought-out pattern when writing regex's! A more specific example ======================= I'm looking for a regex that will match dates in the format YYMMDD (`(([0-9]{2})(0[1-9]|1[0-2])(0[1...
2017/06/28
['https://Stackoverflow.com/questions/44812906', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3017323/']
Try: ``` #!/usr/bin/env bash extract_date() { local string="$1" local _date=`echo "$string" | sed -E 's/.*[^0-9]([0-9]{6})[^0-9].*/\1/'` #date -d $_date &> /dev/null # for Linux date -jf '%y%m%d' $_date &> /dev/null # for MacOS if [ $? -eq 0 ]; then echo $_date else return 1 ...
If your tokens are line-separated (i.e. there is only one token per line): ``` ^[\D]*[\d]{6}([\D]*|[\D]+[\d]{1,6})$ ``` Basically, this regex looks for: * Any number of non-digits at the beginning of the string; * Exactly 6 digits * Any number of non-digits until the end OR at least one non-digit and at least one d...
44,812,906
The general problem =================== I am trying to understand how to prevent the existence of some pattern before or after a sought-out pattern when writing regex's! A more specific example ======================= I'm looking for a regex that will match dates in the format YYMMDD (`(([0-9]{2})(0[1-9]|1[0-2])(0[1...
2017/06/28
['https://Stackoverflow.com/questions/44812906', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3017323/']
Try: ``` #!/usr/bin/env bash extract_date() { local string="$1" local _date=`echo "$string" | sed -E 's/.*[^0-9]([0-9]{6})[^0-9].*/\1/'` #date -d $_date &> /dev/null # for Linux date -jf '%y%m%d' $_date &> /dev/null # for MacOS if [ $? -eq 0 ]; then echo $_date else return 1 ...
You could use non-capturing groups to define non-digits either side of your date Regex. I had success with this expression and your same test data. ``` (?:\D)([0-9]{2})(0[1-9]|1[0-2])(0[1-9]|[1-2][0-9]|3[0-1])(?:\D) ```
12,672,951
I want to lock my **camera view** to "**Landscape**" mode.When I click on the simple button in my app, that time device's camera will open and and that **camera should be locked** to "**Landscape mode**". Can anyone know the solution of this problem? I am using this code inside "CaptureImageActivity.java" activity. So...
2012/10/01
['https://Stackoverflow.com/questions/12672951', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1711713/']
Add this into your activity inside manifest file ``` android:screenOrientation="portrait" ```
``` By using setCameraDisplayOrientation= public static void setCameraDisplayOrientation(Activity activity, int cameraId, android.hardware.Camera camera) { android.hardware.Camera.CameraInfo info = new android.hardware.Camera.CameraInfo(); android.hardware.Camera.getCameraInfo(cameraId, ...
12,672,951
I want to lock my **camera view** to "**Landscape**" mode.When I click on the simple button in my app, that time device's camera will open and and that **camera should be locked** to "**Landscape mode**". Can anyone know the solution of this problem? I am using this code inside "CaptureImageActivity.java" activity. So...
2012/10/01
['https://Stackoverflow.com/questions/12672951', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1711713/']
see this link to lock your camera orientation,use `setDisplayOrientation (int degrees)` documentation can be found on following link : <http://developer.android.com/reference/android/hardware/Camera.html#setDisplayOrientation%28int%29> for more details see this answer : [How to set Android camera orientation proper...
``` By using setCameraDisplayOrientation= public static void setCameraDisplayOrientation(Activity activity, int cameraId, android.hardware.Camera camera) { android.hardware.Camera.CameraInfo info = new android.hardware.Camera.CameraInfo(); android.hardware.Camera.getCameraInfo(cameraId, ...
10,172,336
How can I install this theme <http://simplyhacking.com/spacedust-xcode-theme-for-xcode-4.html> on XCode 4.3.2?
2012/04/16
['https://Stackoverflow.com/questions/10172336', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/631792/']
Download that Spacedust.dvtcolortheme and save it under: ``` ~/Library/Developer/Xcode/UserData/FontAndColorThemes ``` It might be that this folder doesn't exist yet if you never copied an existing Colortheme in the preferences of Xcode. In that case: simply create that directory. Then restart Xcode.
I wanted to add one more little information that after adding the theme to FontAndColorThemes folder and restarting xcode4, go to Fonts & Colors. you should see it under : > > Preferences -> Fonts & Colors. > > > select your theme and enjoy the theme. ref : <http://superqichi.com/add-new-theme-to-xcode-4>
10,172,336
How can I install this theme <http://simplyhacking.com/spacedust-xcode-theme-for-xcode-4.html> on XCode 4.3.2?
2012/04/16
['https://Stackoverflow.com/questions/10172336', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/631792/']
Download that Spacedust.dvtcolortheme and save it under: ``` ~/Library/Developer/Xcode/UserData/FontAndColorThemes ``` It might be that this folder doesn't exist yet if you never copied an existing Colortheme in the preferences of Xcode. In that case: simply create that directory. Then restart Xcode.
ThemeInstaller is an easy app for installing themes in Xcode. Having ThemeInstaller all you need to do is to open an .dvtcolortheme, or go to codethemes.net and press "install" under any of your choice. In Xcode you need to press "cmd" + "," and there you have all of your installed themes.
10,172,336
How can I install this theme <http://simplyhacking.com/spacedust-xcode-theme-for-xcode-4.html> on XCode 4.3.2?
2012/04/16
['https://Stackoverflow.com/questions/10172336', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/631792/']
I wanted to add one more little information that after adding the theme to FontAndColorThemes folder and restarting xcode4, go to Fonts & Colors. you should see it under : > > Preferences -> Fonts & Colors. > > > select your theme and enjoy the theme. ref : <http://superqichi.com/add-new-theme-to-xcode-4>
ThemeInstaller is an easy app for installing themes in Xcode. Having ThemeInstaller all you need to do is to open an .dvtcolortheme, or go to codethemes.net and press "install" under any of your choice. In Xcode you need to press "cmd" + "," and there you have all of your installed themes.
1,522,677
How to add outlook custom fields in ms access? Example: ``` Set objOutlook = CreateObject("Outlook.Application") Set item = objOutlook.CreateItem(2) Set nms = objOutlook.GetNamespace("MAPI") Set fldContacts = nms.GetDefaultFolder(10) Set itms = fldContacts.Items Set item = itms.Add item.FirstName = Me.Fir...
2009/10/05
['https://Stackoverflow.com/questions/1522677', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/154698/']
Underscore matches one character only. Is this what you're looking for? ``` LIKE '___ ___' ```
``` SELECT * FORM SomeTable WHERE Postal LIKE '___ ___' ``` Or even better, when you want to specify exact numbers-letters, you can do this: ``` SELECT * FORM SomeTable WHERE Postal LIKE '[a-z][a-z][a-z] [0-9][0-9][0-9]' ``` It depends of the type of code you want to get.
12,058,016
I am attempting to set up an sftp server on ubuntu/precise on EC2. I have been successful in adding a new user that can connect via ssh, however once I add the following clause: ``` Match Group sftp ChrootDirectory /home/%u AllowTCPForwarding no X11Forwarding no ForceCommand internal-sftp ``` I can n...
2012/08/21
['https://Stackoverflow.com/questions/12058016', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/634621/']
Ok, solved the issue: 2 things were causing a problem 1. I had to move the "Match" Clause to the END of the file, it was in the middle 2. There was a permissions issue - found the answer elsewhere that fixed it from: <https://askubuntu.com/questions/134425/how-can-i-chroot-sftp-only-ssh-users-into-their-homes> "All...
Make sure that /home and /home/%u are chowned to root:root.
11,748,272
I'm trying to determine where a slowdown is occurring in my GPU code. I've verified that the code runs correctly on its own (it doesn't throw any errors, outputs are correct, finishes cleanly, etc). When I try to profile the code in Visual Profiler, it seems to run normally, dumping correct intermediate outputs to stdo...
2012/07/31
['https://Stackoverflow.com/questions/11748272', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/994259/']
When the visual profiler fails to generate a timeline it is typically because it cannot locate a component required for profiling. This component is a shared library found in /usr/local/cuda/lib64 called libcuinj.so. Is that path on your LD\_LIBRARY\_PATH? How are you launching the Visual Profiler? The script in /usr/l...
I don't know if it's the same under Linux, but in Nsight under Windows, there are two basic types of profiling that you can run. "Application trace" and "Profile". Only under Application trace do you get the timelines. Application trace records the timestamps when CUDA and kernel calls were made. The Profile setting of...
1,944,198
I'm given the problem where one can perform perfect shuffles (i.e. you split the deck into halves and then interweave them) on a deck of $52$ cards (both in and out shuffles) and I am supposed to determine whether all $52!$ possible deck orderings are possible through a composition of such shuffles. I know that given o...
2016/09/27
['https://math.stackexchange.com/questions/1944198', 'https://math.stackexchange.com', 'https://math.stackexchange.com/users/164995/']
Not an answer, just a suggestion. You have two permutations, and you want to find out if they generate the entire group of all permutations. If $a$ is one permutation, and $b$ is the other, then $ab^{-1}=(1\,27)(2\,28)(3\,29)\cdots(26\,52)$. We can see that $a$ and $c=ab^{-1}$ generates the same subgroup as $a$ and ...
Given an initial configuration of a deck of $52$ cards, perfectly shuffling them $52$ times will take you through exactly $52$ of the $52!$ permutations on the deck. In order to hit every one of them, you must perfectly shuffle the deck and then switch the top two cards before perfectly shuffling it again. Of course yo...
48,891,174
I have a normal Angular Material 2 DataTable with sort headers. All sort are headers work fine. Except for the one with an object as value. These doesn't sort at all. For example: ```html <!-- Project Column - This should sort!--> <ng-container matColumnDef="project.name"> <mat-header-cell *matHeaderCellD...
2018/02/20
['https://Stackoverflow.com/questions/48891174', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/7515302/']
It was hard to find documentation on this, but it is possible by using `sortingDataAccessor` and a switch statement. For example: ``` @ViewChild(MatSort) sort: MatSort; ngOnInit() { this.dataSource = new MatTableDataSource(yourData); this.dataSource.sortingDataAccessor = (item, property) => { switch(property)...
You can write a function in component to get deeply property from object. Then use it in `dataSource.sortingDataAccessor` like below ``` getProperty = (obj, path) => ( path.split('.').reduce((o, p) => o && o[p], obj) ) ngOnInit() { this.dataSource = new MatTableDataSource(yourData); this.dataSource.sortingDataA...
48,891,174
I have a normal Angular Material 2 DataTable with sort headers. All sort are headers work fine. Except for the one with an object as value. These doesn't sort at all. For example: ```html <!-- Project Column - This should sort!--> <ng-container matColumnDef="project.name"> <mat-header-cell *matHeaderCellD...
2018/02/20
['https://Stackoverflow.com/questions/48891174', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/7515302/']
I use a generic method which allows you to use a dot.seperated.path with `mat-sort-header` or `matColumnDef`. This fails silently returning undefined if it cannot find the property dictated by the path. ``` function pathDataAccessor(item: any, path: string): any { return path.split('.') .reduce((accumulator: any...
Another alternative, that no one threw out here, flatten the column first... ``` yourData.map((d) => d.flattenedName = d.project && d.project.name ? d.project.name : 'Not Specified'); this.dataSource = new MatTableDataSource(yourData); ``` Just another alternative, pr...
48,891,174
I have a normal Angular Material 2 DataTable with sort headers. All sort are headers work fine. Except for the one with an object as value. These doesn't sort at all. For example: ```html <!-- Project Column - This should sort!--> <ng-container matColumnDef="project.name"> <mat-header-cell *matHeaderCellD...
2018/02/20
['https://Stackoverflow.com/questions/48891174', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/7515302/']
Just add this to your data source and you will be able to access the nested object ``` this.dataSource.sortingDataAccessor = (item, property) => { // Split '.' to allow accessing property of nested object if (property.includes('.')) { const accessor = property.split('.'); let value: any = item;...
Another alternative, that no one threw out here, flatten the column first... ``` yourData.map((d) => d.flattenedName = d.project && d.project.name ? d.project.name : 'Not Specified'); this.dataSource = new MatTableDataSource(yourData); ``` Just another alternative, pr...
48,891,174
I have a normal Angular Material 2 DataTable with sort headers. All sort are headers work fine. Except for the one with an object as value. These doesn't sort at all. For example: ```html <!-- Project Column - This should sort!--> <ng-container matColumnDef="project.name"> <mat-header-cell *matHeaderCellD...
2018/02/20
['https://Stackoverflow.com/questions/48891174', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/7515302/']
Another alternative, that no one threw out here, flatten the column first... ``` yourData.map((d) => d.flattenedName = d.project && d.project.name ? d.project.name : 'Not Specified'); this.dataSource = new MatTableDataSource(yourData); ``` Just another alternative, pr...
It's trying to sort by element['project.name']. Obviously element doesn't have such a property. It should be easy to create a custom datasource that extends MatTableDatasource and supports sorting by nested object properties. Check out the examples in material.angular.io docs on using a custom source.
48,891,174
I have a normal Angular Material 2 DataTable with sort headers. All sort are headers work fine. Except for the one with an object as value. These doesn't sort at all. For example: ```html <!-- Project Column - This should sort!--> <ng-container matColumnDef="project.name"> <mat-header-cell *matHeaderCellD...
2018/02/20
['https://Stackoverflow.com/questions/48891174', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/7515302/']
It was hard to find documentation on this, but it is possible by using `sortingDataAccessor` and a switch statement. For example: ``` @ViewChild(MatSort) sort: MatSort; ngOnInit() { this.dataSource = new MatTableDataSource(yourData); this.dataSource.sortingDataAccessor = (item, property) => { switch(property)...
It's trying to sort by element['project.name']. Obviously element doesn't have such a property. It should be easy to create a custom datasource that extends MatTableDatasource and supports sorting by nested object properties. Check out the examples in material.angular.io docs on using a custom source.
48,891,174
I have a normal Angular Material 2 DataTable with sort headers. All sort are headers work fine. Except for the one with an object as value. These doesn't sort at all. For example: ```html <!-- Project Column - This should sort!--> <ng-container matColumnDef="project.name"> <mat-header-cell *matHeaderCellD...
2018/02/20
['https://Stackoverflow.com/questions/48891174', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/7515302/']
You can write a function in component to get deeply property from object. Then use it in `dataSource.sortingDataAccessor` like below ``` getProperty = (obj, path) => ( path.split('.').reduce((o, p) => o && o[p], obj) ) ngOnInit() { this.dataSource = new MatTableDataSource(yourData); this.dataSource.sortingDataA...
I customized for multiple nested object level. ``` this.dataSource.sortingDataAccessor = (data: any, sortHeaderId: string): string | number => { let value = null; if (sortHeaderId.includes('.')) { const ids = sortHeaderId.split('.'); value = data; ids.forEach(function (x) { value = ...
48,891,174
I have a normal Angular Material 2 DataTable with sort headers. All sort are headers work fine. Except for the one with an object as value. These doesn't sort at all. For example: ```html <!-- Project Column - This should sort!--> <ng-container matColumnDef="project.name"> <mat-header-cell *matHeaderCellD...
2018/02/20
['https://Stackoverflow.com/questions/48891174', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/7515302/']
I like @Hieu\_Nguyen solutions. I'll just add that if you use lodash in you project as I do then the solution translates to this: ``` import * as _ from 'lodash'; this.dataSource.sortingDataAccessor = _.get; ``` No need to reinvent the deep property access.
I customized for multiple nested object level. ``` this.dataSource.sortingDataAccessor = (data: any, sortHeaderId: string): string | number => { let value = null; if (sortHeaderId.includes('.')) { const ids = sortHeaderId.split('.'); value = data; ids.forEach(function (x) { value = ...
48,891,174
I have a normal Angular Material 2 DataTable with sort headers. All sort are headers work fine. Except for the one with an object as value. These doesn't sort at all. For example: ```html <!-- Project Column - This should sort!--> <ng-container matColumnDef="project.name"> <mat-header-cell *matHeaderCellD...
2018/02/20
['https://Stackoverflow.com/questions/48891174', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/7515302/']
The answer as given can even be shortened, no switch required, as long as you use the dot notation for the fields. ``` ngOnInit() { this.dataSource = new MatTableDataSource(yourData); this.dataSource.sortingDataAccessor = (item, property) => { if (property.includes('.')) return property.split('.').reduce((o,...
If you want to have an Angular material table with some extended features, like sorting for nested objects have a look at <https://github.com/mikelgo/ngx-mat-table-extensions/blob/master/libs/ngx-mat-table/README.md> . I created this lib because I was missing some features of mat-table out of the box. The advanced so...
48,891,174
I have a normal Angular Material 2 DataTable with sort headers. All sort are headers work fine. Except for the one with an object as value. These doesn't sort at all. For example: ```html <!-- Project Column - This should sort!--> <ng-container matColumnDef="project.name"> <mat-header-cell *matHeaderCellD...
2018/02/20
['https://Stackoverflow.com/questions/48891174', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/7515302/']
The answer as given can even be shortened, no switch required, as long as you use the dot notation for the fields. ``` ngOnInit() { this.dataSource = new MatTableDataSource(yourData); this.dataSource.sortingDataAccessor = (item, property) => { if (property.includes('.')) return property.split('.').reduce((o,...
Just add this to your data source and you will be able to access the nested object ``` this.dataSource.sortingDataAccessor = (item, property) => { // Split '.' to allow accessing property of nested object if (property.includes('.')) { const accessor = property.split('.'); let value: any = item;...
48,891,174
I have a normal Angular Material 2 DataTable with sort headers. All sort are headers work fine. Except for the one with an object as value. These doesn't sort at all. For example: ```html <!-- Project Column - This should sort!--> <ng-container matColumnDef="project.name"> <mat-header-cell *matHeaderCellD...
2018/02/20
['https://Stackoverflow.com/questions/48891174', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/7515302/']
Just add this to your data source and you will be able to access the nested object ``` this.dataSource.sortingDataAccessor = (item, property) => { // Split '.' to allow accessing property of nested object if (property.includes('.')) { const accessor = property.split('.'); let value: any = item;...
I had the same issue, by testing the first proposition I had some errors, I could fixe it by adding "switch (property)" ``` this.dataSource.sortingDataAccessor =(item, property) => { switch (property) { case 'project.name': return item.project.name; default: return item[property]; } }; ```
31,514
A neutron outside the nucleus lives for about 15 minutes and decays mainly through weak decays (beta decay). Many other weakly decaying particles decay with lifetimes between $10^{-10}$ and $10^{-12}$ seconds, which is consistent with $\alpha\_W \simeq 10^{-6}$. Why does the neutron lives so much longer than the other...
2012/07/07
['https://physics.stackexchange.com/questions/31514', 'https://physics.stackexchange.com', 'https://physics.stackexchange.com/users/1502/']
NB: I feel like this is a pretty half-assed job, and I apologize for that but having opened my mouth in the comments I guess I have to write *something* to back it up. --- We start with Fermi's golden rule for all transitions. The probability of the transition is $$ P\_{i\to f} = \frac{2\pi}{\hbar} \left|M\_{i,f}\rig...
As you correctly state, the neutron decay is an decay due to the weak interaction, these are quite a bit slower than other decays due the mass of the intermediate W boson, 81GeV, which slows the reaction, additionally the neutron decay only liberates a small amount of energy, around 1 MeV, it is the ratio of the libera...
31,514
A neutron outside the nucleus lives for about 15 minutes and decays mainly through weak decays (beta decay). Many other weakly decaying particles decay with lifetimes between $10^{-10}$ and $10^{-12}$ seconds, which is consistent with $\alpha\_W \simeq 10^{-6}$. Why does the neutron lives so much longer than the other...
2012/07/07
['https://physics.stackexchange.com/questions/31514', 'https://physics.stackexchange.com', 'https://physics.stackexchange.com/users/1502/']
NB: I feel like this is a pretty half-assed job, and I apologize for that but having opened my mouth in the comments I guess I have to write *something* to back it up. --- We start with Fermi's golden rule for all transitions. The probability of the transition is $$ P\_{i\to f} = \frac{2\pi}{\hbar} \left|M\_{i,f}\rig...
You can estimate the neutron lifetime using dimensional analysis. Beta decay is correctly described by the well known four-fermion Fermi theory, so the amplitude must be proportional to the coupling $G\_F\approx10^{-5}\text{GeV}^{-2}$ (the Fermi constant). The decay rate is proportional to the squared amplitude: $$\Ga...
31,514
A neutron outside the nucleus lives for about 15 minutes and decays mainly through weak decays (beta decay). Many other weakly decaying particles decay with lifetimes between $10^{-10}$ and $10^{-12}$ seconds, which is consistent with $\alpha\_W \simeq 10^{-6}$. Why does the neutron lives so much longer than the other...
2012/07/07
['https://physics.stackexchange.com/questions/31514', 'https://physics.stackexchange.com', 'https://physics.stackexchange.com/users/1502/']
You can estimate the neutron lifetime using dimensional analysis. Beta decay is correctly described by the well known four-fermion Fermi theory, so the amplitude must be proportional to the coupling $G\_F\approx10^{-5}\text{GeV}^{-2}$ (the Fermi constant). The decay rate is proportional to the squared amplitude: $$\Ga...
As you correctly state, the neutron decay is an decay due to the weak interaction, these are quite a bit slower than other decays due the mass of the intermediate W boson, 81GeV, which slows the reaction, additionally the neutron decay only liberates a small amount of energy, around 1 MeV, it is the ratio of the libera...
160,714
I have 2 numbers in 2 columns. I am trying to get ranges of numbers between those two numbers. For example, when I have 1330 in 1st column and 1335 in second column, I want this result: ``` 1330 1331 1332 1333 1334 1335 ``` My spreadsheet: [Range of number between two number google sheet](https://docs.google.com/sp...
2021/12/13
['https://webapps.stackexchange.com/questions/160714', 'https://webapps.stackexchange.com', 'https://webapps.stackexchange.com/users/276710/']
I wouldn't recommend placing your formula *below* your raw data columns, because it would prevent your raw data in Columns A and B from expanding downward. Instead place your results off to the right somewhere (or in another sheet). That said, based on the data in your sample spreadsheet, try first deleting everything...
You can get the sequence `1330 1331 1332 1333 1334 1335` like this: `=iferror( sequence(1, B3 - A3 + 1, A3), A3 )` Put that in cell `D3` and copy the cell down to `D3:D6`. The use this formula to get the final list: `=query( flatten(D3:I6), "where Col1 is not null", 0 )`
699,971
I used to use `overlayroot-chroot` in Ubuntu: <http://manpages.ubuntu.com/manpages/bionic/man8/overlayroot-chroot.8.html> But now that I have changed to Debian it is not there, and `sudo apt install overlayroot-chroot` does not find it. How does one get it for Debian?
2022/04/22
['https://unix.stackexchange.com/questions/699971', 'https://unix.stackexchange.com', 'https://unix.stackexchange.com/users/358674/']
You say, "... on my network ..." If you have access to the physical network layer, then yes, it is possible. Some managed switches have the ability to copy traffic destined for port X to Port Y. Another possibility, if the `tcpdump` host has multiple NICs, is to put the `tcpdump` host in between the other two hosts ...
Solution found probably. The syntax is correct, but modern switched networks (unlike the older with shared bus like the old good 10base2 or base5) don't send traffic out the switch port not connected to the destination MAC address, so tcpdump will show packets only from host connected directly.
18,804
First - this is a question directed towards advanced practitioners of mindfulness or similar meditation. I have been meditating and practicing other transformational work for about 17 years. Throughout the work, I've had many peak experiences, many "aha" moments, and I've experienced the deepening and expansiveness of...
2017/01/05
['https://buddhism.stackexchange.com/questions/18804', 'https://buddhism.stackexchange.com', 'https://buddhism.stackexchange.com/users/315/']
In meditation you get experience [Pīti](https://en.wikipedia.org/wiki/P%C4%ABti), [Sukha](https://en.wikipedia.org/wiki/Sukha), [Passaddhi](https://en.wikipedia.org/wiki/Passaddhi) which can be intense, pleasant and stubtle. If you dwell on these too much you get attached to them and crave to them, causing regression i...
The title and the question are a little different, but I'll try to address both. I think of meditation as a way to practice paying attention. When I meditate, I try to focus more on paying attention and less on whether the experience matches my expectations. Asking "What to expect from meditation?" is kind of like as...
18,804
First - this is a question directed towards advanced practitioners of mindfulness or similar meditation. I have been meditating and practicing other transformational work for about 17 years. Throughout the work, I've had many peak experiences, many "aha" moments, and I've experienced the deepening and expansiveness of...
2017/01/05
['https://buddhism.stackexchange.com/questions/18804', 'https://buddhism.stackexchange.com', 'https://buddhism.stackexchange.com/users/315/']
> > Is it just something to notice, and let pass? Is it a symptom of something and/or, is there anything to do about it? > > > Treat the object according to your practice, i.e. for Samatha meditation: * when mind wanders, bring it back to the breath. Vipassana meditation: * every object is treated in the sam...
The title and the question are a little different, but I'll try to address both. I think of meditation as a way to practice paying attention. When I meditate, I try to focus more on paying attention and less on whether the experience matches my expectations. Asking "What to expect from meditation?" is kind of like as...
18,804
First - this is a question directed towards advanced practitioners of mindfulness or similar meditation. I have been meditating and practicing other transformational work for about 17 years. Throughout the work, I've had many peak experiences, many "aha" moments, and I've experienced the deepening and expansiveness of...
2017/01/05
['https://buddhism.stackexchange.com/questions/18804', 'https://buddhism.stackexchange.com', 'https://buddhism.stackexchange.com/users/315/']
In meditation, you can consider these three: 1. Mental factors that you cultivate, a bit like a sportsman. For instance, mindfulness, alertness and concentration. 2. Experiences of yours (that are also mental factors, in fact) that indicate something about the quality of your mind. For instance, Prasrabhi indicate the...
The title and the question are a little different, but I'll try to address both. I think of meditation as a way to practice paying attention. When I meditate, I try to focus more on paying attention and less on whether the experience matches my expectations. Asking "What to expect from meditation?" is kind of like as...
65,195,952
I created this data frame: ``` Count <- c(1:10) Give <- c(0,0,5,0,0,5,0,5,0,5) X <- c(rep(0,10)) Y <- c(rep(0,10)) Z <- c(rep(0,10)) X_Target <- 5 Y_Target <- 10 Z_Target <- 5 ``` Basically I have 3 vectors (X,Y,Z) and a target for each one of them. I want to have a new calculation for X,Y and Z that based on the v...
2020/12/08
['https://Stackoverflow.com/questions/65195952', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/14686993/']
A `string` is not a single `rune`, it may contain multiple `runes`. You may use a simple type [conversion](https://golang.org/ref/spec#Conversions) to convert a `string` to a `[]runes` containing all its runes like `[]rune(sample)`. The `for range` iterates over the runes of a `string`, so in your example `runeValue` ...
Convert string to rune array: `runeArray := []rune("пример")`
16,086,943
According this [answer](https://stackoverflow.com/a/1570909/240564), it should be option "include files from the App\_data folder" when you publish ASP.NET application. But I don't see it: ![enter image description here](https://i.stack.imgur.com/qMr0h.png) Where it is?
2013/04/18
['https://Stackoverflow.com/questions/16086943', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/240564/']
I don't believe that option is in the newest of Visual Studio. Instead, you should be able to change the Build Action to "Content" by right-clicking on the files in Solution Explorer and clicking "Properties." This should then include them in the publishing process.
I used a After Build Target. To just create a empty folder on deploy. Add this to the end of The project file .csproj ``` <Target Name="CreateDirectories" AfterTargets="GatherAllFilesToPublish"> <MakeDir Directories="$(OutputPath)App_Data\"/> </Target> ```
16,086,943
According this [answer](https://stackoverflow.com/a/1570909/240564), it should be option "include files from the App\_data folder" when you publish ASP.NET application. But I don't see it: ![enter image description here](https://i.stack.imgur.com/qMr0h.png) Where it is?
2013/04/18
['https://Stackoverflow.com/questions/16086943', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/240564/']
I don't believe that option is in the newest of Visual Studio. Instead, you should be able to change the Build Action to "Content" by right-clicking on the files in Solution Explorer and clicking "Properties." This should then include them in the publishing process.
1. Manually Create the App\_Data folder under the published application's root folder 2. Right click at the App\_Data folder and select **Publish App\_Data folder**. 3. Add an item into the App\_Data folder and set the item to be include in the publish. <https://forums.asp.net/t/2126248.aspx?App_Data+folder+missing+in...
16,086,943
According this [answer](https://stackoverflow.com/a/1570909/240564), it should be option "include files from the App\_data folder" when you publish ASP.NET application. But I don't see it: ![enter image description here](https://i.stack.imgur.com/qMr0h.png) Where it is?
2013/04/18
['https://Stackoverflow.com/questions/16086943', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/240564/']
I used a After Build Target. To just create a empty folder on deploy. Add this to the end of The project file .csproj ``` <Target Name="CreateDirectories" AfterTargets="GatherAllFilesToPublish"> <MakeDir Directories="$(OutputPath)App_Data\"/> </Target> ```
1. Manually Create the App\_Data folder under the published application's root folder 2. Right click at the App\_Data folder and select **Publish App\_Data folder**. 3. Add an item into the App\_Data folder and set the item to be include in the publish. <https://forums.asp.net/t/2126248.aspx?App_Data+folder+missing+in...
5,397,598
a need how convert string value in field name valid: Example: > > <%="price.list\_"+current\_user.price.to\_s%> > > > so > > price.list\_1 > > > then is my real field name. this name.this field will use it to do more operations in my view.
2011/03/22
['https://Stackoverflow.com/questions/5397598', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/546530/']
I think I understood your question. You will need to use the send function ``` <%= price.send("list_#{current_user.price}".to_sym) %> ```
That should work but you can also do ``` <%= "price.list_#{current_user.price.to_s}" %> ``` **OR** ``` <p> price.list_<%= current_user.price.to_s %> </p> ``` **UPDATE:** I misunderstood the question. This is going to require some Javascript or AJAX, depending on your exact application. **JS:** ``` :onchange ...
721,705
The following snippet draws a gray square. ``` glColor3b(50, 50, 50); glBegin(GL_QUADS); glVertex3f(-1.0, +1.0, 0.0); // top left glVertex3f(-1.0, -1.0, 0.0); // bottom left glVertex3f(+1.0, -1.0, 0.0); // bottom right glVertex3f(+1.0, +1.0, 0.0); // top right glEnd(); ``` In my application, behind this single squa...
2009/04/06
['https://Stackoverflow.com/questions/721705', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/47775/']
glColor4f(float r,float g, float b, flaot alpha); (in your case maybe clColor4b) also make sure, that blending is enabled. (you have to reset the color to non-alpha afterwads, which might involve a glGet\* to save the old vertexcolor)
Use `glColor4` instead of `glColor3`. For example: ``` glBlendFunc(GL_SRC_ALPHA,GL_ONE); glColor4f(1.0f,1.0f,1.0f,0.5f); ```
721,705
The following snippet draws a gray square. ``` glColor3b(50, 50, 50); glBegin(GL_QUADS); glVertex3f(-1.0, +1.0, 0.0); // top left glVertex3f(-1.0, -1.0, 0.0); // bottom left glVertex3f(+1.0, -1.0, 0.0); // bottom right glVertex3f(+1.0, +1.0, 0.0); // top right glEnd(); ``` In my application, behind this single squa...
2009/04/06
['https://Stackoverflow.com/questions/721705', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/47775/']
In the init function, use these two lines: ``` glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); ``` And in your render function, ensure that `glColor4f` is used instead of `glColor3f`, and set the 4th argument to the level of opacity required. ``` glColor4f(1.0, 1.0, 1.0, 0.5); glBegin(GL_QUA...
glColor4f(float r,float g, float b, flaot alpha); (in your case maybe clColor4b) also make sure, that blending is enabled. (you have to reset the color to non-alpha afterwads, which might involve a glGet\* to save the old vertexcolor)
721,705
The following snippet draws a gray square. ``` glColor3b(50, 50, 50); glBegin(GL_QUADS); glVertex3f(-1.0, +1.0, 0.0); // top left glVertex3f(-1.0, -1.0, 0.0); // bottom left glVertex3f(+1.0, -1.0, 0.0); // bottom right glVertex3f(+1.0, +1.0, 0.0); // top right glEnd(); ``` In my application, behind this single squa...
2009/04/06
['https://Stackoverflow.com/questions/721705', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/47775/']
You can set colors per vertex ``` glBegin(GL_QUADS); glColor4f(1.0, 0.0, 0.0, 0.5); // red, 50% alpha glVertex3f(-1.0, +1.0, 0.0); // top left // Make sure to set the color back since the color state persists glVertex3f(-1.0, -1.0, 0.0); // bottom left glVertex3f(+1.0, -1.0, 0.0); // bottom right glVertex3f(+1.0, +1.0...
Use `glColor4` instead of `glColor3`. For example: ``` glBlendFunc(GL_SRC_ALPHA,GL_ONE); glColor4f(1.0f,1.0f,1.0f,0.5f); ```
721,705
The following snippet draws a gray square. ``` glColor3b(50, 50, 50); glBegin(GL_QUADS); glVertex3f(-1.0, +1.0, 0.0); // top left glVertex3f(-1.0, -1.0, 0.0); // bottom left glVertex3f(+1.0, -1.0, 0.0); // bottom right glVertex3f(+1.0, +1.0, 0.0); // top right glEnd(); ``` In my application, behind this single squa...
2009/04/06
['https://Stackoverflow.com/questions/721705', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/47775/']
In the init function, use these two lines: ``` glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); ``` And in your render function, ensure that `glColor4f` is used instead of `glColor3f`, and set the 4th argument to the level of opacity required. ``` glColor4f(1.0, 1.0, 1.0, 0.5); glBegin(GL_QUA...
Use `glColor4` instead of `glColor3`. For example: ``` glBlendFunc(GL_SRC_ALPHA,GL_ONE); glColor4f(1.0f,1.0f,1.0f,0.5f); ```
721,705
The following snippet draws a gray square. ``` glColor3b(50, 50, 50); glBegin(GL_QUADS); glVertex3f(-1.0, +1.0, 0.0); // top left glVertex3f(-1.0, -1.0, 0.0); // bottom left glVertex3f(+1.0, -1.0, 0.0); // bottom right glVertex3f(+1.0, +1.0, 0.0); // top right glEnd(); ``` In my application, behind this single squa...
2009/04/06
['https://Stackoverflow.com/questions/721705', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/47775/']
In the init function, use these two lines: ``` glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); ``` And in your render function, ensure that `glColor4f` is used instead of `glColor3f`, and set the 4th argument to the level of opacity required. ``` glColor4f(1.0, 1.0, 1.0, 0.5); glBegin(GL_QUA...
You can set colors per vertex ``` glBegin(GL_QUADS); glColor4f(1.0, 0.0, 0.0, 0.5); // red, 50% alpha glVertex3f(-1.0, +1.0, 0.0); // top left // Make sure to set the color back since the color state persists glVertex3f(-1.0, -1.0, 0.0); // bottom left glVertex3f(+1.0, -1.0, 0.0); // bottom right glVertex3f(+1.0, +1.0...
1,051,688
Let's say I have two custom headers, `foo` and `bar` that contribute to the uniqueness of a REST query, how can I configure nginx to include these in its cache key? For example we these queries that hit the same url but should be cached differently given their headers: ``` wget --header=foo:1 --header=bar:A http://my...
2021/01/29
['https://serverfault.com/questions/1051688', 'https://serverfault.com', 'https://serverfault.com/users/679/']
Ok, so with help of [@Praveen Premaratne](https://serverfault.com/users/446078/praveen-premaratne) and [@Piotr P. Karwasz](https://serverfault.com/users/530633/piotr-p-karwasz) and this [article](http://dev.joget.org/community/display/DX7/NGINX+as+Proxy+to+Tomcat) I came up with following configuration: > > don't put...
Try this: ``` location / { try_files $uri @backend; } location @backend { include proxy_params; proxy_pass http://tomcat; } ```
1,051,688
Let's say I have two custom headers, `foo` and `bar` that contribute to the uniqueness of a REST query, how can I configure nginx to include these in its cache key? For example we these queries that hit the same url but should be cached differently given their headers: ``` wget --header=foo:1 --header=bar:A http://my...
2021/01/29
['https://serverfault.com/questions/1051688', 'https://serverfault.com', 'https://serverfault.com/users/679/']
Ok, so with help of [@Praveen Premaratne](https://serverfault.com/users/446078/praveen-premaratne) and [@Piotr P. Karwasz](https://serverfault.com/users/530633/piotr-p-karwasz) and this [article](http://dev.joget.org/community/display/DX7/NGINX+as+Proxy+to+Tomcat) I came up with following configuration: > > don't put...
If I were to do this using the subdomains approach here's how I would do it. * Create an Nginx configuration file for the backend API * Create an Nginx configuration file for the static web content > > Static HTML Nginx file `mydomain.com.nginx` > > > ``` server { server_name mydomain.com; root /var/...
21,241,073
I'm using the gon gem for rails, which allows you to save variables defined in a controller action and use them in your JavaScript. It works fine when I use it in non-Ajax settings, however, I'm having an issue with using it successfully when doing Ajax requests. **The problem**: Ruby variables I assign to gon variabl...
2014/01/20
['https://Stackoverflow.com/questions/21241073', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1908400/']
I ended up solving this by doing the following: **In my controller:** ``` def some_action @my_ajax_var = {some: 'info'}.to_json end ``` **In my corresponding view:** /some\_action.js.erb ``` var my_ajax_var = <%= @my_ajax_var.html_safe %> ``` Would've been nice to have piggybacked off the gon gem, but this got...
It's some time ago that I used erb templates, but I think you need to add tags in your erb-file. ``` /some_action.js.erb console.log('gon.my_ajax_var equals ' + <%= gon.my_ajax_var %>) ```
12,280,600
I'm having trouble with calling a system command from Java. I've tried the following: ``` if (!found) { dbContents += ";" + getPreviousValue(i, dbContents); try { String cmd = "echo \"Device " + headers[i] + " no data incoming at " + timeString + "\" >> /home/envir/11/log.txt"; Runtime.getRunt...
2012/09/05
['https://Stackoverflow.com/questions/12280600', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1452989/']
It is likely your command is failing. Any error message is send to the Process.getErrorStream() which you are ignoring so you can't see it. In your case, if all you want to do append to a log file, the best way to do this is in Java. It is faster, cleaner and more likely to work. ``` PrintWriter pw = new PrintWriter(...
Maybe your file is not created because the redirection (">>") is not evaluated. Try to wrap your call like this : ``` String cmd = "sh -c \"echo \\\"Device " + headers[i] + " no data incoming at " + timeString + "\\\" >> /home/envir/11/log.txt\""; ``` Anyway, why don't you use something like a FileWritter ?
59,835,541
I have a pandas dataframe of format with 226 columns : ``` **W X Y Z.....** a b c d..... e f g h..... ``` i want to subtract columns Y and Z in the following way: ``` **W X Y Z.....** a (b-c) (c-d) (d-nextvalue)..... e (f-g) (g-h) (h-nextvalue).......
2020/01/21
['https://Stackoverflow.com/questions/59835541', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/12724372/']
Use [`DataFrame.diff`](http://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.diff.html) and if necessary convert first column to index by [`DataFrame.set_index`](http://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.set_index.html): ``` df = pd.DataFrame({ 'W':list('ab...
To create 'W' as the index you can do, ``` df.set_index('W', inplace=True) ``` Further, you may try the following: ``` for i in range(len(df.columns) - 1): df.iloc[:, i] = df.iloc[:, i] - df.iloc[:, i+1] ```
1,742,639
I am not from a quantitative science field and most of the my concepts in probability is rustic. I came up with this probability question so please forgive me for any error. **A** and **B** are two tennis doubles player. A and B never played doubles tennis as a team together. ``` Probability of A (with another team ...
2016/04/14
['https://math.stackexchange.com/questions/1742639', 'https://math.stackexchange.com', 'https://math.stackexchange.com/users/23624/']
I think what you need is the probability that they lose, and subtract from $1$. The probability that they both lose (because both of them don't play well) on the same game is $(1-0.5)(1-0.7) = 0.15$, so the probability of the team winning is $1 - 0.15 = 0.85$. The interpretation of this is the sum of the probabilities...
What do you mean by "with another team mate"? Any person at all, as long as it's not A or B? Some particular person? Does it matter who they are playing against? What if A and somebody else are playing against B and somebody else? They can't have probabilities $0.7$ and $0.5$ of winning: the probabilities would have to...
42,254,397
In Xamarin.Forms 2.3.4.192-pre2, I have created a custom `ViewCell` that uses a grid for the `DataTemplate` of a `Xamarin.Forms.ListView`. When the `ListView` is loaded, it throws `System.ArgumentException: NaN is not a valid value for width`. I've located the [error in the Xamarin.Forms source code](https://github.c...
2017/02/15
['https://Stackoverflow.com/questions/42254397', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/5953643/']
This appears to be a regression with Xamarin.Forms v2.3.4.192-pre2. The exception is not thrown when using Xamarin.Forms v2.3.3.180. I submitted the bug to the Xamarin.Forms team via Bugzilla: <https://bugzilla.xamarin.com/show_bug.cgi?id=52533> Update: This error is fixed in Xamarin.Forms 2.3.4.214-pre5
Add a container (ex: frame) and specify width for this condainer, ``` <Frame x:Name="AutoCompleterContainer" Grid.Row="1" WidthRequest="400"> <telerikInput:RadAutoComplete .... </Frame> ```
11,380,533
I create a project with ARC support using the Xcode project wizard. Compared with a program without ARC support, I did not notice any differences. Is there any hint that can tell me if my program supports ARC? I am using XCode 4.2.1 Build 4D502
2012/07/08
['https://Stackoverflow.com/questions/11380533', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/705414/']
You can use `__has_feature`, maybe logging whether the project has ARC in the console like this: ``` #if __has_feature(objc_arc) // ARC is On NSLog(@"ARC on"); #else // ARC is Off NSLog(@"ARC off"); #endif ``` Alternatively, instead of just logging whether ARC is on, try making the compiler raise a...
Or to test just once, add this in your code: ``` NSString* dummy = [[[NSString alloc] init] autorelease]; ``` This should raise an error if you are using ARC. If it does, ARC is enabled, all is fine and you can remove it again.
11,380,533
I create a project with ARC support using the Xcode project wizard. Compared with a program without ARC support, I did not notice any differences. Is there any hint that can tell me if my program supports ARC? I am using XCode 4.2.1 Build 4D502
2012/07/08
['https://Stackoverflow.com/questions/11380533', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/705414/']
You can use `__has_feature`, maybe logging whether the project has ARC in the console like this: ``` #if __has_feature(objc_arc) // ARC is On NSLog(@"ARC on"); #else // ARC is Off NSLog(@"ARC off"); #endif ``` Alternatively, instead of just logging whether ARC is on, try making the compiler raise a...
If you just want to know one time if your project has ARC, I suggest using jpalten's answer. If you want your code to only build with ARC on, I suggest qegal's. However, if you want to know where in Xcode the setting lives: 1. Select your project in the navigator. This will open the project editor. 2. In the project ...
11,380,533
I create a project with ARC support using the Xcode project wizard. Compared with a program without ARC support, I did not notice any differences. Is there any hint that can tell me if my program supports ARC? I am using XCode 4.2.1 Build 4D502
2012/07/08
['https://Stackoverflow.com/questions/11380533', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/705414/']
You can use `__has_feature`, maybe logging whether the project has ARC in the console like this: ``` #if __has_feature(objc_arc) // ARC is On NSLog(@"ARC on"); #else // ARC is Off NSLog(@"ARC off"); #endif ``` Alternatively, instead of just logging whether ARC is on, try making the compiler raise a...
add "-fno-objc-arc" compiler flags for all the .m files in build phases
11,380,533
I create a project with ARC support using the Xcode project wizard. Compared with a program without ARC support, I did not notice any differences. Is there any hint that can tell me if my program supports ARC? I am using XCode 4.2.1 Build 4D502
2012/07/08
['https://Stackoverflow.com/questions/11380533', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/705414/']
If you just want to know one time if your project has ARC, I suggest using jpalten's answer. If you want your code to only build with ARC on, I suggest qegal's. However, if you want to know where in Xcode the setting lives: 1. Select your project in the navigator. This will open the project editor. 2. In the project ...
Or to test just once, add this in your code: ``` NSString* dummy = [[[NSString alloc] init] autorelease]; ``` This should raise an error if you are using ARC. If it does, ARC is enabled, all is fine and you can remove it again.
11,380,533
I create a project with ARC support using the Xcode project wizard. Compared with a program without ARC support, I did not notice any differences. Is there any hint that can tell me if my program supports ARC? I am using XCode 4.2.1 Build 4D502
2012/07/08
['https://Stackoverflow.com/questions/11380533', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/705414/']
Or to test just once, add this in your code: ``` NSString* dummy = [[[NSString alloc] init] autorelease]; ``` This should raise an error if you are using ARC. If it does, ARC is enabled, all is fine and you can remove it again.
add "-fno-objc-arc" compiler flags for all the .m files in build phases
11,380,533
I create a project with ARC support using the Xcode project wizard. Compared with a program without ARC support, I did not notice any differences. Is there any hint that can tell me if my program supports ARC? I am using XCode 4.2.1 Build 4D502
2012/07/08
['https://Stackoverflow.com/questions/11380533', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/705414/']
If you just want to know one time if your project has ARC, I suggest using jpalten's answer. If you want your code to only build with ARC on, I suggest qegal's. However, if you want to know where in Xcode the setting lives: 1. Select your project in the navigator. This will open the project editor. 2. In the project ...
add "-fno-objc-arc" compiler flags for all the .m files in build phases
67,877,783
We use Cosmos DB to track all our devices and also data that is related to the device (and not stored in the device document itself) is stored in the same container with the same partition ID. Both the device document and the related documents have `/deviceId` as the partition key. When a device is removed, then I rem...
2021/06/07
['https://Stackoverflow.com/questions/67877783', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/956435/']
Dart is [null safe](https://dart.dev/null-safety/understanding-null-safety#uninitialized-variables) . You either must always assign a value or mark it explicitly as nullable using a `?` ``` String _prenom = "Something"; ``` or ``` String? _prenom; ```
in Dart class always add ? after DataType ``` bool? log = true; String? mail; String? password; String? prenom; String? nom;``` ```
643
What is a good English phrase for "produktionsbedingter Leerraum"? The literal meaning is "an empty space caused by production" and tells buyers that the half-empty cookie box is a feature.
2011/05/30
['https://german.stackexchange.com/questions/643', 'https://german.stackexchange.com', 'https://german.stackexchange.com/users/4/']
The technical term in the US is ["slack-fill"](http://www.accessdata.fda.gov/scripts/cdrh/cfdocs/cfcfr/CFRSearch.cfm?fr=100.100), however consumers aren't likely to know what this means. (In terms of potato chips and other vacuum-packed goods, this is also called "headspace"): > > *Slack-fill is the difference betwee...
Such a thing doesn't appear written very often, and translating compound words tends to always produce clumsy results. I would propose either > > Free space from manufacturing > > > (short for "free space resulting from the manufacturing process") or > > Manufactured free space > > > As a label, perhaps ...
25,278,612
I'm new in mobile app development. I'm using Xamarin to develop Android applications. In the hello world app in the OnCreate method I see the following code: ``` Button button = FindViewById<Button>(Resource.Id.MyButton); ``` So I'm trying to create my own button the same way. I create the button in the designer and...
2014/08/13
['https://Stackoverflow.com/questions/25278612', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3484533/']
You have to give the `id` `MyOwnBtn` to the `Button` that you created in the designer. `findViewById` is a method of the `View` class and it looks for a child view having the `id` that you provided in the argument. From [official documentation](http://developer.android.com/reference/android/view/View.html#findViewByI...
MyButton id is not a const value, It will change every launch.
25,278,612
I'm new in mobile app development. I'm using Xamarin to develop Android applications. In the hello world app in the OnCreate method I see the following code: ``` Button button = FindViewById<Button>(Resource.Id.MyButton); ``` So I'm trying to create my own button the same way. I create the button in the designer and...
2014/08/13
['https://Stackoverflow.com/questions/25278612', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3484533/']
You have to give the `id` `MyOwnBtn` to the `Button` that you created in the designer. `findViewById` is a method of the `View` class and it looks for a child view having the `id` that you provided in the argument. From [official documentation](http://developer.android.com/reference/android/view/View.html#findViewByI...
The Activity or ViewGroup's findViewById() method returns a view that already has an id. The findViewById() method should be used in conjunction with XML layouts to provide a reference to the View that was defined in the XML file. **Edit**: Not entirely sure if my answer is relevant to Xamarin. I apologize if I have m...
25,278,612
I'm new in mobile app development. I'm using Xamarin to develop Android applications. In the hello world app in the OnCreate method I see the following code: ``` Button button = FindViewById<Button>(Resource.Id.MyButton); ``` So I'm trying to create my own button the same way. I create the button in the designer and...
2014/08/13
['https://Stackoverflow.com/questions/25278612', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3484533/']
You have to give the `id` `MyOwnBtn` to the `Button` that you created in the designer. `findViewById` is a method of the `View` class and it looks for a child view having the `id` that you provided in the argument. From [official documentation](http://developer.android.com/reference/android/view/View.html#findViewByI...
When you declare a **button** in your **.xml** file, you should set an id for it (Usually it is done using **string.xml** file). After that, **R.java** will be updated automatically and set a number to your declared id and you can access your button by that id like what you have done.
25,278,612
I'm new in mobile app development. I'm using Xamarin to develop Android applications. In the hello world app in the OnCreate method I see the following code: ``` Button button = FindViewById<Button>(Resource.Id.MyButton); ``` So I'm trying to create my own button the same way. I create the button in the designer and...
2014/08/13
['https://Stackoverflow.com/questions/25278612', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3484533/']
You have to give the `id` `MyOwnBtn` to the `Button` that you created in the designer. `findViewById` is a method of the `View` class and it looks for a child view having the `id` that you provided in the argument. From [official documentation](http://developer.android.com/reference/android/view/View.html#findViewByI...
It will try to find it from the XML file that you inflate. So make sure you inflate the correct xml file. This code inflates the xml: ``` SetContentView (Resource.Layout.MainLayout); ``` Even if you got the correct id created in a xml file, if you don't inflate it first, the system won't be able to find that view si...
38,654,071
I'm making a report in ssrs where I want to get the Integer that specifies the number of day from the year it is today. Today `=Now()` will also be set as default as a Parameter (EndDate) so I'm actually looking for the number of the day of the year the EndDate parameter is. So for example 1st of January is 1, 1st of F...
2016/07/29
['https://Stackoverflow.com/questions/38654071', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/5713919/']
Try this expression function **DateDiff** in useful for date diffrence between two dates if we found day no from specific dates we can use as ``` =DateDiff(DateInterval.Day,startdate,enddate) ``` **Example :** ``` =DateDiff(DateInterval.Day,CDate("1/1/2016"),now()) ```
I just found a better way if you want to base the day of the year on a parameter/field: e.g. With a parameter called EndDate: 'Day of the year, of that parameter: ``` =DatePart("y",Parameters!EndDate.Value) ```
38,613,510
I am trying to run a shell script to execute a binary on a remote linux box. Both the binary and the shell script are on my local window machine. Is there any way through which i can run the binary to the remote machine directly from windows through command line tools like *PLINK*? I don't want to put the binary and t...
2016/07/27
['https://Stackoverflow.com/questions/38613510', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/5381104/']
You can run the shell script remotely, just by piping it through ssh: ``` cat my_script.sh | ssh -T my_server ``` (Or whatever the windows/plink equivalent is.) However, you can't run the binary remotely through a pipe, the file will have to exist on the remote server. You can do this by pushing the file from your ...
You will have to copy the binary to the remote Linux box before it can be executed. However, you could have a script on the windows machine that uses sftp to transfer the binary program to a temporary directory under `/tmp` before running it, so there is no manual setup required.
35,507,451
So I have this list: ``` list = ["NYC Football", ["NY Giants","NY Jets"], "NYC Hockey", ["NY Rangers", "NY Islanders", "NJ Devils"]] ``` How would I loop through this list and only print out: ``` NY Giants NY Jets NY Rangers NY Islanders NJ Devils ```
2016/02/19
['https://Stackoverflow.com/questions/35507451', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/-1/']
You could use the following: ``` my_list = ["NYC Football", ["NY Giants","NY Jets"], "NYC Hockey", ["NY Rangers", "NY Islanders", "NJ Devils"]] for item in my_list: if type(item) == list: for i in item: print(i) ``` **Output** ``` NY Giants NY Jets NY Rangers NY Islanders NJ Devils ``` **...
Loop over the outer list, and only if the item is a list, iterate over it and print its items: ``` for thing in my_list: #don't call it "list" if isinstance(thing, list): for other in thing: print(other) ``` Another way: ``` for thing in filter(lambda x: isinstance(x, list)): for other i...
35,507,451
So I have this list: ``` list = ["NYC Football", ["NY Giants","NY Jets"], "NYC Hockey", ["NY Rangers", "NY Islanders", "NJ Devils"]] ``` How would I loop through this list and only print out: ``` NY Giants NY Jets NY Rangers NY Islanders NJ Devils ```
2016/02/19
['https://Stackoverflow.com/questions/35507451', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/-1/']
First of all, please don't use the name list for a list. You will shadow the built in list, which is going to give you a hard to detect bug sooner or later. As chepner already mentioned in the comments, I strongly recommend converting your list to a dictionary in order to have a clean sport:teams mapping. ``` >>> lst...
Loop over the outer list, and only if the item is a list, iterate over it and print its items: ``` for thing in my_list: #don't call it "list" if isinstance(thing, list): for other in thing: print(other) ``` Another way: ``` for thing in filter(lambda x: isinstance(x, list)): for other i...
20,237,917
I am trying to initialize collection view its showing incompatible type. I have written below code ``` UICollectionView * collCobj = [[UICollectionView alloc]initWithFrame:CGRectMake(0, 260, 320, 230) collectionViewLayout:UICollectionViewScrollPositionLeft]; ```
2013/11/27
['https://Stackoverflow.com/questions/20237917', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2742598/']
There are multiple smaller problems with your codes. 1. Names in authors and books XML files do not match. I guess it's only some typos. 2. Predicates belong to an axis step, not in their own (remove the slash after `book` in line one). 3. XML and XQuery are capitalization sensitive! `<Book/>` uses a capital B, so do ...
If you use ``` let $books := <library> <Book> <title>Title1</title> <author>Ellizabith</author> </Book> <Book> <title>Title2</title> <author>Sam</author> </Book> <Book> <title>Title3</title> <author>Ryan</author> </Book> </library> let $authors := <authorRoot> <author> ...
6,778,627
Just finishing up a site and having an issue with position: fixed on IE7. I've Googled it and tried different Doctypes but the fixed area is still moving out of position on IE7. I've not got IE7 but a client staffer has it and I can see the issue using an online IE renderer/tester. I've removed the .htaccess from the...
2011/07/21
['https://Stackoverflow.com/questions/6778627', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/856285/']
Use [XPath](http://www.w3schools.com/xpath/) to get the nodes. //child2 - to get the list of all "child2" elements
If you can use SAX parser than it is easy here your ContentHandler ``` public class CH extends DefaultHandler { @Override public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { if (qName.equals("child2")) { // here you go do w...
6,778,627
Just finishing up a site and having an issue with position: fixed on IE7. I've Googled it and tried different Doctypes but the fixed area is still moving out of position on IE7. I've not got IE7 but a client staffer has it and I can see the issue using an online IE renderer/tester. I've removed the .htaccess from the...
2011/07/21
['https://Stackoverflow.com/questions/6778627', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/856285/']
Using XPath, you could do it something like this: ``` XPath xpath = XPathFactory.newInstance().newXPath(); NodeList child2Nodes= (NodeList) xpath.evaluate("//child2", doc, XPathConstants.NODESET); ``` Where doc is your org.w3c.dom.Document class.
Use [XPath](http://www.w3schools.com/xpath/) to get the nodes. //child2 - to get the list of all "child2" elements
6,778,627
Just finishing up a site and having an issue with position: fixed on IE7. I've Googled it and tried different Doctypes but the fixed area is still moving out of position on IE7. I've not got IE7 but a client staffer has it and I can see the issue using an online IE renderer/tester. I've removed the .htaccess from the...
2011/07/21
['https://Stackoverflow.com/questions/6778627', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/856285/']
Using XPath, you could do it something like this: ``` XPath xpath = XPathFactory.newInstance().newXPath(); NodeList child2Nodes= (NodeList) xpath.evaluate("//child2", doc, XPathConstants.NODESET); ``` Where doc is your org.w3c.dom.Document class.
If you can use SAX parser than it is easy here your ContentHandler ``` public class CH extends DefaultHandler { @Override public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { if (qName.equals("child2")) { // here you go do w...
35,524,140
I'm writing a shell script to perform a series of actions in remote. Then I want to come back to local and perform the next series of actions. When I use exit, I'm exiting from the shell script instead of logging out of the remote machine. ``` set -x ssh $1 cd /var/log/sysstat/ for (( i = 11; i <= 19; i++ )) do ...
2016/02/20
['https://Stackoverflow.com/questions/35524140', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4658006/']
In the example code above, there is circular reference between `A`and `B` classes. These [will be garbage collected](https://stackoverflow.com/a/1910203/3736955) IF they are not reachable by any other object instance in `Application`. "`Activity`is destroyed" does not mean it is garbage collected. But when `Activity`...
It would depend on if the object references in A and B are the same object references within each other. After you edited the example to include how A and B were instantiated (newed up), there IS NOT a memory leak in your example because the instances created of each are not the same instances (different memory referen...
48,254
I coded a php chat that stores the text in a txt file and retrieves it, and I want to know if XSS can get past it or if someone can replace `xhr.open("POST","uhh.php");` with something that contains the same php code but without `htmlspecialchars` or something like that. What are the vulnerabilities? (More specifically...
2014/04/26
['https://codereview.stackexchange.com/questions/48254', 'https://codereview.stackexchange.com', 'https://codereview.stackexchange.com/users/41369/']
Looks safe to me, but I would change the way you request the server. This way, you send many requests to the server and for more then few people using it, the server could be flooded by these requests. It would however require switching txt file for script file. Then you could use so called long poll. You are probably...
For the XSS part, here's some resources. It would be better off if I just referenced them rather than write the entire thing down. The second one might be the one you want: * [https://www.owasp.org/index.php/XSS\_(Cross\_Site\_Scripting)\_Prevention\_Cheat\_Sheet](https://www.owasp.org/index.php/XSS_%28Cross_Site_Scri...
10,287,618
Well the motivation is the idea that a python test runner would have functionality similar to [nose](http://readthedocs.org/docs/nose/en/latest/) the difference being it being able to run C Unit tests. I am yet to find anything similar. Here are some of the requirements of test runner. 1. The test runner is responsi...
2012/04/23
['https://Stackoverflow.com/questions/10287618', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/454488/']
Rather than doing all this yourself (a tremedous piece of work), how about using `py.test`? It's a powerful test runner, among other things. It satisfies most of your requirements (well, those that are clear - some don't make a lot of sense to me) out of the box, and is customizable enough to add anything you need beyo...
A much better solution than the already proposed py.test is PySys System Test Framework that solves almost all of the points above, and you can extend very easily to achieve the few that are not already covered You will have to write a common "execute" method that start the C test as an external process and then grep ...
29,556,212
I have a huge document and I need to listen on all `mousemoves` on this document. My first obvious idea was `addEventListener()` on body, but it might introduce some performance issues (you know, bubbling stuff). There is a mythical parameter in `addEventListener()` - `useCapture`. I don't quite get the inner workings...
2015/04/10
['https://Stackoverflow.com/questions/29556212', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/300639/']
The capture phase works as follows: instead of bubbling from the innermost DOM element up and out, capture starts out from the window and goes in. Capture phase happens before the bubbling phase, so it's handy if you want to stop the propagation of an event before it even gets to the inner DOM elements. Which can als...
jQuery did have `live` deprecated due to the fact that [bubbling does take time to reach the root](http://www.sitepoint.com/on-vs-live-review/) (where `live` placed all handlers). For small stuff, this isn't an issue. But if you have a deep DOM tree or a lot of things happening, then this becomes a big problem. The bet...
2,491,023
I am interested in properties of regular neighbourhood meshes, but I feel like I'm missing *keywords* to investigate further. --- In the 2D world I, like both triangular neighbourhood and square neighbourhood, because: * they are both **regular**, which means to me: + there is always *same distance* between two clo...
2017/10/26
['https://math.stackexchange.com/questions/2491023', 'https://math.stackexchange.com', 'https://math.stackexchange.com/users/165143/']
My interpretation of the close-neighbours-neighbouring property is as follows: > > For each node, the minimum separation among all distinct pairs of its neighbours is the same as the distance between the node and its neighbours. > > > Then the [fcc lattice](https://en.wikipedia.org/wiki/Close-packing_of_equal_sph...
No; my understanding of the "close neighbors neighboring" property is that the cells would have to be tetrahedra, and there is no regular tetrahedral tiling of space. You can get something close to a tesselation that you want by [computing](http://A%20Hierarchical%20Approach%20for%20Regular%20Centroidal%20Voronoi%20Te...
2,491,023
I am interested in properties of regular neighbourhood meshes, but I feel like I'm missing *keywords* to investigate further. --- In the 2D world I, like both triangular neighbourhood and square neighbourhood, because: * they are both **regular**, which means to me: + there is always *same distance* between two clo...
2017/10/26
['https://math.stackexchange.com/questions/2491023', 'https://math.stackexchange.com', 'https://math.stackexchange.com/users/165143/']
My interpretation of the close-neighbours-neighbouring property is as follows: > > For each node, the minimum separation among all distinct pairs of its neighbours is the same as the distance between the node and its neighbours. > > > Then the [fcc lattice](https://en.wikipedia.org/wiki/Close-packing_of_equal_sph...
Consider that a rhombic dodecahedron tiles Euclidean 3 space.
36,254,414
I have a Prism Shell with two modules. One module is supposed to be the main application mock, `MainAppMock`, and the other module is supposed to be whatever that main system is using as a region, `ModuleOne`. Could be one, could be a million module. The issue is understanding how Prism works. The `MainAppModule` init...
2016/03/28
['https://Stackoverflow.com/questions/36254414', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3029887/']
As this question has now changed so much since I first asked it (i.e. first I thought this was a memory/ struct issue, then it became a compiler issue, then I finally figured out it was a IDE issue), therefore I decided to create a new question altogether: [Output for CLion IDE sometimes cuts off when executing a progr...
**fscanf()** returns the number of characters read or zero at end of file, while **fgetc(fp)** returns a character or EOF when end of file is reached. You are mixing the two methods of eof detection.
63,154,860
``` table_name='Customer$' if table_name.startswith('$'): table_name=table_name[1:] if table_name.endswith('$'): table_name=table_name[:-1] ``` I tried with the above code it gives me correct result as ``` Customer ``` Is there any optimized way of doing it? please reply
2020/07/29
['https://Stackoverflow.com/questions/63154860', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/13818054/']
Use `.strip()`: ``` table_name = '$Customer$'.strip('$') ``` This will remove all `$`s from the start and end and do nothing if there aren't dollars surrounding the string.
``` '$Customer$'.strip('$') ``` `strip()` method removes any leading (spaces at the beginning) and trailing (spaces at the end) characters (space is the default leading character to remove). By default trailing and leading spaces are removed. If an argument of character/s should be removed has been passed, then that ...
63,154,860
``` table_name='Customer$' if table_name.startswith('$'): table_name=table_name[1:] if table_name.endswith('$'): table_name=table_name[:-1] ``` I tried with the above code it gives me correct result as ``` Customer ``` Is there any optimized way of doing it? please reply
2020/07/29
['https://Stackoverflow.com/questions/63154860', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/13818054/']
Use `.strip()`: ``` table_name = '$Customer$'.strip('$') ``` This will remove all `$`s from the start and end and do nothing if there aren't dollars surrounding the string.
just use `.strip()` it works like `trim()` ``` table_name = '$Cu$$stomer$' ans = table_name.strip('$') print(ans) # output Cu$$stomer ``` The `strip()` method returns a copy of the string by removing both the leading and the trailing characters (based on the string argument passed). you can learn more about `strip...
22,361,630
It's a small piece of code, but I can't get it to work. I have a menu which is filled dynamically with javascript, and I add an eventlistener on click for every button. Now every button needs a different function, so I loop through them ``` var list = $("a"); for (var i=0; i<list.length; i++) { $(list[i]).on("clic...
2014/03/12
['https://Stackoverflow.com/questions/22361630', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/-1/']
Use [each()](https://api.jquery.com/each/) that's what it's for: ``` var list = $("a"); list.each(function(index){ $(this).on("click", function(){alert(index);}); }); ``` [DEMO](http://jsfiddle.net/7HeeA/)
The value of i changes in the loop, but after the loop is finished the value of i is 5. Whenever you call the alert, it is looking for the variable i, whose value is now 5. You need to store the increment value of i somewhere for each thing. In this example, I give each button an HTML5 data attribute called `data-myval...
22,361,630
It's a small piece of code, but I can't get it to work. I have a menu which is filled dynamically with javascript, and I add an eventlistener on click for every button. Now every button needs a different function, so I loop through them ``` var list = $("a"); for (var i=0; i<list.length; i++) { $(list[i]).on("clic...
2014/03/12
['https://Stackoverflow.com/questions/22361630', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/-1/']
Use [each()](https://api.jquery.com/each/) that's what it's for: ``` var list = $("a"); list.each(function(index){ $(this).on("click", function(){alert(index);}); }); ``` [DEMO](http://jsfiddle.net/7HeeA/)
in your html code call a function favbrowser whenever a item is selected using onchange event by writting ``` <select id="myList" onchange="favBrowser()"> <option></option> </select> ``` and then in javascript do this to print the name of menu item ``` <script> function favBrowser() { var mylist=document.getElem...
581,274
I've just completed a custom board that uses an STM32 F4 chip and to program it I have implemented the JTAG 10-pin connecter as seen here: [![enter image description here](https://i.stack.imgur.com/0qpVo.png)](https://i.stack.imgur.com/0qpVo.png) Now, this works fine and I can program the chip with it using the inclu...
2021/08/12
['https://electronics.stackexchange.com/questions/581274', 'https://electronics.stackexchange.com', 'https://electronics.stackexchange.com/users/121457/']
The ST-Link comes with an 20 pin connector. None of shown clones actually cloned this. ST recommends buying the [TC2050-ARM2010](https://www.tag-connect.com/wp-content/uploads/bsk-pdf-manager/2021/02/TC2050-ARM2010-2021.pdf) adapter for the 10 pin connector. (segger has some as well) Which has a pinout according to yo...
They are clones that most likely are using ripped off original firmware and they are trying to allure the hobbyist market with hobbyist-friendly features not present in the original product. So they can do whatever they want with their products. The clones actually provide various supply voltages **to** the programmed...
10,565,752
For example, suppose I have `std::string` containing UNIX-style path to some file: ``` string path("/first/second/blah/myfile"); ``` Suppose now I want to throw away file-related information and get path to 'blah' folder from this string. So is there an efficient (saying 'efficient' I mean 'without any copies') way ...
2012/05/12
['https://Stackoverflow.com/questions/10565752', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1096537/']
If N is known, you can use ``` path.erase(N, std::string::npos); ``` If N is not known and you want to find it, you can use any of the search functions. In this case you 'll want to find the last slash, so you can use [`rfind`](http://en.cppreference.com/w/cpp/string/basic_string/rfind) or [`find_last_of`](http://en...
While the accepted answer for sure works, the most efficient way to throw away the end of a string is to call the `resize` method, in your case just: ``` path.resize(N); ```
35,736,070
Using `asp.net 5` I'd like my controller to be injected with a `Func<T>`instead of `T` For example: ```cs public HomeController(Func<Interfaces.IUnitOfWork> uow) ``` Instead of ```cs public HomeController(Interfaces.IUnitOfWork uow) ``` Is it possible with the built-in DI or am I forced to move to an external DI...
2016/03/02
['https://Stackoverflow.com/questions/35736070', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/20335/']
As far as I'm aware deferring dependencies like this isn't possible using the current default IoC container within ASP.NET Core. I've not been able to get it working anyway! To defer the initialisation of dependencies like this you'll need to implement an existing, more feature rich IoC container.
While there is no built in Func building support in the default dependency injection for .net core we can build an extension method to add in all the missing funcs. We just need to make sure we call it at the end of registration. ``` public static class ServiceCollectionExtensions { private static MethodInfo GetS...
35,736,070
Using `asp.net 5` I'd like my controller to be injected with a `Func<T>`instead of `T` For example: ```cs public HomeController(Func<Interfaces.IUnitOfWork> uow) ``` Instead of ```cs public HomeController(Interfaces.IUnitOfWork uow) ``` Is it possible with the built-in DI or am I forced to move to an external DI...
2016/03/02
['https://Stackoverflow.com/questions/35736070', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/20335/']
`Func<T>` does not get registered or resolved by default but there is nothing stopping you from registering it yourself. e.g. ``` services.AddSingleton(provider => new Func<IUnitOfWork>(() => provider.GetService<IUnitOfWork>())); ``` Note that you will also need to register IUnitOfWork itself in the usual way.
I wrote a little **extension method** that registres the service and the factory (`Func<T>`): ```cs public static class IServiceCollectionExtension { public static IServiceCollection AddFactory<TService, TServiceImplementation>(this IServiceCollection serviceCollection) where TService : class wher...
35,736,070
Using `asp.net 5` I'd like my controller to be injected with a `Func<T>`instead of `T` For example: ```cs public HomeController(Func<Interfaces.IUnitOfWork> uow) ``` Instead of ```cs public HomeController(Interfaces.IUnitOfWork uow) ``` Is it possible with the built-in DI or am I forced to move to an external DI...
2016/03/02
['https://Stackoverflow.com/questions/35736070', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/20335/']
`Func<T>` does not get registered or resolved by default but there is nothing stopping you from registering it yourself. e.g. ``` services.AddSingleton(provider => new Func<IUnitOfWork>(() => provider.GetService<IUnitOfWork>())); ``` Note that you will also need to register IUnitOfWork itself in the usual way.
There are a few options available to you, the first is you can switch over to use the incredible [Lamar](https://jasperfx.github.io/lamar/getting_started/) (with it's [ASP.NET Core integration](https://jasperfx.github.io/lamar/getting_started/#sec1)). For the most part, switching to Lamar is a few lines of code, and y...
35,736,070
Using `asp.net 5` I'd like my controller to be injected with a `Func<T>`instead of `T` For example: ```cs public HomeController(Func<Interfaces.IUnitOfWork> uow) ``` Instead of ```cs public HomeController(Interfaces.IUnitOfWork uow) ``` Is it possible with the built-in DI or am I forced to move to an external DI...
2016/03/02
['https://Stackoverflow.com/questions/35736070', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/20335/']
`Func<T>` does not get registered or resolved by default but there is nothing stopping you from registering it yourself. e.g. ``` services.AddSingleton(provider => new Func<IUnitOfWork>(() => provider.GetService<IUnitOfWork>())); ``` Note that you will also need to register IUnitOfWork itself in the usual way.
You can register a `Func<T>` or a delegate with a `ServiceCollection`. I recommend a delegate because it allows you to distinguish between different methods with identical signatures. Here's an example. ``` public interface IThingINeed {} public class ThingINeed : IThingINeed { } public delegate IThingINeed ThingIN...
35,736,070
Using `asp.net 5` I'd like my controller to be injected with a `Func<T>`instead of `T` For example: ```cs public HomeController(Func<Interfaces.IUnitOfWork> uow) ``` Instead of ```cs public HomeController(Interfaces.IUnitOfWork uow) ``` Is it possible with the built-in DI or am I forced to move to an external DI...
2016/03/02
['https://Stackoverflow.com/questions/35736070', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/20335/']
You can register a `Func<T>` or a delegate with a `ServiceCollection`. I recommend a delegate because it allows you to distinguish between different methods with identical signatures. Here's an example. ``` public interface IThingINeed {} public class ThingINeed : IThingINeed { } public delegate IThingINeed ThingIN...
I have solution below ```cs public static IServiceCollection WithFunc<TService>(this IServiceCollection serviceCollection) where TService : class { var serviceType = typeof(TService); var serviceDescriptor = serviceCollection.LastOrDefault(x => x.ServiceType == serviceType); Debug.Assert(se...
35,736,070
Using `asp.net 5` I'd like my controller to be injected with a `Func<T>`instead of `T` For example: ```cs public HomeController(Func<Interfaces.IUnitOfWork> uow) ``` Instead of ```cs public HomeController(Interfaces.IUnitOfWork uow) ``` Is it possible with the built-in DI or am I forced to move to an external DI...
2016/03/02
['https://Stackoverflow.com/questions/35736070', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/20335/']
You can register a `Func<T>` or a delegate with a `ServiceCollection`. I recommend a delegate because it allows you to distinguish between different methods with identical signatures. Here's an example. ``` public interface IThingINeed {} public class ThingINeed : IThingINeed { } public delegate IThingINeed ThingIN...
I wrote a little **extension method** that registres the service and the factory (`Func<T>`): ```cs public static class IServiceCollectionExtension { public static IServiceCollection AddFactory<TService, TServiceImplementation>(this IServiceCollection serviceCollection) where TService : class wher...
35,736,070
Using `asp.net 5` I'd like my controller to be injected with a `Func<T>`instead of `T` For example: ```cs public HomeController(Func<Interfaces.IUnitOfWork> uow) ``` Instead of ```cs public HomeController(Interfaces.IUnitOfWork uow) ``` Is it possible with the built-in DI or am I forced to move to an external DI...
2016/03/02
['https://Stackoverflow.com/questions/35736070', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/20335/']
As far as I'm aware deferring dependencies like this isn't possible using the current default IoC container within ASP.NET Core. I've not been able to get it working anyway! To defer the initialisation of dependencies like this you'll need to implement an existing, more feature rich IoC container.
I wrote a little **extension method** that registres the service and the factory (`Func<T>`): ```cs public static class IServiceCollectionExtension { public static IServiceCollection AddFactory<TService, TServiceImplementation>(this IServiceCollection serviceCollection) where TService : class wher...
35,736,070
Using `asp.net 5` I'd like my controller to be injected with a `Func<T>`instead of `T` For example: ```cs public HomeController(Func<Interfaces.IUnitOfWork> uow) ``` Instead of ```cs public HomeController(Interfaces.IUnitOfWork uow) ``` Is it possible with the built-in DI or am I forced to move to an external DI...
2016/03/02
['https://Stackoverflow.com/questions/35736070', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/20335/']
As far as I'm aware deferring dependencies like this isn't possible using the current default IoC container within ASP.NET Core. I've not been able to get it working anyway! To defer the initialisation of dependencies like this you'll need to implement an existing, more feature rich IoC container.
I have solution below ```cs public static IServiceCollection WithFunc<TService>(this IServiceCollection serviceCollection) where TService : class { var serviceType = typeof(TService); var serviceDescriptor = serviceCollection.LastOrDefault(x => x.ServiceType == serviceType); Debug.Assert(se...
35,736,070
Using `asp.net 5` I'd like my controller to be injected with a `Func<T>`instead of `T` For example: ```cs public HomeController(Func<Interfaces.IUnitOfWork> uow) ``` Instead of ```cs public HomeController(Interfaces.IUnitOfWork uow) ``` Is it possible with the built-in DI or am I forced to move to an external DI...
2016/03/02
['https://Stackoverflow.com/questions/35736070', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/20335/']
`Func<T>` does not get registered or resolved by default but there is nothing stopping you from registering it yourself. e.g. ``` services.AddSingleton(provider => new Func<IUnitOfWork>(() => provider.GetService<IUnitOfWork>())); ``` Note that you will also need to register IUnitOfWork itself in the usual way.
As far as I'm aware deferring dependencies like this isn't possible using the current default IoC container within ASP.NET Core. I've not been able to get it working anyway! To defer the initialisation of dependencies like this you'll need to implement an existing, more feature rich IoC container.
35,736,070
Using `asp.net 5` I'd like my controller to be injected with a `Func<T>`instead of `T` For example: ```cs public HomeController(Func<Interfaces.IUnitOfWork> uow) ``` Instead of ```cs public HomeController(Interfaces.IUnitOfWork uow) ``` Is it possible with the built-in DI or am I forced to move to an external DI...
2016/03/02
['https://Stackoverflow.com/questions/35736070', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/20335/']
You can register a `Func<T>` or a delegate with a `ServiceCollection`. I recommend a delegate because it allows you to distinguish between different methods with identical signatures. Here's an example. ``` public interface IThingINeed {} public class ThingINeed : IThingINeed { } public delegate IThingINeed ThingIN...
While there is no built in Func building support in the default dependency injection for .net core we can build an extension method to add in all the missing funcs. We just need to make sure we call it at the end of registration. ``` public static class ServiceCollectionExtensions { private static MethodInfo GetS...
13,140,659
I have developed an app using Phonegap for Android and IPhone. Is there how to programm the functionality with the Phonegap Framework to share a URL to twitter and Facebook for Android and IPhone? Thanks
2012/10/30
['https://Stackoverflow.com/questions/13140659', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1551880/']
You have a couple of hybrid plugins for Phonegap which cover twitter and facebook among other social services: * [ShareKit for iOs](https://github.com/mohamedfasil/ShareKitPlugin-for-Phonegap-3.0) * [Share for Android, iOs & WinPhone](https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin)
The canonical Facebook plugin for Phonegap is here: <https://github.com/davejohnson/phonegap-plugin-facebook-connect> It is being updated (by Facebook) to be compatible with the latest iOS and Android SDKs, and so would be recommended...
13,140,659
I have developed an app using Phonegap for Android and IPhone. Is there how to programm the functionality with the Phonegap Framework to share a URL to twitter and Facebook for Android and IPhone? Thanks
2012/10/30
['https://Stackoverflow.com/questions/13140659', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1551880/']
You have a couple of hybrid plugins for Phonegap which cover twitter and facebook among other social services: * [ShareKit for iOs](https://github.com/mohamedfasil/ShareKitPlugin-for-Phonegap-3.0) * [Share for Android, iOs & WinPhone](https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin)
You can use the following link for twitter on IOS: <https://github.com/phonegap/phonegap-plugins/tree/master/iPhone/Twitter> For Android: <http://www.mobiledevelopersolutions.com/home/start/twominutetutorials/tmt5p1>
13,140,659
I have developed an app using Phonegap for Android and IPhone. Is there how to programm the functionality with the Phonegap Framework to share a URL to twitter and Facebook for Android and IPhone? Thanks
2012/10/30
['https://Stackoverflow.com/questions/13140659', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1551880/']
You have a couple of hybrid plugins for Phonegap which cover twitter and facebook among other social services: * [ShareKit for iOs](https://github.com/mohamedfasil/ShareKitPlugin-for-Phonegap-3.0) * [Share for Android, iOs & WinPhone](https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin)
This is really amazing for iOS. Its working with Phonegap Cordova 2.3 <https://github.com/bfcam/phonegap-ios-social-plugin> For Android I'm using Android Share Plugin <https://github.com/phonegap/phonegap-plugins/tree/master/Android/Share>
13,140,659
I have developed an app using Phonegap for Android and IPhone. Is there how to programm the functionality with the Phonegap Framework to share a URL to twitter and Facebook for Android and IPhone? Thanks
2012/10/30
['https://Stackoverflow.com/questions/13140659', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1551880/']
You have a couple of hybrid plugins for Phonegap which cover twitter and facebook among other social services: * [ShareKit for iOs](https://github.com/mohamedfasil/ShareKitPlugin-for-Phonegap-3.0) * [Share for Android, iOs & WinPhone](https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin)
Currently the best cross-platform social share widget is [this one](https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin) which is also [available on PhoneGap Build!](https://build.phonegap.com/plugins/382) It not only supports sharing via the native share widget, but you can also share directly to Facebook...
13,140,659
I have developed an app using Phonegap for Android and IPhone. Is there how to programm the functionality with the Phonegap Framework to share a URL to twitter and Facebook for Android and IPhone? Thanks
2012/10/30
['https://Stackoverflow.com/questions/13140659', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1551880/']
This is really amazing for iOS. Its working with Phonegap Cordova 2.3 <https://github.com/bfcam/phonegap-ios-social-plugin> For Android I'm using Android Share Plugin <https://github.com/phonegap/phonegap-plugins/tree/master/Android/Share>
The canonical Facebook plugin for Phonegap is here: <https://github.com/davejohnson/phonegap-plugin-facebook-connect> It is being updated (by Facebook) to be compatible with the latest iOS and Android SDKs, and so would be recommended...
13,140,659
I have developed an app using Phonegap for Android and IPhone. Is there how to programm the functionality with the Phonegap Framework to share a URL to twitter and Facebook for Android and IPhone? Thanks
2012/10/30
['https://Stackoverflow.com/questions/13140659', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1551880/']
This is really amazing for iOS. Its working with Phonegap Cordova 2.3 <https://github.com/bfcam/phonegap-ios-social-plugin> For Android I'm using Android Share Plugin <https://github.com/phonegap/phonegap-plugins/tree/master/Android/Share>
You can use the following link for twitter on IOS: <https://github.com/phonegap/phonegap-plugins/tree/master/iPhone/Twitter> For Android: <http://www.mobiledevelopersolutions.com/home/start/twominutetutorials/tmt5p1>