Puppeteer - get parent element

Question: I'm trying to click on one value (odds) based on the name of the other element but those two need to be inside a specific parent element which I get by the text inside it.
The snippet below can be found multiple times on the same page with the same classes so targeting by class is not an option.
I first need to get a container with text "1st Goal. Then I need to get it's parent and in the parent, I need to get the second div element (class parent2). That element holds other elements. Let's imagine I need to get the element of value 200 and click on it.
I've tried using parentElement, parentNode but always get the 'undefiend' when getting a parent of the child element, although the child element is retrieved successfully. I just can't get the parent from where I could go down the tree to the desired element and click on it.

1st Goal

Malaga200

No 1st Goal300

Las Palmas400

Comment: Can you post the code that you tried to execute in `puppeteer`?
Comment: You said "in Chrome it works"...but you might try actually running `puppeteer` in non-headless mode. In your [jest-puppeteer.config.js file](https://github.com/smooth-code/jest-puppeteer#configure-puppeteer), you can set `headless:false` and `devtools: true`.
Comment: Did you try running your selector in the Chrome DevConsole to see if it works outside puppeteer?
Comment: @Cristy Yes I did, in Chrome it works.
Answer: const parent_node = await child_node.getProperty('parentNode')

You can try this one
Answer: XPath expressions
If you are okay with using XPath expression, you can use the following statement:
//div[contains(@class, "group") and contains(., "1st Goal")]/div[@class="parent2"]//span[@class="odds"]

This XPath expression queries for a div element having the class group and containing the text 1st Goal somewhere. Then it will query the children div with the class parent2 and query span elements with class odds inside.
Usage within puppeteer
To get the element with puppeteer, use the page.$x function. To click the element, use elementHandle.click.
Putting all together, the code looks like this:
const [targetElement] = await page.$x('//div[contains(@class, "group") and contains(., "1st Goal")]/div[@class="parent2"]//span[@class="odds"]');
await targetElement.click();

Puppeteer - get parent element


ratio, MSE of basic demand to MSE of aggregated demand for MA(1) process

Question: I have a basic demand series that follow MA(1) process,I've applied non-overlapping aggregation approach and then SES on both basic and aggregated series to obtain forecasts, and then I disaggregated forecasts resulted from aggregated series and finally I calculate ratio of MSEbasic/MSEdagg, where MSEbasic=Var(dt-ft) and MSEdagg=Var(dt-(FT/m), dt is basic series at time t, ft is forecast of basic series, FT is aggregated forecast and m is aggregation level and alpha is smoothing constant. this ratio shows that for highly negative value of Theta, basic approach works better and for the rest of Theta parameter aggregated approach works better, I'm trying to understand why aggregation does not work for high negative Theta,I was wondering if you guide me.
bests
Roji
Answer: Simple exponential smoothing, although a widely-used forecasting technique, is not always optimal.  It can be shown that it is optimal for an IMA(1,1) process:
$y_t - y_{t-1} = e_t - \theta e_{t-1}$
which is obviously not the same as the processes, either aggregated or otherwise, that you are dealing with.  Consequently, you can't expect too much!
More generally, as $\theta$ gets more negative, the correlation between two consecutive $y_t$ gets larger (more positive).  Aggregating highly positively correlated series doesn't do as much for you as aggregating less positively correlated series, all other things being equal, which they never are.  As a thought experiment, consider a case where the autocorrelation = 1, say, $y_{t+1} = y_t = 0$; clearly no level of aggregation will do you any good when forecasting.  Combining this with the suboptimal SES forecasting approach is resulting in the interesting table you've included in the question.
However, other forecasting approaches may give you substantially different results.  If you choose one that is optimal for an MA(1) process, and why not do so, then there won't be any point in aggregating, as you cannot gain information about the structure of the errors by aggregation.
Comment: many many thanks for your answer you said Aggregating highly positively correlated series doesn't do as much for you as aggregating less positively correlated series, but why? why aggregation works like this? could you please explain what do you mean by saying all other things?


Does "x per y" always refer to the arithmetic mean?

Question: I recognize that there are many types of averages.  That said, does "x per y" (e.g. visits per day) always refer specifically to the arithmetic mean?
For some context, I saw this recently where someone claimed the cited figure was actually in reference to a median.  While I think it might have been OK to use the median when declaring something as an average, it seems to me that it is clearly wrong to denote anything besides the arithmetic mean with "x per y."  This is highlighted by the common usage of "x/y" to indicate "x per  y."  Am I correct to always assume  usage of the arithmetic mean here?
EDIT: Apparently my original post was not entirely clear.  I am specifically referring to situations where y is unit of time, so clearly "x per y" is a frequency or a rate.  I would always interpret it as the (arithmetic) mean frequency or mean rate.  However, I saw somebody else interpret it as the median frequency (the median of the y discrete time intervals).
Comment: "x per y" is a *frequency,* not a mean.  Could you therefore elaborate on the sense in which people might be referring to medians or means?
Answer: x per y is a ratio. It's not a mean of any sort.  But taking the mean of ratios is dangerous in many situations. For example if you travel 240 miles at 60 miles per hour (x per y) and 240 miles at 40 miles per hour, your average speed is not 50 miles per hour. The first trip takes you 4 hours the second trip takes you 6 hours; total time is 10 hours, total distance is 480 miles, average speed is 48 mph.
So, please explain what you are trying to do.
Answer: whuber indicates that this is a frequency, which is the mean number of events at an instant. It is also a proportion, which is another perspective on a mean. The math is the same.
Perhaps the someone was referring to the median frequency, which could also be termed the median proportion or, more confusingly, the median mean.
An example: You measure each day the proportion of restaurant patrons who are female. This gives you a proportion/mean for each day. Perhaps you are interested in what the proportion is for a typical day. Maybe you do the median of this proportion rather than the mean.
In the example above, you arbitrarily chose median. If you are doing non-parametric statistics, then you would need to use the median.


iphone app crashes on first startup

Question: Just wondering why my newly made application crashes the first time I run it on my iPod but works every single time after that. I have been developing completely with storyboards, and so far I have no written any code. Could anyone please tell me how the fix the crash when I open my app for the first time?
Comment: Are you connecting your device with Mac and running the app in Xcode? There should be some additional error information printed in the Xcode debugger console. That will be helpful to spot the root cause.
Comment: Two questions: 1) When you run it the first time, are you doing so through XCode? 2) When you run it "every single time after that", are you again running through XCode or are you now tapping icon on device?
Comment: your app may not exist completely after the first time. You should kill the app from background.
Comment: I am running it from Xcode. It only crashes the first time, and even if i close the app from the multitask bar it will never crash again. Im just more sure what the problem is... Also, how do breakpoints help me here?
Comment: On, xcode, no bug report shows up, or do I have to manually open the crash reports?
Comment: mine crash on first compiled. Then can run it afterwards without any problem. What is happening?
Answer: If you are running your app in Xcode (connecting your device), you may add break point from Xcode. On the left panel, click on break point toolbar, press "+" to add Exception Breakpoint...
This will stop the in your app's code, at least you should have some controller codes related to your your storyboard views.
Comment: Sorry, I'm a beginner, but I don't understand how break points will help me here.
Comment: You want the program to stop as early as it has noticed a problem, and have it report what problem/exception it has encountered. Otherwise, the underlying cause could be buried under subsequent, unrelated issues (very likely in your case, since we're not seeing a meaningful error on console).

iphone app crashes on first startup


What is taxonomy/term/tid/*

Question: I'm first time seeing a link indexed by Google : taxonomy/term/10007/*  as in here.
What could be causing it?
I've already GlobalRedirect enabled, also not using the View "Taxonomy term" which emulates Drupal core's handling of taxonomy/term.
Answer: Removing the "*" from the path does trigger the redirection to the right page.
It seems to me the "*" is just confusing global redirect (maybe some setting not configured correctly in the module?), because the redirection is definitely not happening, and that might be the reason why google is indexing that.
I'd suggest double-checking the globalredirect settings in place.
Comment: I've checked - I've set only Default settings in the Globalredirect configuration.
Answer: The problem is your link rel="canonical" tag. It's setting the core taxonomy path in the href value.

link rel="canonical" tells search engines the canonical URL to use for search results. That needs to be fixed to resolve your indexing problem.
Are you use the metatag module? If so, some additional tweaks there should solve the problem.
Comment: If you're using Global Redirect, you should try the **Add Canonical Link** option if you haven't already. Failing that, I know the [metatag module](https://www.drupal.org/project/metatag) provides canonical URLs from path aliases.
Comment: No. Which is original source from where Google could have picked taxonomy/term/tid/* url?  And why Drupal is honouring this one?
Answer: Not sure but I guess enabling globalredirect module might solve your problem.
Comment: It is already enabled.

What is taxonomy/term/tid/*


Convolution of L1 & L2 function: definition

Question: A book that I'm reading makes the following statement that I'm not sure how to understand:
On $\mathbb R^n$, if $f\in L1$ and $g\in L2$, we have:
$$\widehat{f*g}=\hat f \hat g$$
How do I read it?
I know that the assumptions imply $\hat f$ is continuous and bounded, $\hat g\in L2$ so that the product on the right-hand side is a well-defined $L2$-function. Hence it is the Fourier transform of an $L2$-function $(\hat f \hat g\check{)}$ which, apparently, is equal to $f*g$.
For all I know it could be the definition of $f*g$ in this case. But is $f*g$ actually defined by an a.e. convergent integral as in the case $f,g\in L1$?
Answer: Hint: notice that in order to define $f\ast g$ it is enough to assume $f$ and $g$ measurable such that $y\mapsto f(x-y)g(y)$ is in $L^1$. (Of course it is sufficient to assume $f,g\in L^1$ by Young's theorem, but is not necessary.)
Comment: Posted before I'd finished typing...
Comment: Thanks, and sorry about the non-comment above. Technical mistake by me. Maybe I get it now - is it like this?
Suppose f, g positive. I want to show that $\int f(y)g(x-y) dy$ and that the resulting function of x is L2. So we integrate its square w.r.t. x:
$$\int |\int f(y)g(x-y) dy|^2 dx=\int \int \int f(y)f(z)g(x-y)g(x-z) dy dz dx$$ $$=\int f(y) f(z)\int\int g(x-y) g(x-z) dx dy dz\leq \int\int f(y)f(z) \|g\|_2^2 dy dz=\|f\|_1^2\|g\|_2^2$$
By Hölder.
Am i then correct in thinking that to show the equality in the question I should approximate g with functions in $L1\cap L2$?
Comment: your are correct!


BigDecimal recebe o valor de uma string

Question: Estou com a seguinte dúvida, de como realizar a soma de um BigDecimal com uma String.
String a = "8";
BigDecimal b = new BigDecimal(2);

Seria algo parecido com isto? b.add(a);
Obs: preciso que a lógica seja esta, apenas preciso saber como atribuir o valor de um BigDecimal de uma variável String.
Answer: String a = "8";
BigDecimal a2 = new BigDecimal(a);
BigDecimal b = new BigDecimal(2);
BigDecimal c = b.add(a2);

Comment: Não funciona, ao dar o valor da variavel a  ao BigDecimal a2 ele dá erro
Comment: @WerikyAlphazero Qual erro?
Comment: Fui eu que errei amigo, desculpe. Muito obrigado

BigDecimal recebe o valor de uma string


MVVMCross System.AggregateException 6.4 Xamarin Android

Question: I am in the process of updating from MVVMCross 5.7 to 6.4.
I have followed the StarWars example, but I'm running in an error while trying to start the android app. I always get a System.AggregateException on base.OnCreate(bundle);
This is my base project App and Custom AppStart

  public class App : MvxApplication
    {

        ///
        /// Initializes this instance.
        ///
        public override void Initialize()
        {
            CreatableTypes()
                .EndingWith("Service")
                .AsInterfaces()
                .RegisterAsLazySingleton();

            RegisterCustomAppStart<AppStart>();
        }
    }

public class AppStart : MvxAppStart
    {
        public AppStart(IMvxApplication app, IMvxNavigationService mvxNavigationService)
            : base(app, mvxNavigationService)
        {
        }

        protected override Task NavigateToFirstViewModel(object hint = null)
        {
            var token = Settings.Token;
            var skipIntro = Settings.SkipIntro;

            if (!skipIntro)
            {
                return NavigationService.Navigate<IntroViewModel>();

            }

            if (!string.IsNullOrEmpty(token))
            {
                return NavigationService.Navigate<MainViewModel>();
            }
            else
            {
                return NavigationService.Navigate<WelcomeViewModel>();

            }
        }

And this is my SplashScreen, Setup and MainApplication in the android project.
  [MvxActivityPresentation]
    [Activity(
        MainLauncher = true,
        Label = "@string/applicationName",
        Icon = "@drawable/icon_main",
        NoHistory = true,
        ScreenOrientation = ScreenOrientation.Portrait)]
    public class SplashScreenView : MvxSplashScreenActivity
    {
        ///
        /// Initializes a new instance of the <see cref="SplashScreenView"/> class.
        ///
        public SplashScreenView() : base(Resource.Layout.screen_splash)
        {
        }

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            ImageView img = FindViewById<ImageView>(Resource.Id.loadingImage);

            if (img != null)
            {
                img.SetBackgroundResource(Resource.Animation.loading_animation);

                // Get the background, which has been compiled to an AnimationDrawable object.
                AnimationDrawable frameAnimation = (AnimationDrawable)img.Background;

                // Start the animation (looped playback by default).
                frameAnimation.Start();
            }
        }
    }

 public class Setup : MvxAppCompatSetup<App>
    {
        private readonly object _applicationContext;

        ///
        /// Initializes a new instance of the <see cref="Setup"/> class.
        ///
        /// <param name="applicationContext">The application context.</param>

        protected override IEnumerable<Assembly> AndroidViewAssemblies => new List<Assembly>(base.AndroidViewAssemblies)
        {
            typeof(NavigationView).Assembly,
            typeof(CoordinatorLayout).Assembly,
            typeof(FloatingActionButton).Assembly,
            typeof(Toolbar).Assembly,
            typeof(DrawerLayout).Assembly,
            typeof(ViewPager).Assembly,
            typeof(MvxSwipeRefreshLayout).Assembly,
        };

        protected override IMvxAndroidViewPresenter CreateViewPresenter()
        {
            return new MvxAppCompatViewPresenter(AndroidViewAssemblies);
        }

        protected override void FillTargetFactories(IMvxTargetBindingFactoryRegistry registry)
        {

            MvxAppCompatSetupHelper.FillTargetFactories(registry);
            base.FillTargetFactories(registry);
        }

    }

 [Application]
    public class MainApplication : MvxAppCompatApplication<Setup, App>
    {

        public MainApplication()
        {
        }

        public MainApplication(IntPtr javaReference, JniHandleOwnership transfer)
            : base(javaReference, transfer)
        {
        }

    }

Whenever the application navigates to InfoViewModel it crashes with System.AggregateException:  error.
I am also including the InfoView file for reference.
   [MvxActivityPresentation]
    [Activity(Theme = "@style/Theme.Intro", Label = "", NoHistory = true)]
    public class IntroView : MvxAppCompatActivity<IntroViewModel>
    {
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            this.SetContentView(Resource.Layout.screen_intro);

            var video = FindViewById<VideoView>(Resource.Id.introVideoView);

            video.Touch += delegate(object sender, View.TouchEventArgs args) { ViewModel.SkipCommand.Execute(null); };
            video.Completion += delegate(object sender, EventArgs args) { ViewModel.SkipCommand.Execute(null); };

            var uri = Uri.Parse("android.resource://" + PackageName + "/" + Resource.Drawable.video_intro);
            video.SetVideoURI(uri);
            video.Start();
        }
    }

I am following exactly what happens in the StarWars example, however I couldn't manage to get it to run. Any suggestions or anything obvious that I still havent managed to see?
Kind regards,
EDIT:
Adding part of the stackTrace
2019-09-30 15:21:40 [TRACE] (MvvmCross.Core.MvxSetup) Setup: Create App
2019-09-30 15:21:40 [TRACE] (MvvmCross.Core.MvxSetup) Setup: NavigationService
09-30 15:21:40.514 I/mono-stdout(12097): 2019-09-30 15:21:40 [TRACE] (MvvmCross.Core.MvxSetup) Setup: NavigationService
09-30 15:21:40.569 I/mono-stdout(12097): 2019-09-30 15:21:40 [TRACE] (MvvmCross.Core.MvxSetup) Setup: Load navigation routes
2019-09-30 15:21:40 [TRACE] (MvvmCross.Core.MvxSetup) Setup: Load navigation routes
2019-09-30 15:21:40 [TRACE] (MvvmCross.Core.MvxSetup) Setup: App start
09-30 15:21:40.670 I/mono-stdout(12097): 2019-09-30 15:21:40 [TRACE] (MvvmCross.Core.MvxSetup) Setup: App start
09-30 15:21:40.687 I/mono-stdout(12097): 2019-09-30 15:21:40 [TRACE] (MvvmCross.Core.MvxSetup) Setup: Application Initialize - On background thread
2019-09-30 15:21:40 [TRACE] (MvvmCross.Core.MvxSetup) Setup: Application Initialize - On background thread
09-30 15:21:40.999 D/OpenGLRenderer(12097): Skia GL Pipeline
2019-09-30 15:21:41 [TRACE] (MvvmCross.Core.MvxSetup) Setup: ViewModelTypeFinder start
09-30 15:21:41.402 I/mono-stdout(12097): 2019-09-30 15:21:41 [TRACE] (MvvmCross.Core.MvxSetup) Setup: ViewModelTypeFinder start
09-30 15:21:41.680 D/Mono    (12097): Assembly Ref addref netstandard[0xe7d85c00] -> System[0xed847880]: 12
09-30 15:21:41.712 D/Mono    (12097): Assembly Ref addref netstandard[0xe7d85c00] -> System.Core[0xe63a5e00]: 6
09-30 15:21:41.780 D/Mono    (12097): Image addref System.Net.Http[0xe7d86800] -> System.Net.Http.dll[0xc8c64e00]: 2
09-30 15:21:41.781 D/Mono    (12097): Prepared to set up assembly 'System.Net.Http' (System.Net.Http.dll)
09-30 15:21:41.787 D/Mono    (12097): Assembly System.Net.Http[0xe7d86800] added to domain RootDomain, ref_count=1
09-30 15:21:41.851 I/Choreographer(12097): Skipped 30 frames!  The application may be doing too much work on its main thread.
09-30 15:21:41.913 D/Mono    (12097): AOT: image 'System.Net.Http.dll.so' not found: dlopen failed: library "/data/app/com.talkingmedicines.medsmart-353GoKCmCuAZwDW2_PDbJA==/lib/x86/libaot-System.Net.Http.dll.so" not found
09-30 15:21:41.914 D/Mono    (12097): AOT: image '/Users/builder/jenkins/workspace/xamarin-android-d15-9/xamarin-android/external/mono/sdks/out/android-x86-release/lib/mono/aot-cache/x86/System.Net.Http.dll.so' not found: dlopen failed: library "/data/app/com.talkingmedicines.medsmart-353GoKCmCuAZwDW2_PDbJA==/lib/x86/libaot-System.Net.Http.dll.so" not found
09-30 15:21:41.924 D/Mono    (12097): Config attempting to parse: 'System.Net.Http.dll.config'.
09-30 15:21:41.924 D/Mono    (12097): Config attempting to parse: '/Users/builder/jenkins/workspace/xamarin-android-d15-9/xamarin-android/external/mono/sdks/out/android-x86-release/etc/mono/assemblies/System.Net.Http/System.Net.Http.config'.
09-30 15:21:41.925 D/Mono    (12097): Assembly Ref addref netstandard[0xe7d85c00] -> System.Net.Http[0xe7d86800]: 2
09-30 15:21:41.925 D/Mono    (12097): Assembly Ref addref System.Net.Http[0xe7d86800] -> mscorlib[0xed8647c0]: 95
09-30 15:21:41.930 D/Mono    (12097): Assembly Ref addref MedSmart.App[0xe5f095a0] -> Newtonsoft.Json[0xe5f0a080]: 3
Loaded assembly: System.Net.Http.dll [External]
2019-09-30 15:21:42 [TRACE] (MvvmCross.Core.MvxSetup) Setup: ViewsContainer start
09-30 15:21:42.009 I/mono-stdout(12097): 2019-09-30 15:21:42 [TRACE] (MvvmCross.Core.MvxSetup) Setup: ViewsContainer start
2019-09-30 15:21:42 [TRACE] (MvvmCross.Core.MvxSetup) Setup: Lookup Dictionary start09-30 15:21:42.053 I/mono-stdout(12097): 2019-09-30 15:21:42 [TRACE] (MvvmCross.Core.MvxSetup) Setup: Lookup Dictionary start

09-30 15:21:42.364 D/        (12097): HostConnection::get() New Host Connection established 0xd1e5bb40, tid 12149
09-30 15:21:42.565 I/ConfigStore(12097): android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasWideColorDisplay retrieved: 0
09-30 15:21:42.568 I/ConfigStore(12097): android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasHDRDisplay retrieved: 0
09-30 15:21:42.568 I/OpenGLRenderer(12097): Initialized EGL, version 1.4
09-30 15:21:42.569 D/OpenGLRenderer(12097): Swap behavior 1
09-30 15:21:42.580 W/OpenGLRenderer(12097): Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
09-30 15:21:42.581 D/OpenGLRenderer(12097): Swap behavior 0
09-30 15:21:42.758 D/EGL_emulation(12097): eglCreateContext: 0xe7d86aa0: maj 3 min 0 rcv 3
09-30 15:21:42.769 D/Mono    (12097): Image addref System.Runtime.Serialization[0xe7d86fe0] -> System.Runtime.Serialization.dll[0xc8c65d00]: 2
09-30 15:21:42.769 D/Mono    (12097): Prepared to set up assembly 'System.Runtime.Serialization' (System.Runtime.Serialization.dll)
09-30 15:21:42.769 D/Mono    (12097): Assembly System.Runtime.Serialization[0xe7d86fe0] added to domain RootDomain, ref_count=1
09-30 15:21:42.785 D/EGL_emulation(12097): eglMakeCurrent: 0xe7d86aa0: ver 3 0 (tinfo 0xc8b7eda0)
09-30 15:21:42.810 D/Mono    (12097): AOT: image 'System.Runtime.Serialization.dll.so' not found: dlopen failed: library "/data/app/com.talkingmedicines.medsmart-353GoKCmCuAZwDW2_PDbJA==/lib/x86/libaot-System.Runtime.Serialization.dll.so" not found
09-30 15:21:42.811 D/Mono    (12097): AOT: image '/Users/builder/jenkins/workspace/xamarin-android-d15-9/xamarin-android/external/mono/sdks/out/android-x86-release/lib/mono/aot-cache/x86/System.Runtime.Serialization.dll.so' not found: dlopen failed: library "/data/app/com.talkingmedicines.medsmart-353GoKCmCuAZwDW2_PDbJA==/lib/x86/libaot-System.Runtime.Serialization.dll.so" not found
09-30 15:21:42.811 D/Mono    (12097): Config attempting to parse: 'System.Runtime.Serialization.dll.config'.
09-30 15:21:42.811 D/Mono    (12097): Config attempting to parse: '/Users/builder/jenkins/workspace/xamarin-android-d15-9/xamarin-android/external/mono/sdks/out/android-x86-release/etc/mono/assemblies/System.Runtime.Serialization/System.Runtime.Serialization.config'.
09-30 15:21:42.811 D/Mono    (12097): Assembly Ref addref Mono.Android[0xe63a5c20] -> System.Runtime.Serialization[0xe7d86fe0]: 2
09-30 15:21:42.819 D/Mono    (12097): Assembly Ref addref System.Runtime.Serialization[0xe7d86fe0] -> mscorlib[0xed8647c0]: 96
Loaded assembly: System.Runtime.Serialization.dll [External]
09-30 15:21:43.977 D/EGL_emulation(12097): eglMakeCurrent: 0xe7d86aa0: ver 3 0 (tinfo 0xc8b7eda0)
09-30 15:21:44.888 I/OpenGLRenderer(12097): Davey! duration=1862ms; Flags=0, IntendedVsync=12658796993658, Vsync=12659013660316, OldestInputEvent=9223372036854775807, NewestInputEvent=0, HandleInputStart=12659032900880, AnimationStart=12659033029580, PerformTraversalsStart=12659040149880, DrawStart=12659527054380, SyncQueued=12659753000480, SyncStart=12659888112480, IssueDrawCommandsStart=12659902310880, SwapBuffers=12660452490380, FrameCompleted=12660794845380, DequeueBufferDuration=1504000, QueueBufferDuration=78423000,
09-30 15:21:45.194 I/mono-stdout(12097): 2019-09-30 15:21:45 [TRACE] (MvvmCross.Logging.MvxLog) No view model association found for candidate view BaseActivity
2019-09-30 15:21:45 [TRACE] (MvvmCross.Logging.MvxLog) No view model association found for candidate view BaseActivity
09-30 15:21:46.308 D/Mono    (12097): Assembly Ref addref Xamarin.Facebook.Common.Android[0xe63a45a0] -> Xamarin.Facebook.Core.Android[0xe63a4660]: 3
09-30 15:21:46.751 D/Mono    (12097): Assembly Ref addref MedSmart.App.Droid[0xed864c40] -> Xamarin.GooglePlayServices.Basement[0xe63a5260]: 2
09-30 15:21:46.817 D/Mono    (12097): Assembly Ref addref Xamarin.GooglePlayServices.Base[0xe63a51a0] -> Xamarin.GooglePlayServices.Basement[0xe63a5260]: 3
2019-09-30 15:21:46 [TRACE] (MvvmCross.Core.MvxSetup) Setup: Views start09-30 15:21:46.996 I/mono-stdout(12097): 2019-09-30 15:21:46 [TRACE] (MvvmCross.Core.MvxSetup) Setup: Views start

2019-09-30 15:21:47 [TRACE] (MvvmCross.Core.MvxSetup) Setup: CommandCollectionBuilder start
09-30 15:21:47.296 I/mono-stdout(12097): 2019-09-30 15:21:47 [TRACE] (MvvmCross.Core.MvxSetup) Setup: CommandCollectionBuilder start
2019-09-30 15:21:47 [TRACE] (MvvmCross.Core.MvxSetup) Setup: NavigationSerializer start
09-30 15:21:47.379 I/mono-stdout(12097): 2019-09-30 15:21:47 [TRACE] (MvvmCross.Core.MvxSetup) Setup: NavigationSerializer start
2019-09-30 15:21:47 [TRACE] (MvvmCross.Core.MvxSetup) Setup: InpcInterception start
2019-09-30 15:21:47 [TRACE] (MvvmCross.Core.MvxSetup) Setup: InpcInterception start09-30 15:21:47.462 I/mono-stdout(12097): 2019-09-30 15:21:47 [TRACE] (MvvmCross.Core.MvxSetup) Setup: InpcInterception start

09-30 15:21:47.471 I/mono-stdout(12097): 2019-09-30 15:21:47 [TRACE] (MvvmCross.Core.MvxSetup) Setup: InpcInterception start
09-30 15:21:47.568 I/mono-stdout(12097): 2019-09-30 15:21:47 [TRACE] (MvvmCross.Core.MvxSetup) Setup: LastChance start
2019-09-30 15:21:47 [TRACE] (MvvmCross.Core.MvxSetup) Setup: LastChance start
09-30 15:21:49.160 D/Mono    (12097): Assembly Ref addref MedSmart.App.Droid[0xed864c40] -> ModernHttpClient[0xe5f09840]: 2
09-30 15:21:49.160 D/Mono    (12097): Assembly Ref addref ModernHttpClient[0xe5f09840] -> mscorlib[0xed8647c0]: 97
09-30 15:21:49.219 D/Mono    (12097): Assembly Ref addref MedSmart.App.Droid[0xed864c40] -> MvvmCross.Droid.Support.Core.Utils[0xe5f09a80]: 2
09-30 15:21:49.231 D/Mono    (12097): Assembly Ref addref MedSmart.App.Droid[0xed864c40] -> MvvmCross.Droid.Support.Design[0xe5f09b40]: 2
09-30 15:21:49.400 D/Mono    (12097): Assembly Ref addref MedSmart.App.Droid[0xed864c40] -> MvvmCross.Droid.Support.Fragment[0xe5f09c00]: 2
09-30 15:21:49.592 D/Mono    (12097): Assembly Ref addref MedSmart.App.Droid[0xed864c40] -> MvvmCross.Plugin.Visibility[0xe5f09f00]: 2
09-30 15:21:49.593 D/Mono    (12097): Assembly Ref addref MedSmart.App.Droid[0xed864c40] -> MvvmCross.Plugin.WebBrowser[0xe5f09fc0]: 2
09-30 15:21:50.003 D/Mono    (12097): Assembly Ref addref ModernHttpClient[0xe5f09840] -> Mono.Android[0xe63a5c20]: 87
09-30 15:21:50.341 D/Mono    (12097): Assembly Ref addref MvvmCross.Droid.Support.Core.Utils[0xe5f09a80] -> Mono.Android[0xe63a5c20]: 88
09-30 15:21:54.391 D/Mono    (12097): Assembly Ref addref Mono.Android[0xe63a5c20] -> System.Net.Http[0xe7d86800]: 3
09-30 15:21:54.489 D/Mono    (12097): Assembly Ref addref Mono.Android[0xe63a5c20] -> System[0xed847880]: 13
09-30 15:21:56.116 I/mono-stdout(12097): 2019-09-30 15:21:56 [WARN]  (MvvmCross.Logging.MvxLog) ReflectionTypeLoadException masked during loading of MvvmCross, Version=220.127.116.11, Culture=neutral, PublicKeyToken=null - error ReflectionTypeLoadException: Exception of type 'System.Reflection.ReflectionTypeLoadException' was thrown.
2019-09-30 15:21:56 [WARN]  (MvvmCross.Logging.MvxLog) ReflectionTypeLoadException masked during loading of MvvmCross, Version=126.96.36.199, Culture=neutral, PublicKeyToken=null - error ReflectionTypeLoadException: Exception of type 'System.Reflection.ReflectionTypeLoadException' was thrown.
      at (wrapper managed-to-native) System.Reflection.Assembly.GetTypes(System.Reflection.Assembly,bool)
  at System.Reflection.Assembly.GetTypes () [0x00000] in <d4a23bbd2f544c30a48c44dd622ce09f>:0 09-30 15:21:56.119 I/mono-stdout(12097):    at (wrapper managed-to-native) System.Reflection.Assembly.GetTypes(System.Reflection.Assembly,bool)

  at System.Reflection.Assembly+<get_DefinedTypes>d__140.MoveNext () [0x0001e] in <d4a23bbd2f544c30a48c44dd622ce09f>:0
  at System.Linq.Enumerable+WhereSelectEnumerableIterator`2[TSource,TResult].MoveNext () [0x00059] in <715c2ff6913942e6aa8535593b3ef35a>:0
  at MvvmCross.IoC.MvxTypeCache`1[TType].AddAssembly (System.Reflection.Assembly assembly) [0x000c6] in D:\a\1\s\MvvmCross\IoC\MvxTypeCache.cs:31 09-30 15:21:56.119 I/mono-stdout(12097):   at System.Reflection.Assembly.GetTypes () [0x00000] in <d4a23bbd2f544c30a48c44dd622ce09f>:0

09-30 15:21:56.123 I/mono-stdout(12097):   at System.Reflection.Assembly+<get_DefinedTypes>d__140.MoveNext () [0x0001e] in <d4a23bbd2f544c30a48c44dd622ce09f>:0
09-30 15:21:56.124 I/mono-stdout(12097):   at System.Linq.Enumerable+WhereSelectEnumerableIterator`2[TSource,TResult].MoveNext () [0x00059] in <715c2ff6913942e6aa8535593b3ef35a>:0
09-30 15:21:56.125 I/mono-stdout(12097):   at MvvmCross.IoC.MvxTypeCache`1[TType].AddAssembly (System.Reflection.Assembly assembly) [0x000c6] in D:\a\1\s\MvvmCross\IoC\MvxTypeCache.cs:31
09-30 15:21:56.201 D/Mono    (12097): Assembly Ref addref Xamarin.Android.Support.v7.AppCompat[0xe5f0bfa0] -> Xamarin.Android.Support.CustomView[0xe5f0b520]: 2
09-30 15:21:56.250 D/Mono    (12097): Assembly Ref addref Xamarin.Android.Support.DrawerLayout[0xe5f0b760] -> Xamarin.Android.Support.Compat[0xe5f0b0a0]: 7
09-30 15:21:56.252 D/Mono    (12097): Assembly Ref addref Xamarin.Android.Support.DrawerLayout[0xe5f0b760] -> Xamarin.Android.Support.CustomView[0xe5f0b520]: 3
09-30 15:21:56.289 D/Mono    (12097): Assembly Ref addref Xamarin.Android.Support.Design[0xe5f0b5e0] -> Xamarin.Android.Support.CoordinaterLayout[0xe5f0b160]: 4
09-30 15:21:56.304 D/Mono    (12097): Assembly Ref addref Xamarin.Android.Support.Design[0xe5f0b5e0] -> Xamarin.Android.Support.v7.CardView[0xe63a4060]: 2
09-30 15:21:56.307 D/Mono    (12097): Assembly Ref addref Xamarin.Android.Support.Design[0xe5f0b5e0] -> Xamarin.Android.Support.CustomView[0xe5f0b520]: 4
09-30 15:21:56.342 D/Mono    (12097): Assembly Ref addref Xamarin.Android.Support.Design[0xe5f0b5e0] -> Xamarin.Android.Support.v7.RecyclerView[0xe63a4120]: 2
09-30 15:21:56.358 D/Mono    (12097): Assembly Ref addref Xamarin.Android.Support.v7.RecyclerView[0xe63a4120] -> Xamarin.Android.Support.Compat[0xe5f0b0a0]: 8
09-30 15:21:56.358 D/Mono    (12097): Assembly Ref addref Xamarin.Android.Support.Design[0xe5f0b5e0] -> Xamarin.Android.Support.Transition[0xe5f0be20]: 2
09-30 15:21:56.369 D/Mono    (12097): Assembly Ref addref Xamarin.Android.Support.Design[0xe5f0b5e0] -> Xamarin.Android.Support.ViewPager[0xe63a4360]: 5
09-30 15:21:56.391 D/Mono    (12097): Assembly Ref addref Xamarin.Android.Support.CoordinaterLayout[0xe5f0b160] -> Xamarin.Android.Support.CustomView[0xe5f0b520]: 5
09-30 15:21:56.394 D/Mono    (12097): Assembly Ref addref Xamarin.Android.Support.ViewPager[0xe63a4360] -> Xamarin.Android.Support.Compat[0xe5f0b0a0]: 9
09-30 15:21:56.404 D/Mono    (12097): Assembly Ref addref Xamarin.Android.Support.ViewPager[0xe63a4360] -> Xamarin.Android.Support.CustomView[0xe5f0b520]: 6
09-30 15:21:57.931 D/Mono    (12097): DllImport searching in: '__Internal' ('(null)').
09-30 15:21:57.932 D/Mono    (12097): Searching for 'java_interop_jnienv_get_static_field_id'.
09-30 15:21:57.932 D/Mono    (12097): Probing 'java_interop_jnienv_get_static_field_id'.
09-30 15:21:57.932 D/Mono    (12097): Found as 'java_interop_jnienv_get_static_field_id'.
09-30 15:21:57.959 D/Mono    (12097): DllImport searching in: '__Internal' ('(null)').
09-30 15:21:57.959 D/Mono    (12097): Searching for 'java_interop_jnienv_get_static_object_field'.
09-30 15:21:57.959 D/Mono    (12097): Probing 'java_interop_jnienv_get_static_object_field'.
09-30 15:21:57.959 D/Mono    (12097): Found as 'java_interop_jnienv_get_static_object_field'.
2019-09-30 15:21:59 [TRACE] (MvvmCross.Logging.MvxLog) AppStart: Application Startup - On UI thread09-30 15:21:59.155 I/mono-stdout(12097): 2019-09-30 15:21:59 [TRACE] (MvvmCross.Logging.MvxLog) AppStart: Application Startup - On UI thread

09-30 15:21:59.252 D/Mono    (12097): Assembly Ref addref MedSmart.App[0xe5f095a0] -> Plugin.Settings.Abstractions[0xe5f0a4a0]: 2
09-30 15:21:59.327 D/Mono    (12097): Unloading image System.Runtime.dll [0xc8b9ba00].
09-30 15:21:59.332 D/Mono    (12097): Image addref System.Runtime[0xc8bfe380] -> System.Runtime.dll[0xc9a2cd00]: 6
09-30 15:21:59.332 D/Mono    (12097): Config attempting to parse: 'System.Runtime.dll.config'.
09-30 15:21:59.332 D/Mono    (12097): Config attempting to parse: '/Users/builder/jenkins/workspace/xamarin-android-d15-9/xamarin-android/external/mono/sdks/out/android-x86-release/etc/mono/assemblies/System.Runtime/System.Runtime.config'.
09-30 15:21:59.332 D/Mono    (12097): Assembly Ref addref Plugin.Settings.Abstractions[0xe5f0a4a0] -> System.Runtime[0xe7d85c60]: 4
09-30 15:21:59.333 D/Mono    (12097): Assembly Ref addref MedSmart.App[0xe5f095a0] -> Plugin.Settings[0xe5f0a560]: 2
09-30 15:21:59.340 D/Mono    (12097): Assembly Ref addref Plugin.Settings[0xe5f0a560] -> mscorlib[0xed8647c0]: 98
09-30 15:21:59.340 D/Mono    (12097): Assembly Ref addref Plugin.Settings[0xe5f0a560] -> Plugin.Settings.Abstractions[0xe5f0a4a0]: 3
09-30 15:21:59.413 D/Mono    (12097): Assembly Ref addref Plugin.Settings[0xe5f0a560] -> Mono.Android[0xe63a5c20]: 89
09-30 15:21:59.672 D/Mono    (12097): DllImport searching in: '__Internal' ('(null)').
09-30 15:21:59.673 D/Mono    (12097): Searching for 'java_interop_jnienv_call_boolean_method_a'.
09-30 15:21:59.673 D/Mono    (12097): Probing 'java_interop_jnienv_call_boolean_method_a'.
09-30 15:21:59.673 D/Mono    (12097): Found as 'java_interop_jnienv_call_boolean_method_a'.
09-30 15:22:00.494 D/Mono    (12097): Assembly Ref addref MvvmCross.Droid.Support.V7.AppCompat[0xe5f09cc0] -> Xamarin.Android.Support.Fragment[0xe5f0b820]: 5
09-30 15:22:00.626 D/Mono    (12097): Assembly Ref addref MvvmCross.Droid.Support.V7.AppCompat[0xe5f09cc0] -> System.Core[0xe63a5e00]: 7
09-30 15:22:02.033 I/icines.medsmar(12097): Background concurrent copying GC freed 10897(1004KB) AllocSpace objects, 10(264KB) LOS objects, 51% free, 1452KB/2MB, paused 19.968ms total 232.701ms
09-30 15:22:02.348 W/icines.medsmar(12097): JNI RegisterNativeMethods: attempt to register 0 native methods for md5716162e2cd7f7ce01364d7c5d961f40b.MvxAppCompatActivity_1
09-30 15:22:04.221 I/Choreographer(12097): Skipped 328 frames!  The application may be doing too much work on its main thread.
09-30 15:22:04.397 I/OpenGLRenderer(12097): Davey! duration=5644ms; Flags=0, IntendedVsync=12674653852755, Vsync=12680120519203, OldestInputEvent=9223372036854775807, NewestInputEvent=0, HandleInputStart=12680128791380, AnimationStart=12680138049980, PerformTraversalsStart=12680183108580, DrawStart=12680187429780, SyncQueued=12680211639680, SyncStart=12680212716680, IssueDrawCommandsStart=12680217558180, SwapBuffers=12680292113880, FrameCompleted=12680299691980, DequeueBufferDuration=88000, QueueBufferDuration=510000,
09-30 15:22:04.638 W/ActivityThread(12097): handleWindowVisibility: no activity for token android.os.BinderProxy@7a003e6
09-30 15:22:06.703 D/Mono    (12097): DllImport searching in: '__Internal' ('(null)').
09-30 15:22:06.703 D/Mono    (12097): Searching for 'java_interop_jnienv_get_static_int_field'.
09-30 15:22:06.703 D/Mono    (12097): Probing 'java_interop_jnienv_get_static_int_field'.
09-30 15:22:06.703 D/Mono    (12097): Found as 'java_interop_jnienv_get_static_int_field'.
09-30 15:22:07.682 D/Mono    (12097): Image addref Mono.Android.Export[0xc8bfd960] -> Mono.Android.Export.dll[0xc8b9c400]: 2
09-30 15:22:07.694 D/Mono    (12097): Prepared to set up assembly 'Mono.Android.Export' (Mono.Android.Export.dll)
09-30 15:22:07.694 D/Mono    (12097): Assembly Mono.Android.Export[0xc8bfd960] added to domain RootDomain, ref_count=1
09-30 15:22:08.197 D/Mono    (12097): AOT: image 'Mono.Android.Export.dll.so' not found: dlopen failed: library "/data/app/com.talkingmedicines.medsmart-353GoKCmCuAZwDW2_PDbJA==/lib/x86/libaot-Mono.Android.Export.dll.so" not found
09-30 15:22:08.199 D/Mono    (12097): AOT: image '/Users/builder/jenkins/workspace/xamarin-android-d15-9/xamarin-android/external/mono/sdks/out/android-x86-release/lib/mono/aot-cache/x86/Mono.Android.Export.dll.so' not found: dlopen failed: library "/data/app/com.talkingmedicines.medsmart-353GoKCmCuAZwDW2_PDbJA==/lib/x86/libaot-Mono.Android.Export.dll.so" not found
09-30 15:22:08.209 D/Mono    (12097): Config attempting to parse: 'Mono.Android.Export.dll.config'.
09-30 15:22:08.209 D/Mono    (12097): Config attempting to parse: '/Users/builder/jenkins/workspace/xamarin-android-d15-9/xamarin-android/external/mono/sdks/out/android-x86-release/etc/mono/assemblies/Mono.Android.Export/Mono.Android.Export.config'.
09-30 15:22:08.216 D/Mono    (12097): Assembly Ref addref Mono.Android.Export[0xc8bfd960] -> mscorlib[0xed8647c0]: 99
Loaded assembly: Mono.Android.Export.dll [External]
09-30 15:22:08.329 D/Mono    (12097): Assembly Ref addref Mono.Android.Export[0xc8bfd960] -> Mono.Android[0xe63a5c20]: 90
09-30 15:22:08.531 D/Mono    (12097): Assembly Ref addref Mono.Android.Export[0xc8bfd960] -> System.Xml[0xed845480]: 3
Loaded assembly: __callback_factory__ [External]
09-30 15:22:09.288 D/Mono    (12097): Assembly Ref addref Mono.Android.Export[0xc8bfd960] -> System.Core[0xe63a5e00]: 8
09-30 15:22:09.532 D/Mono    (12097): DllImport searching in: '__Internal' ('(null)').
09-30 15:22:09.532 D/Mono    (12097): Searching for 'java_interop_jnienv_new_local_ref'.
09-30 15:22:09.532 D/Mono    (12097): Probing 'java_interop_jnienv_new_local_ref'.
09-30 15:22:09.535 D/Mono    (12097): Found as 'java_interop_jnienv_new_local_ref'.
Unhandled Exception:

System.AggregateException: <Timeout exceeded getting exception details>

Comment: After further investigation, it appears that the error was caused by me changing from PCL libraries to .NetStandard, rather than an issue with MVVMCross itself, Thanks for the help!
Comment: Please add the stack trace and description of the exception.
Comment: Added, sorry about that
Comment: In the question and not a separate pastebin
Comment: @Cheesebaron, wanted to add a longer trace, but there's a 30k limit on posts that I didn't know about.
Comment: When you get the exception. Please keep pressing continue execution. The exception and stack trace is missing.
Comment: @VaniaP Could you put your comment above in the answer below so that we can close this Question. That way more people facing the same problem will be able to search the solution! Thanks
Answer: After further investigation, it appears that the error was caused by me changing from PCL libraries to .NetStandard, rather than an issue with MVVMCross itself, Thanks for the help!


How to add values to an array inside an array obtained through AJAX

Question: In my PHP file, I'm receiving a total of 4 variables $data, $date, $shift and $val1.
$data is an array and the other 3 are date and 2 strings obtained through AJAX with no problem.
What I'm trying to do is to insert these 3 values inside my $data variable.
I tried using array merge, and a For each loop with multiple instances but no luck so far.
I obtained my variables like this:
if (isset($_POST['date'])){
    $date = $_POST['date'];
    $date = json_encode($date);
    $date = json_decode($date);
}

if (isset($_POST['shift'])){
    $shift = $_POST['shift'];
    $shift = json_encode($shift);
    $shift = json_decode($shift);
}

if (isset($_POST['val1'])){
    $val1 = $_POST['val1'];
    $val1 = json_encode($val1);
    $val1 = json_decode($val1);
}

if (isset($_POST['data'])){
    $dat = $_POST['data'];
    $data = json_decode($dat, true);
}

$values = array($date,$shift,$val1);

$r = (array_merge($data, $values));

My data array looks something like this:
Array (
    [0] => Array (
        [data] => Array (
            [0] => Array (
                [0] => 1
                [1] => 2
                [2] => 3
                [3] => 0
                [4] => Mat1
                [5] => Box1
                [6] => 100
                [7] => 100
                [8] => Piece1
                [9] => Loc1
                [10] => Mach1
                [11] => 1000
                [12] => Accepted
                )
            )
        )
    [1] => 2019-04-09
    [2] => First
    [3] =>  Value1
)

But what I want to achieve is this:
Array (
    [0] => Array (
        [data] => Array (
            [0] => Array (
                [0] => 1
                [1] => 2
                [2] => 3
                [3] => 0
                [4] => Mat1
                [5] => Box1
                [6] => 100
                [7] => 100
                [8] => Piece 1
                [9] => Suc1
                [10] => Mach1
                [11] => 1000
                [12] => Accepted
                [13] => 2019-04-09
                [14] => First
                [15] => Value1
                )
            )
        )
    )

What am I doing wrong? Or How can I achieve what I'm trying to do?
Edit: Since I can get more than one array at my array, something like this
Array (
    [0] => Array (
        [data] => Array (
            [0] => Array (...)
            [1] => Array (...)
            [2] => Array (...)
            [3] => Array (...)
            )
        )
    )

I just added this code to @HelgeB answer, I'm leaving it here in case someone might need it in the future.
$count = count($data[0]['data']);

for ($i=0; $i < $count ; $i++) {
  $data[0]['data'][$i][] = $date;
  $data[0]['data'][$i][] = $shift;
  $data[0]['data'][$i][] = $val1;
}

Comment: Would something like `$_POST['data'][0][] = $_POST['date']` before assigning `$r` do what you're looking for?
Comment: I've tried that and it just gives me an offset warning or it just adds another parentheses to the result
Answer: As far as I can see from your merged output, your $data array structure is $data[0]['data'][0] = [1,2,3,...,'Accepted'].
So in my opinion you need to insert the values exactly on the level  $data[0]['data'][0] to obtain your result.
The simplest way to achieve this would be:
$data[0]['data'][0][] = $date;
$data[0]['data'][0][] = $shift;
$data[0]['data'][0][] = $val1;

If you want to use your merge approach you need to merge on the correct level like this:
$r = [0 => ['data' => [0 => (array_merge($data[0]['data'][0], $values))]]];

Comment: Well this worked like a charm! Thanks!
As a side note, I can also get more than 1 variable at $data[0]['data'][0], so I just added a count and a for loop to add it to every other array.
I will edit my question to add that in case someone needs it in the future.


On two non-equivalent definitions of variation of a function on an interval $[a,b]$

Question: While studying stochastic process, I encountered two non-equivalent definitions of variation as follows:
Definition 1: Let $f$ be a function on $[a,b]$, the variation of $f$ is defined as
$$V^1_f[a,b] = \sup_{P} \sum^{n-1}_{i=0} |f(t_{i+1}) -f(t_i)|,$$
where the supremum is taking over all partitions $a = t_0 <t_1<...< t_n =b$ of $[a,b]$.
Definition 2: Let $f$ be a function on $[a,b]$, the variation of $f$ is defined as
$$ V^2_f[a,b] = \lim_{\|P\| \rightarrow 0} \sum^{n-1}_{i=0} |f(t_{i+1}) -f(t_i)|, $$
where $\| P \|$ is the mesh of the partition $a = t_0 <t_1<...< t_n =b$ of $[a,b]$, i.e, $\max_i\{t_{i+1} - t_i\}$.
The second definition means $V_f^2[a,b]$ is the finite number (if exists) such that, given $\epsilon >0$, $\exists \delta >0$ whenever $\|P\| < \delta$ then $\Big|\sum^{n-1}_{i=0} |f(t_{i+1}) -f(t_i)| - V_f^2[a,b]\Big| <\epsilon $. To see why they are not equivalent, just take $f$ to be the Dirichlet function on $[0,1]$.
In this post, I'm looking for sufficient conditions for the equality $V_f^1 = V_f^2$, I couldn't find much information on the internet so I hope to get your help here. Two well-known sufficient conditions are 1. $V^1_f[a,b] <\infty$ plus $f$ is continuous and 2. $f$ is monotone, which are proved in many texts. But I would like to see other conditions rather than just continuity of $f$. For example, are they still equal if $f$ is just right-continuous, or left-continuous (possibly just almost everywhere), etc.?
Another question is when $f$ is continuous but $V_f^1[a,b] = \infty$, is it true that $V_f^2[a,b] = \infty$? The latter means that given a number $M>0$, then there is $\delta$ such that whenever $\|P\| < \delta$ we have $\sum^{n-1}_{i=0} |f(t_{i+1}) -f(t_i)| > M$.
For example, a Brownian motion $B_t$ is continuous but $V^1_B[a,b] = \infty$, I wonder if $V_B^2[a,b]= \infty$?
Thank you for your help!
Answer: I have figured out some answers so I write them here:
Assume that $f$ is right-continuous (the case left continuous is handled similarly) and that $V^1_f[a,b] = \infty$. By definition of $V^1_f$, for any $M>0$ and $\epsilon>0$, we can find a partition $P_M = \{a = t_0 < t_1<...<t_N = b \}$ such that
$$ \sum_{i=0}^{N-1}|f(t_{i+1}) - f(t_i)| > M + \epsilon. $$
Now, since $f$ is right continuous, we can always find a number $\delta > 0$ small enough such that in any partition, e.g $P'$, with mesh lower then $\delta$, there are points $a = t'_0 <t'_1 < t'_2<...<t'_{N-1} < t'_N=b$ satisfying
$$ t_1 <t'_1<t_2<t'_2<...<t_{N-1}<t'_{N-1}, \quad and \quad \max_{i=1,...,N-1}{|t_i-t'_i|} <\xi,$$
where $\xi = \xi(\epsilon)$ is the number that makes (by the right continuity of $f$)
$$ \sum_{i=0}^{N} |f(t_i')-f(t_i)| < \frac{\epsilon}{2}.$$
Denote the variation sum of $P'$ as $V_f(P')$, by triangle inequality, we have
\begin{align}
V_f(P') &\geq \sum_{i=0}^{N-1}|f(t'_{i+1}) - f(t'_i)| \geq \sum_{i=0}^{N-1}|f(t_{i+1}) - f(t_i)| - 2\sum_{i=0}^{N-1}|f(t'_{i+1}) - f(t_i)| \\
&\geq \sum_{i=0}^{N-1}|f(t_{i+1}) - f(t_i)| -\epsilon > M.
\end{align}
Consequently, $V^2_f[a,b] = \infty$ (by definition above).
The case $V_f^1[a,b]< \infty$ can be treated similarly, so in short we have
$$V^1_f[a,b] = V^2_f[a,b] \quad \text{(possibly infinite) when $f$ is right or left continuous}. $$
Now, since previous statement holds for monotone functions (which have countable discontinuities), I wonder if it is true for functions that are almost everywhere (w.r.t Lebesgue measure) right-continuous (or left-continuous)?


AJAX By File://

Question: I have created an AJAX based app. It's working perfect when I use my Apache server as http://localhost:8081/ but when I try to directly open the .html file in browser by file:// prefix, it fails to other pages by ajax.
http://localhost:8081/ works perfect

file:///Users/devbrats/Documents/WimBim/www/index.html#Login.html it never loads Login.html inside index.html body div
why this is so?
Comment: Please show the full URL of the document you're in, and the URL you are loading.
Comment: Is this not an issue with Same Origin Policy?
Answer: I don't think it's possible. I always code straight from my server (which is on my development computer), or ftp into it with Shiftedit, (which is really awesome)
Answer: Different browsers impose slightly different limitations when it comes to running JavaScript on file:/// URLs, but in general they impose higher restrictions than when running from a webserver.  Last I checked, Chrome at least disallows XHR completely in this scenario.
So yes, you're generally better off testing JS-heavy applications from an actual webserver, especially if that's where you intend to be running it eventually anyway.
Comment: Yes. But if my app is going to be inside PhoneGap how can I better do that? My web app has cross domains ajax calls also. How can I efficiently do them all?
Answer: Ajax requests only work on urls from the same host as the webpage it is called from. Local files don't work because it imposes a security risk, because any site could load a local file and send it to the host.
A quick google search gave me this link: http://docs.phonegap.com/phonegap_file_file.md.html#File (Android & BB only)
http://docs.phonegap.com/phonegap_storage_storage.md.html#Storage (Android, BB, iphone)
Comment: http://groups.google.com/group/phonegap/browse_thread/thread/829884c7fe517f56/073a2d2a57fd3a69?lnk=gst&q=ajax#073a2d2a57fd3a69
Comment: isn't this link confusing about what you are saying?

AJAX By File://


Como criar componentes a partir de um outro componente base

Question: A ideia é criar um componente para cada tipo de entrada, por exemplo, InputPassword para <input type="password">, porém, visando a reutilização de código, a maioria desses componentes tem uma base igual, todos tem uma
 como container, possuem um elemento <input> e um elemento , então criei uma classe base:
import React, { Component } from 'react';

export default class Input extends Component {
    constructor(props, context, data) {
        this.data = data;

        super(props, context);
    }

    render() {
        return (
            <div className={`input-field col ${this.data.size || ''}`}>
                {this.data.leftIcon ? <i className={`${this.data.leftIcon} prefix left`}> : ''}

                <input
                    type={this.data.type}
                    value={this.data.value}
                    id={`input-${this.data.type}-${Input.prototype.counter}`}
                    className={this.data.validate ? 'validate' : ''}
                />

                <label for={`input-${Input.prototype.counter}`}>
                    {this.data.label || ''}

                {this.data.rightIcon ? <i className={`${this.data.rightIcon} prefix right`}> : ''}

        );
    }
}

Input.prototype.counter = Input.prototype.counter || 0;

E um componente para senhas:
import React from 'react';

import Input from './Input';

export default class InputPassword extends Input {
    constructor(props, context) {
        super(props, context, {
            type: 'password',
            value: '',
            size: this.props.size,
            placeholder: 'Digite sua senha',
            label: 'Senha',
            disabled: false,
            rightIcon: 'fas fa-eye',
            validate: true,
            helperText: '',
            successText: 'Senha válida',
            errorText: 'Senha inválida',
        });
    }
}

Assim é possível fazer pequenas alterações na base sem ter que alterar em diversos lugares, porém ao tentar usar esse component (InputPassword) recebo o erro:

Failed to compile
./src/components/Inputs/InputPassword.js
Line 3:  'Input' is not defined  no-undef
Search for the keywords to learn more about each error.
This error occurred during the build time and cannot be dismissed.

Observação: estou usando o MaterializeCSS (v1) e o FontAwesome (v5.5)
Comment: A "herança" de componente desta forma pode ser tratada com [high order components](https://reactjs.org/docs/higher-order-components.html), que são basicamente funções que recebem um componente e retornam este componente melhorado. Existem alguns exemploscomo [este aqui](https://medium.com/@Farzad_YZ/handle-loadings-in-react-by-using-higher-order-components-2ee8de9c3deb) que acho que podem dar uma luz no que você quer fazer
Answer: A melhor forma de atingir este resultado com React é utilizando composição (por sinal, herança de componentes não é recomendado no React).
O que você pode fazer, de maneira simplificada:
class Input extends React.Component{
    render(){
         return(

                 {this.props.label}
                 <input type={this.props.inputType} />

         )
    }
}

class InputText extends React.Component {
     render(){
          return <Input inputType='text' label='Texto' />
     }
}
// exemplo com functional-stateless components
const InputPass = props => <Input inputType='password' label='Senha' />

Mais referências: https://reactjs.org/docs/composition-vs-inheritance.html


Spark: saveAsTextFile without compression

Question: By default, newer versions of Spark use compression when saving text files. For example:
val txt = sc.parallelize(List("Hello", "world", "!"))
txt.saveAsTextFile("/path/to/output")

will create files in .deflate format. It's quite easy to change compression algorithm, e.g. for .gzip:
import org.apache.hadoop.io.compress._
val txt = sc.parallelize(List("Hello", "world", "!"))
txt.saveAsTextFile("/path/to/output", classOf[GzipCodec])

But is there a way to save RDD as a plain text files, i.e. without any compression?
Comment: Try setting `mapred.output.compress` to `false`
Answer: I can see the text file in HDFS without any compression with this code.
val conf = new SparkConf().setMaster("local").setAppName("App name")
val sc = new SparkContext(conf);
sc.hadoopConfiguration.set("mapred.output.compress", "false")
val txt = sc.parallelize(List("Hello", "world", "!"))
txt.saveAsTextFile("hdfs/path/to/save/file")

You can set all Hadoop related properties to hadoopConfiguration on sc.
Verified this code in Spark 1.5.2(scala 2.11).
Comment: Tested on local filesystem instead of HDFS and Scala 2.10 instead of 2.11, and it works like a charm! Thanks!


Facebook: Find old posts

Question: I'm looking to find old facebook posts using FQL. I tried this:
SELECT actor_id, message, created_time FROM stream
 WHERE source_id = me() and (created_time>date1 and created_time<date2)

but even if the interval between date1 and date2 is only one day, it only returns a fraction of the posts. So, I tried chunking them, but even at 1 hour intervals it still doesn't quite get everything, and I quickly approach the 600 query limit for stream requests.
Is there a better way?
Comment: I also tried adding a LIMIT clause at the end and it didn't hep
Comment: The `stream` table seems to be very limited in what it returns by design. I'm trying to query the `stream` on one of my pages to display photos others have posted to the page's stream on an external website. I can't get some of the older photos anymore (from June) no matter what I try.
Answer: Have you tried using Graph API? Something like this should help you out with pages:
https://graph.facebook.com/PAGE_ID/feed?value=1&base_amount=1&limit=25&until=1332873234
To query your own posts the url is a bit different:
https://graph.facebook.com/USER_ID/home?value=1&base_amount=1&limit=25&since=1344348794",
You can test Graph API queries here:
https://developers.facebook.com/tools/explorer/?method=GET&path=40796308305%2Ffeed
Comment: can you please explain what the value and base amount variables represent? I cant find them in the graph api. Is there somewhere I can find other argument definitions that I might nto have been aware of? All I know is from http://developers.facebook.com/docs/reference/api/. Thanks again! This looks promising!
Comment: I haven't found any documentation for these either. How I discovered them was that I run a sample query and in the end of the response there were links "previous" and "next" with these urls. So I think the only way to find out their meaning is to play around with these values in sample queries.

Facebook: Find old posts


setting "Modal" at runtime

Question: C# WinApp:  if I am creating a form at run time How can I tell it to be "Modal" ...
I tried mFrmPersons.Modal = true  but compile error was saying it is a read only property. so what can I do?  Thanks
EDIT: I cannot use Show or Show Dialog! I have a form that some other application is embedding inside it. so the only way I can call my form is like this:
moPersons.NonClinDocDialog.ShowDocs(DocContext);

The only thing I have control over it is moPersons that is the form I am defining in my Application... rest of it a call to other apps...so I want to set the Modal for moPersons
Comment: You can only simulate a modal dialog if you can get an event when the form is closing (not closed).
Comment: forgot to mention that in the question: I cannot use Show or Show Dialog! I have a form that some other application is embedding inside it. so the only way I can call my form is like this: moPersons.NonClinDocDialog.ShowDocs(DocContext);  so the only thing I have control over it is moPersons that is the form I am defining in my Application... rest of it a call to other apps...so I want to set the Modal for moPersons
Comment: You could edit the question to reflect this :)
Comment: I'd try to fake it... Perhaps show another form in the loading etc
Answer: Using ShowDialog() instead of Show() might work.
Comment: yes forgot to mention that in the question: I cannot use Show or Show Dialog! I have a form that some other application is embedding inside it. so the only way I can call my form is like this: moPersons.NonClinDocDialog.ShowDocs(DocContext);  so the only thing I have control over it is moPersons that is the form I am defining in my Application... rest of it a call to other apps...so I want to set the Modal for moPersons
Answer: The trick is deciding whether the code shows the form with theForm.Show() vs theForm.ShowDialog() - so it is the code that displays the form that needs tweaking.
Comment: yes forgot to mention that in the question: I cannot use Show or Show Dialog! I have a form that some other application is embedding inside it. so the only way I can call my form is like this: moPersons.NonClinDocDialog.ShowDocs(DocContext);  so the only thing I have control over it is moPersons that is the form I am defining in my Application... rest of it a call to other apps...so I want to set the Modal for moPersons

setting "Modal" at runtime


Strange linearity test for ANCOVA

Question: There is an easy way to test the linearity hypothesis for a simple regression model $y \sim {\cal N}(\alpha+\beta x,\sigma^2)$: calling $H_0$ this model, perform a test against the ANOVA model $H_1$ obtained by considering the (numeric) covariate $x$ as a (qualitative) factor. Of course this requires to have several values of $y$ for each value of $x$. In R :
fit0 <- lm(y ~ x)
fit1 <- lm(y ~ factor(x))
anova(fit0, fit1)

This is quite sensible. But I have seen somewhere a linearity test for an ANCOVA model and I'm puzzling over what it means. The R code, denoting by $x$ the numeric covariate and $A$ the qualitative factor, is like:
fit0 <- lm(y ~ x + A + x:A)
fit1 <- lm(y ~ x + A + x:A + factor(x))
anova(fit0, fit1)

That means that $H_0$ is the classical ANCOVA model with interaction and $H_1$ is the bigger model obtained by adding the covariate $x$ considered as a factor.
Does it make sense for you ? I cannot figure out how to interpret model $H_1$.
Comment: Your first snippet is clearly testing whether non-linearity effect is significant. As for the second snippet, I can't understand if there any use of it: two identical full ANCOVA models, and one of them with additional term added. It looks like testing if this addition improves the model, which has nothing to do with the issue of linearity
Comment: I agree: if $x$ is really continuous then there are too many parameters to be able to estimate them; if not, then it's the same logic as the first pair of models. It would make more sense to test adding a quadratic term in $x$.
Comment: @ttnphns This is exactly my feeling. Moreover there are unestimable parameters in the second model. I have seen this test in a SAS code written by a colleague of mine. I appreciate other advices before saying him this test has no sense, or at least nothing to do with the issue of linearity. Thanks.
Answer: Actually the method used by colleague is correct but this is not the one I showed in my question: it is
fit0 <- lm(y ~ x + A + x:A)
fit2 <- lm(y ~ x + A + x:A + factor(x):A)
anova(fit0, fit2)

This still sounds strange, but actually this is tricky. The natural way to test linearity is:
fit0 <- lm(y ~ x + A + x:A)
fit1 <- lm(y ~ factor(x) + A + factor(x):A)
anova(fit0, fit1)

That is, we test $H_0\colon\{\text{ANCOVA model}\}$ vs $H_1\colon\{\text{2-WAY ANOVA model}\}$ by considering in $H_1$ that the numerical covariate is categorical.
Let's consider an example:
y=c(161,160,178,187,171,194,
    151,192,150,172,170,192,
    162,195,174,161,193,151,
    194,184,199,160,163,171,
    176,181,201,202,154,151,
    193,166,161,186,198,182)
A=c("S","T","T","S","S","U",
    "T","T","S","S","U","S",
    "T","S","U","U","T","T",
    "S","S","U","T","S","T",
    "S","T","S","T","T","S",
    "T","S","T","T","S","S")
x=c(1,1,2,3,2,3,
    1,3,1,2,2,3,
    2,3,2,1,6,1,
    3,2,3,1,1,2,
    2,2,3,3,1,1,
    3,1,1,2,4,2)
> fit0 <- lm(y ~ x + A + x:A)
> fit1 <- lm(y ~ factor(x) + A + factor(x):A)
> anova(fit0, fit1)
Analysis of Variance Table

Model 1: y ~ x + A + x:A
Model 2: y ~ factor(x) + A + factor(x):A
  Res.Df    RSS Df Sum of Sq      F    Pr(>F)
1     30 2367.2
2     25  990.8  5    1376.4 6.9459 0.0003439 ***

Now consider the following problem: how to get this $p$-value with SAS ?. There's no equivalent of anova(fit0, fit1) in SAS, and the ANOVA table of $H_1$ does not provide the desired $p$-value:
> anova(fit1)
Analysis of Variance Table

Response: y
            Df Sum Sq Mean Sq F value    Pr(>F)
factor(x)    4 8491.3 2122.82 53.5632 6.678e-12 ***
A            2    4.0    1.98  0.0501    0.9513
factor(x):A  4   70.0   17.49  0.4413    0.7775
Residuals   25  990.8   39.63

Thus, someone (I don't know who is he/she), has invented the following "strange" model:
fit2 <- lm(y ~ x + A + x:A + factor(x):A)

This is the ANCOVA model $H_0$ with an additional term: the interaction of the factor and of the numerical covariate considered as a categorical variable. I say it is strange because I have some pain to interpret it. Moreover it has some unestimable parameters:
> coef(fit2)
  (Intercept)             x            AT            AU          x:AT          x:AU AS:factor(x)2
   144.933333     13.266667      3.866667     -1.683333     -5.900000      4.483333      5.533333
AT:factor(x)2 AU:factor(x)2 AS:factor(x)3 AT:factor(x)3 AU:factor(x)3 AS:factor(x)4 AT:factor(x)4
    12.066667     -6.750000      9.066667     24.766667            NA            NA            NA
AU:factor(x)4 AS:factor(x)6 AT:factor(x)6 AU:factor(x)6
           NA            NA            NA            NA

because its design matrix is not of full rank:
> X <- model.matrix(fit2)
> qr(X)$rank
[1] 11
> dim(X)
[1] 36 18

But this model is useful: its ANOVA table (available in SAS) provides the desired $p$-value:
> anova(fit2)
Analysis of Variance Table

Response: y
            Df Sum Sq Mean Sq  F value    Pr(>F)
x            1 6607.4  6607.4 166.7199 1.471e-12 ***
A            2  156.8    78.4   1.9785 0.1593386
x:A          2  424.5   212.3   5.3559 0.0115905 *
A:factor(x)  5 1376.4   275.3   6.9459 0.0003439 ***
Residuals   25  990.8    39.6

What's happening ? I don't totally understand all the details yet. Actually I don't know how linear model fitting works with unestimable parameters ?
But first note that the Residuals line is the same for fit1 and fit2:
        Df Sum Sq Mean Sq  F value    Pr(>F)
Residuals   25  990.8    39.6

Moreover, the two ANOVA tables have the same total sum of squares:
> cumsum(anova(fit1)$Sum)
    [1] 8491.267 8495.236 8565.200 9556.000
    > cumsum(anova(fit2)$Sum)
[1] 6607.444 6764.270 7188.800 8565.200 9556.000

This occurs because the design matrix in fit1 and fit2 span the same vector space, but in fit2 there's like a "removing of the singular part" of the design matrix (I guess this step uses generalized inverse for matrices but I don't remember how it works). Moreover, the first three lines of anova(fit2) and anova(fit0) are the same:
            Df Sum Sq Mean Sq  F value    Pr(>F)
x            1 6607.4  6607.4 166.7199 1.471e-12 ***
A            2  156.8    78.4   1.9785 0.1593386
x:A          2  424.5   212.3   5.3559 0.0115905 *

Thus we mathematically conclude that the $p$-value of the 4th line of anova(fit2) is the same as the Fisher test anova(fit0, fit1).
Roughly speaking, the philosophy of this trick is : enlarge model $H_0$ by adding one categorical variable such that the bigger model, "even if it is wrong", has a design matrix which span the same vector space as model $H_1$, "after removing the singular part of this matrix". This latter point is the one I don't master.

Strange linearity test for ANCOVA


What do you use to Monitor Server CPU spikes / processes

Question: Sometimes, My apache/Passenger Rails server just spikes to 100% CPU usage and stops working. I need a way to monitor what process spikes it to 100% usage ?. What tools can i use to monitor such things
Thanks
Answer: I like Nagios(http://www.nagios.org/) and Zabbix(http://www.zabbix.com/). Monit(http://mmonit.com/) can repair system.
If you need graphics use Zabbix, if you need manage and repair use Monit, other use Nagios.
If you do not need web managemnt and status, use nagios-plugins check_cpu and your favorite programming language.
Answer: If you want to monitor the server processes to see the problem ones, just setup a script to take a snapshot when CPU usage or load average gets too high and put it in a cron
<code>#/bin/bash
if [[ `cut -d. -f1 /proc/loadavg` -gt 4 ]]; then
    top -n 1  | head -n20 >> /tmp/process-check.log
fi
</code>
If you need to see inside of Apache, enabled server-status and do run curl to pull in a snapshot of the server-status if load or CPU usage gets too high.
More on mod_status at http://httpd.apache.org/docs/2.0/mod/mod_status.html


Why does apache slow down overnight?

Question: Greetings experts,
On my dedicated CentOS 5.4 server, I configure apache with about a dozen virtual hosts.  I test a few of 'em, each loads within about a second; fairly quick.  Load average is less than 1.  No problems.  I'm running static HTML sites, one WordPress blog with MySQL 5.0... these are not high-bandwidth sites; nothing that would stress this server.
Next morning, I get in to work, load up the main site, and it takes 10 to 20 seconds to load.  I check the load average on the server and it's hovering around 3, sometimes up to 5, once saw it at 8, never below 2.  At this point I gracefully bounce apache:
# apachectl -k graceful

Takes about half a minute, then all is well again.  All virtual hosts load fast, less than a second.  Load average quickly sinks below 1.
When checking /server-status, not a lot is going on; when checking net traffic (vnstat -l or vnstat -h), not a lot of bandwidth is being used.  Both are compariable at the beginning of the day as at the end.  Yet, when I check it in the morning, apache is much, much slower than pretty much all day.  What is happening overnight to make apache slow down so much and consume so many more system resources?
# httpd -V
Server version: Apache/2.2.3
# uname -a
Linux myserver.com 2.6.18-92.el5 #1 SMP Tue Jun 10 18:51:06 EDT 2008 x86_64 x86_64 x86_64 GNU/Linux
# free
             total       used       free     shared    buffers     cached
Mem:       1025576    1017292       8284          0       8208      43160
-/+ buffers/cache:     965924      59652
Swap:      2096472     361012    1735460

I suppose I could set up a cronjob which gracefully bounced apache daily, but that seems like a quick-and-dirty solution.  I'd rather find the cause and fix that.
UPDATE 2009-10-28 14:38; samples taken every 10 seconds over five minutes with average:
$ sar -W 10 30 && date
Linux 2.6.18-92.el5 (myserver.com)   10/28/2009

02:32:36 PM  pswpin/s pswpout/s
02:32:46 PM     10.31     30.43
02:32:56 PM      2.30     32.93
02:33:06 PM     21.56      0.00
02:33:16 PM      1.80      0.00
02:33:26 PM      5.69     26.67
02:33:36 PM      0.10      0.00
02:33:46 PM     25.70      7.60
02:33:56 PM     10.61      7.11
02:34:06 PM      4.10      2.60
02:34:16 PM      0.70      0.00
02:34:26 PM      0.00      0.00
02:34:36 PM      0.00      0.00
02:34:46 PM      3.80      0.00
02:34:56 PM      0.00      0.00
02:35:06 PM      0.00     11.01
02:35:16 PM      7.70     30.30
02:35:26 PM     20.32      0.00
02:35:36 PM      1.60      0.00
02:35:46 PM     11.60      0.00
02:35:56 PM      2.50      0.00
02:36:06 PM      0.00      0.00
02:36:16 PM      3.60      0.00
02:36:26 PM      0.00      0.00
02:36:36 PM      0.00      0.00
02:36:46 PM      0.00      0.00
02:36:56 PM    445.20     56.60
02:37:06 PM      0.00      0.00
02:37:16 PM      0.00      0.00
02:37:26 PM      0.00      0.00
02:37:36 PM      0.00      0.00
Average:        19.31      6.84
Wed Oct 28 14:37:36 PDT 2009

Curiously, apache is not slow this morning.  I made some tweaks to the number of servers started, num spare servers, max number of servers, etc, yesterday.  Let me get the old values and compare...
Original values from /etc/httpd/conf/httpd.conf:
StartServers      20
MinSpareServers   20
MaxSpareServers  120
ServerLimit      256
MaxClients       256
MaxRequestsPerChild  4000

New values which, from all appearances, seems to work just fine:
StartServers     30
MinSpareServers  30
MaxSpareServers  40
ServerLimit      50
MaxClients       50
MaxRequestsPerChild  4000

I'll probably continue to tweak these settings a little, but they do seem to work well now.
Sar command again this morning:
$ sar -W 10 30 && date
Linux 2.6.18-92.el5 (myserver.com)   10/29/2009

09:31:09 AM  pswpin/s pswpout/s
09:31:19 AM      5.80     54.40
09:31:29 AM     62.10      0.00
09:31:39 AM      0.00      0.00
09:31:49 AM      0.00      0.00
09:31:59 AM      0.00      0.00
09:32:09 AM      3.30      0.00
09:32:19 AM      2.70      0.00
09:32:29 AM      0.00      0.00
09:32:39 AM      0.00      0.00
09:32:49 AM      0.00      0.00
09:32:59 AM      3.10      0.00
09:33:09 AM      5.80      0.00
09:33:19 AM      0.00      0.00
09:33:29 AM      0.00      0.00
09:33:39 AM      0.00      0.00
09:33:49 AM      0.00      0.00
09:33:59 AM      0.00      0.00
09:34:09 AM      0.00      0.00
09:34:19 AM      0.00      0.00
09:34:29 AM      0.00      0.00
09:34:39 AM      4.00      0.00
09:34:49 AM      0.10      0.00
09:34:59 AM      0.00      0.00
09:35:09 AM      4.80      0.00
09:35:19 AM      0.00      0.00
09:35:29 AM    291.29      0.00
09:35:39 AM      0.00      0.00
09:35:49 AM      0.80      0.00
09:35:59 AM      0.00      0.00
09:36:09 AM      0.00      0.00
Average:        12.78      1.81
Thu Oct 29 09:36:09 PDT 2009

The average is actually lower!  And the server got more traffic than yesterday.  Womble, it seems you were right!  And now all is well in the universe again.
John Gardeniers, good idea!  It's got the -o [filename] switch just for that.  Thanks for the tip!
Jeremy Visser, dstat is a really sweet tool!  Thanks for the tip!  It was not installed, had to yum install dstat.
Comment: +1 for finding the cause instead of working around.  Excellent practice.
Comment: I have the same problem. Did you solve the problem?
Answer: Based on your free output, I strongly suspect that your Apache processes are heavily buried in swap.  The output of sar -W 1 0 will confirm (or refute) this hypothesis (run it when the machine is running slow).
If the Apache processes aren't all actually serving requests (as shown by mod_status) you should tune the number of "spare" children (with MaxSpareServers) so that they get reaped quicker (and hence don't lay around consuming RAM).  If you really do need the number of children you're running to service the request load, you'll need more RAM (I'd go with another 1GB straight up; RAM is cheap, diagnosis time isn't).
Comment: Why not periodically run the command via cron, with output to a file, so you can also see trends throughout the day?
Comment: To confirm this, have a look at dstat. dstat can tell you cool things like live paging information (i.e. how much was retrieved from swap in the last second). Try running dstat in the morning, then fetching a page from your server and seeing what goes haywire (e.g. disk, CPU, net, paging).
Comment: Indeed, I suspected swapping.  I've been playing around with the number of children started, max spare, etc.
I'll run that command tomorrow and post results.
Comment: @Jeremy: sar -W does the same thing.  @John: If you want to get *professional* about it and start collecting comprehensive system performance data, sure... (grin)
Answer: What's the process(es) that eats up all memory?
Try a iostat/vmstat before any apache restarts - could be a I/O problem.
For trend monitoring, I advise using munin/colectd (those have even very useful apache (for you case, especially) plugins).
Comment: +1 for munin monitoring
Comment: check it out : http://muninexchange.projects.linpro.no/?about
Comment: Yes Raven007, I do have munin installed and running on the server.  I just don't have any modules/plugins for apache yet.  Do you know where I can get some?

Why does apache slow down overnight?


How to store field data in a file instead of the db?

Question: So far, I found two decent options for storing field in a file:

using node hooks to store data in a filefield, and process it on node view
theoretically, the best would be to use file storage as a backend, but is there a module for field file storage instead of field sql storage?

My use case is a field that does not change, but mysql backup is very slow because there are 600 000 nodes with it. I also do not need to query this field, just display it. With file storage I can do incremental backup which is lightyears more efficient.
Answer: Your best bet's going to be using the MongoDB module, I think ... Here is a quote about it (from the module's project page):

... is a collection of several modules which allow sites to store different types of Drupal data in MongoDB.
Views integration provided by EntityFieldQuery Views Backend.


Nginx- How can I serve my static content with https that has a proxy in location block?

Question: My server listen 443 port and redirects the requests to another port in the server. Also my server listen 80 port and displays a static content the user when they browse http://www.xxxx.com
But I want also to display static content when user browse https://www.xxxx.com
How can I manage this ? My Nginx config file is ;
server {

   listen 443 ssl;
   server_name xxxx.com;
   ssl_certificate /etc/nginx/ssl/nginx.crt;
   ssl_certificate_key /etc/nginx/ssl/nginx.key;

   location / {
expires off;
      proxy_pass http://backend;
   }
}

server {
  listen 80;
  listen [::]:80;

   server_name xxxx.com;
   root /var/www/xxxx.com/html;
   index index.html;

   location / {
try_files $uri $uri/=404;
   }
}

I want to display my index.html file when user browse my website with https://www.xxxx.com and my proxy will continue to work at backend
Answer: You can invoke a named location as the default action of your try_files statement.
For example:
location / {
    try_files $uri $uri/ @proxy;
}
location @proxy {
    proxy_pass http://backend;
}

See this document for details.


Geojson data is not properly visible on the archgis map

Question: I am trying to show Pakistan flood data on the ArcGIS map. the map is loading fine. Geojsos'   point is showing as well but when I click it, it doesn't show any data. Can you please look into this? I feel there is an issue with the layers but unable to troubleshoot. Please look into this?
Here is my map component:
import React, { useRef, useEffect, useState } from 'react';
import { loadModules } from 'esri-loader';

const loadEsriModules = async () => {
  const [MapView, WebMap, GeoJSONLayer, PopupTemplate] = await loadModules([
    'esri/views/MapView',
    'esri/WebMap',
    'esri/layers/GeoJSONLayer',
    'esri/PopupTemplate',
  ]);
  return { MapView, WebMap, GeoJSONLayer, PopupTemplate }; // Add PopupTemplate to the returned object
};

export default function PakFlood() {
  const mapEI = useRef(null);
  const [mapLoaded, setMapLoaded] = useState(false);

  useEffect(() => {
    const initMap = async () => {
      if (mapLoaded) {
        return; // Map has already been loaded, do not load again
      }

      const { MapView, WebMap, GeoJSONLayer, PopupTemplate } = await loadEsriModules(); // Include PopupTemplate
      let view;

      if (typeof window !== 'undefined') {
        const webmap = new WebMap({
          basemap: 'topo-vector',
        });

     //   const centerCoordinates = [69.3451, 30.3753];

        view = new MapView({
          map: webmap,
          center: [69.3451, 30.3753],
          zoom: 5,
          container: mapEI.current,
        });

        try {
          // Simplified Popup Template
          const popupTemplate = new PopupTemplate({
            title: "Flood Data",
            content: "{Death} deaths, {Injuries} injuries",
          });

          console.log("GeoJSON Layer created");  // Debugging Step 1

          const geojsonLayer = new GeoJSONLayer({
            url: '/GeoJson.json',
            popupTemplate: popupTemplate,
          });

          console.log("Before adding layer:", webmap.layers.length);  // Debugging Step 2

          // Add the GeoJSON layer to the map
          webmap.add(geojsonLayer);

          console.log("After adding layer:", webmap.layers.length);  // Debugging Step 2

          setMapLoaded(true);
        } catch (error) {
          console.error("An error occurred:", error);  // Debugging Step 4
        }
      }

      return () => {
        if (view) {
          view.destroy();
        }
      };
    };

    return () => initMap();
  }, []);

  return

;
}

my geojson file is:
{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "properties": {
        "Death": 336,
        "Injuries": 106,
        "Home Damaged": "4,26,897"

      },
      "geometry": {
        "coordinates": [
          67.02502796328298,
          30.208618740113437
        ],
        "type": "Point"
      },
      "id": 0
    },
    {
      "type": "Feature",
      "properties": {
        "Death": 309,
        "Injuries": 348,
        "Home Damaged": "3,26,897"

      },
      "geometry": {
        "coordinates": [
          71.56406913421023,
          34.166707649222474
        ],
        "type": "Point"
      }
    },
    {
      "type": "Feature",
      "properties": {
        "Death": 799,
        "Injuries": 8422,
        "Home Damaged": "57,496"

      },
      "geometry": {
        "coordinates": [
          66.97593758543181,
          25.004585896445533
        ],
        "type": "Point"
      }
    },
    {
      "type": "Feature",
      "properties": {
        "Death": 23,
        "Injuries": 8,
        "Home Damaged": "1,160"

      },
      "geometry": {
        "coordinates": [
          74.31454667531628,
          35.99794367334606
        ],
        "type": "Point"
      }
    },
    {
      "type": "Feature",
      "properties": { "Death": 223,
        "Injuries": 3858,
        "Home Damaged": "UNKNOWN"
},
      "geometry": {
        "coordinates": [
          74.28116274467547,
          31.745012657468934
        ],
        "type": "Point"
      }
    }
  ]
}

Answer: Having recently finished a map project(only for Nuclear bombs), I feel your pain. To show data when you click a GeoJSON point, you'll need to add a popup template to your GeoJSONLayer. A popup template defines the content displayed in a popup when a user clicks a feature.
Make sure you import the necessary modules from esri-loader.
Create Popup Template to show Death, Injuries, and Home Damaged.
Attach Popup to Layer: Attach the PopupTemplate to your GeoJSONLayer.
Add Layer to Map.
import React, { useRef, useEffect, useState } from 'react';
import { loadModules } from 'esri-loader';

const loadEsriModules = async () => {
  const [MapView, WebMap, GeoJSONLayer, PopupTemplate] = await loadModules([
    'esri/views/MapView',
    'esri/WebMap',
    'esri/layers/GeoJSONLayer',
    'esri/PopupTemplate'
  ]);
  return { MapView, WebMap, GeoJSONLayer, PopupTemplate };
};

export default function PakFlood() {
  const mapEl = useRef(null);
  const [mapLoaded, setMapLoaded] = useState(false);

  useEffect(() => {
    const initMap = async () => {
      if (mapLoaded) {
        return; // Map has already been loaded, do not load again
      }

      const { MapView, WebMap, GeoJSONLayer, PopupTemplate } = await loadEsriModules();
      let view;

      if (typeof window !== 'undefined') {
        const webmap = new WebMap({
          basemap: 'topo-vector',
        });

        const centerCoordinates = [69.3451, 30.3753];

        view = new MapView({
          map: webmap,
          center: centerCoordinates,
          zoom: 5,
          container: mapEl.current,
        });

        // Create a PopupTemplate
        const popupTemplate = new PopupTemplate({
          title: "Flood Data",
          content: [
            {
              type: "fields",
              fieldInfos: [
                { fieldName: "Death", label: "Deaths" },
                { fieldName: "Injuries", label: "Injuries" },
                { fieldName: "Home Damaged", label: "Homes Damaged" },
              ],
            },
          ],
        });

        // Create a GeoJSONLayer using your GeoJSON data
        const geojsonLayer = new GeoJSONLayer({
          url: '/GeoJson.json',
          popupTemplate: popupTemplate, // Attach the popup template
        });

        // Add the GeoJSON layer to the map
        webmap.add(geojsonLayer);

        setMapLoaded(true);
      }

      return () => {
        if (view) {
          view.destroy();
        }
      };
    };

    initMap();
  }, [mapLoaded]);

  return

;
}

Comment: From your screenshot, it looks like you are missing the [CSS](https://developers.arcgis.com/javascript/latest/get-started/#1-install-and-set-up) or it is not loading properly in your configuration. Just noticed, you are using esri-loader. It provides a way to [load the css by default](https://github.com/Esri/esri-loader#loading-styles).
Comment: Thanks for your prompt response I tried earlier with the popup template too but it is not showing the data on the map.  here is a screenshot: https://ibb.co/thSWhJb
Comment: @odoenet, Thanks so much!! I have added missing CSS and the code works fine.
Answer: It's tough to say without see the full code, but you can run some logs:
const geojsonLayer = new GeoJSONLayer({
            url: '/GeoJson.json',
            popupTemplate: popupTemplate,
          });

console.log("Before adding layer:", webmap.layers.length);  // Debugging Step 2

          // Simplified Popup Template
          const popupTemplate = new PopupTemplate({
            title: "Flood Data",
            content: "{Death} deaths, {Injuries} injuries"  // Debugging Step 3
          });

          const geojsonLayer = new GeoJSONLayer({
            url: '/GeoJson.json',
            popupTemplate: popupTemplate,
          });

          console.log("GeoJSON Layer created");  // Debugging Step 1

          webmap.add(geojsonLayer);

          console.log("After adding layer:", webmap.layers.length);  // Debugging Step 2

          setMapLoaded(true);
        }
      } catch (error) {
        console.error("An error occurred:", error);  // Debugging Step 4
      }
    };

    initMap();
  }, [mapLoaded]);

and tell me what they report, or if you figure it out from the logs, all good!
Comment: thanks for the code. I updated the above code. the issue is still persistent. The code is working fine.


ASP Page hosting an ASPX page rendered using XSLT

Question: I have a ASP page that has a DIV to load up ASPX page. The ASPX page is rendered using XSLT.
I am trying to solve some issue. How can I print the value of the following condition

            <xsl:if test="$EXPAND=APPLICATION_ID">

            </xsl:if>

                <xsl:value-of select="APPLICATION_ID" />

            <xsl:value-of select="APPLICATION_NAME" />

            <xsl:value-of select="DATE_CREATED" />

    <xsl:if test="$EXPAND=APPLICATION_ID">
        <xsl:call-template name="show_application_block" />
    </xsl:if>

I want to print the value of $EXPAND and see whether the condition is true. How can this be done?
Answer: you need to put quotes around the value APPLICATION_ID, I believe for the comparison to work.
To output the value, just use xsl:value-Of element.
Simon
Comment: Thanks for the Xsl:Value-Of it works. For some reason it is false. I didn't understand your first comment about APPLICATION_ID.
Comment: I think you can ignore the first comment. I think I was wrong.


Slash chords and notation for A/C (according to Haunschild Book)

Question: I am currently working on a book on music-theory by Haunschild "Die neue Harmonielehre" (the question is not too specific so it might also have some general value for people not working with this book. Nonetheless I will use the table in the book (see photo) as a reference.)
In the table it is stated that the slash chord of the form "A/C" is a C(7/♭9/13) chord without fifth and seventh ("ohne Quinte und Septime" in the book). It is also stated that B♭/C is a C(7/9/sus4) chord without fifth and seventh.
The questions:

Why is "A/C" given as "C(7/♭9/13)"? Up to this point in the table all slash chord definitions made sense to me but there is no 7th and still it is added to the chord symbol and then it is stated that there is no 7th afterwards. The chord consists of the notes "C-A-C♯-E" in rising order so to me it would be a C(6/♭9) chord. Because the sixth is in the same octave (below the C one octave higher) I thought it should be "6" and not "13" added to the chord and more strangely why is a "7" added if it is not in the chord? What am I missing here?
In a previous section of the book (this should be a general thing in chord notation too I assume) it is stated that "add9" is used if the seventh of the chord is taken out and "9" if the seventh is either part of the chord or not. Now in the table the slash chord "B♭/C" is given as "C(7/9/sus4) without fifth and seventh". Even if the chord in question one is written like it is for some reason this (for my understanding) is clearly the case for which "add9" was conceived. So I would write it as "C(add9/sus4)". So same question: what am I missing here?

The only explanation I could come up with was that the notation always includes all stacked thirds up to the highest even if they are not included but it is not stated explicitly in the previous chapters. If this is the case could someone please explain to me why it is done that way (if it is not purely for historical reasons).
I am not a classically trained musician so I assume I got a wrong idea of something I learned from the book previously. It would be great if someone could explain this to me. Thank you in advance.
Answer: Why A/C = C13(♭9)
Here's how to think about this chart: the slash chords provide optional ways to "voice" or spell out more formal chords. And it's okay to voice a chord in a way that is incomplete. For example, if you're reading a piece of music that says "Cmin7," you're not strictly required to play C-E♭-G-B♭ every single time the Cmin7 chord appears. The Cmin7 chord will occur repeatedly as we cycle through the form, and so it's okay for the musician merely to hint at the underlying harmony without playing the full chord. For example, it's perfectly fine to voice a Cmin7 chord with: D-E♭-G. This chord voicing doesn't contain the flatted 7th and contains an extra note (the 2nd/9th). But that's not a problem. Not every iteration/voicing of the chord must contain every note. This is particularly true in jazz.
So, while the chord A/C is not a full and complete voicing for C13(♭9), it is still a very good option. If you're reading a piece of music and you suddenly see C13(♭9), you can immediately think "oh, A/C will sound good." The advantage here is that, when you see C13(♭9), it's simpler to replace it with the slash chord A/C. In effect, the goal of this chart is to demystify complex chords like C13(♭9) by translating them (partially or wholly) into simple triads/slash chords.
You might be wondering why A/C only works for C13(♭9) and not CMaj6(♭9). There's no logical reason why a CMaj6(♭9) can't exist--it's just very uncommon. The ♮6th/♮13th and the flat 9th is a very unique combination of  alterations and extensions, and that specific combination almost exclusively occurs over a dominant 7th chord and almost never occurs over a major 7th chord. Thus, it's much more useful for the book to list C13(♭9) as the underlying harmony.
B♭/C = C7sus
The book contains a typo here. The chord B♭/C does contain the 7th! The 7th of C7sus is B♭, and B♭ is part of the slash chord B♭/C. So the book is correct that B♭ = C7sus, and it's true that we don't need the text "add9" in this case since the 7th is present. The book states that B♭/C omits the 7th, but this is incorrect.
In general, the book is correct about the fact that, if you see "add9" written on the page, then the underlying harmony must omit the 7th. However, it's fine to voice an add9 chord with a subset of its notes.
Note
I've simplified the chord's notation. Instead of calling it C7/♭9/13, I'm calling it C13(♭9). This is fine because a C13 chord implies a flatted 7th. By contrast, a C6 chord wouldn't imply any 7th. To read more about these conventions, check out this great answer: https://music.stackexchange.com/a/20561/40842.


where to modify value of data-plyr-embed-id in plyr source code?

Question: I want to "hide" real ID of the video I am using on my website. I was thinking that I can somehow encrypt the ID before using it in html source code and then encrypt it back to normal in plyr. My knowledge is not good enough to find the right place where I can do that in the plyr.js file
Could someone help me?
I can see only one occurence of the string in the souce code
<code>// Embed attributes
attributes: {
  embed: {
    provider: 'data-plyr-provider',
    id: 'data-plyr-embed-id'
  }
},
</code>
but have no idea how do track the right place where I can modify the value.
It would help me if you could write how you found the right place. I was helped how to modify data-plyr-provider but was given the fish. So still looking how to fish
Answer: Warning: this answer may become outdated as the source changes. Find the references to embed.id in

youtube.js

and

vimeo.js

and add e.g. decryption (assuming you encrypt the id in the div)
https://github.com/sampotts/plyr/search?q=embed.id
The lines are:
<code>// Get from <div> if needed
if (is.empty(source)) {
  source = player.media.getAttribute(this.config.attributes.embed.id);
}
</code>
Change this to e.g.:
<code>// Get from <div> if needed
if (is.empty(source)) {
   source = player.media.getAttribute(this.config.attributes.embed.id);
   source = decrypt(source);
}
</code>
But note that this is still not very secure, as the player will need to know the actual id at some point, and it has to be plain text. This only obfuscates the value in your HTML source. The ID will also be discernible from analyzing the requests the player makes to Youtube/Vimeo.