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
9,437,313
I have a function here that finds the sibling(answerfields) of the parent(li) then counts the child inputs. ``` $('#addAnswer').live('click', function(){ var selected = $(this).parents('li').siblings('#answerFields').children('input').length; document.getElementById('legend').innerHTML = selected; }); ``` Ho...
2012/02/24
[ "https://Stackoverflow.com/questions/9437313", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1082764/" ]
Other way could be using `perl`: ``` perl -i -pe ' BEGIN { $keysalts = qx(curl -sS https://api.wordpress.org/secret-key/1.1/salt) } s/{AUTH-KEYS-SALTS}/$keysalts/g ' wp-config.php ```
You can escape `$keysalts` using sed itself: ``` sed -i "s/{AUTH-KEYS-SALTS}/`echo $keysalts | sed -e 's/[\/&]/\\&/g'`/g" wp-config.php ``` See [this question](https://stackoverflow.com/questions/407523/escape-a-string-for-sed-search-pattern) for more information.
9,437,313
I have a function here that finds the sibling(answerfields) of the parent(li) then counts the child inputs. ``` $('#addAnswer').live('click', function(){ var selected = $(this).parents('li').siblings('#answerFields').children('input').length; document.getElementById('legend').innerHTML = selected; }); ``` Ho...
2012/02/24
[ "https://Stackoverflow.com/questions/9437313", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1082764/" ]
You can escape `$keysalts` using sed itself: ``` sed -i "s/{AUTH-KEYS-SALTS}/`echo $keysalts | sed -e 's/[\/&]/\\&/g'`/g" wp-config.php ``` See [this question](https://stackoverflow.com/questions/407523/escape-a-string-for-sed-search-pattern) for more information.
Actually, I like this [one better](https://stackoverflow.com/questions/584894/sed-scripting-environment-variable-substitution) ``` sed -i 's/{AUTH-KEYS-SALTS}/'"$keysalts"'/g' wp-config.php ``` Personal choice. :-)
9,437,313
I have a function here that finds the sibling(answerfields) of the parent(li) then counts the child inputs. ``` $('#addAnswer').live('click', function(){ var selected = $(this).parents('li').siblings('#answerFields').children('input').length; document.getElementById('legend').innerHTML = selected; }); ``` Ho...
2012/02/24
[ "https://Stackoverflow.com/questions/9437313", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1082764/" ]
You can escape `$keysalts` using sed itself: ``` sed -i "s/{AUTH-KEYS-SALTS}/`echo $keysalts | sed -e 's/[\/&]/\\&/g'`/g" wp-config.php ``` See [this question](https://stackoverflow.com/questions/407523/escape-a-string-for-sed-search-pattern) for more information.
It turns out you're asking the wrong question. I also asked the wrong question. The reason it's wrong is the beginning of the first sentence: "In my bash script...". I had the same question & made the same mistake. If you're using bash, you don't need to use sed to do string replacements (and it's much cleaner to use ...
9,437,313
I have a function here that finds the sibling(answerfields) of the parent(li) then counts the child inputs. ``` $('#addAnswer').live('click', function(){ var selected = $(this).parents('li').siblings('#answerFields').children('input').length; document.getElementById('legend').innerHTML = selected; }); ``` Ho...
2012/02/24
[ "https://Stackoverflow.com/questions/9437313", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1082764/" ]
Other way could be using `perl`: ``` perl -i -pe ' BEGIN { $keysalts = qx(curl -sS https://api.wordpress.org/secret-key/1.1/salt) } s/{AUTH-KEYS-SALTS}/$keysalts/g ' wp-config.php ```
Actually, I like this [one better](https://stackoverflow.com/questions/584894/sed-scripting-environment-variable-substitution) ``` sed -i 's/{AUTH-KEYS-SALTS}/'"$keysalts"'/g' wp-config.php ``` Personal choice. :-)
9,437,313
I have a function here that finds the sibling(answerfields) of the parent(li) then counts the child inputs. ``` $('#addAnswer').live('click', function(){ var selected = $(this).parents('li').siblings('#answerFields').children('input').length; document.getElementById('legend').innerHTML = selected; }); ``` Ho...
2012/02/24
[ "https://Stackoverflow.com/questions/9437313", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1082764/" ]
Other way could be using `perl`: ``` perl -i -pe ' BEGIN { $keysalts = qx(curl -sS https://api.wordpress.org/secret-key/1.1/salt) } s/{AUTH-KEYS-SALTS}/$keysalts/g ' wp-config.php ```
It turns out you're asking the wrong question. I also asked the wrong question. The reason it's wrong is the beginning of the first sentence: "In my bash script...". I had the same question & made the same mistake. If you're using bash, you don't need to use sed to do string replacements (and it's much cleaner to use ...
9,437,313
I have a function here that finds the sibling(answerfields) of the parent(li) then counts the child inputs. ``` $('#addAnswer').live('click', function(){ var selected = $(this).parents('li').siblings('#answerFields').children('input').length; document.getElementById('legend').innerHTML = selected; }); ``` Ho...
2012/02/24
[ "https://Stackoverflow.com/questions/9437313", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1082764/" ]
Actually, I like this [one better](https://stackoverflow.com/questions/584894/sed-scripting-environment-variable-substitution) ``` sed -i 's/{AUTH-KEYS-SALTS}/'"$keysalts"'/g' wp-config.php ``` Personal choice. :-)
It turns out you're asking the wrong question. I also asked the wrong question. The reason it's wrong is the beginning of the first sentence: "In my bash script...". I had the same question & made the same mistake. If you're using bash, you don't need to use sed to do string replacements (and it's much cleaner to use ...
65,710
My college network requires Bradford Persistent Agent and Mcafee Virus Software 8.7i. The Bradford Persistent Agent basically checks to make sure Mcafee is running and updated, and reports this status to the network. If it is configured incorrectly, I cannot access the Internet. Right now, I am running off of the devic...
2009/11/04
[ "https://superuser.com/questions/65710", "https://superuser.com", "https://superuser.com/users/16130/" ]
Okay, if you are compiling yourself, then a simple ``` ./configure --prefix=/opt/git-1.6.5.2 ``` (and then `make`, `make install`) should suffice. Your binary files are now in `/opt/git-1.6.5.2/bin`. Obvously, you can change the directory to your needs.
Just install the new version. They will still be compatible. (no guarentees on 2.0 whenever they make it, but there should be **no** incompatibilites between two 1.6.x versions)
43,515,008
I have a func calculate\_tax that should take a *name:salary* pair as an argument, calculates the tax then returns a dictionary of *name:total\_tax* pair.However, it seem not to calculate tax correctly.What could I be doing wrong? Here is the code: ``` def calculate_tax(**data): for key in data: if data[ke...
2017/04/20
[ "https://Stackoverflow.com/questions/43515008", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5127707/" ]
I would use `orElse` ``` static final List<String> CASH_CARD = Arrays.asList("CASH", "CARD"); public List<Order> getForHotelOrders(Long hotelId, Optional<LocalDate> fromDate, Optional<LocalDate> toDate, O...
Can use orElse(default), to overcome multiple if else... ``` public List<Order> getForHotelOrders(Long hotelId, Optional<LocalDate> fromDate, Optional<LocalDate> toDate, Optional<List<String>> paymentTypes) { List<Order> orders; LocalDate defaultDate = LocalDate.now(); orders = orderRepository.getForHotel(...
11,474,301
I have lists of two Shapes - Rectangles and Circles. They both share 3 common properties - ID , Type and Bounds Circles have 2 extra properties - Range and Center How can i join lists of each type into a single list so i can iterate over them so i don't have to type two foreach cycles Could this be donne in a bette...
2012/07/13
[ "https://Stackoverflow.com/questions/11474301", "https://Stackoverflow.com", "https://Stackoverflow.com/users/122765/" ]
Make an interface `IShape` that contains the common properties, then implement that as well as ICircle and IRectangle. (You could also use a base class that has the properties). You should them be able to join list of Circles and Rectangles to get a list of IShapes.
You could further add an interface ``` public interface IShape { string Id; GeoLocationTypes Type; Bounds Bounds; } ```
11,474,301
I have lists of two Shapes - Rectangles and Circles. They both share 3 common properties - ID , Type and Bounds Circles have 2 extra properties - Range and Center How can i join lists of each type into a single list so i can iterate over them so i don't have to type two foreach cycles Could this be donne in a bette...
2012/07/13
[ "https://Stackoverflow.com/questions/11474301", "https://Stackoverflow.com", "https://Stackoverflow.com/users/122765/" ]
Make both `IRectangle` and `ICircle` inherit from a shared type - say `IShape`. A `List<IShape>` will then be able to take any `IRectangle` and `ICircle` types and their inheriting types. Since both `IRectangle` and `ICircle` share a number of properties, you can do this: ``` public interface IShape { string Id ...
You could further add an interface ``` public interface IShape { string Id; GeoLocationTypes Type; Bounds Bounds; } ```
11,474,301
I have lists of two Shapes - Rectangles and Circles. They both share 3 common properties - ID , Type and Bounds Circles have 2 extra properties - Range and Center How can i join lists of each type into a single list so i can iterate over them so i don't have to type two foreach cycles Could this be donne in a bette...
2012/07/13
[ "https://Stackoverflow.com/questions/11474301", "https://Stackoverflow.com", "https://Stackoverflow.com/users/122765/" ]
You could further add an interface ``` public interface IShape { string Id; GeoLocationTypes Type; Bounds Bounds; } ```
How about this ``` var merged = Rectagles.Select(r => new { r.Id, r.Type, r.Bounds, Radius = float.NaN, Centre = default(Coordinates) }) .Concat(Circles.Select(c => new { c.Id, c.Type, c.Bounds, c.Radius, c.Centre })); ``` it gi...
11,474,301
I have lists of two Shapes - Rectangles and Circles. They both share 3 common properties - ID , Type and Bounds Circles have 2 extra properties - Range and Center How can i join lists of each type into a single list so i can iterate over them so i don't have to type two foreach cycles Could this be donne in a bette...
2012/07/13
[ "https://Stackoverflow.com/questions/11474301", "https://Stackoverflow.com", "https://Stackoverflow.com/users/122765/" ]
Make both `IRectangle` and `ICircle` inherit from a shared type - say `IShape`. A `List<IShape>` will then be able to take any `IRectangle` and `ICircle` types and their inheriting types. Since both `IRectangle` and `ICircle` share a number of properties, you can do this: ``` public interface IShape { string Id ...
Make an interface `IShape` that contains the common properties, then implement that as well as ICircle and IRectangle. (You could also use a base class that has the properties). You should them be able to join list of Circles and Rectangles to get a list of IShapes.
11,474,301
I have lists of two Shapes - Rectangles and Circles. They both share 3 common properties - ID , Type and Bounds Circles have 2 extra properties - Range and Center How can i join lists of each type into a single list so i can iterate over them so i don't have to type two foreach cycles Could this be donne in a bette...
2012/07/13
[ "https://Stackoverflow.com/questions/11474301", "https://Stackoverflow.com", "https://Stackoverflow.com/users/122765/" ]
Make an interface `IShape` that contains the common properties, then implement that as well as ICircle and IRectangle. (You could also use a base class that has the properties). You should them be able to join list of Circles and Rectangles to get a list of IShapes.
You could make them each use an IShape interface, or you could iterate over Objects and cast. ``` public interface IShape { string Id { get; set; } GeoLocationTypes Type { get; set; } Bounds Bounds { get; set; } } public interface IRectangle : IShape { } public class Rectangle : IRectangle { // No c...
11,474,301
I have lists of two Shapes - Rectangles and Circles. They both share 3 common properties - ID , Type and Bounds Circles have 2 extra properties - Range and Center How can i join lists of each type into a single list so i can iterate over them so i don't have to type two foreach cycles Could this be donne in a bette...
2012/07/13
[ "https://Stackoverflow.com/questions/11474301", "https://Stackoverflow.com", "https://Stackoverflow.com/users/122765/" ]
Make an interface `IShape` that contains the common properties, then implement that as well as ICircle and IRectangle. (You could also use a base class that has the properties). You should them be able to join list of Circles and Rectangles to get a list of IShapes.
How about this ``` var merged = Rectagles.Select(r => new { r.Id, r.Type, r.Bounds, Radius = float.NaN, Centre = default(Coordinates) }) .Concat(Circles.Select(c => new { c.Id, c.Type, c.Bounds, c.Radius, c.Centre })); ``` it gi...
11,474,301
I have lists of two Shapes - Rectangles and Circles. They both share 3 common properties - ID , Type and Bounds Circles have 2 extra properties - Range and Center How can i join lists of each type into a single list so i can iterate over them so i don't have to type two foreach cycles Could this be donne in a bette...
2012/07/13
[ "https://Stackoverflow.com/questions/11474301", "https://Stackoverflow.com", "https://Stackoverflow.com/users/122765/" ]
Make both `IRectangle` and `ICircle` inherit from a shared type - say `IShape`. A `List<IShape>` will then be able to take any `IRectangle` and `ICircle` types and their inheriting types. Since both `IRectangle` and `ICircle` share a number of properties, you can do this: ``` public interface IShape { string Id ...
You could make them each use an IShape interface, or you could iterate over Objects and cast. ``` public interface IShape { string Id { get; set; } GeoLocationTypes Type { get; set; } Bounds Bounds { get; set; } } public interface IRectangle : IShape { } public class Rectangle : IRectangle { // No c...
11,474,301
I have lists of two Shapes - Rectangles and Circles. They both share 3 common properties - ID , Type and Bounds Circles have 2 extra properties - Range and Center How can i join lists of each type into a single list so i can iterate over them so i don't have to type two foreach cycles Could this be donne in a bette...
2012/07/13
[ "https://Stackoverflow.com/questions/11474301", "https://Stackoverflow.com", "https://Stackoverflow.com/users/122765/" ]
Make both `IRectangle` and `ICircle` inherit from a shared type - say `IShape`. A `List<IShape>` will then be able to take any `IRectangle` and `ICircle` types and their inheriting types. Since both `IRectangle` and `ICircle` share a number of properties, you can do this: ``` public interface IShape { string Id ...
How about this ``` var merged = Rectagles.Select(r => new { r.Id, r.Type, r.Bounds, Radius = float.NaN, Centre = default(Coordinates) }) .Concat(Circles.Select(c => new { c.Id, c.Type, c.Bounds, c.Radius, c.Centre })); ``` it gi...
11,474,301
I have lists of two Shapes - Rectangles and Circles. They both share 3 common properties - ID , Type and Bounds Circles have 2 extra properties - Range and Center How can i join lists of each type into a single list so i can iterate over them so i don't have to type two foreach cycles Could this be donne in a bette...
2012/07/13
[ "https://Stackoverflow.com/questions/11474301", "https://Stackoverflow.com", "https://Stackoverflow.com/users/122765/" ]
You could make them each use an IShape interface, or you could iterate over Objects and cast. ``` public interface IShape { string Id { get; set; } GeoLocationTypes Type { get; set; } Bounds Bounds { get; set; } } public interface IRectangle : IShape { } public class Rectangle : IRectangle { // No c...
How about this ``` var merged = Rectagles.Select(r => new { r.Id, r.Type, r.Bounds, Radius = float.NaN, Centre = default(Coordinates) }) .Concat(Circles.Select(c => new { c.Id, c.Type, c.Bounds, c.Radius, c.Centre })); ``` it gi...
20,438,517
I have a list of ID’s Shown below. ``` AT0920130004 AT0920130005 AT0920130006 AT0920130007 AT0920130008 AT0920130009 AT0920130010 AT1020130001 AT1020130002 AT1020130003 AT1020130004 AT1020130005 AT1120130003 AT1120130004 AT1120130005 AT1120130006 ``` Here an example record has the format `ATmmyyyyxxxx`. where `AT...
2013/12/07
[ "https://Stackoverflow.com/questions/20438517", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2881402/" ]
You can use this query to get max ID for each month and year ``` select substring([id], 3, 6) MonthYear, max([id]) MaxID from yourtable group by substring([id], 3, 6) ``` --- To get max ID for one specific month, you can use this query: ``` select max([id]) from yourtable where cast(substring([id], 5, 4) as int) =...
try this : ``` select MAX(t.ID) from TableName t group by SUBSTRING(t.ID, 3, 2) ```
20,438,517
I have a list of ID’s Shown below. ``` AT0920130004 AT0920130005 AT0920130006 AT0920130007 AT0920130008 AT0920130009 AT0920130010 AT1020130001 AT1020130002 AT1020130003 AT1020130004 AT1020130005 AT1120130003 AT1120130004 AT1120130005 AT1120130006 ``` Here an example record has the format `ATmmyyyyxxxx`. where `AT...
2013/12/07
[ "https://Stackoverflow.com/questions/20438517", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2881402/" ]
try this : ``` select MAX(t.ID) from TableName t group by SUBSTRING(t.ID, 3, 2) ```
You basically want to get the max id that matches a location, a month and a year. Something like this should do it: ``` SELECT max(id) FROM myTable WHERE substring(id, 0, 2) = [location] AND susbstring(id, 2, 2) = [month] AND substring(id, 4, 4) = [year] ```
20,438,517
I have a list of ID’s Shown below. ``` AT0920130004 AT0920130005 AT0920130006 AT0920130007 AT0920130008 AT0920130009 AT0920130010 AT1020130001 AT1020130002 AT1020130003 AT1020130004 AT1020130005 AT1120130003 AT1120130004 AT1120130005 AT1120130006 ``` Here an example record has the format `ATmmyyyyxxxx`. where `AT...
2013/12/07
[ "https://Stackoverflow.com/questions/20438517", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2881402/" ]
try this : ``` select MAX(t.ID) from TableName t group by SUBSTRING(t.ID, 3, 2) ```
try this(this will return whole field, and just id): ``` SELECT YOUR_FIELD, MAX(RIGHT(YOUR_FIELD,4)) AS just_id FROM YOUR_TABLE WHERE RIGHT(YOUR_FIELD,LENGTH(YOUR_FIELD)-2) LIKE '09%' ```
20,438,517
I have a list of ID’s Shown below. ``` AT0920130004 AT0920130005 AT0920130006 AT0920130007 AT0920130008 AT0920130009 AT0920130010 AT1020130001 AT1020130002 AT1020130003 AT1020130004 AT1020130005 AT1120130003 AT1120130004 AT1120130005 AT1120130006 ``` Here an example record has the format `ATmmyyyyxxxx`. where `AT...
2013/12/07
[ "https://Stackoverflow.com/questions/20438517", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2881402/" ]
You can use this query to get max ID for each month and year ``` select substring([id], 3, 6) MonthYear, max([id]) MaxID from yourtable group by substring([id], 3, 6) ``` --- To get max ID for one specific month, you can use this query: ``` select max([id]) from yourtable where cast(substring([id], 5, 4) as int) =...
You basically want to get the max id that matches a location, a month and a year. Something like this should do it: ``` SELECT max(id) FROM myTable WHERE substring(id, 0, 2) = [location] AND susbstring(id, 2, 2) = [month] AND substring(id, 4, 4) = [year] ```
20,438,517
I have a list of ID’s Shown below. ``` AT0920130004 AT0920130005 AT0920130006 AT0920130007 AT0920130008 AT0920130009 AT0920130010 AT1020130001 AT1020130002 AT1020130003 AT1020130004 AT1020130005 AT1120130003 AT1120130004 AT1120130005 AT1120130006 ``` Here an example record has the format `ATmmyyyyxxxx`. where `AT...
2013/12/07
[ "https://Stackoverflow.com/questions/20438517", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2881402/" ]
You can use this query to get max ID for each month and year ``` select substring([id], 3, 6) MonthYear, max([id]) MaxID from yourtable group by substring([id], 3, 6) ``` --- To get max ID for one specific month, you can use this query: ``` select max([id]) from yourtable where cast(substring([id], 5, 4) as int) =...
try this(this will return whole field, and just id): ``` SELECT YOUR_FIELD, MAX(RIGHT(YOUR_FIELD,4)) AS just_id FROM YOUR_TABLE WHERE RIGHT(YOUR_FIELD,LENGTH(YOUR_FIELD)-2) LIKE '09%' ```
59,085,586
I recently discovered this way of doing in VBA, you populate a function value by passing it as an argument of another function, and then, when the parameter of this other function is filled, its link to the first function value. **EDIT FOR CLARIFICATION** : This idea explained by the teacher was that sometimes, you ha...
2019/11/28
[ "https://Stackoverflow.com/questions/59085586", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6621137/" ]
I am not sure what you are meaning to do here, but the function is nothing but an unnecessarily nested function. The `g` in the second function is not used whatsoever in its execution, and neither is `b` as optional parameter. For example what happens for g(3): With `a` replaced by "3" ``` Function g("3" as integer) ...
In VBA, within a function you can `access/assign` a value to the function name and no you cannot pass an actual function like you would do in C# `Func<T1, T2, TResult>` i.e. ``` Function g(a as integer) 'Here you are allowed do read or write values to the function name g. 'g = 10 ' assigning a return value ...
59,085,586
I recently discovered this way of doing in VBA, you populate a function value by passing it as an argument of another function, and then, when the parameter of this other function is filled, its link to the first function value. **EDIT FOR CLARIFICATION** : This idea explained by the teacher was that sometimes, you ha...
2019/11/28
[ "https://Stackoverflow.com/questions/59085586", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6621137/" ]
I changed it into an example that can be run: ``` Option Explicit Sub Test() Debug.Print result1(1, 2, 3) Debug.Print result2(1, 2, 3) End Sub Function f(a, b, c, Optional result1 As Variant, Optional result2 As Variant) As Boolean Dim raw_result raw_result = a + b + c result1 = raw_result re...
In VBA, within a function you can `access/assign` a value to the function name and no you cannot pass an actual function like you would do in C# `Func<T1, T2, TResult>` i.e. ``` Function g(a as integer) 'Here you are allowed do read or write values to the function name g. 'g = 10 ' assigning a return value ...
59,085,586
I recently discovered this way of doing in VBA, you populate a function value by passing it as an argument of another function, and then, when the parameter of this other function is filled, its link to the first function value. **EDIT FOR CLARIFICATION** : This idea explained by the teacher was that sometimes, you ha...
2019/11/28
[ "https://Stackoverflow.com/questions/59085586", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6621137/" ]
I changed it into an example that can be run: ``` Option Explicit Sub Test() Debug.Print result1(1, 2, 3) Debug.Print result2(1, 2, 3) End Sub Function f(a, b, c, Optional result1 As Variant, Optional result2 As Variant) As Boolean Dim raw_result raw_result = a + b + c result1 = raw_result re...
I am not sure what you are meaning to do here, but the function is nothing but an unnecessarily nested function. The `g` in the second function is not used whatsoever in its execution, and neither is `b` as optional parameter. For example what happens for g(3): With `a` replaced by "3" ``` Function g("3" as integer) ...
324,162
I have a figure `fig_name.eps` with the surrounding text in `fig_name.tex`. They are in a sub directory called fig\_dir. I used the following in the beginning of my document to change the path for `input`. ``` \makeatletter \def\input@path{{/path/to/fig_dir/}} \makeatother ``` I am using `\input{fig_name}` to inclu...
2016/08/10
[ "https://tex.stackexchange.com/questions/324162", "https://tex.stackexchange.com", "https://tex.stackexchange.com/users/111739/" ]
gnuplot's `epslatex` terminal creates two files `fig_name.tex` and `fig_name.eps`. You have to call `fig_name.tex` from your main file with `\input{fig_name}`, but this one will load `fig_name.eps` with an `\includegraphics` command. Open `fig_name.tex` with an editor and will find a line with contents: ``` \put(0,0){...
Too long for a comment. The following works fine for me: ``` % My standard header for TeX.SX answers: \documentclass[a4paper]{article} % To avoid confusion, let us explicitly % declare the paper format. \usepackage[T1]{fontenc} % Not always necessary, but recommended. % End o...
11,015,807
I am successfully using zxing to scan codes, by calling the installed barcode reader's intent, but when it beeps and indicates a good scan I expect the zxing activity would return control so I can process the result, but it sits there and tries to scan again. I have to press the back button and *then* it returns and I ...
2012/06/13
[ "https://Stackoverflow.com/questions/11015807", "https://Stackoverflow.com", "https://Stackoverflow.com/users/769506/" ]
Why not use the provided `IntentIntegrator` class? This is the only approach mentioned in the project docs, did you have a look at those? <https://github.com/zxing/zxing/wiki/Scanning-Via-Intent> I created it to wrap up these details of sending and parsing the Intent, so you don't make typos. For example, there's no s...
Add finishActivity(requestCode); at the end of onActivityResult() method. Try this: Replace your first 2 lines in onTouch with the below code. It seems the issue is while scanning codes other than QR. Please remove the scan filter and check once. Intent intent = new Intent("com.google.zxing.client.android.SCAN"); int...
11,015,807
I am successfully using zxing to scan codes, by calling the installed barcode reader's intent, but when it beeps and indicates a good scan I expect the zxing activity would return control so I can process the result, but it sits there and tries to scan again. I have to press the back button and *then* it returns and I ...
2012/06/13
[ "https://Stackoverflow.com/questions/11015807", "https://Stackoverflow.com", "https://Stackoverflow.com/users/769506/" ]
Here's the full answer to my own question, hope this helps someone: Go [here](http://code.google.com/p/zxing/source/browse/trunk/android-integration/src/com/google/zxing/integration/android/IntentIntegrator.java?r=860) and copy the whole IntentIntegrator class, add it to your app; also go [here](http://code.google.com...
Add finishActivity(requestCode); at the end of onActivityResult() method. Try this: Replace your first 2 lines in onTouch with the below code. It seems the issue is while scanning codes other than QR. Please remove the scan filter and check once. Intent intent = new Intent("com.google.zxing.client.android.SCAN"); int...
11,015,807
I am successfully using zxing to scan codes, by calling the installed barcode reader's intent, but when it beeps and indicates a good scan I expect the zxing activity would return control so I can process the result, but it sits there and tries to scan again. I have to press the back button and *then* it returns and I ...
2012/06/13
[ "https://Stackoverflow.com/questions/11015807", "https://Stackoverflow.com", "https://Stackoverflow.com/users/769506/" ]
Add finishActivity(requestCode); at the end of onActivityResult() method. Try this: Replace your first 2 lines in onTouch with the below code. It seems the issue is while scanning codes other than QR. Please remove the scan filter and check once. Intent intent = new Intent("com.google.zxing.client.android.SCAN"); int...
Here is the solution that I am using. It is working fine for me. ``` Intent intent = new Intent(SelectOptionActivity.this, CaptureActivity.class); intent.putExtra("SCAN_MODE", "ONE_D_MODE"); intent.putExtra("SCAN_FORMATS", "CODE_39,CODE_93,CODE_128,DATA_MATRIX,ITF,CODABAR,EAN_13,EAN_8,U...
11,015,807
I am successfully using zxing to scan codes, by calling the installed barcode reader's intent, but when it beeps and indicates a good scan I expect the zxing activity would return control so I can process the result, but it sits there and tries to scan again. I have to press the back button and *then* it returns and I ...
2012/06/13
[ "https://Stackoverflow.com/questions/11015807", "https://Stackoverflow.com", "https://Stackoverflow.com/users/769506/" ]
Why not use the provided `IntentIntegrator` class? This is the only approach mentioned in the project docs, did you have a look at those? <https://github.com/zxing/zxing/wiki/Scanning-Via-Intent> I created it to wrap up these details of sending and parsing the Intent, so you don't make typos. For example, there's no s...
Here's the full answer to my own question, hope this helps someone: Go [here](http://code.google.com/p/zxing/source/browse/trunk/android-integration/src/com/google/zxing/integration/android/IntentIntegrator.java?r=860) and copy the whole IntentIntegrator class, add it to your app; also go [here](http://code.google.com...
11,015,807
I am successfully using zxing to scan codes, by calling the installed barcode reader's intent, but when it beeps and indicates a good scan I expect the zxing activity would return control so I can process the result, but it sits there and tries to scan again. I have to press the back button and *then* it returns and I ...
2012/06/13
[ "https://Stackoverflow.com/questions/11015807", "https://Stackoverflow.com", "https://Stackoverflow.com/users/769506/" ]
Why not use the provided `IntentIntegrator` class? This is the only approach mentioned in the project docs, did you have a look at those? <https://github.com/zxing/zxing/wiki/Scanning-Via-Intent> I created it to wrap up these details of sending and parsing the Intent, so you don't make typos. For example, there's no s...
I was having the same issue so I tried using the IntentIntegrator class as recommended by Sean Owen. I still had the problem until I realized this was only happening when trying to scan a barcode in portrait (most frequently on phones). It turns out that the orientation change from portrait to landscape causes the doub...
11,015,807
I am successfully using zxing to scan codes, by calling the installed barcode reader's intent, but when it beeps and indicates a good scan I expect the zxing activity would return control so I can process the result, but it sits there and tries to scan again. I have to press the back button and *then* it returns and I ...
2012/06/13
[ "https://Stackoverflow.com/questions/11015807", "https://Stackoverflow.com", "https://Stackoverflow.com/users/769506/" ]
Why not use the provided `IntentIntegrator` class? This is the only approach mentioned in the project docs, did you have a look at those? <https://github.com/zxing/zxing/wiki/Scanning-Via-Intent> I created it to wrap up these details of sending and parsing the Intent, so you don't make typos. For example, there's no s...
Here is the solution that I am using. It is working fine for me. ``` Intent intent = new Intent(SelectOptionActivity.this, CaptureActivity.class); intent.putExtra("SCAN_MODE", "ONE_D_MODE"); intent.putExtra("SCAN_FORMATS", "CODE_39,CODE_93,CODE_128,DATA_MATRIX,ITF,CODABAR,EAN_13,EAN_8,U...
11,015,807
I am successfully using zxing to scan codes, by calling the installed barcode reader's intent, but when it beeps and indicates a good scan I expect the zxing activity would return control so I can process the result, but it sits there and tries to scan again. I have to press the back button and *then* it returns and I ...
2012/06/13
[ "https://Stackoverflow.com/questions/11015807", "https://Stackoverflow.com", "https://Stackoverflow.com/users/769506/" ]
Here's the full answer to my own question, hope this helps someone: Go [here](http://code.google.com/p/zxing/source/browse/trunk/android-integration/src/com/google/zxing/integration/android/IntentIntegrator.java?r=860) and copy the whole IntentIntegrator class, add it to your app; also go [here](http://code.google.com...
I was having the same issue so I tried using the IntentIntegrator class as recommended by Sean Owen. I still had the problem until I realized this was only happening when trying to scan a barcode in portrait (most frequently on phones). It turns out that the orientation change from portrait to landscape causes the doub...
11,015,807
I am successfully using zxing to scan codes, by calling the installed barcode reader's intent, but when it beeps and indicates a good scan I expect the zxing activity would return control so I can process the result, but it sits there and tries to scan again. I have to press the back button and *then* it returns and I ...
2012/06/13
[ "https://Stackoverflow.com/questions/11015807", "https://Stackoverflow.com", "https://Stackoverflow.com/users/769506/" ]
Here's the full answer to my own question, hope this helps someone: Go [here](http://code.google.com/p/zxing/source/browse/trunk/android-integration/src/com/google/zxing/integration/android/IntentIntegrator.java?r=860) and copy the whole IntentIntegrator class, add it to your app; also go [here](http://code.google.com...
Here is the solution that I am using. It is working fine for me. ``` Intent intent = new Intent(SelectOptionActivity.this, CaptureActivity.class); intent.putExtra("SCAN_MODE", "ONE_D_MODE"); intent.putExtra("SCAN_FORMATS", "CODE_39,CODE_93,CODE_128,DATA_MATRIX,ITF,CODABAR,EAN_13,EAN_8,U...
11,015,807
I am successfully using zxing to scan codes, by calling the installed barcode reader's intent, but when it beeps and indicates a good scan I expect the zxing activity would return control so I can process the result, but it sits there and tries to scan again. I have to press the back button and *then* it returns and I ...
2012/06/13
[ "https://Stackoverflow.com/questions/11015807", "https://Stackoverflow.com", "https://Stackoverflow.com/users/769506/" ]
I was having the same issue so I tried using the IntentIntegrator class as recommended by Sean Owen. I still had the problem until I realized this was only happening when trying to scan a barcode in portrait (most frequently on phones). It turns out that the orientation change from portrait to landscape causes the doub...
Here is the solution that I am using. It is working fine for me. ``` Intent intent = new Intent(SelectOptionActivity.this, CaptureActivity.class); intent.putExtra("SCAN_MODE", "ONE_D_MODE"); intent.putExtra("SCAN_FORMATS", "CODE_39,CODE_93,CODE_128,DATA_MATRIX,ITF,CODABAR,EAN_13,EAN_8,U...
8,580,656
I have an auinotebook, is there anyway to get a list of all pages in the notebook? When the user selects an action from a list, a new page is added to the notebook. If they select that action again, then the page should not be added again (instead, that page will be selected for them). I can't see to figure out how to ...
2011/12/20
[ "https://Stackoverflow.com/questions/8580656", "https://Stackoverflow.com", "https://Stackoverflow.com/users/563299/" ]
Assuming you are using wx.lib.agw.aui.AuiNotebook: ``` import wx.lib.agw.aui as aui class MyNotebook(aui.AuiNotebook): def __getitem__(self, index): ''' More pythonic way to get a specific page, also useful for iterating over all pages, e.g: for page in notebook: ... ''' if index < sel...
You don't mention which AuiNotebook you're using. Is it the one that comes with wx.aui or wx.lib.agw.aui? Either way, I would think you could use GetChildren() to get a list of the notebook's panels and iterate through those as necessary. There's also a GetPageCount that you might be able to use in conjunction with Get...
478,060
We all have elaborative discussion in physics about classical mechanics as well as interaction of particles through forces and certain laws which all particles obey. I want to ask,Does a particle exert a force on itself? **EDIT** Thanks for the respectful answers and comments.I edited this question in order to make ...
2019/05/05
[ "https://physics.stackexchange.com/questions/478060", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/230533/" ]
This question is never addressed by teachers, altough students start asking it more and more every year (surprisingly). Here are two possible arguments. 1. A particle is meant to have 0 volume. Maybe you're used to exert a force on yourself, but you are an extended body. Particles are points in space. I find it quite ...
This exact question is considered at the end of Jackson's (somewhat infamous) *Classical Electrodynamics*. I think it would be appropriate to simply quote the relevant passage: > > In the preceding chapters the problems of electrodynamics have been > divided into two classes: one in which the sources of charge and >...
478,060
We all have elaborative discussion in physics about classical mechanics as well as interaction of particles through forces and certain laws which all particles obey. I want to ask,Does a particle exert a force on itself? **EDIT** Thanks for the respectful answers and comments.I edited this question in order to make ...
2019/05/05
[ "https://physics.stackexchange.com/questions/478060", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/230533/" ]
This exact question is considered at the end of Jackson's (somewhat infamous) *Classical Electrodynamics*. I think it would be appropriate to simply quote the relevant passage: > > In the preceding chapters the problems of electrodynamics have been > divided into two classes: one in which the sources of charge and >...
> > The difficulties presented by this problem touch one of the most fundamental aspects of physics, the nature of the elementary particle. Although partial solutions, workable within limited areas, can be given, the basic problem remains unsolved. One might hope that the transition from classical to quantum-mechanica...
478,060
We all have elaborative discussion in physics about classical mechanics as well as interaction of particles through forces and certain laws which all particles obey. I want to ask,Does a particle exert a force on itself? **EDIT** Thanks for the respectful answers and comments.I edited this question in order to make ...
2019/05/05
[ "https://physics.stackexchange.com/questions/478060", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/230533/" ]
This is one of those terribly simple questions which is also astonishingly insightful and surprisingly a big deal in physics. I'd like to commend you for the question! The classical mechanics answer is "because we say it doesn't." One of the peculiarities about science is that it doesn't tell you the *true* answer, in...
Interesting question. The majority of the present answers seems to limit the possibility of self-interaction to the case of charges, referring in a direct or indirect way to the radiation reaction force. References to self-interaction in QFT, although interesting, seem to go beyond the limits of the original question, ...
478,060
We all have elaborative discussion in physics about classical mechanics as well as interaction of particles through forces and certain laws which all particles obey. I want to ask,Does a particle exert a force on itself? **EDIT** Thanks for the respectful answers and comments.I edited this question in order to make ...
2019/05/05
[ "https://physics.stackexchange.com/questions/478060", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/230533/" ]
This exact question is considered at the end of Jackson's (somewhat infamous) *Classical Electrodynamics*. I think it would be appropriate to simply quote the relevant passage: > > In the preceding chapters the problems of electrodynamics have been > divided into two classes: one in which the sources of charge and >...
This answer may a bit technical but the clearest argument that there is always self interaction, that is, a force of a particle on itself comes from lagrangian formalism. If we calculate the EM potential of a charge then the source of the potential, the charge, is given by $q=dL/dV$. This means that $L$ must contain a ...
478,060
We all have elaborative discussion in physics about classical mechanics as well as interaction of particles through forces and certain laws which all particles obey. I want to ask,Does a particle exert a force on itself? **EDIT** Thanks for the respectful answers and comments.I edited this question in order to make ...
2019/05/05
[ "https://physics.stackexchange.com/questions/478060", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/230533/" ]
This exact question is considered at the end of Jackson's (somewhat infamous) *Classical Electrodynamics*. I think it would be appropriate to simply quote the relevant passage: > > In the preceding chapters the problems of electrodynamics have been > divided into two classes: one in which the sources of charge and >...
Interesting question. The majority of the present answers seems to limit the possibility of self-interaction to the case of charges, referring in a direct or indirect way to the radiation reaction force. References to self-interaction in QFT, although interesting, seem to go beyond the limits of the original question, ...
478,060
We all have elaborative discussion in physics about classical mechanics as well as interaction of particles through forces and certain laws which all particles obey. I want to ask,Does a particle exert a force on itself? **EDIT** Thanks for the respectful answers and comments.I edited this question in order to make ...
2019/05/05
[ "https://physics.stackexchange.com/questions/478060", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/230533/" ]
Interesting question. The majority of the present answers seems to limit the possibility of self-interaction to the case of charges, referring in a direct or indirect way to the radiation reaction force. References to self-interaction in QFT, although interesting, seem to go beyond the limits of the original question, ...
> > The difficulties presented by this problem touch one of the most fundamental aspects of physics, the nature of the elementary particle. Although partial solutions, workable within limited areas, can be given, the basic problem remains unsolved. One might hope that the transition from classical to quantum-mechanica...
478,060
We all have elaborative discussion in physics about classical mechanics as well as interaction of particles through forces and certain laws which all particles obey. I want to ask,Does a particle exert a force on itself? **EDIT** Thanks for the respectful answers and comments.I edited this question in order to make ...
2019/05/05
[ "https://physics.stackexchange.com/questions/478060", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/230533/" ]
What even *is* a particle in classical mechanics? Particles do exist in the real world, but their discovery pretty much made the invention of quantum mechanics necessary. So to answer this question, you have to set up some straw man of a "classical mechanics particle" and then destroy that. For instance, we may pret...
This answer may a bit technical but the clearest argument that there is always self interaction, that is, a force of a particle on itself comes from lagrangian formalism. If we calculate the EM potential of a charge then the source of the potential, the charge, is given by $q=dL/dV$. This means that $L$ must contain a ...
478,060
We all have elaborative discussion in physics about classical mechanics as well as interaction of particles through forces and certain laws which all particles obey. I want to ask,Does a particle exert a force on itself? **EDIT** Thanks for the respectful answers and comments.I edited this question in order to make ...
2019/05/05
[ "https://physics.stackexchange.com/questions/478060", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/230533/" ]
Well a point particle is just an idealization that has spherical symmetry, and we can imagine that in reality we have some finite volume associated with the "point", in which the total charge is distributed. The argument, at least in electromagnetism, is that the spherical symmetry of the charge together with its own s...
This exact question is considered at the end of Jackson's (somewhat infamous) *Classical Electrodynamics*. I think it would be appropriate to simply quote the relevant passage: > > In the preceding chapters the problems of electrodynamics have been > divided into two classes: one in which the sources of charge and >...
478,060
We all have elaborative discussion in physics about classical mechanics as well as interaction of particles through forces and certain laws which all particles obey. I want to ask,Does a particle exert a force on itself? **EDIT** Thanks for the respectful answers and comments.I edited this question in order to make ...
2019/05/05
[ "https://physics.stackexchange.com/questions/478060", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/230533/" ]
This question is never addressed by teachers, altough students start asking it more and more every year (surprisingly). Here are two possible arguments. 1. A particle is meant to have 0 volume. Maybe you're used to exert a force on yourself, but you are an extended body. Particles are points in space. I find it quite ...
What even *is* a particle in classical mechanics? Particles do exist in the real world, but their discovery pretty much made the invention of quantum mechanics necessary. So to answer this question, you have to set up some straw man of a "classical mechanics particle" and then destroy that. For instance, we may pret...
478,060
We all have elaborative discussion in physics about classical mechanics as well as interaction of particles through forces and certain laws which all particles obey. I want to ask,Does a particle exert a force on itself? **EDIT** Thanks for the respectful answers and comments.I edited this question in order to make ...
2019/05/05
[ "https://physics.stackexchange.com/questions/478060", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/230533/" ]
This question is never addressed by teachers, altough students start asking it more and more every year (surprisingly). Here are two possible arguments. 1. A particle is meant to have 0 volume. Maybe you're used to exert a force on yourself, but you are an extended body. Particles are points in space. I find it quite ...
> > The difficulties presented by this problem touch one of the most fundamental aspects of physics, the nature of the elementary particle. Although partial solutions, workable within limited areas, can be given, the basic problem remains unsolved. One might hope that the transition from classical to quantum-mechanica...
53,003
My toddler dropped a toothbrush down a bathroom sink. Unfortunately, the stopper wasn't in the sink at the time. When looking down from above the sink, I believe the toothbrush is in the PVC section of the picture, and leaning against the side. The PVC is a larger diameter so even if I could reach the toothbrush from ...
2014/11/17
[ "https://diy.stackexchange.com/questions/53003", "https://diy.stackexchange.com", "https://diy.stackexchange.com/users/7648/" ]
In my part of the world, PVC P-traps for sinks and basins are universally designed so that you can easily remove the U-bend from below without tools. ![enter image description here](https://i.stack.imgur.com/MU8FV.jpg) I wouldn't hesitate very long before undoing all the obvious nuts visible in your picture† and atte...
Before you start taking things apart..... try this! Get a dowel and your glue gun. Dab hot glue onto tip of dowel, quickly put down drain onto toothbrush ( or whatever you've dropped down there) leave for a minute or 2 and pull dowel out!! Nothing to take apart! This probably would not work for a small item in the wa...
53,003
My toddler dropped a toothbrush down a bathroom sink. Unfortunately, the stopper wasn't in the sink at the time. When looking down from above the sink, I believe the toothbrush is in the PVC section of the picture, and leaning against the side. The PVC is a larger diameter so even if I could reach the toothbrush from ...
2014/11/17
[ "https://diy.stackexchange.com/questions/53003", "https://diy.stackexchange.com", "https://diy.stackexchange.com/users/7648/" ]
You could try using a pick-up or claw tool to reach down in the drain to grab it and pull it out. Something like this [one at Amazon.com](http://rads.stackoverflow.com/amzn/click/B002RHP7TS). ![enter image description here](https://i.stack.imgur.com/xUBtP.jpg)
Before you start taking things apart..... try this! Get a dowel and your glue gun. Dab hot glue onto tip of dowel, quickly put down drain onto toothbrush ( or whatever you've dropped down there) leave for a minute or 2 and pull dowel out!! Nothing to take apart! This probably would not work for a small item in the wa...
39,407,605
I am building a website and wish to serve a video if the user is on a desktop device, and if on a mobile I am going to serve a gif. Does anyone have any guidance for best practices on this? Is the below code enough? When I test this on chrome it doesn't show the mobile gif, but perhaps something is incorrect here. ...
2016/09/09
[ "https://Stackoverflow.com/questions/39407605", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Please do not test for a device, test for a screen size. ``` var windowWidth = $(window).width(); var maxDeviceWidth = 768; if (windowWidth > maxDeviceWidth) { //Server the desktop version //You can get the content with Ajax or load both and hide the other } else { //Load the mobile content - either with ...
Update: I've included dynamic insertion based on the `innerWidth` so this should be cool now, it includes a video on wide screens, and a gif on small ones. HTML: ``` <div class="wrapper"> <div id="video-container"> <video></video> </div> <div id="gif-container"> <img src="gif.gif"> </d...
68,490,691
I'm trying to "translate" some of my R scripts to Python, but I notice, that working with data frames in Python is tremendously slower than doing it in R, e.g. exctracting cells according to some conditions. I've done a little investigation, this is how much time it takes to look for a specific value in Python: ``` i...
2021/07/22
[ "https://Stackoverflow.com/questions/68490691", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15005884/" ]
Since you are looking to select a **single** value from a DataFrame there are a few things you can do to improve performance. 1. Use `.item()` instead of `[0]`, which has a small, but decent improvement especially for smaller DataFrames. 2. It's wasteful to mask the **entire DataFrame** just to then select a known Ser...
You can cut it in about half just by reusing the filter expression. ```py In [1]: import pandas as pd In [2]: code = 145896 ...: df = pd.DataFrame(data={ ...: 'code1': [145896, 800175, 633974, 774521, 416109], ...: 'code2': [100, 800, 600, 700, 400], ...: 'code3': [1, 8, 6, 7, 4] ...: }) I...
68,490,691
I'm trying to "translate" some of my R scripts to Python, but I notice, that working with data frames in Python is tremendously slower than doing it in R, e.g. exctracting cells according to some conditions. I've done a little investigation, this is how much time it takes to look for a specific value in Python: ``` i...
2021/07/22
[ "https://Stackoverflow.com/questions/68490691", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15005884/" ]
You can cut it in about half just by reusing the filter expression. ```py In [1]: import pandas as pd In [2]: code = 145896 ...: df = pd.DataFrame(data={ ...: 'code1': [145896, 800175, 633974, 774521, 416109], ...: 'code2': [100, 800, 600, 700, 400], ...: 'code3': [1, 8, 6, 7, 4] ...: }) I...
R-lang was probably designed around this kind of operations. Pandas is a third-party library in python, so it has additional limitations and overheads to work around. Namely, upon each intermediate step a new dataframe or series is generated. Almost each equals sign or a bracket is an intermediate step. If you really ...
68,490,691
I'm trying to "translate" some of my R scripts to Python, but I notice, that working with data frames in Python is tremendously slower than doing it in R, e.g. exctracting cells according to some conditions. I've done a little investigation, this is how much time it takes to look for a specific value in Python: ``` i...
2021/07/22
[ "https://Stackoverflow.com/questions/68490691", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15005884/" ]
You can cut it in about half just by reusing the filter expression. ```py In [1]: import pandas as pd In [2]: code = 145896 ...: df = pd.DataFrame(data={ ...: 'code1': [145896, 800175, 633974, 774521, 416109], ...: 'code2': [100, 800, 600, 700, 400], ...: 'code3': [1, 8, 6, 7, 4] ...: }) I...
One way to do it is to fall back on numpy by first getting the underlying arrays and then looping: ``` import pandas as pd from timeit import default_timer as timer code = 145896 # real df is way bigger df = pd.DataFrame(data={ 'code1': [145896, 800175, 633974, 774521, 416109], 'code2': [100, 800, 600, 700, ...
68,490,691
I'm trying to "translate" some of my R scripts to Python, but I notice, that working with data frames in Python is tremendously slower than doing it in R, e.g. exctracting cells according to some conditions. I've done a little investigation, this is how much time it takes to look for a specific value in Python: ``` i...
2021/07/22
[ "https://Stackoverflow.com/questions/68490691", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15005884/" ]
Since you are looking to select a **single** value from a DataFrame there are a few things you can do to improve performance. 1. Use `.item()` instead of `[0]`, which has a small, but decent improvement especially for smaller DataFrames. 2. It's wasteful to mask the **entire DataFrame** just to then select a known Ser...
R-lang was probably designed around this kind of operations. Pandas is a third-party library in python, so it has additional limitations and overheads to work around. Namely, upon each intermediate step a new dataframe or series is generated. Almost each equals sign or a bracket is an intermediate step. If you really ...
68,490,691
I'm trying to "translate" some of my R scripts to Python, but I notice, that working with data frames in Python is tremendously slower than doing it in R, e.g. exctracting cells according to some conditions. I've done a little investigation, this is how much time it takes to look for a specific value in Python: ``` i...
2021/07/22
[ "https://Stackoverflow.com/questions/68490691", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15005884/" ]
Since you are looking to select a **single** value from a DataFrame there are a few things you can do to improve performance. 1. Use `.item()` instead of `[0]`, which has a small, but decent improvement especially for smaller DataFrames. 2. It's wasteful to mask the **entire DataFrame** just to then select a known Ser...
One way to do it is to fall back on numpy by first getting the underlying arrays and then looping: ``` import pandas as pd from timeit import default_timer as timer code = 145896 # real df is way bigger df = pd.DataFrame(data={ 'code1': [145896, 800175, 633974, 774521, 416109], 'code2': [100, 800, 600, 700, ...
68,490,691
I'm trying to "translate" some of my R scripts to Python, but I notice, that working with data frames in Python is tremendously slower than doing it in R, e.g. exctracting cells according to some conditions. I've done a little investigation, this is how much time it takes to look for a specific value in Python: ``` i...
2021/07/22
[ "https://Stackoverflow.com/questions/68490691", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15005884/" ]
One way to do it is to fall back on numpy by first getting the underlying arrays and then looping: ``` import pandas as pd from timeit import default_timer as timer code = 145896 # real df is way bigger df = pd.DataFrame(data={ 'code1': [145896, 800175, 633974, 774521, 416109], 'code2': [100, 800, 600, 700, ...
R-lang was probably designed around this kind of operations. Pandas is a third-party library in python, so it has additional limitations and overheads to work around. Namely, upon each intermediate step a new dataframe or series is generated. Almost each equals sign or a bracket is an intermediate step. If you really ...
19,227,124
I have upgraded my project to rails 4 but now I am getting some deprecation warnings and one of them is **DEPRECATION: any\_number\_of\_times is deprecated.**. Code for which I am gettings this warning is ``` sponsorship = RSpec::Mocks::Mock.new(:sponsorship) SPONSORSHIP.should_receive(:[]).with('sponsorship').any_nu...
2013/10/07
[ "https://Stackoverflow.com/questions/19227124", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2086124/" ]
The method `any_number_of_times` is deprecated (and is going away in RSpec 3) because it's not really testing anything. It will never fail, since it can be called 0 times as well. See extended argument in <https://trello.com/c/p2OsobvA/78-update-website-menu-architecture-to-accommodate-pledging-as-well-as-weddings-memo...
Since **`any_number_of_times`** is not of any help other alternative methods like **`at_least(n)`** and **`at_most(n)`** helped removing those deprecation warnings.
58,965,861
I am scratching my head trying to understand the point of the following code ``` Map<String Set<MyOtherObj>> myMap = myapi.getMyMap(); final MyObj[] myObjList; { final List<MyObj> list = new ArrayList<>(myMap.size()); for (Entry<String, Set<MyOtherObj>> entry : myMap.entrySet()) { ...
2019/11/21
[ "https://Stackoverflow.com/questions/58965861", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10714010/" ]
As stated in [this answer](https://stackoverflow.com/a/24380219/2711488): > > *Scope* is a language concept that determines the validity of names. Whether an object can be garbage collected (and therefore finalized) depends on whether it is *reachable*. > > > So, no, the scope is not relevant to garbage collectio...
No, it is done for the same reason as empty lines are added to the code. The variables in the block are scoped to that block, and can no longer be used after the block. So one does not need to pay attention to those block variables. So this is more readable: ``` A a; { B b; C c; ... } ... ``` Than: ``` A a; B b; ...
21,371,732
I have a `Workshop` Django app. Each `Workshop` can have multiple attendees via a related `WorkshopAttendee` model (simplified below). I am using Django's `ModelForm` in a Class Based View, and in `forms.py` I am using [crispy-forms](http://django-crispy-forms.readthedocs.org): **models.py (relevant parts)** ```pytho...
2014/01/27
[ "https://Stackoverflow.com/questions/21371732", "https://Stackoverflow.com", "https://Stackoverflow.com/users/109554/" ]
You don't need to pass the PK - you got it already in your URL as the slug. So let's say this is your URL: <http://example.com/workshops/awesome-workshop-slug/sign_in/> Your `urls.py` should look like this: ``` url(r'^workshop/(?P<workshop_slug>\w+)/sign_in/$', # ../workshops/awesome-workshop-slug/sign_in/ ...
Turns out I was overly complicating this. All I needed to do was modify the `form_valid` method for Django's GCBV `FormView` to this: **workshop/views.py** ```python from django.views.generic.edit import FormView from workshop.models import Workshop, WorkshopAttendee from workshop.forms import WorkshopAttendeeForm f...
130,027
I'm trying to import this SVG; which I imported before earlier but now it seems to don't work that well anymore? The original SVG file has not been modified, so I don't know where the issue could be, closing Photoshop didn't help. Illustrator doesn't have this issue. [![enter image description here](https://i.stack.im...
2019/10/03
[ "https://graphicdesign.stackexchange.com/questions/130027", "https://graphicdesign.stackexchange.com", "https://graphicdesign.stackexchange.com/users/123192/" ]
I believe it is a mix of two fonts: * Akrobat Black: <https://www.fontfabric.com/fonts/akrobat/> * Gear Proportion Regular1: <https://www.dafont.com/gear.font> In the below image you can see the different fonts. The top row is your original image. Second row is Akrobat Black. Third row is Gear Proportion. Final row a...
If your goal is to reproduce the logo here, I would suggest you find a typeface close to the logo and then convert it to vector shapes to customize some parts of the word. I think 'Decima+ Bold' is very close to the original. You just need to work on the 'R' and squish the 'O's Hope this helps.
130,027
I'm trying to import this SVG; which I imported before earlier but now it seems to don't work that well anymore? The original SVG file has not been modified, so I don't know where the issue could be, closing Photoshop didn't help. Illustrator doesn't have this issue. [![enter image description here](https://i.stack.im...
2019/10/03
[ "https://graphicdesign.stackexchange.com/questions/130027", "https://graphicdesign.stackexchange.com", "https://graphicdesign.stackexchange.com/users/123192/" ]
If your goal is to reproduce the logo here, I would suggest you find a typeface close to the logo and then convert it to vector shapes to customize some parts of the word. I think 'Decima+ Bold' is very close to the original. You just need to work on the 'R' and squish the 'O's Hope this helps.
I can't find an exact match, which suggests it might be a custom design, or perhaps an existing font (or a mix of 2) which has been modified. For a quick and dirty solution you could auto trace it using vector editing software, such as Adobe Illustrator or free software such as Inkscape. Or, depending on how good you...
130,027
I'm trying to import this SVG; which I imported before earlier but now it seems to don't work that well anymore? The original SVG file has not been modified, so I don't know where the issue could be, closing Photoshop didn't help. Illustrator doesn't have this issue. [![enter image description here](https://i.stack.im...
2019/10/03
[ "https://graphicdesign.stackexchange.com/questions/130027", "https://graphicdesign.stackexchange.com", "https://graphicdesign.stackexchange.com/users/123192/" ]
I believe it is a mix of two fonts: * Akrobat Black: <https://www.fontfabric.com/fonts/akrobat/> * Gear Proportion Regular1: <https://www.dafont.com/gear.font> In the below image you can see the different fonts. The top row is your original image. Second row is Akrobat Black. Third row is Gear Proportion. Final row a...
I can't find an exact match, which suggests it might be a custom design, or perhaps an existing font (or a mix of 2) which has been modified. For a quick and dirty solution you could auto trace it using vector editing software, such as Adobe Illustrator or free software such as Inkscape. Or, depending on how good you...
47,176,823
I've been trying to sort this out for weeks, but can't get anywhere. My issue is that I have an array in javascript but the individual phrases in the array also have commas in them. I am passing the array as a variable to php using POST and php is exploding the array into variables, but is also separating parts of th...
2017/11/08
[ "https://Stackoverflow.com/questions/47176823", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8905789/" ]
The most obvious issue is that your filters are never applied, because $gendre, $country and $year are never passed to the function. Assuming that you read those values correctly from the request object, look at the tags in the HTML, you never set name attribute for either of them, so I think they are never passed to ...
Tadasbub's answer should be sufficient. I just write out the changes based on his suggestions. ``` <?php $query = "SELECT * FROM movies WHERE movie_status = '1'"; //filter query start if(!empty($genre)){ $genredata =implode("','",$genr...
43,690,169
I'm reposting my question because someone closed my question when it wasn't answered correctly and I can't reopen it myself. I'm trying to convert a list of words to a 2D array without using any of the numpy and any of the extension methods. I want to figure it out without the extra methods, but I'm very stuck. ``` ...
2017/04/28
[ "https://Stackoverflow.com/questions/43690169", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7937034/" ]
well, I'd say your issue is that it looks like you've learned how to make classes, and before thinking about the problem you're trying to solve, you're writing a class. But what you want can simply be done with a loop in a function, without any magic or external thing: ``` def to_matrix(array, nb_rows, nb_cols): ...
A quick version using generators: ``` def gen_array(data, count): for i, v in enumerate(data): if i == count: # Shorten too long arrays break yield v for c in range(count - len(data)): # Extend if needed yield None def matrix(array, row, col): l = list(gen_array(array...
5,472,526
I have switched over to Netbeans and am finding accessing files in packages quite perplexing. Usually I would just have everything in the one folder. I have created packages in my project which is structured like so: ``` project_name ......Source Packages ............Game ............Players ............Resou...
2011/03/29
[ "https://Stackoverflow.com/questions/5472526", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
``` MyClass.class.getResources("/Resources/Image/myImage.jpg"); ```
This has nothing to do with NetBeans, but everything to do with Java. To access a resource in the classpath, you should use [`Class.getResourceAsStream()`](http://download.oracle.com/javase/6/docs/api/java/lang/Class.html#getResourceAsStream%28java.lang.String%29) method. Read its documentatino carefully. In your case,...
47,207,671
i'm trying to segue from objective-c to swift. However when I try this using the object below I receive the following error [![enter image description here](https://i.stack.imgur.com/sF7Fu.png)](https://i.stack.imgur.com/sF7Fu.png) I don't know what i'm doing wrong, i've setup the segue on the storyboard and assigne...
2017/11/09
[ "https://Stackoverflow.com/questions/47207671", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5034263/" ]
After discussion in Chat and fixing various issues, I'll take them one by one: ``` > *** Assertion failure in -[UIApplication _cachedSystemAnimationFenceCreatingIfNecessary:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit/UIKit-3698.21.8/UIApplication.m:1707 > *** Terminating app due to uncaught exception 'NSI...
I guess the more safe way is to use navigationController?.pushViewController(\_:animated:), instead of using segues.
166,338
My hubby and I purchased the home in 2015. We are currently noticing cracks both inside and outside of the home. Moreover, we noticed the area had been fixed and covered up before. As I'm not a professional, I am pretty concerned about it. Please help and diagnose if I should be concerned. Thank you ahead of time! It ...
2019/05/31
[ "https://diy.stackexchange.com/questions/166338", "https://diy.stackexchange.com", "https://diy.stackexchange.com/users/102237/" ]
The short answer to the question in your Heading is: Yes, the culprit for the stucco crack is probably footing/foundation settling. But it doesn't look serious. Most building move, some more than others. Traditional stucco shows it; concrete foundations/basements show it; and even drywall shows cracks in buildings tha...
When stucco is mixed without enough sand in it the first place it's going to crack is at the corners of your windows. This does not indicated structural problem. More often than not it's a problem caused by subcontractors working for builders who build houses on spec and cut corners don't use enough material or don't p...
84,125
I am the proud recipient of a brand new, EMV-equipped Visa Debit card through my financial institution -- this card is capable of being used for PIN debit/EFTPOS, signature debit, and ATM transactions, at least in the North American senses of the terms. However, can such a card support EMV chip-and-PIN debit transactio...
2016/12/11
[ "https://travel.stackexchange.com/questions/84125", "https://travel.stackexchange.com", "https://travel.stackexchange.com/users/22968/" ]
Because they think more people will pay more to fly to Flagstaff than Cancún. It's as simple as that: airlines set prices to maximize their profit. In this case, Cancun is normally thought of as a budget leisure destination. The airline knows from long experience that many vacationers headed to Cancun will simply fin...
It is called supply and demand. There is more competition going to Cancun hence lower more competitve airfares. Less competition gping to Flagstaff.
84,125
I am the proud recipient of a brand new, EMV-equipped Visa Debit card through my financial institution -- this card is capable of being used for PIN debit/EFTPOS, signature debit, and ATM transactions, at least in the North American senses of the terms. However, can such a card support EMV chip-and-PIN debit transactio...
2016/12/11
[ "https://travel.stackexchange.com/questions/84125", "https://travel.stackexchange.com", "https://travel.stackexchange.com/users/22968/" ]
It is called supply and demand. There is more competition going to Cancun hence lower more competitve airfares. Less competition gping to Flagstaff.
It's basically "whatever the market will bear" with some important exceptions. Fare history for the city pair plays a role and helps predict the future. A carrier new to the route may lower the fare to attract business. Flagstaff has relatively few people, and by laws of chance, there will be far fewer people going PIT...
84,125
I am the proud recipient of a brand new, EMV-equipped Visa Debit card through my financial institution -- this card is capable of being used for PIN debit/EFTPOS, signature debit, and ATM transactions, at least in the North American senses of the terms. However, can such a card support EMV chip-and-PIN debit transactio...
2016/12/11
[ "https://travel.stackexchange.com/questions/84125", "https://travel.stackexchange.com", "https://travel.stackexchange.com/users/22968/" ]
Because they think more people will pay more to fly to Flagstaff than Cancún. It's as simple as that: airlines set prices to maximize their profit. In this case, Cancun is normally thought of as a budget leisure destination. The airline knows from long experience that many vacationers headed to Cancun will simply fin...
It's basically "whatever the market will bear" with some important exceptions. Fare history for the city pair plays a role and helps predict the future. A carrier new to the route may lower the fare to attract business. Flagstaff has relatively few people, and by laws of chance, there will be far fewer people going PIT...
16
When I am downloading large files I need to stop my phone from sleeping , how do I keep my wi-fi on when the phone is in sleep mode.
2010/09/13
[ "https://android.stackexchange.com/questions/16", "https://android.stackexchange.com", "https://android.stackexchange.com/users/17/" ]
Go to: Settings > Wireless & networks > Wi-Fi settings. Hit your Menu button and select Advanced. You should now see an option for changing the Wi-Fi sleep policy.
For Android 4.0 (Ice Cream Sandwich) and later upto Android 5.x (Lollipop) Goto: > > Settings > Wifi > Advanced (from options menu) > Keep Wi-Fi on during sleep > Always > > > For previous versions of Android(i.e. 2.x) please consider Rohan Singh's answer.
5,131,887
The site is appearing fine in Mozilla, Chrome, and IE6. But IE7 onwards, the menu background image was not appearing at all. In the file moo.menu.css, I made the following changes in li: ``` .ry-cssmnu ul li { margin: 0; /* all list items */ padding: 0; float: left; display: block; background: url(../images/mainnav-bg...
2011/02/27
[ "https://Stackoverflow.com/questions/5131887", "https://Stackoverflow.com", "https://Stackoverflow.com/users/636231/" ]
You have to declare a height to that container. Your floating list items are not giving their parent container height because `float` removes them from the document flow. Your `<ul>` has a current height of nothing, and the background image won't remedy that. ``` #mainnav { height:44px; ... } ```
First of all, I would change the CSS **background** property according to the CSS syntax: ``` background: blue url(../images/mainnav-bg.gif) repeat-x center top; ```
5,131,887
The site is appearing fine in Mozilla, Chrome, and IE6. But IE7 onwards, the menu background image was not appearing at all. In the file moo.menu.css, I made the following changes in li: ``` .ry-cssmnu ul li { margin: 0; /* all list items */ padding: 0; float: left; display: block; background: url(../images/mainnav-bg...
2011/02/27
[ "https://Stackoverflow.com/questions/5131887", "https://Stackoverflow.com", "https://Stackoverflow.com/users/636231/" ]
You have to declare a height to that container. Your floating list items are not giving their parent container height because `float` removes them from the document flow. Your `<ul>` has a current height of nothing, and the background image won't remedy that. ``` #mainnav { height:44px; ... } ```
Looks like the problem is with your ``` <div class="clearfix" id="mainnav"> ``` tag. Have you tried adding a pink border or something (to debug it) to the mainnav element and then setting a fixed width on it to make sure it goes the full width?
19,483,230
I need some help with creating my pattern. I've got the basic parts done, but one issue remains. Let's say I have a string as follows: ``` John: I can type in :red:colour! :white:Not in the same :red:wo:green:rd :white:though :( ``` I have this code setup to separate the colors from the actual value: ``` line = "J...
2013/10/20
[ "https://Stackoverflow.com/questions/19483230", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1773027/" ]
The following code will give your [desired output](https://eval.in/56063): ``` for token in line:gmatch( "(%S+)" ) do if not token:match( "(:%w-:)([^:]+)" ) then print(token) else for col, w in token:gmatch( "(:%w-:)([^:]+)" ) do print( col ) print( w ) end end end ``` Though, it will f...
A more generic solution works: `line = "John: I can type in :red:colour! :white:Not in the same :red:wo:green:rd :white:though :("` ``` for i in string.gmatch(line ,"%S+") do if (i:match(":%w+")) then for k,r in string.gmatch(i,"(:%w+:)(%w+[^:]*)") do print(k) print(r) end ...
58,091,429
I have a log file I am attempting to extract particular lines from. When I crop the file to a few lines above and below I am able to get it. However, there is multiple instances of what I am trying to find preventing using the FULL file. Following is some code I have tried... ``` for /f "tokens=1* delims=[]" %%a in ...
2019/09/25
[ "https://Stackoverflow.com/questions/58091429", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3380038/" ]
Windows command processor designed for executing commands and executables and not for text file processing is definitely the worst choice to filter `TEST.LOG`. For the reasons read completely my answer on [How to read and print contents of text file line by line?](https://stackoverflow.com/a/51579256/3074564) The batch...
You can give a try with this code : ``` @echo off Title Extract Data between two tags Set "InputFile=InputFile.txt" Set From_Start="<Line" Set To_End="</Report>" Set "OutputFile=OutputFile.txt" Call :ExtractData %InputFile% %From_Start% %To_End% Call :ExtractData %InputFile% %From_Start% %To_End%>%OutputFile% If Exist...
58,091,429
I have a log file I am attempting to extract particular lines from. When I crop the file to a few lines above and below I am able to get it. However, there is multiple instances of what I am trying to find preventing using the FULL file. Following is some code I have tried... ``` for /f "tokens=1* delims=[]" %%a in ...
2019/09/25
[ "https://Stackoverflow.com/questions/58091429", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3380038/" ]
Updated: -------- > > > > > > You want to find `<Line Text="***********TEST1 TEST TEST************" />` then print it and any line until the First `</Report>` is encountered, then look for the next `<Line Text="***********TEST1 TEST TEST************" />` and print it and every following line until the next `</Repor...
Windows command processor designed for executing commands and executables and not for text file processing is definitely the worst choice to filter `TEST.LOG`. For the reasons read completely my answer on [How to read and print contents of text file line by line?](https://stackoverflow.com/a/51579256/3074564) The batch...
58,091,429
I have a log file I am attempting to extract particular lines from. When I crop the file to a few lines above and below I am able to get it. However, there is multiple instances of what I am trying to find preventing using the FULL file. Following is some code I have tried... ``` for /f "tokens=1* delims=[]" %%a in ...
2019/09/25
[ "https://Stackoverflow.com/questions/58091429", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3380038/" ]
Updated: -------- > > > > > > You want to find `<Line Text="***********TEST1 TEST TEST************" />` then print it and any line until the First `</Report>` is encountered, then look for the next `<Line Text="***********TEST1 TEST TEST************" />` and print it and every following line until the next `</Repor...
You can give a try with this code : ``` @echo off Title Extract Data between two tags Set "InputFile=InputFile.txt" Set From_Start="<Line" Set To_End="</Report>" Set "OutputFile=OutputFile.txt" Call :ExtractData %InputFile% %From_Start% %To_End% Call :ExtractData %InputFile% %From_Start% %To_End%>%OutputFile% If Exist...
179,571
For example, if a client submits a file to a server, and the server opens the file in read-mode with Python: ``` with open(uploaded_file, "r") as f: # Do something ``` Could the act of opening a file be abused with a cleverly-crafted file from the client? Does it depend on the language used by the server?
2018/02/11
[ "https://security.stackexchange.com/questions/179571", "https://security.stackexchange.com", "https://security.stackexchange.com/users/170466/" ]
No. If the filename is controlled by the user, then you might open yourself up to vulnerabilities (e.g. an attacker might try to read config files with the database password). But just opening a file handle for an uploaded file can't do much. Perhaps if the underlying mechanism would try to read the whole file for bu...
Operating systems generally have a limited number of files they can open at once (specifically, a limited number of file descriptors or `fd`s in Unix-like systems, or `HANDLE`s in Windows). If you allow people to open an arbitrary number of those without closing them, then it might be possible to deplete that limit, wh...
179,571
For example, if a client submits a file to a server, and the server opens the file in read-mode with Python: ``` with open(uploaded_file, "r") as f: # Do something ``` Could the act of opening a file be abused with a cleverly-crafted file from the client? Does it depend on the language used by the server?
2018/02/11
[ "https://security.stackexchange.com/questions/179571", "https://security.stackexchange.com", "https://security.stackexchange.com/users/170466/" ]
No. If the filename is controlled by the user, then you might open yourself up to vulnerabilities (e.g. an attacker might try to read config files with the database password). But just opening a file handle for an uploaded file can't do much. Perhaps if the underlying mechanism would try to read the whole file for bu...
**Not the act of opening, but the act of reading (in text mode).** The `open()` function falls back on several defaults when you don't specify the parameters. This is what the code snippet you provided does: * Opens the file in text mode (no "b" in mode flags). * Calls `locale.getpreferredencoding(False)` to determin...
19,570,774
This is a program that stores 10 unique strings. If the user enters a string that already exists in the array, the user will get an error. My code is working perfectly for the first string that I enter, but throws an exception after that and I don't know why. How do I fix this and make it work? P.S. I don't want to us...
2013/10/24
[ "https://Stackoverflow.com/questions/19570774", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2915567/" ]
you problem is this `if (stringArray[j].equalsIgnoreCase(input)) {`, you refern to null element as you array do not contain nothing. You can solve this `if (input.equalsIgnoreCase(stringArray[j])) {` Now you compare the value agains the array items that may be null. Check the example code ``` private final ...
You're getting the NullPointerException because you're accessing an empty array. In the second loop you're looping over the entire stringArray array but you've inserted the first i elements. Change this: ``` for (int j = 0; j < stringArray.length; j++) { ``` with this: ``` for (int j = 0; j < i; j++) { ``` P.s. ...
19,570,774
This is a program that stores 10 unique strings. If the user enters a string that already exists in the array, the user will get an error. My code is working perfectly for the first string that I enter, but throws an exception after that and I don't know why. How do I fix this and make it work? P.S. I don't want to us...
2013/10/24
[ "https://Stackoverflow.com/questions/19570774", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2915567/" ]
you problem is this `if (stringArray[j].equalsIgnoreCase(input)) {`, you refern to null element as you array do not contain nothing. You can solve this `if (input.equalsIgnoreCase(stringArray[j])) {` Now you compare the value agains the array items that may be null. Check the example code ``` private final ...
The problem is this inner loop: ``` for (int j = 0; j < stringArray.length; j++) { if (stringArray[j].equalsIgnoreCase(input)) { itemExists = true; out.println("Item \"" + input + "\" already exists."); break; } else...
1,004,699
I have a requirement to document the assembly dependencies in a vb6/dotnet application. What techniques / tools are good for performing this sort of document. I was planning on using Visio for drawing.
2009/06/17
[ "https://Stackoverflow.com/questions/1004699", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4490/" ]
As a start, try [Dependency Visualizer](http://www.codeplex.com/dependencyvisualizer). I've also used [GraphViz's Dot](http://www.graphviz.org) and some custom code for simple dependency generation. The custom code invoked SysInternal's depends.exe recursively and parsed the output. [.NET Reflector](http://www.red-gate...
Well for .NET you could also try VS2010 Beta 1 and the Architecture Explorer [(Arch Explorer screen shots)](http://ajdotnet.wordpress.com/2009/03/29/visual-studio-2010-architecture-edition/). As for VB6, I'd like to have a tool for that also. This tool from Microsoft [Visual Basic 6.0 to Visual Basic .NET Upgrade Asse...
1,004,699
I have a requirement to document the assembly dependencies in a vb6/dotnet application. What techniques / tools are good for performing this sort of document. I was planning on using Visio for drawing.
2009/06/17
[ "https://Stackoverflow.com/questions/1004699", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4490/" ]
Have you had a look at [NDepend](http://www.ndepend.com/)?
You can create dependency graphs of .NET assemblies and application projects in VS 2010 Ultimate. You can generate assembly dependency graphs as one of the standard graphs, or you can use Architecture Explorer to browse your solution, select projects and the relationships that you want to visualize, and then create a d...
1,004,699
I have a requirement to document the assembly dependencies in a vb6/dotnet application. What techniques / tools are good for performing this sort of document. I was planning on using Visio for drawing.
2009/06/17
[ "https://Stackoverflow.com/questions/1004699", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4490/" ]
You can create dependency graphs of .NET assemblies and application projects in VS 2010 Ultimate. You can generate assembly dependency graphs as one of the standard graphs, or you can use Architecture Explorer to browse your solution, select projects and the relationships that you want to visualize, and then create a d...
Dependency visualizer is good for small projects. For projects or solutions with many inter dependencies it becomes too clumsy to even trace the dependency graph.
1,004,699
I have a requirement to document the assembly dependencies in a vb6/dotnet application. What techniques / tools are good for performing this sort of document. I was planning on using Visio for drawing.
2009/06/17
[ "https://Stackoverflow.com/questions/1004699", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4490/" ]
As a start, try [Dependency Visualizer](http://www.codeplex.com/dependencyvisualizer). I've also used [GraphViz's Dot](http://www.graphviz.org) and some custom code for simple dependency generation. The custom code invoked SysInternal's depends.exe recursively and parsed the output. [.NET Reflector](http://www.red-gate...
You can create dependency graphs of .NET assemblies and application projects in VS 2010 Ultimate. You can generate assembly dependency graphs as one of the standard graphs, or you can use Architecture Explorer to browse your solution, select projects and the relationships that you want to visualize, and then create a d...
1,004,699
I have a requirement to document the assembly dependencies in a vb6/dotnet application. What techniques / tools are good for performing this sort of document. I was planning on using Visio for drawing.
2009/06/17
[ "https://Stackoverflow.com/questions/1004699", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4490/" ]
Have you had a look at [NDepend](http://www.ndepend.com/)?
Dependency visualizer is good for small projects. For projects or solutions with many inter dependencies it becomes too clumsy to even trace the dependency graph.
1,004,699
I have a requirement to document the assembly dependencies in a vb6/dotnet application. What techniques / tools are good for performing this sort of document. I was planning on using Visio for drawing.
2009/06/17
[ "https://Stackoverflow.com/questions/1004699", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4490/" ]
As a start, try [Dependency Visualizer](http://www.codeplex.com/dependencyvisualizer). I've also used [GraphViz's Dot](http://www.graphviz.org) and some custom code for simple dependency generation. The custom code invoked SysInternal's depends.exe recursively and parsed the output. [.NET Reflector](http://www.red-gate...
Dependency visualizer is good for small projects. For projects or solutions with many inter dependencies it becomes too clumsy to even trace the dependency graph.
1,004,699
I have a requirement to document the assembly dependencies in a vb6/dotnet application. What techniques / tools are good for performing this sort of document. I was planning on using Visio for drawing.
2009/06/17
[ "https://Stackoverflow.com/questions/1004699", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4490/" ]
Have you had a look at [NDepend](http://www.ndepend.com/)?
To complete the Eric answer, NDepend comes indeed with a [dependency graph](http://www.ndepend.com/Doc_VS_Arch.aspx) coupled with a [dependency matrix](http://www.ndepend.com/Doc_Matrix.aspx). ![NDepend Dependency Graph](https://i.stack.imgur.com/ETJHB.png) ![NDepend Dependency Matrix](https://i.stack.imgur.com/Fpr6...
1,004,699
I have a requirement to document the assembly dependencies in a vb6/dotnet application. What techniques / tools are good for performing this sort of document. I was planning on using Visio for drawing.
2009/06/17
[ "https://Stackoverflow.com/questions/1004699", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4490/" ]
To complete the Eric answer, NDepend comes indeed with a [dependency graph](http://www.ndepend.com/Doc_VS_Arch.aspx) coupled with a [dependency matrix](http://www.ndepend.com/Doc_Matrix.aspx). ![NDepend Dependency Graph](https://i.stack.imgur.com/ETJHB.png) ![NDepend Dependency Matrix](https://i.stack.imgur.com/Fpr6...
Dependency visualizer is good for small projects. For projects or solutions with many inter dependencies it becomes too clumsy to even trace the dependency graph.
1,004,699
I have a requirement to document the assembly dependencies in a vb6/dotnet application. What techniques / tools are good for performing this sort of document. I was planning on using Visio for drawing.
2009/06/17
[ "https://Stackoverflow.com/questions/1004699", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4490/" ]
Well for .NET you could also try VS2010 Beta 1 and the Architecture Explorer [(Arch Explorer screen shots)](http://ajdotnet.wordpress.com/2009/03/29/visual-studio-2010-architecture-edition/). As for VB6, I'd like to have a tool for that also. This tool from Microsoft [Visual Basic 6.0 to Visual Basic .NET Upgrade Asse...
You can create dependency graphs of .NET assemblies and application projects in VS 2010 Ultimate. You can generate assembly dependency graphs as one of the standard graphs, or you can use Architecture Explorer to browse your solution, select projects and the relationships that you want to visualize, and then create a d...
1,004,699
I have a requirement to document the assembly dependencies in a vb6/dotnet application. What techniques / tools are good for performing this sort of document. I was planning on using Visio for drawing.
2009/06/17
[ "https://Stackoverflow.com/questions/1004699", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4490/" ]
As a start, try [Dependency Visualizer](http://www.codeplex.com/dependencyvisualizer). I've also used [GraphViz's Dot](http://www.graphviz.org) and some custom code for simple dependency generation. The custom code invoked SysInternal's depends.exe recursively and parsed the output. [.NET Reflector](http://www.red-gate...
Have you had a look at [NDepend](http://www.ndepend.com/)?
1,696,791
Assume $|f(z)|\leq 1/|y|$ for all $z\in\mathbb{C}$. Here $f$ is entire and we express $z=x+iy$. Then is $f$ constant ?
2016/03/14
[ "https://math.stackexchange.com/questions/1696791", "https://math.stackexchange.com", "https://math.stackexchange.com/users/74489/" ]
Let $w\in\mathbb R$ and $r > 0$ be arbitrary. Let $C$ be the circle about $w$ with radius $r$. We have $$ \frac 1 {2\pi i}\int\_C\frac{f(z)}{z-w}\,dz = f(w)\quad\text{and}\quad\frac 1 {2\pi i}\int\_C(z-w)f(z)\,dz = 0. $$ Hence, $$ -f(w) = \frac 1 {2\pi i}\int\_C\frac{r^{-2}(z-w)^2 - 1}{z-w}f(z)\,dz = \frac 1 {r^2}\cdot...
A function like this must be zero. Indeed, let $g(z) := f(1/z)$, $z\neq 0$. Then $|g(z)|\le\frac{|z|^2}{|y|}$, i.e., $|g(z)|\le\frac 1 {|\operatorname{Im} z|}$ for $z\in\mathbb D\setminus\{0\}$. From this, it follows that $z=0$ is (at most) a pole of $g$. From here, it should be easy for you to deduce that $f = 0$.
25,055,712
`Dataframe.resample()` works only with timeseries data. I cannot find a way of getting every nth row from non-timeseries data. What is the best method?
2014/07/31
[ "https://Stackoverflow.com/questions/25055712", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1014352/" ]
There is an even simpler solution to the accepted answer that involves directly invoking `df.__getitem__`. ``` df = pd.DataFrame('x', index=range(5), columns=list('abc')) df a b c 0 x x x 1 x x x 2 x x x 3 x x x 4 x x x ``` For example, to get every 2 rows, you can do ``` df[::2] a b c 0 ...
I had a similar requirement, but I wanted the n'th item in a particular group. This is how I solved it. ``` groups = data.groupby(['group_key']) selection = groups['index_col'].apply(lambda x: x % 3 == 0) subset = data[selection] ```
25,055,712
`Dataframe.resample()` works only with timeseries data. I cannot find a way of getting every nth row from non-timeseries data. What is the best method?
2014/07/31
[ "https://Stackoverflow.com/questions/25055712", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1014352/" ]
I had a similar requirement, but I wanted the n'th item in a particular group. This is how I solved it. ``` groups = data.groupby(['group_key']) selection = groups['index_col'].apply(lambda x: x % 3 == 0) subset = data[selection] ```
``` df.drop(labels=df[df.index % 3 != 0].index, axis=0) # every 3rd row (mod 3) ```
25,055,712
`Dataframe.resample()` works only with timeseries data. I cannot find a way of getting every nth row from non-timeseries data. What is the best method?
2014/07/31
[ "https://Stackoverflow.com/questions/25055712", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1014352/" ]
Though @chrisb's accepted answer does answer the question, I would like to add to it the following. A simple method I use to get the `nth` data or drop the `nth` row is the following: ``` df1 = df[df.index % 3 != 0] # Excludes every 3rd row starting from 0 df2 = df[df.index % 3 == 0] # Selects every 3rd raw startin...
Adding `reset_index()` to [metastableB's answer](https://stackoverflow.com/a/46141173/11816073) allows you to only need to assume that the rows are *ordered and consecutive*. ``` df1 = df[df.reset_index().index % 3 != 0] # Excludes every 3rd row starting from 0 df2 = df[df.reset_index().index % 3 == 0] # Selects eve...
25,055,712
`Dataframe.resample()` works only with timeseries data. I cannot find a way of getting every nth row from non-timeseries data. What is the best method?
2014/07/31
[ "https://Stackoverflow.com/questions/25055712", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1014352/" ]
Though @chrisb's accepted answer does answer the question, I would like to add to it the following. A simple method I use to get the `nth` data or drop the `nth` row is the following: ``` df1 = df[df.index % 3 != 0] # Excludes every 3rd row starting from 0 df2 = df[df.index % 3 == 0] # Selects every 3rd raw startin...
There is an even simpler solution to the accepted answer that involves directly invoking `df.__getitem__`. ``` df = pd.DataFrame('x', index=range(5), columns=list('abc')) df a b c 0 x x x 1 x x x 2 x x x 3 x x x 4 x x x ``` For example, to get every 2 rows, you can do ``` df[::2] a b c 0 ...
25,055,712
`Dataframe.resample()` works only with timeseries data. I cannot find a way of getting every nth row from non-timeseries data. What is the best method?
2014/07/31
[ "https://Stackoverflow.com/questions/25055712", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1014352/" ]
I'd use `iloc`, which takes a row/column slice, both based on integer position and following normal python syntax. If you want every 5th row: ``` df.iloc[::5, :] ```
I had a similar requirement, but I wanted the n'th item in a particular group. This is how I solved it. ``` groups = data.groupby(['group_key']) selection = groups['index_col'].apply(lambda x: x % 3 == 0) subset = data[selection] ```
25,055,712
`Dataframe.resample()` works only with timeseries data. I cannot find a way of getting every nth row from non-timeseries data. What is the best method?
2014/07/31
[ "https://Stackoverflow.com/questions/25055712", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1014352/" ]
I'd use `iloc`, which takes a row/column slice, both based on integer position and following normal python syntax. If you want every 5th row: ``` df.iloc[::5, :] ```
``` df.drop(labels=df[df.index % 3 != 0].index, axis=0) # every 3rd row (mod 3) ```
25,055,712
`Dataframe.resample()` works only with timeseries data. I cannot find a way of getting every nth row from non-timeseries data. What is the best method?
2014/07/31
[ "https://Stackoverflow.com/questions/25055712", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1014352/" ]
I had a similar requirement, but I wanted the n'th item in a particular group. This is how I solved it. ``` groups = data.groupby(['group_key']) selection = groups['index_col'].apply(lambda x: x % 3 == 0) subset = data[selection] ```
A solution I came up with when using the index was not viable ( possibly the multi-Gig .csv was too large, or I missed some technique that would allow me to reindex without crashing ). Walk through one row at a time and add the nth row to a new dataframe. ``` import pandas as pd from csv import DictReader def make...
25,055,712
`Dataframe.resample()` works only with timeseries data. I cannot find a way of getting every nth row from non-timeseries data. What is the best method?
2014/07/31
[ "https://Stackoverflow.com/questions/25055712", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1014352/" ]
Adding `reset_index()` to [metastableB's answer](https://stackoverflow.com/a/46141173/11816073) allows you to only need to assume that the rows are *ordered and consecutive*. ``` df1 = df[df.reset_index().index % 3 != 0] # Excludes every 3rd row starting from 0 df2 = df[df.reset_index().index % 3 == 0] # Selects eve...
I had a similar requirement, but I wanted the n'th item in a particular group. This is how I solved it. ``` groups = data.groupby(['group_key']) selection = groups['index_col'].apply(lambda x: x % 3 == 0) subset = data[selection] ```
25,055,712
`Dataframe.resample()` works only with timeseries data. I cannot find a way of getting every nth row from non-timeseries data. What is the best method?
2014/07/31
[ "https://Stackoverflow.com/questions/25055712", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1014352/" ]
I'd use `iloc`, which takes a row/column slice, both based on integer position and following normal python syntax. If you want every 5th row: ``` df.iloc[::5, :] ```
Adding `reset_index()` to [metastableB's answer](https://stackoverflow.com/a/46141173/11816073) allows you to only need to assume that the rows are *ordered and consecutive*. ``` df1 = df[df.reset_index().index % 3 != 0] # Excludes every 3rd row starting from 0 df2 = df[df.reset_index().index % 3 == 0] # Selects eve...