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
54,616,310
I have a 2-D numpy array each row of which consists of three elements - ['dataframe\_column\_name', 'dataframe\_index', 'value']. Now, I tried populating the pandas dataframe using iloc double for loop but it is quite slow. Is there any faster way of doing this. I am a bit new to pandas, so apologies in case this is so...
2019/02/10
[ "https://Stackoverflow.com/questions/54616310", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9912260/" ]
You can use the `Keyword.new` function and pass in a transform function as the second argument. ``` Keyword.new(%{"browser_name" => "Chrome", "platform" => "linux"}, fn {k,v} -> {String.to_existing_atom(k), v} end) > [browser_name: "Chrome", platform: "linux"] ``` Although this is basically equivalent to the accepte...
For future reference. You can also use [Enum.into/3](https://hexdocs.pm/elixir/Enum.html#into/3) ``` %{"browser_name" => "Chrome", "platform" => "linux"} |> Enum.into([], fn {k, v} -> {String.to_existing_atom(k), v} end) ``` or in its shorter version: ``` %{"browser_name" => "Chrome", "platform" => "linux"} |> Enum...
3,156,090
Let's say we have two tables: 'Car' and 'Part', with a joining table in 'Car\_Part'. Say I want to see all cars that have a part 123 in them. I could do this: ``` SELECT Car.Col1, Car.Col2, Car.Col3 FROM Car INNER JOIN Car_Part ON Car_Part.Car_Id = Car.Car_Id WHERE Car_Part.Part_Id = @part_to_look_for GROUP BY Car.Co...
2010/07/01
[ "https://Stackoverflow.com/questions/3156090", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1039/" ]
I have similar data so I checked the execution plan for both styles of query. To my surprise, the Column In Subquery (CIS) produced an execution plan with 25% less I/O cost to than the inner join (IJ) query. In the CIS execution plan I get an 2 index scans of the intermediate table (Car\_Part) versus an index scan of t...
The best thing you can do is test them yourself, on realistic data volumes. That would not only benefit for this query, but for all future queries when you are not sure which is the best way. Important things to do include: - test on production level data volumes - test fairly & consistently (clear cache: <http:...
3,156,090
Let's say we have two tables: 'Car' and 'Part', with a joining table in 'Car\_Part'. Say I want to see all cars that have a part 123 in them. I could do this: ``` SELECT Car.Col1, Car.Col2, Car.Col3 FROM Car INNER JOIN Car_Part ON Car_Part.Car_Id = Car.Car_Id WHERE Car_Part.Part_Id = @part_to_look_for GROUP BY Car.Co...
2010/07/01
[ "https://Stackoverflow.com/questions/3156090", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1039/" ]
I have similar data so I checked the execution plan for both styles of query. To my surprise, the Column In Subquery (CIS) produced an execution plan with 25% less I/O cost to than the inner join (IJ) query. In the CIS execution plan I get an 2 index scans of the intermediate table (Car\_Part) versus an index scan of t...
With SQL Server 2008 I would expect `In` to be quicker as it is equivalent to this. ``` SELECT Car.Col1, Car.Col2, Car.Col3 FROM Car WHERE EXISTS(SELECT * FROM Car_Part WHERE Car_Part.Car_Id = Car.Car_Id AND Car_Part.Part_Id = @part_to_look_for ) ``` i.e. it only has to check for the existen...
11,135,032
Part of our application polls for updates and then updates the model with the changes. It leaks, most noticeably in chrome. I saw the problem in **IE** when I left the application running for a long period but it's most noticeable in chrome (version of chrome is 19.0.1084.56 m). There's an example on jsFiddle <http://...
2012/06/21
[ "https://Stackoverflow.com/questions/11135032", "https://Stackoverflow.com", "https://Stackoverflow.com/users/360863/" ]
I don't see any noticeable increase in memory usage, anyway this post could be useful, it is about how to manipulate observable array in efficent ways: <http://www.knockmeout.net/2012/04/knockoutjs-performance-gotcha.html>
After clicking many times the memory will grow. but as soon you force the garbage collector to collect the memory will be freed. You can start collecting by going in on the timeline tab of the chrome developer tools and clicking on start collecting icon.
5,418,945
I have a problem with injecting a bean into a helper class. It works basically like this: I create an object in the page constructor that does some work, returns some data and I show these on the page. In this helper object, a service should be injected via `@Autowired` annotation. However, I always get a null pointer ...
2011/03/24
[ "https://Stackoverflow.com/questions/5418945", "https://Stackoverflow.com", "https://Stackoverflow.com/users/265289/" ]
`@SpringBean` only injects dependencies into classes that inherit from Wicket's `Component`. `@Autowired` only injects dependencies into classes created by Spring itself. That means you can't automatically inject a dependency into an object you create with `new`. (Edit: you can also add a `@SpringBean` injection to yo...
The best practice would be to create your objects via a factory bean (that has those properties injected by Spring, and have that factory inject those properties to objects it spawns - pure IoC). You should really **avoid using SpringContext all over the place** (or any other similar solution for that matter). Here is...
5,418,945
I have a problem with injecting a bean into a helper class. It works basically like this: I create an object in the page constructor that does some work, returns some data and I show these on the page. In this helper object, a service should be injected via `@Autowired` annotation. However, I always get a null pointer ...
2011/03/24
[ "https://Stackoverflow.com/questions/5418945", "https://Stackoverflow.com", "https://Stackoverflow.com/users/265289/" ]
You can inject dependencies into non-Spring-non-Wicket-new-created objects using `@SpringBean` by calling `InjectorHolder.getInjector().inject(this);` in its constructor. For example: ``` class MyPojo { @SpringBean MyDumbDAO dao; MyPojo() { InjectorHolder.getInjector().inject(this); } void...
The best practice would be to create your objects via a factory bean (that has those properties injected by Spring, and have that factory inject those properties to objects it spawns - pure IoC). You should really **avoid using SpringContext all over the place** (or any other similar solution for that matter). Here is...
5,533,538
Why am I getting this error? ``` jQuery(document).ready(function($){ $('.stuff').each(function(){ function thing(id, count){ this.id = id; this.count = count; } var myvar = new Array(); myvar.push(new thing('one', '134')); myvar.push(new thing('two', '225')); $('a', this...
2011/04/04
[ "https://Stackoverflow.com/questions/5533538", "https://Stackoverflow.com", "https://Stackoverflow.com/users/376947/" ]
You're trying to access an index based (0,1,2) array with a string index (i, the result of attr('class')). Easiest fix is to use an object (aka fake hash array) for myvar and set the keys to the class names. ``` var myvar = { one : 134, two : 225 }; ``` With that myvar, you can still use myvar[i] with i being t...
What is the value of "i"? I suspect you are not getting a myvar = null, but myvar[0] = null because you have not added any data to the array. Can you include the script within the anonymous function.
5,533,538
Why am I getting this error? ``` jQuery(document).ready(function($){ $('.stuff').each(function(){ function thing(id, count){ this.id = id; this.count = count; } var myvar = new Array(); myvar.push(new thing('one', '134')); myvar.push(new thing('two', '225')); $('a', this...
2011/04/04
[ "https://Stackoverflow.com/questions/5533538", "https://Stackoverflow.com", "https://Stackoverflow.com/users/376947/" ]
You're trying to access an index based (0,1,2) array with a string index (i, the result of attr('class')). Easiest fix is to use an object (aka fake hash array) for myvar and set the keys to the class names. ``` var myvar = { one : 134, two : 225 }; ``` With that myvar, you can still use myvar[i] with i being t...
As i said , your value i might be wrong , it should start with 0,1,2 et .... print the value or alert and check it ``` $('a', this).click(function(event){ var i = $(this).attr('class'); // class is 'one', 'two' etc... // myvar[i] appears undefined here! wtf? }); ```
22,338,281
I am exploring docusign API. I am trying to understand if the following is possible with status API Is it possible to request the status for a set of Envelope Ids. I have seen the documentation for requesting status for ONE envelope id. Thanks for reading
2014/03/11
[ "https://Stackoverflow.com/questions/22338281", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1810135/" ]
There are two types of arrays: ``` array( 'key' => 'value', 'key' => 'value', 'key' => 'value', ) ``` and ``` array( 'value', 'value', 'value', 'value', ); ``` the latter is the same as: ``` array( 0 => 'value', 1 => 'value', 2 => 'value', 3 => 'value', ); ``` it's r...
Here is an example that is similar to what you're describing: ``` $words = array("tasty", "wretched", "simple", "gnarly", "fruitful", "cleeeever"); echo $words[1]; //prints wretched for($i=0;$i<4;$i++) {//prints array in original order echo $words[$i].'<br/>'; } shuffle($words); for($i=0;$i<4;$i++) {//prints s...
3,015,457
Here's some JavaScript: ``` linkElem.click(function () { var data = linkElem.data(); alert(''+data.mls + ' ' + data.id); }); ``` It works. `linkElem` is a local variable that I create in a loop inside a function. I assign some data to it with jQuery's `.data()`. If I did not call `.click()`, `linkElem` woul...
2010/06/10
[ "https://Stackoverflow.com/questions/3015457", "https://Stackoverflow.com", "https://Stackoverflow.com/users/312427/" ]
Yes, your description is pretty close. The local storage for a Javascript function call is just a block of memory allocated for local variables. If you "capture" that by creating *another* function *inside* a called function, then the storage is retained and the local variables carry on with their lives, unaware that t...
> > However, I have created an anonymous function which references linkElem. So I am no longer sure what is going on. > > > It still gets reassigned, unless you are wrapping it in another level of scope (NB: another function). Consider the following: ``` for (var j = 0;j < 10;j += 1) { arrayOfLinks[j].onclic...
3,015,457
Here's some JavaScript: ``` linkElem.click(function () { var data = linkElem.data(); alert(''+data.mls + ' ' + data.id); }); ``` It works. `linkElem` is a local variable that I create in a loop inside a function. I assign some data to it with jQuery's `.data()`. If I did not call `.click()`, `linkElem` woul...
2010/06/10
[ "https://Stackoverflow.com/questions/3015457", "https://Stackoverflow.com", "https://Stackoverflow.com/users/312427/" ]
Yes, your description is pretty close. The local storage for a Javascript function call is just a block of memory allocated for local variables. If you "capture" that by creating *another* function *inside* a called function, then the storage is retained and the local variables carry on with their lives, unaware that t...
Please refer to this [How do JavaScript closures work?](https://stackoverflow.com/questions/111102/how-do-javascript-closures-work) This may help you understanding closures. Whenever you see the function keyword within another function, the inner function has access to variables in the outer function. ``` function f...
20,802,469
I'm sure this is really simple, but I'm only just starting with angular. I have a property.price variable which is either 1, 2 or 3. I wish to display this as £, ££, or £££. I can display "Price: 2" by going: ``` Price: {{ price = property.price}} ``` But I'm getting a bit confused. ``` <span ng-repeat="n in [] |...
2013/12/27
[ "https://Stackoverflow.com/questions/20802469", "https://Stackoverflow.com", "https://Stackoverflow.com/users/630203/" ]
I created a fiddle that demonstrates what I think you are looking for here (<http://jsfiddle.net/gwfPh/72/>). In this I put two variables in scope - amount and repeatCount, which display the amount and the number of times to repeat the pound symbol: ``` function Main($scope){ // number of times to repeat $sco...
You could use the filter mechanic, or you could create your own simple directive. Fiddle - <http://jsfiddle.net/2MN5w/1/> ``` <span repeat-by-integer="3">£</span> myApp.directive('repeatByInteger', function () { return { link: function (scope, element, attr) { var times = parseInt(attr.repeatB...
130,199
Are there clustering algorithms that take advantage of bootstrap? For example can one combine bootstrap with a standard K-Means algorithm to scale K-Means. I was thinking if the following at a high-level: 1. Use bootstrap to create sub-samples from the elements that need to be clustered. 2. Each of these sub-samples...
2014/12/24
[ "https://stats.stackexchange.com/questions/130199", "https://stats.stackexchange.com", "https://stats.stackexchange.com/users/14163/" ]
If you're still interested in applying **bootstrap** approach to *clustering*, I would recommend you to read the following two excellent and IMHO relevant answers: one on *applying bootstrapping to clustering* (<https://stats.stackexchange.com/a/11702/31372>) and another on *determining optimal number of clusters and m...
Usually, it will be good enough to run k-means on a *single* sample. So yes, one can combine k-means with sampling, in two ways: 1. run k-means on the sample, and use the result. 2. run k-means on the sample, use the resulting centers, and continue on the full data set (which should usually converge within a small nu...
61,227,788
I just want to skip the given week from a date range(month range). For example, I have a date range between **2020-04-01 to 2020-04-30**. I just have to skip the alternate week from this date range which is **2020-04-08 to 2020-04-14 and 2020-04-22 to 2020-04-28**. So my final output will be ``` [0] => 2020-04-01 ...
2020/04/15
[ "https://Stackoverflow.com/questions/61227788", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11454721/" ]
Maybe something like this: You only need to pass in date for first of month and array of weeks to exclude. ``` function excludeWeeks($dateStart, $excludeWeeks) { $finalDates = []; $date = new DateTime($dateStart); $daysInMonth = date("t", strtotime($dateStart));; $firstOfMonth = strtotime(date("Y-m-01", str...
The starting parameters are at beggining of code ``` $startData = "2020-04-01"; $endData = "2020-04-30"; $skipData = "2020-04-08"; // skip one week starting from this data $everyNumberWeeks = 1; $dateTimestampStartData = strtotime($startData); $dateTimestampEndData = strtotime($endData); $dataTimestampSkipData = strt...
545,134
Summary: We have both an old tried and true computer (type #1) and brand new (type #2) on 100 airplanes processing the same raw data and want to know if they are equivalent based on the telematics output of those computers. Should we use the sample size equation for [two independent samples continuous outcome](https://...
2021/09/18
[ "https://stats.stackexchange.com/questions/545134", "https://stats.stackexchange.com", "https://stats.stackexchange.com/users/335162/" ]
Ed Tufte's [spare redesign of the boxplot](https://stats.stackexchange.com/a/13915/919) permits a large "small multiple" graphic to be displayed. Another point Tufte makes is that by ordering small multiples according to another factor, one often gets "free" information out of the graphic. Ordering the plots by median ...
In my opinion the 2nd plot is pretty good. I might just add `colour =` so that each individual has their own colour, but the two main things that jump out about that plot are: * there is considerably variation *between* individuals * there is, by comparison, much less variation *within* individuals * there is conside...
11,852,483
How do I create unit tests for out parameters of a private function? My service layer: ``` private int LoadProduct(string productId, out IProduct product) { product = this.Load(productId); return ErrorCodes.Success; } ``` Test case: ``` [Test] public void LoadProductTest() { var offerService = new Off...
2012/08/07
[ "https://Stackoverflow.com/questions/11852483", "https://Stackoverflow.com", "https://Stackoverflow.com/users/131818/" ]
try saving the object array that you pass the invoke call. ``` object[] args = new object[] { "AnId", myProduct }; var result = (int)privateOfferService.Invoke("LoadProduct", args); Assert.That(args[1], Is.NotNull()); ``` <https://stackoverflow.com/a/2438069/1311351>
You can, if you really, really need to test this method, mark it internal and specify the [InternalsVisibleTo](http://msdn.microsoft.com/en-us/library/system.runtime.compilerservices.internalsvisibletoattribute.aspx) attribute for the class to your test namespace. But yeah, just test the public interface.
11,852,483
How do I create unit tests for out parameters of a private function? My service layer: ``` private int LoadProduct(string productId, out IProduct product) { product = this.Load(productId); return ErrorCodes.Success; } ``` Test case: ``` [Test] public void LoadProductTest() { var offerService = new Off...
2012/08/07
[ "https://Stackoverflow.com/questions/11852483", "https://Stackoverflow.com", "https://Stackoverflow.com/users/131818/" ]
try saving the object array that you pass the invoke call. ``` object[] args = new object[] { "AnId", myProduct }; var result = (int)privateOfferService.Invoke("LoadProduct", args); Assert.That(args[1], Is.NotNull()); ``` <https://stackoverflow.com/a/2438069/1311351>
I believe it's considered good practice to return the actual object, and not use error codes for return values. If there is an error, throw an exception. And if you return the actual business object, you won't have this issue. Since you don't say what about your code doesn't compile, I'm assuming your test method can'...
29,831,056
I am really getting Frustrated right now. I tried to add a Button to the Action Bar but removed again because i thought it caused this reason. The following is the Gradle Error Messages ``` Information:Gradle tasks [:app:assembleDebug] :app:preBuild UP-TO-DATE :app:preDebugBuild UP-TO-DATE :app:compileDebugNdk UP-TO-D...
2015/04/23
[ "https://Stackoverflow.com/questions/29831056", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4779542/" ]
You have misplaced your JAR files. They should not be under `res`. The resource compiler tries to parse them as XML and fails, hence the error message. Since you're using the android-plot library from a repo, you can remove the `res/libs` altogether.
The problem is most likely an invalid content of your `AndroidManifest.xml`. Check if it is valid XML. I am not sure if build is doing some transformation/substitutions there but generally it has to be a valid XML conforming to Android app requirements. There are few similar topics like [org.xml.sax.SAXParseException:...
8,942,360
I have a JPanel with two JTextFields. If the user writes some text into textfield A the same text should appear in textfield B and vice versa. How can that be implemented without getting an infinite loop. So far I have the following which leds to a infinite loop. ``` JTextField textFieldA; JTextField...
2012/01/20
[ "https://Stackoverflow.com/questions/8942360", "https://Stackoverflow.com", "https://Stackoverflow.com/users/836038/" ]
Try to update `textFieldB` only if `textFieldA` [hasFocus](http://docs.oracle.com/javase/6/docs/api/java/awt/Component.html#isFocusOwner%28%29) (and vice versa)
I'd do it with a key listener on both Text fields, the keyPressed event then copys the triggered field to the other. greets
8,942,360
I have a JPanel with two JTextFields. If the user writes some text into textfield A the same text should appear in textfield B and vice versa. How can that be implemented without getting an infinite loop. So far I have the following which leds to a infinite loop. ``` JTextField textFieldA; JTextField...
2012/01/20
[ "https://Stackoverflow.com/questions/8942360", "https://Stackoverflow.com", "https://Stackoverflow.com/users/836038/" ]
You can use a boolean to mark when you are propagating changes. ``` JTextField textFieldA; JTextField textFieldB; boolean updating = false; textFieldA.getDocument().addDocumentListener(new DocumentListener() { public void insertUpdate(DocumentEvent e) { if(!updating) { ...
I'd do it with a key listener on both Text fields, the keyPressed event then copys the triggered field to the other. greets
8,942,360
I have a JPanel with two JTextFields. If the user writes some text into textfield A the same text should appear in textfield B and vice versa. How can that be implemented without getting an infinite loop. So far I have the following which leds to a infinite loop. ``` JTextField textFieldA; JTextField...
2012/01/20
[ "https://Stackoverflow.com/questions/8942360", "https://Stackoverflow.com", "https://Stackoverflow.com/users/836038/" ]
Take advantage of MVC design and share the model: ``` textFieldB.setDocument(textFieldA.getDocument()); ```
I'd do it with a key listener on both Text fields, the keyPressed event then copys the triggered field to the other. greets
8,942,360
I have a JPanel with two JTextFields. If the user writes some text into textfield A the same text should appear in textfield B and vice versa. How can that be implemented without getting an infinite loop. So far I have the following which leds to a infinite loop. ``` JTextField textFieldA; JTextField...
2012/01/20
[ "https://Stackoverflow.com/questions/8942360", "https://Stackoverflow.com", "https://Stackoverflow.com/users/836038/" ]
You can use a boolean to mark when you are propagating changes. ``` JTextField textFieldA; JTextField textFieldB; boolean updating = false; textFieldA.getDocument().addDocumentListener(new DocumentListener() { public void insertUpdate(DocumentEvent e) { if(!updating) { ...
Try to update `textFieldB` only if `textFieldA` [hasFocus](http://docs.oracle.com/javase/6/docs/api/java/awt/Component.html#isFocusOwner%28%29) (and vice versa)
8,942,360
I have a JPanel with two JTextFields. If the user writes some text into textfield A the same text should appear in textfield B and vice versa. How can that be implemented without getting an infinite loop. So far I have the following which leds to a infinite loop. ``` JTextField textFieldA; JTextField...
2012/01/20
[ "https://Stackoverflow.com/questions/8942360", "https://Stackoverflow.com", "https://Stackoverflow.com/users/836038/" ]
Take advantage of MVC design and share the model: ``` textFieldB.setDocument(textFieldA.getDocument()); ```
Try to update `textFieldB` only if `textFieldA` [hasFocus](http://docs.oracle.com/javase/6/docs/api/java/awt/Component.html#isFocusOwner%28%29) (and vice versa)
18,808,908
what is error in this code? could any give code for peak finding in an 1-d array in perl code? I tried but i could complete if some one help me out.` ``` @a=(5.7,5.3,8.2,16.5,34.2,58.8,5.9,8,5,27.8); @a=\$ptr; $i; $f=1; $l=10; $num=@a; print"\nthe num of elements in array:$num"; $s=0; $s=$s+$_ for @a; print"\nthe sum...
2013/09/15
[ "https://Stackoverflow.com/questions/18808908", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2780453/" ]
A quick way to do this is to use `sort`. But be sure to use a numeric comparator because sort sorts alphanumeric by default: ``` my @b = sort {$b <=> $a} @a; print "$b[0]"; ``` **UPDATE** Or you can use `map` from `List::Util` - thanks @squiguy. ``` use List::Util qw(max); my $peak = max(@a); ``` It's true that ...
Perl has a built in `sort` function that should help in this situation. ``` a@ = sort {$b <=> $a} @a; print "$a[0]"; ```
18,808,908
what is error in this code? could any give code for peak finding in an 1-d array in perl code? I tried but i could complete if some one help me out.` ``` @a=(5.7,5.3,8.2,16.5,34.2,58.8,5.9,8,5,27.8); @a=\$ptr; $i; $f=1; $l=10; $num=@a; print"\nthe num of elements in array:$num"; $s=0; $s=$s+$_ for @a; print"\nthe sum...
2013/09/15
[ "https://Stackoverflow.com/questions/18808908", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2780453/" ]
The cleanest way to find the max is to use the core [List::Util](http://perldoc.perl.org/List/Util.html) module. ``` use List::Util qw(max); my $max = max @arr; ```
Perl has a built in `sort` function that should help in this situation. ``` a@ = sort {$b <=> $a} @a; print "$a[0]"; ```
18,808,908
what is error in this code? could any give code for peak finding in an 1-d array in perl code? I tried but i could complete if some one help me out.` ``` @a=(5.7,5.3,8.2,16.5,34.2,58.8,5.9,8,5,27.8); @a=\$ptr; $i; $f=1; $l=10; $num=@a; print"\nthe num of elements in array:$num"; $s=0; $s=$s+$_ for @a; print"\nthe sum...
2013/09/15
[ "https://Stackoverflow.com/questions/18808908", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2780453/" ]
The cleanest way to find the max is to use the core [List::Util](http://perldoc.perl.org/List/Util.html) module. ``` use List::Util qw(max); my $max = max @arr; ```
A quick way to do this is to use `sort`. But be sure to use a numeric comparator because sort sorts alphanumeric by default: ``` my @b = sort {$b <=> $a} @a; print "$b[0]"; ``` **UPDATE** Or you can use `map` from `List::Util` - thanks @squiguy. ``` use List::Util qw(max); my $peak = max(@a); ``` It's true that ...
49,082,688
1. Suppose I have 10k of record and whenever I am trying to update state using setState every time component is re-render but I want after all changes on state component should render once only. example :- ```js constructor(){ this.state={ employeeList:[{name:a},{name:b},{name:c},{name:d},{name:e}.....] ...
2018/03/03
[ "https://Stackoverflow.com/questions/49082688", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5891950/" ]
There are two possible ways to do this: * Use the 'shouldComponentUpdate' and decide in it whether to render. * Use a pure component. Using 'shouldComponentUpdate' ============================= The following text is copied from "[How does React decide to re-render a component?](http://lucybain.com/blog/2017/react-js...
You need to handle your state updates differently Instead of updating state separately for each value, you would update it once like ``` update() { const newValues = [1,2,3,4,5]; const newEmployeeList = this.state.employeeList.map((obj, index) => { return {...obj, name: newValues[index]}; }) this.se...
30,018,459
I have created some forms using class based views, now I like to add them to the Django Admin site. I have only found this [link](http://patrick.arminio.info/additional-admin-views/) which describes adding normal views to the Admin site.
2015/05/03
[ "https://Stackoverflow.com/questions/30018459", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4779076/" ]
`as_view()` method of class-based view returns regular view so you can call it from `ModelAdmin` like this: ``` def review(self, request, id): return MyReviewView.as_view()(request, id) ```
You can pass the class based view's `as_view` directly, without need of having a variable like `awesome_book_view` as suggested by another answer: Example: in `admin.py` I have: ``` class EmailAdmin(admin.ModelAdmin): def get_urls(self): urls = super(EmailAdmin, self).get_urls() my_urls = [ ...
30,018,459
I have created some forms using class based views, now I like to add them to the Django Admin site. I have only found this [link](http://patrick.arminio.info/additional-admin-views/) which describes adding normal views to the Admin site.
2015/05/03
[ "https://Stackoverflow.com/questions/30018459", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4779076/" ]
Let say you have the following class based view: ``` # File: views.py class MyAwesomeBookView(TemplateView): pass ``` To use this view, you have to make it `callable` ``` # File: views.py awesome_book_view = MyAwesomeBookView.as_view() ``` Once your view is `callable`, you can pretty much treat it like how yo...
You can pass the class based view's `as_view` directly, without need of having a variable like `awesome_book_view` as suggested by another answer: Example: in `admin.py` I have: ``` class EmailAdmin(admin.ModelAdmin): def get_urls(self): urls = super(EmailAdmin, self).get_urls() my_urls = [ ...
30,018,459
I have created some forms using class based views, now I like to add them to the Django Admin site. I have only found this [link](http://patrick.arminio.info/additional-admin-views/) which describes adding normal views to the Admin site.
2015/05/03
[ "https://Stackoverflow.com/questions/30018459", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4779076/" ]
For a full integration with Django admin templates, you can pass the model admin as an extra argument to the class based view, then use it to add some sugar to the context: file admin.py: ``` from django.contrib import admin from .models import MyModel from .views import ProcessObjectView @admin.register(MyModel) cl...
You can pass the class based view's `as_view` directly, without need of having a variable like `awesome_book_view` as suggested by another answer: Example: in `admin.py` I have: ``` class EmailAdmin(admin.ModelAdmin): def get_urls(self): urls = super(EmailAdmin, self).get_urls() my_urls = [ ...
6,983,042
I'm converting code from perl to java. I'm sort of stuck on finding the equivalents in java. Here's my Perl code: ``` for($i = 0; $i < strlen($hex_); $i = $i + 2) { $ascii = $ascii.chr(hexdec(substr($hex_, $i, 2))); } ``` so in java i can do hex.substring(i,2). I got that part. How would I do t...
2011/08/08
[ "https://Stackoverflow.com/questions/6983042", "https://Stackoverflow.com", "https://Stackoverflow.com/users/763472/" ]
There is no need for you to go about parsing hexadecimal numbers manually, you can just use [Integer.parseInt(String s, int radix)](http://download.oracle.com/javase/1.4.2/docs/api/java/lang/Integer.html#parseInt%28java.lang.String,%20int%29). Similarily, there is an [Integer.toString(int i, int radix)](http://download...
I'm actually extremely surprised you didn't use `pack` for your Perl version! ``` $ascii = pack 'H*', $hex_; ``` Anyway, the Java port of your Perl code, if you want to code it manually (as opposed to using something like [Apache Commons Codec](http://commons.apache.org/codec/)) is: ``` StringBuilder sb = new Strin...
19,482,378
I'm working on a project where I have to read a date to make sure that it's a valid date. For example, February 29th is only a valid date on leap years, or June 31st is not a valid date, so the computer would output that information based on the input. My issue is that I can't figure out how to parse the string so that...
2013/10/20
[ "https://Stackoverflow.com/questions/19482378", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2469129/" ]
If the format is like in your example, you could take out the integer like this: ``` int day, month, year; sscanf(buffer, "%2d/%2d/%4d", &month, &day, &year); ``` where of course in buffer you have the date ("05/11/1996" )
I'd prefer to use Boost DateTime: See it **[Live on Coliru](http://coliru.stacked-crooked.com/a/7afe5aac06f94870)** ``` #include <iostream> #include <boost/date_time/local_time/local_time.hpp> struct dateparser { dateparser(std::string fmt) { // set format using namespace boost::local_time; ...
19,482,378
I'm working on a project where I have to read a date to make sure that it's a valid date. For example, February 29th is only a valid date on leap years, or June 31st is not a valid date, so the computer would output that information based on the input. My issue is that I can't figure out how to parse the string so that...
2013/10/20
[ "https://Stackoverflow.com/questions/19482378", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2469129/" ]
If the format is like in your example, you could take out the integer like this: ``` int day, month, year; sscanf(buffer, "%2d/%2d/%4d", &month, &day, &year); ``` where of course in buffer you have the date ("05/11/1996" )
Another option is to use `std::get_time` from the `<iomanip>` header (available since C++11). A good example of its use can be found [here](http://en.cppreference.com/w/cpp/io/manip/get_time).
19,482,378
I'm working on a project where I have to read a date to make sure that it's a valid date. For example, February 29th is only a valid date on leap years, or June 31st is not a valid date, so the computer would output that information based on the input. My issue is that I can't figure out how to parse the string so that...
2013/10/20
[ "https://Stackoverflow.com/questions/19482378", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2469129/" ]
A possible solution might be also based on [`strptime`](http://man7.org/linux/man-pages/man3/strptime.3.html), however note that this function only validates whether the day is from the interval `<1;31>` and month from `<1;12>`, i.e. `"30/02/2013"` is valid still: ``` #include <iostream> #include <ctime> int main() {...
I'd prefer to use Boost DateTime: See it **[Live on Coliru](http://coliru.stacked-crooked.com/a/7afe5aac06f94870)** ``` #include <iostream> #include <boost/date_time/local_time/local_time.hpp> struct dateparser { dateparser(std::string fmt) { // set format using namespace boost::local_time; ...
19,482,378
I'm working on a project where I have to read a date to make sure that it's a valid date. For example, February 29th is only a valid date on leap years, or June 31st is not a valid date, so the computer would output that information based on the input. My issue is that I can't figure out how to parse the string so that...
2013/10/20
[ "https://Stackoverflow.com/questions/19482378", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2469129/" ]
A possible solution might be also based on [`strptime`](http://man7.org/linux/man-pages/man3/strptime.3.html), however note that this function only validates whether the day is from the interval `<1;31>` and month from `<1;12>`, i.e. `"30/02/2013"` is valid still: ``` #include <iostream> #include <ctime> int main() {...
Another option is to use `std::get_time` from the `<iomanip>` header (available since C++11). A good example of its use can be found [here](http://en.cppreference.com/w/cpp/io/manip/get_time).
459,615
Is there a way to do it without sacrifices?
2012/08/08
[ "https://superuser.com/questions/459615", "https://superuser.com", "https://superuser.com/users/-1/" ]
This does the job well: Colors->Components->Decompose * Set Color Model to RGBA * Uncheck "Decompose to layers" - my personal preference * OK Colors->Components->Recompose Swap the RED and ALPHA channels
It seems that "Colors -> Color To Alpha" should do the trick if you set the color to ff0000.
25,011,873
I'm trying to get photo data (like likes) using the graph api, but it appears that some photos give me the data, but others return "Unsupported get request". I'm only testing public pictures, using [GET /photo-id](https://developers.facebook.com/docs/graph-api/reference/v1.0/photo). [This](https://www.facebook.com/ph...
2014/07/29
[ "https://Stackoverflow.com/questions/25011873", "https://Stackoverflow.com", "https://Stackoverflow.com/users/955823/" ]
Try this: ``` Invoke-Command -ComputerName "mycomputer" -ScriptBlock { ## if public then $queuename = ".\YOUR_Q_NAME" $queuename = ".\private$\YOUR_Q_NAME" [Reflection.Assembly]::LoadWithPartialName("System.Messaging") | Out-Null $queue = New-Object -TypeName "System.Messaging.Mess...
Or if you're running Windows Server 2012 on the remote machine, you can use the MSMQ module functions: ``` Get-MessageQueue -Name QueueName | Clear-MessageQueue ```
577,954
How can I solve $y-xy'-\sin(y')=0$? Are there any general techniques for solving ODE of the form $y=f(y')$, where $f$ is a trigonometric function?
2013/11/23
[ "https://math.stackexchange.com/questions/577954", "https://math.stackexchange.com", "https://math.stackexchange.com/users/96345/" ]
I really don't know how to solve this kind of ODE's in a general manner. For your specific case, basically by trial and error, I found y = a x + Sin[a]. Please, let me know if you receive answers. I am really curious.
May be this helps $y−xy′−sin(y′)=0 \to sin(y')=y-xy'\\ y'-(xy''+y')-y''cos(y')=0 \to cos(y')=-\frac{xy''}{y''}=-x\\ sin^2(y')+cos^2(y')=1 \to (y-xy')^2+x^2=1 \to y^2+x^2(y')^2-2xyy'+x^2=1$ Which is a first-order nonlinear ordinary differential equation, that must be solvable. Let $y=xv(x)$. After doing the math we ...
577,954
How can I solve $y-xy'-\sin(y')=0$? Are there any general techniques for solving ODE of the form $y=f(y')$, where $f$ is a trigonometric function?
2013/11/23
[ "https://math.stackexchange.com/questions/577954", "https://math.stackexchange.com", "https://math.stackexchange.com/users/96345/" ]
Assuming you mean $y(x)$, what you have is what is known as a [Clairaut's equation](http://en.wikipedia.org/wiki/Clairaut%27s_equation). Separate your $y$ and $y'$ and then differentiate with respect to $x$, then factor and solve. After a bit of manipulation, you should get $y = \sin \alpha + \alpha x$ or $y = \pm(x ...
I really don't know how to solve this kind of ODE's in a general manner. For your specific case, basically by trial and error, I found y = a x + Sin[a]. Please, let me know if you receive answers. I am really curious.
577,954
How can I solve $y-xy'-\sin(y')=0$? Are there any general techniques for solving ODE of the form $y=f(y')$, where $f$ is a trigonometric function?
2013/11/23
[ "https://math.stackexchange.com/questions/577954", "https://math.stackexchange.com", "https://math.stackexchange.com/users/96345/" ]
Assuming you mean $y(x)$, what you have is what is known as a [Clairaut's equation](http://en.wikipedia.org/wiki/Clairaut%27s_equation). Separate your $y$ and $y'$ and then differentiate with respect to $x$, then factor and solve. After a bit of manipulation, you should get $y = \sin \alpha + \alpha x$ or $y = \pm(x ...
May be this helps $y−xy′−sin(y′)=0 \to sin(y')=y-xy'\\ y'-(xy''+y')-y''cos(y')=0 \to cos(y')=-\frac{xy''}{y''}=-x\\ sin^2(y')+cos^2(y')=1 \to (y-xy')^2+x^2=1 \to y^2+x^2(y')^2-2xyy'+x^2=1$ Which is a first-order nonlinear ordinary differential equation, that must be solvable. Let $y=xv(x)$. After doing the math we ...
31,912,225
I am trying to start a New Activity using Intent but I keep getting `java.lang.IllegalStateException: Could not execute method of the activity` What am I doing wrong? Main Activity ``` package com.example.wrw; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view...
2015/08/10
[ "https://Stackoverflow.com/questions/31912225", "https://Stackoverflow.com", "https://Stackoverflow.com/users/848968/" ]
In android app, all `Activity` must be configured in the `Manifest.xml` file firstly, so you should add `newact Activity` to your manifest ``` <activity android:name=".MainActivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> ...
try this ``` Intent intent = new Intent(MainActivity.this, newact.class) ``` and also register `newact` in manifest file like this ``` <activity android:name=".newact" android:label="@string/app_name"> </activity> ```
31,912,225
I am trying to start a New Activity using Intent but I keep getting `java.lang.IllegalStateException: Could not execute method of the activity` What am I doing wrong? Main Activity ``` package com.example.wrw; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view...
2015/08/10
[ "https://Stackoverflow.com/questions/31912225", "https://Stackoverflow.com", "https://Stackoverflow.com/users/848968/" ]
In android app, all `Activity` must be configured in the `Manifest.xml` file firstly, so you should add `newact Activity` to your manifest ``` <activity android:name=".MainActivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> ...
Add this to your manifest file ``` <activity android:name=".newact" android:label="@string/title_activity_login"> ```
31,912,225
I am trying to start a New Activity using Intent but I keep getting `java.lang.IllegalStateException: Could not execute method of the activity` What am I doing wrong? Main Activity ``` package com.example.wrw; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view...
2015/08/10
[ "https://Stackoverflow.com/questions/31912225", "https://Stackoverflow.com", "https://Stackoverflow.com/users/848968/" ]
In android app, all `Activity` must be configured in the `Manifest.xml` file firstly, so you should add `newact Activity` to your manifest ``` <activity android:name=".MainActivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> ...
Replace this to your **MainActivity**, this may resolve your problem. ``` Intent intent = new Intent(MainActivity.this, newact.class); startActivity(intent); ``` After this, do not forget to **add this in your android menifest file**, ``` <activity android:name=".newact" android:label="@string/a...
208,980
I am wondering about the differences. Based on my understanding, MLP is one kind of neural networks, where the activation function is sigmoid, and error term is cross-entropy(logistics) error. Looking for help, thanks!
2016/04/23
[ "https://stats.stackexchange.com/questions/208980", "https://stats.stackexchange.com", "https://stats.stackexchange.com/users/39551/" ]
You are right, MLP is one kind of neural network. **There are several kinds of NN**, you can have a NN based on Radial Basis Function with a Soft gating strategy, for example. You can use a committee machine strategy to form a NN...
Multi-Layer Perceptron is a model of neural networks (NN). There are several other models including recurrent NN and radial basis networks. For an introduction to different models and to get a sense of how they are different, check this [link](https://en.m.wikipedia.org/wiki/Types_of_artificial_neural_networks) out.
208,980
I am wondering about the differences. Based on my understanding, MLP is one kind of neural networks, where the activation function is sigmoid, and error term is cross-entropy(logistics) error. Looking for help, thanks!
2016/04/23
[ "https://stats.stackexchange.com/questions/208980", "https://stats.stackexchange.com", "https://stats.stackexchange.com/users/39551/" ]
You are right, MLP is one kind of neural network. **There are several kinds of NN**, you can have a NN based on Radial Basis Function with a Soft gating strategy, for example. You can use a committee machine strategy to form a NN...
MLP is fully connected feed-forward network. In particular CNN which is partially connected, RNN which has feedback loop are not MLPs.
208,980
I am wondering about the differences. Based on my understanding, MLP is one kind of neural networks, where the activation function is sigmoid, and error term is cross-entropy(logistics) error. Looking for help, thanks!
2016/04/23
[ "https://stats.stackexchange.com/questions/208980", "https://stats.stackexchange.com", "https://stats.stackexchange.com/users/39551/" ]
You are right, MLP is one kind of neural network. **There are several kinds of NN**, you can have a NN based on Radial Basis Function with a Soft gating strategy, for example. You can use a committee machine strategy to form a NN...
The main difference is that MLP is one way. Thus, it's a feedforward network without any loop. Whereas, Neural networks such as DNN can contain loops. See more [here](https://www.kaggle.com/getting-started/46727)
208,980
I am wondering about the differences. Based on my understanding, MLP is one kind of neural networks, where the activation function is sigmoid, and error term is cross-entropy(logistics) error. Looking for help, thanks!
2016/04/23
[ "https://stats.stackexchange.com/questions/208980", "https://stats.stackexchange.com", "https://stats.stackexchange.com/users/39551/" ]
MLP is fully connected feed-forward network. In particular CNN which is partially connected, RNN which has feedback loop are not MLPs.
Multi-Layer Perceptron is a model of neural networks (NN). There are several other models including recurrent NN and radial basis networks. For an introduction to different models and to get a sense of how they are different, check this [link](https://en.m.wikipedia.org/wiki/Types_of_artificial_neural_networks) out.
208,980
I am wondering about the differences. Based on my understanding, MLP is one kind of neural networks, where the activation function is sigmoid, and error term is cross-entropy(logistics) error. Looking for help, thanks!
2016/04/23
[ "https://stats.stackexchange.com/questions/208980", "https://stats.stackexchange.com", "https://stats.stackexchange.com/users/39551/" ]
MLP is fully connected feed-forward network. In particular CNN which is partially connected, RNN which has feedback loop are not MLPs.
The main difference is that MLP is one way. Thus, it's a feedforward network without any loop. Whereas, Neural networks such as DNN can contain loops. See more [here](https://www.kaggle.com/getting-started/46727)
30,531,063
I am parsing file which has following type of rows using Talend, i have tried tFileInputDelimted component to parse it, but text en-closer "'" not working. ``` 1, 0, 1, 73, 0, 'root.1', 'Root Asset', '{"site":{"6":1,"2":1},"core":{"6":1}}' ``` I need a output in following format. ``` 1 0 1 73 0 root.1 Root Asset ...
2015/05/29
[ "https://Stackoverflow.com/questions/30531063", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1551515/" ]
You can use the following regex: ``` \\s*,\\s*(?=(?:(?:[^']*'){2})*[^']*$) ``` See [DEMO](https://regex101.com/r/mD9cK8/6)
Seems like it contains only strings and integers. So you could do matching. ``` Matcher m = Pattern.compile("'([^']*)'|(\\d+(?:\\.\\d+)?)").matcher(str); while(m.find()) { System.out.println(m.group(1)); System.out.println(m.group(2)); } ```
5,147,913
I know I can create a custom event and associate data with it and retrieve it in respective Event Listener. But What I am interested to know is, is there a short method (without having to extend Alert Event Class) to associate parameters to its alert Listener.
2011/02/28
[ "https://Stackoverflow.com/questions/5147913", "https://Stackoverflow.com", "https://Stackoverflow.com/users/503510/" ]
`.ASP` is traditionally not a .NET application page unless you re-configured the `.ASP` extension. My guess is that you do not have `.ASP` enabled and the server thinks "main.asp" is a virtual directory not a .ASP page: [Enabling ASP Pages in IIS 6.0](http://technet.microsoft.com/en-us/library/cc737992%28WS.10%29.asp...
It means that you can only rewrite to another virtual path, meaning /somefolder/somefile.asp or aspx or whatever. If you want to execute the asp page from another server and just serve the content it generates, you will need to "proxy" that page. That can be a .aspx page that makes a remote request or a proxy module f...
28,460,088
There's any way to implement an **implicit** conversion from `string` to `bool` using C#? E.g. I have the string `str` with value *Y* and when I try convert (cast) to `boolean` it must return `true`.
2015/02/11
[ "https://Stackoverflow.com/questions/28460088", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4190610/" ]
No. You can't create user-defined conversions which don't convert either to or from the type they're declared in. The closest you could easily come would be an extension method, e.g. ``` public static bool ToBoolean(this string text) { return text == "Y"; // Or whatever } ``` You could then use: ``` bool resul...
Here is an extension method that you can use for any string. ``` public static bool ToBoolean(this string input) { var stringTrueValues = new[] { "true", "ok", "yes", "1", "y" }; return stringTrueValues.Contains(input.ToLower()); } ``` Here is an example of using this extension method: ``` Console.WriteLine...
28,460,088
There's any way to implement an **implicit** conversion from `string` to `bool` using C#? E.g. I have the string `str` with value *Y* and when I try convert (cast) to `boolean` it must return `true`.
2015/02/11
[ "https://Stackoverflow.com/questions/28460088", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4190610/" ]
No. You can't create user-defined conversions which don't convert either to or from the type they're declared in. The closest you could easily come would be an extension method, e.g. ``` public static bool ToBoolean(this string text) { return text == "Y"; // Or whatever } ``` You could then use: ``` bool resul...
You'll need to make the method on you own. There is no way to just cast a string to a bool. You'll end up with true if the string is not null, I believe. Just make a Boolean method that returns true if the string it's passed is y or false otherwise
28,460,088
There's any way to implement an **implicit** conversion from `string` to `bool` using C#? E.g. I have the string `str` with value *Y* and when I try convert (cast) to `boolean` it must return `true`.
2015/02/11
[ "https://Stackoverflow.com/questions/28460088", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4190610/" ]
Here is an extension method that you can use for any string. ``` public static bool ToBoolean(this string input) { var stringTrueValues = new[] { "true", "ok", "yes", "1", "y" }; return stringTrueValues.Contains(input.ToLower()); } ``` Here is an example of using this extension method: ``` Console.WriteLine...
You'll need to make the method on you own. There is no way to just cast a string to a bool. You'll end up with true if the string is not null, I believe. Just make a Boolean method that returns true if the string it's passed is y or false otherwise
58,764
Kind of a "universal donor" or "universal recipient"? Aliens that can take on the qualities of several kinds of species and recombine them to make a kind of "super" being?
2016/10/17
[ "https://worldbuilding.stackexchange.com/questions/58764", "https://worldbuilding.stackexchange.com", "https://worldbuilding.stackexchange.com/users/28601/" ]
Sorta yes. It may be possible, but not likely. One issue is that we don't know if all life would be the same handedness. There is no reason it should be, in fact it should be about 50/50. How much the handedness of compounds matter can range from not mattering at all to being very potent toxins where if you expose som...
"Is it plausible that there could be an alien species that has the capacity to mate with and share genetic material with many other alien species?" No. Biology doesn't work like that. A human-Vulcan hybrid like Mr Spock couldn't arise via normal reproductive mating, but it could happen via biotechnology assisted repro...
58,764
Kind of a "universal donor" or "universal recipient"? Aliens that can take on the qualities of several kinds of species and recombine them to make a kind of "super" being?
2016/10/17
[ "https://worldbuilding.stackexchange.com/questions/58764", "https://worldbuilding.stackexchange.com", "https://worldbuilding.stackexchange.com/users/28601/" ]
"Is it plausible that there could be an alien species that has the capacity to mate with and share genetic material with many other alien species?" No. Biology doesn't work like that. A human-Vulcan hybrid like Mr Spock couldn't arise via normal reproductive mating, but it could happen via biotechnology assisted repro...
On its own, no. --------------- * Genetic material is not compatible. DNA is not compatible with structures of not only different chemicals, as would likely be present, but also different, non-helix shapes, making the combination of genetic structures **extremely improbable if not statistically impossible**. * If the ...
58,764
Kind of a "universal donor" or "universal recipient"? Aliens that can take on the qualities of several kinds of species and recombine them to make a kind of "super" being?
2016/10/17
[ "https://worldbuilding.stackexchange.com/questions/58764", "https://worldbuilding.stackexchange.com", "https://worldbuilding.stackexchange.com/users/28601/" ]
"Is it plausible that there could be an alien species that has the capacity to mate with and share genetic material with many other alien species?" No. Biology doesn't work like that. A human-Vulcan hybrid like Mr Spock couldn't arise via normal reproductive mating, but it could happen via biotechnology assisted repro...
... I'm pretty sure there is an organism (not sure if single-celled or multi-cellular... though single-celled is more likely) which 'borrows' DNA from other organisms to add genetic variation & abilities due to being asexual reproducers. (From a quick google search i found that i might be referencing bdelloid's as they...
58,764
Kind of a "universal donor" or "universal recipient"? Aliens that can take on the qualities of several kinds of species and recombine them to make a kind of "super" being?
2016/10/17
[ "https://worldbuilding.stackexchange.com/questions/58764", "https://worldbuilding.stackexchange.com", "https://worldbuilding.stackexchange.com/users/28601/" ]
Sorta yes. It may be possible, but not likely. One issue is that we don't know if all life would be the same handedness. There is no reason it should be, in fact it should be about 50/50. How much the handedness of compounds matter can range from not mattering at all to being very potent toxins where if you expose som...
On its own, no. --------------- * Genetic material is not compatible. DNA is not compatible with structures of not only different chemicals, as would likely be present, but also different, non-helix shapes, making the combination of genetic structures **extremely improbable if not statistically impossible**. * If the ...
58,764
Kind of a "universal donor" or "universal recipient"? Aliens that can take on the qualities of several kinds of species and recombine them to make a kind of "super" being?
2016/10/17
[ "https://worldbuilding.stackexchange.com/questions/58764", "https://worldbuilding.stackexchange.com", "https://worldbuilding.stackexchange.com/users/28601/" ]
Sorta yes. It may be possible, but not likely. One issue is that we don't know if all life would be the same handedness. There is no reason it should be, in fact it should be about 50/50. How much the handedness of compounds matter can range from not mattering at all to being very potent toxins where if you expose som...
... I'm pretty sure there is an organism (not sure if single-celled or multi-cellular... though single-celled is more likely) which 'borrows' DNA from other organisms to add genetic variation & abilities due to being asexual reproducers. (From a quick google search i found that i might be referencing bdelloid's as they...
58,764
Kind of a "universal donor" or "universal recipient"? Aliens that can take on the qualities of several kinds of species and recombine them to make a kind of "super" being?
2016/10/17
[ "https://worldbuilding.stackexchange.com/questions/58764", "https://worldbuilding.stackexchange.com", "https://worldbuilding.stackexchange.com/users/28601/" ]
On its own, no. --------------- * Genetic material is not compatible. DNA is not compatible with structures of not only different chemicals, as would likely be present, but also different, non-helix shapes, making the combination of genetic structures **extremely improbable if not statistically impossible**. * If the ...
... I'm pretty sure there is an organism (not sure if single-celled or multi-cellular... though single-celled is more likely) which 'borrows' DNA from other organisms to add genetic variation & abilities due to being asexual reproducers. (From a quick google search i found that i might be referencing bdelloid's as they...
510,794
I want to use have numbering like equations for some regular text. So I am using `equation` environment. I am not writing any mathematics in it, so I'll also use `textrm`. This is my basic code - ``` \documentclass[fleqn]{article} \setlength{\mathindent}{0pt} \begin{document} \noindent Select an\\ Select apple\\ \be...
2019/10/03
[ "https://tex.stackexchange.com/questions/510794", "https://tex.stackexchange.com", "https://tex.stackexchange.com/users/174620/" ]
The mess is caused by `trim axis right` which (in this case) isn't needed/doesn't change the output if present or not. ``` % used PGFPlots v1.16 \documentclass[border=5pt]{standalone} \usepackage{pgfplotstable} \usepgfplotslibrary{fillbetween} \pgfplotsset{ compat=1.16, % (added this style to s...
[![enter image description here](https://i.stack.imgur.com/JultP.png)](https://i.stack.imgur.com/JultP.png) Instead of `fillbetween` is used simple `fill` of rectangle which borders are determined on the same way as at `fillbetween`: ``` \documentclass[margin=3mm]{standalone} \usepackage{pgfplots} \pgfplotsset{compat...
42,108,930
I am currently working on a simple WinForms/C# application which archives data in a structured and consistent manner. The intended users don't have write access to the archive folder, and are only supposed to be able to write using the application. Since users should not get additional rights, I need to supply the app...
2017/02/08
[ "https://Stackoverflow.com/questions/42108930", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7533331/" ]
The safest solution is to actually create a service, which runs under a user with the correct permissions. Your Winforms application would then just use a tight interface to the service to tell it what needs to be done. How feasible this is depends on what exactly you're trying to do. Trying to do this using just the ...
you can hash passwords like below ``` using System.Security.Cryptography; public static string EncodePasswordToBase64(string password) { byte[] bytes = Encoding.Unicode.GetBytes(password); byte[] inArray = HashAlgorithm.Create("SHA1").ComputeHash(bytes); return Convert.ToBase64String(inArray); } ```
25,538,159
I inherited maintenance of a Drupal 7 website and I have zero PHP experience and I need some help. I have just updated Drupal to 7.31 and am getting the error "Only variables should be passed by reference in..." on lines 43 and 86 of an .inc file. Here is line 43: $item = array\_shift(array\_values($data)); Here is ...
2014/08/27
[ "https://Stackoverflow.com/questions/25538159", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3984654/" ]
``` if ([serverErrorJSON isKindOfClass:NSDictionary.class]) { return serverErrorJSON[@"message"][@"form"]; } return nil; ``` Its good to use the literal syntax both syntactically and programatically. You don't have to chain them together either, you might want to use another property of the JSON, ``` if ([serve...
The best way to protect against unrecognized selector errors is to check `respondsToSelector` or `isKindOfClass` depending on your use case. Unfortunately your code can get pretty cluttered if you find yourself needing to verify that an object is a dictionary frequently, which can occur in your situation like yours wi...
25,538,159
I inherited maintenance of a Drupal 7 website and I have zero PHP experience and I need some help. I have just updated Drupal to 7.31 and am getting the error "Only variables should be passed by reference in..." on lines 43 and 86 of an .inc file. Here is line 43: $item = array\_shift(array\_values($data)); Here is ...
2014/08/27
[ "https://Stackoverflow.com/questions/25538159", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3984654/" ]
``` if ([serverErrorJSON isKindOfClass:NSDictionary.class]) { return serverErrorJSON[@"message"][@"form"]; } return nil; ``` Its good to use the literal syntax both syntactically and programatically. You don't have to chain them together either, you might want to use another property of the JSON, ``` if ([serve...
Your code: ``` NSDictionary *message = [serverErrorJSON objectForKey:@"message"]; if (message != nil) { return [message objectForKey:@"form"]; } ``` The reason you are getting "unrecognized selector" here is that `[serverErrorJSON objectForKey:@"message"]` is not returning an NSDictionary as you expect. Since yo...
25,538,159
I inherited maintenance of a Drupal 7 website and I have zero PHP experience and I need some help. I have just updated Drupal to 7.31 and am getting the error "Only variables should be passed by reference in..." on lines 43 and 86 of an .inc file. Here is line 43: $item = array\_shift(array\_values($data)); Here is ...
2014/08/27
[ "https://Stackoverflow.com/questions/25538159", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3984654/" ]
Your code: ``` NSDictionary *message = [serverErrorJSON objectForKey:@"message"]; if (message != nil) { return [message objectForKey:@"form"]; } ``` The reason you are getting "unrecognized selector" here is that `[serverErrorJSON objectForKey:@"message"]` is not returning an NSDictionary as you expect. Since yo...
The best way to protect against unrecognized selector errors is to check `respondsToSelector` or `isKindOfClass` depending on your use case. Unfortunately your code can get pretty cluttered if you find yourself needing to verify that an object is a dictionary frequently, which can occur in your situation like yours wi...
23,096,884
I want to get a numbered list of files, e.g. if I have these files: ``` a.pdf b.pdf c ``` then it should be listed as: ``` 1 a.pdf 2 b.pdf 3 c ```
2014/04/16
[ "https://Stackoverflow.com/questions/23096884", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
You can do it two ways:- 1st one :- `ls -1 | awk '{print NR,$0}'` 2nd one:- `ls -1 | cat -n` You must prefer 2nd one but choose whatever you like. :-)
You can do this without awk, trivially. `ls -1 | cat -n`. Or, with awk: ``` ls -1 | awk '{printf "%d %s\n", NR, $0;}' ```
23,096,884
I want to get a numbered list of files, e.g. if I have these files: ``` a.pdf b.pdf c ``` then it should be listed as: ``` 1 a.pdf 2 b.pdf 3 c ```
2014/04/16
[ "https://Stackoverflow.com/questions/23096884", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
If your system has command `nl`, it will be easier. ( I can confirm `nl` command is exist in cygwin, aix and solaris system, then it should be popular command in most unix system) ``` ls |nl ```
You can do this without awk, trivially. `ls -1 | cat -n`. Or, with awk: ``` ls -1 | awk '{printf "%d %s\n", NR, $0;}' ```
23,096,884
I want to get a numbered list of files, e.g. if I have these files: ``` a.pdf b.pdf c ``` then it should be listed as: ``` 1 a.pdf 2 b.pdf 3 c ```
2014/04/16
[ "https://Stackoverflow.com/questions/23096884", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
If you want to [avoid parsing the output of `ls`](http://mywiki.wooledge.org/ParsingLs) (which you do), you can do something like this: ``` $ counter=1; for f in *; do printf "%2d %s\n" $((counter++)) "$f"; done 1 a.pdf 2 b.pdf 3 c ``` I only mention this because it's the path for doing more sophisticated things,...
You can do this without awk, trivially. `ls -1 | cat -n`. Or, with awk: ``` ls -1 | awk '{printf "%d %s\n", NR, $0;}' ```
23,096,884
I want to get a numbered list of files, e.g. if I have these files: ``` a.pdf b.pdf c ``` then it should be listed as: ``` 1 a.pdf 2 b.pdf 3 c ```
2014/04/16
[ "https://Stackoverflow.com/questions/23096884", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
You can do it two ways:- 1st one :- `ls -1 | awk '{print NR,$0}'` 2nd one:- `ls -1 | cat -n` You must prefer 2nd one but choose whatever you like. :-)
Not sure why you need to use `awk` but here you go: ``` ls | awk '{print NR, $0}' ``` **updated** `$0` is better than `$1` since it will print the entire file name even with spaces (as hinted at by BroSlow) Note - you do **not** need to use the `-1` flag with `ls` when the output is another process - it becomes the...
23,096,884
I want to get a numbered list of files, e.g. if I have these files: ``` a.pdf b.pdf c ``` then it should be listed as: ``` 1 a.pdf 2 b.pdf 3 c ```
2014/04/16
[ "https://Stackoverflow.com/questions/23096884", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
You can do it two ways:- 1st one :- `ls -1 | awk '{print NR,$0}'` 2nd one:- `ls -1 | cat -n` You must prefer 2nd one but choose whatever you like. :-)
If your system has command `nl`, it will be easier. ( I can confirm `nl` command is exist in cygwin, aix and solaris system, then it should be popular command in most unix system) ``` ls |nl ```
23,096,884
I want to get a numbered list of files, e.g. if I have these files: ``` a.pdf b.pdf c ``` then it should be listed as: ``` 1 a.pdf 2 b.pdf 3 c ```
2014/04/16
[ "https://Stackoverflow.com/questions/23096884", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
You can do it two ways:- 1st one :- `ls -1 | awk '{print NR,$0}'` 2nd one:- `ls -1 | cat -n` You must prefer 2nd one but choose whatever you like. :-)
If you want to [avoid parsing the output of `ls`](http://mywiki.wooledge.org/ParsingLs) (which you do), you can do something like this: ``` $ counter=1; for f in *; do printf "%2d %s\n" $((counter++)) "$f"; done 1 a.pdf 2 b.pdf 3 c ``` I only mention this because it's the path for doing more sophisticated things,...
23,096,884
I want to get a numbered list of files, e.g. if I have these files: ``` a.pdf b.pdf c ``` then it should be listed as: ``` 1 a.pdf 2 b.pdf 3 c ```
2014/04/16
[ "https://Stackoverflow.com/questions/23096884", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
If your system has command `nl`, it will be easier. ( I can confirm `nl` command is exist in cygwin, aix and solaris system, then it should be popular command in most unix system) ``` ls |nl ```
Not sure why you need to use `awk` but here you go: ``` ls | awk '{print NR, $0}' ``` **updated** `$0` is better than `$1` since it will print the entire file name even with spaces (as hinted at by BroSlow) Note - you do **not** need to use the `-1` flag with `ls` when the output is another process - it becomes the...
23,096,884
I want to get a numbered list of files, e.g. if I have these files: ``` a.pdf b.pdf c ``` then it should be listed as: ``` 1 a.pdf 2 b.pdf 3 c ```
2014/04/16
[ "https://Stackoverflow.com/questions/23096884", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
If you want to [avoid parsing the output of `ls`](http://mywiki.wooledge.org/ParsingLs) (which you do), you can do something like this: ``` $ counter=1; for f in *; do printf "%2d %s\n" $((counter++)) "$f"; done 1 a.pdf 2 b.pdf 3 c ``` I only mention this because it's the path for doing more sophisticated things,...
Not sure why you need to use `awk` but here you go: ``` ls | awk '{print NR, $0}' ``` **updated** `$0` is better than `$1` since it will print the entire file name even with spaces (as hinted at by BroSlow) Note - you do **not** need to use the `-1` flag with `ls` when the output is another process - it becomes the...
23,096,884
I want to get a numbered list of files, e.g. if I have these files: ``` a.pdf b.pdf c ``` then it should be listed as: ``` 1 a.pdf 2 b.pdf 3 c ```
2014/04/16
[ "https://Stackoverflow.com/questions/23096884", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
If you want to [avoid parsing the output of `ls`](http://mywiki.wooledge.org/ParsingLs) (which you do), you can do something like this: ``` $ counter=1; for f in *; do printf "%2d %s\n" $((counter++)) "$f"; done 1 a.pdf 2 b.pdf 3 c ``` I only mention this because it's the path for doing more sophisticated things,...
If your system has command `nl`, it will be easier. ( I can confirm `nl` command is exist in cygwin, aix and solaris system, then it should be popular command in most unix system) ``` ls |nl ```
42,039,868
**Is there any kid of "repl + extra features" (like showing docs, module autoreload etc.), like iPython, but for Nodejs?** And I mean something *that runs locally & offline.* This is a must. And preferably to work both in terminal mode and have an optional nicer GUI on top (like iPython + iPythonQT/Jupyter-qtconsole)....
2017/02/04
[ "https://Stackoverflow.com/questions/42039868", "https://Stackoverflow.com", "https://Stackoverflow.com/users/507537/" ]
Use [ijavascript](https://github.com/n-riesco/ijavascript). This is compatible with Jupyter notebook and you can use it just like on Python environment. The below is a screenshot taken from the official repository. [![enter image description here](https://i.stack.imgur.com/ZakIU.png)](https://i.stack.imgur.com/ZakI...
I wrote [node-help](https://github.com/foundling/node-help "node-help") for exactly this reason, maybe it would work for you? It pulls from the Node.js JSON API and works offline. Major versions 8,9 and 10 are supported. There is no gui functionality for it, though, but I did take some care to make it easy on the eye...
42,039,868
**Is there any kid of "repl + extra features" (like showing docs, module autoreload etc.), like iPython, but for Nodejs?** And I mean something *that runs locally & offline.* This is a must. And preferably to work both in terminal mode and have an optional nicer GUI on top (like iPython + iPythonQT/Jupyter-qtconsole)....
2017/02/04
[ "https://Stackoverflow.com/questions/42039868", "https://Stackoverflow.com", "https://Stackoverflow.com/users/507537/" ]
Use [ijavascript](https://github.com/n-riesco/ijavascript). This is compatible with Jupyter notebook and you can use it just like on Python environment. The below is a screenshot taken from the official repository. [![enter image description here](https://i.stack.imgur.com/ZakIU.png)](https://i.stack.imgur.com/ZakI...
I've been looking for "ipython for node" for years and here's how I would answer your question: No.
42,039,868
**Is there any kid of "repl + extra features" (like showing docs, module autoreload etc.), like iPython, but for Nodejs?** And I mean something *that runs locally & offline.* This is a must. And preferably to work both in terminal mode and have an optional nicer GUI on top (like iPython + iPythonQT/Jupyter-qtconsole)....
2017/02/04
[ "https://Stackoverflow.com/questions/42039868", "https://Stackoverflow.com", "https://Stackoverflow.com/users/507537/" ]
Use [ijavascript](https://github.com/n-riesco/ijavascript). This is compatible with Jupyter notebook and you can use it just like on Python environment. The below is a screenshot taken from the official repository. [![enter image description here](https://i.stack.imgur.com/ZakIU.png)](https://i.stack.imgur.com/ZakI...
Give Data-Forge Notebook a try. (I'm not affiliated in any way.) <https://www.data-forge-notebook.com/>
42,039,868
**Is there any kid of "repl + extra features" (like showing docs, module autoreload etc.), like iPython, but for Nodejs?** And I mean something *that runs locally & offline.* This is a must. And preferably to work both in terminal mode and have an optional nicer GUI on top (like iPython + iPythonQT/Jupyter-qtconsole)....
2017/02/04
[ "https://Stackoverflow.com/questions/42039868", "https://Stackoverflow.com", "https://Stackoverflow.com/users/507537/" ]
I've been looking for "ipython for node" for years and here's how I would answer your question: No.
I wrote [node-help](https://github.com/foundling/node-help "node-help") for exactly this reason, maybe it would work for you? It pulls from the Node.js JSON API and works offline. Major versions 8,9 and 10 are supported. There is no gui functionality for it, though, but I did take some care to make it easy on the eye...
42,039,868
**Is there any kid of "repl + extra features" (like showing docs, module autoreload etc.), like iPython, but for Nodejs?** And I mean something *that runs locally & offline.* This is a must. And preferably to work both in terminal mode and have an optional nicer GUI on top (like iPython + iPythonQT/Jupyter-qtconsole)....
2017/02/04
[ "https://Stackoverflow.com/questions/42039868", "https://Stackoverflow.com", "https://Stackoverflow.com/users/507537/" ]
I wrote [node-help](https://github.com/foundling/node-help "node-help") for exactly this reason, maybe it would work for you? It pulls from the Node.js JSON API and works offline. Major versions 8,9 and 10 are supported. There is no gui functionality for it, though, but I did take some care to make it easy on the eye...
Give Data-Forge Notebook a try. (I'm not affiliated in any way.) <https://www.data-forge-notebook.com/>
42,039,868
**Is there any kid of "repl + extra features" (like showing docs, module autoreload etc.), like iPython, but for Nodejs?** And I mean something *that runs locally & offline.* This is a must. And preferably to work both in terminal mode and have an optional nicer GUI on top (like iPython + iPythonQT/Jupyter-qtconsole)....
2017/02/04
[ "https://Stackoverflow.com/questions/42039868", "https://Stackoverflow.com", "https://Stackoverflow.com/users/507537/" ]
I've been looking for "ipython for node" for years and here's how I would answer your question: No.
Give Data-Forge Notebook a try. (I'm not affiliated in any way.) <https://www.data-forge-notebook.com/>
721,630
as all know after kernel upgrade (on `RHEL 7`), reboot is necessary in order to update the kernel version So after reboot we can verify the kernel version by `uname -r` since we are using scripts for kernel upgrade, we want to verify what is the right approach that machines are required reboot as results of kernel u...
2022/10/19
[ "https://unix.stackexchange.com/questions/721630", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/237298/" ]
> > as all know after kernel upgrade (on RHEL 7), reboot is necessary in order to update the kernel version > > > no, it's already upgraded; but to run a new kernel, you'll need to load the new kernel if you want to use it. Since Linux is not *that* cool, the only way to do that is effectively a reboot¹. `yum` co...
/usr/bin/needs-restarting (in yum-utils) can do this for you. (e.g., `needs-restarting -r || shutdown +5 "Rebooting post patching"` ) ``` Usage: needs-restarting: Report a list of process ids of programs that started running before they or some component they use were updated. Options:...
26,878,777
I am following a tutorial on Twitter sentiment analysis. I have downloaded the codes here <http://www.sananalytics.com/lab/twitter-sentiment/>. I follow the steps to run the install.py from cmd prompt, while it does create the json files in the 'rawdata' folder, when I view these json files, it says: ``` { "errors...
2014/11/12
[ "https://Stackoverflow.com/questions/26878777", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3635544/" ]
For any other wary travelers ... I noticed that KubiK888 didn't link where he found the updated code. A) Here is a complete upload of the CSV i found on github - <https://raw.githubusercontent.com/zfz/twitter_corpus/master/full-corpus.csv> Seems to have the entire 6000+ tweets, after "irrelevant" tweets are removed ...
Apparently, the code I posted, which is still on their website, is outdated. And I found the newer version from Github as below: ``` # This code is supporting material for the book # Building Machine Learning Systems with Python # by Willi Richert and Luis Pedro Coelho # published by PACKT Publishing # # It is made av...
44,118
I have upgraded my ubuntu from 10.11 to 11.04. The problem is, there is a horizontal mouse dead zone, I can not click in that area. My laptop is Acer Aspire 5920G But, when my friend installing ubuntu 11.04 in Vaio laptop, he gets the same problem with me, there is a mouse dead zone in the same area. Anyone can help...
2011/05/20
[ "https://askubuntu.com/questions/44118", "https://askubuntu.com", "https://askubuntu.com/users/2997/" ]
This is a [known bug](https://bugs.launchpad.net/ubuntu/+source/compiz/+bug/709461) in Compiz, unfortunately it's not fixed yet but when it is it will be rolled out in an update.
just to inform I have the same problem, a little (~20cm x 1cm horizontal) rectangle on the screen is affected is not always there appear after a while I don't know why 1. I don't use unity 2. I on ubuntu 11.04 3. I have compiz working with emerald 0.9.4 4. using gimp I clicked the screen until I surrounded the area th...
3,068,929
This batch file releases a build from TEST to LIVE. I want to add a check constraint in this file that ensures there is an accomanying release document in a specific folder. ``` "C:\Program Files\Windows Resource Kits\Tools\robocopy.exe" "\\testserver\testapp$" "\\liveserver\liveapp$" *.* /E /XA:H /PURGE /XO /...
2010/06/18
[ "https://Stackoverflow.com/questions/3068929", "https://Stackoverflow.com", "https://Stackoverflow.com/users/190578/" ]
Read file contents into a variable: ``` for /f "delims=" %%x in (version.txt) do set Build=%%x ``` or ``` set /p Build=<version.txt ``` Both will act the same with only a single line in the file, for more lines the `for` variant will put the *last* line into the variable, while `set /p` will use the *first.* Usi...
To get all the lines of the file loaded into the variable, Delayed Expansion is needed, so do the following: ``` SETLOCAL EnableDelayedExpansion for /f "Tokens=* Delims=" %%x in (version.txt) do set Build=!Build!%%x ``` There is a problem with some special characters, though especially `;`, `%` and `!`
3,068,929
This batch file releases a build from TEST to LIVE. I want to add a check constraint in this file that ensures there is an accomanying release document in a specific folder. ``` "C:\Program Files\Windows Resource Kits\Tools\robocopy.exe" "\\testserver\testapp$" "\\liveserver\liveapp$" *.* /E /XA:H /PURGE /XO /...
2010/06/18
[ "https://Stackoverflow.com/questions/3068929", "https://Stackoverflow.com", "https://Stackoverflow.com/users/190578/" ]
Read file contents into a variable: ``` for /f "delims=" %%x in (version.txt) do set Build=%%x ``` or ``` set /p Build=<version.txt ``` Both will act the same with only a single line in the file, for more lines the `for` variant will put the *last* line into the variable, while `set /p` will use the *first.* Usi...
just do: ``` type version.txt ``` and it will be displayed as if you typed: ``` set /p Build=<version.txt echo %Build% ```
3,068,929
This batch file releases a build from TEST to LIVE. I want to add a check constraint in this file that ensures there is an accomanying release document in a specific folder. ``` "C:\Program Files\Windows Resource Kits\Tools\robocopy.exe" "\\testserver\testapp$" "\\liveserver\liveapp$" *.* /E /XA:H /PURGE /XO /...
2010/06/18
[ "https://Stackoverflow.com/questions/3068929", "https://Stackoverflow.com", "https://Stackoverflow.com/users/190578/" ]
Read file contents into a variable: ``` for /f "delims=" %%x in (version.txt) do set Build=%%x ``` or ``` set /p Build=<version.txt ``` Both will act the same with only a single line in the file, for more lines the `for` variant will put the *last* line into the variable, while `set /p` will use the *first.* Usi...
You can read multiple variables from file like this: ``` for /f "delims== tokens=1,2" %%G in (param.txt) do set %%G=%%H ``` where param.txt: ``` PARAM1=value1 PARAM2=value2 ... ```
3,068,929
This batch file releases a build from TEST to LIVE. I want to add a check constraint in this file that ensures there is an accomanying release document in a specific folder. ``` "C:\Program Files\Windows Resource Kits\Tools\robocopy.exe" "\\testserver\testapp$" "\\liveserver\liveapp$" *.* /E /XA:H /PURGE /XO /...
2010/06/18
[ "https://Stackoverflow.com/questions/3068929", "https://Stackoverflow.com", "https://Stackoverflow.com/users/190578/" ]
You can read multiple variables from file like this: ``` for /f "delims== tokens=1,2" %%G in (param.txt) do set %%G=%%H ``` where param.txt: ``` PARAM1=value1 PARAM2=value2 ... ```
To get all the lines of the file loaded into the variable, Delayed Expansion is needed, so do the following: ``` SETLOCAL EnableDelayedExpansion for /f "Tokens=* Delims=" %%x in (version.txt) do set Build=!Build!%%x ``` There is a problem with some special characters, though especially `;`, `%` and `!`
3,068,929
This batch file releases a build from TEST to LIVE. I want to add a check constraint in this file that ensures there is an accomanying release document in a specific folder. ``` "C:\Program Files\Windows Resource Kits\Tools\robocopy.exe" "\\testserver\testapp$" "\\liveserver\liveapp$" *.* /E /XA:H /PURGE /XO /...
2010/06/18
[ "https://Stackoverflow.com/questions/3068929", "https://Stackoverflow.com", "https://Stackoverflow.com/users/190578/" ]
You can read multiple variables from file like this: ``` for /f "delims== tokens=1,2" %%G in (param.txt) do set %%G=%%H ``` where param.txt: ``` PARAM1=value1 PARAM2=value2 ... ```
just do: ``` type version.txt ``` and it will be displayed as if you typed: ``` set /p Build=<version.txt echo %Build% ```
52,428,077
Hi guys please consider the code below. I was using it to add new values to my table(`booking`) in mysql database(`seat_booking`). Variables include `String(id,cname,ctype,event_name)` and `int(seatsno)`.I also call a function `EventName()` in this code and, trust me guys it works perfectly and I am able to derive the...
2018/09/20
[ "https://Stackoverflow.com/questions/52428077", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10392038/" ]
You could use `:after` pseudo element to create one square and then use `rotate` and `translate` transforms. ```css .element { display: inline-block; background: lightgreen; position: relative; width: 200px; height: 200px; overflow: hidden; } .two { margin-left: 30px; width: 300px; height:...
You can easily do this with gradient: ```css .box { width:200px; height:200px; background: linear-gradient(red,red) right/30% 100%, linear-gradient(to top left,red 49.8%,transparent 50%) top left/70% 50%, linear-gradient(to bottom left,red 49.8%,transparent 50%) bottom left/70% 50%, url(ht...
8,080,674
We have an internal MySQL database that our customer service department uses to do quotes, and an external MySQL database on our website that our customers use to do quotes. I have a PHP report that I've written that gives me the information from the internal database. Now I'd like to modify the report to include the d...
2011/11/10
[ "https://Stackoverflow.com/questions/8080674", "https://Stackoverflow.com", "https://Stackoverflow.com/users/843411/" ]
I actually use a MySQL GUI client called "Sequel Pro", which does offer the option to connect to MySQL through a SSH connection. This is totally doable, though if you have the option to connect to the DB without it (e.g. you can connect to it from "outside" the host), you should prefer this. the easiest way I conceive...
Yes you can query mysql from bash over SSH but this is not the best and scalable way to go. The best solution would be to create a REST Web Service on the production servers. Then your internal system will query that remote service with authentication.
8,080,674
We have an internal MySQL database that our customer service department uses to do quotes, and an external MySQL database on our website that our customers use to do quotes. I have a PHP report that I've written that gives me the information from the internal database. Now I'd like to modify the report to include the d...
2011/11/10
[ "https://Stackoverflow.com/questions/8080674", "https://Stackoverflow.com", "https://Stackoverflow.com/users/843411/" ]
I actually use a MySQL GUI client called "Sequel Pro", which does offer the option to connect to MySQL through a SSH connection. This is totally doable, though if you have the option to connect to the DB without it (e.g. you can connect to it from "outside" the host), you should prefer this. the easiest way I conceive...
You set up a tunnel from some available port on the local server to the mysql port on the remote server: ``` ssh -L 3307:localhost:3306 someuser@remoteserver ``` That creates a tunnel listening on port 3307 on the local system, which connects to port 3306 (MySQL) on the remoteserver. Then point your PHP code to con...
8,833,053
Is there ability to get in some way Balance on CreditCard ? API of Authorize.net or Paypal were examined on this subject and no results. In real life any cash terminal can show to you balance on your credit card. That is why I assume there is some way to get this balance in web through some payment gateway. Thanks in...
2012/01/12
[ "https://Stackoverflow.com/questions/8833053", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1145173/" ]
I've dealt with many credit card processing APIs and unless it is an API for a gateway solution, they generally do not have methods to do much in the way of querying for information. You might see some capability (again, in a gateway API but not in a lower-level processor's API) to load details of the original transact...
The only thing that I can think of is to use the AuthOnly method and try running (and voiding) multiple transactions, incrementing the PaymentAmount values until it fails.
8,833,053
Is there ability to get in some way Balance on CreditCard ? API of Authorize.net or Paypal were examined on this subject and no results. In real life any cash terminal can show to you balance on your credit card. That is why I assume there is some way to get this balance in web through some payment gateway. Thanks in...
2012/01/12
[ "https://Stackoverflow.com/questions/8833053", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1145173/" ]
I've dealt with many credit card processing APIs and unless it is an API for a gateway solution, they generally do not have methods to do much in the way of querying for information. You might see some capability (again, in a gateway API but not in a lower-level processor's API) to load details of the original transact...
> > > > > > Is there ability to get in some way Balance on CreditCard ? > > > > > > > > > No. > > > > > > API of Authorize.net or Paypal were examined on this subject and no results. > > > > > > > > > That's because you can't get someone else's balance. It's private information. > > > > > > I...
8,833,053
Is there ability to get in some way Balance on CreditCard ? API of Authorize.net or Paypal were examined on this subject and no results. In real life any cash terminal can show to you balance on your credit card. That is why I assume there is some way to get this balance in web through some payment gateway. Thanks in...
2012/01/12
[ "https://Stackoverflow.com/questions/8833053", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1145173/" ]
The only thing that I can think of is to use the AuthOnly method and try running (and voiding) multiple transactions, incrementing the PaymentAmount values until it fails.
> > > > > > Is there ability to get in some way Balance on CreditCard ? > > > > > > > > > No. > > > > > > API of Authorize.net or Paypal were examined on this subject and no results. > > > > > > > > > That's because you can't get someone else's balance. It's private information. > > > > > > I...
24,760,877
I have a site that is actually a multisite using subdomains and I would like to remap the subfolder translations to a sub domain. ``` domain.com (main site) blog.domain.com (mu site for the blog) ``` With WPML, I have: ``` domain.com/fr/ (for the French translation) blog.domain.com/fr/ (for the French translation)...
2014/07/15
[ "https://Stackoverflow.com/questions/24760877", "https://Stackoverflow.com", "https://Stackoverflow.com/users/528096/" ]
Keep your .htaccess like this: ``` RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ^domain\.com$ [NC] RewriteRule ^fr/(.*)$ http://fr.domain.com/$1 [NC,R=302,L] RewriteCond %{HTTP_HOST} ^blog\.domain\.com$ [NC] RewriteRule ^fr/(.*)$ http://blogue.domain.com/$1 [NC,R=302,L] RewriteRule ^index\.php$ - [L] Re...
You can add to .htaccess: ``` RewriteCond %{HTTP_HOST} ^domain\.com RewriteRule ^/fr/ http://fr.domain.com/fr/ [R,L] RewriteCond %{HTTP_HOST} ^blog\.domain\.com RewriteRule ^/fr/ http://blogue.domain.com/fr/ [R,L] ```
18,017,456
I have an array, and the contents of it are objects of type `id`, but I need to turn them into type `in`t. Is there any way I can make the array read the data as `int`s, or turn the `id` into an `int`? ``` NSArray *array = [string componentsSeparatedByString:@"\n"]; int foo = array[0]; /*Warning: Incompatib...
2013/08/02
[ "https://Stackoverflow.com/questions/18017456", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2564682/" ]
`componentsSeparatedByString:` docs says: > > **Return value** > > > An `NSArray` object containing substrings from the receiver that have been divided by separator. > > > So your `fileContents` contains an array of `NSStrings`. `fileContents[0]` is then the first `NSString` instance in the array. And you can c...
You should use `intValue` to convert to `int`. ``` int object1 = [fileContents[0] intValue]; ```
18,775,467
I'm coming to C++ from C# and const-correctness is still new to me. In C# I could declare a property like this: ``` class Type { public readonly int x; public Type(int y) { x = y; } } ``` This would ensure that x was only set during initialization. I would like to do something similar in C+...
2013/09/12
[ "https://Stackoverflow.com/questions/18775467", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4593/" ]
There is a `const` modifier: ``` class Type { private: const int _x; int j; public: Type(int y):_x(y) { j = 5; } int get_x() { return _x; } // disable changing the object through assignment Type& operator=(const Type&) = delete; }; ``` Note that you need to initialize constant in the construct...
Rather than a collection of constants, you could have a constant collection. The property of being constant seems to pertain to your use case, not the data model itself. Like so: ``` struct extent { int width; int height; }; const extent e { 20, 30 }; ``` It's possible to have specifically constant data members of ...
18,775,467
I'm coming to C++ from C# and const-correctness is still new to me. In C# I could declare a property like this: ``` class Type { public readonly int x; public Type(int y) { x = y; } } ``` This would ensure that x was only set during initialization. I would like to do something similar in C+...
2013/09/12
[ "https://Stackoverflow.com/questions/18775467", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4593/" ]
There is a `const` modifier: ``` class Type { private: const int _x; int j; public: Type(int y):_x(y) { j = 5; } int get_x() { return _x; } // disable changing the object through assignment Type& operator=(const Type&) = delete; }; ``` Note that you need to initialize constant in the construct...
You can initialize class const members with constructor. If you need add some other logic in constructor, but in .cpp file not in .h, you can create a private method and call it in constructor. **File.h** ``` class Example { private: const int constantMember1; const int constantMember2; ...
18,775,467
I'm coming to C++ from C# and const-correctness is still new to me. In C# I could declare a property like this: ``` class Type { public readonly int x; public Type(int y) { x = y; } } ``` This would ensure that x was only set during initialization. I would like to do something similar in C+...
2013/09/12
[ "https://Stackoverflow.com/questions/18775467", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4593/" ]
There is a `const` modifier: ``` class Type { private: const int _x; int j; public: Type(int y):_x(y) { j = 5; } int get_x() { return _x; } // disable changing the object through assignment Type& operator=(const Type&) = delete; }; ``` Note that you need to initialize constant in the construct...
This is not exactly answering the question asked, but if you wanted to have the simplicity of directly accessing member variables in a struct without getters, but wanted to ensure that nobody could modify the values, you could do something like this: ``` #include <iostream> using namespace std; class TypeFriend; st...
18,775,467
I'm coming to C++ from C# and const-correctness is still new to me. In C# I could declare a property like this: ``` class Type { public readonly int x; public Type(int y) { x = y; } } ``` This would ensure that x was only set during initialization. I would like to do something similar in C+...
2013/09/12
[ "https://Stackoverflow.com/questions/18775467", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4593/" ]
Rather than a collection of constants, you could have a constant collection. The property of being constant seems to pertain to your use case, not the data model itself. Like so: ``` struct extent { int width; int height; }; const extent e { 20, 30 }; ``` It's possible to have specifically constant data members of ...
You can initialize class const members with constructor. If you need add some other logic in constructor, but in .cpp file not in .h, you can create a private method and call it in constructor. **File.h** ``` class Example { private: const int constantMember1; const int constantMember2; ...
18,775,467
I'm coming to C++ from C# and const-correctness is still new to me. In C# I could declare a property like this: ``` class Type { public readonly int x; public Type(int y) { x = y; } } ``` This would ensure that x was only set during initialization. I would like to do something similar in C+...
2013/09/12
[ "https://Stackoverflow.com/questions/18775467", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4593/" ]
Rather than a collection of constants, you could have a constant collection. The property of being constant seems to pertain to your use case, not the data model itself. Like so: ``` struct extent { int width; int height; }; const extent e { 20, 30 }; ``` It's possible to have specifically constant data members of ...
This is not exactly answering the question asked, but if you wanted to have the simplicity of directly accessing member variables in a struct without getters, but wanted to ensure that nobody could modify the values, you could do something like this: ``` #include <iostream> using namespace std; class TypeFriend; st...