text:
Q: Why getting a 202 in two equal setup structuremap code paths In the C# language, using StructureMap 2.5.4, targeting .NET Framework 3.5 libraries.
I've taken the step to support multiple Profiles in a structure map DI setup, using ServiceLocator model with Bootstrapper activation. First setup was loading default registry, using the scanner.
Now I like to determine runtime what Registry configuration I like to use. Scanning and loading multiple assemblies with registries.
Seems it's not working for the actual implementation (Getting the 202, default instance not found), but a stripped test version does work. The following setup.

*

*Two assemblies containing Registries and implementations

*Scanning them in running AppDomain, providing the shared Interface, and requesting Creation Of Instance, using the interfaces in constructor (which get dealt with thanx to the profile on Invokation)

Working code sample below (same structure for other setup, but with more complex stuff, that get's a 202):
What type of couses are possible for a 202, specifically naming the System.Uri type, not being handles by a default type?? (uri makes no sense)
// let structure map create instance of class tester, that provides the registered
// interfaces in the registries to the constructor of tester.

   public class Tester<TPOCO>
                {
                    private ITestMe<TPOCO> _tester;

                    public Tester(ITestMe<TPOCO> some)
                    {
                        _tester = some;
                    }

                    public string Exec()
                    {
                        return _tester.Execute();
                    }
                }

     public static class Main {
            public void ExecuteDIFunction() {
            ObjectFactory.GetInstance<Tester<string>>().Exec();
            }
        }

    public class ImplementedTestMe<TSome> : ITestMe<TSome>
        {
            public string Execute()
            {
                return "Special Execution";
            }
        }

    public class RegistryForSpecial : Registry
        {
            public RegistryForSpecial()
            {
                CreateProfile("Special",
                              gc =>
                                  {
                                      gc.For(typeof(ITestMe<>)).UseConcreteType(typeof(ImplementedTestMe<>));

                                  });
            }
        }

*

*Background articles on Profiles I used.

*How to setup named instances using StructureMap profiles?

*http://devlicio.us/blogs/derik_whittaker/archive/2009/01/07/setting-up-profiles-in-structuremap-2-5.aspx

*http://structuremap.sourceforge.net/RegistryDSL.htm
EDIT:
It seemed the missing interface was actually the one being determined runtime. So here is the next challange (and solved):
I provided a default object whenever StructureMap needs to create the object. Like:
x.ForRequestedType<IConnectionContext>()
                  .TheDefault.Is.Object(new WebServiceConnection());

This way I got rid of the 202 error, because now a real instance could be used whever structure map needed the type.
Next was the override on runtime. That did not work out at first using the ObjectFactory.Configure method. Instead I used the ObjectFactory.Inject method to overide the default instance. Works like a charm.
ObjectFactory.Inject(typeof(IConnectionContext), context);

Loving the community effort.

A: Error code 202 means a default instance could not be built for the requested type. Your test code is apparently not equal to your real code that fails. If you are getting an error about Uri, you likely have a dependency that requires a Uri in its constructor. It may not be the class you are asking for - it may be one of that classes dependendencies - or one of the dependencies dependencies... somewhere down the line someone is asking StructureMap to resolve a Uri, which it cannot do, without some help from you.


text:
Q: Local scale invariance without conformal anomaly I need to know if conformal symmetry can be localized in the same manner that global symmetries like $SU(2)$ is localized and gauge bosons pop up?(I assume the trace anomaly doesn't violate the scale invariance symmetry)
If so what is the particle that appears after localization?
Is such symmetry compatible with the rest of the Standard Model symmetries? (In other words, if it can create any violation of mixed vectorial current anomaly via triangle diagrams)

redpajama_set_name: RedPajamaStackExchange


text:
Q: calculate kernels of matrices with angles So my professor gave me this question:
I have to find the basis of the eigenvalues of this matrix
\begin{pmatrix}
  \cos(q) & \sin(q)\\
  \sin(q) & -\cos(q)\\
  \end{pmatrix}
so I calculate the eigenvalues and I found it is 1 and -1.
so now I need to find the basis of the kernel of those matrices
\begin{pmatrix}
  1-\cos(q) & -\sin(q)\\
  -\sin(q) & 1+\cos(q)\\
  \end{pmatrix}
\begin{pmatrix}
  -1-\cos(q) & -\sin(q)\\
  -\sin(q) & -1+\cos(q)\\
  \end{pmatrix}
so actually I need to find
\begin{pmatrix}
  a \\ b\\
  \end{pmatrix}
that will be function as basis for the kernel of each one of those matrices.
but how do I do it ?
I know how to do it when there is no angles meaning I would just compare it to zero.
for example in the first matrix I get these two equations :
$x-xcos(q)-ysin(q)=0$
$-xsin(q)+y+ycos(q)=0$
so I get this equation:
$x(-sin(y)+((1-cos(y))/(sin(y)))+((cos(y)-cos(y)cos(y))/(sin(y))))=0$
which is true for every $x$ and then I can assign some value to $x$ for example zero and then $y$ equal zero also but after I am checking it, it is not true.
could u please help me ?
so how can I do it ?
All he told us is that $q\neq{0}$ and $q\neq\pi$ and $q\neq{2}\pi $
and nothing more.

A: Observe that $\cos(q-\pi/2)=\sin q$, and $\sin(q-\pi/2)=-\cos q$. So, the linear transformation corresponding to the matrix sends ${\bf i}\,(=\pmatrix{1\\0})$ to $\bf u$ in the unit circle at angle $q$ (the first column) and sends ${\bf j}\,(=\pmatrix{0\\1})$ to $\bf v$ in the unit circle at angle $q-\pi/2$.
If you draw it, it could be clear that the reflection through the line $e$ at angle $q/2$ also does the same to the basis vectors $\bf i$ and $\bf j$. As both are linear and coincide on a basis, we get that this is the matrix of reflection through $e$. From this, we easily get the eigenvectors: vectors parallel to $e$ will be fixed (i.e. they correspond to eigenvalue $1$) and vectors orthogonal to $e$ will be reversed (i.e. they correspond to eigenvalue $-1$).


text:
Q: Should the rep limit be raised for access to admin tools?
Possible Duplicate:
What to do about rep inflation?

Should the rep limit be raised for access to moderation tools? As the site's continue to grow more and more people will breech the 10k barrier(currently 100+ on SO). I'm not 100% sure that this is a problem, but is there ever a point where too many people having access to mod tools becomes a bad thing?

A: I'm sure this is a duplicate but I'm too lazy to search.
To summarize the old discussions: Basically, as the number of questions increases, we need more moderation and we'll get more moderators and we'll end up having a stable moderator/post ratio. Increasing the threshold will reduce the moderator/post ratio.


text:
Q: Dijit dialog fires onshow event before visible I've got myself trying to create a dialog with a progress bar in dojo.
When it is visible, on an onshow event, I want to trigger a recursive function to process code, and update the progress bar.  Problem is, the onshow fires before the dialog is visible, and the recursive processing completes and destroys the dialog with progress bar before it even becomes visible
Here's a vague code sample (ignore some of the custom classes, like panelManager, etc. When the dialog shows, I have a function I wish to call..
register_dialog = panelManager.getActive();
        //createPanel(panelManager.getActive().domNode, true, '', "Number of " + text_correction("Sample")+"s Registered", '', null, 90, 290, null, false, null);
        dialog = new dialog_simple({
            title: "Number of " + text_correction("Sample")+"s Registered",
            isLayoutContainer: true,
            containerNode: register_dialog.domNode,
            href: "blank.html",
            preload: true,
            parseOnLoad: true
        });

        dialog.domNode.style.width = "290px";
        dialog.domNode.style.height = "70px";

        progress = new ProgressBar({
            style: "width:270px",
            id: "register_progress",
            maximum: numOfSamples,
            value: 0,
            label: "0 of " +numOfSamples
        });
        dialog.on("show", function() {
            startRegister(theJSON, theHeaderData, currentSample, theSamples, dialog, progress, register_dialog);
        });
        dialog.on("cancel", function() {
            dijit.registry.remove(progress.id);
            progress.destroy();
            dialog.destroyRecursive()

        });
        dialog.set("content",progress);
        progress.startup();
        dialog.startup();
        dialog.show();

ANYWAY, it fires the function before the dialog is visible... ideas?


text:
Q: Postgres: Strategies for optimizing access to recent data If we have the following requirements:

*

*Data is frequently inserted into the database

*We want to have fast access to the latest rows

*We can tolerate slower access to older rows

What are the best strategies that we can use in Postgres?

To give a concrete toy example:
We have a Slack-like chat application, and we are storing chat messages into the database. Access to the latest messages in any channel needs to be fast, but fast access to messages from a month is not necessary.


text:
Q: How do i display the NESTED JSON data using php? I coding a whole day just to display the nested Data from JSON that i got from the Api Provider but nothings gonna change. It's always error! what should i do?
Here's my code hope you help me in this problem.
Imagine my name of json file is 05-03-21.json.
and here's the JSON Data
    {
   "result":"OK",
   "data":{
      "body":{
         "header":"Manila, National Capital Region, Philippines",
         "query":{
            "destination":{
               "id":"1004070",
               "value":"Manila, National Capital Region, Philippines",
               "resolvedLocation":"CITY:1004070:UNKNOWN:UNKNOWN"
            }
         },
         "searchResults":{
            "totalCount":1286,
            "results":[
               {
                  "id":438619,
                  "name":"OYO 653 Rosas Garden Hotel",
                  "starRating":3,
                  "urls":[

                  ],
                  "address":{
                     "streetAddress":"1140 MH Del Pilar St., Ermita",
                     "extendedAddress":"",
                     "locality":"Manila",
                     "postalCode":"1000",
                     "region":"Manila",
                     "countryName":"Philippines",
                     "countryCode":"ph",
                     "obfuscate":false
                  },
                  "welcomeRewards":{
                     "collect":true
                  },
                  "guestReviews":{
                     "unformattedRating":7,
                     "rating":"7.0",
                     "total":29,
                     "scale":10,
                     "badge":"good",
                     "badgeText":"Good"
                  },
                  "landmarks":[
                     {
                        "label":"City centre",
                        "distance":"2.0 km"
                     },
                     {
                        "label":"Manila Bay",
                        "distance":"7.6 km"
                     }
                  ],
                  "geoBullets":[

                  ],
                  "ratePlan":{
                     "price":{
                        "current":"P1,287",
                        "exactCurrent":1286.71,
                        "old":"P2,383",
                        "summary":"excluding taxes & fees"
                     },
                     "features":{
                        "freeCancellation":false,
                        "paymentPreference":false,
                        "noCCRequired":false
                     },
                     "type":"EC"
                  },
                  "neighbourhood":"Ermita",
                  "deals":{
                     "specialDeal":{
                        "dealText":"Save 46%"
                     },
                     "priceReasoning":"DRR-446"
                  },
                  "messaging":[

                  ],
                  "badging":[

                  ],
                  "pimmsAttributes":"DoubleStamps|D13|TESCO",
                  "coordinate":{
                     "lat":14.578154,
                     "lon":120.979947
                  },
                  "providerType":"LOCAL",
                  "supplierHotelId":6457589,
                  "isAlternative":false,
                  "optimizedThumbUrls":{
                     "srpDesktop":"https:\/\/thumbnails.trvl-media.com\/uQm5oEf1djKsihiqX24-TfWhriQ=\/250x140\/smart\/filters:quality(60)\/images.trvl-media.com\/hotels\/7000000\/6460000\/6457600\/6457589\/b189dd23_z.jpg"
                  }
               },
               {
                  "id":756613600,
                  "name":"Astrotel Anonas",
                  "starRating":3,
                  "urls":[

                  ],
                  "address":{
                     "streetAddress":"960 Aurora Boulevard",
                     "extendedAddress":"near LRT Anonas Station",
                     "locality":"Quezon City",
                     "postalCode":"",
                     "region":"",
                     "countryName":"Philippines",
                     "countryCode":"ph",
                     "obfuscate":false
                  },
                  "welcomeRewards":{
                     "collect":true
                  },
                  "guestReviews":{
                     "unformattedRating":4.8,
                     "rating":"4.8",
                     "total":40,
                     "scale":10
                  },
                  "landmarks":[
                     {
                        "label":"City centre",
                        "distance":"10 km"
                     },
                     {
                        "label":"Manila Bay",
                        "distance":"17 km"
                     }
                  ],
                  "geoBullets":[

                  ],
                  "ratePlan":{
                     "price":{
                        "current":"P1,295",
                        "exactCurrent":1294.64,
                        "summary":"excluding taxes & fees"
                     },
                     "features":{
                        "freeCancellation":false,
                        "paymentPreference":false,
                        "noCCRequired":false
                     },
                     "type":"EC"
                  },
                  "neighbourhood":"Quezon City",
                  "deals":[

                  ],
                  "messaging":[

                  ],
                  "badging":[

                  ],
                  "pimmsAttributes":"DoubleStamps|D13|TESCO",
                  "coordinate":{
                     "lat":14.627763,
                     "lon":121.06376
                  },
                  "providerType":"LOCAL",
                  "supplierHotelId":23612925,
                  "isAlternative":false,
                  "optimizedThumbUrls":{
                     "srpDesktop":"https:\/\/thumbnails.trvl-media.com\/0GhZSM5K0XRDs9aaIYn2FuUBUqk=\/250x140\/smart\/filters:quality(60)\/images.trvl-media.com\/hotels\/24000000\/23620000\/23613000\/23612925\/c83bf0b0_z.jpg"
                  }
               }
            ]
         },
         "common":{
            "pointOfSale":{
               "numberSeparators":",.",
               "brandName":"Hotels.com"
            },
            "tracking":{
               "omniture":{
                  "s.prop33":"D=v33",
                  "s.prop32":"D=v43",
                  "s.prop74":"search result with dates | ms shown | N",
                  "s.products":"MULTISOURCE;6457589,LOCAL;23612925,LOCAL;23612485",
                  "s.eVar16":"Mob :: aApp",
                  "s.eVar40":"D=v0",
                  "s.eVar41":"PHP",
                  "s.eVar63":"60acf7e5-d622-4a1a-8110-a1fac036b405",
                  "s.eVar42":"30|1|20210404|20210405",
                  "s.eVar4":"|SI:anonymous|VS:returnVisitor|HCR:notApplicable|FC:notApplicable|NS:unknown|TI:notApplicable|SM:notApplicable|IR:anonymous|",
                  "s.eVar43":"en_PH|HCOM_PH|ph.hotels.com",
                  "s.eVar3":"2|0",
                  "s.eVar22":"5|PHP|24:438619:2382.7900:1286.7100:1|24:756613600:1294.6400:1294.6400:0|24:756599520:1294.6400:1294.6400:0|24:2052351936:1442.6200:1298.3600:0|24:454367:2407.3200:1299.9500:0",
                  "s.eVar2":"Manila, National Capital Region, Philippines",
                  "s.eVar23":"5|PHP|24:1279267456:1446.4300:1301.7900:0|24:632077728:2176.8300:1306.1000:1|24:494528:1455.3600:1309.8200:0|24:633744:1311.4800:1311.4800:0|24:1841636192:1311.4800:1311.4800:0",
                  "s.eVar24":"MCTC=20;TU=NA;PDID=NULL;MVT=",
                  "s.eVar7":"30",
                  "s.server":"ph.hotels.com",
                  "s.eVar6":"1004070",
                  "s.prop29":"D=v42",
                  "s.eVar5":"1",
                  "s.prop27":"1f6f9be9-a413-4f39-874c-86385cfe9627",
                  "s.eVar9":"Price - low to high",
                  "s.prop21":"0",
                  "s.prop20":"2",
                  "s.eVar69":"Mob :: aApp",
                  "s.currencyCode":"PHP",
                  "s.eVar26":"US:NY:NEWYORK:501",
                  "s.eVar29":"Mob :: aApp",
                  "s.prop9":"1286",
                  "s.eVar95":"Unknown",
                  "s.prop7":"1252",
                  "s.eVar31":"D=v0",
                  "s.eVar32":"D=v0",
                  "s.eVar33":"search result with dates",
                  "s.eVar34":"H1871:007.002,M376:152.000,M904:000.000,M3736:000.000,M4200:000.000,M4440.2,M4869:001.000,M4952:036.001,M4961:001.000,M5184:001.000,M5342:000.000,M5663:000.000,M6388:000.000,M6775:000.000,M6779:000.000,M7015.1,M7192:000.000,M7215:000.000,M7296:000.000,M7305:000.000,M7353:000.000,M7362.0,M7384:000.000,M7552:023.001,M7561:000.000,M7763:000.000,M7765.2,M7870:000.000,M7895:000.000,M8336:000.000,M8347:019.002,M8483:000.000,M8485:007.001,M8692:000.000,M8693:000.000,M8698:000.000,M8708:000.000,M8714:000.000,M8718:000.000,M8758:000.000,M8915:000.000,M8928:000.000,M8952:000.000,M8954:000.000,M8976:000.000,M8992:000.000,M9004:000.000,M9035:000.000,M9065:000.000,M9220:000.000,M9281:000.000,M9282:000.000,M9297:000.000,M9301:000.000,M9351:000.000,M9420:000.000,M9431:000.000,M9469:000.000,M9549:000.000,M9567.1,M9691:000.000,M9693:000.000,M9699:000.000,M9716:000.000,M9729:000.000,M9752:000.000,M9771:000.000,M9853:000.000,M9857:000.000,M9864:000.000,M9924:000.000,M9927:000.000,M9945:000.000,M9961:000.000,M9971:000.000,M10001:000.000,M10007:000.000,M10010:000.000,M10013:002.001,M10068:000.000,M10121:000.000,M10125:000.000,M10137:001.001,M10148:000.000,M10155:000.000,M10248:000.000,M9215:001.000",
                  "s.eVar13":"389242",
                  "s.prop19":"1",
                  "s.events":"event324,event319,event320",
                  "s.prop18":"D=v6",
                  "s.prop5":"389242",
                  "s.prop15":"1",
                  "s.prop3":"Manila, National Capital Region, Philippines",
                  "s.prop14":"D=v7",
                  "s.prop36":"|SI:anonymous|VS:returnVisitor|HCR:notApplicable|FC:notApplicable|NS:unknown|TI:notApplicable|SM:notApplicable|IR:anonymous|",
                  "s.eVar93":"aws.us-west-2.unknown",
                  "s.prop2":"Price - low to high"
               }
            }
         }
      }
   }
}

And here's my php code.
                <?php

                $filepath = '05-03-21.json';
                $json_string = file_get_contents($filepath);
                $json_data = json_decode($json_string,true);

                $json_data = json_decode($json_string,true);
                foreach ($json_data as $var_1 ) {
                    foreach ($var_1['searchResults'] as $var_2 ) {
                        echo "Hotel Name: ".$var_2['name']."
";
                        echo "Ratings: ".$var_2['starRating']."
";
                        echo "Location: ".$var_2['address']['locality']."
";
                    }

                }

            ?>

All i wanna do is to display the Data with loop something like this.
Image here

A: just parse the correct array with :
foreach ($json_data['data']['body']['searchResults']['results'] as $var_1 ) {
  echo "Hotel Name: ".$var_1['name']."
";
  echo "Ratings: ".$var_1['starRating']."
";
  echo "Location: ".$var_1['address']['locality']."
========
";
}


text:
Q: Horizontal LinearLayout won't match parent when using it under HorizontalScrollView I want to create an horizontal scroll view for my app
(I have six buttons needed to be distributed equally), everything
works fine when using smaller display (nexus 6 1440x 2560), but when using bigger display (pixel C 2560x1800) I got some space. I remarked
that LinearLayout width cover only the content even though I'm using
match_parent in android:layout_width
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.example.android.xieon_2.Home_dashboard">

    <LinearLayout
        android:id="@+id/main_vertical_layout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        tools:ignore="MissingConstraints"
        tools:layout_editor_absoluteX="0dp"
        tools:layout_editor_absoluteY="30dp">

        <HorizontalScrollView
            android:layout_marginTop="10dp"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:gravity="center_horizontal"
                android:orientation="horizontal">

                <ImageButton
                    android:id="@+id/bedroom_but"
                    android:layout_width="80dp"
                    android:layout_height="80dp"
                    android:layout_marginLeft="10dp"
                    android:background="@drawable/round_shape"
                    android:src="@drawable/bedroom_icon" />

                <ImageButton
                    android:id="@+id/kitchen_but"
                    android:layout_width="80dp"
                    android:layout_height="80dp"
                    android:layout_marginLeft="9dp"
                    android:background="@drawable/round_shape"
                    android:src="@drawable/kitchen_icon" />

                <ImageButton
                    android:id="@+id/living_room_but"
                    android:layout_width="80dp"
                    android:layout_height="80dp"
                    android:layout_marginLeft="9dp"
                    android:background="@drawable/round_shape"
                    android:src="@drawable/living_room" />

                <ImageButton
                    android:id="@+id/kids_room_but"
                    android:layout_width="80dp"
                    android:layout_height="80dp"
                    android:layout_marginLeft="9dp"
                    android:background="@drawable/round_shape"
                    android:src="@drawable/kids_room_icon" />

                <ImageButton
                    android:id="@+id/bathroom_but"
                    android:layout_width="80dp"
                    android:layout_height="80dp"
                    android:layout_marginLeft="9dp"
                    android:background="@drawable/round_shape"
                    android:src="@drawable/bathroom_icon" />

                <ImageButton
                    android:id="@+id/Guestroom_but"
                    android:layout_width="80dp"
                    android:layout_height="80dp"
                    android:layout_marginLeft="9dp"
                    android:background="@drawable/round_shape"
                    android:src="@drawable/guest_room" />

            </LinearLayout>
        </HorizontalScrollView>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="----------------------------------------------------------------"
            android:textColor="@color/RoyalBlue"
            android:textSize="20sp" />

        <Button
            android:id="@+id/control_but"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            android:layout_marginTop="30dp"
            android:text="Control" />

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="30dp">

            <ImageView
                android:id="@+id/temp_icon_2"
                android:layout_width="50dp"
                android:layout_height="50dp"
                android:layout_marginLeft="10dp"
                android:src="@drawable/temperature_icon" />

            <TextView
                android:id="@+id/temp_val"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_toEndOf="@+id/temp_icon_2"
                android:text="26"
                android:textColor="@color/RoyalBlue"
                android:textSize="40sp" />

            <TextView
                android:id="@+id/degree_2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_toEndOf="@+id/temp_val"
                android:text="°"
                android:textColor="@color/RoyalBlue"
                android:textSize="40sp" />

            <TextView
                android:id="@+id/pcnt"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentEnd="true"
                android:layout_marginRight="10dp"
                android:text="%"
                android:textColor="@color/RoyalBlue"
                android:textSize="40sp" />

            <TextView
                android:id="@+id/hum_val_2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_toStartOf="@+id/pcnt"
                android:text="85"
                android:textColor="@color/RoyalBlue"
                android:textSize="40sp" />

            <ImageView
                android:id="@+id/humidity_icon_2"
                android:layout_width="50dp"
                android:layout_height="50dp"
                android:layout_toStartOf="@+id/hum_val_2"
                android:src="@drawable/humidity_icon" />

        </RelativeLayout>

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="50dp">

            <ImageView
                android:id="@+id/noise_icon"
                android:layout_width="70dp"
                android:layout_height="70dp"
                android:layout_alignParentStart="true"
                android:layout_alignTop="@+id/noise_unit"
                android:src="@drawable/air_quality" />

            <TextView
                android:id="@+id/noise_val"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerVertical="true"
                android:layout_toEndOf="@+id/noise_icon"
                android:text="15"
                android:textColor="@color/RoyalBlue"
                android:textSize="40sp" />

            <TextView
                android:id="@+id/noise_unit"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerVertical="true"
                android:layout_marginLeft="5dp"
                android:layout_toEndOf="@+id/noise_val"
                android:text="PPM"
                android:textColor="@color/RoyalBlue"
                android:textSize="28sp" />

            <TextView
                android:id="@+id/security_state"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignBottom="@+id/noise_val"
                android:layout_alignParentEnd="true"
                android:layout_marginEnd="12dp"
                android:text="ON"
                android:textColor="@color/RoyalBlue"
                android:textSize="35sp" />

            <ImageView
                android:id="@+id/security_icon"
                android:layout_width="50dp"
                android:layout_height="50dp"
                android:layout_alignBottom="@+id/noise_val"
                android:layout_toStartOf="@+id/security_state"
                android:src="@drawable/home_security"
                android:layout_marginTop="10dp"/>
        </RelativeLayout>
    </LinearLayout>
</LinearLayout>

app with large display
app with small display


text:
Q: OpenCV - Java : inRange function I have my image mRgba and when I do this :
Core.inRange(mRgba, B1, B2, mRgba);

I have the result that I expect : all my RGBA image is thresholded between B1 and B2.
Now I want to do this :
Mat roi = mRgba.submat(rect);
Core.inRange(roi, B1, B2, roi);

And it's not apply on my area rectangle, I try everything since 3 hours I can't find a solution...

A: OK, maybe everybody doesn't care, but after many tries, i found the answer.
Mat roi = new Mat();
roi = mRgba.submat(rect);
Mat roiTmp = roi.clone();

Imgproc.cvtColor(roiTmp, roiTmp, Imgproc.COLOR_RGB2HSV);

Core.inRange(roiTmp, B1, B2, roiTmp);

Imgproc.cvtColor(roiTmp, roi, Imgproc.COLOR_GRAY2BGRA);


text:
Q: No Such Method Exception thrown? The problem I am facing is that when I try to pass an item with the value java.util.ArrayList,pass args[2] with value "add" and Method Parameter with the value Integer it throws a NoSuchMethodException? Any help in this regard is much appreciated.
Stack Trace:
java.lang.NoSuchMethodException: java.util.ArrayList.add(java.lang.Integer)
at java.lang.Class.getDeclaredMethod(Unknown Source)
at com.acp.assignments.jcp.JCP.CallMethod(JCP.java:65)
at com.acp.assignments.jcp.JCP.InteractiveMode(JCP.java:129)
at com.acp.assignments.jcp.JCP.BatchOrInterActive(JCP.java:47)
at com.acp.assignments.jcp.Main.main(Main.java:29)

public void CallMethod(String[] args) throws Exception {
    HashMap<String, Object> temp=VariableslistHashMap;
    if(args[0].contains("call")) {
        for(Map.Entry<String, Object> item:temp.entrySet()) {
            for(Map.Entry<String, Object> MethodParameter:temp.entrySet()) {
                if(item.getKey().contains(args[1]) && MethodParameter.getKey().contains(args[3])) {
                    Method method=item.getValue().getClass().getDeclaredMethod(args[2],MethodParameter.getValue().getClass());
                    Object result=(Object) method.invoke(item.getClass(), MethodParameter.getValue());
                    System.out.println(result);
                }
            }
        }
    }
}

A: Try using Object as the key. Probably Integer is the type parameter, which is erased..
public static void main(String[] args) throws NoSuchMethodException, SecurityException {

    ArrayList<Integer> i = new ArrayList<>();
    i.getClass().getDeclaredMethod("add", new Class[] { Object.class } );  // Works
    i.getClass().getDeclaredMethod("add", new Class[] { Integer.class } ); // Fails
}


text:
Q: Qpython3 and androidhelper, droid.dialogSetSingleChoiceItems I am trying to figure out androidhelper, which I find very useful to work with python 3 and Android.  I am trying to return a selection from a list using dialogSetChoiceItems.  I have it set up, and I have tried various ways of going about it.  I will get something returned, but it is the length of the list.  Any help would be appreciated.  Thanks,
#-*-coding:utf8;-*-
#qpy:3
#qpy:console
import androidhelper
droid = androidhelper.Android()

def test_alert_dialog_with_single_choice_list(Title, ListOfStuff):

  droid.dialogCreateAlert(Title)
  droid.dialogSetSingleChoiceItems(ListOfStuff)

  droid.dialogSetPositiveButtonText('Select')
  droid.dialogShow()
  response = droid.dialogGetSelectedItems().result
  return response

if __name__ == '__main__':

    Listy = [1,2,3,4,5,6,7,8]
    YTitle = 'Title of The Thing'

    FReturn = test_alert_dialog_with_single_choice_list(YTitle, Listy)

    print(FReturn)

A: This example makes a dialog with "xyz" buttons and "abcde" items, then print(pressed_button, selected_items_indexes), and makeToast your pressed button and selected items. Try it! It worked fine on my phone, tell me if it doesn't on your phone.
#-*-coding:utf8;-*-
#qpy:2
#qpy:console
import androidhelper
droid=androidhelper.Android()
def mydialog(title,buttons=["OK"],items=[],multi=False):
    title = str(title)
    droid.dialogCreateAlert(title)
    if len(items) > 0:
        if multi:
            droid.dialogSetMultiChoiceItems(items)
        else:
            droid.dialogSetSingleChoiceItems(items)
    if len(buttons) >= 1:
        droid.dialogSetPositiveButtonText(buttons[0])
    if len(buttons) >= 2:
        droid.dialogSetNeutralButtonText(buttons[1])
    if len(buttons) >= 3:
        droid.dialogSetNegativeButtonText(buttons[2])
    droid.dialogShow()
    res0 = droid.dialogGetResponse().result
    res = droid.dialogGetSelectedItems().result
    if "which" in res0.keys():
        res0={"positive":0,"neutral":1,"negative":2}[res0["which"]]
    else:
        res0=-1
    return res0,res
items = [i for i in "abcde"]
btns = [i for i in "xyz"]
pressed_button, selected_items_indexes = mydialog("Dialog test!", btns, items, True)
print(pressed_button, selected_items_indexes)
if pressed_button == -1:
    droid.makeToast("You didn't press any buttons!")
else:
    droid.makeToast("You pressed %s!"%("xyz"[pressed_button]))
if selected_items_indexes == []:
    droid.makeToast("You selected nothing!")
else:
    selected_abc = "".join(["abcde"[i] for i in selected_items_indexes])
    droid.makeToast("You selected %s!"%selected_abc)


text:
Q: Idempotence of the interior of the closure I'm reading the Complex Analysis text by Ahlfors. I'm stuck on exercise 5 on chapter 3:
Prove that $\overline{\overline{\overline{{\overline{X}}^c}^c}^c}^c=\overline{{\overline{X}}^c}^c$.
I've manged to rephrase the question as $ Int(Cl(Int(Cl(X))))=Int(Cl(X))$.
I've proven one inclusion like so: $Int(Cl(X)) \subseteq Cl(Int(Cl(X)))$, taking interior of both sides gives $LHS \supseteq RHS$. How can I prove the other inclusion? Is there a way of proving both at once?
Thank you!
P.S. in the book, topological spaces haven't been defined yet. So it might be true for metric spaces only.

A: Provided that you know the following:
For any set $A$, $Int(A)\subset A \subset Cl(A)$ and for any sets $A \subset B$, $Int(A) \subset Int(B)$ and $Cl(A) \subset Cl(B)$
As you said, $Int(Cl(A))\subset Cl(Int(Cl(A)))$ and taking interiors gives $Int(Int(Cl(A))) \subset Int(Cl(Int(Cl(A))))$ so $Int(Cl(A)) \subset Int(Cl(Int(Cl(A))))$.
For the other direction, note that $Int(Cl(A)) \subset Cl(A)$ which gives $Cl(Int(Cl(A))) \subset Cl(Cl(A))=Cl(A)$ and this $Int(Cl(Int(Cl(A)))) \subset Int(Cl(A))$.
This is in fact true for any topological space, as is the related fact:
$Cl(Int(Cl(Int(A)))) = Cl(Int(A))$. These two statements tell us that for a given set $A$ we cant obtain a maximum of $7$ sets (including $A$) by taking interiors and closures. A good exercise is to find some $A \subset \mathbb{R}$ where all of the $7$ possible sets are distinct!

A: If we denote by $\mathcal O(X)$ the set of open sets and by $\mathcal C(X)$ the set of closed sets, then $Cl$ is an inclusion-preserving map from $\mathcal O$ to $\mathcal C$ while $Int$ is such a map from $\mathcal C$ to $\mathcal O$. These maps satisfy the properties $U\subseteq Int(Cl(U))$ and $Cl(Int(A))\subseteq A$. It follows that $Cl(U)\subseteq Cl(Int(Cl(U)))\subseteq Cl(U)$ and $Int(A)\subseteq Int(Cl(Int(A)))\subseteq Int(A)$ for all open $U$ and closed $A$. Since $Cl(Y)$ is closed and $Int(Y)$ is open for any set $Y$ in $X$, the equalities follow.
In the language of category theory this says that $Cl$ is a left adjoint functor to $Int$. Don't worry if you do not know what that means. In an abstract setting the inclusion $U\subseteq Int(Cl(U))$ is replaced by morphisms $U\to F(G(U))$, and the posets $\mathcal O$ and $\mathcal  C$ become general categories with functors $F,G$ instead of order-preserving maps $Cl$ and $Int$. Having a adjoint-functor pair is then a nice relation between $F,G$ implying certain existence and uniqueness statements, which are radically simplified if the categories are just posets like in your case. For example, you could also have proven the equality using the fact that $Cl(U)\subseteq A\iff U\subseteq Int(A)$.

A: Interior of the closure is the topological operation that models double-negation in intuitionistic logic.   Negation is modeled by interior of the complement, and intuitionistic negation satisfies $N = N^3$ and thus $N^k = N^{k+2}$ for all positive $k$.  Double negation $D = N^2$ therefore satisfies $D = D^2 = D^3 = \dots$.
The problem in Ahlfors is about $D^2 = D^4$, which trivially follows from the above.  So it is enough to prove two simpler facts, that can be restated in the language of topology with no reference to any logic:

*

*if $D(s)$ is interior of the closure of $s$, and $N(s)$ is interior of the complement of $s$, then $D = N^2 \quad$ (explicitly, $D(s)=N(N(s))$ for all sets $s$)

*$N = N^3$
The rest is just associativity of function composition.
The logic interpretation of the idempotence of $D$ is that $D$ is the operator of projection from intuitionistic onto classical logic.


text:
Q: Compare DateTime with fixed offset to DateTime with time zone How does one convert between DateTime<FixedOffset> and DateTime<Tz>, in order to subtract to get a duration, compare inequality, or reassign?
use chrono::DateTime;
use chrono_tz::America::New_York;

fn main() {
    let mut a = DateTime::parse_from_rfc3339("2022-06- 01T10:00:00").unwrap();
    let b = a.with_timezone(&New_York);
    a = b;
}

An attempt to do this directly yields the error:
error[E0308]: mismatched types
  --> src/main.rs:13:9
   |
11 |     let mut a = DateTime::parse_from_rfc3339("2022-06-01T10:00:00").unwrap();
   |                 ------------------------------------------------------------ expected due to this value
12 |     let b = a.with_timezone(&New_York);
13 |     a = b;
   |         ^ expected struct `FixedOffset`, found enum `Tz`
   |
   = note: expected struct `DateTime<FixedOffset>`
              found struct `DateTime<Tz>`

Playground

A: Convert the timezone of b into the timezone of a before assigning it:
a = b.with_timezone(&a.timezone());


text:
Q: Installing MeshPy in Colab I have tried to install MeshPy in Colab using !pip install MeshPy but I got the following output and the package has not been installed. I would appreciate any suggestion.
Here is the complete output
Collecting MeshPy

  Downloading

https://files.pythonhosted.org/packages/90/03/3bb205ac46141074aeb561f5bbf60fb2214380aa6ac1435b49d275cf219a/MeshPy-2018.2.1.tar.gz (472kB)
    100% |████████████████████████████████| 481kB 25.8MB/s

Collecting pytools>=2011.2 (from MeshPy)

  Downloading

https://files.pythonhosted.org/packages/ac/a3/f54f7190315ad41b7334d8733350e7fcefded8f25e0b45e2329b80279921/pytools-2019.1.tar.gz (57kB)
    100% |████████████████████████████████| 61kB 22.3MB/s

Requirement already satisfied: pytest>=2 in /usr/local/lib/python3.6/dist-packages (from MeshPy) (3.10.1)

Requirement already satisfied: numpy in /usr/local/lib/python3.6/dist-packages (from MeshPy) (1.14.6)

Collecting gmsh_interop (from MeshPy)
  Downloading

https://files.pythonhosted.org/packages/a5/8c/62c40850d8e8a2c9c3d223c9b9456ed4431f02b0c45e16cc90bf0025fffe/gmsh_interop-2019.1.tar.gz

Requirement already satisfied: six in /usr/local/lib/python3.6/dist-packages (from MeshPy) (1.11.0)

Requirement already satisfied: decorator>=3.2.0 in /usr/local/lib/python3.6/dist-packages (from pytools>=2011.2->MeshPy) (4.3.2)

Collecting appdirs>=1.4.0 (from pytools>=2011.2->MeshPy)

  Downloading

https://files.pythonhosted.org/packages/56/eb/810e700ed1349edde4cbdc1b2a21e28cdf115f9faf263f6bbf8447c1abf3/appdirs-1.4.3-py2.py3-none-any.whl

Requirement already satisfied: atomicwrites>=1.0 in /usr/local/lib/python3.6/dist-packages (from pytest>=2->MeshPy) (1.3.0)

Requirement already satisfied: setuptools in /usr/local/lib/python3.6/dist-packages (from pytest>=2->MeshPy) (40.8.0)

Requirement already satisfied: py>=1.5.0 in /usr/local/lib/python3.6/dist-packages (from pytest>=2->MeshPy) (1.8.0)

Requirement already satisfied: pluggy>=0.7 in /usr/local/lib/python3.6/dist-packages (from pytest>=2->MeshPy) (0.9.0)

Requirement already satisfied: attrs>=17.4.0 in /usr/local/lib/python3.6/dist-packages (from pytest>=2->MeshPy) (18.2.0)

Requirement already satisfied: more-itertools>=4.0.0 in /usr/local/lib/python3.6/dist-packages (from pytest>=2->MeshPy) (6.0.0)

Building wheels for collected packages: MeshPy, pytools, gmsh-interop

  Building wheel for MeshPy (setup.py) ... error

  Failed building wheel for MeshPy

  Running setup.py clean for MeshPy

  Building wheel for pytools (setup.py) ... done

  Stored in directory: /root/.cache/pip/wheels/1b/f4/26/46b6cf949b3cccefcc41e6b526f7c16351a4a5c124fc6f6eaa

  Building wheel for gmsh-interop (setup.py) ... done

  Stored in directory: /root/.cache/pip/wheels/be/19/0b/76011e06f64c41e0dcfed58e171c091c31f2b499a981d8d773

Successfully built pytools gmsh-interop

Failed to build MeshPy

Installing collected packages: appdirs, pytools, gmsh-interop, MeshPy

  Running setup.py install for MeshPy ... error

Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-matqpp2p/MeshPy/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-8_339liz/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-matqpp2p/MeshPy/

A: Not enough information in your error. To see the exact cause we need longer traceback.
Let's me guess. I tried to install MeshPy myself with pip install MeshPy and got an error about absent of pybind11. So I ran
pip install pybind11
pip install MeshPy

and MeshPy was successfully installed.


text:
Q: How to use an object's instance variables in const_missing(), threadsafe? I want to treat certain uppercase identifiers as dynamically calculated constants - so when I evaluate a code string such as eval("foo(BAR)") I can look up the value of BAR and supply it to the evaluation.
Don't even ask why I want to do this. :-)
The trouble is that const_missing() (unlike, say, method_missing() ) must be a class method, not an instance method. So if I try to write a function like this:
  def self.const_missing(name)
    if @data[name]
      return @data[name]
    end
    raise "Missing const #{name.inspect}"
  end

I can't see the instance variable @data that tells me what the value of FOO should be.
I could of course use a class variable @@data, but that would not let me a different data for each object. I could set @@data from @data immediately before doing the eval, but that would not be thread-safe nor recursion-friendly.
My fallback is to use thread-local storage to contain a stack of @data, and push and pop @data before and after the eval call. But that feels so... inelegant.
Is there a better way to do this?

A:
Don't even ask why I want to do this. :-)

thx for the suggestion, but why exactly are you doing this?
i'm asking because there probably is a different approach that people can show you if you try to explain the problem you are trying to solve.
another thing, don't ever use eval. just don't! if you are not able to one of the other possible metaprogramming methods like class_eval instance_eval method_missing and friends, you are probably doing it wrong.
let me emphasize, DONT USE eval()!


text:
Q: Comparing two strings with boolean? I was trying this code writing exercise and I am so lost!
The exercise is:
Complete the method which takes two Strings and one boolean as input. If the boolean is true, this method compares the first two Strings, ignoring case considerations (uppercase/lowercase). Two Strings are considered equal ignoring case if they are of the same length, and corresponding characters in the two Strings are equal ignoring case.
If the boolean is false, this method should compare two Strings and return true if the first String represents the same sequence of characters as the second String, otherwise false.
Note: compareTwoStrings("HELLO", "", false) should return false.
And here is my attempt:
public boolean compareTwoStrings (String a, String b, boolean isIgnoreCase)
{
    if (a.equalsIgnoreCase(b)) {
        return (isIgnoreCase==true);
    }
    else if (a.equals(b)) {
       return (isIgnoreCase==false);
    }
}

It doesn't even compile, but even if it did, I'm sure it wouldn't work.

A: You're doing it backwards. The subject says: if the boolean is true, then do this, else, then do that. So you should program it the same way:
if (isIgnoreCase) {
    return ...
}
else {
    return ...
}

The rest is left as an exercise. You should be able to figure it out by yourself.

A: I think the requested solution is the following method:
public boolean compareTwoStrings(String a, String b, boolean isIgnoreCase)
{
    if (isIgnoreCase)
    {
        return a.equalsIgnoreCase(b);
    }

    return a.equals(b);
}

Your method das not compile because the Java compiler supposes that unter some circumstances both if conditions evalutes to false. Because of that the compiler can not ensure that at least one return statement is reachable.

A: I think this is what you are looking for.
public static void myMethod(String str, String str2, boolean bool) {

    if (bool) {
        str = str.toLowerCase();
        str2 = str2.toLowerCase();
        if (str.equals(str2))
            System.out.println("strings equal");
    }
    else {
        System.out.println("false condition");
    }
}

A: This could be the solution for your problem:
public boolean compareTwoStrings (String a, String b, boolean isIgnoreCase){
  if (isIgnoreCase)
    return (a.toLowerCase()).equals(b.toLowerCase());
  else
   return a.equals(b);
}


text:
Q: XML group information by row I have a specific database with this particular form :
<Database  NumTables="5">
    <Table TableName="table_name_0" TableID="0" NumOriginalColumns="8" NumColumns="8" NumRows="5">
        <Column ColumnName="column_name_0" ColumnID="0" ColumnType="Int32">
            <Cell>1</Cell>
            <Cell>2</Cell>
            <Cell>3</Cell>
            <Cell>4</Cell>
            <Cell>5</Cell>
        </Column>
        <Column ColumnName="column_name_1" ColumnID="1" ColumnType="Int16">
            <Cell>5</Cell>
            <Cell>2</Cell>
            <Cell>8</Cell>
            <Cell>32</Cell>
            <Cell>42</Cell>
        </Column>
    ... (other columns)
    </Table>
    ... (other tables)
</Database>

And when I want to group information by rows I do like this :
Element root = this.document.getRootElement();
Element table = root.getChildren().get(0);
int numRows = Integer.parseInt(table.getAttributeValue("NumRows"));
for (int currentRow = 0; currentRow < numRows; currentRow++) {
    Integer column_0 = Integer.parseInt(table.getChildren().get(0).getChildren().get(currentRow).getValue());
    Integer column_1 = Integer.parseInt(table.getChildren().get(1).getChildren().get(currentRow).getValue());
    ...
}

It works well, but I think this code is not very nice because I use two times the construction getChildren.get(number) who is very cumbersome. So I want, to know if it exist a proper solution to do this with jdom2.

A: This is the first step: an XML schema describing your XML file, call it db.xsd
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
       xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
        version="2.0">
<xs:element name="Database" type="Database"/>
<xs:complexType name="Database">
 <xs:sequence>
   <xs:element name="Table" type="Table" maxOccurs="unbounded"/>
 </xs:sequence>
 <xs:attribute name="NumTables"  type="xs:int"/>
</xs:complexType>
<xs:complexType name="Table">
 <xs:sequence>
   <xs:element name="Column" type="Column" maxOccurs="unbounded"/>
 </xs:sequence>
 <xs:attribute name="TableName"          type="xs:string"/>
 <xs:attribute name="TableID"            type="xs:int"/>
 <xs:attribute name="NumOriginalColumns" type="xs:int"/>
 <xs:attribute name="NumColumns"         type="xs:int"/>
 <xs:attribute name="NumRows"            type="xs:int"/>
</xs:complexType>
<xs:complexType name="Column">
 <xs:sequence>
   <xs:element name="Cell" type="xs:string" maxOccurs="unbounded"/>
 </xs:sequence>
 <xs:attribute name="ColumnName" type="xs:string"/>
 <xs:attribute name="ColumnID"   type="xs:int"/>
 <xs:attribute name="ColumnType" type="xs:string"/>
</xs:complexType>
</xs:schema>

If you run
$ xjc db.xsd

Several Java classes are generated in subdir generated (this name can, of course, be improved).
Now, we need a simple procedure to unmarshal your XML file:
public class Main {

private static final String PACKAGE = "generated";
private static final String SCHEMA  = "table.xsd";
private static final String XMLIN   = "database.xml";

private Database db;

void unmarshal() throws Exception {
    JAXBContext jc = JAXBContext.newInstance( PACKAGE );
    Unmarshaller m = jc.createUnmarshaller();

    JAXBElement<Database> jbe = null;
    try {
        StreamSource source =
            new StreamSource( new FileInputStream( XMLIN ) );
        jbe = m.unmarshal( source, Database.class );
        db = jbe.getValue();
    } catch( Exception e  ){
        System.out.println( "EXCEPTION: " + e.getMessage() );
        e.printStackTrace();
}
}

public Database getDatabase(){
    return db;
}

public static void main( String[] args ) {
    Main main = new Main();
    try {
        main.unmarshal();
        Database db = main.getDatabase();
        for( Table table: db.getTable() ){
            for( Column column: table.getColumn() ){
                 for( String cell: column.getCell() ){
                     System.out.print( " " + cell );
                }
            }
        }
    } catch( Exception e ){
        System.err.println( "marshal fails: " );
        e.printStackTrace();
    }
}
}


text:
Q: Differentiability of an (improper) integral
let $f: \mathbb{R}^{m+1} \to \mathbb{R}$ be $C^1$. For $x \in \mathbb{R}$, define $h_x(y) = f(x,y)$ and suppose $h$ is absolutely integrable in $\mathbb{R}^m$. Define
  $$F(x) = \int_{\mathbb{R}^m} h_x(y)dy$$
  Further suppose that there exists an absolutely integrable function $g:\mathbb{R}^{m} \to \mathbb{R}$ satisfying
  $$|D_1 f(x,y)| \le g(y)$$
  for all $(x,y) \in \mathbb{R}^{m+1}$. Show that $F$ is differentiable on $\mathbb{R}$

I keep running into circular arguments when trying to prove this and would like some help.

It can be shown that $D_1 f(x,y)$ is absolutely integrable over $\mathbb{R}^m$ for fixed $x \in \mathbb{R}$, so $\forall \epsilon > 0$, there exists an approximating sequence $A_n$ (compact/contented sets) to $\mathbb{R}^m$, and $N_1 \in \mathbb{N}$ such that $n>N_1$ implies:
$$\left\lvert \int_{\mathbb{R^m}} D_1 f(x,y)dy - \int_{A_n} D_1 f(x,y)dy \right\rvert < \frac{\epsilon}{4}$$
$A_n$ is compact/contented, so $D_1f(x,y)$ is uniformly continuous on $A_n$, and so $\exists \eta > 0$ such that $\delta < \eta$ implies
$$|D_1 f(x,y) - D_1 f(x + \delta,y)| < \frac{\epsilon}{2 v(A_n)}$$
Let $\delta < \eta$. By MVT $\exists \tau$ on the line connecting $(x,y)$ to $(x + \delta,y)$ such that:
$$h_{x+\delta}(y)-h_x(y) = D_1 f(\tau,y) \delta$$
Hence,
$$\frac{F(x + \delta)-F(x)}{\delta} \stackrel{?}{=} \int_{A_n} D_1 f(\tau,y)dy$$
Furthermore, $\exists N_2$ such that $n > N_2$ implies:
$$\left\lvert \int_{\mathbb{R^m}} D_1 f(\tau,y)dy - \int_{A_n} D_1 f(\tau,y)dy \right\rvert < \frac{\epsilon}{4}$$
Let $N = \max \{N_1, N_1 \}$ and $n > N$:
$$\left\lvert \frac{F(x+\delta)-F(x)}{\delta} - \int_{\mathbb{R}^m} D_1 f(x,y)dy \right\rvert <
\left\lvert \frac{F(x+\delta)-F(x)}{\delta} - \int_{A_n} D_1 f(x,y)dy \right\rvert + \frac{\epsilon}{4}$$
$$\le \left\lvert \frac{F(x+\delta)-F(x)}{\delta} - \int_{A_n} D_1 f(\tau,y)dy \right\rvert + \left\lvert \int_{A_n} D_1 f(x,y)dy - \int_{A_n} D_1 f(\tau,y)dy \right\rvert + \frac{\epsilon}4$$
$$= \left\lvert \int_{\mathbb{R}^m} D_1f(\tau,y)dy - \int_{A_n} D_1 f(\tau,y)dy \right\rvert + \left\lvert \int_{A_n} D_1 f(x,y)dy - \int_{A_n} D_1 f(\tau,y)dy \right\rvert + \frac{\epsilon}4$$
$$\le \left\lvert \int_{A_n} D_1 f(x,y)dy - \int_{A_n} D_1 f(\tau,y)dy \right\rvert + \frac{\epsilon}2$$
$$\le \int_{A_n} |D_1 f(x,y) - D_1 f(\tau, y)| dy + \frac{\epsilon}2$$
$|D_1 f(x,y) - D_1 f(\tau, y)| < \frac{\epsilon}{2 v(A_n)}$, but this $A_n$ may not be what we are currently integrating over, so this does nothing for us. I also can't change the location of the uniform continuity statement, because $\tau$ depends on $\delta$ which depends on $\eta$.

A: We can salvage your approach and prove as you intended.
First, you are correct that for sufficiently large $n > N_1$ we find
$$\tag{1}\left\lvert \int_{\mathbb{R^m}} D_1 f(x,y)\,dy - \int_{A_n} D_1 f(x,y)\,dy \right\rvert < \frac{\epsilon}{4},
$$
but we can make a stronger statement that this is true for all and not just fixed $x$.  This follows because $|D_1f(x,y)| \leqslant g(y)$ and the convergence $\int_{A_n} \to \int _\mathbb{R^m}$ is uniform by the Weierstrass test.
Define  $F_n(x) = \int_{A_n} f(x,y)\,dy $ and let $n > N_1$ be fixed.
Similar to your attempt, we can apply the triangle inequality and (1) to obtain
$$\tag{2}\left\lvert \frac{F(x+\delta)-F(x)}{\delta} - \int_{\mathbb{R}^m} D_1 f(x,y)\,dy \right\rvert \\ \leqslant \left\lvert \frac{F(x+\delta)-F(x)}{\delta} - \frac{F_n(x+\delta)-F_n(x)}{\delta}\right\rvert+
\left\lvert \frac{F_n(x+\delta)-F_n(x)}{\delta} - \int_{A_n} D_1 f(x,y)\,dy \right\rvert + \frac{\epsilon}{4}
$$
We can use your argument based on the mean value theorem to show that for some $\tau_y$ between $x$ and $x + \delta$ we have
$$\frac{F_n(x+\delta)-F_n(x)}{\delta} = \int_{A_n} D_1 f(\tau_y,y)\,dy, $$
and
$$\left\lvert \frac{F_n(x+\delta)-F_n(x)}{\delta} - \int_{A_n} D_1 f(x,y)\,dy \right\rvert  \leqslant \int_{A_n} |D_1 f(\tau_y,y) - D_1f(x,y)|\,dy  .$$
Using uniform continuity of $D_1f$ on the compact set $A_n$, there exists $\eta > 0$ such that when $\delta < \eta$ we have $|D_1f(\tau_y,y) - D_1f(x,y)| < \epsilon/(4v(A_n)) $ and
$$\left\lvert \frac{F_n(x+\delta)-F_n(x)}{\delta} - \int_{A_n} D_1 f(x,y)\,dy\right\rvert   < \frac{\epsilon}{4}.$$
It just remains to show that for sufficiently large $n$, the first term on the RHS of (2) is smaller than $\epsilon/2$.
For $m > n$ we apply the mean value theorem to find $z$ between $x$ and $x + \delta$ such that
$$\left|\frac{F_m(x+\delta)-F_m(x)}{\delta} - \frac{F_n(x+\delta)-F_n(x)}{\delta}\right| = \left|\int_{A_m} D_1f(z,y) \, dy - \int_{A_n} D_1f(z,y) \, dy \right| $$
By uniform convergence of $\int_{A_n}$, there exists $N_2$ such that for all $m > n > N_2$ we have
$$\left|\frac{F_m(x+\delta)-F_m(x)}{\delta} - \frac{F_n(x+\delta)-F_n(x)}{\delta}\right| < \frac{\epsilon}{2}.$$
Taking the limit of both sides, as $m \to \infty$ we get
$$\left|\frac{F_(x+\delta)-F_(x)}{\delta} - \frac{F_n(x+\delta)-F_n(x)}{\delta}\right| \leqslant \frac{\epsilon}{2}.$$
Therefore, we can find $\eta>0$ such that if $\delta < \eta$ and we have
$$\left\lvert \frac{F(x+\delta)-F(x)}{\delta} - \int_{\mathbb{R}^m} D_1 f(x,y)\,dy \right\rvert < \epsilon.$$
Note that $\eta$ may depend of the fixed $n > \max(N_1,N_2)$ used in the estimate, but this is enough to reach the conclusion that $F$ is differentiable with $F'(x) =\int_{\mathbb{R}^m}D_1f(x,y) \, dy.$

A: Fix $x\in \mathbb R,$ and fix a real sequence $h_n \to 0$ through nonzero values. Define
$$ d_n(y) = \frac{f(x+h_n,y)-f(x,y)}{h_n}.$$
Then $d_n(y) \to D_1f(x,y)$ for every $y\in \mathbb R^m.$
By the mean value theorem, for each $y\in \mathbb R^m,$ there exists $c(y,n)$ between $x$ and $x+h_n$ such that
$$d_n(y) = D_1 f(c(y,n),y).$$
From our hypothesis on $D_1f,$ it follows that $|d_n(y)| \le g(y)\in L^1(\mathbb R^m).$ Thus by the dominated convergence theorem,
$$\tag 1 \int_{\mathbb R^m} d_n(y)\, dy \to \int_{\mathbb R^m} D_1f(x,y)\, dy.$$
Now $(F(x+h_n) - F(x))/h_n$ equals the left side of $(1),$ so $(F(x+h_n) - F(x))/h_n$ $\to \int_{\mathbb R^m} D_1f(x,y)\, dy.$ Because $h_n$ was an arbitrary sequence $\to 0,$ we have  $F'(x) = \int_{\mathbb R^m} D_1f(x,y)\, dy.$ Finally, since $x$ was an arbitrary real number, we have $F$ differentiable on $\mathbb R$ as desired.


text:
Q: conditional cookie in jquery $('nav #mobileMenu').on('click', function() {

    if ($.cookie('isToggled') == 'true')
        var isToggled = $.cookie('isToggled');
    else
        var isToggled = $(this).data('isToggled');

    if ($.cookie('isToggled') == 'true') {
        // this opens the menu
        $(this).parent().addClass("mobileMenuActive");
        $(this).parent().find('ul').fadeIn(1000);
        $(this).parent().find('em').fadeOut('fast');
    } else {
        // this hides the menu
        $(this).parent().removeClass("mobileMenuActive");
        $(this).parent().find('ul').fadeOut(1000);
        $(this).parent().find('em').fadeIn('fast');
    }

    $(this).data('isToggled', !isToggled)
    $.cookie('isToggled', !isToggled, { expires: 1, path: '/' });
});

It works great however when the class is added 'mobileMenuActive' I would like it to set a cookie for a period of 1 day, so when the user goes to another page in the site the menu still has that class, if they click the toggle: 'nav #mobileMenu' once the cookie has been set, the cookie will be removed or set to false, but I can't seem to get it to work properly.
I have tried toggling cookies, but the condition doesn't seem to work which I did.


text:
Q: Jsoup captcha login with cookie I have been trying to develop a small application that gets captcha from my academics page, displays it to the user, the user enters captcha and the program should display details. However, I am stuck at login page itself. I used jsoup to get the cookie,save captcha to a folder, submit captcha along with form data, using the previous cookie. But I get the same login page again. Please help!
This is the get request. Website url https://academics.vit.ac.in/parent/parent_login.asp
Response res =  Jsoup.connect(webSiteURL).method(Method.GET).execute();
Map<String,String> cook = res.cookies();
String sessionid = res.cookie("ASPSESSIONIDSQHDAQRQ");

After getting the captcha, this is the post request.
Response login = Jsoup.connect(webSiteURL)
            .userAgent("Mozilla/5.0")
            .cookie("ASPSESSIONIDSQHDAQRQ", sessionid).
            data("message","Enter Verification Code of 6 characters exactly as shown.")
            .data("vrfcd",captcha).data("wdpswd","somedata").data("wdregno","somedata")
            .method(Method.POST).execute();
    System.out.println(login.parse());

When I tried this
System.out.println(login.cookies());

The value is null, is that a clue?? Help me out!! Thanks!!

A: Are you sure you are retrieving the captcha using the cookie too?. Please check that. I mean, you can download the captcha with something like:
    Response res1 =  Jsoup.connect("https://academics.vit.ac.in/parent/captcha.asp")
            .cookie("ASPSESSIONIDSQHDAQRQ", sessionid)
            .ignoreContentType(true)
            .method(Method.GET).timeout(30000).execute();

Then be sure that in the login post you are using the correct url, that is:
https://academics.vit.ac.in/parent/parent_login_submit.asp

Then it should work fine.
Hope it helps.


text:
Q: Node and relationship creation in Neo4j I have a data set, which looks like this

Now, as one can see that a single person has multiple skillid, along with this data, i also have a skill_ref table, which has 2 columns(skillid and skillname) so from the image above, i can look and say that last person has multiple skills, Now, i want this data to be put in Neo4j, with person and skillname as node, and a relationship of has_skill. But i dont know how to handle the multiple instances, if i split the skillid , then i will have multiple instances of person name, but this is not what i want, i want something like this

in the graph,the center node is the name of the person and the others have skill name, with the arrows pointing a relation has_skill.
I am new to neo4j as well as cypher, any help guys will be highly appreciated.
USING PERIODIC COMMIT
LOAD CSV WITH HEADERS FROM "file:///people_data.csv" AS line
CREATE (p:Person{id:line.people_uid})
WITH line, p
SET p.firstName = line.first_name,p.lastname=line.last_name
WITH line,split(line.skillid,' ') as skill_ids
UNWIND skill_ids as skill_Id
MERGE (skill:Skill{id:skill_Id})
LOAD CSV WITH HEADERS FROM "file:///skills_ref.csv" AS line
WITH line
MERGE(skill:line.skillid{name:line.skillname})
CREATE (p)-[:HAS_SKILL]->(skill)

A: You've got the right idea.
The general approach is to first MERGE (or CREATE) the :Person node, then split() the skillid into a list of skill ids, UNWIND the skill id list into rows, then MERGE the skill for the given id (and make sure you have an index or unique constraint on :Skill(id)), then MERGE (or CREATE) the relationship between the :Person node and the :Skill.
Here's an example, loading from a CSV file:
USING PERIODIC COMMIT
LOAD CSV WITH HEADERS FROM "file:///your.file.url" AS line
CREATE (p:Person{id:line.people_uid})
WITH line, p
SET p.firstName = line.f_name ... <same for the rest of the properties>
UNWIND split(line.skillid, ' ') as skillId
MERGE (skill:Skill{id:skillId})
CREATE (p)-[:HAS_SKILL]->(skill)

EDIT
Regarding the revised query you're attempting, it's actually better to use separate queries for each csv load, using the first to create the nodes and merge the relationships, and the second just to match/merge to skills and add the skill name:
USING PERIODIC COMMIT
LOAD CSV WITH HEADERS FROM "file:///people_data.csv" AS line
CREATE (p:Person{id:line.people_uid})
SET p.firstName = line.first_name, p.lastname=line.last_name
WITH line, split(line.skillid, ' ') as skill_ids
UNWIND skill_ids as skill_Id
MERGE (skill:Skill{id:skill_Id})
CREATE (p)-[:HAS_SKILL]->(skill)

Then your next query:
LOAD CSV WITH HEADERS FROM "file:///skills_ref.csv" AS line
MERGE (skill:Skill{id:line.skillid})
SET skill.name = line.skillname

Remember that you should have an a unique constraint created on :Skill(id) and :Person(id) first.


text:
Q: Python pandas filling of a DataFrame I have a problem with the filling of a Dataframe.
This is the initial situation (picture1)

My code runs like this (picture 2):

But I want this (picture3):

So if there a row from -1 to 4 empty, it should be empty. But if there are numbers it should be filled with "0"
My code looks like this...
import pandas as pd
df = pd.read_csv('/Users/Hanna/Code/ZERO.csv')

indx = df[df['D'] == -1].index.values

for i, j in zip(indx[:-1], indx[1:]):
df.loc[i:j-1, 'E'] = df.loc[i:j-1, 'E'].fillna(0)

    if j == indx[-1]:
    df.loc[j:, 'E'] = df.loc[j:, 'E'].fillna(0)

That my code, but I am not sure with the 'NaN'
d = {'A': [4000074, 4000074, 4000074, 4000074, 4000074, 4000074, 4000074, 4000074, 4000074, 4000074, 4000074, 4000074, 4000074, 4000074, 4000074, 4000074, 4000074, 4000074], 'B': [SP000796746, SP000796746, SP000796746, SP000796746, SP000796746, SP000796746, SP000796746, SP000796746, SP000796746, SP000796746, SP000796746, SP000796746, SP000796746, SP000796746, SP000796746, SP000796746, SP000796746, SP000796746], 'C': [-1, 0, 1, 2, 3, 4, -1, 0, 1, 2, 3, 4, -1, 0, 1, 2, 3, 4, -1, 0, 1, 2, 3, 4], 'D': [0, 1000, 1000, 0, 0, 0, 'NaN', 'NaN', 'NaN', 'NaN', 'NaN', 'NaN', 0, 0, 0, 3000, 3000, 0], 'E': [2000, 2000, 2000, 2000, 2000, 2000, 'NaN', 'NaN', 'NaN', 'NaN', 'NaN', 'NaN', 4000, 4000, 4000, 4000, 4000, 4000]}
Thank you Hanna
Maybe it does not work, because I do this before, with another column F:
indx = df[df['Diff Load Due Week'] == -1].index.values

for i, j in zip(indx[:-1], indx[1:]):
    df.loc[i:j-1, 'F'] = df.loc[i:j-1, 'F'].max()

if j == indx[-1]:
        df.loc[j:, 'F'] = df.loc[j:, 'F'].max()

Can it be, that I have to remove the index first?
That is my last output:
base_list =[-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]
df_c = pd.MultiIndex.from_product([
[4000074],
["SP000796746","SP001811642"],
[201824, 201828, 201832, 201835, 201837, 201839, 201845, 201850, 201910, 201918, 201922, 201926, 201909, 201916, 201918, 201920],
base_list],

    names=["A", "B", "C", "D"]).to_frame(index=False)

# Verbinden der neuen Liste und der kleinen Rohdatenliste

df_3 = pd.merge(df_c, df_1, how='outer')

# Zusammengefügte Daten in Excel und csv speichern für Überprüfung und Weiterarbeit

df_3.to_csv('GROß.csv')
df_3.to_excel('GROß.xlsx')

Einlesen der neu erstellten csv
df = pd.read_csv('/Users/Hanna/Desktop/Daten Projektseminar/Coding/GROß.csv')

#Index setzen für -1, damit Spalten und Reihen aufgefüllt werden können

indx = df[df['D'] == -1].index.values

#Aufüllen der Billings mit maximalen Wert

for i, j in zip(indx[:-1], indx[1:]):
    df.loc[i:j-1, 'F'] = df.loc[i:j-1, 'F'].max()

if j == indx[-1]:
        df.loc[j:, 'F'] = df.loc[j:, 'F'].max()

A: Ok this should do the trick now:
import pandas as pd
import numpy as np

#your data
d = {'A': [4000074, 4000074, 4000074, 4000074, 4000074, 4000074, 4000074, 4000074, 4000074,
   4000074, 4000074, 4000074, 4000074, 4000074, 4000074, 4000074, 4000074, 4000074],
 'B': ['SP000796746', 'SP000796746', 'SP000796746', 'SP000796746', 'SP000796746', 'SP000796746',
   'SP000796746', 'SP000796746', 'SP000796746', 'SP000796746', 'SP000796746', 'SP000796746',
   'SP000796746', 'SP000796746', 'SP000796746', 'SP000796746', 'SP000796746', 'SP000796746'],
 'C': [201926, 201926, 201926, 201926, 201926, 201926, 201909,201909, 201909, 201909, 201909,
   201909, 201933, 201933, 201933, 201933, 201933, 201933],
 'D': [-1, 0, 1, 2, 3, 4, -1, 0, 1, 2, 3, 4, -1, 0, 1, 2, 3, 4],
 'E': [np.nan, 1000, 1000, 0, 0, 0, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, 3000, 3000, np.nan]}

#create data frame
df = pd.DataFrame(data = d)

#group sum column E by ID columns
groupedSum = df.groupby(['A', 'B', 'C'])['E'].sum().reset_index()

#loop over unique IDs
for i, row in groupedSum.iterrows():
    #define values
    idValue = groupedSum.at[i,'C']
    sumValue = groupedSum.at[i,'E']
    #if sum is not zero
    if (sumValue != 0):
        #change values to zero if greater than zero
        df['E'].loc[df['C'] == idValue] = df['E'].apply(lambda x: x if x > 0 else 0)

print(df)

          A            B       C  D       E
0   4000074  SP000796746  201926 -1     0.0
1   4000074  SP000796746  201926  0  1000.0
2   4000074  SP000796746  201926  1  1000.0
3   4000074  SP000796746  201926  2     0.0
4   4000074  SP000796746  201926  3     0.0
5   4000074  SP000796746  201926  4     0.0
6   4000074  SP000796746  201909 -1     NaN
7   4000074  SP000796746  201909  0     NaN
8   4000074  SP000796746  201909  1     NaN
9   4000074  SP000796746  201909  2     NaN
10  4000074  SP000796746  201909  3     NaN
11  4000074  SP000796746  201909  4     NaN
12  4000074  SP000796746  201933 -1     0.0
13  4000074  SP000796746  201933  0     0.0
14  4000074  SP000796746  201933  1     0.0
15  4000074  SP000796746  201933  2  3000.0
16  4000074  SP000796746  201933  3  3000.0
17  4000074  SP000796746  201933  4     0.0


text:
Q: Consume .txt file as a web service .net I have a .txt file which contains xml code for the web service.
I want to convert it into .wsdl and consume the web service and then deploy the MVC app on IIS. How can I do that?
.TXT File
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sieb="http://SIEBEL_COMPLAINT_REGISTRATION">
   <soapenv:Header/>
   <soapenv:Body>
      <sieb:Complaint_Registration>
         <Email_Address>usman.sohail@speridian.com</Email_Address>
         <Customer_Name>Usman Sohail</Customer_Name>
         <Tag4>111</Tag4>
         <Tag3></Tag3>
         <Mobile_Number>+9230014785236</Mobile_Number>
         <Tag1></Tag1>
         <Channel>Self Service Kiosk</Channel>
         <Branch>College Road, Daska</Branch>
         <Complaint_Name>Bill Payment Issues</Complaint_Name>
         <Father_Husband_Name>Sohail</Father_Husband_Name>
         <Complaint_Description>test complaint web service</Complaint_Description>
         <Product>P00018</Product>
         <Product_Category>Branchless Banking</Product_Category>
         <Id_Document_Number>3530365321425</Id_Document_Number>
         <Tag5></Tag5>
         <Tag2></Tag2>
         <Personal_Street_Address>lahore</Personal_Street_Address>
         <ReferenceNo>123xxxxxxx</ReferenceNo>
      </sieb:Complaint_Registration>
   </soapenv:Body>
</soapenv:Envelope>

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <soapenv:Body>
      <NS1:Complaint_RegistrationResponse xmlns:NS1="http://SIEBEL_COMPLAINT_REGISTRATION">
         <ns:ABL_Complaint_Registration_WebService_Output xmlns:ns="http://siebel.com/CustomUI">
            <ns:ComplaintId>1-3182972</ns:ComplaintId>
            <ns:Complaint_Reference_Num>C2705220014</ns:Complaint_Reference_Num>
            <ns:Responce_Code>ABL-CRM-SUCCESS01</ns:Responce_Code>
            <ns:Responce_Message>Complaint Has been generated successfully</ns:Responce_Message>
         </ns:ABL_Complaint_Registration_WebService_Output>
      </NS1:Complaint_RegistrationResponse>
   </soapenv:Body>
</soapenv:Envelope>


text:
Q: PowerShell command for ffmpeg to process items in a folder recursively I'm trying to figure out what PowerShell command [or script if necessary] might allow ffmpeg to recursively traverse a directory, pull stills via the -vf flag, and put all the stills into a folder without any filename conflicts that would cause overwriting.
So I know that this works fine for an individual file:
ffmpeg -i input.mov -vf fps=10/60 still%04d.jpg

The files generated start from still0001.jpg and count up to still0002.jpg, still0003.jpg, etc.
I have a directory that looks like this, with video files at different levels:

*

*topFolder1

*

*midFolder1

*

*video1.mov

*video2.mov

*midFolder2

*

*video3.mov

*video4.mov
I'm trying to use a PowerShell command that can pull stills from all the videos video1.mov, video2.mov, video3.mov, and video4.mov and drop them into one folder.
I found a PowerShell command that purports to have ffmpeg traverse a directory recursively, but when I try to adapt it, it's not working.
I run:
PS T:\Exports\1 - Dailies\stills test> for /F "tokens=*" "%G" IN ('dir "T:\Exports\1 - Dailies" *.mov') do ffmpeg -i "%G" -vf fps=10/60 still%05d.jpg

But I get this error:
At line:1 char:4
+ for /F "tokens=*" "%G" IN ('dir "T:\Exports\1 - Dailies" *.mov') do f...
+    ~
Missing opening '(' after keyword 'for'.
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : MissingOpenParenthesisAfterKeyword

Where am I going wrong?

A: Here's an example of a powershell command for converting all files in a directory to mp4 and resizing to 1280x720:
dir *.* | foreach-object { $newname = $_.Name.Remove($_.Name.Length - $_.Extension.Length) + ".mp4"; .\ffmpeg.exe -i "$_" -s 1280x720 $newname }


text:
Q: Android service taking photos in background OnUiThread I have service in which I want to take pictures of the user.
I have a timer task
     myTimer = new Timer();
     myTimer.schedule(new TimerTask() {
        @Override
        public void run() {
            TimerMethod();
        }

    }, 0, 3000);

And the timer method
private void TimerMethod() {
    if (na != null)
        zzz.runOnUiThread(Timer_Tick);
}

private Runnable Timer_Tick = new Runnable() {
    public void run() {

        takePhoto(getApplicationContext(), 1);
    }
};

My problem is that if i runOnUiThread the app is running slower.
How can I run in other thread that will not influence the user experience?
Many thanks.

A: Your TimerTask is running in main thread,this will make app runnning slower.You need a new thread to run method TimerMethod,just like this:
  myTimer.schedule(new TimerTask() {
    @Override
    public void run() {
            new Thread(new Runnable() {

                @Override
                public void run() {
                    TimerMethod();
                }
            }).start();
       }

   }, 0, 3000);


text:
Q: Regex to match a fragment of the URL I have URL's like:
http://127.0.0.1:81/controller/verbOne/NXw4fDF8MXwxfDQ1?source=dddd
or
http://127.0.0.1:81/controller/verbTwo/NXw4fDF8MXwxfDQ1
I'd like to extract that part in bold. The host and port can change to anything (when I publish it to a live server it will change). The controller never changes. And for the verb part, there are 2 possibilities.
Can anyone help me with the regex?
Thanks

A: Instead of using a regex you could use the built in functionality of Uri
Uri uri = new Uri("http://127.0.0.1:81/controller/verbOne/NXw4fDF8MXwxfDQ1?source=dddd");

var lastSegment = uri.Segments.Last();

A: You're looking for the Uri and Path classes:
Path.GetFileName(new Uri(str).AbsolutePath)

A: Why do you look for a regex? you can look for the two string elements "verbOne/" or "verbTwo/" and make a substring from the end. And then you can look for the rest and substrakt the part with the '?'
I think this is faster then a regex.
krikit

A: Though everyone else here is correct that regex is not the best solution, because it could fail when parsers already exist that should never fail due to their specialization, I believe you could use the following regex:
(?<=http://127\.0\.0\.1:81/controller/verb(One|Two)/)[a-zA-Z0-9]*


text:
Q: Are these two registry entries in StructureMap identical? I want to register a singleton class against its corresponding interface.
I found two different ways to achieve this:
Option 1:
this.For<ISomeClass>()
    .Use<SomeClass>()
    .Singleton();

Option 2:
this.For<ISomeClass>()
    .Use(c=>c.GetInstance<SomeClass>())
    .Singleton();
this.ForConcreteType<SomeClass>()
    .Configure
    .Singleton();

So are these two calls identical or is there a difference between the two? Obviously option 1 is much more desirable due to its terseness.

A: The outcome will be identical, but the second example performs an extra step. It's really small. But the simpler syntax is better.
The first example says that when there's a need for ISomeClass, fulfill it with SomeClass. If an instance has been created, use it. If not, create an instance.
The second example says that when there's a need for ISomeClass, fulfill it by calling an anonymous function which will return an implementation of ISomeClass. That function resolves and returns an instance of SomeClass.
Given the amount of work that's going on under the hood, calling one more anonymous function isn't going to make that much difference.
The bigger concern is how the more complex approach can confuse other developers and create problems. This is not hypothetical. I've seen it, and it the consequences aren't pretty.
The developer coming behind you may not understand how an IoC container is supposed to work, and all they can do is follow your example until they understand it. So it's important to set the right example or else they can completely miss the point. I've seen factory methods like this:
this.For<ISomeClass>()
    .Use(c=> new SomeClass(
        c.GetInstance<ISomethingElse>(),
        c.GetInstance<ISomeOtherThing>(),
        c.GetInstance<ITenMoreOfThese>()
));

Then they start creating objects like this, resolving instances, and using the DI registration to inject instances into objects. Granted there are occasional valid reasons to do that. But it can pollute your IoC code until it's painful to change the dependencies of a class, which is one of the problems that the container was supposed to solve.
That actually snowballs some more. Now developers don't want to touch the increasingly fragile and confusing IoC code, so they stop creating new classes, start cramming new functionality into existing methods, and never refactor anything. The IoC, which should make refactoring and smaller classes and interfaces easier, ends up making it all harder. That leads to all sorts of new code smells and rot.
So I'd recommend the "no broken window" approach - use the simplest syntax that follows the original intent of the IoC - specify an implementation type for an interface wherever possible instead of a function that resolves and returns an implementation.


text:
Q: Vertical ViewPager Has anybody managed to implement a vertical ViewPager by trying to change the source code of ViewPager?

A: I think you would need to edit the source code for ViewPager and swap out all x,y and width,height logic. DirectionalViewPager should do the job. Here is the source: https://github.com/JakeWharton/Android-DirectionalViewPager


text:
Q: How to play an audio file into Tone.Offline buffer output Question
How do I play a local audio file inside Tone.Offline so that when it finishes and return it's promised buffer it will contain the played audio?
Code
Tone.Offline(({ transport }) => {
    const p = new Tone.Player(src, () => {
        transport.start();
    }).toDestination();

    transport.schedule((time) => {
        p.start(time + 5).stop(time + 9); //this never happen!
    });
}, 10).then((buffer) => { // how do I push parts of my audio file onto the buffer?
    const wav = toWav(buffer);
    saveAs(new Blob([wav], { type: "audio/wav" }), "./blibli.wav");
});

Issue
I've noticed the callback part inside transport.schedule never happen,
and so I never get to build the final buffer.


text:
Q: ruby puts get stuck adding unix content My ruby puts get stuck for some reason and i cant figure out why,
The commands i'm passing through the backticks are alright, the script gets stuck between the puts 2 and puts 2 commands, so it basically never exits the puts command containing the unix sort / cut
    #!/usr/bin/ruby/
require 'fileutils'

@raw_file=File.open(ARGV[0],"r") unless File.open(ARGV[0],"r").nil?
#agg_file=File.open(ARGV[1],"r") unless File.open(ARGV[1],"r").nil?
@pwd=Dir.pwd
puts @pwd
#do the raw file first
 def do_raw
  tmp_raw=File.new("#{@pwd}/tmp_raw","w")
  #unix cut and sort
  puts 1
  tmp_raw.puts(`cat #{@raw_file} | cut -f1,6,3,4,2,5,9,12 | sort -k1,1 -k8,8`)
  puts 2
  tmp_raw.close
  tmp_raw=File.open("#{@pwd}/tmp_raw","r")
  final_file=File.new("#{@pwd}/uniques_raw","w")
    #merge the lines and append count
    vector =IO.readlines(@tmp_raw.path)[1]
    count=1
     while (line=tmp_raw.gets) do
       if line.eql? vector
          count=count+1
       else
          vector=line
          final_file.write("#{line}\t#{count}")
          count=1
       end
     end
     #job done, close and clean file
     tmp_raw.close
     final_file.close
     tmp_raw.remove
 end

#run jobs
 do_raw

But a simple:
    tmp_raw.puts("blablabla")
Works, so the file is ok
The puts command get stuck, i have tryed the simple command on terminal and it works just fine, the files are also existing and writing some random text into them works just fine
Any idea?

A: I see. @raw_file is a File object rather than the file name itself.  Then you cannot invoke the cat(1) command against the string representation of the File object.
You should have wrote
tmp_raw.puts(`cat #{ARGV[0]} | cut -f1,6,3,4,2,5,9,12 | sort -k1,1 -k8,8`)


text:
Q: C++/CLI obfuscated assembly throws a MissingManifestResourceException I'm using Dotfuscator Pro 4.10 to obfuscate an application built with VS 2012. The .NET code contains managed as well as unmanaged C++/CLI code, thus compiled with /clr.
My solution contains a lot of projects. I only allow renaming as obfuscation. Also, as all assemblies/application are in the dotfuscator project, I don't run in library mode. Thus, all interfaces are scrambled.
When I obfuscate the assemblies everything works fine but for an assembly (let's call it A.dll). If I disable obfuscation for A.dll, the application works perfectly. If I enable obfuscation for A.dll, I get this:

Error: System.Resources.MissingManifestResourceException
Message: Could not find any resources appropriate for the specified culture or the neutral culture. Make sure "ahe.resources" was correctly embedded or linked into assembly "A.dll" at compile time, or that the satellite assemblies required are loadable and fully signed.

ahe is the scrambled name of a Window Form in A.dll and the exception is thrown here (from ApplyResources()):
void InitializeComponent( void )
{
    this->components = (gcnew System::ComponentModel::Container());
    System::ComponentModel::ComponentResourceManager^resources = (gcnew System::ComponentModel::ComponentResourceManager( A::typeid ));

    // ...

    resources->ApplyResources( this->mpMyControl, L"mpMyControl" ); // Exception thrown here.

    // ...
}

The resources are correctly defined in A.resx (and it works before obfuscating).
Notice that this kind of code is used at many places in other assemblies and, when I disallow obfuscation for the problematic assembly A.dll, it works perfectly.
So, does somebody have an idea about how to solve the problem? Feel free to ask for more info/details, I don't know what could be important or not.
Thanks!
Edit 1: None of the assemblies are signed.

A: Check if your root namespace is correct in .vcxproj file:
<RootNamespace>YourNameSpace</RootNamespace>

A: One Scott has reported at
http://www.pcreview.co.uk/forums/dotfuscator-vs-resourcemanager-ctor-t3403701.html
that this problem is addressed in the Dotfuscator's Knowledge base, which is available only to registered users of the Community edition here:
http://www.preemptive.com/support/dotfuscator/KnowledgeBase/CommunityEdition.html .


text:
Q: empty the previous content of a div in order to replace with another one using ajax In my view, I have to recover users following their state. (it's a twig view, I work on a symfony project, but here the back-end process are already build)
The view contains 3 buttons (  tags exactly) and a table. In fact, it's like creating a filter in order to display users in the table following their state.
3 states are possible:

*

*waiting for validation => pending_validation

*enabled

*disabled

This is my code in my html view:
{# the div containing the menu  #}

        User enabled

        User disabled

        User attempting validation

{# the div containing the table of user #}

  {% if (users|length == 0) %}

 No users are availabled for the choosen statement you click on !

  {% else %}

          USERS

                {% for user in users %}

                    {{ user.id }}

                    {{ user.username }}

                    {{ user.email }}

                    {{ user.created_at|date}}

                      <button>
                        EDIT
                      </button>

                {% endfor %}

So, as you can understand, when admin clicks on button, I have to display the right users table with the right state in Javascript using jQuery.
I wrote this code in javascript using jquery:

As you can understand, the url parameter of my ajax request is url: "{{ path('index_user_admin') }}" and retuns the entire html view containing the div menu and the table.
The ajax request works well, I recover my users info. Except one thing happened and I don't really know how to fix this behavior.
Once I clicked on a button, it loads and display my user datas, but it add it and not revoming the actual I want to replaced by the new ones I call on click.
That I would like to do here is to replace the actual content by the new content I call when I clicked on a button.
For now, my previous datas have to be removed in order to be replaced by the new users info, it's not the case, in fact no data are removed, just new datas are added to the previous.

A: I found a solution, it seems like I made a rookie mistake herein my ajax calling.
In fact, instead of this userInfoDiv.replaceWith(newuserInfoDiv); in my ajax request, I replace this with userInfoDiv.append(newuserInfoDiv); and all is working well.


text:
Q: When should I provide #defined macro for declaring or initializing variable in Linux Kernel? It seems that lots of Linux Kernel components provide macros to help the programmer easily declare a variable statically at runtime, which is allocated on the stack (doesn't mean a static keyword); for example, DECLARE_WORK(name, void (*func)(void *), void *data) is provided to declare work_struct which is initialized with the provided func and data arguments.
Also, sometimes it provides a macro to initialize a dynamically created variable such as INIT_WORK(struct work_struct *work, void (*func)(void *), void *data), which assigns func and data argument to the member field of work pointer.
It seems that these macros are usually defined by the core kernel components, and cannot be seen frequently in the driver code. Is there any rule or custom that define when to provide those #defined macros for declaring or initializing data structures in the Linux Kernel such as providing this interface for frequently used data structure?
And why they are provided? Is it only because to provide a way to write clean code by giving a clean interface to declare and initialize complex data structures to kernel programmers?
Is it because some data structures are internally used, but some data structures can be utilized by multiple kernel components? In other words, to hide the implementation of the data structures?

A: I think it is a bit of both.
#define __WORK_INITIALIZER(n, f) {                  \
    .data = WORK_DATA_STATIC_INIT(),                \
    .entry  = { &(n).entry, &(n).entry },               \
    .func = (f),                            \
    __WORK_INIT_LOCKDEP_MAP(#n, &(n))               \
    }

#define DECLARE_WORK(n, f)                      \
    struct work_struct n = __WORK_INITIALIZER(n, f)

First of all, in this case, it is most probably due to the simple reason that initializing work_struct is at least 4-5 lines of code and since this is something that happens quite a lot in the kernel, it would add unnecessary verbosity to the code, so it has been abstracted into a macro. It could have been a function, but that is also less efficient.
Also, it is difficult for kernel developers and maintainers, when reviewing the code, to ensure that every time a work_struct is declared, it is also initialized properly. In this case, since the initialization code is at a single place, they can safely assume that any code that uses this macro will have initialized the struct properly.
Thirdly, you may be a developer working on some specific driver inside a specific subsystem and may not want to know the internals of the kernel work_queue mechanism. You just want to be able to queue your work using the api provided. This macro also saves you from being bothered about the internals. Even if a new field is added to the struct tomorrow for internal use, your driver code does not need to change.