qid
int64
1
74.7M
question
stringlengths
15
58.3k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
4
30.2k
response_k
stringlengths
11
36.5k
5,032,552
I have an ASP.NET MVC 3 application, [WouldBeBetter.com](http://www.wouldbebetter.com), currently hosted on Windows Azure. I have an Introductory Special subscription package that was free for several months but was surprised at how expensive it has turned out to be (€150 p/m on average!) now that I have started paying...
2011/02/17
[ "https://Stackoverflow.com/questions/5032552", "https://Stackoverflow.com", "https://Stackoverflow.com/users/93356/" ]
I use DiscountASP myself. It's pretty basic hosting for sure, a little behind the times. But I have found just creating a subdirectory and publishing my beta/test/whatever versions there works pretty well. It's not fancy or pretty, but does get the job done. In order to do this you need to create the subdirectory fir...
Before abandoning Windows Azure, there are several cost-saving things you can do to lower your monthly bill. For instance: * If you have both a Web role and a Worker role, merge the two. Take your background processing, queue processing, etc. and run them in your Web role (do your time-consuming startup in OnStart(), ...
5,032,552
I have an ASP.NET MVC 3 application, [WouldBeBetter.com](http://www.wouldbebetter.com), currently hosted on Windows Azure. I have an Introductory Special subscription package that was free for several months but was surprised at how expensive it has turned out to be (€150 p/m on average!) now that I have started paying...
2011/02/17
[ "https://Stackoverflow.com/questions/5032552", "https://Stackoverflow.com", "https://Stackoverflow.com/users/93356/" ]
Before abandoning Windows Azure, there are several cost-saving things you can do to lower your monthly bill. For instance: * If you have both a Web role and a Worker role, merge the two. Take your background processing, queue processing, etc. and run them in your Web role (do your time-consuming startup in OnStart(), ...
1) Get an automated deployment tool. There are plenty of free/open-source ones that million/billion dollar companies actually use for their production environments. 2) Get a second hosting package identical to the first. Use it as your staging, then just redeploy to production when staging passes.
57,985,161
I am using HTML, CSS, mediaQuery, Javascript, jQuery and PrimeFaces, and I want to use the css property ``` calc(100% - 100px) ``` I've implement a javascript work around for old browsers, which do not support this property. After reading several related questions, such as: * [css width: calc(100% -100px); alterna...
2019/09/18
[ "https://Stackoverflow.com/questions/57985161", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1925356/" ]
As we can see [here](https://github.com/Microsoft/msbuild/blob/dd5e8bc3f86ac98bd77d8971b00a6ad14f122f1a/src/XMakeTasks/Microsoft.Common.CurrentVersion.targets#L2027) we need both `AutoGenerateBindingRedirects` and `GenerateBindingRedirectsOutputType` flags to make some things for "autogenerating binding redirects" work...
It is not needed for projects that generate .exe executables but needed for unit test projects.
29,177,000
Currently, I have a few utility functions defined in the top level build.gradle in a multi-project setup, for example like this: ``` def utilityMethod() { doSomethingWith(project) // project is magically defined } ``` I would like to move this code into a plugin, which will make the utilityMethod available withi...
2015/03/20
[ "https://Stackoverflow.com/questions/29177000", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2092842/" ]
This seems to work using: ``` import org.gradle.api.Plugin import org.gradle.api.Project class FooPlugin implements Plugin<Project> { void apply(Project target) { target.extensions.create("foo", FooExtension) target.task('sometask', type: GreetingTask) } } class FooExtension{ def sayHello(...
Plugins are not meant to provide common methods but *tasks*. When it comes to extensions they should be used to gather input for the applied plugins: > > Most plugins need to obtain some configuration from the build script. > One method for doing this is to use extension objects. > > > More details [here](http...
29,177,000
Currently, I have a few utility functions defined in the top level build.gradle in a multi-project setup, for example like this: ``` def utilityMethod() { doSomethingWith(project) // project is magically defined } ``` I would like to move this code into a plugin, which will make the utilityMethod available withi...
2015/03/20
[ "https://Stackoverflow.com/questions/29177000", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2092842/" ]
I implemented this recently, a full example is available at [Github](https://github.com/eaaltonen/gradle_plugin_function_export). The injection basically boils down to ``` target.ext.utilityMethod = SomeClass.&utilityMethod ``` **Beware:** This method could potentially conflict with some other plugin, so you sho...
Plugins are not meant to provide common methods but *tasks*. When it comes to extensions they should be used to gather input for the applied plugins: > > Most plugins need to obtain some configuration from the build script. > One method for doing this is to use extension objects. > > > More details [here](http...
27,827,758
I have 3 divs (all of which have dynamic content) inside of a parent container. I need them all to fill the height of the parent container, so that they are all equal sizes. I have created a **[jsfiddle](http://jsfiddle.net/gcam9gcj/)** to outline my problem in a simple way. ```css .parent { overflow: hidden; p...
2015/01/07
[ "https://Stackoverflow.com/questions/27827758", "https://Stackoverflow.com", "https://Stackoverflow.com/users/680429/" ]
You can do it using the display table and table-cell properties, and ditching the floats: ```css .parent { display: table; width:100%; position: relative; border: 1px solid #000; } .left { width: 33%; } .right { width: 33%; } .center { width: 34%; } .one { background-col...
You could use `display: table` for the parent. It's nothing wrong about using a table layout here, since it's a table, right? ``` .parent { display: table; width: 100%; height: 100%; overflow: hidden; position: relative; border: 1px solid #000; } ``` See the working fiddle: <http://jsfiddle.n...
30,779,515
I have the tree classes AbstractComponent, Leaf and Composite: ``` public abstract class AbstractComponent { privavte String name; [...] } public class Leaf extends AbstractComponent { [...] } public Composite extends AbstractComponent { private List<AbstractComponent> children; public void add...
2015/06/11
[ "https://Stackoverflow.com/questions/30779515", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2952545/" ]
``` let rootControllerIdentifier = "FirstInputInterfaceController" WKInterfaceController.reloadRootControllers(withNames: [rootControllerIdentifier], contexts: nil) ``` --- ### Swift 4: ``` let rootControllerIdentifier = "FirstInputInterfaceController" WKInterfaceController.reloadRootControllers(withNamesAndContex...
After long research work I found only one solution - create some SplashController, with some splash screen, and in ``` override func awakeWithContext(context: AnyObject?) { super.awakeWithContext(context) } ``` track something that you need, after track present some controllers, example ``` if !isCounting ...
59,486,382
Im trying to check if an hour is below 10 so i can add a 0 behind it to make it the right hour format. All my efforts till now haven't worked out. Thank you for you time
2019/12/26
[ "https://Stackoverflow.com/questions/59486382", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12437460/" ]
You can use [padLeft()](https://api.dartlang.org/stable/2.7.0/dart-core/String/padLeft.html) method on strings. It takes `width` and `padding` parameters. You can use it like this: ``` print("5".padLeft(2,"0")); // Prints 05 print("14".padLeft(2,"0")); // Prints 14 ```
you can try this; ``` var now = new DateTime.now(); String newHour = now.hour.toString(); if (newHour.length > 2) { newHour = "0"+ newHour; } ```
48,590,074
I am trying to find out the average length of words that begin with each of other alphabets except z. So far, I have ``` // words only val words1 = words.map(_.toLowerCase).filter(x => x.length>0).filter(x => x(0).isLetter) val allWords = words1.filter(x=> !x.startsWith("z"))// avoiding the z var mapAllWords= allWor...
2018/02/02
[ "https://Stackoverflow.com/questions/48590074", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8772398/" ]
Let's say this is your data: ``` val words = sc.textFile("README.md").flatMap(_.split("\\s+")) ``` Convert to dataset: ``` val ds = spark.createDataset(words) ``` Filter and aggregate ``` ds // Get first letter and length .select( lower(substring($"value", 0, 1)) as "letter", length($"value") as "length"...
in scala (no spark) some hints for you: ``` val l=List("mario","monica", "renzo","sabrina","sonia","nikola", "enrica","paola") val couples = l.map(w => (w.charAt(0), w.length)) couples.groupBy(_._1) .map(x=> ( x._1, (x._2, x._2.size))) ``` you get: ``` l: List[String] = List(mario, monica, renzo, sabrina, ...
48,590,074
I am trying to find out the average length of words that begin with each of other alphabets except z. So far, I have ``` // words only val words1 = words.map(_.toLowerCase).filter(x => x.length>0).filter(x => x(0).isLetter) val allWords = words1.filter(x=> !x.startsWith("z"))// avoiding the z var mapAllWords= allWor...
2018/02/02
[ "https://Stackoverflow.com/questions/48590074", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8772398/" ]
Let's say this is your data: ``` val words = sc.textFile("README.md").flatMap(_.split("\\s+")) ``` Convert to dataset: ``` val ds = spark.createDataset(words) ``` Filter and aggregate ``` ds // Get first letter and length .select( lower(substring($"value", 0, 1)) as "letter", length($"value") as "length"...
Here's a Scala example of getting the average size of all words starting with the same letter that I think you could adapt easily enough to your use case. ``` val sentences = Array("Lester is nice", "Lester is cool", "cool Lester is an awesome dude", "awesome awesome awesome Les") val sentRDD = sc.parallelize(sentence...
44,876,449
If you see the example below, when you hover on the points, the tooltip will be to the left of the point, except when you hover on the month of 'June', where there is only a single value. Im trying to get the tooltip to show in the same position when i hover on a point with multiple values on a single point, and also ...
2017/07/03
[ "https://Stackoverflow.com/questions/44876449", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2805611/" ]
As I have mentioned in my comment, you should be able to use tooltip.positioner for positioning your tooltip near your points: <http://api.highcharts.com/highcharts/tooltip.positioner> ``` tooltip: { shared: true, crosshairs: true, positioner: function(labelWidth, labelHeight, point) { var x; ...
That's because you put a `null` value in the month of June of the second data array, if you put the correct value, the month will match correctly ```js Highcharts.chart('container', { xAxis: { categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', '...
70,777,096
I'm interested in creating a query of a raw json blob without having to use a subquery in PostgreSQL. The query looks like this: ```sql SELECT id, ((db_bench_results.result::json -> 'Runner'::text)) as runner FROM public.db_bench_results as full_results WHERE ((db_bench_results.result::json -> 'Runner'::t...
2022/01/19
[ "https://Stackoverflow.com/questions/70777096", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4322/" ]
String constants have to be enclosed in single quotes in SQL. The double quotes are for identifiers. As you want to compare a value as `text`, use the `->>` operator to make the returned value a `text` not a `jsonb` (or `json`) value. So the following should work: ``` SELECT id, db_bench_results.result ->> '...
Ended up doing this, is this efficient? ```sql SELECT f.runner from (select ((db_bench_results.result -> 'Runner'::text))::text AS runner, FROM public.db_bench_results) as f where f.runner like '%this_runner%' ```
286,636
I now have 3 characters at level 75+, I am playing maps since a while (albeit only tier 4 or lower so far), but I have yet to see an Exalted to drop. Is there some way I can increase the chances to see one? Or are they limited only to higher tier maps?
2016/09/27
[ "https://gaming.stackexchange.com/questions/286636", "https://gaming.stackexchange.com", "https://gaming.stackexchange.com/users/100233/" ]
Exalted Orbs can drop randomly from mobs, chests, etc. from practically any zone; I don't believe they are limited to maps or other higher-tier zones. The simplest way of increasing your chances to see an Exalted Orb drop is to kill more mobs, open more chests, and turn over more rocks. You can also get Exalted orbs ...
From my personal experience (currently lvl 87 in Legacy clearing up to t13 maps), exalts drop rate increases as area lvl increases (this was to be expected and I am not sure that it is clearly stated by GGG). With all chars I have leveled, I had 1 "guaranteed"drop until act 3-4 merc (sample of 5 different chars) and ...
286,636
I now have 3 characters at level 75+, I am playing maps since a while (albeit only tier 4 or lower so far), but I have yet to see an Exalted to drop. Is there some way I can increase the chances to see one? Or are they limited only to higher tier maps?
2016/09/27
[ "https://gaming.stackexchange.com/questions/286636", "https://gaming.stackexchange.com", "https://gaming.stackexchange.com/users/100233/" ]
I would recommend doing the following (this takes a bit of investment first though). It's what I've done in the past & also what worked out really well for me. --- 1.) You need a character who can tackle at least T10 maps without any big problems. 2.) You need a bit of currency to start with this, I'd say ~50c shoul...
From my personal experience (currently lvl 87 in Legacy clearing up to t13 maps), exalts drop rate increases as area lvl increases (this was to be expected and I am not sure that it is clearly stated by GGG). With all chars I have leveled, I had 1 "guaranteed"drop until act 3-4 merc (sample of 5 different chars) and ...
57,146,104
Say I have the following classes: ``` @Slf4j class MySuperclass { public void testMethod() { def test = [1, 2, 3] test.each {it -> log.info("gab" + it) def test2 = [4,5,6] test2.each { log.info("" + it) } } } } ``` And t...
2019/07/22
[ "https://Stackoverflow.com/questions/57146104", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1403273/" ]
One way to deal with it is to reference the log property as a static member on the class. The project at <https://github.com/jeffbrown/logissue> demonstrates that. <https://github.com/jeffbrown/logissue/blob/d089c296c102980855a88061275e52485965e4ab/src/main/groovy/logdemo/MySuperclass.groovy> ``` package logdemo imp...
You need add log dependencies in MySuperClass, like: ``` import groovy.util.logging.Slf4j @Grapes([ @Grab(group='ch.qos.logback', module='logback-classic', version='1.0.13') ]) @Slf4j class MySuperclass { ... } ```
32,932,590
I'm trying to get more familiar with eventhanlders, but my current even only updates once, I want it to update until I close the application. This is my code: ``` private static event EventHandler Updater; Updater += Program_updater; Updater.Invoke(null, EventArgs.Empty); Application.Run(); private static void Progr...
2015/10/04
[ "https://Stackoverflow.com/questions/32932590", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5228246/" ]
You probably want to bitwise-and the return value of `fileperms` to get just it's lower bits, and compare that: ``` // Get only the 4 righmost octal digits of the file's permissions $perms = fileperms($file) & 07777; $chmod = 0644; if ($perms !== $chmod) { // do your stuff } ``` Note that there are no "octal v...
Try this, untested as not on my computer at the mo, ```html <?php $dir ="./"; $chmod =0644; function chmod_r($dir) { $dp = opendir($dir); while($Folder = readdir($dp)) { if($Folder != "." AND $Folder != "..") { if(is_dir($Folder)){ if(substr(sprintf...
37,098,301
On my website, for some reason the Arial font is displayed differently on several devices. It was fine and the complaints started to arrive approximately a month ago and I suspect that the root cause is somewhere locally (browser or OS). All the problematic users sit on different versions of Windows and mostly use Chr...
2016/05/08
[ "https://Stackoverflow.com/questions/37098301", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5851467/" ]
You can't style an iframe with CSS, there are two ways to solve the problem though: * Use javascript to style it: take a look at [this answer](https://stackoverflow.com/questions/583753/using-css-to-affect-div-style-inside-iframe) * Don't use an iframe: use [this tutorial](https://morningstudio.com.au/blog/2013/06/how...
What I did to change the width of the form was change the width within the embedded code within the iframe.
37,098,301
On my website, for some reason the Arial font is displayed differently on several devices. It was fine and the complaints started to arrive approximately a month ago and I suspect that the root cause is somewhere locally (browser or OS). All the problematic users sit on different versions of Windows and mostly use Chr...
2016/05/08
[ "https://Stackoverflow.com/questions/37098301", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5851467/" ]
You can't style an iframe with CSS, there are two ways to solve the problem though: * Use javascript to style it: take a look at [this answer](https://stackoverflow.com/questions/583753/using-css-to-affect-div-style-inside-iframe) * Don't use an iframe: use [this tutorial](https://morningstudio.com.au/blog/2013/06/how...
Apparently, there is no way to do that and I have looked everywhere. Currently, there isn't an option to make the Google Form wider. Check out this link on google forum: <https://productforums.google.com/forum/#!topic/docs/FaGfvxnm51U>
11,144,496
I want to visit a page like... ``` http://mysitelocaltion/user_name/user_id ``` This is just a virtual link, I have used a .htaccess -rewrite rule to internally pass "user\_name" and "use\_id" as get parameters for my actual page. How do I achieve the same in Laravel? **Update:** This shall help (documentation) `...
2012/06/21
[ "https://Stackoverflow.com/questions/11144496", "https://Stackoverflow.com", "https://Stackoverflow.com/users/553406/" ]
``` Route::get('(:any)/(:any)', function($user_name, $user_id) { echo $user_name; }); ``` Great to see you using Laravel!
You can add the following in your route ``` Route::get('user_name/{user_id}', 'YourControllerName@method_name'); ``` In your controller you can access the value as follows ``` public function method_name(Request $request, $user_id){ echo $user_id; $user = User::find($user_id); return view('view_name')->...
28,242,903
i have a big buttons with images and text.i want to remove white background behind image. **Xml code:** ``` <Button android:id="@+id/message" android:background="@drawable/button_style" android:shadowColor="#f9f9f9" android:drawableLeft="@drawable/message" android:paddingLeft=...
2015/01/30
[ "https://Stackoverflow.com/questions/28242903", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4512578/" ]
I used [`random.randint`](https://docs.python.org/2/library/random.html#random.randint) to generate a random number, but this can be easily replaced. The idea is to use a [`defaultdict`](https://docs.python.org/2/library/collections.html#collections.defaultdict) to have **single** score (`dict` keys are unique) for a ...
Sounds like you're looking for a mapping. You can use dicts for that. Once you've first decided 1001 goes to file 2, you can add to your mapping dict. ``` fileMap={} fileMap[group]="fileName" ``` And then, when you need to check if the group has been decided yet, you just ``` >>>group in fileMap True ``` This...
13,893
I've noticed in my own stats, as well as [searching on other sites](http://www.google.com/search?q=%22wwwstumbleupon.com%22), a fair amount of traffic that comes from urls that look like this: http://wwwstumbleupon.com/refer.php?url=http://[mydomain]/[myurl] Which looks a lot like a valid stumbleupon referrer, but fr...
2011/05/16
[ "https://webmasters.stackexchange.com/questions/13893", "https://webmasters.stackexchange.com", "https://webmasters.stackexchange.com/users/7539/" ]
It turns out that all this traffic is not from referrer spam, it's from StumbleUpon's android app. All that traffic has Android user agents, and by logging the HTTP requests the android app is making I was able to determine that they are setting the referrer header incorrectly. They've got a typo in their own domain na...
> > Does anybody know if this is valid traffic from stumbleupon? > > > It isn't. The WHOIS information hides behind one of those privacy shields, and the home page is obviously designed to look like a parked domain. This looks like a classic case of [referrer spam](http://en.wikipedia.org/wiki/Referrer_spam), th...
29,949,020
> > ! Latest I've tried. I put it in my head.php which I just include. I'll send over my files if you'd want to see them personally. > Directory of my folder > > > ``` Main_Folder -Main_files -- JS_Folder ---- Js Files -- Includes_Folder ---- Head.php is here <script type="text/javascript"> jQuery(function($) { ...
2015/04/29
[ "https://Stackoverflow.com/questions/29949020", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4110257/" ]
One approach: ```js // obviously, use 'document.location'/'window.location' in the real thing: var fakeLocation = 'http://www.example.com/index.php'; $('.nav a').each(function() { // get the absolute URL from the <a> element: var href = this.href, // get the current page and file-type: pageAndFile =...
Assuming `location.pathname.split("/")[2]` returns the expected parameter, the problem is ``` $('nav a[href^="/' ``` should be ``` $('.nav a[href^="' ``` `.nav` is a class, not an element, in your example
29,949,020
> > ! Latest I've tried. I put it in my head.php which I just include. I'll send over my files if you'd want to see them personally. > Directory of my folder > > > ``` Main_Folder -Main_files -- JS_Folder ---- Js Files -- Includes_Folder ---- Head.php is here <script type="text/javascript"> jQuery(function($) { ...
2015/04/29
[ "https://Stackoverflow.com/questions/29949020", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4110257/" ]
One approach: ```js // obviously, use 'document.location'/'window.location' in the real thing: var fakeLocation = 'http://www.example.com/index.php'; $('.nav a').each(function() { // get the absolute URL from the <a> element: var href = this.href, // get the current page and file-type: pageAndFile =...
problem in your script...... ``` $(function() { $('.nav a[href^="' + location.pathname.split("/")[2] + '"]').addClass('active');t }); ```
61,160,686
I am trying to display `plotly.express` bar chart in Flask. But it is giving `'Figure' object has no attribute savefig error`. The image gets displayed correctly while using `fig.show()`. ``` import matplotlib.pyplot as plt import plotly.express as px figs = px.bar( comp_df.head(10), x = "Company", y = "S...
2020/04/11
[ "https://Stackoverflow.com/questions/61160686", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4264590/" ]
You have defined `figs` with the `px.bar()` method. Per [documentation](https://plotly.com/python-api-reference/generated/plotly.express.bar.html#plotly.express.bar) `px.bar()` returns a `plotly.graph_objects.Figure` object. Looking at this `plotly.graph_objects.Figure` class' documentation we can see all the methods...
Instead of using `figs.savefig`, try to use `plt.savefig` ``` import matplotlib.pyplot as plt plt.savefig('static/images/staff_plot.png') ```
51,644,456
I am getting the following exception while running grails. Recently i have upgraded grails from version 2.x to 3.3.6. Please let me know what i am missing. Thanks General error during conversion: java.lang.NoClassDefFoundError: org/codehaus/groovy/grails/commons/ApplicationAttributes java.lang.RuntimeException: java.l...
2018/08/02
[ "https://Stackoverflow.com/questions/51644456", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10153596/" ]
`getvalue` method is available only on `io.StringIO`. For an `io.TextIOWrapper` instance, use the `read` method. Change `csvfile.getvalue()` to `csvfile.read()` and it should work.
Since the **csvfile** is a **`_io.TextIOWrapper`** object, you have to use **`.read()`** method instead of **`getvalue()`** as, ``` def send_results_by_email(to, filename=FILENAME): """Send an email with the NPS data attached""" with open(filename, 'r') as csvfile: now = datetime.now().strftime("%m-%...
24,960,719
I'm looking for an efficient way to find all the intersections between sets of timestamp ranges. It needs to work with PostgreSQL 9.2. Let's say the ranges represent the times when a person is available to meet. Each person may have one or more ranges of times when they are available. I want to find *all* the time per...
2014/07/25
[ "https://Stackoverflow.com/questions/24960719", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1536933/" ]
If you have a fixed number of entities you want to cross reference, you can use a cross join for each of them, and build the intersection (using the `*` operator on ranges). Using a cross join like this is probably less efficient, though. The following example has more to do with explaining the more complex example be...
OK, I wrote and tested this in TSQL but it should run or at least be close enough for you to translate back, it's all fairly vanilla constructs. ~~Except maybe the between, but that can be broken into a < clause and a > clause.~~ (thanks @Horse) ``` WITH cteSched AS ( --Schedule for everyone -- Test data. Returns:...
24,960,719
I'm looking for an efficient way to find all the intersections between sets of timestamp ranges. It needs to work with PostgreSQL 9.2. Let's say the ranges represent the times when a person is available to meet. Each person may have one or more ranges of times when they are available. I want to find *all* the time per...
2014/07/25
[ "https://Stackoverflow.com/questions/24960719", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1536933/" ]
I created the `tsrange_interception_agg` aggregate ``` create function tsrange_interception ( internal_state tsrange, next_data_values tsrange ) returns tsrange as $$ select internal_state * next_data_values; $$ language sql; create aggregate tsrange_interception_agg (tsrange) ( sfunc = tsrange_intercepti...
OK, I wrote and tested this in TSQL but it should run or at least be close enough for you to translate back, it's all fairly vanilla constructs. ~~Except maybe the between, but that can be broken into a < clause and a > clause.~~ (thanks @Horse) ``` WITH cteSched AS ( --Schedule for everyone -- Test data. Returns:...
24,960,719
I'm looking for an efficient way to find all the intersections between sets of timestamp ranges. It needs to work with PostgreSQL 9.2. Let's say the ranges represent the times when a person is available to meet. Each person may have one or more ranges of times when they are available. I want to find *all* the time per...
2014/07/25
[ "https://Stackoverflow.com/questions/24960719", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1536933/" ]
I created the `tsrange_interception_agg` aggregate ``` create function tsrange_interception ( internal_state tsrange, next_data_values tsrange ) returns tsrange as $$ select internal_state * next_data_values; $$ language sql; create aggregate tsrange_interception_agg (tsrange) ( sfunc = tsrange_intercepti...
If you have a fixed number of entities you want to cross reference, you can use a cross join for each of them, and build the intersection (using the `*` operator on ranges). Using a cross join like this is probably less efficient, though. The following example has more to do with explaining the more complex example be...
2,116,833
I use Eclipse Galileo to develop Java code. When implementing an interface for mocking, I often want to specify the behavior of just a few methods and retain the default behavior (do nothing or return null/0) for most. Eclipse will produce a nicely formatted default implementation like: ``` HttpServletRequest mock...
2010/01/22
[ "https://Stackoverflow.com/questions/2116833", "https://Stackoverflow.com", "https://Stackoverflow.com/users/76024/" ]
I came up with something like: * Find pattern: `(public|private|protected)\s+(\w+)\s+(\w+)(\(.*\))\s+\{\s*(// TODO Auto-generated method stub)\s*(.*)\s*\}` * Replace pattern: `$1 $2 $3$4 { $6 }`
See how this is done with Adapters in swing, where the adapter is a dummy implementation of a given interface, and you then override just what you need. Gives very concise code even with anonynous classes.
59,209,036
I'm writing a Programm to crop inmages and my problem is I want that rectangle to have a specific aspect ratio (90:90) and is it possible to make the rectangle instead of the mouse, change its size with mousewheel and confirm with mouse click? ``` import cv2 import numpy as np cropping = False x_start, y_start, x_en...
2019/12/06
[ "https://Stackoverflow.com/questions/59209036", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12489962/" ]
Using conditional count: ``` select c.CardHolderID, count( case when c.deleted > 0 then 1 else null end ) deleted0, count( case when c.deleted = 0 then 1 else null end ) deleted1, from Card c group by c.CardHolderID ```
`GROUP BY` CardHolderID alone. Use `SUM(Deleted)` to count the 1's. Use `SUM(1-deleted)` to count the 0's. ``` select c.CardHolderID, sum(1-c.deleted) deleted0, sum(c.Deleted) deleted1 from Card c group by c.CardHolderID ```
59,209,036
I'm writing a Programm to crop inmages and my problem is I want that rectangle to have a specific aspect ratio (90:90) and is it possible to make the rectangle instead of the mouse, change its size with mousewheel and confirm with mouse click? ``` import cv2 import numpy as np cropping = False x_start, y_start, x_en...
2019/12/06
[ "https://Stackoverflow.com/questions/59209036", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12489962/" ]
`GROUP BY` CardHolderID alone. Use `SUM(Deleted)` to count the 1's. Use `SUM(1-deleted)` to count the 0's. ``` select c.CardHolderID, sum(1-c.deleted) deleted0, sum(c.Deleted) deleted1 from Card c group by c.CardHolderID ```
if you are using MSSQL ``` select DtlPivot.CardHolderID, isnull(DtlPivot.[0],0) as Deleted0, isnull(DtlPivot.[1],0) as Deleted1 from ( select c.CardHolderID, c.Deleted, COUNT(*) as Total from Card c group by c.Deleted, c.CardHolderID ) aa PIVOT ( sum(Total) FOR Deleted IN([0],[1]) )AS DtlPivot ```
59,209,036
I'm writing a Programm to crop inmages and my problem is I want that rectangle to have a specific aspect ratio (90:90) and is it possible to make the rectangle instead of the mouse, change its size with mousewheel and confirm with mouse click? ``` import cv2 import numpy as np cropping = False x_start, y_start, x_en...
2019/12/06
[ "https://Stackoverflow.com/questions/59209036", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12489962/" ]
Using conditional count: ``` select c.CardHolderID, count( case when c.deleted > 0 then 1 else null end ) deleted0, count( case when c.deleted = 0 then 1 else null end ) deleted1, from Card c group by c.CardHolderID ```
if you are using MSSQL ``` select DtlPivot.CardHolderID, isnull(DtlPivot.[0],0) as Deleted0, isnull(DtlPivot.[1],0) as Deleted1 from ( select c.CardHolderID, c.Deleted, COUNT(*) as Total from Card c group by c.Deleted, c.CardHolderID ) aa PIVOT ( sum(Total) FOR Deleted IN([0],[1]) )AS DtlPivot ```
552,751
<https://m.youtube.com/watch?v=HneFM-BvZj4> (excerpt from the 2014 World Science Festival Program Dear Albert. Actor Alan Alda and physicist Brian Greene discuss Einstein's relationship with the "unruly child" of quantum mechanics, and how the famed physicist came up with the Special Theory of Relativity). From about...
2020/05/17
[ "https://physics.stackexchange.com/questions/552751", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/264695/" ]
In relativity we regard motion as relative. Actually, even position is relative. You cannot say where something is unless you say where it is relative to something else. When we say we fall to the ground, we are thinking in terms of our motion, relative to the ground. But suppose we were in an elevator in which we cann...
In the following I'm going to talk about the relation between information and science When the information that is available to you is purely local information your assessment of your situation is inherently limited to that local information. Let's say you find yourself in a small room, and as far as you can tell the...
53,412,580
I wanted to extract the value of a column given another column with id's of a different dataset. DF-1: ``` ID A B 1 cat 22 2 dog 33 3 mamal 44 4 rat 55 5 rabbit 66 6 puppy 77 ``` DF-2: ``` name fav_animal x 1,2,3 y 2,3 z 3,4 ``` I wanted to see the fav animals ...
2018/11/21
[ "https://Stackoverflow.com/questions/53412580", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7166834/" ]
First check find `fav_animal` values with [`boolean indexing`](http://pandas.pydata.org/pandas-docs/stable/indexing.html#boolean-indexing), `next` and `iter` is for return empty list if no name matched. ``` a = next(iter(df2.loc[df2['name'] == 'x', 'fav_animal']), []) ``` Then split values and convert them to intege...
You can use this function for example: ``` def get_names(df, df2, name): indices = np.asarray(df2.loc[name].values[0].split(',')).astype(int) return indices.tolist(), df.loc[indices,:]['A'].tolist() ``` So, for example if you want the `fav_animals` for name `x`: ``` list_id, name_animal = get_names(df,df2, ...
53,412,580
I wanted to extract the value of a column given another column with id's of a different dataset. DF-1: ``` ID A B 1 cat 22 2 dog 33 3 mamal 44 4 rat 55 5 rabbit 66 6 puppy 77 ``` DF-2: ``` name fav_animal x 1,2,3 y 2,3 z 3,4 ``` I wanted to see the fav animals ...
2018/11/21
[ "https://Stackoverflow.com/questions/53412580", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7166834/" ]
You can use this function for example: ``` def get_names(df, df2, name): indices = np.asarray(df2.loc[name].values[0].split(',')).astype(int) return indices.tolist(), df.loc[indices,:]['A'].tolist() ``` So, for example if you want the `fav_animals` for name `x`: ``` list_id, name_animal = get_names(df,df2, ...
Something like this? ``` for i in df2.fav_animal.tolist(): print(df1.loc[map(int, i.split(","))]["A"].tolist()) ``` Output: ``` ['dog', 'mamal', 'rat'] ['mamal', 'rat'] ['rat', 'rabbit'] ``` Alternative: ``` print([df1.loc[map(int, i.split(","))]["A"].tolist() for i in df2.fav_animal.tolist()]) ``` Output:...
53,412,580
I wanted to extract the value of a column given another column with id's of a different dataset. DF-1: ``` ID A B 1 cat 22 2 dog 33 3 mamal 44 4 rat 55 5 rabbit 66 6 puppy 77 ``` DF-2: ``` name fav_animal x 1,2,3 y 2,3 z 3,4 ``` I wanted to see the fav animals ...
2018/11/21
[ "https://Stackoverflow.com/questions/53412580", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7166834/" ]
First check find `fav_animal` values with [`boolean indexing`](http://pandas.pydata.org/pandas-docs/stable/indexing.html#boolean-indexing), `next` and `iter` is for return empty list if no name matched. ``` a = next(iter(df2.loc[df2['name'] == 'x', 'fav_animal']), []) ``` Then split values and convert them to intege...
Something like this? ``` for i in df2.fav_animal.tolist(): print(df1.loc[map(int, i.split(","))]["A"].tolist()) ``` Output: ``` ['dog', 'mamal', 'rat'] ['mamal', 'rat'] ['rat', 'rabbit'] ``` Alternative: ``` print([df1.loc[map(int, i.split(","))]["A"].tolist() for i in df2.fav_animal.tolist()]) ``` Output:...
53,412,580
I wanted to extract the value of a column given another column with id's of a different dataset. DF-1: ``` ID A B 1 cat 22 2 dog 33 3 mamal 44 4 rat 55 5 rabbit 66 6 puppy 77 ``` DF-2: ``` name fav_animal x 1,2,3 y 2,3 z 3,4 ``` I wanted to see the fav animals ...
2018/11/21
[ "https://Stackoverflow.com/questions/53412580", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7166834/" ]
First check find `fav_animal` values with [`boolean indexing`](http://pandas.pydata.org/pandas-docs/stable/indexing.html#boolean-indexing), `next` and `iter` is for return empty list if no name matched. ``` a = next(iter(df2.loc[df2['name'] == 'x', 'fav_animal']), []) ``` Then split values and convert them to intege...
I think what you're looking for is this: ``` df1 = pd.DataFrame({'ID':np.arange(1, 7), 'A': ['cat', 'dog', 'mamal', 'rat', 'rabbit', 'puppy'], 'B': [22, 33, 44, 55, 66, 77]}) df2 = pd.DataFrame({'name': ['x', 'y', 'z'], 'fav_animal': ['1,2,3', '2,3', '3,4']}) df2.loc[df2.name ...
53,412,580
I wanted to extract the value of a column given another column with id's of a different dataset. DF-1: ``` ID A B 1 cat 22 2 dog 33 3 mamal 44 4 rat 55 5 rabbit 66 6 puppy 77 ``` DF-2: ``` name fav_animal x 1,2,3 y 2,3 z 3,4 ``` I wanted to see the fav animals ...
2018/11/21
[ "https://Stackoverflow.com/questions/53412580", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7166834/" ]
I think what you're looking for is this: ``` df1 = pd.DataFrame({'ID':np.arange(1, 7), 'A': ['cat', 'dog', 'mamal', 'rat', 'rabbit', 'puppy'], 'B': [22, 33, 44, 55, 66, 77]}) df2 = pd.DataFrame({'name': ['x', 'y', 'z'], 'fav_animal': ['1,2,3', '2,3', '3,4']}) df2.loc[df2.name ...
Something like this? ``` for i in df2.fav_animal.tolist(): print(df1.loc[map(int, i.split(","))]["A"].tolist()) ``` Output: ``` ['dog', 'mamal', 'rat'] ['mamal', 'rat'] ['rat', 'rabbit'] ``` Alternative: ``` print([df1.loc[map(int, i.split(","))]["A"].tolist() for i in df2.fav_animal.tolist()]) ``` Output:...
56,356,164
This is the question about MergeContent processor in Nifi. Currently, I need to combine all flowfiles with one particular attribute in one shot manner. But what happens is since there are so many flowFile with the same attribute, the processor produces a few different flowfiles merged with the attribute, and those fe...
2019/05/29
[ "https://Stackoverflow.com/questions/56356164", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11332024/" ]
You can increase the "Minimum Number of Entries" and "Maximum Number of Entries" to suit your use case and increase the "Max Bin Age" to a suitable time. You can refer all the properties for merge-content here : <https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-standard-nar/1.6.0/org.apache.nifi...
Before the MergeContent Processor you should configure your connector with a Load Balancing policy of "Single Node" so that you guarantee that only 1 node will process the defragmentation.
58,903,690
In the ToggleButtons-Example there is not much space between the icons: <https://api.flutter.dev/flutter/material/ToggleButtons-class.html> [![enter image description here](https://i.stack.imgur.com/NXk8z.png)](https://i.stack.imgur.com/NXk8z.png) When I use the code provided, I get that [![enter image description h...
2019/11/17
[ "https://Stackoverflow.com/questions/58903690", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2069048/" ]
**How can I remove the space on the left and on the right?** How Bogdan Orzea said, in Flutter last release (version 1.9.1) isn't possible to change the padding of the ToggleButtons's children. Probably in the next Flutter release it will be possible. If you can't wait until the next release, you can update Flutter to...
You can wrap any widget with a `SingleChildScrollView` like this: ``` SingleChildScrollView( scrollDirection: Axis.horizontal, child: ToggleButtons( ... ), ), ```
58,903,690
In the ToggleButtons-Example there is not much space between the icons: <https://api.flutter.dev/flutter/material/ToggleButtons-class.html> [![enter image description here](https://i.stack.imgur.com/NXk8z.png)](https://i.stack.imgur.com/NXk8z.png) When I use the code provided, I get that [![enter image description h...
2019/11/17
[ "https://Stackoverflow.com/questions/58903690", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2069048/" ]
You can wrap any widget with a `SingleChildScrollView` like this: ``` SingleChildScrollView( scrollDirection: Axis.horizontal, child: ToggleButtons( ... ), ), ```
Seems like there are now built-in way to achieve that. Working solution in 2022: ``` Padding( padding: EdgeInsets.all(5), child: ToggleButtons( constraints: Bo...
58,903,690
In the ToggleButtons-Example there is not much space between the icons: <https://api.flutter.dev/flutter/material/ToggleButtons-class.html> [![enter image description here](https://i.stack.imgur.com/NXk8z.png)](https://i.stack.imgur.com/NXk8z.png) When I use the code provided, I get that [![enter image description h...
2019/11/17
[ "https://Stackoverflow.com/questions/58903690", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2069048/" ]
**How can I remove the space on the left and on the right?** How Bogdan Orzea said, in Flutter last release (version 1.9.1) isn't possible to change the padding of the ToggleButtons's children. Probably in the next Flutter release it will be possible. If you can't wait until the next release, you can update Flutter to...
Probably the next Flutter release will include a PR that adds *constraints* parameter to *ToggleButtons* widget (<https://github.com/flutter/flutter/pull/39857>). Until then, you can use the SingleChildScrollView method.
58,903,690
In the ToggleButtons-Example there is not much space between the icons: <https://api.flutter.dev/flutter/material/ToggleButtons-class.html> [![enter image description here](https://i.stack.imgur.com/NXk8z.png)](https://i.stack.imgur.com/NXk8z.png) When I use the code provided, I get that [![enter image description h...
2019/11/17
[ "https://Stackoverflow.com/questions/58903690", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2069048/" ]
Probably the next Flutter release will include a PR that adds *constraints* parameter to *ToggleButtons* widget (<https://github.com/flutter/flutter/pull/39857>). Until then, you can use the SingleChildScrollView method.
Seems like there are now built-in way to achieve that. Working solution in 2022: ``` Padding( padding: EdgeInsets.all(5), child: ToggleButtons( constraints: Bo...
58,903,690
In the ToggleButtons-Example there is not much space between the icons: <https://api.flutter.dev/flutter/material/ToggleButtons-class.html> [![enter image description here](https://i.stack.imgur.com/NXk8z.png)](https://i.stack.imgur.com/NXk8z.png) When I use the code provided, I get that [![enter image description h...
2019/11/17
[ "https://Stackoverflow.com/questions/58903690", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2069048/" ]
**How can I remove the space on the left and on the right?** How Bogdan Orzea said, in Flutter last release (version 1.9.1) isn't possible to change the padding of the ToggleButtons's children. Probably in the next Flutter release it will be possible. If you can't wait until the next release, you can update Flutter to...
Seems like there are now built-in way to achieve that. Working solution in 2022: ``` Padding( padding: EdgeInsets.all(5), child: ToggleButtons( constraints: Bo...
238,620
I have a subclass "s" of UIView. I want to put some buttons and labels on s. How do I associate my UIView subclass with a nib file?
2008/10/26
[ "https://Stackoverflow.com/questions/238620", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22471/" ]
1. In Interface Builder, create a new xib with the View template. * Click on the view in the list of objects in the xib (you should also see "File's Owner and "First Responder"). * Push Cmd-4 to open the Identity pane of the inspector. * Type your class's name into the "Class Name" field and push return. You s...
In my case, I didn't want my view controller to have any knowledge of the IBOutlets from my view's .xib. I wanted my view subclass to own the IBOutlets. Unfortunately UIView doesn't have an `initWithNibName:` method, so I just created my own category. Here's what I did: * In IB, click on your main UIView, and in the ...
252,993
Can someone review my code and provide feedback. For context in column A will be a status message of "OK" or "NOK" and this little function just counts the number of times this appear so I can update a label in another procedure. Not too sure if this is the most efficient way of doing this because looping will create d...
2020/12/03
[ "https://codereview.stackexchange.com/questions/252993", "https://codereview.stackexchange.com", "https://codereview.stackexchange.com/users/135180/" ]
Don't reinvent the wheel. Your homemade function will *never* be as fast as the built in functions. ``` Function UploadStatus(ByRef WS As Worksheet, ByVal StartRow As Long, ByVal EndRow As Long, Optional ByVal strMsg As String) As String Dim OK As Long Dim NOK As Long Dim uploadMsg As String If StartRow = 0 A...
This is a refined solution based on the answer above as I found few errors when testing like type miss match and object required. ``` Function UploadStatus(ByRef WS As Worksheet, ByVal StartRow As Long, ByVal EndRow As Long, Optional ByVal strMsg As String) As String Dim OK As Long Dim NOK As Long Dim uploadMsg As Str...
252,993
Can someone review my code and provide feedback. For context in column A will be a status message of "OK" or "NOK" and this little function just counts the number of times this appear so I can update a label in another procedure. Not too sure if this is the most efficient way of doing this because looping will create d...
2020/12/03
[ "https://codereview.stackexchange.com/questions/252993", "https://codereview.stackexchange.com", "https://codereview.stackexchange.com/users/135180/" ]
Personally, I would not worry about the pluralizing and use `row(s)` in the message. The `iif` can be used to simplify the code. ``` Function UploadStatus2(ByRef WS As Worksheet, ByVal StartRow As Long, ByVal EndRow As Long, Optional ByVal strMsg As String) As String Dim Target As Range With WS On Erro...
This is a refined solution based on the answer above as I found few errors when testing like type miss match and object required. ``` Function UploadStatus(ByRef WS As Worksheet, ByVal StartRow As Long, ByVal EndRow As Long, Optional ByVal strMsg As String) As String Dim OK As Long Dim NOK As Long Dim uploadMsg As Str...
2,121
My contract is [here](https://smartpy.io/demo/explore.html?address=KT18rxeQo6hcxMQHvhoWMEiSJrXYUSzCrBde) [![enter image description here](https://i.stack.imgur.com/mmGVc.png)](https://i.stack.imgur.com/mmGVc.png) === [![enter image description here](https://i.stack.imgur.com/yVBqt.png)](https://i.stack.imgur.com/yVBq...
2020/02/12
[ "https://tezos.stackexchange.com/questions/2121", "https://tezos.stackexchange.com", "https://tezos.stackexchange.com/users/4798/" ]
When you send an operation, it first goes to the mempool, and only then bakers include it into the block. So there is some delay... I highly recommend you use [tzkt.io](https://tzkt.io) explorer, because it also checks operations in the mempool so you will see them right after sending or if it's stuck in the mempool. ...
Something didn't work correctly. If you click on "Operations" tab on the SmartPy explorer, you can see there are only 2 operations. This is confirmed by [looking at tzstas](https://zeronet.tzstats.com/KT18rxeQo6hcxMQHvhoWMEiSJrXYUSzCrBde) and looking at [BCD](https://better-call.dev/zero/KT18rxeQo6hcxMQHvhoWMEiSJrXYUSz...
2,121
My contract is [here](https://smartpy.io/demo/explore.html?address=KT18rxeQo6hcxMQHvhoWMEiSJrXYUSzCrBde) [![enter image description here](https://i.stack.imgur.com/mmGVc.png)](https://i.stack.imgur.com/mmGVc.png) === [![enter image description here](https://i.stack.imgur.com/yVBqt.png)](https://i.stack.imgur.com/yVBq...
2020/02/12
[ "https://tezos.stackexchange.com/questions/2121", "https://tezos.stackexchange.com", "https://tezos.stackexchange.com/users/4798/" ]
When you send an operation, it first goes to the mempool, and only then bakers include it into the block. So there is some delay... I highly recommend you use [tzkt.io](https://tzkt.io) explorer, because it also checks operations in the mempool so you will see them right after sending or if it's stuck in the mempool. ...
You were looking at the wrong network on TzStats. It actually appears on zeronet - see [here](https://zeronet.tzstats.com/KT18rxeQo6hcxMQHvhoWMEiSJrXYUSzCrBde).
2,090,836
When I was at high school, our teacher showed us a technique to simplify square roots like this $\sqrt{8 - 2\sqrt{7}}$ that I forgot. It was something like 8 = 7+1; 7 = 7\*1; and using them we could represent $\sqrt{8 - 2\sqrt{7}}$ in simpler form. I would be happy if you can show how it works, and how this techn...
2017/01/09
[ "https://math.stackexchange.com/questions/2090836", "https://math.stackexchange.com", "https://math.stackexchange.com/users/300795/" ]
Try making perfect square inside of that square root, as you can see that $$2\sqrt{7}=2\times1\times\sqrt{7}$$ and $$8=1+(\sqrt{7})^2$$ Then apply $$a^2+b^2-2ab=(a-b^2)$$
You could approach this by setting $\sqrt{8 - 2\sqrt{7}} = \sqrt a \pm \sqrt b$ for some $a,b$. Then, squaring both sides, we have: $$8 - 2\sqrt{7} = a \pm 2\sqrt{ab} + b,$$ so that $8=a+b$ and $-2\sqrt7 = \pm 2\sqrt{ab}$. In other words, the $\pm$ sign must be $-$, and we now have a system of two equations $\{8=a+b...
2,090,836
When I was at high school, our teacher showed us a technique to simplify square roots like this $\sqrt{8 - 2\sqrt{7}}$ that I forgot. It was something like 8 = 7+1; 7 = 7\*1; and using them we could represent $\sqrt{8 - 2\sqrt{7}}$ in simpler form. I would be happy if you can show how it works, and how this techn...
2017/01/09
[ "https://math.stackexchange.com/questions/2090836", "https://math.stackexchange.com", "https://math.stackexchange.com/users/300795/" ]
HINT: $$ 8=1^2+(\sqrt{7})^2 $$ and $(a-b)^2=a^2+b^2-2ab$.
$$\sqrt { 8-2\sqrt { 7 } } =\sqrt { { \left( \sqrt { 7 } \right) }^{ 2 }-2\sqrt { 7 } +1 } =\sqrt { { \left( \sqrt { 7 } -1 \right) }^{ 2 } } =\sqrt { 7 } -1$$
2,090,836
When I was at high school, our teacher showed us a technique to simplify square roots like this $\sqrt{8 - 2\sqrt{7}}$ that I forgot. It was something like 8 = 7+1; 7 = 7\*1; and using them we could represent $\sqrt{8 - 2\sqrt{7}}$ in simpler form. I would be happy if you can show how it works, and how this techn...
2017/01/09
[ "https://math.stackexchange.com/questions/2090836", "https://math.stackexchange.com", "https://math.stackexchange.com/users/300795/" ]
Maybe that the formula that you do not remember is: $$ \sqrt{a\pm \sqrt{b}}=\sqrt{\dfrac{a+ \sqrt{a^2-b}}{2}}\pm\sqrt{\dfrac{a- \sqrt{a^2-b}}{2}} $$ that can easily verified ( see my answer to the similar question: [Denesting a square root: $\sqrt{7 + \sqrt{14}}$](https://math.stackexchange.com/questions/1214527/denest...
Such square roots can be *mechanically* computed by a [Simple Denesting Rule:](https://math.stackexchange.com/a/816527/242) Here $\ 8-2\sqrt 7\ $ has norm $= 36.\:$ $\rm\ \color{blue}{Subtracting\ out}\,\ \sqrt{norm}\ = 6\,\ $ yields $\,\ 2-2\sqrt 7\:$ which has $\, {\rm\ \sqrt{trace}}\, =\, \sqrt{4}\, =\, 2.\,\ \ \ ...
2,090,836
When I was at high school, our teacher showed us a technique to simplify square roots like this $\sqrt{8 - 2\sqrt{7}}$ that I forgot. It was something like 8 = 7+1; 7 = 7\*1; and using them we could represent $\sqrt{8 - 2\sqrt{7}}$ in simpler form. I would be happy if you can show how it works, and how this techn...
2017/01/09
[ "https://math.stackexchange.com/questions/2090836", "https://math.stackexchange.com", "https://math.stackexchange.com/users/300795/" ]
Try making perfect square inside of that square root, as you can see that $$2\sqrt{7}=2\times1\times\sqrt{7}$$ and $$8=1+(\sqrt{7})^2$$ Then apply $$a^2+b^2-2ab=(a-b^2)$$
Consider this:$$\sqrt{X\pm Y}=\sqrt{\dfrac {X+\sqrt{X^2-Y^2}}2}\pm\sqrt{\dfrac {X-\sqrt{X^2-Y^2}}2}\tag1$$ For $X,Y\in\mathbb{R}$ and $X>Y$. Therefore, we have $x=8,\ Y=\sqrt{28}$ so$$\sqrt{8-2\sqrt7}=\sqrt{\dfrac {8+\sqrt{64-28}}2}-\sqrt{\dfrac {8-\sqrt{64-28}}2}=\sqrt7-1\tag2$$
2,090,836
When I was at high school, our teacher showed us a technique to simplify square roots like this $\sqrt{8 - 2\sqrt{7}}$ that I forgot. It was something like 8 = 7+1; 7 = 7\*1; and using them we could represent $\sqrt{8 - 2\sqrt{7}}$ in simpler form. I would be happy if you can show how it works, and how this techn...
2017/01/09
[ "https://math.stackexchange.com/questions/2090836", "https://math.stackexchange.com", "https://math.stackexchange.com/users/300795/" ]
HINT: $$ 8=1^2+(\sqrt{7})^2 $$ and $(a-b)^2=a^2+b^2-2ab$.
Consider this:$$\sqrt{X\pm Y}=\sqrt{\dfrac {X+\sqrt{X^2-Y^2}}2}\pm\sqrt{\dfrac {X-\sqrt{X^2-Y^2}}2}\tag1$$ For $X,Y\in\mathbb{R}$ and $X>Y$. Therefore, we have $x=8,\ Y=\sqrt{28}$ so$$\sqrt{8-2\sqrt7}=\sqrt{\dfrac {8+\sqrt{64-28}}2}-\sqrt{\dfrac {8-\sqrt{64-28}}2}=\sqrt7-1\tag2$$
2,090,836
When I was at high school, our teacher showed us a technique to simplify square roots like this $\sqrt{8 - 2\sqrt{7}}$ that I forgot. It was something like 8 = 7+1; 7 = 7\*1; and using them we could represent $\sqrt{8 - 2\sqrt{7}}$ in simpler form. I would be happy if you can show how it works, and how this techn...
2017/01/09
[ "https://math.stackexchange.com/questions/2090836", "https://math.stackexchange.com", "https://math.stackexchange.com/users/300795/" ]
Maybe that the formula that you do not remember is: $$ \sqrt{a\pm \sqrt{b}}=\sqrt{\dfrac{a+ \sqrt{a^2-b}}{2}}\pm\sqrt{\dfrac{a- \sqrt{a^2-b}}{2}} $$ that can easily verified ( see my answer to the similar question: [Denesting a square root: $\sqrt{7 + \sqrt{14}}$](https://math.stackexchange.com/questions/1214527/denest...
Consider this:$$\sqrt{X\pm Y}=\sqrt{\dfrac {X+\sqrt{X^2-Y^2}}2}\pm\sqrt{\dfrac {X-\sqrt{X^2-Y^2}}2}\tag1$$ For $X,Y\in\mathbb{R}$ and $X>Y$. Therefore, we have $x=8,\ Y=\sqrt{28}$ so$$\sqrt{8-2\sqrt7}=\sqrt{\dfrac {8+\sqrt{64-28}}2}-\sqrt{\dfrac {8-\sqrt{64-28}}2}=\sqrt7-1\tag2$$
2,090,836
When I was at high school, our teacher showed us a technique to simplify square roots like this $\sqrt{8 - 2\sqrt{7}}$ that I forgot. It was something like 8 = 7+1; 7 = 7\*1; and using them we could represent $\sqrt{8 - 2\sqrt{7}}$ in simpler form. I would be happy if you can show how it works, and how this techn...
2017/01/09
[ "https://math.stackexchange.com/questions/2090836", "https://math.stackexchange.com", "https://math.stackexchange.com/users/300795/" ]
HINT: $$ 8=1^2+(\sqrt{7})^2 $$ and $(a-b)^2=a^2+b^2-2ab$.
Maybe that the formula that you do not remember is: $$ \sqrt{a\pm \sqrt{b}}=\sqrt{\dfrac{a+ \sqrt{a^2-b}}{2}}\pm\sqrt{\dfrac{a- \sqrt{a^2-b}}{2}} $$ that can easily verified ( see my answer to the similar question: [Denesting a square root: $\sqrt{7 + \sqrt{14}}$](https://math.stackexchange.com/questions/1214527/denest...
2,090,836
When I was at high school, our teacher showed us a technique to simplify square roots like this $\sqrt{8 - 2\sqrt{7}}$ that I forgot. It was something like 8 = 7+1; 7 = 7\*1; and using them we could represent $\sqrt{8 - 2\sqrt{7}}$ in simpler form. I would be happy if you can show how it works, and how this techn...
2017/01/09
[ "https://math.stackexchange.com/questions/2090836", "https://math.stackexchange.com", "https://math.stackexchange.com/users/300795/" ]
Maybe that the formula that you do not remember is: $$ \sqrt{a\pm \sqrt{b}}=\sqrt{\dfrac{a+ \sqrt{a^2-b}}{2}}\pm\sqrt{\dfrac{a- \sqrt{a^2-b}}{2}} $$ that can easily verified ( see my answer to the similar question: [Denesting a square root: $\sqrt{7 + \sqrt{14}}$](https://math.stackexchange.com/questions/1214527/denest...
You could approach this by setting $\sqrt{8 - 2\sqrt{7}} = \sqrt a \pm \sqrt b$ for some $a,b$. Then, squaring both sides, we have: $$8 - 2\sqrt{7} = a \pm 2\sqrt{ab} + b,$$ so that $8=a+b$ and $-2\sqrt7 = \pm 2\sqrt{ab}$. In other words, the $\pm$ sign must be $-$, and we now have a system of two equations $\{8=a+b...
2,090,836
When I was at high school, our teacher showed us a technique to simplify square roots like this $\sqrt{8 - 2\sqrt{7}}$ that I forgot. It was something like 8 = 7+1; 7 = 7\*1; and using them we could represent $\sqrt{8 - 2\sqrt{7}}$ in simpler form. I would be happy if you can show how it works, and how this techn...
2017/01/09
[ "https://math.stackexchange.com/questions/2090836", "https://math.stackexchange.com", "https://math.stackexchange.com/users/300795/" ]
$$\sqrt { 8-2\sqrt { 7 } } =\sqrt { { \left( \sqrt { 7 } \right) }^{ 2 }-2\sqrt { 7 } +1 } =\sqrt { { \left( \sqrt { 7 } -1 \right) }^{ 2 } } =\sqrt { 7 } -1$$
Such square roots can be *mechanically* computed by a [Simple Denesting Rule:](https://math.stackexchange.com/a/816527/242) Here $\ 8-2\sqrt 7\ $ has norm $= 36.\:$ $\rm\ \color{blue}{Subtracting\ out}\,\ \sqrt{norm}\ = 6\,\ $ yields $\,\ 2-2\sqrt 7\:$ which has $\, {\rm\ \sqrt{trace}}\, =\, \sqrt{4}\, =\, 2.\,\ \ \ ...
2,090,836
When I was at high school, our teacher showed us a technique to simplify square roots like this $\sqrt{8 - 2\sqrt{7}}$ that I forgot. It was something like 8 = 7+1; 7 = 7\*1; and using them we could represent $\sqrt{8 - 2\sqrt{7}}$ in simpler form. I would be happy if you can show how it works, and how this techn...
2017/01/09
[ "https://math.stackexchange.com/questions/2090836", "https://math.stackexchange.com", "https://math.stackexchange.com/users/300795/" ]
You could approach this by setting $\sqrt{8 - 2\sqrt{7}} = \sqrt a \pm \sqrt b$ for some $a,b$. Then, squaring both sides, we have: $$8 - 2\sqrt{7} = a \pm 2\sqrt{ab} + b,$$ so that $8=a+b$ and $-2\sqrt7 = \pm 2\sqrt{ab}$. In other words, the $\pm$ sign must be $-$, and we now have a system of two equations $\{8=a+b...
Consider this:$$\sqrt{X\pm Y}=\sqrt{\dfrac {X+\sqrt{X^2-Y^2}}2}\pm\sqrt{\dfrac {X-\sqrt{X^2-Y^2}}2}\tag1$$ For $X,Y\in\mathbb{R}$ and $X>Y$. Therefore, we have $x=8,\ Y=\sqrt{28}$ so$$\sqrt{8-2\sqrt7}=\sqrt{\dfrac {8+\sqrt{64-28}}2}-\sqrt{\dfrac {8-\sqrt{64-28}}2}=\sqrt7-1\tag2$$
57,370,750
In the [G Suite Developer Hub](https://script.google.com), under `My Projects > "insert project name here" > PROJECT DETAILS > Failed executions`, I keep seeing a status "failed" for the function `onOpen`. My script uses `onOpen` to add menu items for the add-on, nothing complicated, so I'm sure that there is no probl...
2019/08/06
[ "https://Stackoverflow.com/questions/57370750", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
You can use Map ``` final data = { "key1" : "value1", "key2" : "value2" }; Navigator.of(context).pop(data); ```
Make a new data structure class containing all data. You can also use map or list, but it will be a possible bug source if data structure changes.
57,370,750
In the [G Suite Developer Hub](https://script.google.com), under `My Projects > "insert project name here" > PROJECT DETAILS > Failed executions`, I keep seeing a status "failed" for the function `onOpen`. My script uses `onOpen` to add menu items for the add-on, nothing complicated, so I'm sure that there is no probl...
2019/08/06
[ "https://Stackoverflow.com/questions/57370750", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
You can use Map ``` final data = { "key1" : "value1", "key2" : "value2" }; Navigator.of(context).pop(data); ```
**Simple Example:** [![enter image description here](https://i.stack.imgur.com/pBeQs.png)](https://i.stack.imgur.com/pBeQs.png) *You can send your custom object via **result** parameter.* **Push to and get result from new Screen:** Navigate to new-screen wait for *then()* or *complete()* event to happen. ``` pushTo...
57,370,750
In the [G Suite Developer Hub](https://script.google.com), under `My Projects > "insert project name here" > PROJECT DETAILS > Failed executions`, I keep seeing a status "failed" for the function `onOpen`. My script uses `onOpen` to add menu items for the add-on, nothing complicated, so I'm sure that there is no probl...
2019/08/06
[ "https://Stackoverflow.com/questions/57370750", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
You can `pop` in two ways: ``` Navigator.of(context).pop(object); ``` or ``` Navigator.pop(context, object); ``` Either way, I've flagged with `object` the **optional** return value for the method. If you desire to return more than one values, you'll need to box them in an object, `class` or `Map` or whatever. ...
Make a new data structure class containing all data. You can also use map or list, but it will be a possible bug source if data structure changes.
57,370,750
In the [G Suite Developer Hub](https://script.google.com), under `My Projects > "insert project name here" > PROJECT DETAILS > Failed executions`, I keep seeing a status "failed" for the function `onOpen`. My script uses `onOpen` to add menu items for the add-on, nothing complicated, so I'm sure that there is no probl...
2019/08/06
[ "https://Stackoverflow.com/questions/57370750", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
You can `pop` in two ways: ``` Navigator.of(context).pop(object); ``` or ``` Navigator.pop(context, object); ``` Either way, I've flagged with `object` the **optional** return value for the method. If you desire to return more than one values, you'll need to box them in an object, `class` or `Map` or whatever. ...
**Simple Example:** [![enter image description here](https://i.stack.imgur.com/pBeQs.png)](https://i.stack.imgur.com/pBeQs.png) *You can send your custom object via **result** parameter.* **Push to and get result from new Screen:** Navigate to new-screen wait for *then()* or *complete()* event to happen. ``` pushTo...
57,370,750
In the [G Suite Developer Hub](https://script.google.com), under `My Projects > "insert project name here" > PROJECT DETAILS > Failed executions`, I keep seeing a status "failed" for the function `onOpen`. My script uses `onOpen` to add menu items for the add-on, nothing complicated, so I'm sure that there is no probl...
2019/08/06
[ "https://Stackoverflow.com/questions/57370750", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
You can `pop` in two ways: ``` Navigator.of(context).pop(object); ``` or ``` Navigator.pop(context, object); ``` Either way, I've flagged with `object` the **optional** return value for the method. If you desire to return more than one values, you'll need to box them in an object, `class` or `Map` or whatever. ...
Similar question [Flutter Back button with return data](https://stackoverflow.com/questions/51927885/flutter-back-button-with-return-data). code snippet from Deepak Thakur ``` class DetailsClassWhichYouWantToPop { final String date; final String amount; DetailsClassWhichYouWantToPop(this.date, this.amount); ...
57,370,750
In the [G Suite Developer Hub](https://script.google.com), under `My Projects > "insert project name here" > PROJECT DETAILS > Failed executions`, I keep seeing a status "failed" for the function `onOpen`. My script uses `onOpen` to add menu items for the add-on, nothing complicated, so I'm sure that there is no probl...
2019/08/06
[ "https://Stackoverflow.com/questions/57370750", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
You can use Map ``` final data = { "key1" : "value1", "key2" : "value2" }; Navigator.of(context).pop(data); ```
To be able to return multiple values via `Navigator.pop()` you could do 2 things (surely even more ways but those are some basic ones): **1. Creating a model holding those data:** ```dart class YourClass { String firstVar; String secondVar; int thirdVar; News( {this.firstVar, this.secondVar, ...
57,370,750
In the [G Suite Developer Hub](https://script.google.com), under `My Projects > "insert project name here" > PROJECT DETAILS > Failed executions`, I keep seeing a status "failed" for the function `onOpen`. My script uses `onOpen` to add menu items for the add-on, nothing complicated, so I'm sure that there is no probl...
2019/08/06
[ "https://Stackoverflow.com/questions/57370750", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
To be able to return multiple values via `Navigator.pop()` you could do 2 things (surely even more ways but those are some basic ones): **1. Creating a model holding those data:** ```dart class YourClass { String firstVar; String secondVar; int thirdVar; News( {this.firstVar, this.secondVar, ...
Similar question [Flutter Back button with return data](https://stackoverflow.com/questions/51927885/flutter-back-button-with-return-data). code snippet from Deepak Thakur ``` class DetailsClassWhichYouWantToPop { final String date; final String amount; DetailsClassWhichYouWantToPop(this.date, this.amount); ...
57,370,750
In the [G Suite Developer Hub](https://script.google.com), under `My Projects > "insert project name here" > PROJECT DETAILS > Failed executions`, I keep seeing a status "failed" for the function `onOpen`. My script uses `onOpen` to add menu items for the add-on, nothing complicated, so I'm sure that there is no probl...
2019/08/06
[ "https://Stackoverflow.com/questions/57370750", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
You can `pop` in two ways: ``` Navigator.of(context).pop(object); ``` or ``` Navigator.pop(context, object); ``` Either way, I've flagged with `object` the **optional** return value for the method. If you desire to return more than one values, you'll need to box them in an object, `class` or `Map` or whatever. ...
To be able to return multiple values via `Navigator.pop()` you could do 2 things (surely even more ways but those are some basic ones): **1. Creating a model holding those data:** ```dart class YourClass { String firstVar; String secondVar; int thirdVar; News( {this.firstVar, this.secondVar, ...
57,370,750
In the [G Suite Developer Hub](https://script.google.com), under `My Projects > "insert project name here" > PROJECT DETAILS > Failed executions`, I keep seeing a status "failed" for the function `onOpen`. My script uses `onOpen` to add menu items for the add-on, nothing complicated, so I'm sure that there is no probl...
2019/08/06
[ "https://Stackoverflow.com/questions/57370750", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
To be able to return multiple values via `Navigator.pop()` you could do 2 things (surely even more ways but those are some basic ones): **1. Creating a model holding those data:** ```dart class YourClass { String firstVar; String secondVar; int thirdVar; News( {this.firstVar, this.secondVar, ...
Make a new data structure class containing all data. You can also use map or list, but it will be a possible bug source if data structure changes.
57,370,750
In the [G Suite Developer Hub](https://script.google.com), under `My Projects > "insert project name here" > PROJECT DETAILS > Failed executions`, I keep seeing a status "failed" for the function `onOpen`. My script uses `onOpen` to add menu items for the add-on, nothing complicated, so I'm sure that there is no probl...
2019/08/06
[ "https://Stackoverflow.com/questions/57370750", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
You can use Map ``` final data = { "key1" : "value1", "key2" : "value2" }; Navigator.of(context).pop(data); ```
Similar question [Flutter Back button with return data](https://stackoverflow.com/questions/51927885/flutter-back-button-with-return-data). code snippet from Deepak Thakur ``` class DetailsClassWhichYouWantToPop { final String date; final String amount; DetailsClassWhichYouWantToPop(this.date, this.amount); ...
14,937,381
I'm running a certain Java program, with its `-Xmx` higher than `-Xms`, i.e. its heap can grow. The heap size at execution end is (IIRC) not the maximum used during the run. * How can I get the current heap size? * How can I get the maximum heap size over the course of the run, other than periodically polling the curr...
2013/02/18
[ "https://Stackoverflow.com/questions/14937381", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1593077/" ]
// Get current size of heap in bytes ``` long heapSize = Runtime.getRuntime().totalMemory(); ``` // Get maximum size of heap in bytes. The heap cannot grow beyond this size.// Any attempt will result in an OutOfMemoryException. ``` long heapMaxSize = Runtime.getRuntime().maxMemory(); ``` // Get amount of free me...
See runtime info: ``` Runtime.getRuntime().maxMemory(); Runtime.getRuntime().totalMemory(); Runtime.getRuntime().freeMemory(); ```
14,937,381
I'm running a certain Java program, with its `-Xmx` higher than `-Xms`, i.e. its heap can grow. The heap size at execution end is (IIRC) not the maximum used during the run. * How can I get the current heap size? * How can I get the maximum heap size over the course of the run, other than periodically polling the curr...
2013/02/18
[ "https://Stackoverflow.com/questions/14937381", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1593077/" ]
// Get current size of heap in bytes ``` long heapSize = Runtime.getRuntime().totalMemory(); ``` // Get maximum size of heap in bytes. The heap cannot grow beyond this size.// Any attempt will result in an OutOfMemoryException. ``` long heapMaxSize = Runtime.getRuntime().maxMemory(); ``` // Get amount of free me...
Get current heap size: ``` public static long getHeapSize(){ int mb = 1024*1024; //Getting the runtime reference from system Runtime runtime = Runtime.getRuntime(); return ((runtime.totalMemory() - runtime.freeMemory()) / mb); } ```
14,937,381
I'm running a certain Java program, with its `-Xmx` higher than `-Xms`, i.e. its heap can grow. The heap size at execution end is (IIRC) not the maximum used during the run. * How can I get the current heap size? * How can I get the maximum heap size over the course of the run, other than periodically polling the curr...
2013/02/18
[ "https://Stackoverflow.com/questions/14937381", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1593077/" ]
If you want to inspect it from your program itself, use the methods of the [Runtime](http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Runtime.html) class: ``` Runtime.getRuntime().freeMemory() Runtime.getRuntime().maxMemory() ``` If it is ok for you to inspect the heap size from outside your program, you shoul...
See runtime info: ``` Runtime.getRuntime().maxMemory(); Runtime.getRuntime().totalMemory(); Runtime.getRuntime().freeMemory(); ```
14,937,381
I'm running a certain Java program, with its `-Xmx` higher than `-Xms`, i.e. its heap can grow. The heap size at execution end is (IIRC) not the maximum used during the run. * How can I get the current heap size? * How can I get the maximum heap size over the course of the run, other than periodically polling the curr...
2013/02/18
[ "https://Stackoverflow.com/questions/14937381", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1593077/" ]
// Get current size of heap in bytes ``` long heapSize = Runtime.getRuntime().totalMemory(); ``` // Get maximum size of heap in bytes. The heap cannot grow beyond this size.// Any attempt will result in an OutOfMemoryException. ``` long heapMaxSize = Runtime.getRuntime().maxMemory(); ``` // Get amount of free me...
Combination of `jps` and `jstat` command is really powerful enough to track your java memory details. Use the `jps` command to get the pid of your java process and use `jstat $pid` to get the details of your java program. Now you can run them in a loop and closely moniter the memory detatils of your java program. You...
14,937,381
I'm running a certain Java program, with its `-Xmx` higher than `-Xms`, i.e. its heap can grow. The heap size at execution end is (IIRC) not the maximum used during the run. * How can I get the current heap size? * How can I get the maximum heap size over the course of the run, other than periodically polling the curr...
2013/02/18
[ "https://Stackoverflow.com/questions/14937381", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1593077/" ]
The other answers provide the mechanics of doing via Runtime.getRuntime().totalMemory() and maxMemory(), but be VERY careful - the answer given will be true at a given instant only. After a GC, the totalMemory() will change (downwards!). You can't have a perfectly accurate view of "how many live objects there are in th...
See runtime info: ``` Runtime.getRuntime().maxMemory(); Runtime.getRuntime().totalMemory(); Runtime.getRuntime().freeMemory(); ```
14,937,381
I'm running a certain Java program, with its `-Xmx` higher than `-Xms`, i.e. its heap can grow. The heap size at execution end is (IIRC) not the maximum used during the run. * How can I get the current heap size? * How can I get the maximum heap size over the course of the run, other than periodically polling the curr...
2013/02/18
[ "https://Stackoverflow.com/questions/14937381", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1593077/" ]
If you want to inspect it from your program itself, use the methods of the [Runtime](http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Runtime.html) class: ``` Runtime.getRuntime().freeMemory() Runtime.getRuntime().maxMemory() ``` If it is ok for you to inspect the heap size from outside your program, you shoul...
Combination of `jps` and `jstat` command is really powerful enough to track your java memory details. Use the `jps` command to get the pid of your java process and use `jstat $pid` to get the details of your java program. Now you can run them in a loop and closely moniter the memory detatils of your java program. You...
14,937,381
I'm running a certain Java program, with its `-Xmx` higher than `-Xms`, i.e. its heap can grow. The heap size at execution end is (IIRC) not the maximum used during the run. * How can I get the current heap size? * How can I get the maximum heap size over the course of the run, other than periodically polling the curr...
2013/02/18
[ "https://Stackoverflow.com/questions/14937381", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1593077/" ]
The other answers provide the mechanics of doing via Runtime.getRuntime().totalMemory() and maxMemory(), but be VERY careful - the answer given will be true at a given instant only. After a GC, the totalMemory() will change (downwards!). You can't have a perfectly accurate view of "how many live objects there are in th...
Combination of `jps` and `jstat` command is really powerful enough to track your java memory details. Use the `jps` command to get the pid of your java process and use `jstat $pid` to get the details of your java program. Now you can run them in a loop and closely moniter the memory detatils of your java program. You...
14,937,381
I'm running a certain Java program, with its `-Xmx` higher than `-Xms`, i.e. its heap can grow. The heap size at execution end is (IIRC) not the maximum used during the run. * How can I get the current heap size? * How can I get the maximum heap size over the course of the run, other than periodically polling the curr...
2013/02/18
[ "https://Stackoverflow.com/questions/14937381", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1593077/" ]
Get current heap size: ``` public static long getHeapSize(){ int mb = 1024*1024; //Getting the runtime reference from system Runtime runtime = Runtime.getRuntime(); return ((runtime.totalMemory() - runtime.freeMemory()) / mb); } ```
Combination of `jps` and `jstat` command is really powerful enough to track your java memory details. Use the `jps` command to get the pid of your java process and use `jstat $pid` to get the details of your java program. Now you can run them in a loop and closely moniter the memory detatils of your java program. You...
14,937,381
I'm running a certain Java program, with its `-Xmx` higher than `-Xms`, i.e. its heap can grow. The heap size at execution end is (IIRC) not the maximum used during the run. * How can I get the current heap size? * How can I get the maximum heap size over the course of the run, other than periodically polling the curr...
2013/02/18
[ "https://Stackoverflow.com/questions/14937381", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1593077/" ]
Get current heap size: ``` public static long getHeapSize(){ int mb = 1024*1024; //Getting the runtime reference from system Runtime runtime = Runtime.getRuntime(); return ((runtime.totalMemory() - runtime.freeMemory()) / mb); } ```
See runtime info: ``` Runtime.getRuntime().maxMemory(); Runtime.getRuntime().totalMemory(); Runtime.getRuntime().freeMemory(); ```
14,937,381
I'm running a certain Java program, with its `-Xmx` higher than `-Xms`, i.e. its heap can grow. The heap size at execution end is (IIRC) not the maximum used during the run. * How can I get the current heap size? * How can I get the maximum heap size over the course of the run, other than periodically polling the curr...
2013/02/18
[ "https://Stackoverflow.com/questions/14937381", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1593077/" ]
// Get current size of heap in bytes ``` long heapSize = Runtime.getRuntime().totalMemory(); ``` // Get maximum size of heap in bytes. The heap cannot grow beyond this size.// Any attempt will result in an OutOfMemoryException. ``` long heapMaxSize = Runtime.getRuntime().maxMemory(); ``` // Get amount of free me...
If you want to inspect it from your program itself, use the methods of the [Runtime](http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Runtime.html) class: ``` Runtime.getRuntime().freeMemory() Runtime.getRuntime().maxMemory() ``` If it is ok for you to inspect the heap size from outside your program, you shoul...
56,249,472
Regex search fails to get a string from match object when being used in a for loop. ``` row_values = result_script_name.split('^') for row in row_values: table_name = re.search(r"(?<=')(.*)(?=')", row).group(0) ``` > > AttributeError: 'NoneType' object has no attribute 'group' > > > But the same reg...
2019/05/22
[ "https://Stackoverflow.com/questions/56249472", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5509319/" ]
I believe what is happening is that certain rows do not match at all, and therefore you are trying to access a capture group (the zeroth one, in this case), which does not even exist. Here is the pattern you should be using: ``` input = "^WORKFLOW_NAME='lifetime'" match = re.search(r"(?<=')(.*)(?=')", input) if match:...
Here, we might want to simplify our expression, maybe to something similar to: ``` .+?'(.+?)' ``` where our data is saved in the capturing group `\\1` ### Test ``` # coding=utf8 # the above tag defines encoding for this document and is for Python 2.x compatibility import re regex = r".+'(.+?)'" test_str = "^WOR...
63,981,610
I'm using the Alfresco Rest API from a Laravel application! To do so, I use the laravel guzzlehttp/guzzle package. Below is my code. When I run it, I get a status 400 The documentation of my endpoint can be found here: <https://api-explorer.alfresco.com/api-explorer/#!/nodes/createNode> ```php // AlfrescoService....
2020/09/20
[ "https://Stackoverflow.com/questions/63981610", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13005348/" ]
I dont understand why you have used $querytype but as you have asked in your heading "How to upload file using Laravel Guzzle HTTP client", so here is the answer for that, ``` public static function request2($queryType, String $query, array $data=[]) { $file = fopen('alfresco/doc.txt', 'r') $resp...
The response should mention what precipitated the bad request. You may try [wireshark](https://www.wireshark.org/docs/wsug_html_chunked/ChapterIntroduction.html) to capture the upload attempt and compare it with the curl examples [here](https://docs.alfresco.com/6.1/concepts/dev-api-by-language-alf-rest-upload-file.htm...
47,299,856
I have downloaded kernel and the kernel resides in folder called Linux-2.6.32.28 in which I can find /Kernel/Kthread.c I found Kthread.c but I cannot find pthread.c in Linux-2.6.32.28 I found Kthread.c in Linux-3.13/Kernel and Linux-4.7.2/Kernel locate pthread.c finds file pthread.c in Computer/usr folder that comes w...
2017/11/15
[ "https://Stackoverflow.com/questions/47299856", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2657070/" ]
Read first [pthreads(7)](http://man7.org/linux/man-pages/man7/pthreads.7.html). It explains you that pthreads are implemented in the [C standard library](https://en.wikipedia.org/wiki/C_standard_library) as [nptl(7)](http://man7.org/linux/man-pages/man7/nptl.7.html). The C standard library is the cornerstone of Linux ...
pthread is POSIX thread. It is a library that helps application to create threads in OS. Kthread in kernel source code is for kernel threads in linux. POSIX is a standard defined by IEEE to maintain the compatibility between different OS. So pthread source code cannot be seen in linux kernel source code. you may ref...
47,299,856
I have downloaded kernel and the kernel resides in folder called Linux-2.6.32.28 in which I can find /Kernel/Kthread.c I found Kthread.c but I cannot find pthread.c in Linux-2.6.32.28 I found Kthread.c in Linux-3.13/Kernel and Linux-4.7.2/Kernel locate pthread.c finds file pthread.c in Computer/usr folder that comes w...
2017/11/15
[ "https://Stackoverflow.com/questions/47299856", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2657070/" ]
Regarding your second cluster of questions: Everything a computer does is ultimately done by hardware. But we can make some distinctions between different *kinds* of hardware within the computer, and different kinds of programs interacting with them in different ways. A modern computer can be divided into three major ...
pthread is POSIX thread. It is a library that helps application to create threads in OS. Kthread in kernel source code is for kernel threads in linux. POSIX is a standard defined by IEEE to maintain the compatibility between different OS. So pthread source code cannot be seen in linux kernel source code. you may ref...
47,299,856
I have downloaded kernel and the kernel resides in folder called Linux-2.6.32.28 in which I can find /Kernel/Kthread.c I found Kthread.c but I cannot find pthread.c in Linux-2.6.32.28 I found Kthread.c in Linux-3.13/Kernel and Linux-4.7.2/Kernel locate pthread.c finds file pthread.c in Computer/usr folder that comes w...
2017/11/15
[ "https://Stackoverflow.com/questions/47299856", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2657070/" ]
Read first [pthreads(7)](http://man7.org/linux/man-pages/man7/pthreads.7.html). It explains you that pthreads are implemented in the [C standard library](https://en.wikipedia.org/wiki/C_standard_library) as [nptl(7)](http://man7.org/linux/man-pages/man7/nptl.7.html). The C standard library is the cornerstone of Linux ...
Regarding your second cluster of questions: Everything a computer does is ultimately done by hardware. But we can make some distinctions between different *kinds* of hardware within the computer, and different kinds of programs interacting with them in different ways. A modern computer can be divided into three major ...
8,595,277
I'm trying to access a samba share that requires authentication. I do not want the drive to be mapped. I currently have this working with samba shares that the host-name is registered with the DNS. It will not work with a plain IP address. I've done some work rounds to make it work in the mean time (adding to windo...
2011/12/21
[ "https://Stackoverflow.com/questions/8595277", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1036267/" ]
Linq to objects's deferred execution works differently than linq-to-sql's (and EF's). With linq-to-objects, the method chain will be executed in the order that the methods are listed—it doesn't use expression trees to store and translate the whole thing. Calling `OrderBy` *then* `Where` with linq-to-objects will, whe...
Because, with LINQ for SQL, the SQL grammar for SELECT mandates that the different clauses occur in a particular sequence. The compiler must generate grammatically correct SQL. Applying LINQ for objects on an IEnumerable involves iterating over the IEnumerable and applying a sequence of actions to each object in the I...
8,595,277
I'm trying to access a samba share that requires authentication. I do not want the drive to be mapped. I currently have this working with samba shares that the host-name is registered with the DNS. It will not work with a plain IP address. I've done some work rounds to make it work in the mean time (adding to windo...
2011/12/21
[ "https://Stackoverflow.com/questions/8595277", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1036267/" ]
> > Why it doesn't work this way with LINQ to objects? > > > LINQ to Objects doesn't use expression trees. The statement is directly turned into a series of method calls, each of which runs as a normal C# method. As such, the following in LINQ to Objects: ``` var results = collection.OrderBy(x => x.Id) ...
Linq to objects's deferred execution works differently than linq-to-sql's (and EF's). With linq-to-objects, the method chain will be executed in the order that the methods are listed—it doesn't use expression trees to store and translate the whole thing. Calling `OrderBy` *then* `Where` with linq-to-objects will, whe...
8,595,277
I'm trying to access a samba share that requires authentication. I do not want the drive to be mapped. I currently have this working with samba shares that the host-name is registered with the DNS. It will not work with a plain IP address. I've done some work rounds to make it work in the mean time (adding to windo...
2011/12/21
[ "https://Stackoverflow.com/questions/8595277", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1036267/" ]
Linq to objects's deferred execution works differently than linq-to-sql's (and EF's). With linq-to-objects, the method chain will be executed in the order that the methods are listed—it doesn't use expression trees to store and translate the whole thing. Calling `OrderBy` *then* `Where` with linq-to-objects will, whe...
Linq to Objects does not reorder to avoid a would-be run-time step to do something that should be optimized at coding time. The resharpers of the world may at some point introduce code analysis tools to smoke out optimization opportunities like this, but it is definitely not a job for the runtime.
8,595,277
I'm trying to access a samba share that requires authentication. I do not want the drive to be mapped. I currently have this working with samba shares that the host-name is registered with the DNS. It will not work with a plain IP address. I've done some work rounds to make it work in the mean time (adding to windo...
2011/12/21
[ "https://Stackoverflow.com/questions/8595277", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1036267/" ]
Linq to objects's deferred execution works differently than linq-to-sql's (and EF's). With linq-to-objects, the method chain will be executed in the order that the methods are listed—it doesn't use expression trees to store and translate the whole thing. Calling `OrderBy` *then* `Where` with linq-to-objects will, whe...
It's perfectly legal to use side-effecting operations. Compare: ``` "crabapple" .OrderBy(c => { Console.Write(c); return c; }) .Where(c => { Console.Write(c); return c > 'c'; }) .Count(); "crabapple" .Where(c => { Console.Write(c); return c > 'c'; }) .OrderBy(c => { Console.Write(c); return c; }) ...
8,595,277
I'm trying to access a samba share that requires authentication. I do not want the drive to be mapped. I currently have this working with samba shares that the host-name is registered with the DNS. It will not work with a plain IP address. I've done some work rounds to make it work in the mean time (adding to windo...
2011/12/21
[ "https://Stackoverflow.com/questions/8595277", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1036267/" ]
> > Why it doesn't work this way with LINQ to objects? > > > LINQ to Objects doesn't use expression trees. The statement is directly turned into a series of method calls, each of which runs as a normal C# method. As such, the following in LINQ to Objects: ``` var results = collection.OrderBy(x => x.Id) ...
Because, with LINQ for SQL, the SQL grammar for SELECT mandates that the different clauses occur in a particular sequence. The compiler must generate grammatically correct SQL. Applying LINQ for objects on an IEnumerable involves iterating over the IEnumerable and applying a sequence of actions to each object in the I...
8,595,277
I'm trying to access a samba share that requires authentication. I do not want the drive to be mapped. I currently have this working with samba shares that the host-name is registered with the DNS. It will not work with a plain IP address. I've done some work rounds to make it work in the mean time (adding to windo...
2011/12/21
[ "https://Stackoverflow.com/questions/8595277", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1036267/" ]
Because, with LINQ for SQL, the SQL grammar for SELECT mandates that the different clauses occur in a particular sequence. The compiler must generate grammatically correct SQL. Applying LINQ for objects on an IEnumerable involves iterating over the IEnumerable and applying a sequence of actions to each object in the I...
Linq to Objects does not reorder to avoid a would-be run-time step to do something that should be optimized at coding time. The resharpers of the world may at some point introduce code analysis tools to smoke out optimization opportunities like this, but it is definitely not a job for the runtime.
8,595,277
I'm trying to access a samba share that requires authentication. I do not want the drive to be mapped. I currently have this working with samba shares that the host-name is registered with the DNS. It will not work with a plain IP address. I've done some work rounds to make it work in the mean time (adding to windo...
2011/12/21
[ "https://Stackoverflow.com/questions/8595277", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1036267/" ]
> > Why it doesn't work this way with LINQ to objects? > > > LINQ to Objects doesn't use expression trees. The statement is directly turned into a series of method calls, each of which runs as a normal C# method. As such, the following in LINQ to Objects: ``` var results = collection.OrderBy(x => x.Id) ...
Linq to Objects does not reorder to avoid a would-be run-time step to do something that should be optimized at coding time. The resharpers of the world may at some point introduce code analysis tools to smoke out optimization opportunities like this, but it is definitely not a job for the runtime.
8,595,277
I'm trying to access a samba share that requires authentication. I do not want the drive to be mapped. I currently have this working with samba shares that the host-name is registered with the DNS. It will not work with a plain IP address. I've done some work rounds to make it work in the mean time (adding to windo...
2011/12/21
[ "https://Stackoverflow.com/questions/8595277", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1036267/" ]
> > Why it doesn't work this way with LINQ to objects? > > > LINQ to Objects doesn't use expression trees. The statement is directly turned into a series of method calls, each of which runs as a normal C# method. As such, the following in LINQ to Objects: ``` var results = collection.OrderBy(x => x.Id) ...
It's perfectly legal to use side-effecting operations. Compare: ``` "crabapple" .OrderBy(c => { Console.Write(c); return c; }) .Where(c => { Console.Write(c); return c > 'c'; }) .Count(); "crabapple" .Where(c => { Console.Write(c); return c > 'c'; }) .OrderBy(c => { Console.Write(c); return c; }) ...
8,595,277
I'm trying to access a samba share that requires authentication. I do not want the drive to be mapped. I currently have this working with samba shares that the host-name is registered with the DNS. It will not work with a plain IP address. I've done some work rounds to make it work in the mean time (adding to windo...
2011/12/21
[ "https://Stackoverflow.com/questions/8595277", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1036267/" ]
It's perfectly legal to use side-effecting operations. Compare: ``` "crabapple" .OrderBy(c => { Console.Write(c); return c; }) .Where(c => { Console.Write(c); return c > 'c'; }) .Count(); "crabapple" .Where(c => { Console.Write(c); return c > 'c'; }) .OrderBy(c => { Console.Write(c); return c; }) ...
Linq to Objects does not reorder to avoid a would-be run-time step to do something that should be optimized at coding time. The resharpers of the world may at some point introduce code analysis tools to smoke out optimization opportunities like this, but it is definitely not a job for the runtime.
1,329,237
I would like to know, whether it's possible to use two ordinary PC/ATX power supplies safely in one machine. I've heard about *Add2Psu* board, but I have a very severe objections about it. (The power on molex from 1st PSU, shorts PWR\_ON on 2nd PSU via relay.) I would like to build something like that, but maybe in a...
2018/06/06
[ "https://superuser.com/questions/1329237", "https://superuser.com", "https://superuser.com/users/762374/" ]
There may be issues because power supplies are *regulated*. If two were paralleled, and one line had, for example, 4.99 V and the other had 5.00 V, both well within tolerance, one PS would be trying to force current backward, while the other tries to limit the voltage. At the best, the full load would be carried by one...
Both PSU’s must be earth bonded for EMC reasons therefore cannot be galvanically isolated. The ground noise must be minimal and voltages within tolerance, so wire leads must be similar. **Any** delay to trigger power OK should not pose any issues. This triggers Power On Reset then jumps to BIOS. This AUX12V must be pr...
1,329,237
I would like to know, whether it's possible to use two ordinary PC/ATX power supplies safely in one machine. I've heard about *Add2Psu* board, but I have a very severe objections about it. (The power on molex from 1st PSU, shorts PWR\_ON on 2nd PSU via relay.) I would like to build something like that, but maybe in a...
2018/06/06
[ "https://superuser.com/questions/1329237", "https://superuser.com", "https://superuser.com/users/762374/" ]
There may be issues because power supplies are *regulated*. If two were paralleled, and one line had, for example, 4.99 V and the other had 5.00 V, both well within tolerance, one PS would be trying to force current backward, while the other tries to limit the voltage. At the best, the full load would be carried by one...
I currently have 2 different PSU's connected.. I have the green power-on hardlinked so one powersupply is on once I switch the power on, Its been removed from the powerbox case, and the bare parts are installed into, where the CD rom or DVD drive would have been.. I have the the ground connected to each other.. VITA...
1,329,237
I would like to know, whether it's possible to use two ordinary PC/ATX power supplies safely in one machine. I've heard about *Add2Psu* board, but I have a very severe objections about it. (The power on molex from 1st PSU, shorts PWR\_ON on 2nd PSU via relay.) I would like to build something like that, but maybe in a...
2018/06/06
[ "https://superuser.com/questions/1329237", "https://superuser.com", "https://superuser.com/users/762374/" ]
Both PSU’s must be earth bonded for EMC reasons therefore cannot be galvanically isolated. The ground noise must be minimal and voltages within tolerance, so wire leads must be similar. **Any** delay to trigger power OK should not pose any issues. This triggers Power On Reset then jumps to BIOS. This AUX12V must be pr...
I currently have 2 different PSU's connected.. I have the green power-on hardlinked so one powersupply is on once I switch the power on, Its been removed from the powerbox case, and the bare parts are installed into, where the CD rom or DVD drive would have been.. I have the the ground connected to each other.. VITA...
5,953,978
I need to create a method for listening to events and waiting for a certain amount of silence before calling another function. Specifically, I am listening to a directory for file updates. When a file change occurs, my "directoryUpdate" function is called. From there I add the file to a list and create a thread called...
2011/05/10
[ "https://Stackoverflow.com/questions/5953978", "https://Stackoverflow.com", "https://Stackoverflow.com/users/110129/" ]
You could just use an AutoResetEvent and wait 2 seconds on it. If the event is triggered then you loop and wait another 2 seconds. ``` AutoResetEvent resetTimer = new AutoResetEvent(false); ... private void TimerJob() { ... // The thread will sleep and loop un...
One way of doing this would be to add each updated file to a list along with a timestamp of when they were added. Then, when your 2-second Timer fires, you can check for any items in the list that have a timestamp older than the last time it fired.
5,953,978
I need to create a method for listening to events and waiting for a certain amount of silence before calling another function. Specifically, I am listening to a directory for file updates. When a file change occurs, my "directoryUpdate" function is called. From there I add the file to a list and create a thread called...
2011/05/10
[ "https://Stackoverflow.com/questions/5953978", "https://Stackoverflow.com", "https://Stackoverflow.com/users/110129/" ]
You could just use an AutoResetEvent and wait 2 seconds on it. If the event is triggered then you loop and wait another 2 seconds. ``` AutoResetEvent resetTimer = new AutoResetEvent(false); ... private void TimerJob() { ... // The thread will sleep and loop un...
Hey Jono, This is actually a really fun problem. If I understand correctly you're using the FileSystemWatcher or some other similar object to monitor a folder. Each time a file is added or changes, you receive an event. Now the problem is that this event can be raised at relatively random times, and if you're trying...
5,953,978
I need to create a method for listening to events and waiting for a certain amount of silence before calling another function. Specifically, I am listening to a directory for file updates. When a file change occurs, my "directoryUpdate" function is called. From there I add the file to a list and create a thread called...
2011/05/10
[ "https://Stackoverflow.com/questions/5953978", "https://Stackoverflow.com", "https://Stackoverflow.com/users/110129/" ]
You could just use an AutoResetEvent and wait 2 seconds on it. If the event is triggered then you loop and wait another 2 seconds. ``` AutoResetEvent resetTimer = new AutoResetEvent(false); ... private void TimerJob() { ... // The thread will sleep and loop un...
I am going to assume that you are using the `FileSystemWatcher` class to monitor for file system changes. Your problem is well suited for the producer-consumer pattern. In your case the producer is the `FileSystemWatcher` which will add changed files to a queue. The consumer will then dequeue the file names from the qu...
8,871,727
I am trying to convert nsstring to nsdate and then to the systemtimezone. Is my code right? Any help appreciated. ``` NSString *str=@"2012-01-15 06:27:42"; NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; [NSDateFormatter setDefaultFormatterBehavior:NSDateFormatterBehaviorDefault]; [dateFormatter se...
2012/01/15
[ "https://Stackoverflow.com/questions/8871727", "https://Stackoverflow.com", "https://Stackoverflow.com/users/235532/" ]
I *think* I can see what the problem is here - it's this line: ``` NSTimeZone* sourceTimeZone = [NSTimeZone timeZoneWithAbbreviation:@"GMT-07:00"]; ``` `GMT-07:00` is not a valid abbreviation for this method. If you call `[NSTimeZone abbreviationDictionary]` you'll get a dictionary containing all available abbreviat...
The list above of “supported" abbreviations is also an abbreviated list.. if you want to see a fairly complete list, here is some code to generate it: (and a small part of the output below to show some that are not in the list above) unfortunately the OS will not use these extra zones) you’ll have to do a conversion ...