text:
Q: How to export FTP-data from several packages I've been trying for hours to solve this. Googling like a maniac aswell. How do I export the FTP-data from a bunch of packages? Like when you export HTTP-packages in Wireshark, in just a few clicks you can export all packages as a single one to a file and then just open the HTML page.
Lets say you downloaded a .zip file (through FTP) and you caught this with Wireshark. Now I want to export all those FTP-data packages containing the .zip file to a copy of the .zip file. How can I do that? I managed to get all hexdumps (I think that's what it is called) of the packages, and it looks like this:
0000  00 50 56 ca 11 d8 00 50 18 03 39 80 08 00 45 00   .PV....P..9...E.
0010  04 34 06 34 40 00 2d 06 d3 6f c1 e7 ec 2a c0 a8   .4.4@.-..o...*..
etc...

Maybe I can convert that somehow? Or is there some other way?

A: You can use Bro to extract files from FTP traffic (and other protocols as well). Simply run it as follows:
bro -r trace.pcap 'FTP::extract_file_types = /.*/'

The pattern controls the MIME type of the files to extract. Change -r <trace> to -i <interface> when sniffing on a network interface. Bro creates log files in the same directory it is being run. In addition to the basic logs, you'll now find files named
ftp-item_<SERVER-IP>:<SERVER-DATA-PORT>-<CLIENT-IP>:<CLIENT-PORT>.dat

which contain the payload of the FTP data.


text:
Q: Why does Rails to_json sometimes include attributes, attributes_cache, changed_attributes, etc? My to_json call sometimes seems to include some extra cruft that I'm not expecting:
{"response":
  [{"attributes":
    {
        (...actual list of key:value pairs, as expected)
    },
    "json_class":"Survey",
    "attributes_cache":{}
   },
   {"changed_attributes":{"survey_source":""},
    "attributes":
    {
     (...actual list of key:value pairs, as expected)
    },
    "json_class":"Survey",
    "attributes_cache":{}}
  ],
  "status_code":"200","status_description":"OK"}

What I'm expecting is closer to this:
{"response":
  [survey: {
     (...list of key:value pairs...)
   },
   survey: {
     (...list of key:value pairs...)
    }
  ],
  "status_code":"200","status_description":"OK"}

As far as I can tell, the extra stuff that shows up is used by AR to keep track of the state of dirty objects, but I'm not sure why it gets picked up by to_json. My code does nothing fancy as far as I can tell:
RESPONSE_OK = {"status_code" => "200", "status_description" => "OK"}
@surveys = Survey.find_all_by_state("RUNNING")
response = RESPONSE_OK.merge({"response" => @surveys})
respond_to do |format|
    format.json {
        render :json => response.to_json(:methods => :intercept, :include => {:question_groups => {:include => [:questions]}})
    }
end

I cannot reproduce it on the Rails console (including a simpler example for legibility, but I get the same result for my actual code):
  ?> s = Survey.find_by_id(49)
  => #<Survey id: 49, name: "Cat?", description: "", created_at: "2010-08-29 17:50:45", updated_at: "2010-08-29 17:50:45", order: nil, entrance_logic: nil, user_id: 187, state: "RUNNING", maxresponses: 0, isrepeatable: false, reward_description: nil, compensation_amount: 0, survey_source: nil, responses_received: nil, is_profile_survey: false, hash_id: "123", survey_alias: "456", prerequisites: nil, is_web_survey: false, max_invites: 0, is_social: true>
  >> s.to_json
  => "{"survey":{"survey_source":null,"prerequisites":null,"name":"Cat?","isrepeatable":false,"maxresponses":0,"hash_id":"123","entrance_logic":null,"created_at":"2010-08-29T17:50:45Z","survey_alias":"456","updated_at":"2010-08-29T17:50:45Z","reward_description":null,"responses_received":null,"order":null,"id":49,"user_id":187,"max_invites":0,"is_web_survey":false,"is_social":true,"is_profile_survey":false,"description":"","compensation_amount":0,"state":"RUNNING"}}"
  >> s.reward_description = "100 points"
  => "100 points"
  >> s.to_json
  => "{"survey":{"survey_source":null,"prerequisites":null,"name":"Cat?","isrepeatable":false,"maxresponses":0,"hash_id":"123","entrance_logic":null,"created_at":"2010-08-29T17:50:45Z","survey_alias":"456","updated_at":"2010-08-29T17:50:45Z","reward_description":"100 points","responses_received":null,"order":null,"id":49,"user_id":187,"max_invites":0,"is_web_survey":false,"is_social":true,"is_profile_survey":false,"description":"","compensation_amount":0,"state":"RUNNING"}}"
  >> s.changed
  => ["reward_description"]
  >> s.changed_attributes
  NoMethodError: Attempt to call private method
          from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/attribute_methods.rb:236:in `method_missing'
          from (irb):45
          from :0
  >>

Thanks for any insights!  I'm sure I can modify my code to find a workaround (if all else fails I can just build the hash I pass to to_json by hand), but I would like to gain some understanding of why this happens, if possible.

A: I just had the same problem - and solved it after extensive googling.
You have a JSON gem installed (perhaps as a dependency of another gem) and this is determining your to_json output.
Remove the gem (if you can) and it'll come good.
:)

redpajama_set_name: RedPajamaStackExchange


text:
Q: Is it possible to send routing directions to the HereWeGo app? We are trying to allow people to open their navigation app to show the one or more addresses that we already have set up for them. Is this possible with the HereWeGo app? The reason why we don't use Google maps for this is due to the fact they are driving in trucks and there HereWeGo App supports this.
Thanks,
Alex

A: The HERE WeGo service does not offer Truck routes as an option, the only options available are:

*

*Car

*Public transport

*Pedestrian

*Taxi

You can visit the HERE WeGo website at the following link so you can review all of its features: https://wego.here.com/
Similarly, we are pleased to tell you that we provide the Truck routing service through our Routing v8 API or if you prefer, we still have SDKs available that can be adjusted to what you need to do.
We invite you to take a walk through our documentation to learn more about these services:

*

*https://developer.here.com/documentation

*https://developer.here.com/documentation/routing-api/dev_guide/index.html
Best regards!


text:
Q: Load view classes dynamically in Play using reflection in java I've a configuration file from which I want to read the name of the view and then render the view. I'm trying to use java reflection for this and code looks something like:
Class viewClass = Play.current().classloader().loadClass(viewName);
Method render = viewClass.getDeclaredMethod("render");
page = (Html)render.invoke(viewClass.newInstance());

I'm getting Java.lang.ClassNotFoundException. viewName is the name of the view.

A: You didn't posted how you obtained a class name so I presents a full example in this case for an index view.
String viewName = "views.html.index"
Class viewClass = Play.current().classloader().loadClass(viewName);
Method render = viewClass.getDeclaredMethod("render");
Html page = (Html) render.invoke(null);

There's another problem that you can't call the newInstance() method for a view class. Luckily you don't need an instance of a class as the render() method can be called statically. Just pass a null to the invoke() method.


text:
Q: cannot import a project into github I want to add a flutter project to github so I created a new repository and followed all the instructions in the quick setup and everything was okay but when I opened the repository there were only the read me file with the informations from my project but this is just it no other folders
and by the way I'm trying to import the defult flutter project I didn't change anything

A: You might have missed out on your initial commit of the entire project

A: I believe you may have missed the initial commit of the project.
You would run
$ flutter create project
$ cd project/
$ git init
$ git remote add origin GITHUB_REPO_URL
$ git add -A
$ git commit -m "initial commit"
$ git push


text:
Q: Can I have multiple Swagger endpoints in a single Web API? My Web API has four controllers: Login, Users, Products and Sales. There are also three different client applications and each of these just use a single controller. Administrators have an User Administration app, Managers have a Product management App and customers have a "Buy this" app. So, three different Web API's?
Well, no. As all controllers share the same database so we want it all contained in a single project. They also share some functionality in the background and all APIs also need to support the Login controller.
What I want is that my API has three different URLs:

*

*example.com/Users

*example.com/Products

*example.com/Sales

These should be three different Swagger endpoints, each with the Login controller. I just wonder if this is even possible or if I need three different projects to get this to work.

A: Well, I had to find this post about multiple Swagger documents but I managed to get it to work.
It starts with the builder.Services.AddSwaggerGet() where you use options.SwaggerDoc() multiple times to create multiple documents.
Then, using app.UseSwaggerUI() you add multiple endpoints for each doc. specifying the related document names from the previous step.
And with each controller you add [ApiExplorerSettings(GroupName = "...")] to link the controller to a specific document. Without it, they end up in all documents...
The result is that I now have a single project that holds multiple Swagger endpoints and thus multiple Web API's.


text:
Q: How can I use tilde in the powershell prompt? So I get that:
function global:prompt {
    # Commands go here
}

Sets the prompt in powershell. I can use Get-Location to get the current working directory. And I can cd ~ and be in my home dir.
But can I make the prompt use the tilde? E.g., if I'm in /home/mike it should just show ~.
I've tried testing with:
$pwd -contains $home

But the results aren't correct.
How can I use ~ in the prompt in powershell?

A: You can replace $HOME with ~ using normal string replacement. Ex.
Get the current prompt-function:
Get-Content Function:\prompt

    "PS $($executionContext.SessionState.Path.CurrentLocation)$('>' * ($nestedPromptLevel + 1)) ";
    # .Link
    # http://go.microsoft.com/fwlink/?LinkID=225750
    # .ExternalHelp System.Management.Automation.dll-help.xml

Then replace $home with ~ when the current path is $home or $home\*.
Using switch (readable):
function global:prompt {

    $path = switch -Wildcard ($executionContext.SessionState.Path.CurrentLocation.Path) {
        "$HOME" { "~" }
        "$HOME\*" { $executionContext.SessionState.Path.CurrentLocation.Path.Replace($HOME, "~") }
        default { $executionContext.SessionState.Path.CurrentLocation.Path }
    }

    "PS $path$('>' * ($nestedPromptLevel + 1)) ";
}

Using regex (recommended):
function global:prompt {

    $regex = [regex]::Escape($HOME) + "(\\.*)*$"

    "PS $($executionContext.SessionState.Path.CurrentLocation.Path -replace $regex, '~$1')$('>' * ($nestedPromptLevel + 1)) ";

}

Using Split-Path (ugly):
function global:prompt {

    $path = $executionContext.SessionState.Path.CurrentLocation.Path
    $p = $path

    while ($p -ne "") {
        if($p -eq $HOME) { $path = $path.Replace($HOME,"~"); break}
        $p = Split-Path $p
    }

    "PS $path$('>' * ($nestedPromptLevel + 1)) ";

}

Demo:
PS C:\> cd ~

PS ~> cd .\Desktop

PS ~\Desktop>


text:
Q: GridView xml for layout-large I have the below grid view xml code for layout-large. I have no idea what is the mistake such on device(the screenshot is also there of the device) it is just showing small squares but on studio preview of the xml design it is showing a proper grid view.Kindly help to solve this issue.
    <?xml version="1.0" encoding="utf-8"?>
    <ScrollView 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="wrap_content"
android:background="@color/primary"
android:orientation="vertical"
tools:context="com.example.MainActivity">

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"

        android:orientation="vertical"
        android:paddingBottom="15dp"
        android:paddingLeft="1dp"
        android:paddingRight="1dp"
        android:paddingTop="15dp">

        <TextView
            android:id="@+id/text_id"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
       android:layout_gravity="center"
            android:text="heading"
            android:textSize="20dp"
            android:textStyle="bold" />
    </LinearLayout>

    <GridLayout
        android:id="@+id/mainGrid"
        android:layout_width="match_parent"
        android:layout_height="1050dp"
        android:alignmentMode="alignMargins"
        android:columnCount="2"
        android:columnWidth="10dp"
        android:numColumns="auto_fit"
        android:columnOrderPreserved="false"
        android:padding="5dp"
        android:rowCount="3">
        <!-- row1-->
        <!--column 1-->
        <android.support.v7.widget.CardView
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:layout_columnWeight="1"
            android:layout_marginBottom="16dp"
            android:layout_marginLeft="16dp"
            android:layout_marginRight="16dp"
            android:layout_rowWeight="1"
            app:cardBackgroundColor="@android:color/holo_blue_dark"
            app:cardCornerRadius="8dp"
            app:cardElevation="8dp">

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_horizontal|center_vertical"
                android:layout_margin="16dp"
                android:orientation="vertical">

                <TextView
                    android:id="@+id/download"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Download"
                    android:textAlignment="center"
                    android:textSize="18sp"
                    android:textStyle="bold" />
            </LinearLayout>
        </android.support.v7.widget.CardView>

        <!-- row1-->
        <!--column 1-->
        <android.support.v7.widget.CardView
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:layout_columnWeight="1"
            android:layout_marginBottom="16dp"
            android:layout_marginLeft="16dp"
            android:layout_marginRight="16dp"
            android:layout_rowWeight="1"
            app:cardBackgroundColor="@android:color/holo_blue_dark"
            app:cardCornerRadius="8dp"

            app:cardElevation="8dp">

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_horizontal|center_vertical"
                android:layout_margin="16dp"
                android:orientation="vertical">

                <TextView
                    android:id="@+id/status"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Status"
                    android:textAlignment="center"
                    android:textSize="18sp"
                    android:textStyle="bold" />
            </LinearLayout>
        </android.support.v7.widget.CardView>
        <!--column 2-->
        <android.support.v7.widget.CardView
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:layout_columnWeight="1"
            android:layout_marginBottom="16dp"
            android:layout_marginLeft="16dp"
            android:layout_marginRight="16dp"
            android:layout_rowWeight="1"
            app:cardBackgroundColor="@android:color/holo_blue_dark"
            app:cardCornerRadius="8dp"
            app:cardElevation="8dp">

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_horizontal|center_vertical"
                android:layout_margin="16dp"
                android:orientation="vertical">

                <TextView
                    android:id="@+id/search"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Search"
                    android:textAlignment="center"
                    android:textSize="18sp"
                    android:textStyle="bold" />
            </LinearLayout>
        </android.support.v7.widget.CardView>

        <!-- row2-->
        <!--column 1-->
        <android.support.v7.widget.CardView
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:layout_columnWeight="1"
            android:layout_marginBottom="16dp"
            android:layout_marginLeft="16dp"
            android:layout_marginRight="16dp"
            android:layout_rowWeight="1"
            app:cardBackgroundColor="#176005"
            app:cardCornerRadius="8dp"
            app:cardElevation="8dp">

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_horizontal|center_vertical"
                android:layout_margin="16dp"
                android:orientation="vertical">

                <TextView
                    android:id="@+id/view1"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="View "
                    android:textAlignment="center"
                    android:textSize="18sp"
                    android:textStyle="bold" />
            </LinearLayout>
        </android.support.v7.widget.CardView>
        <!--column 2-->
        <android.support.v7.widget.CardView
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:layout_columnWeight="1"
            android:layout_marginBottom="16dp"
            android:layout_marginLeft="16dp"
            android:layout_marginRight="16dp"
            android:layout_rowWeight="1"
            app:cardBackgroundColor="#176005"
            app:cardCornerRadius="8dp"
            app:cardElevation="8dp">

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_horizontal|center_vertical"
                android:layout_margin="16dp"
                android:orientation="vertical">

                <TextView
                    android:id="@+id/update"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="update"
                    android:textAlignment="center"
                    android:textSize="18sp"
                    android:textStyle="bold" />
            </LinearLayout>
        </android.support.v7.widget.CardView>

        <!-- row3-->
        <!--column 1-->
        <android.support.v7.widget.CardView
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:layout_columnWeight="1"
            android:layout_marginBottom="16dp"
            android:layout_marginLeft="16dp"
            android:layout_marginRight="16dp"
            android:layout_rowWeight="1"
            app:cardBackgroundColor="#176005"
            app:cardCornerRadius="8dp"
            app:cardElevation="8dp">

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_horizontal|center_vertical"
                android:layout_margin="16dp"
                android:orientation="vertical">

                <TextView
                    android:id="@+id/register"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Register"
                    android:textAlignment="center"
                    android:textSize="18sp"
                    android:textStyle="bold" />
            </LinearLayout>
        </android.support.v7.widget.CardView>
        <!--column 2-->
        <android.support.v7.widget.CardView
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:layout_columnWeight="1"
            android:layout_marginBottom="16dp"
            android:layout_marginLeft="16dp"
            android:layout_marginRight="16dp"
            android:layout_rowWeight="1"
            app:cardBackgroundColor="#176005"
            app:cardCornerRadius="8dp"
            app:cardElevation="8dp">

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_horizontal|center_vertical"
                android:layout_margin="16dp"
                android:orientation="vertical">

                <TextView
                    android:id="@+id/view2"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="View "
                    android:textAlignment="center"
                    android:textSize="18sp"
                    android:textStyle="bold" />
            </LinearLayout>
        </android.support.v7.widget.CardView>
        <!-- row4-->
        <!--column 1-->
        <android.support.v7.widget.CardView
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:layout_columnWeight="1"
            android:layout_marginBottom="16dp"
            android:layout_marginLeft="16dp"
            android:layout_marginRight="16dp"
            android:layout_rowWeight="1"
            app:cardBackgroundColor="#176005"
            app:cardCornerRadius="8dp"
            app:cardElevation="8dp">

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_horizontal|center_vertical"
                android:layout_margin="16dp"
                android:orientation="vertical">

                <TextView
                    android:id="@+id/calculate"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Calculate"
                    android:textAlignment="center"
                    android:textSize="18sp"
                    android:textStyle="bold" />
            </LinearLayout>
        </android.support.v7.widget.CardView>
        <!--column 2-->
        <android.support.v7.widget.CardView
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:layout_columnWeight="1"
            android:layout_marginBottom="16dp"
            android:layout_marginLeft="16dp"
            android:layout_marginRight="16dp"
            android:layout_rowWeight="1"
            app:cardBackgroundColor="#176005"
            app:cardCornerRadius="8dp"
            app:cardElevation="8dp">

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_horizontal|center_vertical"
                android:layout_margin="16dp"
                android:orientation="vertical">

                <TextView
                    android:id="@+id/login"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="login"
                    android:textAlignment="center"
                    android:textSize="18sp"
                    android:textStyle="bold" />
            </LinearLayout>
        </android.support.v7.widget.CardView>
        <!-- row5-->
        <!--column 1-->
        <android.support.v7.widget.CardView
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:layout_columnWeight="1"
            android:layout_marginBottom="16dp"
            android:layout_marginLeft="16dp"
            android:layout_marginRight="16dp"
            android:layout_rowWeight="1"
            app:cardBackgroundColor="#176005"
            app:cardCornerRadius="8dp"
            app:cardElevation="8dp">

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_horizontal|center_vertical"
                android:layout_margin="16dp"
                android:orientation="vertical">

                <TextView
                    android:id="@+id/signup"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="signup"
                    android:textAlignment="center"
                    android:textSize="18sp"
                    android:textStyle="bold" />
            </LinearLayout>
        </android.support.v7.widget.CardView>
        <!--column 2-->
        <android.support.v7.widget.CardView
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:layout_columnWeight="1"
            android:layout_marginBottom="16dp"
            android:layout_marginLeft="16dp"
            android:layout_marginRight="16dp"
            android:layout_rowWeight="1"
            app:cardBackgroundColor="#176005"
            app:cardCornerRadius="8dp"
            app:cardElevation="8dp">

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_horizontal|center_vertical"
                android:layout_margin="16dp"
                android:orientation="vertical">

                <TextView
                    android:id="@+id/claim"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Claim"
                    android:textAlignment="center"
                    android:textSize="18sp"
                    android:textStyle="bold" />
            </LinearLayout>
        </android.support.v7.widget.CardView>
        <!-- row6-->
        <!--column 1-->
        <android.support.v7.widget.CardView
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:layout_columnWeight="1"
            android:layout_marginBottom="16dp"
            android:layout_marginLeft="16dp"
            android:layout_marginRight="16dp"
            android:layout_rowWeight="1"
            app:cardBackgroundColor="#176005"
            app:cardCornerRadius="8dp"
            app:cardElevation="8dp">

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_horizontal|center_vertical"
                android:layout_margin="16dp"
                android:orientation="vertical">

                <TextView
                    android:id="@+id/changepassword"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Change Password"
                    android:textAlignment="center"
                    android:textSize="18sp"
                    android:textStyle="bold" />
            </LinearLayout>
        </android.support.v7.widget.CardView>
        <!--column 2-->
        <android.support.v7.widget.CardView
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:layout_columnWeight="1"
            android:layout_marginBottom="16dp"
            android:layout_marginLeft="16dp"
            android:layout_marginRight="16dp"
            android:layout_rowWeight="1"
            app:cardBackgroundColor="@android:color/holo_blue_dark"
            app:cardCornerRadius="8dp"
            app:cardElevation="8dp">

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_horizontal|center_vertical"
                android:layout_margin="16dp"
                android:orientation="vertical">

                <TextView
                    android:id="@+id/sync"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Sync"
                    android:textAlignment="center"
                    android:textSize="18sp"
                    android:textStyle="bold" />
            </LinearLayout>
        </android.support.v7.widget.CardView>

        <!-- row1-->
        <!-- row6-->
        <!--column 1-->
        <android.support.v7.widget.CardView
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:layout_columnWeight="1"
            android:layout_marginBottom="16dp"
            android:layout_marginLeft="16dp"
            android:layout_marginRight="16dp"
            android:layout_rowWeight="1"
            app:cardBackgroundColor="#176005"
            app:cardCornerRadius="8dp"
            app:cardElevation="8dp">

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_horizontal|center_vertical"
                android:layout_margin="16dp"
                android:orientation="vertical">

                <TextView
                    android:id="@+id/logout"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Logout"
                    android:textAlignment="center"
                    android:textSize="18sp"
                    android:textStyle="bold" />
            </LinearLayout>
        </android.support.v7.widget.CardView>
    </GridLayout>

</LinearLayout>

Kindly help to solve the above issue please.


text:
Q: Change message class to appointments to custom form When I receive a new appointment request I want to add a form for me to complete (client name, sales opportunity, territory) I created a form in Developer and it works on appointments I create but does not appear on appointments I receive. I tried the following with no joy.  My form is NewForm:
 Sub cItems_ItemChange(ByVal Item As Object)
  [enter image description here][1]
   ' Change the following line to your new Message Class
  NewMC = "IPM.Appointment.NewForm"

  If Item.Class = olAppointment Then
       If Item.MessageClass <> NewMC Then
          Item.MessageClass = NewMC
          Item.Save
  End If

 End Sub

This works on appointments I create: https://i.stack.imgur.com/B4pUL.png


text:
Q: Running Kotlin from VS Code in UBUNTU gives kotlinc : not found I have installed kotlin on ubuntu using sdkman command sdk install kotlin. Kotlin installed and I tested whether kotlinc command takes me to the kotlin interactive shell. It works and the shell executes the kotlin language.
When I tried running Code Runner add-on in VS Code to execute a .kt file with a basic println("Hello World") function with name main, I get the following error:
[Running] cd "/home/user/Dropbox/user/kotlin/" && kotlinc bgn_hello.kt -include-runtime -d bgn_hello.jar && java -jar bgn_hello.jar
/bin/sh: 1: kotlinc: not found

[Done] exited with code=127 in 0.007 seconds

Does anyone please have an idea why VS Code is not able to execute the kotlin file?

A: Add Kotlin to our PATH so we can access the compiler without having to write out the full path to our installation. Add the following lines to your '~/.bashrc' file.
export KOTLIN_HOME=/usr/local/bin/kotlin
export PATH=$PATH:$KOTLIN_HOME/bin

Make sure to run source ~/.bashrc in order to access the Kotlin compiler in your current terminal session.
Then run kotlinc -version, it should return something like info: kotlinc-jvm 1.5.30 (JRE 11.0.11+9)
Restart VS Code, the command kotlinc should be recognized successfully when using Code Runner.

A: This is because your kotlinc binaries are not in the $PATH environment variable.
I'm on Mac and I added this to my .bashrc:
export PATH="/Applications/IntelliJ IDEA CE.app/Contents/plugins/Kotlin/kotlinc/bin:$PATH"

Where /Applications/IntelliJ IDEA CE.app/Contents/plugins/Kotlin/kotlinc/bin is where my kotlinc binaries exist. Try to see where your kotlin compiler is installed through your IntelliJ IDEA installation and add that line to your ~/.bashrc.
Note that if you're using other types of shells like Oh-My-Zsh you'd have to modify that file for that shell. In case of Oh-My-Zsh would be .zshrc


text:
Q: Order columns in pandas dataframe I have pandas dataframe as below:
import pandas as pd
import numpy as np
df = pd.DataFrame({'CATEGORY': [1, 1, 2, 2],
                    'GROUP': ['A', 'A', 'B', 'B'],
                     'XYZ': [3000, 2500, 3000, 3000],
                  'VAL': [3000, 2500, 3000, 3000],
                  'A_CLASS': [3000, 2500, 3000, 3000],
                  'B_CAL': [3000, 4500, 3000, 1000],
                  'C_CLASS': [3000, 2500, 3000, 3000],
                  'A_CAL': [3000, 2500, 3000, 3000],
                  'B_CLASS': [3000, 4500, 3000, 500],
                  'C_CAL': [3000, 2500, 3000, 3000],
                  'ABC': [3000, 2500, 3000, 3000]})
df

CATEGORY   GROUP   XYZ   VAL    A_CLASS  B_CAL  C_CLASS   A_CAL   B_CLASS   C_CAL  ABC
1          A       3000   1     3000     3000     3000     3000    3000     3000   3000
1          A       2500   2     2500     4500     2500     2500    4500     2500   2500
2          B       3000   4     3000     3000     3000     3000    3000     3000   3000
2          B       3000   1     3000     1000     3000     3000    500      3000   3000

I want columns in below order in my final dataframe
GROUP, CATEGORY, all columns with suffix "_CAL", all columns with suffix "_CLASS", all other fields
My expected output:
GROUP    CATEGORY   B_CAL    A_CAL   C_CAL   A_CLASS   C_CLASS    B_CLASS   XYZ   VAL   ABC
A        1          3000     3000    3000    3000      3000       3000      3000   1    3000
A        1          4500     2500    2500    2500      2500       4500      2500   2    2500
A        1          8000     7000    8000    8000      8000       8000      8000   5    8000
B        2          3000     3000    3000    3000      3000       3000      3000   4    3000
B        2          1000     3000    3000    3000      3000       500       3000   1    3000

A: Fun with sorted:
first = ['GROUP','CATEGORY']
cols = sorted(df.columns.difference(first),
              key=lambda x: (not x.endswith('_CAL'), not x.endswith('_CLASS')))

df[first+cols]

   GROUP  CATEGORY  A_CAL  B_CAL  C_CAL  A_CLASS  B_CLASS  C_CLASS   ABC   VAL  \
0     A         1   3000   3000   3000     3000     3000     3000  3000  3000
1     A         1   2500   4500   2500     2500     4500     2500  2500  2500
2     B         2   3000   3000   3000     3000     3000     3000  3000  3000
3     B         2   3000   1000   3000     3000      500     3000  3000  3000

    XYZ
0  3000
1  2500
2  3000
3  3000

For more details here's a similar one with a detailed explanation

A: You just need to play with strings
cols = df.columns
cols_sorted = ["GROUP", "CATEGORY"] +\
              [col for col in cols if col.endswith('_CAL')] +\
              [col for col in cols if col.endswith('_CLASS')]
cols_sorted += sorted([col for col in cols if col not in cols_sorted])

df = df[cols_sorted]


text:
Q: Applying *:first-child +html in same CSS file with different attributes I have one common CSS file and two pages are referring to it.
One page which is referring to this common CSS requires below CSS,
*:first-child + html .rich-tabpanel {
   margin-left:-13px;        // Note : Its 13px here
}

The other page which is referring to this common CSS requires below CSS,
*:first-child + html .rich-tabpanel {
   margin-left: 0px;         //Note : Its 0px here
}

HTML code is below,
<table class="rich-tabpanel">

I have this problem only in IE7 where its not taking below code (I don't know why),
.ie7 .rich-tabpanel {
   margin-left: 13px; //OR 0px depending on the page
}

So, I removed above code and went with only *:first-child + html .rich-tabpanel code
How can I have two different margin-left attributes in the same common CSS file for rich-tabpanel attribute?

A: From the moment *:first-child +html .rich-tabpanel is a hack, it's specificity is unknown. .ie7 .rich-tabpanel has specificty 0020, so the hack probably has a specifity above it. Changing the selector .ie7 .rich-tabpanel to html .ie7 .rich-tabpanel which changes the specifity then the rule is applied. I don't gurantee that is a specificity issue, but changing the selector, in any case, works.
Demo: http://jsfiddle.net/xWX2R/1/
In any case, I suggest you to use conditional comments than hacks for internet explorer.

A: First, I am confused why you are applying this CSS style:
*:first-child +html .rich-tabpanel{
    margin-left:-13px;        // Note : Its 13px here
}

Specifically, what does *:first-child +html .rich .rich-tabpanel1 even mean?
When I read that it says 'select all elements, the select the first child followed by the adjacent tag  and select .rich-tabpanel1. There is surely a better way to do this:
.rich-tabpanel1 {
  //code
}

There is nothing wrong with your code. One page can reference the first code block while the scond one can reference the other code block. HOWEVER this code:
.ie7 .rich-tabpanel {
   margin-left: 13px; //OR 0px depending on the page
}

Does not work unless you specifically add .ie7 class in your html. Are you using server-side scripting to add that class into the html markup? Purposes a better way to do this is the following:
<!--[if IE]>
  <style type="text/css">@import url("ie.css");</style>
<![endif]-->

If its an IE browser, this CSS file will be fetched and used to override css properties. This gives you a lot more control over your styling.


text:
Q: What's happening with the Ender's Game movie? * UPDATE: Movie is out in theaters as of 2013 *

I'm not asking for rumor here, but verifiable fact.  Anyone know what the status of the Ender's Game movie is?  Last I heard it was in something of development hell.  But Wikipedia suggests that things have gotten moving again since then.  Anyone know anything?  Maybe someone with access to IMDB pro?

A: Update: The movie put out casting calls last month for several of the main characters:

The casting calls appear to be from a draft of the script, written by Star Trek's Roberto Orci and Alex Kurtzman, and they give a pretty good idea of just how closely this film will stick to the book's story.

Here's a description of the movie Ender:

He's depicted as smart and sensitive, but also incredibly ruthless. And he's ten years old — older than in the book, but not as old as Hollywood was trying to make him at one point. There are a few scenes where he worries about being like his cut-throat brother Peter, and confides in his sister Valentine. Just like in the book, he dishes out a rough treatment to Bonzo Madrid, his former platoon leader, when Bonzo tries to bully him too much. And then he feels bad about it. The screenplay also includes some scenes where Ender has weird nightmares about the buggers — and he tries to understand where the buggers are coming from, and what their children are like. Ender is pissed at Graff because he keeps changing the rules in the war "exercises."
  !The scene where Ender finds out that his final victory was not, in fact, a game is pretty intense, and features Ender and Graff both trying to talk at the same time. Ender is saying "They came to establish a colony, we chased them away... in fifty years they have never returned," while Graff is saying, "It makes no difference now," and then Ender is saying "Now I am become death, the destroyer of worlds," at the same time as Graff is saying "What are you talking about?" Finally, Ender is saying "I will bear the shame of this xenocide forever," at the same moment as Graff is saying, "You will be remembered as a hero." It ends with Ender getting an injection, knocking him out.

A: According to Time.com, the project is still ongoing, citing that Gavin Hood has taken up re-writing of the script as well as the project's director. He previously worked on X-Men Origins: Wolverine.
Summit Entertainment is acquiring the rights to development and is co-financing the film.  The current producers are Orson Scott Card himself, Roberto Orci, Alex Kurtzman, Gigi Pritzker, Linda McDonough, and Lynn Hendee.
The current plan is to put the film into production by early 2012.


text:
Q: Angular.js missing $scope update on page load I've got a bit of an interesting situation where I have a weather app, and on loading the app, I want to get the users last position, and the last forecast they saw, and display that, while the app goes and gets the updated forecast.
In my controller, I construct the forecast view like this
function constructWeather(forecast){
        if(!forecast.data.list){
            $scope.loading='weather-error';
            return;
        }
        var today = forecast.data.list[0];
        console.log($scope.date);
        var date = $scope.date;
        $scope.print_date = $filter('date')(date,'EEEE, MMMM, d');
        $scope.print_time = $filter('date')(date,'h:mm a');
        $scope.weather = formatWeather(today,date,true);
        $scope.city =  $scope.position.name || forecast.data.city.name;

        $scope.forecast = (function(){
                            var day_list=[];
                            for(var d=1; d<6; d++){
                                var day_weather = formatForecast(forecast.data.list[d],date,false);
                                day_list.push(day_weather);
                            }
                            return day_list;
                        })();

        $scope.loading = 'weather-loaded';

    }

This works fine when getting a new weather forecast, but when I am trying to reload the old forecast, all the $scope.print_date, $scope.weather, etc. etc. work fine, but ONLY the $scope.forecast the one executed within the anonymous function, does not display.
I've output to the console, and I see the day_weather is being built, but angular isn't updating.
In the template, it is loaded via

{{ day.print_date }}

{{ day.long_day }}

                {{ day.weather.temps.max }}
                {{ day.weather.temps.min }}

and of course, no divs are added to the page.
I've tried to run a $scope.$apply but it returns an error that I'm already in a digest cycle.
Is there another way to tell Angular that the $scope.forecast has new data?

A: Using closure like you did, works like that:

*

*function declaration: (function() {...})

*function execution: ()
So to the $scope.forcast the result of 2. is assigned. It is a completely static object.
If you want to execute this function many times, declare it this way:
 $scope.forecast = function(){ ... };

and in you mark-up use it like that:
ng-repeat="day in forecast()"

PLNKR that shows it in action!

UPDATE
$scope.forecast = (function(){...})() can be replaced with:
$scope.getForecast = function () {...};
$scope.forecast = $scope.getForecast();

Then in your mark-up you can do something like that:
ng-repeat="day in (forecast=getForecast())"

For sure, it cannot be anything worse than what you had previously. If there is still some delay due to -- for example -- some asynchronous call, you should manually synchronize properties you want to be updated together.


text:
Q: What points help identify a cubic and an exponential graph? What are the different points on the graph we need to know which would help determine the equation of the curve. For example in a quadratic graph, we can determine the equation if we know either any three points, vertex and y intercept, two roots and a point, y intercept and two roots, etc. Similarly what are the various points on the graph which would help determine the graph for a cubic and exponential graph?

A: Let's discuss the case of a cubic. A cubic equation has the form $f(x)=ax^3 + bx^2+cd + d$. To fully determine the function, you need four pieces of information that will allow you to calculate $a,b,c,d$.
The simplest example of "four pieces of information" is the values of $f$ at four points, say $x_1$, $x_2$, $x_3$, $x_4$. If we know that
$$
f(x_i) = y_i  \quad \text{for} \; i=1,2,3,4
$$
then we have four linear equations that we can solve to get $a,b,c,d$. This is related to something called Lagrange interpolation.
An especially easy case is where three of the values are zeros of $f$. If we have $f(x_1) = f(x_2) = f(x_3)=0$, then we know that $f(x)=k(x-x_1)(x-x_2)(x-x_3)$ for some $k$. A fourth known value of $f$ will then allow you to calculate $k$.
Another common case is where we know the value and first derivative of $f$ at two points. This again gives us a system of four linear equations that we can solve to get $a,b,c,d$. This is related to so-called Hermite interpolation.
Another example: maybe you know the value of $f$ and its first, second, and third derivatives at some particular point. This lets you construct the Taylor series for $f$ at this point, and that Taylor series is actually identical to $f$ itself.
The four pieces of information can be a diverse mixture. For example, if you know that $f(0)=0$, $f'(0)=0$, $f(1) = 2$, and $f''(2) = 3$, then we have
\begin{align}
f(0) = 0    &\;\Longrightarrow\; d=0 \\
f'(0) = 0   &\;\Longrightarrow\; c=0 \\
f(1) = 2    &\;\Longrightarrow\; a+b+c+d =2 \\
f''(2) = 3  &\;\Longrightarrow\; 12a+4b = 3
\end{align}
which, again, you can solve to get  $a,b,c,d$.
So, in short, you need 4 pieces of information, which are typically values of the function or its derivative(s).


text:
Q: Configuring multiple ORGs in SalesForce Mobile sdk for login I am working on an app where we use Sales Force SDK for Login. We use
com.salesforce.mobilesdk:SalesforceSDK:5.+ SDK for login.
We currently have configured login url, oauthRedirectURI, Consumer key and client secret in servers.xml and bootconfig.xml for ORG1. How do we configure the same for ORG2 as the requirement is to configure the app to allow login using Sales Force SDK for both ORG1 and ORG2

A: No matter how many Orgs you have the app should only have one connected app (consumer key, redirect uri, etc).  All you need to do is add the second Org to servers.xml.  Doc:
https://developer.salesforce.com/docs/atlas.en-us.mobile_sdk.meta/mobile_sdk/oauth_custom_login_host.htm
https://developer.salesforce.com/docs/atlas.en-us.mobile_sdk.meta/mobile_sdk/oauth_custom_login_host_ios.htm
Both orgs will show up on the connections screen (gear in the top right of the login screen) and allow you to login to either.  Multiple users can be logged-in to different Orgs simultaneously.
While not required, I would recommend upgrading the SDK as 5.3 is more than 2 years old.  8.0 was released yesterday.


text:
Q: How to put an enumerated list(or a part of it) in a box, excluding the numbered bullets?

*

*doesn't go in box

*goes in box

*goes in box

*doesn't go in box

*the numbers don't go in box

I'm using \begin{enumerate} for the list.

A: I took one half of this solution to achieve what you want to have. See the linked solution for more details on how you can optimize that.
\documentclass{article}
\usepackage{xparse}
\usepackage{calc}
\usepackage{tikz}
\usetikzlibrary{calc}

\newcommand{\tikzmark}[1]{\tikz[overlay,remember picture] \node (#1) {};}

\makeatletter
\NewDocumentCommand{\DrawBox}{s O{}}{%
    \tikz[overlay,remember picture]{
    \IfBooleanTF{#1}{%
        \coordinate (RightPoint) at ($(left |- right)+(\linewidth-\labelsep-\labelwidth,0.0)$);
    }{%
        \coordinate (RightPoint) at (right.east);
    }%
    \draw[red,#2]
      ($(left)+(-0.2em,0.9em)$) rectangle
      ($(RightPoint)+(0.2em,-0.3em)$);}
}
\makeatother

\begin{document}

\begin{enumerate}
    \item \tikzmark{left}doesn't go in box
    \item goes in box\hspace{1cm}\tikzmark{right}\DrawBox[thick,red]
    \item \tikzmark{left}goes in box
    \item doesn't go in box\tikzmark{right}\DrawBox[dashed, very thick,blue]
    \item the numbers don't go in box
\end{enumerate}

\end{document}

Note: You may need to run LaTeX twice to get the correct positions.


text:
Q: How do i display category module on a custom page in opencart? I am new in php so i don't know what to do!
For opencart I created a custom page for products.I want to add category module which is provided ready by opencart but i don't know how. Any idea how to add category module to my custom page?

A: You need to assign your custom page to a layout that displays the categories module.
Alternately you can create a new layout just for your custom page, then add the category module to your new layout.

A: No need to add a custome page for displaying category. If you entered category from the admin side then front side will be display your category...


text:
Q: Fetching all Posts and Comments from a Facebook Page I'm trying to fetch all the posts and comments from a Facebook Page.
This works quite good so far using the following FQL:
{'all_posts':
'SELECT created_time, post_id, actor_id, message, description, comments FROM stream
   WHERE source_id=PAGE_ID ORDER BY created_time',
'comments':
   'SELECT id, fromid, post_fbid, text, time, post_id FROM comment WHERE post_id
    IN (SELECT post_id FROM #all_posts) ORDER BY post_id'
}

I'm trying to use the RestFB Library, but I get
com.restfb.exception.FacebookResponseStatusException: Received Facebook error response
(code 601): Parser error: unexpected '{' at position 0.

when I try to execute the query:
List<JsonObject> queryResults = facebookClient.executeQuery(query, JsonObject.class);

How can I solve this issue?
Thanks in advance.

A: I thought it was a mistake on RestFB side, parsing the result json, because I got several Exceptions and was kind of confused.
The right way to do this is to use the Multiquery Support of RestFB (Executing Multiqueries with RestFb)
Map<String, String> queries = new HashMap<String, String>();
queries.put("all_posts", "select created_time, post_id, actor_id, message, description, comments from stream where source_id=279947942083512 ORDER BY created_time");
queries.put("comments", "SELECT fromid, username, text, time, post_id FROM comment WHERE post_id in (SELECT post_id FROM #all_posts) ORDER BY post_id");

MultiqueryResults queryResults = facebookClient.executeMultiquery(queries, MultiqueryResults.class);

You have to provide the MultiqueryResults Bean as described in 1


text:
Q: Vue add new value to array I am new to VUE and for one project I am trying to update an array passing the object. I have two button which is called BUTTON 1 and BUTTON 2. If you click on BUTTON 1 then it will set an object to list[] using this.$set. But when BUTTON 2 is pressed it should update with the new value and should display as
{
 a:1,
 b:2,
 c:3
}

Right now I am using this.$set for button 2 as well and it removes the previous value then adds the new one as {c:3} only. Is there a way to add on value using VUE to display { a:1,b:2,c:3} when BUTTON 2 is clicked.
View
<div id="app">
  <button @click="button1()">Button 1</button>
  <button @click="button2()">Button 2</button>
</div>

Method
new Vue({
  el: "#app",
  data: {
    list:[]
  },
  methods: {

    button1(){
      var b = '0';
      this.$set(this.list, b, {
        1:{
            a: '1',
            b: '2'
        }
      })
      console.log(this.list);
    },

    button2(){
      var b = '0';
      this.$set(this.list, b,{
        1:{
            c: '3'
        }
      })
      console.log(this.list);
    },

  }
})

Below there is a jsfiddle link for my code
https://jsfiddle.net/ujjumaki/enj3dwo6/19/

A: Hope this works.
new Vue({
el: "#app",
data: {
list:[]
 },
 methods: {

button1(){
console.log('button 1');

const b = '0';
const restObj=this.list[b] && this.list[b][1]
    this.$set(this.list, b, {
    1:{
    ...restObj,
        a: '1',
        b: '2'
    }
  })

  console.log(this.list);
},

button2(){

const b = '0';
const restObj=this.list[b] && this.list[b][1]
    this.$set(this.list, b,{
    1:{
    ...restObj,
        c: '3'
    }
  })

  console.log(this.list);
},

}
})


text:
Q: Angular 13 fire event on swiping up after certain height How to fire an event after "scrolling down" on touch device?
I have a list of items where each time after scrolling >80% of the list loads 10 additional items.
The example below works fine when using mouse & keyboard but when I switch to touch device, it does not get the scrollTop height due to it is not scrolling.
How can I accomplish the same behavior on mobile devices?
HTML
<div class="...">
  <angular-component
         id="article-list"
         (scroll)="onScroll('article-list')"
         [list]="list"
         class="...">
  </angular-component>
</div>

TS
@HostListener('touchstart', ['$event'])
onScroll(elementId: string): void {
  const articleList = document.getElementById(elementId);
   if (articleList) {
    const scrollPercent = Math.ceil((((articleList.offsetHeight + articleList.scrollTop) /
     articleList.scrollHeight) * 100));
     if (scrollPercent < 30) {
       this.enableScrollToTopButton = false;
     } else {
       this.enableScrollToTopButton = true;
     }
      // code for loading items
   }
}

A: Given your needs, I would take a totally different approach than you.
Here is an example : https://stackblitz.com/edit/angular-ivy-ryetnx?file=src%2Fapp%2Fapp.component.ts
The principle is that the parent component listens to the scroll events on himself, detects when the limit has been reached, then does something (like loading more elements).
This is just the basis, but this gives you a neat approach to handle your needs.
  ngOnInit() {
    // Listen to the scroll of the host
    fromEvent(this.el.nativeElement, 'scroll')
      .pipe(
        // Throttle to trigger only if 50ms have elapsed
        throttleTime(50),
        map((event: any) => {
          const el: HTMLElement = event.target;
          const pageHeight = el.clientHeight;
          const totalHeight = el.scrollHeight;
          const currentScroll = el.scrollTop;

          // Get the bottom point of the page
          const bottomPoint = pageHeight + currentScroll;

          // Get the counts of page (if needed);
          const pageCount = Math.round(totalHeight / pageHeight);

          // Get the current scroll % of the user in the page
          const percentScroll = Math.round((bottomPoint * 100) / totalHeight);

          return { pageCount, percentScroll };
        }),
        // Check if more than 80% has been scrolled
        filter((v) => v.percentScroll >= 80),
        // Take only the first emission
        first()
      )
      .subscribe(() => {
        console.log('Page should load more items');
      });


text:
Q: How to create a Power Bi measure to calculate First Pass Yield based off unique serial numbers I need to create a power bi measure that calculates First Pass Yield (FPY) based on unique serial numbers.
Measure (FPY) =
(Count of unique serial numbers that dont have a "Fail" result)
divided by
(Count of total amount of unique serial numbers)

This measure could then be plotted on a chart that could be dynamically filtered by a date range slicer:

A: This should do the trick:
FPY =
VAR FailedSerialNumbers =
    CALCULATETABLE (
        VALUES ( 'Table'[Serial Number] ),
        FILTER ( ALL ( 'Table'), 'Table'[RESULT] = "FAIL" )
    )
VAR SerialNumbers =
    VALUES ( 'Table'[Serial Number] )
VAR FPYResult =
    CALCULATE (
        DISTINCTCOUNT ( 'Table'[Serial Number] ),
        'Table'[Serial Number] IN EXCEPT ( SerialNumbers, FailedSerialNumbers )
    )
VAR SerialNumberVolume =
    CALCULATE ( DISTINCTCOUNT ( 'Table'[Serial Number] ) )
RETURN
    DIVIDE ( FPYResult, SerialNumberVolume )

Which yields the following:

This solution uses two table variables, 1 with your failed serial numbers and another with all serial numbers. Using these tables, I can extract all serial numbers that have never failed using the EXCEPT function. Once this value has been calculated we just divide it by the total volume.
I hope it helps!

A: Here's another method:
First Pass Yield =
VAR distinctCountTotal =
    DISTINCTCOUNT ( 'Table'[Serial Number] )
VAR distinctCountFail =
    CALCULATE ( DISTINCTCOUNT ( 'Table'[Serial Number] ), 'Table'[Result] = "Fail" )
RETURN
    DIVIDE ( distinctCountTotal - distinctCountFail, distinctCountTotal )


text:
Q: JDateChooser set number of displayed Entrys in Month Combobox Well i must admit i am a little ashamed that i can not find a solution for my newest problem because it sounds so basic and simple.
In JDateChooser there is a JCombobox which enables the user to select a month.
obviously it has 12 entrys. This Combobox displays only 9 entrys at the same time, to reach the other three months you have to scroll up and down.
Is there any way to do this without scrolling, i.e. enlarge the popup vertically?

A: This Will Help
dateChooserCombo1.setCalendarPreferredSize(new java.awt.Dimension(350, 220));


text:
Q: Testing controller init process in Angular unit test Is it possible to test the init process of Angular controller?
Here is the code:
var app = angular.module('led', []);
app.controller('zeppelin', ['$scope', function ($scope) {
    $scope.love = function () {
        return 2;
    };

    $scope.tangerine = $scope.love();
    $scope.prove = function () {
        $scope.love();
    };

    $scope.prove();
    $scope.love();
}]);

Test code:
scope = _$rootScope_.$new();
controller = _$controller_('zeppelin', {
    $scope: scope
});

proved = sinon.spy();
loved = sinon.stub().returns(7);
scope.prove = proved;
scope.love = loved;
expect(proved.callCount).toBe(1); //=> 0
expect(loved.callCount).toBe(2); //=> 0
scope.prove();
expect(proved.callCount).toBe(2); //=> 1
expect(loved.callCount).toBe(3); //=> 0

My issues with the above code are:

*

*I understand that expectation will fail as the controller is already initialized. If I set scope.prove = spied before the initialization, then I receive 0 for both, even after calling them explicitly. Is there a working approach for testing the init process?

*How can I stub scope.love, so scope.tangerine receives the data from the stub, not from the controller?

*Why after calling scope.prove(), loved.callCount does not increment?

To me the most curios case is 3 as I cannot think of any logical explanation for this strange behaviour.

A: 1.
The controller is just a constructor which accepts the $scope object as an argument. You are defining functions on the scope
$scope.love = function () {
    return 2;
};
$scope.prove = function () {
    $scope.love();
};

and then immediately invoking them
$scope.prove();
$scope.love();

There is no way to intercept this process (in Angular, or in general) to spy on the functions before they are first called at the end of your controller. If you set $scope.prove = spied before initializing the controller, then it will simply be overwritten by the controller, if you set it after then the spies will not yet exist when the functions are called.
2.
For the reason described above, you cannot stub $scope.love in time for its return value to be assigned to $scope.tangerine. If it is truly important for you to be able to modify controller initialization behavior in tests, you should make love and injectable service inject it into the controller, and mock it in your tests.
3.
$scope.prove is overwritten by your spy (scope.prove = proved). You are losing the original function created in your controller which calls $scope.love. Instead, you need to spy on the existing function. For example,
var controller = $controller('zeppelin', { $scope: scope });

// here, the controller has initialized scope.prove and scope.love
var loved = sinon.spy(scope, 'love');
var proved = sinon.spy(scope, 'prove');

scope.prove();

// both callCounts are incremented
expect(proved.callCount).toBe(1);
expect(loved.callCount).toBe(1);

A: As it appears it is impossible only for scope to be tested on the init process of the controller. Any other dependency can be tested, as it is beforehand known what their status.
Some code for confirmation:
app.controller('zeppelin', ['$scope','hangman', function ($scope, hangman) {
$scope.love = function () {
    hangman.a(4,6);
    return 'sweet';
};
$scope.tangerine = $scope.love();
$scope.prove = function () {
    $scope.love();
    hangman.a(4,$scope.tangerine);
};
hangman.a(4,6);
}]);

Test code:
beforeEach(inject(function (_$rootScope_, _$controller_, _hangman_) {
    sandbox = sinon.sandbox.create();
    scope = _$rootScope_.$new();
    hangman = _hangman_;
    blackDog = sinon.spy(hangman, 'a');
    loved = sinon.spy(scope, 'love');
    controller = _$controller_('zeppelin', {
        $scope: scope,
        hangman: hangman
    });
    proved = sinon.spy(scope, 'prove');
}));
it('should x', function () {
    scope.prove();
    scope.love();
    expect(scope.tangerine).toBe('sweet');
    expect(loved.callCount).toBe(2);
    expect(blackDog.callCount).toBe(5);
    expect(proved.callCount).toBe(1);
});


text:
Q: Castle Facilities NHibernateIntegration vs Castle Facilities NHibernate Can anybody shed some light on the difference of these two?
I want to use fluent Nhibernate which the second facility provides support for. But I also want to use the http module (SessionWebModule) for open session in view support which seems to reside in the first facility. Are they compatible, should I use both?

A: I'm the creator of NHibernate Facility and the committer on Castle.Transactions. (not participating in NHibernate Integration facility)
I created the NHibernate facility as a Windsor-facility-only type of project. It works mostly around the concept session per transaction and not session per request. However, to the c'tor of the NHibernateFacility you can pass an enum that makes the default lifestyle session per request.
They are not compatible as you can see from the version numbers. The NHibernate Facility is brand new (but in production, because it's very very tiny). NHibernate Integration on the other hand is the official product.
NHibernate Facility requires you to use Transactions 3.0 which is beta at the moment. The tx support is fully there, but not the transactional NTFS bits.
I use my own NHibernate Facility for my own projects and it works really well. YMMV.


text:
Q: Keep getting the "ConfigError: Missing region in config" error in Node.js no matter what I do I keep getting the "UnhandledPromiseRejectionWarning: ConfigError: Missing region in config" when trying to make requests to APIs I have set up in Node.js.
I'm new to DynamoDB and after setting up most of my boilerplate code I'm using Postman to test my routes. However I keep getting the same error each time I make a post request. I've checked some solutions on existing threads, namely: Configuring region in Node.js AWS SDK but cannot get it to work.
I am currently developing the app locally and checked the database where the items are being added.
My setup is as follows:
// user_controller.js

const uuid = require('uuid');
const sanitizer = require('validator');
const bcrypt = require('bcryptjs-then');
const AWS = require('aws-sdk');
const config = require('../config/config');
const { signToken, userByEmail, userById } = require('../Helpers/Users');
const isDev = true

Then in my code block I have the following:
// user_controller.js
(...)

if (isDev) {
      AWS.config.update(config.aws_local_config);
    } else {
      AWS.config.update(config.aws_remote_config);
    }

    const DB = new AWS.DynamoDB.DocumentClient();

    const params = {
      TableName: config.aws_table_name,
      Item: {
        userId: await uuid.v1(),
        firstName: sanitizer.trim(firstName),
        lastName: sanitizer.trim(lastName),
        email: sanitizer.normalizeEmail(sanitizer.trim(email)),
        password: await bcrypt.hash(password, 8),
        level: 'standard',
        createdAt: new Date().getTime(),
        updatedAt: new Date().getTime(),
      },
    }

 return userByEmail(params.Item.email) // Does the email already exist?
      .then(user => { if (user) throw new Error('User with that email exists') })
      .then(() => DB.put(params).promise()) // Add the data to the DB
      .then(() => userById(params.Item.id)) // Get user data from DB
      .then(user => (err, data) => {
        console.log("AFTER USER CREATED")
        if (err) {
          res.send({
            success: false,
            message: 'Error: Server error'
          });
        } else {
          console.log('data', data);
          res.send({
            statusCode: 201,
            message: 'Success - you are now registered',
            data: { token: signToken(params.Item.id), ...user },
          });
        }
      })

(...)

Finally I am importing the config from separate file:
// config.js

module.exports = {
  aws_table_name: 'usersTable',
  aws_local_config: {
    region: 'local',
    endpoint: 'http://localhost:8000'
  },
  aws_remote_config: {}
}

In have already configured the aws-sdk:
AWS Access Key ID [****************foo]:
AWS Secret Access Key [****************bar]:
Default region name [local]:
Default output format [json]:

Here is the output I keep getting:
(node:4568) UnhandledPromiseRejectionWarning: ConfigError: Missing region in config
    at Request.VALIDATE_REGION (/Users/BANGBIZ/Programming/techstars/capexmove/SmartLegalContract/node_modules/aws-sdk/lib/event_listeners.js:92:45)
    at Request.callListeners (/Users/BANGBIZ/Programming/techstars/capexmove/SmartLegalContract/node_modules/aws-sdk/lib/sequential_executor.js:106:20)
    at callNextListener (/Users/BANGBIZ/Programming/techstars/capexmove/SmartLegalContract/node_modules/aws-sdk/lib/sequential_executor.js:96:12)
    at /Users/BANGBIZ/Programming/techstars/capexmove/SmartLegalContract/node_modules/aws-sdk/lib/event_listeners.js:86:9
    at finish (/Users/BANGBIZ/Programming/techstars/capexmove/SmartLegalContract/node_modules/aws-sdk/lib/config.js:350:7)
    at /Users/BANGBIZ/Programming/techstars/capexmove/SmartLegalContract/node_modules/aws-sdk/lib/config.js:368:9
    at SharedIniFileCredentials.get (/Users/BANGBIZ/Programming/techstars/capexmove/SmartLegalContract/node_modules/aws-sdk/lib/credentials.js:127:7)
    at getAsyncCredentials (/Users/BANGBIZ/Programming/techstars/capexmove/SmartLegalContract/node_modules/aws-sdk/lib/config.js:362:24)
    at Config.getCredentials (/Users/BANGBIZ/Programming/techstars/capexmove/SmartLegalContract/node_modules/aws-sdk/lib/config.js:382:9)
    at Request.VALIDATE_CREDENTIALS (/Users/BANGBIZ/Programming/techstars/capexmove/SmartLegalContract/node_modules/aws-sdk/lib/event_listeners.js:81:26)
(node:4568) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 4)
(node:4568) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Like I said, I've tried a lot of variations on this but to no avail. Would love some help, thanks.

A: I dont know if this helps, but I used none instead of local for the region and it seemed to work for me
AWS.config.update({ region: 'none' })


text:
Q: Can a member operator be used without referring to the "this" pointer? I would like to overload the [] operator and use it within a member function without referring to the this pointer, because the point of overloading, at least in this case, is brevity. I don't think it can be done, can it? It seems inconsistent that I can access member functions without dereferencing this, but not member operators.
#include <iostream>

struct demo {
  int i;

  void operator [](demo d) {
    std::cout << "operator called [" << d.i << "]" << std::endl;
  }

  void run() {

    demo k = { 5 };

    (*this)[k] ;          // works
    this->operator[](k);  // works
    // [k]                // fails - why?
  }

};

A: You can use it without this like
operator[](k);

A: Just writing [k]; is simply syntactically incorrect in C++. Why? Maybe because no one though to make it a feature, it is pretty niche and not really readable.
In post-C++11 it is most likely parsed as a lambda with missing body, that is why a compiler complains about expected {. For example [k]{return k;}; is a correct lambda definition.


text:
Q: Set padding for cells of a specific row (not all cells) and set vertical center alignment The context
I'm trying to create a table that meets the following conditions

*

*the padding on all cells from the first row must be bigger than the default padding.

*the content of all cells must be vertically center aligned.

Regarding the condition no. 1: I know how to change the padding on all cells but don't know how to do it for all cells of an specific row without causing this effect on all the other rows (see document below)
\documentclass{article}

\begin{document}

\def\arraystretch{2}

\noindent
\begin{tabular}{|c|c|c|}
   \hline a & b & c
\\ \hline a & b & c
\\ \hline a & b & c
\\ \hline
\end{tabular}

\end{document}

Regarding the condition no. 2: I know how to do it.
\documentclass{article}

\usepackage{array, lipsum}

\begin{document}

\noindent
\begin{tabular}{|m{5cm}|m{5cm}|}
   \hline a & \lipsum[1][1-2]
\\ \hline \lipsum[2][1-2] & b
\\ \hline
\end{tabular}

\end{document}

The question
How can I create a table that meet condition no. 1 and condition no. 2?

A: In the environment {NiceTabular} of nicematrix, you have two keys cell-space-top-limit and cell-space-bottom-limit and a key cell-space-limits for their conjonction.
With the latest version of nicematrix (v. 5.18 of 2021-07-15), it's possible to fix the value of those parameters for a single row with the command \RowStyle.
\documentclass{article}
\usepackage{nicematrix}

\begin{document}

\newcolumntype{M}{>{\raggedright\arraybackslash}m{2.2cm}}

\begin{NiceTabular}{MMM}[hvlines,cell-space-limits=1mm]
some text & here also some text & text, text, text and text \\
some text & here also some text & text, text, text and text \\
\RowStyle[cell-space-limits=0pt]{}
some text & here also some text & text, text, text and text \\
some text & here also some text & text, text, text and text \\
\end{NiceTabular}

\end{document}

The package nicematrix also provides a key hvlines which draw all the rules.

A: I use zero width rules piped into a zero width m-column to set the height of the rows. In addition, I define a new column type, M, which vertically and horizontally centres its content.
In example 2, I have defined a new command \rl, which allows you to set the row height individually.
Example 1 - same height rows

\documentclass{article}

\usepackage{array}
\newcolumntype{M}{>{\centering\arraybackslash}m{15pt}}

\begin{document}

\noindent
\begin{tabular}{|*{3}{M|}>{\rule{0pt}{30pt}}m{0pt}}
   \cline{1-3} a & b & j &
\\ \cline{1-3}  a & b & j &
\\ \cline{1-3}  a & b & j &
\\ \cline{1-3}
\end{tabular}

\end{document}

Example 2 - different height rows

\documentclass{article}

\usepackage{array}
\newcolumntype{M}{>{\centering\arraybackslash}m{15pt}}
\newcommand{\rl}[1]{\rule{0pt}{#1pt}}

\begin{document}

\noindent
\begin{tabular}{|*{3}{M|}m{0pt}}
   \cline{1-3} a & b & j & \rl{16}
\\ \cline{1-3}  a & b & j &
\\ \cline{1-3}  a & b & j &\rl{30}
\\ \cline{1-3}
\end{tabular}

\end{document}

A: I wouldn't use  arraystretch  to have vertically centered cells contents, as it asymmetrically expands the height and depth of cells. A better way uses package cellspace, which defines a minimal vertical padding at the top and bottom of cells in columns with specifier prefixed with the letter S (or C if you load siunitx).
Here is demo, with \cellspacetop-bottomlimit chosen so that the solution with arraystretch and the solution with cellspace result in tables of the same height:
\documentclass{article}
\usepackage{cellspace}
\setlength{\cellspacetoplimit}{8.5pt}
\setlength{\cellspacebottomlimit}{8.5pt}

\begin{document}

{\def\arraystretch{2}

\noindent
\begin{tabular}{|c|c|c|}
   \hline a & b & c
\\ \hline a & b & c
\\ \hline a & b & c
\\ \hline
\end{tabular}}
\qquad
\begin{tabular}{|Sc|Sc|Sc|}
   \hline a & b & c
\\ \hline a & b & c
\\ \hline a & b & c
\\ \hline
\end{tabular}

\end{document}

A: Both conditions are met with this approach
\documentclass{article}

\usepackage{tabu, stackengine}

\usepackage{lipsum}

\begin{document}

\begin{tabu}{|m{80pt}|m{80pt}|m{80pt}|}
\hline

\addstackgap[80pt]{a}
& b
& \lipsum[1][1-2]
\\ \hline

A
& B
& C
\\ \hline

\end{tabu}

\end{document}


text:
Q: Simple joint probability distribution table calculations Given this joint probability distribution table
     |   A   |   B   |   C
X    | 0.15  | 0.03  | 0.07
notX | 0.05  | 0.25  | 0.45

I've to calc the following probabilities
P(B or X) = ?
P(C or notX) = ?

So far I got this solution:
P(B or X) = 0.15 + 0.03 + 0.07 + 0.25
P(C or notX) = 0.07 + 0.45 + 0.05 + 0.25

but I'm very unsure...

A: By addition theorem of probability,
P(A U B) = P(A) + P(B) – P(A ⋂ B)
U denotes union of events, and ⋂ denotes intersection of events.
In other words,
P(A or B) = P(A) + P(B) – P(A and B)
So, your calculations are correct. Here's the proof
P(B or X) = P(B) + P(X) - P(B and X)

          = (0.03 + 0.25) + (0.15 + 0.03 + 0.07) - 0.03

          = 0.15 + 0.03 + 0.07 + 0.25

Similarly,
P(C or not X) = 0.07 + 0.45 + 0.05 + 0.25


text:
Q: PHP listen to unix socket So in short I'm trying to get a PHP script to listen for requests over unix sockets and send it a request from another PHP script.
I have configured PHP-FPM as such:
[a]

; Unix user/group of processes
user = www
group = www

listen = /var/run/php-fpm-a.sock
;listen.backlog = -1

listen.owner = www
listen.group = www
listen.mode = 0660

; Choose how the process manager will control the number of child processes.
pm = dynamic
pm.max_children = 75
pm.start_servers = 3
pm.min_spare_servers = 1
pm.max_spare_servers = 5
pm.max_requests = 500

; host-specific php ini settings here
php_admin_value[open_basedir] = /usr/local/www/a
php_flag[display_errors] = on
/usr/local/www/a contains the following index.php:

<?php
echo 'test\ntest\ntest\n';

There is another PHP-FPM config file that effectively listens at /var/run/php-fpm-b.sock and Nginx points to it (this bit works fine), this contains the following code in /usr/local/www/b/index.php:
echo 'TEST B';
$fp = fsockopen('unix:///var/run/php-fpm-a.sock', -1, $errno, $errstr, 30);
if (!$fp) {
  echo "$errstr ($errno)<br />\n";
} else {
  $out = "GET /index.php HTTP/1.1\r\n";
  $out .= "Host: localhost\r\n";
  $out .= "Connection: Close\r\n\r\n";
  fwrite($fp, $out);
  while (!feof($fp)) {
    echo fgets($fp, 128);
  }

  fclose($fp);
}

Clearly I have something wrong in /usr/local/www/b/index.php as all I get is "TEST B" as the output. I don't think it's a socket permission issue as it would state so with an error, my guess is $out is wrong for this to work but have no idea what PHP excepts to receive. Any help would be appreciated.
Note: using PHP7 on FreeBSD11

A: PHP-FPM is a FastCGI Process Manager. FastCGI and HTTP are two different protocols. So, PHP-FPM can't speak HTTP directly.
browser -> (HTTP) -> nginx -> (FastCGI) -> PHP-FPM + scriptB
scriptB -> (HTTP) -> PHP-FPM + scriptA

You have two options:

*

*Put script A behind nginx and then open TCP socket instead of unix socket to communicate from B to A.

*Modify script B to speak in FastCGI language with script A instead of HTTP.


text:
Q: JAVA RMI Addition example I m Implementing a simple Java RMI application. It's main objective is to add 2 integer. The code source is the following:
AdditionInterface for both client and server side
import java.rmi.*;
 public interface AdditionInterface extends Remote {
 public int add(int a,int b) throws RemoteException;
 }
Addition.java
 import java.rmi.*;
 import java.rmi.server.*;

 public class Addition extends UnicastRemoteObject
 implements AdditionInterface {

 public Addition () throws RemoteException { }

 public int add(int a, int b) throws RemoteException {
 int result=a+b;
 return result;
 }
 }

AdditionServer
import java.rmi.*;
 import java.rmi.server.*;

 public class AdditionServer {
 public static void main (String[] argv) {
 try {
 System.setSecurityManager(new SecurityManager());

 Addition Hello = new Addition();
 Naming.rebind("rmi://localhost/ABC", Hello);

 System.out.println("Addition Server is ready.");
 }catch (Exception e) {
 System.out.println("Addition Server failed: " + e);
 }
 }
}

AdditionClient
import java.rmi.*;

 public class AdditionClient {
 public static void main (String[] args) {
 AdditionInterface hello;
 try {
 System.setSecurityManager(new SecurityManager());
 hello = (AdditionInterface)Naming.lookup("rmi://localhost/ABC");
 int result=hello.add(9,10);
 System.out.println("Result is :"+result);

 }catch (Exception e) {
 System.out.println("HelloClient exception: " + e);
 }
 }
 }

Security Policy for both client and server side
    grant {
        permission java.security.AllPermission;

  };

However i get the HelloClient exception: java.security.AccessControlException: access denied ("java.net.SocketPermission" "127.0.0.1:1099" "connect,resolve")
 error

A: You have to start the RMI registry first. Try to call
java.rmi.registry.LocateRegistry.createRegistry(1099);

before trying to (re)bind your remote object. I am not sure but this call may fail if the registry is already started.
Your second problem may be that the policy applied by your SecurityManager does not have permissions to connect/resolve localhost. Try ro comment out System.setSecurityManager(new SecurityManager()); to get started. The default java policy file has only one SocketPermission granted:
permission java.net.SocketPermission "localhost:0", "listen";


text:
Q: Facebook like button on wordpress post Hello I have wordpress blog with facebook like button under each post. The problem is when I clicked like button it counts very well but it doesn't display that I liked this post on my facebook profile. Are there any errors in code? :
<iframe class="like-post" src="//www.facebook.com/plugins/like.php?href=<?php echo urlencode(get_permalink($post->ID)); ?>&locale=en_US&width=100&layout=button_count&action=like&show_faces=true&share=false&height=21" style="float: left; border:none; overflow:hidden; height:21px;width:80px;" ></iframe>


text:
Q: Does Resharper has a quick code preview like in Roslynator? I mean something like this.

I don't know what it called. Today, I tried a trial version of Resharper and I found Resharper need to click Preview Code to show code changes. I wonder if Resharper has a feature like this.


text:
Q: I want to test a submission form but the click on the submit button calls on a api from a different domain in Cypress Lets say I want to automate a lead form with name and number in cypress,
I click on Submit button
The BaseUrl is https://localhost:8080
On clicking the Submit button manually, an API is triggered with URL https://localhost:9010
But in Cypress
Api is not triggered , and no action occurs on clicking the submit button .
Can somebody give a solution or a workaround for this issue??


text:
Q: How can I remove an ArrayList from an ArrayList of ArrayLists? ArrayList<ArrayList<String>> b = new ArrayList<ArrayList<String>>();

I have an ArrayList like the one above with a bunch of ArrayLists as elements, is there a way to remove one of them by index?
I created a for loop to remove one of the ArrayLists and got an error message that says there are
incompatible types.
for(int f = 0; f < longDistanceInput.size(); f++){
     ArrayList<ArrayList<String>> newLongDisinput = longDistanceInput.remove(f);
}

Thanks in advance.

A:
I tried to do something like this and got an error message says
  incompatible types
for(int f = 0; f<longDistanceInput.size(); f ++){
   ArrayList<ArrayList<String>> newLongDisinput = longDistanceInput.remove(f);}

That's because longDistanceInput.remove(f) returns a ArrayList<String>, not a ArrayList<ArrayList<String>>.
Try:
ArrayList<String> newLongDisinput = longDistanceInput.remove(f);

However: be careful removing things while iterating forwards: you will end up removing only half the items in the list, because you skip over the one immediately after the one you remove.
Either iterate in reverse; or just use longDistanceInput.remove(0) instead of remove(f). But note that removing from anything but the large-index end of an ArrayList is rather inefficient: if possible, just don't remove things from the list until after the loop.


text:
Q: $\operatorname{Eq}(f,g) = X$ implies that $f= g $ as morphisms? Let $X,Y$ be schemes over $S$ and assumed $Y/S$ is separated and $X$ reduced. Let $\operatorname{Eq}(f,g)$ denote the equalizer of $f$ and $g$. By base change to an affine open subset $U$ of $X$, I can show that the map
$$\operatorname{Eq}(f|_U,g|_U) = \operatorname{Eq}(f,g) \cap U \longrightarrow U$$
is an isomorphism and since $U$ was arbitrary, thus we have that $\operatorname{Eq}(f,g) \cong X$.

My questions are:

*

*How does this imply that $f = g$ as morphisms of schemes?

*This is possibly stupid but isn't there a difference between saying $\operatorname{Eq}(f,g) = X$ and $\operatorname{Eq}(f,g) \cong X$?

A: The following is pure abstract nonsense:

The equaliser of a parallel pair $f_0, f_1 : X \to Y$ is an isomorphism $e : E \to X$ if and only if $f_0 = f_1$.

Indeed, if $e$ is the equaliser, then $f_0 \circ e = f_1 \circ e$; and if $e$ is an isomorphism (or even just an epimorphism!), then we can cancel $e$ and get $f_0 = f_1$. Conversely, if $f_0 = f_1$, then $\mathrm{id} : X \to X$ is an equaliser (of course!), but equalisers are unique up to unique isomorphism, so any other equaliser of $f_0$ and $f_1$ must be an isomorphism.


text:
Q: JQuery timepicker time slots are not disabling I am trying to disable a time slot in my jQuery timepicker, however it idoesn't get disabled. My HTML is:

$( document ).ready(function() {
    $('input[name="datetime"]').timepicker({
        minTime: '10:00am',
        maxTime: '04:40pm',
        interval: '20', // 15 minutes
        disableTimeRanges: [
            ['10:00am', '10:20am'],
            ['4:20pm', '5:00pm']
        ],
        // showDuration: true
    });
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/timepicker/1.3.5/jquery.timepicker.css" rel="stylesheet"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/timepicker/1.3.5/jquery.timepicker.js"></script>

<input id="timepicker"
       type="text"
       class = "timepicker"
       name="datetime"
       placeholder = "Time*"
       required/>

I have done some research, and tried different things but couldn't get it working. Does anyone know how to fix this?

A: There are two libraries, Timepicker for jQuery and jQuery Timepicker, I wonder if you're using one and reading the documentation for the other.
Here I switched to the Timepicker for jQuery library and your code seems to work, although "interval" becomes "step" and takes an integer (minutes).
I don't see support for "disableTimeRanges" in jQuery Timepicker

$( document ).ready(function() {
    $('input[name="datetime"]').timepicker({
    minTime: '10:00am',
    maxTime: '04:40pm',
    step: 20, // 15 minutes
    disableTimeRanges: [
        ['10:00am', '10:20am'],
        ['4:20pm', '5:00pm']
    ],
    // showDuration: true
    });
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/jquery-timepicker/1.10.0/jquery.timepicker.min.css" rel="stylesheet"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-timepicker/1.10.0/jquery.timepicker.min.js"></script>

<input id="timepicker"
       type="text"
       class = "timepicker"
       name="datetime"
       placeholder = "Time*"
       required/>


text:
Q: Change order of columns in Flask-Admin list view I have a Flask-Admin list view (ModelView) of my user model with some fields excluded, custom headers, etc. Everything's working correctly and I've overridden the default list template so I can match the styling of the rest of the application.
However, my foreign key columns appear at the beginning of the list, and I need to move them around so the table makes a bit more sense.
How do I specify what order the columns appear in? Is this possible, or do I just need to add some nasty conditionals in my list template?

A: Define the column_list. You define which columns appear and their order.
Example:
column_list = ['id', 'name', 'other_column']


text:
Q: How to filter using a condition in NLog with C# I am having an issue creating an NLog target filter in C#. I am trying to create a filter to log to two different targets. I have this working with a condition based off of the message contents containing a matching string. The issue is that I can't seem to get the condition working with the machinename or event-context contents.
This will work as expected with the use of the message itself:
var newRule = new LoggingRule("*", logLevel, someWrapper);
newRule.DefaultFilterResult = FilterResult.Ignore;
newRule.Filters.Add(new ConditionBasedFilter()
{
    Condition = "contains(message, 'string')",
    Action = FilterResult.Log
});
config.LoggingRules.Add(newRule);

These do not work:
Condition = "contains(machinename, 'string')"
Condition = "equals(machinename, 'string')"
Condition = "machinename == 'string')"
Condition = "contains(event-context:item=SomeItem, 'string')"
Condition = "equals(event-context:item=SomeItem, 'string')"
Condition = "event-context:item=SomeItem == 'string')"

The error I will see for the above will be:

"Unexpected token: ==" OR "Unexpected toekn: ,"

I am not sure if I have the format wrong maybe? I have tried several different options but I just can't seem to get the conditional filter working with machinename or more specifically the event-context.
Thank you for your time and help!

A: What you're missing on your condition are some single quotes around it.
var stringToCompare = "sometext";
var stringCondition = "'${machinename}' == '" + stringToCompare + "'";

...

newRule.Filters.Add(new ConditionBasedFilter()
{
    Condition = stringCondition,
    Action = FilterResult.Log
});

A: NLog 4.6.7 introduces the new NLog.Filters.WhenMethodFilter that takes a lambda as input-parameter.
If you want to do filtering without making use of NLog LayoutRenderers. See also: https://github.com/NLog/NLog/wiki/Filtering-log-messages

A: In conditions you could use layout renderers, but you need the ${...} syntax,
so this will work:
Condition = "contains(${machinename}, 'string')"
Condition = "equals(${machinename}, 'string')"
Condition = "${machinename} == 'string'"
Condition = "contains(${event-context:item=SomeItem}, 'string')"
Condition = "equals(${event-context:item=SomeItem}, 'string')"
Condition = "${event-context:item=SomeItem} == 'string'"

See also the docs of the conditions in NLog

Condition Language
  The filter expressions are written in a special mini-language. The language consists of:

*

*relational operators: ==, !=, <, <=, >= and >

*

*Note: Some predefined XML characters may need to be escaped. For example, if you try to use the '<' character, the XML parser will interpret it as an opening tag which results in an error in the configuration file. Instead, use the escaped version of '<' (<) in this context.

*boolean operators: and, or, not

*string literals which are always evaluated as layouts - ${somerenderer}

*boolean literals - true and false

*numeric literals - e.g. 12345 (integer literal) and 12345.678 (floating point literal)

*log level literals - LogLevel.Trace, LogLevel.Debug, ... LogLevel.Fatal

*predefined keywords to access the most common log event properties - level, message and logger

*braces - to override default priorities and group expressions together

*condition functions - to perform string and object tests

*Single quotes should be escaped with another single quote.

All possible layout renderers could be found here https://nlog-project.org/config (tab 'layout-renderers')
The official docs how to filter in NLog could be found here: https://github.com/NLog/NLog/wiki/Filtering-log-messages


text:
Q: Help understanding SQL Server Developer License when users test via webserver I'm trying to understand how many licenses I may need if we decide to pursue a SQL Server Developer license for our Testing environment.
We would have 5 actual developer and DBA's physically accessing the database to perform work.
The part where I get confused is our users will be testing our applications from a web server. This webserver will communicate with a 'logic' server that will perform all the database interaction.
At our highest level of testing we probably have 20 users on the system, but depending on the time of year they may be different users.  Example: During fiscal year end we may have 20 people from account on the system, but during benefit enrollment time of year we may have 20 HR/Payroll users testing on the system.
In reading different sets of documentation(Article 1)(Article 2) and speaking to our license reseller I still do not have a clear idea of how many licenses I need.
I think I can purchase 5 for the actual developers/DBA's and one license for each SQL accounts the services uses?
This is the how we are structured currently.  The servers have SQL Server accounts for authentication.


text:
Q: Optimizing an Azure App Service for Static Content I have a "Basic" Azure App Service Plan hosting multiple App Services. One of those App Services contains exclusively static content (i.e., html, css, js, png, &c.).
Question
What server-side configuration settings are available to me in Azure to optimize for static content delivery? My objective is to minimize resources used by the App Service Plan, while also maximizing responsiveness to clients.

Note: I am not looking for advice on optimization of client-side files, such as bundling and minification.

Current Settings
Currently, I have the following set in my web.config file:
<configuration>
  <system.webServer>
    <staticContent>
      <clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="30.00:00:00" />
    </staticContent>
    <urlCompression doStaticCompression="true" />
    <httpCompression>
      <staticTypes>
        <clear />
        <add enabled="true" mimeType="*/*" />
      </staticTypes>
    </httpCompression>
  </system.webServer>
</configuration>

Related Questions
I'm hoping for something similar to an excellent answer to a similar question pertaining to IIS 7.5 from a number of years ago. Obviously, many of those remain pertinent. Are there additional settings I should be considering for Azure specifically? For example, are there ways to disable support for server-side preprocessors such as ASP.NET that might reduce unnecessary resources?


text:
Q: How To Get Clear Image From FaceBook I used graph API Json Response of Facebook Wall Post Images and display in my APP i successfully got it. But the wall images look very Blur how to resolve? i used this code for get wall picture
URL url=new URL(hashMap.get("picture_url"));
bitmap=BitmapFactory.decodeStream(url.openConnection().getInputStream());
((ImageView)view.findViewById(R.id.imageView_FullImage)).setImageBitmap(bitmap)

A: The Facebook Graph API as well as the FQL data set always returns the Picture URL of a thumbnail. If you look at the URL it returns, it will have one of these ending (right before the image extension .jpg, .png, etc) _t., _a.. For example, if the URL is to a JPG file, it could have an ending _t.jpg
The idea is to swap the ending and choose a normal size for the image that is returned. To do this, use the code below that will replace the endings with the one for normal sized images (that should have the _n.)
By the way, I don't think the tag you are looking for is picture_url. It should be just picture. But regardless, get the source URL as shown below, replace the endings and then pass it to the this line in your code:
// THIS SHOULD BE AFTER THE if....else code block
bitmap=BitmapFactory.decodeStream(url.openConnection().getInputStream());

CODE TO REPLACE THE VARIOUS THUMBNAIL IMAGES: By the way, this is production code and works perfect.
String PICTURE_URL;
String getPicture = JOFeeds.getString("picture");

if (getPicture.contains("_t.")) {
    PICTURE_URL = getPicture.replaceAll("_t.", "_n.");
} else if (getPicture.contains("_a.")) {
    PICTURE_URL = getPicture.replaceAll("_a.", "_n.");
} else if (getPicture.contains("_s.")) {
    PICTURE_URL = getPicture.replaceAll("_s.", "_n.");
} else if (getPicture.contains("_q.")) {
    PICTURE_URL = getPicture.replaceAll("_q.", "_n.");
}

Note: However, in some cases, like a Video preview or a Link preview, it will not always have a bigger image available. Nothing much you can do about it nor can Facebook I suspect. These typically come from posts that are shared by users from other websites.


text:
Q: Changing App name Is it possible to change the name of an app which is already in the windows 8 store through an update ? I can imagine that the actual name can be changed through the manifest file but what about the name in the store ?

A: Here is an guide on MSDN about the things you have to do to change the name of your app:
http://msdn.microsoft.com/en-us/library/windows/apps/hh868182.aspx
Tried it myself and it works like a charm!

A: I guess it should be possible - the app name is determined by the name in App Manifest. The only problem might be if the new name is already taken by someone else.


text:
Q: Mysql subtracting values using row selected from min timestamp, grouping by id I've been at this for a few hours now to no avail, pulling my hair out.
Edit: Im wanting to calculate the difference between the overall_exp column by using the same data from 1 day ago to calculate the greatest 'gain' for each user
Currently I'm take a row, then select a row from 1 day ago based on the first rows timestamp then subtract the overall_exp column from the 2 rows and order by that result whilst grouping by user_id
SQL Fiddle: http://sqlfiddle.com/#!2/501c8
Here is what i currently have, however the logic is completely wrong so im pulling 0 results
SELECT rsn, ts.timestamp, @original_ts := SUBDATE( ts.timestamp, INTERVAL 1 DAY), ts.overall_exp, ts.overall_exp - previous.overall_exp AS gained_exp
    FROM tracker AS ts
INNER JOIN (
    SELECT user_id, MIN( TIMESTAMP ) , overall_exp
    FROM tracker
    WHERE TIMESTAMP >= @original_ts
    GROUP BY user_id
) previous
    ON ts.user_id = previous.user_id
JOIN users
    ON ts.user_id = users.id
GROUP BY ts.user_id
ORDER BY gained_exp DESC

A: You can do this with a self-join:
select t.user_id, max(t.overall_exp - tprev.overall_exp)
from tracker t join
     tracker tprev
     on tprev.user_id = t.user_id and
        date(tprev.timestamp) = date(SUBDATE(t.timestamp, INTERVAL 1 DAY))
group by t.user_id

A key here is converting the timestamps to dates, so the comparison is exact.

A: Try:
select u.*, max(t.`timestamp`)-min(t.`timestamp`) gain
from users u
left join tracker t
on u.id = t.user_id and
   t.`timestamp` >= date_sub(date(now()), interval 1 day) and
   t.`timestamp` < date_add(date(now()), interval 1 day)
group by u.id
order by gain desc

SQLFiddle here.


text:
Q: Problems with travis for C# Travis CI now supports C# (in beta).
After try 8 different methods, I can't find a solution to my problem.
I have an ASP MVC project, travis use mono and I know that I can't build in travis this kind of project
script:
    - xbuild project.sln

Ok no problem with this but I want to pass my tests, the best solution that I find is:
language: csharp
solution: OptionType.sln
install:
  - sudo apt-get install mono-devel mono-gmcs nunit-console
script:
  - nunit-console MSPSpain.Tests/bin/Debug/MSPSpain.Tests.dll

but failed.. https://travis-ci.org/MSPSpain/Website/builds/43711017
936ProcessModel: Default    DomainUsage: Single

937Execution Runtime: mono-4.0

938Missing method .ctor in     assembly /home/travis/build/MSPSpain/Website/MSPSpain.Tests/bin/Debug/MSPSpain.Tests.dll, type     Microsoft.VisualStudio.TestTools.UnitTesting.TestClassAttribute

939Can't find custom attr constructor     image: /home/travis/build/MSPSpain/Website/MSPSpain.Tests/bin/Debug/MSPSpain.Tests.dll mtoken:     0x0a000011

940Could not load file or assembly 'Microsoft.VisualStudio.QualityTools.UnitTestFramework,     Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.

941

942The command "nunit-console MSPSpain.Tests/bin/Debug/MSPSpain.Tests.dll" exited with 254.

I searched a lot about this and I can't find the best solution to my problem.

A: Your tests are using MSTest and referencing the Microsoft.VisualStudio.QualityTools.UnitTestFramework assembly which is typically installed by Visual Studio.
The Microsoft.VisualStudio.QualityTools.UnitTestFramework will not be included with Mono.
Probably the simplest solution is to switch to using NUnit instead of MSTest if you want to run the tests on both Windows and Mono.
Whilst it is possible to get MSTest installed without Visual Studio on Windows I suspect this will not be possible on a non-Windows operating system.