qid
int64
1
74.7M
question
stringlengths
0
58.3k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
2
48.3k
response_k
stringlengths
2
40.5k
512
I'm interested in investing in power functions based trains, but want to automate switching points. Is this possible? What is the cheapest / easiest way of achieving this?
2011/11/02
[ "https://bricks.stackexchange.com/questions/512", "https://bricks.stackexchange.com", "https://bricks.stackexchange.com/users/134/" ]
One elegant solution is to use pneumatic elements, as a [small pneumatic pump](http://www.bricklink.com/catalogItem.asp?P=x191c01) is enough to move the lever. If you're lazy to figure out how, you can [buy a kit from a fan](http://www.blokbricks.com/contents/en-us/p104.html?lmd=40799.435417) which will allow you to co...
I just found this link on another forum. This is a set of instructions for using a medium power functions motor to switch the point. It is quite compact and is compatible with the infrared receiver. (page 7 of 8) <http://www.flickr.com/photos/whoward69/3731639719/in/set-72157621512518259/>
512
I'm interested in investing in power functions based trains, but want to automate switching points. Is this possible? What is the cheapest / easiest way of achieving this?
2011/11/02
[ "https://bricks.stackexchange.com/questions/512", "https://bricks.stackexchange.com", "https://bricks.stackexchange.com/users/134/" ]
There is a pure way of changing the points at a track. It requires as few pieces as you like: a motor and two technic beam/bricks. This [video](http://www.youtube.com/watch?v=WoNiq5FCd9U) demonstrates the principles of point changing with a NXT motor and will work with PF and RCX. [![enter image description here](http...
I just found this link on another forum. This is a set of instructions for using a medium power functions motor to switch the point. It is quite compact and is compatible with the infrared receiver. (page 7 of 8) <http://www.flickr.com/photos/whoward69/3731639719/in/set-72157621512518259/>
62,005,879
Since I am not so great programming in PHP I wanted to ask my question here, hopefully you guys can help me out. I'm building a WordPress website, this website has a custom page template like `custom-single.php`. On that custom template I want to show posts filtered on a tag. And the tag is coming from a Angular valu...
2020/05/25
[ "https://Stackoverflow.com/questions/62005879", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7167791/" ]
Clang uses a cost based decision whether a function will be inlined or not. This cost is affected by a lot of things. It is affected by `static`. Fortunately, clang has an output, where we can observe this. Check out this godbolt [link](https://godbolt.org/z/6gqxGs): ``` void call(); inline void a() { call(); } ...
`inline` is just an advise to the compiler, which may or may not really inline that your particular code. Regarding to the `static` keyword, if it's applied to a global variable, then it has the file-scope (as you've mentioned) if you compile your code as a separate compilation-unit. So it's even possible to have your...
39,394,054
I have this cell that has a list of things, for example: ``` [dogs, cats, mice, cows, horses] ``` And I want to separate them in different cells: ``` [dogs] [cats] [mice] [cows] [horses] ``` Can this be done?
2016/09/08
[ "https://Stackoverflow.com/questions/39394054", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6061805/" ]
You can easily do this in `VBA`: ``` Sub splitString () Dim ran, splitS() As String ran = Range("A1") splitS() = Split(ran, ",") For j = LBound(splitS) To UBound(splitS) Range("B" & (j + 1)) = splitS(j) Next j End Sub ``` If you also want the *square brackets*, use this code below: ``` Sub s...
This would do it - You have to select the cell with the cell before running it and it assumes that there is closed brackets ("[" and "]") on either end. I'll have my best answer now.. ``` Sub ImAmazing() Dim sString As String, i As Long If Trim(ActiveCell.Value) = "" Then Exit Sub ActiveCell.Value = Mid(ActiveCell....
39,394,054
I have this cell that has a list of things, for example: ``` [dogs, cats, mice, cows, horses] ``` And I want to separate them in different cells: ``` [dogs] [cats] [mice] [cows] [horses] ``` Can this be done?
2016/09/08
[ "https://Stackoverflow.com/questions/39394054", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6061805/" ]
You can easily do this in `VBA`: ``` Sub splitString () Dim ran, splitS() As String ran = Range("A1") splitS() = Split(ran, ",") For j = LBound(splitS) To UBound(splitS) Range("B" & (j + 1)) = splitS(j) Next j End Sub ``` If you also want the *square brackets*, use this code below: ``` Sub s...
With data in cell **A1**: ``` Sub dural() Dim s As String, i As Long s = Range("A1").Value s = Mid(s, 2, Len(s) - 2) ary = Split(s, ", ") i = 2 For Each a In ary Cells(i, "A").Value = "[" & a & "]" i = i + 1 Next a End Sub ``` [![enter image description here](https://i.s...
19,791,796
I'm a beginner and trying to learn Python by myself. I've been working on coding some basic shape exercises, so far I have the following code to make a diagonal. ``` size = input('Please enter the size: ') chr = raw_input('Please enter the drawing character: ') row = 1 while row <= size: col = 1 while col <...
2013/11/05
[ "https://Stackoverflow.com/questions/19791796", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2955471/" ]
You can do: ``` >>> for i in xrange(4): ... print ' ' * i + 'X ' * (4 - i) ... X X X X X X X X X X ``` The value of `i` goes from 0 to 3 (by using [`xrange`](http://docs.python.org/2/library/functions.html#xrange)) and it prints the string `' '` (two spaces) `i` number of times and it prints `'X '` ...
The simplest fix is just to print the character `print chr,` instead of space `print ' ',`. To invert the result vertically a simple change in the condition, from `while col < row:` to `while col < (size - row + 1):` will suffice. And finally, to invert it horizontally, add a loop that prints spaces: ``` size = input...
19,791,796
I'm a beginner and trying to learn Python by myself. I've been working on coding some basic shape exercises, so far I have the following code to make a diagonal. ``` size = input('Please enter the size: ') chr = raw_input('Please enter the drawing character: ') row = 1 while row <= size: col = 1 while col <...
2013/11/05
[ "https://Stackoverflow.com/questions/19791796", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2955471/" ]
You can do: ``` >>> for i in xrange(4): ... print ' ' * i + 'X ' * (4 - i) ... X X X X X X X X X X ``` The value of `i` goes from 0 to 3 (by using [`xrange`](http://docs.python.org/2/library/functions.html#xrange)) and it prints the string `' '` (two spaces) `i` number of times and it prints `'X '` ...
I wrote some code earlier that does shapes, its a bit more detailed than what you might need, but here it is: ``` >>> def make_triangle(size, siblings=1, step=1, char='*'): return '\n'.join([' '.join(line) for line in [[char * (i-(step*sib)) + ' ' * (((size-(step*sib))-(i-(step*sib)))) for sib in xrange(siblings)...
47,433,827
I'm working with Angular 4 and I have a problem with conditional style changing. I have a table and values in it. I need the values in a column to be changed depending if the value is greater or smaller than zero. For example: if the value is 123, then its color should be green. If the value is -123, then its color sho...
2017/11/22
[ "https://Stackoverflow.com/questions/47433827", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8725604/" ]
You could use ngClass for this. <https://angular.io/api/common/NgClass> ``` <mat-table> <ng-container matColumnDef="availableBalance"> <mat-header-cell *matHeaderCellDef>Available balance</mat-header-cell> <mat-cell *matCellDef="let row" [ngClass]="{ 'positive' : row.availableBalan...
Use ngStyle with a method as expression. Add the following method to your component: ``` public getColor(balance: number): string{ return balance > 0 ? "green" : "red"; } ``` And in template use it as expression: ``` <mat-cell *matCellDef="let row" *ngIf="row.availableBalance > 0" [ngStyle]="{'color': getColor(r...
50,110,744
My bi weekly payments started on January 1st, 2015 (that is what is in my Date object, it is a Thursday by the way). How would I find when will I have to pay my first payment in May of 2018? (I do not care about second or third payment in a month). I would show the work I have done, but I can't begin to think how to ...
2018/05/01
[ "https://Stackoverflow.com/questions/50110744", "https://Stackoverflow.com", "https://Stackoverflow.com/users/964335/" ]
--- *It shouldn't be necessary to point out that the comparator function in the OP is incorrect, and using it is Undefined Behaviour. Nonetheless, it is interesting to ask how it could ever work.* --- Although the interface to `qsort` requires a comparator function which returns an integer, providing three possible ...
The use of `>` is indeed a bug. This operation will only yield a result of 0 or 1. Using `-` is the correct method. The reason it worked on one but not the other is most likely because of how the list to sort was initially ordered. When in doubt, run the code through [Valgrind](http://valgrind.org) on Linux.
35,636,377
I have a Universal application in Swift 2.0 developed in XCode 7. On the storyboard simulated metrics, I have the 'size' set to 'iPhone 4.7-inch'. When I run the application on my device (iPhone 5s), none of the labels are aligned and the toolbar is out of view. -This is also the case when I run using the iPad devic...
2016/02/25
[ "https://Stackoverflow.com/questions/35636377", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5330854/" ]
That's what auto layout (*constraints*) is for. > > On the storyboard simulated metrics, I have the 'size' set to 'iPhone 4.7-inch'. > > > That's irrelevant, and indeed misleading, since in means that only on the iPhone 4.7-inch will your app look like the storyboard design — unless you use auto layout. iPhones...
Maybe you are using auto layout and auto constraint. You could deactivate this in opening the storyboard, open up right panel , go to "show the file inspector" section and under Interface Builder Document uncheck auto layout and auto constraint [Image here](http://i.stack.imgur.com/4FN5X.png) Select your item view, g...
196,571
I got two sentences: > > 1) pass out **from** college. > 2) pass out **of** college. > > > Could you tell me the difference in meaning when we use these two sentences?
2019/02/13
[ "https://ell.stackexchange.com/questions/196571", "https://ell.stackexchange.com", "https://ell.stackexchange.com/users/89515/" ]
[Cambridge Dictionary: pass out](https://dictionary.cambridge.org/dictionary/english/pass-out) > > to pass out = to become unconscious for a short time, for example when ill, badly hurt, or drunk: `I was hit on the head and passed out.` > > > This is the most used meaning. In many cases, people may not even know ...
In reading the two sentences, the following would be the common interpretations: > > pass out **from** college > > > parsed (pass out) from college > > > This means that you lose consciousness because of college. Because of the preposition *from*, it is saying that college is the result of the phrasal verb *pa...
59,148,483
I have a function called `aFunc()` and it is doing some bitwise operations. I understand what the program is doing, but I'm unable to determine what's the reason for doing this. I passed this function values from 0 to 49, but I still cannot summarize the purpose of this function. Do you have any suggestions on what thi...
2019/12/03
[ "https://Stackoverflow.com/questions/59148483", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1171987/" ]
The program is counting the number of 1 bits in the given integer. ``` 0 = b0000 => 0 one bits 1 = b0001 => 1 one bits 2 = b0010 => 1 one bits ... ``` Only the lower 4 bits shown for brevity.
It counts the number of set bits in an integer. Let's step through it. Counter: ``` int c = 0; ``` Loop; while `i` has bits set (or is true) continue: ``` while( i ) { ``` If the low bit of `i` is set, increment the counter: ``` if( i & 1 ) { c++; } ``` shift `i` right by one to go on to the next bit; if...
19,636,764
I have this code in my theme: ``` <?php global $query_string; query_posts($query_string . "posts_per_page=".get_option('onthego_fromblog_random')."&ignore_sticky_posts=1&orderby=rand&cat=".get_catid(get_option('onthego_blog_cat'))); ?> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <?php...
2013/10/28
[ "https://Stackoverflow.com/questions/19636764", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2238121/" ]
With `paste0` you can achieve this: ``` sqlfun <- function(startdate,stopdate){ sqldf(paste0("SELECT * FROM data WHERE strftime('%Y-%m-%d', time, 'unixepoch', 'localtime') >= '",startdate,"' AND strftime('%Y-%m-%d', time, 'unixepoch', 'localtime') <= '",stopdate,"'")) } sqlfun('2013-01-01','2013-12-31') ```
**between and fn$** Use `between` and factor out the `strptime` expression by prefacing `sqldf` with `fn` to perform string interpolation: ``` Time <- "strftime('%Y-%m-%d', time, 'unixepoch', 'localtime')" st <- '2013-01-01' en <- '2013-12-31' fn$sqldf("select * from data where $Time between '$st' AND '$en' ") ``` I...
16,561,365
When I use UTF-8 characters (most of the time Turkish characters) in controllers, I have to add `#encoding: utf-8` on the top of each controller file. Why doesn't Rails use this as a default? edit: I have learnt that it is not about Rails, it is about Ruby.
2013/05/15
[ "https://Stackoverflow.com/questions/16561365", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1579306/" ]
Ruby 2.0 is UTF8 by default. Otherwise you must signify that in 1.9. According to naruse: > > The default script encoding change. > > > Default script encoding (when magic comment is not specified) is > changed into UTF8[[#6679]](http://bugs.ruby-lang.org/issues/6679) In Ruby 1.9, the default script encoding is > ...
Rails is not a programming language. It is just library written in Ruby. It cannot change the fundamental syntax of Ruby. Ruby 1.8 doesn't know anything about encodings, in Ruby 1.9 the default is ASCII and in Ruby 2.0 the default is UTF-8. There's nothing Rails can do about it.
30,962,465
I hope someone can help me with a macro for some text manipulation in Excel. **Question:** How can I change the content of selected cells (even whole columns/rows) by using a macro? How should that macro look like? There are some rules that I am looking to follow in the process: * Let's presume that we have the fo...
2015/06/21
[ "https://Stackoverflow.com/questions/30962465", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5032783/" ]
I believe you can distinguish between the two events in your delegate, but not through an `IBAction`. The `NSComboBoxDelegate` protocol responds to the selector `- (void)comboBoxSelectionDidChange:(NSNotification *)notification`. You can use this to determine when an item was selected from the drop box, and use the tex...
so I added this code to my **viewController.m**: ``` -(void)comboBoxSelectionDidChange:(NSNotification *)notification{ NSLog(@"comboBoxSelectionDidChange"); } - (void)controlTextDidEndEditing:(NSNotification *)aNotification{ NSLog(@"controlTextDidEndEditing"); } ``` Then, connected my combobox "*cmbbox*" t...
45,469,748
According to: <http://search.cpan.org/~drolsky/DateTime-1.43/lib/DateTime.pm#Formatters_And_Stringification> the following will work: ``` use DateTime; $dt = DateTime->new( ... ); print $dt; # as string ``` and it does. However, when using the JSON module to embed the created $dt string as a json-encoded data s...
2017/08/02
[ "https://Stackoverflow.com/questions/45469748", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2518556/" ]
You can use `"$dt"` or `"".$o->dt`. Like your solution, it's short for ``` $dt->formatter ? $dt->formatter->format_datetime($dt) : $dt->iso8601 ``` If you want a specific format, there's `$dt->strftime`, `$dt->iso8601`, or you could use a [*DateTime::Format::*](http://search.cpan.org/search?query=DateTime%3A%3AForma...
You can explicitly interpolate the object in a string (`"$dt"`) or call the method that's actually getting called (`$dt->iso8601`). ``` use strict; use warnings; use 5.010; use DateTime; my $dt = DateTime->now; say $dt; say "$dt"; say $dt->iso8601; ``` Output: ``` 2017-08-02T19:54:22 2017-08-02T19:54:22 2017-08-...
13,246,286
This seems really basic but i can't get the hang of it. I'm trying to send more then one parameter to a method in the controller, like this : ``` http://localhost/ci/index.php/subjects/3/state ``` This is the routings i've tried : ``` $route['subjects/(:num)'] = 'subjects/view/$1'; $route['subjects/(:num)/{:any}']...
2012/11/06
[ "https://Stackoverflow.com/questions/13246286", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1026199/" ]
you have problem with your route brackets just change it from {} to () brackets will work from ``` $route['subjects/(:num)/{:any}'] = 'subjects/view/$1/$2'; ``` to ``` $route['subjects/(:num)/(:any)'] = 'subjects/view/$1/$2'; ```
Always maintain your routing rules like ``` $route['subjects/(:num)/(:any)/(:any)/(:any)'] = 'subjects/view/$1/$2/$3/$4'; $route['subjects/(:num)/(:any)/(:any)'] = 'subjects/view/$1/$2/$3'; $route['subjects/(:num)/(:any)'] = 'subjects/view/$1/$2'; ``` always follow this pattern for routing if you add like this `...
13,246,286
This seems really basic but i can't get the hang of it. I'm trying to send more then one parameter to a method in the controller, like this : ``` http://localhost/ci/index.php/subjects/3/state ``` This is the routings i've tried : ``` $route['subjects/(:num)'] = 'subjects/view/$1'; $route['subjects/(:num)/{:any}']...
2012/11/06
[ "https://Stackoverflow.com/questions/13246286", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1026199/" ]
you have problem with your route brackets just change it from {} to () brackets will work from ``` $route['subjects/(:num)/{:any}'] = 'subjects/view/$1/$2'; ``` to ``` $route['subjects/(:num)/(:any)'] = 'subjects/view/$1/$2'; ```
I once tried this URI pattern ``` $route['(:any)'] = 'welcome/list1/$1'; $route['(:any)/(:num)'] = 'welcome/list1/$1/$2'; $route['(:any)/(:any)'] = 'welcome/list2/$1/$2'; $route['(:any)/(:any)/(:num)'] = 'welcome/list2/$1/$2/$3'; $route['(:any)/(:any)/(:any)'] = 'welcome/list3/$1/$2/$3'; ``` but it didnt worked .....
13,246,286
This seems really basic but i can't get the hang of it. I'm trying to send more then one parameter to a method in the controller, like this : ``` http://localhost/ci/index.php/subjects/3/state ``` This is the routings i've tried : ``` $route['subjects/(:num)'] = 'subjects/view/$1'; $route['subjects/(:num)/{:any}']...
2012/11/06
[ "https://Stackoverflow.com/questions/13246286", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1026199/" ]
Always maintain your routing rules like ``` $route['subjects/(:num)/(:any)/(:any)/(:any)'] = 'subjects/view/$1/$2/$3/$4'; $route['subjects/(:num)/(:any)/(:any)'] = 'subjects/view/$1/$2/$3'; $route['subjects/(:num)/(:any)'] = 'subjects/view/$1/$2'; ``` always follow this pattern for routing if you add like this `...
I once tried this URI pattern ``` $route['(:any)'] = 'welcome/list1/$1'; $route['(:any)/(:num)'] = 'welcome/list1/$1/$2'; $route['(:any)/(:any)'] = 'welcome/list2/$1/$2'; $route['(:any)/(:any)/(:num)'] = 'welcome/list2/$1/$2/$3'; $route['(:any)/(:any)/(:any)'] = 'welcome/list3/$1/$2/$3'; ``` but it didnt worked .....
9,928,466
Can someone help me understand how I can pass the start date into the calendar. I have created a Delivery Scheduler calendar and I display the delivery details in a table under the calends that is feed via the database. This requires me to refresh the page when a user select a calendar day to load the table information...
2012/03/29
[ "https://Stackoverflow.com/questions/9928466", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1293524/" ]
Sample based on documentation <http://arshaw.com/fullcalendar/docs/current_date/gotoDate/> Remember that month is 0-based, so 10 means November. ``` $(document).ready(function () { var calendar = $('#calendar').fullCalendar({ events:[ { title:'All Day Event', start:new Date(2012, 10, 20)}, ...
Thank you Biesior for your helpful answer. I was able to use your suggested code to get the behavior I was looking for. While using the approach above, I notice that Firebug's console shows two AJAX data requests being executed simultaneously, one for the view associated with the current date, and one for the view as...
61,945,954
Working on a file that displays/overlays pricing for Magento 2.3.3 and I have the following JQuery statement: ``` if(price != 0){ $('#product-price-'+product_id+' .price').html(price); } ``` I want to change that so that if the price = 0, it displays a message to call for a quote. I have tried the followi...
2020/05/22
[ "https://Stackoverflow.com/questions/61945954", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4496641/" ]
The usual way to do this is to loop through the deck and assign new card values: ``` for (int i = 0; i < cardNum; ++i) deck[i] = Card(i / faceNum, i % faceNum); ``` Since `i` and `faceNum` are both integers, `i / faceNum` and `i % faceNum` are also integers. `i / faceNum` will range from 0 to 3, and `i % faceNum...
I would suggest something like this ```cpp enum Suit { SPADES = 0, HEARTS, DIAMONDS, CLUBS, MAX_SUIT }; struct Card { Suit suit; int value; }; int main() { const int faceNum = 13; Card deck[faceNum * Suit::MAX_SUIT]; Card* next = deck; for (int i = 0; i < Suit::MAX_SUIT; i++) { for (int j ...
984,416
I have the expression below, which I'd like to write in polar form. $$z = \frac{i}{{1+\frac{i(\sqrt3-1)}{1+i}}}$$ ### Own process My process was very tedious; and I also wouldn't solve the final part without a calculator. $$\frac{\sqrt3-1}{1+i} = \frac{(\sqrt3-1)(1-i)}{(1+i)(1-i)} = \frac{\sqrt3-i\cdot\sqrt{3} - 1 +...
2014/10/21
[ "https://math.stackexchange.com/questions/984416", "https://math.stackexchange.com", "https://math.stackexchange.com/users/174557/" ]
We have $$z=\color{red}{\frac{\frac{2}{\sqrt2}\frac{\sqrt2}2}{\frac12\frac21}}\frac{-1+i}{1+i\sqrt3}=\frac1{\sqrt2}e^{3i\pi/4}e^{-i\pi/3}$$
$$1+\frac{i(\sqrt3-1)}{1+i}=\frac{1+i\sqrt3}{1+i}$$ $$\implies\frac i{1+\dfrac{i(\sqrt3-1)}{1+i}}=\frac{i(i+1)}{1+i\sqrt3}=\frac{(i-1)(1-i\sqrt3)}{1^2+(\sqrt3)^2}$$ $$=\frac{(\sqrt3+1)i+\sqrt3-1}4$$ Can you take it home from here?
421,060
I came across a word **plutocracy** ``` Oxford Advanced Learner's Dictionary of Current English : ``` > > (a) [U] government by a rich and powerful class > > > (b) [C] state governed in this way > > > I am looking for its ***opposite word***. --- I do not think **communism** or **democracy**, which have ...
2017/12/05
[ "https://english.stackexchange.com/questions/421060", "https://english.stackexchange.com", "https://english.stackexchange.com/users/49342/" ]
You're looking for **ptochocracy**, which is a rare (and often derogatory) word with the following definition: > > A government elected by or consisting of the poor; (in extended use) poor people considered as a class. > > [Oxford Dictionaries](https://en.oxforddictionaries.com/definition/ptochocracy) > > >
You might consider finding a way to use the term **distributism**, which describes an economic system or situation (not a government) in which property is widespread... so everybody's a small-scale property owner instead of a few people being big owners (as in plutocracy) or no one having property (as in communism). In...
40,179,398
I'm defining a function that I want to use both for numpy arrays and for scalars. ``` def inv(x): return 1/x ``` this gives back inf in numpy arrays ``` A = np.zeros([4,4]) inv(A) array([[ inf, inf, inf, inf], [ inf, inf, inf, inf], [ inf, inf, inf, inf], [ inf, inf, inf, inf]])...
2016/10/21
[ "https://Stackoverflow.com/questions/40179398", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3254025/" ]
You're looking for `Global Application Class` located under the `Web` templates. That will create a file named by default as `Global.asax` [![enter image description here](https://i.stack.imgur.com/UarAO.png)](https://i.stack.imgur.com/UarAO.png)
I am assuming you are using VS2015. I am using VS2017, and the situation is the same. Working on legacy code with legacy instructions requires some research into how things have changed and been renamed or deprecated. I must use the same 2 step process for using the template that was formally titled `ASP.NET Empty Web...
18,743,715
I have a project which recently began using version control. There is an older attempt at this project with completely different code, which I want to add to version control for posterity but which is neither an ancestor nor a descendent of the initial commit of the current `master` branch. I wish to create a new p...
2013/09/11
[ "https://Stackoverflow.com/questions/18743715", "https://Stackoverflow.com", "https://Stackoverflow.com/users/760706/" ]
`git checkout` has an option for exactly such use case: `--orphan`. From the Git manual: > > `--orphan <new_branch>` > > > Create a new orphan branch, named `<new_branch>`, started from `<start_point>` and switch to it. The first commit made on this new branch will have no parents and it will be the root of a new...
You need to create an orphan branch: ``` git checkout --orphan <branch> ```
18,743,715
I have a project which recently began using version control. There is an older attempt at this project with completely different code, which I want to add to version control for posterity but which is neither an ancestor nor a descendent of the initial commit of the current `master` branch. I wish to create a new p...
2013/09/11
[ "https://Stackoverflow.com/questions/18743715", "https://Stackoverflow.com", "https://Stackoverflow.com/users/760706/" ]
`git checkout` has an option for exactly such use case: `--orphan`. From the Git manual: > > `--orphan <new_branch>` > > > Create a new orphan branch, named `<new_branch>`, started from `<start_point>` and switch to it. The first commit made on this new branch will have no parents and it will be the root of a new...
Apart from using the `checkout --orphan` method, you can as well create a separate repository in your other code base, make the initial commit, and then push to the other repository (or from the other repository pull from this one) ``` cd old-code git init git add . git commit -m 'Initial commit of historical codebase...
18,743,715
I have a project which recently began using version control. There is an older attempt at this project with completely different code, which I want to add to version control for posterity but which is neither an ancestor nor a descendent of the initial commit of the current `master` branch. I wish to create a new p...
2013/09/11
[ "https://Stackoverflow.com/questions/18743715", "https://Stackoverflow.com", "https://Stackoverflow.com/users/760706/" ]
Apart from using the `checkout --orphan` method, you can as well create a separate repository in your other code base, make the initial commit, and then push to the other repository (or from the other repository pull from this one) ``` cd old-code git init git add . git commit -m 'Initial commit of historical codebase...
You need to create an orphan branch: ``` git checkout --orphan <branch> ```
1,079,067
In the table below, I want to sum all of New York ACT in Q2 after the sales have been multiplied by the corresponding rates. Is there a one-shot formula I can use without needing to multiply all the items of the first table with the corresponding rates, then summing? The result I'm looking for would be (49\*.45)+(10\*....
2016/05/20
[ "https://superuser.com/questions/1079067", "https://superuser.com", "https://superuser.com/users/595106/" ]
You can insert a new column G in the table for **Rates** and write the corresponding rate in it (at the same row of store A write 0.45, B write 0.37 ...) The result will be : **=SUMPRODUCT((A3:A8="New York")\*E3:E8\*G3:G8)** Sumproduct will multiply each cell in column E (Q2) by the rate in G if the Territory (co...
You could use this formula: ``` =SUMPRODUCT(($E$3:$E$8)*(LOOKUP($B$3:$B$8,$H$3:$H$8,$I$3:$I$8))) ``` [![enter image description here](https://i.stack.imgur.com/WWknt.png)](https://i.stack.imgur.com/WWknt.png) The order in the territories and companies do not matter, but the lookup range must be in ascending order i...
50,119,187
I am using Eclipse Oxygen.3 Release (4.7.3). The following is my JUnit test class: ```java import static org.junit.Assert.assertEquals; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; class MyMathTest { MyMath myMath = new MyMath(...
2018/05/01
[ "https://Stackoverflow.com/questions/50119187", "https://Stackoverflow.com", "https://Stackoverflow.com/users/740018/" ]
Right click the java file and choose: **Build Path -> Configure Build Path -> Java Build Path**. Choose the tab **Libraries** in Java Build Path, On the right side tab choose **Add Library**. Select **JUnit** and click **Next**. Choose **JUnit 5** in **JUnit Library version** dropdown and click **finish**. Now run...
Adding the JUnit vintage dependency fixed the issue for me. <https://junit.org/junit5/docs/current/user-guide/#migrating-from-junit4-running> ``` <dependency> <groupId>org.junit.vintage</groupId> <artifactId>junit-vintage-engine</artifactId> <scope>test</scope> </dependency> ```
50,119,187
I am using Eclipse Oxygen.3 Release (4.7.3). The following is my JUnit test class: ```java import static org.junit.Assert.assertEquals; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; class MyMathTest { MyMath myMath = new MyMath(...
2018/05/01
[ "https://Stackoverflow.com/questions/50119187", "https://Stackoverflow.com", "https://Stackoverflow.com/users/740018/" ]
the test class is not public, make it public and it should work
In my current case, I encountered this error when testing the pact verification on the Service Provider side.The error was thrown because the Pact Broker doesn't have any pact to test against the Service Provider. Visit the pact broker and ensure that there is at least one pact to test with.
50,119,187
I am using Eclipse Oxygen.3 Release (4.7.3). The following is my JUnit test class: ```java import static org.junit.Assert.assertEquals; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; class MyMathTest { MyMath myMath = new MyMath(...
2018/05/01
[ "https://Stackoverflow.com/questions/50119187", "https://Stackoverflow.com", "https://Stackoverflow.com/users/740018/" ]
the test class is not public, make it public and it should work
Adding the JUnit vintage dependency fixed the issue for me. <https://junit.org/junit5/docs/current/user-guide/#migrating-from-junit4-running> ``` <dependency> <groupId>org.junit.vintage</groupId> <artifactId>junit-vintage-engine</artifactId> <scope>test</scope> </dependency> ```
50,119,187
I am using Eclipse Oxygen.3 Release (4.7.3). The following is my JUnit test class: ```java import static org.junit.Assert.assertEquals; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; class MyMathTest { MyMath myMath = new MyMath(...
2018/05/01
[ "https://Stackoverflow.com/questions/50119187", "https://Stackoverflow.com", "https://Stackoverflow.com/users/740018/" ]
In Eclipse 2019-09 (4.13) is a bug that can cause the "No tests found with test runner 'JUnit 5'" error: <https://bugs.eclipse.org/bugs/show_bug.cgi?id=551298> I added the following dependency to my project and it worked for me: ``` <dependency> <groupId>org.junit.platform</groupId> <artifactId>junit-platform...
My issue was that, Run works fine, debug throws this error. I was getting this merely because of low memory in the system. Ideally, eclipse couldn't launch the debug session due to low memory in the system. Error message thrown is confusing. Hope it helps someone!
50,119,187
I am using Eclipse Oxygen.3 Release (4.7.3). The following is my JUnit test class: ```java import static org.junit.Assert.assertEquals; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; class MyMathTest { MyMath myMath = new MyMath(...
2018/05/01
[ "https://Stackoverflow.com/questions/50119187", "https://Stackoverflow.com", "https://Stackoverflow.com/users/740018/" ]
In Eclipse 2019-09 (4.13) is a bug that can cause the "No tests found with test runner 'JUnit 5'" error: <https://bugs.eclipse.org/bugs/show_bug.cgi?id=551298> I added the following dependency to my project and it worked for me: ``` <dependency> <groupId>org.junit.platform</groupId> <artifactId>junit-platform...
In my current case, I encountered this error when testing the pact verification on the Service Provider side.The error was thrown because the Pact Broker doesn't have any pact to test against the Service Provider. Visit the pact broker and ensure that there is at least one pact to test with.
50,119,187
I am using Eclipse Oxygen.3 Release (4.7.3). The following is my JUnit test class: ```java import static org.junit.Assert.assertEquals; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; class MyMathTest { MyMath myMath = new MyMath(...
2018/05/01
[ "https://Stackoverflow.com/questions/50119187", "https://Stackoverflow.com", "https://Stackoverflow.com/users/740018/" ]
I had the same error, after trying everything, I have realized that the JUnit library wasn't added. So after adding it, tests worked as intended. ![](https://i.stack.imgur.com/ZnJVa.jpg)
Right click the java file and choose: **Build Path -> Configure Build Path -> Java Build Path**. Choose the tab **Libraries** in Java Build Path, On the right side tab choose **Add Library**. Select **JUnit** and click **Next**. Choose **JUnit 5** in **JUnit Library version** dropdown and click **finish**. Now run...
50,119,187
I am using Eclipse Oxygen.3 Release (4.7.3). The following is my JUnit test class: ```java import static org.junit.Assert.assertEquals; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; class MyMathTest { MyMath myMath = new MyMath(...
2018/05/01
[ "https://Stackoverflow.com/questions/50119187", "https://Stackoverflow.com", "https://Stackoverflow.com/users/740018/" ]
You are using JUnit 4 annotations with JUnit 5 dependencies. If you want to use JUnit 5 you should replace: ``` @Before with @BeforeEach @After with @AfterEach @BeforeClass with @BeforeAll @AfterClass with @AfterAll @Ignore with @Disabled ``` Here is more about JUnit 5 annotations <https://junit.org/junit5/docs...
My issue was that, Run works fine, debug throws this error. I was getting this merely because of low memory in the system. Ideally, eclipse couldn't launch the debug session due to low memory in the system. Error message thrown is confusing. Hope it helps someone!
50,119,187
I am using Eclipse Oxygen.3 Release (4.7.3). The following is my JUnit test class: ```java import static org.junit.Assert.assertEquals; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; class MyMathTest { MyMath myMath = new MyMath(...
2018/05/01
[ "https://Stackoverflow.com/questions/50119187", "https://Stackoverflow.com", "https://Stackoverflow.com/users/740018/" ]
Take a look back to your imports. You imports `import org.junit.Test;` (Used for run test cases with JUnit 4) You need to import `import org.junit.jupiter.api.Test;` to run tast case with JUnit5.
I had the same problem with an Eclipse (2020-09) non-Maven project. None of the proposed solutions worked, but changing the compiler from 9.0.4 to 15.0.1 did. I did that by selecting `Preferences > Java > Installed JREs`and checking the box next to `jdk-15.01`. You may need to install a recent JDK if none are shown.
50,119,187
I am using Eclipse Oxygen.3 Release (4.7.3). The following is my JUnit test class: ```java import static org.junit.Assert.assertEquals; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; class MyMathTest { MyMath myMath = new MyMath(...
2018/05/01
[ "https://Stackoverflow.com/questions/50119187", "https://Stackoverflow.com", "https://Stackoverflow.com/users/740018/" ]
In Eclipse 2019-09 (4.13) is a bug that can cause the "No tests found with test runner 'JUnit 5'" error: <https://bugs.eclipse.org/bugs/show_bug.cgi?id=551298> I added the following dependency to my project and it worked for me: ``` <dependency> <groupId>org.junit.platform</groupId> <artifactId>junit-platform...
Adding the JUnit vintage dependency fixed the issue for me. <https://junit.org/junit5/docs/current/user-guide/#migrating-from-junit4-running> ``` <dependency> <groupId>org.junit.vintage</groupId> <artifactId>junit-vintage-engine</artifactId> <scope>test</scope> </dependency> ```
50,119,187
I am using Eclipse Oxygen.3 Release (4.7.3). The following is my JUnit test class: ```java import static org.junit.Assert.assertEquals; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; class MyMathTest { MyMath myMath = new MyMath(...
2018/05/01
[ "https://Stackoverflow.com/questions/50119187", "https://Stackoverflow.com", "https://Stackoverflow.com/users/740018/" ]
Your test class is currently based on JUnit 4 since it uses annotations from the `org.junit` package. Thus, to get it to run as a JUnit 4 test class in Eclipse, you need to select the JUnit 4 Runner in the "Run Configuration". Click on the tiny arrow (pointing down) next to the green circle with a white arrow in it (a...
Take a look back to your imports. You imports `import org.junit.Test;` (Used for run test cases with JUnit 4) You need to import `import org.junit.jupiter.api.Test;` to run tast case with JUnit5.
1,068,221
In Lubuntu distribution of Ubuntu 18.04.1 LTS, I try to set the background of the terminal with some transparency but it takes no effect. I'm using LXterminal, which come with the distribution [![Setting transparency](https://i.stack.imgur.com/pFgeL.png)](https://i.stack.imgur.com/pFgeL.png) Is it anything of the ne...
2018/08/23
[ "https://askubuntu.com/questions/1068221", "https://askubuntu.com", "https://askubuntu.com/users/632766/" ]
I couldn't find the transparency option either in lxterminal 0.3.1. Looks like they dropped it at some point. See <https://sourceforge.net/p/lxde/bugs/910/>. From there: > > Was due to a configure variable. Passing --enable-gtk3 to ./configure of any recent version (tested 0.3.1 sourceforge and git latest on "master"...
In **Lubuntu 18.10** you just have to go to : *Preference > LXQT settings > Session Settings* Now Check the Compton(X Compositor) and Hit The Start Button That's it now the Transparency option in terminal preference will work.
61,742
What, if any, ability does a priest or bishop have in order to stop a brother priest who has confessed to molestation of minors, according to Canon Law? Very often I hear, and am personally aware of local priests, being re-assigned; so presumably some action can be taken in response to a confession like this. What can...
2018/01/16
[ "https://christianity.stackexchange.com/questions/61742", "https://christianity.stackexchange.com", "https://christianity.stackexchange.com/users/20611/" ]
Canon law is very explicit on this... The priest can't betray the person confessing (983.1) > > The sacramental seal is inviolable; therefore it is **absolutely forbidden** for a confessor to betray in any way a penitent in words or in **any manner and for any reason**. > > > Sacramentale sigillum inviolabile est;...
Oregon, USA, passed a law requiring the breaking of confidentiality in cases of child abuse/molestation. Psychiatrists, psychologists, social workers, teachers, and attorneys all signed on board. The Catholic Church was the only hold out. It did not do the Church well in the social structure of such a liberal state. ...
2,434
In [a recent question about problems with Ask Ubuntu](https://meta.askubuntu.com/questions/2419), the topic of low-quality, incomplete, pseudo-bug-report questions came up. From [*What to do with questions that describe known bugs?*](https://meta.askubuntu.com/questions/1317/what-to-do-with-questions-that-describe-know...
2012/02/01
[ "https://meta.askubuntu.com/questions/2434", "https://meta.askubuntu.com", "https://meta.askubuntu.com/users/24694/" ]
It's impossible for us to process people's bugs for them, they themselves need to run the `ubuntu-bug` tool on their computer in order for it to be an effective bug report. It collects things like all their hardware information, and then at some point a retracer is run on whatever they submit to find the real problem. ...
I get your point that bug questions should be closed with the relevant bug report links. But, that would only work if it is a known bug. What if we are handling something that is a relatively new bug that has yet to be documented in any of the relevant bug trackers? Not closing such questions just because we don't al...
47,301,777
I want to record phone screen in a video format. Is there a way to record my screen using ARcore android SDK??
2017/11/15
[ "https://Stackoverflow.com/questions/47301777", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8943551/" ]
Do you want the recording functionality to be built into your app? If not, just use something like the [DU Recorder](https://play.google.com/store/apps/details?id=com.duapps.recorder) App. Worked well for me for recording Google Tango Apps. Haven't tested it with ARCore, but should work as well.
Try to see if this works for you - <https://stackoverflow.com/a/31547690/855984> The only thing that sucks about it is that you'll need to be tethered via USB cable to control the recording. Android Studio will sample whatever it is you are seeing on your device provided that you're the owner of the process. Won't wo...
47,301,777
I want to record phone screen in a video format. Is there a way to record my screen using ARcore android SDK??
2017/11/15
[ "https://Stackoverflow.com/questions/47301777", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8943551/" ]
Do you want the recording functionality to be built into your app? If not, just use something like the [DU Recorder](https://play.google.com/store/apps/details?id=com.duapps.recorder) App. Worked well for me for recording Google Tango Apps. Haven't tested it with ARCore, but should work as well.
I was successfully able to record the phone screen by using a recordablesurfaceview in place of the GLSurfaceView. see: <https://github.com/UncorkedStudios/recordablesurfaceview>. The OnDrawFrame is called twice by recordablesurfaceview, once to render to the screen and the second time to record the video. Once the vid...
11,067,073
We are getting a mustache play error in production (amazon linux EC2 AMI) but not in development (MACs) and we have tried upgrading the jvm, using the jdk instead, and changing from a tomcat deploy model to match our development environments as much as possible but nothing is working. Please any help would be greatly a...
2012/06/16
[ "https://Stackoverflow.com/questions/11067073", "https://Stackoverflow.com", "https://Stackoverflow.com/users/421201/" ]
Seems the issue is with the threadlocal. In Prod as per my logs, the session gets initialized with the main thread. ``` [2012-06-30 18:35:38,102] INFO 10097[**main**] - Mustache module initialized ``` However, MustacheTag tries to access with various thread like this during request. ``` [2012-06-30 17:48:...
your issue is difficult to reproduce so i'll give few pointers here. you have tried to eliminate of issue being env issue. so other possible issues could be 1. data issue: many times reason for production issue is usually difference in actual data and test data. check if its data issue which is casuing NPE. 2. code...
11,067,073
We are getting a mustache play error in production (amazon linux EC2 AMI) but not in development (MACs) and we have tried upgrading the jvm, using the jdk instead, and changing from a tomcat deploy model to match our development environments as much as possible but nothing is working. Please any help would be greatly a...
2012/06/16
[ "https://Stackoverflow.com/questions/11067073", "https://Stackoverflow.com", "https://Stackoverflow.com/users/421201/" ]
Seems the issue is with the threadlocal. In Prod as per my logs, the session gets initialized with the main thread. ``` [2012-06-30 18:35:38,102] INFO 10097[**main**] - Mustache module initialized ``` However, MustacheTag tries to access with various thread like this during request. ``` [2012-06-30 17:48:...
You have a NullPointerException on MustacheTags.java at line 32. This means that you are probably calling a method of the Mustache library and passing a null value. Try logging all the parameters you transfer to this method (MyStuff.java line 183?). You can look at the source code of MustacheTags [here](https://githu...
3,891,402
> > **Possible Duplicate:** > > [Where should non-member operator overloads be placed?](https://stackoverflow.com/questions/3623631/where-should-non-member-operator-overloads-be-placed) > > > While browsing on SO, I often find questions or answer that involves overloading/defining a `std::ostream& operator<<(s...
2010/10/08
[ "https://Stackoverflow.com/questions/3891402", "https://Stackoverflow.com", "https://Stackoverflow.com/users/279259/" ]
It should be in the `bar` namespace. You must consider [what makes up the interface for the class](http://www.gotw.ca/publications/mill02.htm), and group those together. "A class describes a set of data along with the functions that operate on that data." Your free function operates on a `Foo`, therefore it is part of...
The rule is that, when looking for a suitable function overload, both the current namespace and all namespaces of the argument type definitions are considered. This is called Argument Dependent Lookup (ADL). So when you have this code: ``` ::std::ostream& os = /* something */; const ::bar::Foo& foo = /* something...
3,891,402
> > **Possible Duplicate:** > > [Where should non-member operator overloads be placed?](https://stackoverflow.com/questions/3623631/where-should-non-member-operator-overloads-be-placed) > > > While browsing on SO, I often find questions or answer that involves overloading/defining a `std::ostream& operator<<(s...
2010/10/08
[ "https://Stackoverflow.com/questions/3891402", "https://Stackoverflow.com", "https://Stackoverflow.com/users/279259/" ]
It should be in the `bar` namespace. You must consider [what makes up the interface for the class](http://www.gotw.ca/publications/mill02.htm), and group those together. "A class describes a set of data along with the functions that operate on that data." Your free function operates on a `Foo`, therefore it is part of...
The best choice is option 1. Why? Because when you use a unqualified function name (an an overloaded operator is a function), apart from normal name lookup, Argument-Dependent lookup is applied, that is (informally) all the namespaces where the arguments were declared are searched. E.g. ``` namespace N { class X()...
3,891,402
> > **Possible Duplicate:** > > [Where should non-member operator overloads be placed?](https://stackoverflow.com/questions/3623631/where-should-non-member-operator-overloads-be-placed) > > > While browsing on SO, I often find questions or answer that involves overloading/defining a `std::ostream& operator<<(s...
2010/10/08
[ "https://Stackoverflow.com/questions/3891402", "https://Stackoverflow.com", "https://Stackoverflow.com/users/279259/" ]
It should be in the `bar` namespace. You must consider [what makes up the interface for the class](http://www.gotw.ca/publications/mill02.htm), and group those together. "A class describes a set of data along with the functions that operate on that data." Your free function operates on a `Foo`, therefore it is part of...
The good practice is to declare the (non-member) operators in the same namespace as the class whose interface they belong to. For something like `operator+`, this is rather easy: It operates only on Foo objects, so it should go in the same namespace as Foo itself. For `operator<<` and `operator>>`, you could still cho...
3,891,402
> > **Possible Duplicate:** > > [Where should non-member operator overloads be placed?](https://stackoverflow.com/questions/3623631/where-should-non-member-operator-overloads-be-placed) > > > While browsing on SO, I often find questions or answer that involves overloading/defining a `std::ostream& operator<<(s...
2010/10/08
[ "https://Stackoverflow.com/questions/3891402", "https://Stackoverflow.com", "https://Stackoverflow.com/users/279259/" ]
It should be in the `bar` namespace. You must consider [what makes up the interface for the class](http://www.gotw.ca/publications/mill02.htm), and group those together. "A class describes a set of data along with the functions that operate on that data." Your free function operates on a `Foo`, therefore it is part of...
For operator overloading to work correctly, the function must be in the same namespace as one of its operands. Otherwise, ADL doesn't find it. This means the namespace of your class for operators like + and -. Theoretically, you could put operator<< in either std or the same namespace as your class, but the standard fo...
3,891,402
> > **Possible Duplicate:** > > [Where should non-member operator overloads be placed?](https://stackoverflow.com/questions/3623631/where-should-non-member-operator-overloads-be-placed) > > > While browsing on SO, I often find questions or answer that involves overloading/defining a `std::ostream& operator<<(s...
2010/10/08
[ "https://Stackoverflow.com/questions/3891402", "https://Stackoverflow.com", "https://Stackoverflow.com/users/279259/" ]
The rule is that, when looking for a suitable function overload, both the current namespace and all namespaces of the argument type definitions are considered. This is called Argument Dependent Lookup (ADL). So when you have this code: ``` ::std::ostream& os = /* something */; const ::bar::Foo& foo = /* something...
The best choice is option 1. Why? Because when you use a unqualified function name (an an overloaded operator is a function), apart from normal name lookup, Argument-Dependent lookup is applied, that is (informally) all the namespaces where the arguments were declared are searched. E.g. ``` namespace N { class X()...
3,891,402
> > **Possible Duplicate:** > > [Where should non-member operator overloads be placed?](https://stackoverflow.com/questions/3623631/where-should-non-member-operator-overloads-be-placed) > > > While browsing on SO, I often find questions or answer that involves overloading/defining a `std::ostream& operator<<(s...
2010/10/08
[ "https://Stackoverflow.com/questions/3891402", "https://Stackoverflow.com", "https://Stackoverflow.com/users/279259/" ]
The rule is that, when looking for a suitable function overload, both the current namespace and all namespaces of the argument type definitions are considered. This is called Argument Dependent Lookup (ADL). So when you have this code: ``` ::std::ostream& os = /* something */; const ::bar::Foo& foo = /* something...
The good practice is to declare the (non-member) operators in the same namespace as the class whose interface they belong to. For something like `operator+`, this is rather easy: It operates only on Foo objects, so it should go in the same namespace as Foo itself. For `operator<<` and `operator>>`, you could still cho...
3,891,402
> > **Possible Duplicate:** > > [Where should non-member operator overloads be placed?](https://stackoverflow.com/questions/3623631/where-should-non-member-operator-overloads-be-placed) > > > While browsing on SO, I often find questions or answer that involves overloading/defining a `std::ostream& operator<<(s...
2010/10/08
[ "https://Stackoverflow.com/questions/3891402", "https://Stackoverflow.com", "https://Stackoverflow.com/users/279259/" ]
The rule is that, when looking for a suitable function overload, both the current namespace and all namespaces of the argument type definitions are considered. This is called Argument Dependent Lookup (ADL). So when you have this code: ``` ::std::ostream& os = /* something */; const ::bar::Foo& foo = /* something...
For operator overloading to work correctly, the function must be in the same namespace as one of its operands. Otherwise, ADL doesn't find it. This means the namespace of your class for operators like + and -. Theoretically, you could put operator<< in either std or the same namespace as your class, but the standard fo...
3,891,402
> > **Possible Duplicate:** > > [Where should non-member operator overloads be placed?](https://stackoverflow.com/questions/3623631/where-should-non-member-operator-overloads-be-placed) > > > While browsing on SO, I often find questions or answer that involves overloading/defining a `std::ostream& operator<<(s...
2010/10/08
[ "https://Stackoverflow.com/questions/3891402", "https://Stackoverflow.com", "https://Stackoverflow.com/users/279259/" ]
For operator overloading to work correctly, the function must be in the same namespace as one of its operands. Otherwise, ADL doesn't find it. This means the namespace of your class for operators like + and -. Theoretically, you could put operator<< in either std or the same namespace as your class, but the standard fo...
The best choice is option 1. Why? Because when you use a unqualified function name (an an overloaded operator is a function), apart from normal name lookup, Argument-Dependent lookup is applied, that is (informally) all the namespaces where the arguments were declared are searched. E.g. ``` namespace N { class X()...
3,891,402
> > **Possible Duplicate:** > > [Where should non-member operator overloads be placed?](https://stackoverflow.com/questions/3623631/where-should-non-member-operator-overloads-be-placed) > > > While browsing on SO, I often find questions or answer that involves overloading/defining a `std::ostream& operator<<(s...
2010/10/08
[ "https://Stackoverflow.com/questions/3891402", "https://Stackoverflow.com", "https://Stackoverflow.com/users/279259/" ]
For operator overloading to work correctly, the function must be in the same namespace as one of its operands. Otherwise, ADL doesn't find it. This means the namespace of your class for operators like + and -. Theoretically, you could put operator<< in either std or the same namespace as your class, but the standard fo...
The good practice is to declare the (non-member) operators in the same namespace as the class whose interface they belong to. For something like `operator+`, this is rather easy: It operates only on Foo objects, so it should go in the same namespace as Foo itself. For `operator<<` and `operator>>`, you could still cho...
13,795,803
I got this error while debugging in SSIS: > > > > > > Error: 0xC0049064 at Data Flow Task, Derived Column [70]: An error occurred while attempting to perform a type cast. > > Error: 0xC0209029 at Data Flow Task, Derived Column [70]: SSIS Error Code DTS\_E\_INDUCEDTRANSFORMFAILUREONERROR. The "component "Derived Co...
2012/12/10
[ "https://Stackoverflow.com/questions/13795803", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1491357/" ]
I suspect that there are some date time values which are not in the correct format .So SSIS throws error while parsing them . In order to find to incorrect date time value from your source table try to redirect the error rows from `Derived Transformation` and check the incorrect data using a data viewer The problem ...
If you wanted to do this without a script, you could have just changed your expression from `(DT_DBTIMESTAMP)(SUBSTRING(EVENT_D,7,4) + "-" + SUBSTRING(EVENT_D,4,2) + "-" + SUBSTRING(EVENT_D,1,2) + EVENT_T)` to `(DT_DBTIMESTAMP)(SUBSTRING(EVENT_D,7,4) + "-" + SUBSTRING(EVENT_D,4,2) + "-" + SUBSTRING(EVENT_D...
13,795,803
I got this error while debugging in SSIS: > > > > > > Error: 0xC0049064 at Data Flow Task, Derived Column [70]: An error occurred while attempting to perform a type cast. > > Error: 0xC0209029 at Data Flow Task, Derived Column [70]: SSIS Error Code DTS\_E\_INDUCEDTRANSFORMFAILUREONERROR. The "component "Derived Co...
2012/12/10
[ "https://Stackoverflow.com/questions/13795803", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1491357/" ]
I suspect that there are some date time values which are not in the correct format .So SSIS throws error while parsing them . In order to find to incorrect date time value from your source table try to redirect the error rows from `Derived Transformation` and check the incorrect data using a data viewer The problem ...
I faced the same problem while converting a string containing date to datetimestamp field. It is all due to spaces in the field. So we need to check for space and then convert it to datetimestamp. Below is the expression for the same. LEN(TRIM([Field1])) == 1 ? NULL(DT\_DBTIMESTAMP) : (DT\_DBTIMESTAMP)(SUBSTRING([Fi...
236,275
I have created a form in a list, and one of the fields required is a person/group field that I would like to send a notification email to when the form is submitted. I have a button at the bottom of the form and would like to assign a rule on the button to generate an email. I am having trouble finding the correct fiel...
2018/02/19
[ "https://sharepoint.stackexchange.com/questions/236275", "https://sharepoint.stackexchange.com", "https://sharepoint.stackexchange.com/users/74066/" ]
The easiest way would be to create SharePoint Designer workflow which would run after the new item has been created. In it you can use `Email` action and select the field which holds the person as the receiver of the email. More on creating simple SharePoint designer workflows can be found [here](https://docs.microsof...
You can use this snippet on button click : ``` function processSendEmail() { if ($("#empEmailId").val() != null) { var userEmaiId = $("#empEmailId").val(); } else { alert("EmailId Should not be empty"); } var From = ''; var To = userEmaiId; var Body = 'You have been successfully submitted ...
34,024,388
How would I go about not displaying the message timestamp for incoming/outgoing messages if they occur during the same 5 minutes as the previous message. How iMessage does it. I have it set up to where every message has a timestamp now but having a hard time figuring out how to limit them. How would I go about setting ...
2015/12/01
[ "https://Stackoverflow.com/questions/34024388", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5361578/" ]
Presumably you're looping through the messages? Just keep track of a variable for the last printed timestamp and only display the current messages time if it is >5 minutes later. eg something like (pseudo-ish) ``` $lastMessageTime = 0; // epoch $delayInSeconds = 300; // 5 minutes foreach($messages as $message) { ...
I've never used iMessage but it seems you're looking for something like this (pseudo code): ``` $last_timestamp = ''; foreach(...){ if($last_timestamp !== $this_timestamp){ echo $this_timestamp; $last_timestamp = $this_timestamp; } } ``` This way, you'll only print the timestamp whenever it is differe...
745,655
We have a domain set with Samba Version 4.0.0beta2. Machines with Windows 7 and Windows XP have no problems to log in but Windows 8.x machine has this problema where the machine joins the domain but no user can after the first reboot. "There are currently no logon servers available to service the logon request". What's...
2014/04/24
[ "https://superuser.com/questions/745655", "https://superuser.com", "https://superuser.com/users/72846/" ]
This problem is directly related to another one of mine: > > [Is there any trick to join and use Windows 8/8.1 with Samba 4 (4.1.6)?](https://superuser.com/questions/749052/is-there-any-trick-to-join-and-use-windows-8-8-1-with-samba-4-4-1-6) > > > It's happening because of wrong realm naming. Our internal DNS con...
It sounds like the systems attempting to logon to the domain have not been added to the domain. I've seen this error before when a computer is either removed from the domain or the system is not part of the domain and it is attempting to authenticate and join.
2,720,495
I've got a strange problem with a static variable that is obviously not initialized as it should be. I have a huge project that runs with Windows and Linux. As the Linux developer doesn't have this problem I would suggest that this is some kind of wired Visual Studio stuff. Header file ``` class MyClass { // som...
2010/04/27
[ "https://Stackoverflow.com/questions/2720495", "https://Stackoverflow.com", "https://Stackoverflow.com/users/261110/" ]
In case this happens while initializing some other static variables you might be seeing the [static initialization fiasco](http://www.parashift.com/c++-faq-lite/ctors.html#faq-10.12).
Works On My Machine(TM): ``` #include <iostream> #include <cassert> class AnotherClass { public: AnotherClass(const char*) {} }; class MyClass { public: MyClass(AnotherClass* const var); private: static AnotherClass* const Default_; }; AnotherClass* const MyClass::Default_(new AnotherClass("")); MyCla...
2,720,495
I've got a strange problem with a static variable that is obviously not initialized as it should be. I have a huge project that runs with Windows and Linux. As the Linux developer doesn't have this problem I would suggest that this is some kind of wired Visual Studio stuff. Header file ``` class MyClass { // som...
2010/04/27
[ "https://Stackoverflow.com/questions/2720495", "https://Stackoverflow.com", "https://Stackoverflow.com/users/261110/" ]
I suggest you use static member function with static variable and not static variable itself: ``` class MyClass { // some other stuff here ... private: static AnotherClass* const getAnotherClass(); }; AnotherClass *const MyClass::getAnotherClass() { static AnotherClass *const p = new AnotherCl...
Works On My Machine(TM): ``` #include <iostream> #include <cassert> class AnotherClass { public: AnotherClass(const char*) {} }; class MyClass { public: MyClass(AnotherClass* const var); private: static AnotherClass* const Default_; }; AnotherClass* const MyClass::Default_(new AnotherClass("")); MyCla...
2,720,495
I've got a strange problem with a static variable that is obviously not initialized as it should be. I have a huge project that runs with Windows and Linux. As the Linux developer doesn't have this problem I would suggest that this is some kind of wired Visual Studio stuff. Header file ``` class MyClass { // som...
2010/04/27
[ "https://Stackoverflow.com/questions/2720495", "https://Stackoverflow.com", "https://Stackoverflow.com/users/261110/" ]
> > Shouldn't the compiler react the same way in this case? > > > No. As I understand it, the initialization order of individual compilation units is UNDEFINED. So the Linux developer just got lucky. Today. Tomorrow, who knows?
Works On My Machine(TM): ``` #include <iostream> #include <cassert> class AnotherClass { public: AnotherClass(const char*) {} }; class MyClass { public: MyClass(AnotherClass* const var); private: static AnotherClass* const Default_; }; AnotherClass* const MyClass::Default_(new AnotherClass("")); MyCla...
2,720,495
I've got a strange problem with a static variable that is obviously not initialized as it should be. I have a huge project that runs with Windows and Linux. As the Linux developer doesn't have this problem I would suggest that this is some kind of wired Visual Studio stuff. Header file ``` class MyClass { // som...
2010/04/27
[ "https://Stackoverflow.com/questions/2720495", "https://Stackoverflow.com", "https://Stackoverflow.com/users/261110/" ]
I suggest you use static member function with static variable and not static variable itself: ``` class MyClass { // some other stuff here ... private: static AnotherClass* const getAnotherClass(); }; AnotherClass *const MyClass::getAnotherClass() { static AnotherClass *const p = new AnotherCl...
In case this happens while initializing some other static variables you might be seeing the [static initialization fiasco](http://www.parashift.com/c++-faq-lite/ctors.html#faq-10.12).
2,720,495
I've got a strange problem with a static variable that is obviously not initialized as it should be. I have a huge project that runs with Windows and Linux. As the Linux developer doesn't have this problem I would suggest that this is some kind of wired Visual Studio stuff. Header file ``` class MyClass { // som...
2010/04/27
[ "https://Stackoverflow.com/questions/2720495", "https://Stackoverflow.com", "https://Stackoverflow.com/users/261110/" ]
I suggest you use static member function with static variable and not static variable itself: ``` class MyClass { // some other stuff here ... private: static AnotherClass* const getAnotherClass(); }; AnotherClass *const MyClass::getAnotherClass() { static AnotherClass *const p = new AnotherCl...
> > Shouldn't the compiler react the same way in this case? > > > No. As I understand it, the initialization order of individual compilation units is UNDEFINED. So the Linux developer just got lucky. Today. Tomorrow, who knows?
28,650,198
Forking on Github or Bitcket creates a repo's copy under your own account. Does this mean that forking is a server-side action? I was unable to find "fork command" inside Git. If it's not a server-side action, what are the steps to fork a local Git repository with full history and tags?
2015/02/21
[ "https://Stackoverflow.com/questions/28650198", "https://Stackoverflow.com", "https://Stackoverflow.com/users/437039/" ]
*Forking* is not a technical operation but a process which happens in software development: > > [...] a project fork happens when developers take a copy of source code from one software package and start independent development on it, creating a distinct and separate piece of software. > > > *source: <http://en.w...
Forking is just copying the whole repo. `git clone` is how you do it locally. Or you could literally just copy the entire repo. See also [Are git forks actually git clones?](https://stackoverflow.com/questions/6286571/git-fork-is-git-clone)
28,650,198
Forking on Github or Bitcket creates a repo's copy under your own account. Does this mean that forking is a server-side action? I was unable to find "fork command" inside Git. If it's not a server-side action, what are the steps to fork a local Git repository with full history and tags?
2015/02/21
[ "https://Stackoverflow.com/questions/28650198", "https://Stackoverflow.com", "https://Stackoverflow.com/users/437039/" ]
*Forking* is not a technical operation but a process which happens in software development: > > [...] a project fork happens when developers take a copy of source code from one software package and start independent development on it, creating a distinct and separate piece of software. > > > *source: <http://en.w...
There is a great summary of forking on [GitHub](https://help.github.com/articles/fork-a-repo/), but essentially you are creating a copy of their repo so you can make your own changes to it without affecting the source repo. This means you can build upon what someone else has done but alter it to your own ends.
28,650,198
Forking on Github or Bitcket creates a repo's copy under your own account. Does this mean that forking is a server-side action? I was unable to find "fork command" inside Git. If it's not a server-side action, what are the steps to fork a local Git repository with full history and tags?
2015/02/21
[ "https://Stackoverflow.com/questions/28650198", "https://Stackoverflow.com", "https://Stackoverflow.com/users/437039/" ]
*Forking* is not a technical operation but a process which happens in software development: > > [...] a project fork happens when developers take a copy of source code from one software package and start independent development on it, creating a distinct and separate piece of software. > > > *source: <http://en.w...
The representation of **Fork** in Github is a git configuration with some server side logics for **Pull Requests** features. **Commands to simulate a github fork in git commands:** > > git clone externalrepo > > > git remote rename origin external > > > create a empty repositories (could be any server, but when ...
28,650,198
Forking on Github or Bitcket creates a repo's copy under your own account. Does this mean that forking is a server-side action? I was unable to find "fork command" inside Git. If it's not a server-side action, what are the steps to fork a local Git repository with full history and tags?
2015/02/21
[ "https://Stackoverflow.com/questions/28650198", "https://Stackoverflow.com", "https://Stackoverflow.com/users/437039/" ]
Forking is just copying the whole repo. `git clone` is how you do it locally. Or you could literally just copy the entire repo. See also [Are git forks actually git clones?](https://stackoverflow.com/questions/6286571/git-fork-is-git-clone)
There is a great summary of forking on [GitHub](https://help.github.com/articles/fork-a-repo/), but essentially you are creating a copy of their repo so you can make your own changes to it without affecting the source repo. This means you can build upon what someone else has done but alter it to your own ends.
28,650,198
Forking on Github or Bitcket creates a repo's copy under your own account. Does this mean that forking is a server-side action? I was unable to find "fork command" inside Git. If it's not a server-side action, what are the steps to fork a local Git repository with full history and tags?
2015/02/21
[ "https://Stackoverflow.com/questions/28650198", "https://Stackoverflow.com", "https://Stackoverflow.com/users/437039/" ]
The representation of **Fork** in Github is a git configuration with some server side logics for **Pull Requests** features. **Commands to simulate a github fork in git commands:** > > git clone externalrepo > > > git remote rename origin external > > > create a empty repositories (could be any server, but when ...
There is a great summary of forking on [GitHub](https://help.github.com/articles/fork-a-repo/), but essentially you are creating a copy of their repo so you can make your own changes to it without affecting the source repo. This means you can build upon what someone else has done but alter it to your own ends.
17,991,506
I would like to *grep* (or equivalent) what is written inside my terminal after a ``` $ gfortran -Wall file.f90 ``` I thought a simple ``` $ gfortran -Wall file.f90 | grep something ``` would work, but it's not the case. It seems like `gfortran` is not actually writing in the standard output like `cat`. Would yo...
2013/08/01
[ "https://Stackoverflow.com/questions/17991506", "https://Stackoverflow.com", "https://Stackoverflow.com/users/851898/" ]
Try: ``` gfortran -Wall file.f90 2>&1 | grep something ``` `grep` would operate on `STDOUT` so you need to redirect the `STDERR`.
Error messages are usually written to standard error (hence the name), not standard output. If you want to pipe it, you need to redirect it first: ``` gfortran -Wall file.f90 2>&1 | grep something ```
609,872
Is it safe to use the HTTP status code [308 Permanent Redirect](https://www.rfc-editor.org/rfc/rfc7238) ([suggestion](https://datatracker.ietf.org/doc/html/draft-reschke-http-status-308-07)) in server responses? The issue with 301 Moved Permanently is that it only works with GET requests (to be fair: POST will transfor...
2014/07/03
[ "https://serverfault.com/questions/609872", "https://serverfault.com", "https://serverfault.com/users/98811/" ]
<https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/308> The RFC 7538 proposal have wide support today. It's safe. 308 instead 301. 307 instead 302. move != redirect Move reminds a specific address and/or file moved. Redirect is a new location or address.
To end this: No it is not safe to use that status code. See comments for details. > > 308 is not a standard - it's a proposal, still in the experimental stage. Browers should fall back to a 300 interpretation of any 301-399 error that they don't specifically understand. > > > Some browsers just fail completely on...
609,872
Is it safe to use the HTTP status code [308 Permanent Redirect](https://www.rfc-editor.org/rfc/rfc7238) ([suggestion](https://datatracker.ietf.org/doc/html/draft-reschke-http-status-308-07)) in server responses? The issue with 301 Moved Permanently is that it only works with GET requests (to be fair: POST will transfor...
2014/07/03
[ "https://serverfault.com/questions/609872", "https://serverfault.com", "https://serverfault.com/users/98811/" ]
Although 308 is now a standard (<https://www.rfc-editor.org/rfc/rfc7538>), **it is not currently Safe** [Edit] (as of 3 April 2019), especially for desktop applications, but may be almost safe in some specific regions (e.g. India), or for applications targeted at tablets and mobile devices. The lack of safety is becau...
To end this: No it is not safe to use that status code. See comments for details. > > 308 is not a standard - it's a proposal, still in the experimental stage. Browers should fall back to a 300 interpretation of any 301-399 error that they don't specifically understand. > > > Some browsers just fail completely on...
16,897,708
I'm following this [YouTube tutorial to build an FPS game in C++](http://www.youtube.com/playlist?list=PLA850388B1C9C62A6) but I've run into an error I can't solve; linker error [LNK2019](http://msdn.microsoft.com/en-us/library/799kze2z.aspx): > > Error 1 error LNK2019: unresolved external symbol "public: \_\_thiscal...
2013/06/03
[ "https://Stackoverflow.com/questions/16897708", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2185868/" ]
You have a destructor declared in your .h file but not implemented in the cpp ``` ~Vector3d(void); // you probably want to remove that line or default it if using C++11 ``` Declaring an empty destructor is firstly useless, as the compiler can write it for you anyway, but more importantly since C++11 it will prevent ...
You declared a destructor in your header file : ``` class Vector3d { public: float x,y,z; Vector3d(void); Vector3d(float,float); Vector3d(float,float,float); ~Vector3d(void); ^^^^^^^^^^^^^^^^ ... ``` But you never implemented it anywhere, you should add an implementation in `Vector3d.cp...
34,181,664
I have a number of images that I'm laying out in a grid system of alternating sizes. For a number of reasons, the images have to start out as a default size and I'm changing each with jQuery depending on it's location. Here's a drawing of what it should [look like.](http://i.stack.imgur.com/2C7JW.png) I'm also using ...
2015/12/09
[ "https://Stackoverflow.com/questions/34181664", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5056654/" ]
Here is an example to get the result you want. Please Sett your Api Username, Api Password, Api Signature and your SubscID. Enjoy ``` <?php /** GetTransactionDetails NVP example; last modified 08MAY23. * * Get detailed information about a single transaction. */ $environment = 'sandbox'; //sandbox or 'beta-sandbo...
If you required an API to list all the created Recurring Payments Profile in PayPal, currently PayPal doesn't have that API yet. The only API that exist and functional is [GetRecurringPaymentsProfileDetails](https://developer.paypal.com/docs/classic/api/merchant/GetRecurringPaymentsProfileDetails_API_Operation_NVP/) as...
73,695,368
I am new to Python . I am trying to create a webapp from Django which will read data from Excel file and then it will show that data on webpage in a form of dropdown . This is the structure of my web app which is I am creating [![App Structure](https://i.stack.imgur.com/h5XFM.jpg)](https://i.stack.imgur.com/h5XFM.jpg)...
2022/09/12
[ "https://Stackoverflow.com/questions/73695368", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2618323/" ]
You need to do following 3 steps. 1. Write a view function to see your Excel data in your HTML. 2. Add your view function in your urls.py file. 3. Create a loop in your HTML to see your months\_data. **1. my\_website/views.py** ``` from django.http import Http404 from django.shortcuts import render def get_months(r...
Why dump to json? Use pyexcel its easy to understand the docs. [link docs](https://pypi.org/project/pyexcel/) Another option is to use ajax, you can implement the excel output (json Response) in a simple way in your template. If you dont want to use pyexcel (which is in most cases sufficient) let me know, then we can ...
73,695,368
I am new to Python . I am trying to create a webapp from Django which will read data from Excel file and then it will show that data on webpage in a form of dropdown . This is the structure of my web app which is I am creating [![App Structure](https://i.stack.imgur.com/h5XFM.jpg)](https://i.stack.imgur.com/h5XFM.jpg)...
2022/09/12
[ "https://Stackoverflow.com/questions/73695368", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2618323/" ]
You need to do following 3 steps. 1. Write a view function to see your Excel data in your HTML. 2. Add your view function in your urls.py file. 3. Create a loop in your HTML to see your months\_data. **1. my\_website/views.py** ``` from django.http import Http404 from django.shortcuts import render def get_months(r...
I'm not sure if you're using function or class based view, but pass your data in the context ```py ... context['months'] = [{"Name":"Jan","Month":1}, ...] ... ``` Then in the template iterate over it ```html ... {% for item in months %} <select name="months" id="month"> <option value="{{ item.Month }}">{{ ite...
68,305
Is it possible for a restored iPod touch to recover former apps that had been installed on an iPod touch? Is it possible for a deleted app to be re installed containing the same information from its previous use, and also still be signed in?
2012/10/13
[ "https://apple.stackexchange.com/questions/68305", "https://apple.stackexchange.com", "https://apple.stackexchange.com/users/32823/" ]
If you restore using a backup that is recent, depending on the app, associated information will get restored (i.e. most games will generally have your high scores) as long as the app uses the standard way of storing data on an iOS device (which optionally involves iCloud). This is the information that is at `/var/mobi...
Yes, just restore from an iCloud or iTunes backup. If you're talking about forensics / recovering deleted files, that won't happen unless you have a lot of time and/or a lot of money. (And you probably won't get anything back.)
5,256,430
This is a long shot. I have no idea why this is happening, and I am hoping this is something someone else has run into. I have an email utility that sends me an email whenever a user gets an error, and I use it like so: ``` MyUtility.SendEmail(shortNTID, "support@mycompany.com", ...
2011/03/10
[ "https://Stackoverflow.com/questions/5256430", "https://Stackoverflow.com", "https://Stackoverflow.com/users/568289/" ]
This will run a job weekly: ``` 0 0 * * 0 /path/to/php yourscript.php ``` [Nice intro](http://ss64.com/osx/crontab.html) to cron and crontab.
TO your problem there is 2 step solution 1. Create cron tab using `crontab -e` command, add a following line to your cron: `0 0 * * 0 php your/php/script/path/email_script.php` 2. Create a Email script and write yor email functions here. Note: If you are including a file in your script make sure that you give fu...
69,363,867
I want to move a file form one directory to another in linux with python. I wish to achieve a behavior similar to bash `mv` command. What is the difference in practice between the two commands ``` os.replace() os.rename() ``` Is it simply that `os.rename()` will raise an error if file exists in destination while `o...
2021/09/28
[ "https://Stackoverflow.com/questions/69363867", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14649310/" ]
**os.rename()** `os.rename()` method in Python is used to rename a file or directory. This method renames a source file/ directory to specified destination file/directory. **os.replace()** `os.replace()` method in Python is also used to rename the file or directory. but: * If destination is a directory, `OSError` ...
From [docs](https://docs.python.org/3/library/os.html): `os.replace()` > > Rename the file or directory src to dst. If dst is a directory, OSError will be raised. If dst exists and is a file, it will be replaced silently if the user has permission. The operation may fail if src and dst are on different filesystems. ...
69,363,867
I want to move a file form one directory to another in linux with python. I wish to achieve a behavior similar to bash `mv` command. What is the difference in practice between the two commands ``` os.replace() os.rename() ``` Is it simply that `os.rename()` will raise an error if file exists in destination while `o...
2021/09/28
[ "https://Stackoverflow.com/questions/69363867", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14649310/" ]
On POSIX systems, the [rename](https://man7.org/linux/man-pages/man2/rename.2.html) system call will silently replace the destination file if the user has sufficient permissions. The same is not true on Windows. `os.replace` and `os.rename` are the same function on POSIX systems, but on Windows `os.replace` will call ...
**os.rename()** `os.rename()` method in Python is used to rename a file or directory. This method renames a source file/ directory to specified destination file/directory. **os.replace()** `os.replace()` method in Python is also used to rename the file or directory. but: * If destination is a directory, `OSError` ...
69,363,867
I want to move a file form one directory to another in linux with python. I wish to achieve a behavior similar to bash `mv` command. What is the difference in practice between the two commands ``` os.replace() os.rename() ``` Is it simply that `os.rename()` will raise an error if file exists in destination while `o...
2021/09/28
[ "https://Stackoverflow.com/questions/69363867", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14649310/" ]
On POSIX systems, the [rename](https://man7.org/linux/man-pages/man2/rename.2.html) system call will silently replace the destination file if the user has sufficient permissions. The same is not true on Windows. `os.replace` and `os.rename` are the same function on POSIX systems, but on Windows `os.replace` will call ...
From [docs](https://docs.python.org/3/library/os.html): `os.replace()` > > Rename the file or directory src to dst. If dst is a directory, OSError will be raised. If dst exists and is a file, it will be replaced silently if the user has permission. The operation may fail if src and dst are on different filesystems. ...
10,821,290
I've read all the posts I could find about this issue, but, to date, none of the solutions have worked for me. Obviously, I'm overlooking something important. I also don't know how to debug sessions. I read one article, [PHP session Debugging](http://css.dzone.com/news/php-session-debugging), but it was over my head. ...
2012/05/30
[ "https://Stackoverflow.com/questions/10821290", "https://Stackoverflow.com", "https://Stackoverflow.com/users/226118/" ]
Each PHP file should start with `session_start();` regardless of `$_SESSION` being set or not. This function will create a new session OR take up the existing one.
All of your code that needs the session information should start with `session_start()`. `session_start()` needs to happen before any headers or other output would be written. Setup and teardown are then handled for you. I do this: ``` session_start(); $s = &$_SESSION; ``` Then you can use read/write `$s` just l...
10,821,290
I've read all the posts I could find about this issue, but, to date, none of the solutions have worked for me. Obviously, I'm overlooking something important. I also don't know how to debug sessions. I read one article, [PHP session Debugging](http://css.dzone.com/news/php-session-debugging), but it was over my head. ...
2012/05/30
[ "https://Stackoverflow.com/questions/10821290", "https://Stackoverflow.com", "https://Stackoverflow.com/users/226118/" ]
Each PHP file should start with `session_start();` regardless of `$_SESSION` being set or not. This function will create a new session OR take up the existing one.
No `$_SESSION` is started to begin with when you check it with your first `if`. Therefore, it will always FAIL. You must call `session_start()` PRIOR to doing anything with a `$_SESSION` variable. Correct your code. First page: ``` <?php session_start(); /* Don't need this unless you really need the debugging Pre...
32,517,346
I am new to SQL Server triggers. Suppose we write an `after insert` trigger for table `tableA` and in that trigger, can we have an `INSERT` operation on the same table i.e `tableA`? Any suggestions please?
2015/09/11
[ "https://Stackoverflow.com/questions/32517346", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1047280/" ]
Yes, if you could disable recursive trigger. ``` SP_CONFIGURE 'nested_triggers',0 GO RECONFIGURE GO ```
Yes, you can: **[SqlFiddleDemo](http://sqlfiddle.com/#!6/f19cf/1/0)** ``` CREATE TABLE tab(a INT); INSERT INTO tab(a) VALUES (1); CREATE TRIGGER trg_tab ON tab AFTER INSERT AS INSERT tab SELECT a+1 FROM inserted; INSERT INTO tab(a) VALUES (10); SELECT * FROM tab; ``` Result: ``` a 1 10 11 ```
32,517,346
I am new to SQL Server triggers. Suppose we write an `after insert` trigger for table `tableA` and in that trigger, can we have an `INSERT` operation on the same table i.e `tableA`? Any suggestions please?
2015/09/11
[ "https://Stackoverflow.com/questions/32517346", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1047280/" ]
You can use [`CONTEXT_INFO`](https://technet.microsoft.com/en-us/library/ms189252(v=sql.105).aspx) to control when the trigger should or should not run: ``` CREATE TRIGGER TR_YourTable_AfterInsert ON YourTable AFTER INSERT AS BEGIN DECLARE @contextInfo VARBINARY(128) SELECT @contextInfo = CONTEXT_INFO() IF (@...
Yes, you can: **[SqlFiddleDemo](http://sqlfiddle.com/#!6/f19cf/1/0)** ``` CREATE TABLE tab(a INT); INSERT INTO tab(a) VALUES (1); CREATE TRIGGER trg_tab ON tab AFTER INSERT AS INSERT tab SELECT a+1 FROM inserted; INSERT INTO tab(a) VALUES (10); SELECT * FROM tab; ``` Result: ``` a 1 10 11 ```
74,624,629
Basically, I have a set of BigDecimal values for example **[3.2,3.10,3.12,3.17,3.9].** I want to sort them based on the values after the dot using java. The expected output should be like **[3.2,3.9,3.10,3.12,3.17]**. how do I write a code for this can you please help?
2022/11/30
[ "https://Stackoverflow.com/questions/74624629", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5741251/" ]
It seems you actually want to process version numbers, so I strongly discourage from abusing `BigDecimal` for that purpose. It’s too easy to accidentally confuse your logic with `BigDecimal`’s original numeric semantics. Create your own class reflecting the actual purpose, e.g. ```java public record Version(int major...
Create a method that returns the decimal part according to the `scale` of the given number (e.g. calling it with `3.10` will return `10`): ``` private static BigDecimal decimalPart(BigDecimal num) { var dec = num.remainder(BigDecimal.ONE); // decimal part (e.g. 0.10) var adj = dec.movePointRight(dec.scal...
13,407
In Nautilus, I would like to add columns displaying metadatas contained in files. This is mostly useful with audio and pictures files: * Audio : Artist, album, Track Title, Year ...(ID3 Tags) * Photos : Date taken, Image resolution, Columns would be editable in the standard 'View - Visible Columns' option in Nautilu...
2010/11/15
[ "https://askubuntu.com/questions/13407", "https://askubuntu.com", "https://askubuntu.com/users/2841/" ]
Follow this excellent how-to: [Adding metadata columns in Nautilus (Ubuntu)](https://web.archive.org/web/20101118031846/http://www.overclock.net:80/linux-unix/515783-how-adding-metadata-columns-nautilus-ubuntu.html). Here is a screenshot I took after following the how-to: [![alt text](https://i.stack.imgur.com/rslwG...
There may be a problem with nautilus-python and this extension (maybe just as of Ubuntu 13.04). If so, try one of these two solutions: 1. ``` sudo ln -sf /usr/lib/x86_64-linux-gnu/libpython2.7.so.1 /usr/lib/libpython2.7.so.1 sudo ldconfig ``` (From <https://bugs.launchpad.net/ubuntu/+source/nautilus/+bug/1157246>) ...
13,407
In Nautilus, I would like to add columns displaying metadatas contained in files. This is mostly useful with audio and pictures files: * Audio : Artist, album, Track Title, Year ...(ID3 Tags) * Photos : Date taken, Image resolution, Columns would be editable in the standard 'View - Visible Columns' option in Nautilu...
2010/11/15
[ "https://askubuntu.com/questions/13407", "https://askubuntu.com", "https://askubuntu.com/users/2841/" ]
`nautilus-columns` from `ppa:nilarimogard/webupd8` works great. You can install it with: ``` sudo apt-add-repository ppa:nilarimogard/webupd8 sudo apt-get update sudo apt-get install nautilus-columns ``` These are the columns that are added: ![nautilus-columns screen shot](https://i.stack.imgur.com/s6ASq.jpg)
There may be a problem with nautilus-python and this extension (maybe just as of Ubuntu 13.04). If so, try one of these two solutions: 1. ``` sudo ln -sf /usr/lib/x86_64-linux-gnu/libpython2.7.so.1 /usr/lib/libpython2.7.so.1 sudo ldconfig ``` (From <https://bugs.launchpad.net/ubuntu/+source/nautilus/+bug/1157246>) ...
27,126,148
I'm trying to insert an image in a MySQL database using Servlet and JSP in Tomcat 7. When I click on the save button, it displays null. I am not getting any errors. Also I set `commons-fileupload.jar` file and `commons-io.jar` file. If you have some demonstration code, please give me. ``` <%@ page language="java" co...
2014/11/25
[ "https://Stackoverflow.com/questions/27126148", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2415900/" ]
The following code explains how to store/retrieve an image to/from db. First create a table in your db using following code ```sql CREATE TABLE contacts ( contact_id int PRIMARY KEY AUTO_INCREMENT, first_name varchar(45) DEFAULT NULL, last_name varchar(45) DEFAULT NULL, photo` mediumblob); ``` Creat...
``` Jsp Page Save this page with any name <%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>JSP Page</title> </head> <body> <form action="abc" method="post" enctype="multip...
43,960,214
The color attribute not working in ionic 2. the color works in normal IONIC tags but not in the HTMl tags. can you help with this. code has been written below. ``` <ion-content> <div class="page-home"> <h1 color="secondary">LOGO</h1> <br/> <br/> <p color="danger">Sign in with social media account</p> <div id="socialL...
2017/05/14
[ "https://Stackoverflow.com/questions/43960214", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3614370/" ]
Use `ion-text` directive on your element then apply color. It will work. In your case it should be like this. ``` <h1 ion-text color="secondary">LOGO</h1> <!-- and --> <p ion-text color="danger">Sign in with social media account</p> ```
The `color` attributes on ionic components are `@Input`s, So they could be used only for Ionic components. See the Ionic docs for example: <https://ionicframework.com/docs/api/components/button/Button/#input-properties> For regular html use `[style.color]="regular css color / name or hash"`. If you want to use "secon...
15,333,134
I have a class like so: ``` class Node { // data Node* next; void operator++(int); }; ``` And when I define the post-increment operator like so: ``` void Node::operator++(int) { this = this->next; } ``` I get the error `Expression is not assignable` on `this = this->next;`. What's up with this? H...
2013/03/11
[ "https://Stackoverflow.com/questions/15333134", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1291990/" ]
This can not be changed. it is constant.
You just discovered why the STL has *iterators*. An iterator is holding a pointer to a node as a member of itself or in some cases it is a pointer. It could also modify it's member variable. Maybe try something like: ``` class Iterator { Node* node; public: Iterator(Node* n) : node( n ) {} Ite...
15,333,134
I have a class like so: ``` class Node { // data Node* next; void operator++(int); }; ``` And when I define the post-increment operator like so: ``` void Node::operator++(int) { this = this->next; } ``` I get the error `Expression is not assignable` on `this = this->next;`. What's up with this? H...
2013/03/11
[ "https://Stackoverflow.com/questions/15333134", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1291990/" ]
This can not be changed. it is constant.
You cannot do that. Even if by some dirty tricks you change `this`, the change won't be propagated to the caller. `this` is a hidden formal argument of methods.
15,333,134
I have a class like so: ``` class Node { // data Node* next; void operator++(int); }; ``` And when I define the post-increment operator like so: ``` void Node::operator++(int) { this = this->next; } ``` I get the error `Expression is not assignable` on `this = this->next;`. What's up with this? H...
2013/03/11
[ "https://Stackoverflow.com/questions/15333134", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1291990/" ]
Don't even try. It won't work, and if you could make it work, it would be a bad thing anyway. From the looks of things, your node is in something like a linked list. If that's the case, then what you normally want is something like: ``` template <class T> class linked_list { class node { node *next; ...
You cannot do that. Even if by some dirty tricks you change `this`, the change won't be propagated to the caller. `this` is a hidden formal argument of methods.
15,333,134
I have a class like so: ``` class Node { // data Node* next; void operator++(int); }; ``` And when I define the post-increment operator like so: ``` void Node::operator++(int) { this = this->next; } ``` I get the error `Expression is not assignable` on `this = this->next;`. What's up with this? H...
2013/03/11
[ "https://Stackoverflow.com/questions/15333134", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1291990/" ]
This can not be changed. it is constant.
The hidden parameter 'this' is passed with the 'const' qualifier. Hence it cannot be changed. [Hidden this](http://www.learncpp.com/cpp-tutorial/87-the-hidden-this-pointer/)
15,333,134
I have a class like so: ``` class Node { // data Node* next; void operator++(int); }; ``` And when I define the post-increment operator like so: ``` void Node::operator++(int) { this = this->next; } ``` I get the error `Expression is not assignable` on `this = this->next;`. What's up with this? H...
2013/03/11
[ "https://Stackoverflow.com/questions/15333134", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1291990/" ]
According to the C++ standard the `this` pointer is a *prvalue* expression (see [[class.this]](http://eel.is/c++draft/class.this)), however the assignment operator requires an *lvalue* as its left operand (see [[expr.ass]](http://eel.is/c++draft/expr.ass)).
You just discovered why the STL has *iterators*. An iterator is holding a pointer to a node as a member of itself or in some cases it is a pointer. It could also modify it's member variable. Maybe try something like: ``` class Iterator { Node* node; public: Iterator(Node* n) : node( n ) {} Ite...
15,333,134
I have a class like so: ``` class Node { // data Node* next; void operator++(int); }; ``` And when I define the post-increment operator like so: ``` void Node::operator++(int) { this = this->next; } ``` I get the error `Expression is not assignable` on `this = this->next;`. What's up with this? H...
2013/03/11
[ "https://Stackoverflow.com/questions/15333134", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1291990/" ]
Don't even try. It won't work, and if you could make it work, it would be a bad thing anyway. From the looks of things, your node is in something like a linked list. If that's the case, then what you normally want is something like: ``` template <class T> class linked_list { class node { node *next; ...
The hidden parameter 'this' is passed with the 'const' qualifier. Hence it cannot be changed. [Hidden this](http://www.learncpp.com/cpp-tutorial/87-the-hidden-this-pointer/)
15,333,134
I have a class like so: ``` class Node { // data Node* next; void operator++(int); }; ``` And when I define the post-increment operator like so: ``` void Node::operator++(int) { this = this->next; } ``` I get the error `Expression is not assignable` on `this = this->next;`. What's up with this? H...
2013/03/11
[ "https://Stackoverflow.com/questions/15333134", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1291990/" ]
Don't even try. It won't work, and if you could make it work, it would be a bad thing anyway. From the looks of things, your node is in something like a linked list. If that's the case, then what you normally want is something like: ``` template <class T> class linked_list { class node { node *next; ...
According to the C++ standard the `this` pointer is a *prvalue* expression (see [[class.this]](http://eel.is/c++draft/class.this)), however the assignment operator requires an *lvalue* as its left operand (see [[expr.ass]](http://eel.is/c++draft/expr.ass)).
15,333,134
I have a class like so: ``` class Node { // data Node* next; void operator++(int); }; ``` And when I define the post-increment operator like so: ``` void Node::operator++(int) { this = this->next; } ``` I get the error `Expression is not assignable` on `this = this->next;`. What's up with this? H...
2013/03/11
[ "https://Stackoverflow.com/questions/15333134", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1291990/" ]
According to the C++ standard the `this` pointer is a *prvalue* expression (see [[class.this]](http://eel.is/c++draft/class.this)), however the assignment operator requires an *lvalue* as its left operand (see [[expr.ass]](http://eel.is/c++draft/expr.ass)).
You seem very confused in terms of what you are trying to do here. You have a `node` class which represents a node in the list. Typically one would also have an `iterator` class which represents the position in the list that you are currently at. It seems to me that you are trying to use `++` to iterate to the next ite...
15,333,134
I have a class like so: ``` class Node { // data Node* next; void operator++(int); }; ``` And when I define the post-increment operator like so: ``` void Node::operator++(int) { this = this->next; } ``` I get the error `Expression is not assignable` on `this = this->next;`. What's up with this? H...
2013/03/11
[ "https://Stackoverflow.com/questions/15333134", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1291990/" ]
According to the C++ standard the `this` pointer is a *prvalue* expression (see [[class.this]](http://eel.is/c++draft/class.this)), however the assignment operator requires an *lvalue* as its left operand (see [[expr.ass]](http://eel.is/c++draft/expr.ass)).
The hidden parameter 'this' is passed with the 'const' qualifier. Hence it cannot be changed. [Hidden this](http://www.learncpp.com/cpp-tutorial/87-the-hidden-this-pointer/)
15,333,134
I have a class like so: ``` class Node { // data Node* next; void operator++(int); }; ``` And when I define the post-increment operator like so: ``` void Node::operator++(int) { this = this->next; } ``` I get the error `Expression is not assignable` on `this = this->next;`. What's up with this? H...
2013/03/11
[ "https://Stackoverflow.com/questions/15333134", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1291990/" ]
Don't even try. It won't work, and if you could make it work, it would be a bad thing anyway. From the looks of things, your node is in something like a linked list. If that's the case, then what you normally want is something like: ``` template <class T> class linked_list { class node { node *next; ...
This can not be changed. it is constant.