text:
Q: Is there a way to run `git cherry-pick` and specify the series of commits specific to a given branch? For example:
feature        C---D---E---G---H---L---M
              /         \       \      ^--- tip of feature
master   A---B-----------F---I---J---K
                                     ^--- tip of master

The commits I want to cherry-pick are: C D E G H L M
The key requirement: I don't want to specify any commit IDs manually --- I want a reliable way to specify them in terms of "commits I made to feature since it diverged from master".  I don't want what's been put into master since feature diverged from it so I don't want F I J K.
The reason: I'd like to be able to cherry-pick those commits into a third branch, but I cannot just run git merge feature as it would also include additional ancestors such as A and B.  (I do not want to get into the reasons why there's stuff in master I don't want in the third branch.)
Does this make sense?

A: You can get list of commits you want to pick by listing the first parents of feature, and remove the first parents of master ;
you can use the script provided in this answer :
git rev-list --first-parent master > listm.txt
git rev-list --first-parent feature > listb.txt

# use grep, use '-f' to read patterns from 'listm.txt',
# use '-v' to say "exclude these patterns"
cat listf.txt | grep -v -f listm.txt

In bash like shell, you can use <(...) to turn it into a one liner :
git rev-list --first-parent feature | grep -v -f <(git rev-list --first-parent master)

You can then feed that list to cherry-pick :
list=$(git rev-list ...)
git cherry-pick $list

A: TL;DR
You can do it easily by rebasing the specific part of the graph that interest you to a new branch onto the feature2 branch. The only tricky part is to identify the 1st commit to re-play (see bellow).

To make the reading easier, let's call your feature branch 'feature1'
let's say the branch you want your cherry-picked to go into is called 'feature2'
for now let's create a working branch from the feature1 branch (will will use this in few seconds). let's call it 'feature2-with-feature1-commits'

*

*git checkout feature1

*git checkout -b feature2-with-feature1-commits
now we can find the hash the feature1 was created from (the original master commit) by finding the previous commit of the 1st shared commit between feature1 and master :
git show $(git rev-list f1..master | tail -1)~1 --pretty=%h
but we don't need to save it as we can now use rebase --onto command
so let's execute the third step that will contain the previous command to give to git the original commit to replay the commit from:

*git rebase --onto feature2 `git show $(git rev-list feature1..master | tail -1)~1 --pretty=%h` feature2-with-feature1-commits
You have now all the commits we wanted from feature1 cherry-picked into the new branch (going out from feature2 latest commit) without master commits and you can now integrate them into the feature2 branch by merging them (git checkout feature2; git merge --no-ff -;) or by fast forwarding the feature2 branch (git checkout feature2; git merge --ff-only -;)


text:
Q: Add date picker fragment inside fragment I am trying to create date picker dialog inside fragment.
Main Fragment:
public class DataFragment extends Fragment implements
DatePickerDialog.OnDateSetListener
{
private Button addNew;

@Override
public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {

    String date = String.format("%02d", dayOfMonth) + "/" + String.format("%02d", monthOfYear + 1) + "/" + String.format("%02d", year);
    Log.d("DTAG", "date: "+date);
    }
}

 @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
    View RootView = inflater.inflate(R.layout.fragment_data, container, false);
    addNew = RootView.findViewById(R.id.button_add);

    addNew.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {

            showDatePickerDialog(view);
        }
    });

    return RootView;
}

public void showDatePickerDialog(View v)
{
    DialogFragment newFragment = new DatePickerFragment();
    newFragment.show(getFragmentManager(), "datePicker");

}

}

DatePickerFragment:
public class DatePickerFragment extends DialogFragment {

private DatePickerDialog.OnDateSetListener mListener;
private Context context;

@Override
public void onAttach(Context context) {
    super.onAttach(context);
    this.context = context;

    try {
        mListener = (DatePickerDialog.OnDateSetListener) context;
    } catch (ClassCastException e) {
        throw new ClassCastException(context.toString() + " must implement OnDateSetListener");
    }
}

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {

    final Calendar c = Calendar.getInstance();
    int year = c.get(Calendar.YEAR);
    int month = c.get(Calendar.MONTH);
    int day = c.get(Calendar.DAY_OF_MONTH);

    // Create a new instance of DatePickerDialog and return it
   return new DatePickerDialog(context, mListener, year, month, day);
}

}
But I get an exception:
FATAL EXCEPTION: main
 Process: michlind.com.workcalendar, PID: 4951
 java.lang.ClassCastException: michlind.com.workcalendar.views.MainActivity@a20fbb7 must implement OnDateSetListener
     at michlind.com.workcalendar.views.DatePickerFragment.onAttach(DatePickerFragment.java:29)
     at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1220)
     at android.app.FragmentManagerImpl.addAddedFragments(FragmentManager.java:2415)
     at android.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2194)
     at android.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManager.java:2148)
     at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2049)
     at android.app.FragmentManagerImpl$1.run(FragmentManager.java:718)
     at android.os.Handler.handleCallback(Handler.java:789)
     at android.os.Handler.dispatchMessage(Handler.java:98)
     at android.os.Looper.loop(Looper.java:164)
     at android.app.ActivityThread.main(ActivityThread.java:6541)
     at java.lang.reflect.Method.invoke(Native Method)
     at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)

A: You are trying to pass data from one fragment to another via mListener but context  is representing your activity
hence the error in onAttach of second fragment

michlind.com.workcalendar.views.MainActivity@a20fbb7 must implement
  OnDateSetListener

because your MainActivity does not implement the OnDateSetListener
Solution : You need to implement callback mechanism where
DialogFragment -> sends date to MainActivity using interface callback
MainActivity -> sends data to fragment one using instance of fragment by invoking it's function with parameter as date

DatePickerFragment

*

*Create interface (will be implemented by activity) and initialize it in onAttach

*Send date values to mainactivity via callback

public class DatePickerFragment extends DialogFragment implements DatePickerDialog.OnDateSetListener{

    private DatePickerFragment.OnDateReceiveCallBack mListener;
    private Context context;

    public interface OnDateReceiveCallBack {
        public void onDateReceive(int dd ,int mm, int yy);
    }

    @Override
    public void onAttach(Context context) {
        super.onAttach(context);
        this.context = context;

        try {
            mListener = (DatePickerFragment.OnDateReceiveCallBack) context;
        } catch (ClassCastException e) {
            throw new ClassCastException(context.toString() + " must implement OnDateSetListener");
        }
    }

    @Override
    public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
        mListener.onDateReceive(dayOfMonth,monthOfYear,year);
    }

    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {

        final Calendar c = Calendar.getInstance();
        int year = c.get(Calendar.YEAR);
        int month = c.get(Calendar.MONTH);
        int day = c.get(Calendar.DAY_OF_MONTH);

        // Create a new instance of DatePickerDialog and return it
       return new DatePickerDialog(context, this, year, month, day);
    }

}

MainActivity

*

*Implement Interface callback

*Pass data to dataFragmentObject using functions

public class MainActivity ....implements DatePickerFragment.OnDateReceiveCallBack{

    // implement callback
    public void onDateReceive(int dd ,int mm, int yy){
        dataFragmentObject.displaydate(dd,mm,yy);
    }

}

DataFragment

*

*Create method to receive data and use it

public class DataFragment extends Fragment
{
    private Button addNew;

    public void displaydate(int year, int monthOfYear, int dayOfMonth) {

        String date = String.format("%02d", dayOfMonth) + "/" + String.format("%02d", monthOfYear + 1) + "/" + String.format("%02d", year);
        Log.d("DTAG", "date: "+date);
        }
    }

    //..code oncreateview

    public void showDatePickerDialog(View v)
    {
        DialogFragment newFragment = new DatePickerFragment();
        newFragment.show(getFragmentManager(), "datePicker");

    }

}

redpajama_set_name: RedPajamaStackExchange


text:
Q: stripe curl command line POST I am trying to use stripe curl to charge a test customer 10 USD, but it returns error that the amount is incorrect.
    curl https://api.stripe.com/v1/charges      \

   -u sk_test_qtxx1EuLIMqMwOmEw3NKxxxx:     \

   -d amount=10.00                          \

   -d currency=usd                          \

   -d card[number]=4242424242424242         \

   -d card[exp_month]=12                    \

   -d card[exp_year]=2019                   \

   -d card[cvc]=123

The error returned was:
{
  "error": {
    "type": "invalid_request_error",
    "message": "Invalid integer: 10.00",
    "param": "amount"
  }
}

I tried 10, it said: "Amount must be at least 50 cents".
I wonder if I missed any post variables, like some kind of tokens or keys.

A: As per the documentation, the amount parameter needs to be

A positive integer in the smallest currency unit

So for ten dollars, you need to pass 1000.


text:
Q: 'Contravariance has more mathematical structure in it whereas covariance is more geometrical and easy to understand.' Is it a serious claim? In Shastri's Basic Algebraic Topology Remark 1.8.8, the author wrotes that

The difference between covariance and contravariance is simply in the fact that covariance preserves the direction of the arrow whereas contravariance reverses it. However, in practice, it turns out that contravariance has more mathematical structure in it whereas covariance is more geometrical and easy to understand.

I am really curious as to why the author thinks that way. Unfortunately, he doesn't provide further justification of that. My question is:

*

*Is this a serious claim? (i.e. Is there a sense in which it is true?)

*If the answer to 1 is 'yes', what's the underlying reason for this phenomenon? (maybe there is a categorical justification?)

Though I am just a beginner in algebraic topology, answers from all levels are welcomed.

As Connor Malin comments below, every contravariant functor is a covariant functor from $\mathsf{C^{op}}$ to $\mathsf D$, so the two concepts are duals of each other, which further mystifies the claim.

A: Is it a serious claim? I claim this doesn't have a serious answer: It is opinion-based.
Remark 1.1.8 follows the definition of covariant and contravariant functors, thus it is certainly a statement about functors used in practice. There are other contexts where the words "covariant" and "contravariant" are used, for example in the context of (multi-)linear algebra; see Lutz Lehmann's comment and this question. I guess that most people (including physicists and engineers) who have heard these word associate it with tensors. But this context is irrelevant here.
Have a look at the contents of the book. It has 13 chapters, but one cannot say that contravariant functors (essentially cohomology functors) are overrepresented and provide more mathematical structure than covariant functors.
There are some nice things which you can do with cohomology, for example you can introduce the cup product and get the cohomology ring or define cohomology operations. But all that can be dualized, for example you can give homology a coring-structure. Many people have never heard about this concept, thus it may appear somewhat strange.
Contravariant functors are often representable ("Brown's representability theorem") which led to the fruitful concept of a spectrum. Another example is $K$-theory which arises via classifying vector bundles on spaces $X$; this gives a very important (generalized) cohomology theory. The construction is geometrical and easy to understand although it is contravariant.
This shows that many important concepts of algebraic topology are based (in a natural way) on contravariance. However, other things like homotopy groups are covariant.
I think we need on equal terms both co- and contravariance. The whole complex of duality, for example duality in manifolds, relies on both types.


text:
Q: Draw line automatically in jquery with the value of div tag. I created two div tags and inside it, I created a span and set value of that. I need to draw line between two tags automatically using the value of span. Is it possible?

1

2

   <canvas id="canvas" width="350" height="300"></canvas>

I need to draw lines between these two tags using the value 1 and 2.

A: Just do this:
$(".drline span").each(function(){
    if ($(this).html()==1){
      $(this).append('

 ');
    }
    if($(this).html()==2){
         $(this).append('

 ');
    }
});

DEMO


text:
Q: Red: *** Error: word has no value! when calling external library function I am following the example from the Red documentation here: http://static.red-lang.org/red-system-specs.html#section-14
This is my code:
Red []

#import [
   "SDL2.dll" cdecl [
       sdl_init: "SDL_Init" [
           flags [integer!]
           return: [integer!]
       ]
   ]
]

rc: sdl_init 0

When I execute this with the Red interpreter, I get the following error on the last line:
*** Error: word has no value!
*** Error: word has no value!

Compiling with red -c gives a more useful error:
*** Compilation Error: undefined word sdl_init
*** in file: %/C/temp/red/sdl.red
*** near: [sdl_init 0]

Obviously the sdl_init definied during the import of the library is out of scope by the time it gets to the last line.
How do you explain the example in the documentation then? If I initialize sdl_init to some arbitrary value prior to the import, it still retains the same value after the #import block.

A: Remember, you are reading the Red/System (The C-like language) spec, not the Red spec, so the #import must be done in Red/System.  A couple of notes:

*

*If you want to reference Red/System within Red there are a couple ways:

Make a separate SDL2.reds script with the imports,
Red/System []
sdl: context [
    #import [
       "SDL2.dll" cdecl [
           sdl_init: "SDL_Init" [
               flags [integer!]
               return: [integer!]
           ]
       ]
    ]
]
rc: sdl_init 0

To use it in Red, use #include %SDL2.reds in the script, and you can make a routine
#include %SDL2.reds
initialize: routine ["SDL Initialize" ][
    with sdl [sdl_init 0]
]

Or your can use the directives: #system-global [] or #system [] -  I don't know that this is a good idea for using #import, but you can call the SDL2.reds functions in it.
#include %SDL2.reds
#system [with sdl [sdl_init 0]]

*There is an SDL1 binding that already exists here.  There are dependencies from other bindings as well though.  I have a mirror of all those fossil bindings (updated a couple days ago).

A: The document you refer to is the Red/System specification and does not cover Red. You have actually written a Red/System program. (Apart from having used a Red[] header). It should perform as you expect, if you compile and run it.
If you want to access an external library from Red you need to use a routine!, a Red/System function that is called from Red. If you are only passing integer values between Red and the external function it is quite straight forward as integer values are automatically "marshalled" between Red and Red/System. (This is not the case with other datatypes).
A Red program that includes a routjne! needs to be compiled and cannot be run from the Red console at this stage. Once the Red compiler is self-hosted (Red 2.0), there should be a just-in-time compiler so you will be able to run such code in the Red console.


text:
Q: Django force Python3 I have a view in Django that i've written & it works only in Python3 as the library I am using isn't available in Python2.
In the terminal, I can run the same script python3 scriptname.py and it works, whereas python scriptname.py does not.
so when I run the app, the view fails, because it's trying to run it in Python2.
How do I force Django to try and run it in Python3?

A: In simple terms 'You Can't'. python/python3 is just an executable(located somewhere in your filesystem), you can access it just by typing python/python3 because the location of the executable has been added to PATH variable of your system. So of course python and python3 points to different executable and django has nothing to do with it. If you must use python to run python3 you can add an alias in your .bashrc
alias python="python3"

with the side effect that all python cmds.. would now be interpreted as python3 cmds..
on other hand you can create a custom alias to run django app with python3
alias dserve="python3 manage.py runserver"


text:
Q: What is () => operator? I came across this ajax call. It works perfectly fine:
$.ajax({
    url: '/items/' + item.id,
    method: 'PUT',
    data: {item: item},
    success: () => {
        this.updateItems(item);
    }
});

I did not get what () => means. I used success: function(){ } but then it gives me an error

"updateItems is not a function"

A: The construct is called an arrow function. It has been introduced with the ES2015 standard and works similar the the function() {} syntax.
For more infos, check the MDN docs.
Note that this syntax is not yet supported by all browsers, especially older versions, so you should look into transpiling it into ES5 compliant JavaScript.

The reason why your attempt to transform it into a classic function() {} fails is that classic functions define their own this value, while arrow functions use the this value of the surrounding function. This is why this.updateItems cannot be found anymore.
To resolve this, bind the function context manually:
$.ajax({
    url: '/items/' + item.id,
    method: 'PUT',
    data: {item: item},
    success: function() {
        this.updateItems(item);
    }.bind(this)
});

A: It's an Arrow Function, and is like an anonymous function that also binds this.  When you switched it to a function(), the this was bound to something else, hence the error.
Edit:
If you still want to use a more traditional syntax, then use:
function(){/*...*/}.bind(this)

Which will ensure you're bound to the correct object.


text:
Q: Change form language with WtForm and Flask? Sorry for being a newbie but I am having troubles changing the language for a form. I am trying out Flask with wtform but I cant change the text for name, email, etc to my native language.
class ContactForm(Form):
name = StringField("Name", [validators.Required("Skriv in ditt namn")])
email = StringField("Email", [validators.Required("Skriv inepostadress"), validators.Email("Är det verkligen din epostadress?")])
subject = StringField("Subject")
message = TextAreaField("Message", [validators.Required("Skriv in ett meddelande")])
recaptcha = RecaptchaField()
submit = SubmitField("Send")

How do I change the language so that I can use swedish chars "ÅÄÖ"? For example I want to change the value StringField("Name") to StringField("Nåme")

A: To use special characters in your source code it is always a good idea to have:
# -*- coding: utf8 -*-
At the top of the file. This will allow Python to read the file correctly.
In your case you need to append a u to the start of your string. This marks the string as Unicode u"Är det verkligen din epostadress?"
This should only be needed in Python 2. In Python 3 strings are unicode by default.


text:
Q: Custom Save button in asp.net my question is simple, how do i create a custom save and update button for records entered in a detail view. I dont want to use the ones given. thanks a lot.

A: You have a couple of options. One is the OnItemCommand and you'll roll your own commands.
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.detailsview.itemcommand.aspx
The easier way is to use the OnItemInserted and OnItemUpdating events. Just send the Insert or Update commands instead as appropriate and you can use easier EventArgs
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.detailsview.iteminserting.aspx
<http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.detailsview.itemupdating.aspx
From these pages, basically what you'll do is capture a command from a button in your DetailsView.
Custom "Add" commamnd with ItemCommand
Sub CustomerDetailView_ItemCommand(ByVal sender As Object, ByVal e As DetailsViewCommandEventArgs)

    ' Use the CommandName property to determine which button
    ' was clicked.
    If e.CommandName = "Add" Then
        ' Do your work here if Add Contact is clicked
    End If
End Sub

Easier built in Insert command with ItemInserting
Sub CustomerDetailView_ItemInserting((ByVal sender As Object, ByVal e As DetailsViewInsertEventArgs)
    ' Access the actual rows with
    Some variable1 = e.Values("CustomerID")
    Some variable2 = e.Values("CompanyName")
    Some variable3 = e.Values("City")

    ' Do something with them
End Sub

Code front
<asp:DetailsView ID="CustomerDetailView"
    DataSourceID="DetailsViewSource"
    AutoGenerateRows="false"
    DataKeyNames="CustomerID"
    AllowPaging="true"
    OnItemCommand="CustomerDetailView_ItemCommand"
    OnItemInserting="CustomerDetailView_ItemInserting"
    OnItemUpdating="CustomerDetailView_ItemUpdating"
    runat="server">
    <FieldHeaderStyle BackColor="Navy" ForeColor="White" />
    <Fields>
        <asp:BoundField DataField="CustomerID" HeaderText="Store ID" />
        <asp:BoundField DataField="CompanyName" HeaderText="Store Name" />
        <asp:BoundField DataField="City" HeaderText="City" />
        <asp:TemplateField HeaderText="Name">
            <InsertItemTemplate>
                <asp:Button ID="btAddContact" runat="server" Text="Add Contact" CommandName="Add" />
                            Or
                <asp:Button ID="btAddContact" runat="server" Text="Add Contact" CommandName="Insert" />
            </InsertItemTemplate>
            <EditItemTemplate>
                <asp:Button ID="btAddContact" runat="server" Text="Save Contact" CommandName="Update" />
            </EditItemTemplate>
        </asp:TemplateField>
    </Fields>
</asp:DetailsView>

A: You can use any button that implements the IButtonControl interface. The key is to set the CommandName correctly. Hopefully this will give you the freedom to style your button the way you need to.
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.button.commandname.aspx
You can find a list of the relevant command names here:
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.listview.itemcommand.aspx
<asp:ImageButton runat="server" ... CommandName="Save" />
<asp:LinkButton runat="server" ... CommandName="Update" />


text:
Q: Angular - HTML - pass selected value from drop down to TS method on button click The issue I'm having is that I'm unable to access the .value and .id in {{selectItem}} to send them back to the typescript for a HTTP post later on. While there is no actual error I have exceptions and have googled to resolve yet to no avail.
Exception thrown: 'System.IO.IOException' in System.Net.Sockets.dll
Exception thrown: 'System.IO.IOException' in System.Private.CoreLib.dll
Exception thrown: 'System.Threading.Tasks.TaskCanceledException' in System.Net.Http.dll
Exception thrown: 'System.Threading.Tasks.TaskCanceledException' in System.Private.CoreLib.dll
Exception thrown: 'System.Threading.Tasks.TaskCanceledException' in System.Private.CoreLib.dll
I understand that {{selectedItem | json}} just places the selected item into JSON form but I want to simply pass the .id and .values back to a method on a button click. Struggling for about a week. Any guidance appreciated.
<div div class="main-search-user-name">
        <mat-form-field>
          <mat-label>Search Select User</mat-label>
          <mat-select [(ngModel)]="selectedItem">
            <mat-option *ngFor="let getddusers of getusers" [id]="getddusers.id" [value]="getddusers.value">
              {{getddusers.id}} {{getddusers.value}}
            </mat-option>
          </mat-select>
        </mat-form-field>
        {{selectedItem | json}}
        <button type="button" class="btn btn-primary btn-sm">Search</button>
        <button type="button" class="btn btn-primary btn-sm" (click)="displayName('{{getddusers.id}}' + '{{getddusers.value}}')">Search</button>
</div>

A: You can use selectedItem variable in component's displayName() method. Since you are using selectedItem in ngModel, It'll be updated in component
i.e
//app.component.ts

export class AppComponent {
  selectedItem: any= null;

  displayName(){
     //you can use selectedItem here
    console.log("Selected user"+ this.selectedItem.id);
  }

}

A: You would need to change the property binding from [value]="getddusers.value" to [value]="getddusers".
Doing so will ensure that selectedItem represents the entire object, and you can then simply use this.selectedItem.id and this.selectedItem.value within displayName() in your Component ts file.


text:
Q: Using $in clause for insensitive search in mongo db driver c# I am wondering how to use the case insensitive for $in expressions.
According to the official MongoDB manual you can do this:
{ name: { $in: [ /^acme/i, /^ack/ ] } }

I tested out this on Compass and it's working fine, search is insensitive.
I need to this using the Mongo Driver in C#.
I am doing this:
  var array = new BsonArray(companyNames);

  var filter = new BsonDocument { { "Name", new BsonDocument { { "$in", new BsonArray(array) }} } };
  var result = _collection.Find(filter).ToList();

companyNames is a string[]
However this retrieves me only exact matches. It's kind of obvious because I am not including the "regex" expression. But I don't know how I am able to include the regex in a string.
The workaround is to create an $or expresion with regex for every company name.
Does anyone knows how to do this?
Thanks

A: With mongo-csharp-driver, you can utilise MongoDB.Bson.BsonRegularExpression. You can either perform:
var arrayIn = new BsonArray().Add(
                      new BsonRegularExpression("^acme", "i")
                  ).Add(
                      new BsonRegularExpression("^ack"));
var filter = new BsonDocument { { "name", new BsonDocument { { "$in", arrayIn }} } };
var cursor = collection.Find(filter).ToList();

Or alternatively, instead of string use Regex and RegexOptions:
var arrayIn = new BsonArray().Add(
                      new BsonRegularExpression(
                          new Regex(
                              "^acme", RegexOptions.IgnoreCase))
                  ).Add(new BsonRegularExpression(
                              "^ack"));

A: here's an elegant solution using a text index on the company name field.
using MongoDB.Entities;

namespace StackOverflow
{
    class Program
    {
        public class Company : Entity
        {
            public string Name { get; set; }
        }

        static void Main(string[] args)
        {
            new DB("test");

            DB.Index<Company>()
              .Key(c => c.Name, KeyType.Text)
              .Option(o => o.Background = false)
              .Create();

            var c1 = new Company { Name = "Ackme" };
            var c2 = new Company { Name = "Acme" };
            var c3 = new Company { Name = "Lackme" };
            var c4 = new Company { Name = "Hackme" };

            c1.Save(); c2.Save(); c3.Save(); c4.Save();

            var names = new[] { "ackme", "acme" };

            var result = DB.SearchText<Company>(string.Join(" ", names));
        }
    }
}

mind you, the above uses the convenience library MongoDB.Entities. however the concepts are the same but the syntax for the official driver is cumbersome compared to the above.

A: My solution was an overloaded .In() as an extension method, taking an extra parameter for case-insensitivity:
public static class MongoExtensions
{
    public static FilterDefinition<TDocument> In<TDocument>(
        this FilterDefinitionBuilder<TDocument> builder,
        Expression<Func<TDocument, object>> expr,
        IEnumerable<string> values,
        bool ignoreCase)
    {
        if (!ignoreCase)
        {
            return builder.In(expr, values);
        }

        var filters = values
            .Select(v => builder.Regex(expr, new BsonRegularExpression($"^{Regex.Escape(v)}$", "i")));

        return builder.Or(filters);
    }
}

Then you can simply:
var filter = Builders<Companies>.Filter.In(c => c.Name, companyNames, true);
var result = _collection.Find(filter).ToList();


text:
Q: Unable to stop an input field from auto-populating I'm running into a strange issue with a simple input field rendered through the material-ui library (called TextField in the library). I'm somehow unable to prevent it from auto-populating even upon page refresh! Here's the component props:
<TextField
      {...{
        id: 'emailField',
        placeholder,
        error,
        type,
        fullWidth,
        disabled,
        required,
        variant: 'outlined',
        className: classes.margin,
        label: 'Email',
        name,
        helperText,
        ...(value && { value }),
      }}
      autoComplete='off'
      InputProps={{
        startAdornment: <InputAdornment position="start"><EmailIcon /></InputAdornment>,
      }}
    />

And this is the HTML it renders:
<input aria-invalid="false" aria-describedby="emailField-helper-text" autocomplete="off" class="MuiInputBase-input MuiOutlinedInput-input MuiInputBase-inputAdornedStart MuiOutlinedInput-inputAdornedStart" id="emailField" name="userid" placeholder=""john@doe.com" or "johndoe123"" required="" type="text" value="">

If you notice, it does render with the autocomplete="off" attribute as expected. However, it still doesn't stop the field from getting pre-populated with a value I had used before even after the page is refreshed. FWIW, am using Chrome and this does not happen when I load the page in incognito mode.
The page is live at https://www.schandillia.com.


text:
Q: What do you call a person who loses interest after achieving something? I know about the term butterfly, but I am looking for something a little different.
What do you call a person that is greatly motivated to achieve a goal, but loses interest the second after that goal is achieved?
The difference to the butterfly example metioned above would be the provided achievement of said person.
It would also be great if anyone could mention a literary reference to such a character.

A: The informal words fickle and chaser have the intended meaning; although, they are both used in relationships mainly.

fickle: Where you want someone so bad and "chase" them and once they like you back you don't like them anymore - Urbandictionary

chaser: someone who is interested in someone but as soon as that person returns the feelings they dont have feelings for them anymore. ie. only interested when the other person isn't. - Urbandictionary

This topic can be discussed in the context of psychology also. For example, there is a psychological term called anticipatory joy, which means "anticipation of a desired outcome makes us feel good" (and even better than the actual outcome).

The anticipatory joy is depicted through the eyes of a character in an aria in the book "A Psychological Perspective on Joy and Emotional Fulfillment" By Chris Meadows:

An example of anticipatory joy is found in the memorable aria "One Fine Day" in Giacomo Puccini's Madama Butterfly. This scene gives us a lyrical description of the yearning and anticipatory joy arising in a classic reunion between lovers. Lieutenant Pinkerton has engaged Butterfly as his geisha and is to stay with her before returning to his homeland to obtain an American wife. Butterfly images his return:
One fine day, we'll notice a thread of smoke arising on the sea in the far horizon, and then the ship's appearing. Then the trim white vessel glides into the harbor, thunders forth her cannon.
Butterfly waits a long time on the crest of the hill but does not weary of waiting. The emotional anticipation of the reunion builds to a crescendo at their finally coming together. She sights him. The power of her first reuniting with him is apparent as the aria intensifies: "Do you see him? He is coming. . . . There is coming a man!" At first he is speck in the distance. Then she asks a question to which she knows the answer: "Who is it?" It is him! From the summit of the hill he calls to her, "Butterfly! Butterfly!" But she does not answer, concealing herself, partly to tease him, and partly to keep herself from dying with ecstasy, to keep herself from bursting with joy. He calls out to her his little pet names, signs of their intimacy in the past, "Dear baby-wife of mine, dear little orange blossom." They come together! In her fantasy, the joy of reunion is complete!

A: How about a "flighty Renaissance man or woman."
In other words, a person who can do many things well, but who flits from one completed project to another, having lost interest in what was just achieved but eager to try something novel and hence to him or her, exciting.
Then there are the following:

*

*a flighty generalist.

*a person with a high threshold for achievement, but a low threshold for boredom. (I kind of like this one.)

*a serial (or compulsive) goal setter and achiever.

*an overachiever

*a new-goal-oriented person

*a serial implementer (Not bad.)

*a serial visionary

*a compulsive doer

*an accomplished manic-depressive

*fruition boredom (I really like this one!)

Take your pick, but let me know if any one (or more) tickles your fancy.


text:
Q: mysql - joining tables together in one single query Merry Xmas. Can anyone help me to come up with the query for this particular scenario: ~I need to produce a list of Activities showing the number of Children of each gender registered for each activity. What would be the query?
Thank you.
TABLE STRUCTURE AS FOLLOWS: There is ACTIVITY, CHILD, CHILD ACTIVITY TABLE.
ACTIVITY TABLE
( activity_id[Primary Key],
  Activity)

CHILD TABLE
( child_id[Primary Key],
  child_name,
  child_gender,
  child_dob)

CHILD ACTIVITY TABLE
( activity_id[Composite Primary Key],
  child_id[Composite Primary Key]
  Activity/Day Of Week)

A: SELECT a.activity_id, a.Activity, c.child_gender, COUNT(*)
FROM ACTIVITY a
 JOIN [CHILD ACTIVITY] ca ON a.activity_id = ca.activity_id
 JOIN CHILD c ON ca.child_id = c.child_id
GROUP BY a.activity_id, a.Activity, c.child_gender


text:
Q: AutomationElement.FromHandle() execution time is intermittently slow I am working on UI test automation and have noticed that usually AutomationElement.FromHandle is quite fast, but occasionally it takes 30 seconds to return an AutomationElement.  From my limited logging it either takes less than 100ms or a full 30 seconds to get an AutomationElement back.  Has anyone else seen this type of issue?
I admit that I have not done much investigation on the repeat-ability of this issue, so I don't know if there is potentially a performance issue with a control class in the application under test.

A: Don't know if this will help, but: when you use FromHandle, behind the scenes, UIAutomation is sending a WM_GETOBJECT message to the target window, using SendMessageTimeout or similar. If the target UI is frozen or busy doing something else, SendMessageTimeout will block until the timeout happens; this could be one cause of an intermittent block. You could check if this is the cause by also using SendMessageTimeout to send WM_NULL to the same HWND to 'ping' it, and if that also blocks, then you know that the problem is that the target UI is busy/hung then.


text: Q: running multiple windows of powershell with different commands in one script I am pretty new to this and I am trying to learn how to write a script that allows me to open multiple powershell windows and have each one run its own command. I haven't been able to figure out the answer to this question anywhere. I am open to suggestions and happy to learn from you guys. Cheers


text:
Q: Django absolute link appending link content I've been building a site in Django, and I have URLconf in an app on the site to handle several URLs namespaced under "films" set up as such:
urlpatterns = [
url(r'^$', views.index, name='index'),
url(r'^(?P<film_id>[0-9]+)/$', views.detail, name='details'),
url(r'^(?P<film_id>[0-9]+)/rate/(?P<rating_value>[0-9]+)/$', views.rate,name='rate'),
]

The URLs are namespaced here:
urlpatterns = [
url(r'^films/', include('poll_test.urls', namespace='films', app_name='poll_test')),
url(r'^admin/', include(admin.site.urls)),
]

Index itself, along with the other pages, function as they should, and can be accessed correctly through the URL bar. The problem arises when I attempt to link between pages in the site. In rate.html (which is linked to the view "rate"), I have:

The link shows up, but when I attempt to use the link, the page refreshes, changing the URL from  http://127.0.0.1:8000/films/2 to  http://127.0.0.1:8000/films/2/#/films/
It seems to append a # along with the URL I'm attempting to reach from the base url, but, from there, I haven't the slightest idea what's going wrong.
Edit:
It seems that mobile jQuery script that I was importing was causing the issue:

Removing the script import solved the issue.


text:
Q: Perl- Reading sorted array elements into a hash with sorted keys so i have an array (say @array) with sorted values between 0 and 1, and also and a hash (say %hash) whose keys are sorted and are numbers between 0 and 1. the values for each key in the hash is  0. Now, I need to look at each element of @array, find the  key in %hash which  is immediately smaller than it, and increment the corresponding value by 1 . that is, the keys serve as a lowerbounds for intervals
if say
$array = (0.15,0.33,0.67,0.87)
and %hash = ("0.25", 0, "0.50", 0, "0.75", 0)

and I take $array[1] = 0.33
then, I need to be able to determine that $array[1] is greater than 0.25 BUT less than 0.5 and, thus, increment the value for "0.25" by 1 giving me an updated hash %hash = ("0.25", 1, "0.50", 0, "0.75", 0).
I hope this made sense! thanks in advance!!!

A: Hash does not store keys in sorted order. You must rethink your approach to the problem.

A: You're building a frequency distribution for intervals or ranges. CPAN has modules that will do that. If you can reformulate your problem to agree with how those modules understand frequency distributions, you'll be able to save yourself a little bit of trouble and gain access to other statistical tools that might be useful for your project. An example:
use Statistics::Descriptive;
my @data = (0.15, 0.33, 0.67, 0.87);
my @bins = (0.25, 0.50, 0.75, 1.00);
my $stat = Statistics::Descriptive::Full->new();
$stat->add_data(@data);
my $freq = $stat->frequency_distribution_ref(\@bins);

The distribution in $freq will be a hash reference like this:
$freq = {
  '0.25' => 1
  '0.5'  => 1,  # N of items x, such that PREVIOUS_BIN_VAL < x <= .50
  '0.75' => 1,
  '1'    => 1,
};

If you can't modify your problem, then you'll need to compute the distribution yourself, but you can take an important cue from Statistics::Descriptive. In particular, it will be helpful for you to have an ordered list of bin values. Here's an illustration:
my @data = (0.15, 0.33, 0.67, 0.87);
my @bins = (0.25, 0.50, 0.75);    # Include 0.0 if you want 0.15 to be tallied.
my %freq = map {$_ => 0} @bins;

for my $d (@data){
    for my $b (reverse @bins){
        do { $freq{$b} ++; last } if $d >= $b;
    }
}

A: As far as I understood, you want to keep track of how many items in $array are less than the key's in %hash
So for each key value in the hash, you can just retrieve all items from the array that are less then the key in a list and get the count of it. You can use grep for this
use strict;
use warnings;
use Data::Dumper;

my $array = [qw (0.15 0.33 0.67 0.87 1.5) ] ;
my %hash = (0.25 => 0, 0.50 => 0, 0.75 => 0, 0.05 => 0);

for my $k (keys %hash) {
        my @filtered =  grep { $_ < $k } @$array;
        $hash{$k} = @filtered;
        #$hash{$k} = @filtered ? 1 : 0 # if you just want a flag
}

print Dumper(\%hash);

A: If your hash keys are evenly spaced, like in your example, each can be calculated by a simple formula like $biggestSmaller = int(i*4)/4. If not, you need an auxiliary index like @keys = sort keys %hash - it could also be a binary tree, but this is trivial enough that a simple list ought to do (and if speed is not important, you could even be so lazy as to search bottom up, instead of implement binary search).


text:
Q: namespase в Symfony2 Здравствуйте. У меня следующий вопрос - есть ли возможность использовать в Symfony 2 use namespace для аннотаций?
Пример
namespace classes;
use OtherClass\Photo;

class Place
{
    /**
     * @ORM\OneToMany(targetEntity="Photo") // OtherClass\Photo;
     */
    private $photo;
}

Не работает.
Пишет что
The target-entity classes\Photo cannot be found in ....

Что я делаю не так?

A: В данных аннотациях вам стоит использовать полные имена классов сущностей, т.к.

*

*это универсально

*никогда не спутается с другим классом

*

*при рефакторинге вам будет проще искать такие классы


text:
Q: ajax-solr: How to make an ajax page readable by Google? I am using ajax-solr to generate search results from Solr.
Is there any way to make such an ajax page available to Google (and search engines in general) for indexing?
Thanks.

A: Not sure how this maps to ajax-solr specifically, but take a look at "Making AJAX Applications Crawlable", it explains how googlebot can crawl and index ajax websites.
Still, I think the safest way is to implement graceful degradation of ajax functions, unfortunately I don't think this is doable in a pure ajax-solr site.

A: I think the easiest solution is to use Google Sitemaps and create alternative representations of the Solr database's contents (i.e. have one URL for each document in the Solr database). In other words, don't try to make make the ajax-solr page indexable by Google.


text:
Q: Execute code when item pressed in NavDrawer I am using a Navigation Drawer with a NavController, which means I define the navigation to other fragments in my nav_graph file. The navigation drawer has 3 items (To-do, profile and logout), the first two items (To-Do and profile) change the current fragment (and this works fine) but the third item (logout) should execute some code by calling a function, but with navController I can only change fragments, if I implement the OnNavigationOnItemSelectedListner, it disables the navController functionality (fragments won't change unless I write the code to do so in the listener). Is there a way to implement the code for logout item without disabling the NavController?
This is part of the code I am Using
Activity
appBarConfiguration = AppBarConfiguration(setOf(R.id.nav_todo, R.id.nav_profile), drawerLayout)
        setupActionBarWithNavController(navController, appBarConfiguration)
        navView.setupWithNavController(navController)

nav_graph.xml
<?xml version="1.0" encoding="utf-8"?>
<navigation 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:id="@+id/nav_graph"
    app:startDestination="@id/nav_todo">
    <fragment
        android:id="@+id/nav_todo"
        android:name="com.lepe.helloandroidkotlin.ToDoFragment"
        android:label="To - Do"
        tools:layout="@layout/fragment_to_do"/>
    <fragment
        android:id="@+id/nav_profile"
        android:name="com.lepe.helloandroidkotlin.ProfileFragment"
        android:label="Profile"
        tools:layout="@layout/fragment_profile"/>

</navigation>

Thanks

A: I managed to solve this problem by adding a listener just to the Log Out item of the Navigation Drawer. To do so, I get an instance of the Nav Drawer Menu then I find the Item I want to listen to and add the listener.
In this case, just to test, I finish the activity.
val menu: Menu = navView.getMenu()
        val menuItem = menu.findItem(R.id.nav_logout)
        menuItem.setOnMenuItemClickListener {
            this.finish()
            true
        }


text:
Q: GET-POINTER-VALUE - Unix behaivor? *How can I obtain a mem pointer with progress using GET-POINTER-VALUE....?
In Windows works fine:
DEFINE VARIABLE vUNO  AS MEMPTR.
DEFINE VARIABLE vDOS  AS MEMPTR.
DEFINE VARIABLE vTRES AS MEMPTR.
DEFINE VARIABLE sUNO  AS CHARACTER.
DEFINE VARIABLE sDOS  AS CHARACTER.
DEFINE VARIABLE sTRES AS CHARACTER.
DEFINE VARIABLE rUno  AS MEMPTR.
/*Para prueba, poner algo a UNO, DOS y TRES.*/
DEFINE VARIABLE PTR AS MEMPTR.
ASSIGN sUNO                 = "Uno"
       sDOS                 = "Dos"
       sTRES                = "Tres"

       SET-SIZE(vUNO  )     = LENGTH(sUNO ) * 2
       SET-SIZE(vDOS  )     = LENGTH(sDOS ) * 2
       SET-SIZE(vTRES )     = LENGTH(sTRES) * 2

       PUT-STRING(vUNO , 1) = sUNO
       PUT-STRING(vDOS , 1) = sDOS
       PUT-STRING(vTRES, 1) = sTRES.
SET-SIZE(PTR) =  4  /*Apuntador a vUNO  -> 1*/
               + 4  /*Apuntador a vDOS  -> 5*/
               + 4. /*Apuntador a vTRES -> 9*/
/*
  NOTA:
       4 porque en arquitcturas a 32 bits apuntadores miden 4 bytes.
       Checar en Unix porque Hp-Ux (de Axa) es a 64 bits (apuntadores a 8 bytes).
*/
/* [1] 2 3 4 [5] 6 7 8 [9] 10 11 12 */
MESSAGE PROGRAM-NAME(1) SKIP
    GET-STRING(vUNO,1 ) "/" GET-POINTER-VALUE(vUNO)  SKIP
    GET-STRING(vDOS,1 ) "/" GET-POINTER-VALUE(vDOS)  SKIP
    GET-STRING(vTRES,1) "/" GET-POINTER-VALUE(vTRES) SKIP
    VIEW-AS ALERT-BOX INFO BUTTONS OK.

/******************************************/
It returns:
---------------------------
Información
---------------------------
C:\GMM2000\Temp\p19350.cmp
Uno / 87066920
Dos / 85914720
Tres / 85914744
---------------------------
Aceptar
---------------------------

but with the same code Unix returns:
---------------------------
Información
---------------------------
/gmm2000/p13659.cmp
Uno / ?
Dos / ?
Tres / ?
---------------------------
Aceptar
---------------------------

Please HEEEEEELLLLPPPPP!!!!*

A: I just tried your code on 10.2B Linux.  It seems to work:
  ┌────────── Information ──────────┐
  │ /home/tom/p04012_Untitled1.ped  │
  │         Uno / 16817200          │
  │         Dos / 16992512          │
  │        Tres / 16992544          │
  │ ─────────────────────────────── │
  │              <OK>               │
  └─────────────────────────────────┘

Know that we know that you are running 64 bit Progress v9 on HPUX...
In a 64 bit environment GET-POINTER-VALUE() returns a 64 bit result.  But Progress v9 does not have an int64 data type.  Try assigning the result to a DECIMAL variable.  That should be able to hold the value.

A: The HP-UX 64bit AVM doesn't do 64bit pointers for some of the releases, as the external interfaces only do 32bits.I forget which version implemented full 64 bit pointers though - that would be a question to ask PSC TS.


text:
Q: How much energy was consumed when we turn on/off light? My parents told me to turn off the light when I am not using it. But I remember my physics teacher told me that the action of turning on/off a light can cause huge energy. I am wondering how much is that? Someone said the energy caused by this action are enough to keep the light on for 15 minutes.
If we require a configuration here, let's assume we use a T8 light tube, with 220V voltage from the house and 30W of the tube.

A: From an answer by  Steve Selkowitz of Lawrence Berkeley National Labs
(I'm quoting it in full here because the site has changed and I had to pull this from an old mailing list archive)

Fluorescent Lighting - Should I turn the lights off?
There have been two very resilient energy myths that have dissuaded
  people from turning off fluorescent lamps. These myths are hard to
  dispel because inside each myth is a kernel of fact.
Inrush myth: I don't turn off fluorescent lights because the inrush
  energy when I turn the lights on is more than the energy I saved by
  turning them off.
Inrush fact: When fluorescent fixtures are turned on there is a
  MOMENTARY inrush of current. This inrush is 5 times greater than
  normal operating current for magnetic ballasts and can be as high as
  40 times greater than normal operating current for electronic
  ballasts. This inrush lasts for 1/10th of a second or less. Thus the
  energy content of the inrush event is comparable 5 seconds or less of
  normal operation. Thus, turning off the lights for more than 5 seconds
  will save more energy than leaving them on even when including the
  inrush current.

A: First thing, it depends on the type of light used.
For an incandescent bulb, a bit of energy is used up while turning it on; but not much.
On the other hand, tubelights have inductors (choke coils) in them. These come into play when switching the tubelight on and off only. This is because inductors oppose change in current, when there is a steady current, they act like wires (or more accurately, like resistors). As they oppose change in current, they do absorb and emit energy.
When a tubelight is turned on, the choke absorbs some energy, whereas when you turn it off, the choke releases the same energy. There is almost no net energy transfer here (Energy "held" by an inductor's magnetic field is $\frac{1}{2}Li^2$). I say almost, as the heat lost through the inductor while the tubelight starts is a little bit different, and there are other small energy losses.
If we consider an "energy loss" as any energy used up during a period when no useful output (light) is given out by the tubelight, then at the time when the tubelight is starting, there is a small heat loss through the choke resistance. A smaller loss is there when the tubelight is turned off.
So really, I don't see where your value of 15 minutes came from. 15 seconds or 15 microseconds is more appropriate (the exact value would depend upon the parameters of the light, and what you interpret as an "energy loss").

A: It seems from what I have read on a couple of sites that the 15 minute recommendation refers mainly to CFLs. Incandescent light bulbs are very inefficient and you will always do best to turn them off. Same with halogen. However, with CFLs the bulbs life is shortened by the amount of times it is turned on and off. Therefore if you figure in the cost of replacing the bulb, that is where they come up with the recommendation of 15 minutes. LED's however are not affected by the amount of times it is turned on and off, so you can turn them off as much as you like.


text:
Q: XMLHttpRequest cannot load http://example.com/myapp/jsonurl/. No 'Access-Control-Allow-Origin' header is present on the requested resource $.ajax() request from html page in django project,it work with firefox but not working with chrome .i tried many things from google but not getting any result ,i waste my 2 day plz help
Error on chrome console :
XMLHttpRequest cannot load http://example.com/myapp/jsonurl/. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://www.example.com' is therefore not allowed access.
My code :
ajax code:
 $.ajax({
    url: "http://example.com/myapp/jsonurl/",
    dataType:"json",
    type:"GET",
    success: function(data){
      alert(data);
    },
    error: function(xhRequest, ErrorText, thrownError){
      alert(xhRequest+ ErrorText+thrownError);
    }
  });

url:
url(r'^jsonurl/', planViews.jsonurl,name='jsonurl'),

view:
def jsonurltest(request):
    context = RequestContext(request)

    return HttpResponse(json.dumps("{'jsondata':'ajax test'}"), content_type="application/json")

A: Two solutions:
Make sure you use the same name (www.example.com in both for example)
Or if you have to keep two different name, make sure the server serving the AJAX call add a header:
Access-Control-Allow-Origin: http://www.example.com>
More info about can be found on:
http://jquery-howto.blogspot.com/2013/09/jquery-cross-domain-ajax-request.html

A: finally i got solution there are two problem in my project
1:install https://github.com/ottoyiu/django-cors-headers
2: i used "@login_required" with my view when remove this work properly with chrom all browser


text:
Q: Joining 5 tables in Access 2010 So here's a challenge. I have a webpage that needs to show data from 5 different tables in a database. Here's the query:
'SELECT ORGANIZATIONS.ORG_NAME, ORG_SECTIONS.SectionName, ATTORNEYS.NAME, ATTORNEYS.LASTNAME, ATTORNEYS.EMAIL, ATTORNEYS.TEL, ATTY_TITLES.ATT_TITLE, FIRM_PRACTICE_GRPS.PRACTICE_GRP
         FROM (ORGANIZATIONS INNER JOIN (Org_Sec_Atty INNER JOIN ATTORNEYS ON Org_Sec_Atty.Atty_ID = ATTORNEYS.ATTY_ID) ON ORGANIZATIONS.ID = Org_Sec_Atty.OrgID) INNER JOIN ORG_SECTIONS ON Org_Sec_Atty.SecID = ORG_SECTIONS.ID
         WHERE ATTORNEYS.LASTNAME LIKE @LASTNAME;'

The 5 tables are Org_Sec_Atty, ORGANIZATIONS, ORG_SECTIONS, ATTORNEYS, ATTY_TITLES, and FIRM_PRACTICE_GRPS. First, I didn't come up with the table names, lol.
Second, ATTORNEYS is the table that has ATTY_ID, TITLE_ID, PRACTICE_GRP_ID, which is what I'm sure I need to join to FIRM_PRACTICE_GRPS and ATTY_TITLE, and then it needs to connect with the Org_Sec_Atty and ORG_SECTIONS table.
I already have a page where the three tables ATTORNEYS, Org_Sec_Atty, and ORG_SECTIONS are joined by the JOIN statement you see up there. I'm trying to figure out where the other INNER JOIN statements would go and in what order.
It seems like I need to replace "ATTORNEYS" in the "Org_Sec_Atty INNER JOIN ATTORNEYS" with the subordinate INNER JOIN statements, but, again, I'm not sure of the order. Is this possible?

A: You didn't specified foreign keys on last two tables. Change appropriately if necessary:
SELECT  ORGANIZATIONS.ORG_NAME ,
        ORG_SECTIONS.SectionName ,
        ATTORNEYS.NAME ,
        ATTORNEYS.LASTNAME ,
        ATTORNEYS.EMAIL ,
        ATTORNEYS.TEL ,
        ATTY_TITLES.ATT_TITLE ,
        FIRM_PRACTICE_GRPS.PRACTICE_GRP
FROM    (((( ORGANIZATIONS
          INNER JOIN Org_Sec_Atty ON ORGANIZATIONS.ID = Org_Sec_Atty.OrgID)
          INNER JOIN ATTORNEYS ON Org_Sec_Atty.Atty_ID = ATTORNEYS.ATTY_ID)
          INNER JOIN ORG_SECTIONS ON Org_Sec_Atty.SecID = ORG_SECTIONS.ID)
          INNER JOIN ATTY_TITLES ON ORG_SECTIONS.ATTY_ID = ATTY_TITLES.ID)
          INNER JOIN FIRM_PRACTICE_GRPS ON ATTY_TITLES.FIRM_ID = FIRM_PRACTICE_GRPS.ID

WHERE   ATTORNEYS.LASTNAME LIKE @LASTNAME;


text:
Q: DirectorySearcher FindAll SearchResultCollection Count throws COMException I've got some code that has been working fine for a long time to get someone logged in on my application:
private Employee Authenticate(string userName, string password) {
  DirectorySearcher search = new DirectorySearcher(_rootDirectory);
  search.Filter = "(&(objectClass=user)(SAMAccountName=" + userName + "))";
  try {
    SearchResultCollection results = search.FindAll();
    if (0 < results.Count) {
      // the rest of my code
      // that returns an employee
      // if the password matches
    }
  } catch (Exception err) {
    MessageBox.Show(err.Message, "ActiveDir.cs ADWrapper::AuthenticateUser Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
  }
  return null;
}

Lately, the code has been throwing a COMException as soon as I test the results.Count value (the SearchResultCollection is not null).
Microsoft's Documentation does not indicate that Count should be throwing any kind of exceptions.
When debugging my code, I can put the break point on the condition above, mouse over it, and see that the exception exists.

If I use F10 to let the debugger take me to the catch condition or wait a few seconds on the breakpoint, the results.Count variable becomes valid and contains an integer value.
I am guessing the FindAll method is executing in a thread, and that I am checking the results before the thread has completed.
Is there a way to tell when FindAll() has finished or have I just spotted some kind of new bug that happened as a result of an Active Directory update?

A: This is a debugger artifact.  Debug expressions are executed on a helper thread inside the process.  The fact that it is a different thread from the one that the code is executing on can have side-effects.  Obvious cases are, say, properties that use lock in their getter.
The not-so-obvious ones are anything that's COM related, like Active Directory. COM implements thread-safety for COM servers that are not thread-safe.  This can't work well on the debugger thread, the thread that created the server is frozen.  Plus anything else that can go wrong, like not having a proxy/stub required to marshal the call etcetera.
You don't have a real problem.

A: I found the exact behaviour as the OP. My problem was that my filter had an error - when this happens I get no error thrown by FindAll() but then trying to access .Count gives the error in the debugger...a few seconds later .Count returns zero.


text:
Q: Changing a melted table back into a table Titanic is a data set in R whose class is "table".
dim(Titanic) tells it is 4-dimensional.
Now, if I do
x <- Titanic
y <- melt(x)

y looks like a 2-dimensional data frame.
My question is, how can I change y back to x? The closest I could get was by
z <- table(y)

But then z is 5-dimensional.
Could anyone help me?

A: I couldn't find an existing function to do this.  But, after using dput to look at the output of reshape2::melt(Titanic) we can use parts of that and feed the correct pieces into reshape2::acast to "unmelt" the table:
library(reshape2)

unmelt_table <- function(melted_table, value.name = "value") {

  premelt_dimnames <- names(melted_table)[names(melted_table) != value.name]
  premelt_dimlabels <- sapply(premelt_dimnames, function(n)
    levels(getElement(melted_table, n))
  )
  formula_colnames <- rev(premelt_dimnames)
  recast_formula <- as.formula(paste0(". ~ ", paste(formula_colnames, collapse = " + ")))
  premelt_vec <- as.vector(acast(melted_table, recast_formula))
  structure(premelt_vec,
            .Dim = as.vector(sapply(premelt_dimlabels, length)),
            .Dimnames = premelt_dimlabels,
            class = "table")
}

To verify that it worked, just run this:
> identical(Titanic, unmelt_table(melt(Titanic)))
[1] TRUE

A: There is not much melted about the result of reshape2::melt(Titaninc). Compare with the result of as.data.frame(Titanic). The only difference is the name of 'numbers' column (value vs Freq).
By doing class(Titanic) and ?table you find out that the Titanic is type of data that comes out of the table() function. In the documentation you can also notice that there is xtabs, formula based interface to tabulation. In xtabs docs, formula argument says

... On the left hand side, one may optionally give a vector or a matrix of counts; in the latter case, the columns are interpreted as corresponding to the levels of a variable. This is useful if the data have already been tabulated, ...

Which leaves you with a simple
dt <- as.data.frame(Titanic)
xtabs( Freq ~ Class + Sex + Age + Survived, data = dt )

to reconstruct the table classed data, should you ever need it for some other package as input.
Tto add my two cents, working with a crosstab in a form of a simple two dimensional data.frame or better a tibble from tidyverse is much more advisable!


text:
Q: Duplicate a tab across multiple workbooks in google I'm hoping someone can help me with this?
I have multiple spreadsheets in a file all with a tab named after the week start date.
What i want to do is duplicate this tab in all the spreadsheets with one google script.
At present I have a macro linked button in each spreadsheet with the following code -
function NewWeek() {
  const sh = SpreadsheetApp.getActive();
  let ss = sh.duplicateActiveSheet();
  let name = ss.getRange("E4").getDisplayValue();

  ss.setName(name);
}

Is there a way for me to have this run across all spreadsheets without having to open them individually and run the macro?
Any help would be most appreciated.


text:
Q: Elastic Beanstalk gives error HTTP ERROR 503 on one app and not the other while both are deployed in the same exact way I have deployed my Docker image of a Flask app to AWS beanstalk but everytime the environment health becomes severe, with error:
ELB health is failing or not available for all instances.

I have tried to host a sample program of index.html and it worked fine so maybe something is wrong with the code. Please see the below code to help.
FlaskApp[app.py]
from flask import Flask, jsonify, request
from util import prediction

application = Flask(__name__)

@application.route('/predict', methods=['POST'])
def predict():
   data = request.get_json()
   try:
       sample = data['text']
   except KeyError:
       return jsonify({'error':'No text sent'})
   pred = prediction(sample)
   try:
       result = jsonify(pred)
   except TypeError as e:
       result = jsonify({'error': str(e)})
   return result

if __name__ == '__main__':
   application.run(host='0.0.0.0', debug= True)

Util.py
import nltk
import pandas as pd
from nltk import TweetTokenizer
import numpy as np
import nltk
from nltk.stem.wordnet import WordNetLemmatizer
from sklearn.feature_extraction.text import TfidfVectorizer
import csv
import pandas as pd
import time
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.linear_model import LogisticRegression
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.metrics import confusion_matrix, accuracy_score, classification_report
from nltk.tokenize import TweetTokenizer
from nltk.tag import pos_tag
import re
import string
from nltk.stem.wordnet import WordNetLemmatizer
from nltk.corpus import stopwords
import joblib
import warnings
warnings.filterwarnings("ignore")

# nltk.download('averaged_perceptron_tagger')
# nltk.download('wordnet')
# nltk.download('omw-1.4')
# nltk.download('stopwords')

token = TweetTokenizer()

def lemmatize_sentence(tokens):
    lemmatizer = WordNetLemmatizer()
    lemmatize_sentence = []
    for word, tag in pos_tag(tokens):
        if tag.startswith('NN'):
            pos = 'n'
        elif tag.startswith('VB'):
            pos = 'v'
        else:
            pos = 'a'
        lemmatize_sentence.append(lemmatizer.lemmatize(word, pos))
    return lemmatize_sentence
# print(' '.join(lemmatize_sentence(data[0][0])))

# Data cleaning, getting rid of words not needed for analysis.

stop_words = stopwords.words('english')

def cleaned(token):
    if token == 'u':
        return 'you'
    if token == 'r':
        return 'are'
    if token == 'some1':
        return 'someone'
    if token == 'yrs':
        return 'years'
    if token == 'hrs':
        return 'hours'
    if token == 'mins':
        return 'minutes'
    if token == 'secs':
        return 'seconds'
    if token == 'pls' or token == 'plz':
        return 'please'
    if token == '2morow':
        return 'tomorrow'
    if token == '2day':
        return 'today'
    if token == '4got' or token == '4gotten':
        return 'forget'
    if token == 'amp' or token == 'quot' or token == 'lt' or token == 'gt':
        return ''
    return token

# Noise removal from data, removing links, mentions and words with less than 3 length.

def remove_noise(tokens):
    cleaned_tokens = []
    for token, tag in pos_tag(tokens):
        # using non capturing groups ?:)// and eleminating the token if its a link.
        token = re.sub('http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+#]|[!*\(\),]|(?:%[0-9a-fA-F]))+', '', token)
        token = re.sub('[^a-zA-Z]', ' ', token)
        # eliminating token if its a mention
        token = re.sub("(@[A-Za-z0-9_]+)", "", token)
        if tag.startswith("NN"):
            pos = 'n'
        elif tag.startswith("VB"):
            pos = 'v'
        else:
            pos = 'a'

        lemmatizer = WordNetLemmatizer()
        token = lemmatizer.lemmatize(token, pos)

        cleaned_token = cleaned(token.lower())
        # Eliminating if the length of the token is less than 3, if its a punctuation or if it is a stopword.
        if cleaned_token not in string.punctuation and len(cleaned_token) > 2 and cleaned_token not in stop_words:
            cleaned_tokens.append(cleaned_token)
    return cleaned_tokens

with open ('Models/Sentimenttfpipe', 'rb') as f:
    loaded_pipeline = joblib.load(f)

def prediction(body):
    # loaded_pipeline = joblib.load('Api/Models/Sentimenttfpipe')
    text= []
    test = token.tokenize(body)
    test = remove_noise(test)
    text.append(" ".join(test))
    test = pd.DataFrame(text, columns=['text'])
    a = loaded_pipeline.predict(test['text'].values.astype('U'))
    final = []
    if a[0] == 0:
        final.append({'Label' : 'Relaxed'})
        return {'Label' : 'Relaxed'}

    if a[0] == 1:
        final.append({'Label' : 'Angry'})
        return {'Label' : 'Angry'}

    if a[0] == 2:
        final.append({'Label' : 'Fearful'})
        return {'Label' : 'Fearful'}

    if a[0] == 3:
        final.append({'Label' : 'Happy'})
        return {'Label' : 'Happy'}

    if a[0] == 4:
        final.append({'Label' : 'Sad'})
        return {'Label' : 'Sad'}

    if a[0] == 5:
        final.append({'Label' : 'Surprised'})
        return {'Label' : 'Surprised'}

if __name__ == '__main__':
    sen = "May the force be with you"
    a = prediction(sen)
    print(a)

Dockerfile
FROM python:3.10.8

WORKDIR /app

COPY ["requirements.txt", "./"]

RUN pip install -r requirements.txt

RUN python -c "import nltk; nltk.download('averaged_perceptron_tagger'); nltk.download('wordnet'); nltk.download('omw-1.4'); nltk.download('stopwords');"

COPY . .

EXPOSE 5000

ENTRYPOINT [ "gunicorn", "--bind=0.0.0.0:5000", "app:application" ]

docker-compose.yml
version: "3.7"

services:
  mlapp:
    container_name: Container
    image: mlapp
    ports:
      - "5000:5000"
    build:
      context: .
      dockerfile: Dockerfile

Requirement.txt
Flask>=2.2.2
joblib==1.2.0
nltk==3.7
numpy==1.21.6
pandas==1.5.1
regex==2022.10.31
requests==2.28.1
scikit-learn==1.1.3
gunicorn==20.1.0

A: I got it to work and all i had to do was delete the docker-compose.yml file.
I don't know how, but it works.


text:
Q: Sequelize method providing undefined I am new for sequelize and express js.
I need to get data from mysql. I have created table and data via sync method.
function getUserData() {
    user.findAll().then(users => {
        return users
    })
}

console.log(getUserData());

This is for getting user data. If i access this function, I am getting undefined error. I don't know why it's happened.
Please anyone help to fix this issue.

A: findAll(). returns the promise , so you can access the data like this :
function getUserData() {
    return user.findAll().then(users => { // <--- Need to add `return`
        return users
    }); // <---- Will return promise
}

getUserData().then(data => { console.log(data); }); // <--- So you can access the data this way


text:
Q: Failure probability in $3^{rd}$ attempt after 2 first failure attempt First, excuse me for my languish.
First i wase have to case sending message one times with failure probability $Q_1=1-P_1$ and successful probability $P_1=exp(-\theta)$,$\theta$ is real number.
Now I send two times so I have
$P_1$ and $Q_1$ also failure probability $Q_2$ on second attempt and successful probability $P_2$ on the second attempt in which
$P_1+Q_1+P_2+Q_2=1$.
So now I have only $P_1$ and $Q_1$, if someone can help me to find $Q_2$ and $P_2$ in which $Q_2$ failure on second attempt probability after failure in the first attempt.
The geometrical distrubution $P_2=P_1*(1-P_1)$ give me only $P_2$ but i need also $Q_2$ inwich $P_1+Q_1+P_2+Q_2=1$.
So if there is any distrubution or conditional probability to get this probability, the important thing is $P_1=exp(-\theta)$
Thank so much in advance.


text:
Q: Why it can not find the implicit? I have the following definition in the file Show.scala:
package com.example

trait Show[A] {
  def show(a: A): String
}

object Show {
  def apply[A](implicit sh: Show[A]): Show[A] = sh

  //def show[A](a:A)(implicit  sh: Show[A]) = sh.show(a)
  def show[A: Show](a: A) = Show[A].show(a)

  implicit class ShowOps[A: Show](a: A) {
    def show = Show[A].show(a)
  }

  implicit val intCanShow: Show[Int] =
    new Show[Int] {
      override def show(a: Int): String = s"int $a"
    }

}

and in the Main.scala:
package com.example

object Main extends App {

  println(Show.show(344))
  println(30.show)
}

The compiler complains:
[error] /home/developer/scala/show/src/main/scala/com/example/Main.scala:6:14: value show is not a member of Int
[error]   println(30.show)
[error]              ^
[error] one error found

What am I doing wrong?

A: In order to Main to find Show, you need to import Show._ in Main.scala
package com.example

object Main extends App {
  import Show._
  // Or import Show.ShowOps if you only want to use that implicit

  println(Show.show(344))
  println(30.show)
}

You can Try it
Here are the implicits rules to keep in mind (From Martin's book):
Here is the relevant rule for your particular case (I have highlighted the relevant parts):

Scope Rule: An inserted implicit conversion must be in scope as a
  single identifier, or be associated with the source or target type of
  the conversion. The Scala compiler will only consider implicit
  conversions that are in scope. To make an implicit conversion
  available, therefore, you must in some way bring it into scope.
  Moreover, with one exception, the implicit conversion must be in scope
  as a single identifier. The compiler will not insert a conversion of
  the form someVariable.convert. For example, it will not expand x + y
  to someVariable.convert(x) + y. If you want to make
  someVariable.convert available as an implicit, therefore, you would
  need to import it, which would make it available as a single
  identifier. Once imported, the compiler would be free to apply it as
  convert(x) + y. In fact, it is common for libraries to include a
  Preamble object including a number of useful implicit conversions.
  Code that uses the library can then do a single "import Preamble._" to
  access the library's implicit conversions

A: Try this one..
package com.example

import Show._ // add in order to access implicit..

object Main extends App {

  println(Show.show(344))
  println(30.show)
}


text:
Q: Using counter with nth type Is it possible to have a counter with nth-type something like this:
td:nth-of-type(counter(section)):before {
     content: "Date"counter(section);
     counter-increment: section;
}

Where counter is initialized as

#myTable  tr {
    border: 1px solid #ccc;
    counter-reset: section;counter-increment: section;
}

What I'm trying to do is this - check if tr has class iR and if it does, the structure looks like this:
table.myTable td:nth-of-type(1):before { content: "Date"; }
table.myTable td:nth-of-type(2):before { content: "Fajr"; }
table.myTable td:nth-of-type(3):before { content: "Fr"; }
table.myTable td :nth-of-type(4):before { content: "Se"; }
table.myTable td:nth-of-type(5):before { content: "Dr"; }
table.myTable td:nth-of-type(6):before { content: " "; }
table.myTable td:nth-of-type(7):before { content: "A"; }
table.myTable td:nth-of-type(8):before { content: " "; }
table.myTable td:nth-of-type(9):before { content: "Mb"; }
table.myTable td:nth-of-type(10):before { content: " "; }
table.myTable td:nth-of-type(11):before { content: "I"; }
table.myTable td:nth-of-type(12):before { content: ""; }

If not it will be like this
table.myTable td:nth-of-type(1):before { content: "Date"; }
table.myTable td:nth-of-type(2):before { content: "Fr"; }
table.myTable td :nth-of-type(3):before { content: "Se"; }
table.myTable td:nth-of-type(4):before { content: "Dr"; }
table.myTable td:nth-of-type(5):before { content: "A"; }
table.myTable td:nth-of-type(6):before { content: "Mb"; }
table.myTable td:nth-of-type(7):before { content: "I"; }

Here is jsfiddle what Im trying to do
https://jsfiddle.net/wj5gnafm/1/

A: Based on the fiddle that is now provided in question, you don't even need a counter. You should be able to achieve this just by using the class and negation selectors that I had mentioned in my original answer. Below is a sample snippet.

td {
  border: 1px solid;
}
table tr.iRow td:nth-of-type(1):before {
  content: 'Date ';
}
table tr.iRow td:nth-of-type(2):before {
  content: 'Fr ';
}
table tr.iRow td:nth-of-type(3):before {
  content: '';
}
table tr.iRow td:nth-of-type(4):before {
  content: 'Se ';
}
table tr.iRow td:nth-of-type(5):before {
  content: 'Dr ';
}
table tr.iRow td:nth-of-type(6):before {
  content: '';
}
table tr.iRow td:nth-of-type(7):before {
  content: 'A ';
}
table tr.iRow td:nth-of-type(8):before {
  content: '';
}
table tr.iRow td:nth-of-type(9):before {
  content: 'Mb ';
}
table tr.iRow td:nth-of-type(10):before {
  content: '';
}
table tr.iRow td:nth-of-type(11):before {
  content: 'I ';
}
table tr.iRow td:nth-of-type(12):before {
  content: '';
}
table tr:not(.iRow) td:nth-of-type(1):before {
  content: 'Date ';
}
table tr:not(.iRow) td:nth-of-type(2):before {
  content: 'Fr ';
}
table tr:not(.iRow) td:nth-of-type(3):before {
  content: 'Se ';
}
table tr:not(.iRow) td:nth-of-type(4):before {
  content: 'Dr ';
}
table tr:not(.iRow) td:nth-of-type(5):before {
  content: 'A ';
}
table tr:not(.iRow) td:nth-of-type(6):before {
  content: 'Mb ';
}
table tr:not(.iRow) td:nth-of-type(7):before {
  content: 'I ';
}

    A
    B
    C
    D
    E
    F
    G
    H
    I
    J
    K
    L

    A
    B
    C
    D
    E
    E
    E

Answer for original question:
As I had mentioned in my comment to the question, you cannot pass the counter's value as argument to the nth-of-type (or any other nth-*) selectors.
You can achieve your expected output by doing the counter-increment only when the required class is present (by using class selector) and use :not([classname]) to increment the other counter.
While displaying the value, make use of either the class or the  class-negation in the selector and then display the value as required. Below is a sample snippet.

table {
  counter-reset: section, section-other;
}
table, tr, td {
  border: 1px solid;
}
table tr.iRow {
  counter-increment: section;
  background: sandybrown; /* just for distinction */
}
table .iRow td:nth-of-type(1):before {
  content: "Foo." counter(section)" ";
}
table .iRow td:nth-of-type(2):before {
  content: "Bar." counter(section)" ";
}
table .iRow td:nth-of-type(3):before {
  content: "Baz." counter(section)" ";
}
table tr:not(.iRow) {
  counter-increment: section-other;
  background: wheat; /* just for distinction */
}
table tr:not(.iRow) td:nth-of-type(1):before {
  content: "ooF." counter(section-other)" ";
}
table tr:not(.iRow) td:nth-of-type(2):before {
  content: "raB." counter(section-other)" ";
}
table tr:not(.iRow) td:nth-of-type(3):before {
  content: "zaB." counter(section-other)" ";
}

    A	B	C

    A	B	C

    A	B	C

    A	B	C

    A	B	C

    A	B	C

    A	B	C

    A	B	C


text:
Q: Symfony2 : how to check if a file input is empty I am making a form to edit an entity where the user can upload a file. When he make some edits, I want to check if he uploaded another file to know if I have to delete the other. I can't find how to know if the input file is empty or not. How can I do this?

A: public function upload()
{
    if (null === $this->file) {
      // this is the condition where you can get to know that the value of
      // input field is null or not
    }

    // if there is an error when moving the file, an exception will
    // be automatically thrown by move(). This will properly prevent
    // the entity from being persisted to the database on error
    $this->file->move($this->getUploadRootDir(), $this->path);

    unset($this->file);
}

Check the symfony documentation


text:
Q: Does Set.remove may return false if element exists? Consider the following example:
public Optional<User> getUser(Integer id) {
    for(User user : usersSet) {
        if(user.getId().equals(id)) return Optional.of(user);
    }
    return Optional.empty();
}

public void deleteUser(Integer id) {
    User user = getUser(id).orElseThrow(new RuntimeException("User not found"));
    boolean result = usersSet.remove(user);
}

Is there any case in which the result is false?
I ask because I don´t know if it´s necessary to check the result of the remove method of an HashSet.

A: No. There is no way that you can get a false if the element exist.
If you look at the docs, it's clearly mentioned.

true if this set contained the specified element

A: usersSet is probably a java.util.Set instance.
Set relies on equals() method for add/removal operations.
So boolean result = usersSet.remove(user); will return true only if equals() of  User class is overrided by using the same criteria as the getUser() method. For example to simplify  : return user.getId().equals(id);

A: YES.
In your case result can be false because your users object and userSet both are different. Moreover it depends on the way you have implemented equal() method for User class


text:
Q: Connect third party vue component to vuex Is there a way to connect the complex v-model object to Vuex for a third-party Vue component?
My problem: I want to use this calendar component as a data range selector but I need to connect it to Vuex. The v-model object is complex. I care only about the start and end date: "dateRange":{"start":"2021-3-16","end":"2021-3-26"}
{"currentDate":"[native Date Thu Feb 04 2021 21:06:21 GMT+0100 (Central European Standard Time)]","selectedDate":false,"selectedDateTime":false,"selectedHour":"00","selectedMinute":"00","selectedDatesItem":"","selectedDates":[],"dateRange":{"start":"2021-3-16","end":"2021-3-26"},"multipleDateRange":[]}

A: You do have a working example here: https://codesandbox.io/s/populate-vuex-with-vue-functional-calendar-5wj9m?file=/src/App.vue
Essentially, we:

*

*wait for an input on the calendar

*check if we have selected the end (and therefore the start) of the dateRange

*call a vuex action to populate the state

*you can see the state above the calendar

Since the code is not so big, here it is
<template>

range object in vuex: {{ $store.state.range }}

    <functional-calendar @input="populateIfDoneSelecting" is-date-range></functional-calendar>

</template>


text:
Q: Divide div into rows by percent, in a way that works for IE/Edge? I have a fluid-layout page with a center image and two sidebars. Each of the sidebars is divided into two rows. These rows have their height defined as a percentage of their containing column...
...except in Internet Explorer and Edge, where their height is defined by their content.
My current setup requires that the rows have a display type of inline-table, which I know has not historically been supported by IE. IE 11 and Edge are supposed to support inline-table, but they do not appear to interpret it the same as other browsers.
What approach can I use so that Microsoft's browsers will give me the results I am getting from everything else?
<!DOCTYPE HTML>

    (navbar goes here)

row a

row b

row c

row d

https://jsfiddle.net/fkvnpk0b/2/

A: Might I suggest using Viewport Units here?
http://caniuse.com/#feat=viewport-units
vh is well supported down to IE9; the partial support refers directly to vmin in particular.
Anyway, you'd want to change the heights of .row and .a and .b to use vh units instead of %. This will fill the viewport height on page load.
https://jsfiddle.net/m4tuna/z6co93wa/
Of course this is slightly different than your current example in that you're just filling the parent height by percentage. If your looking for it to fill any outer container by percentage in particular, you'll need to assign a height or min-height to the container so that the rows know what to fill.


text:
Q: Converting a piece of octave (mrdivide) code to numpy I am trying to convert a piece of octave code to numpy but I got different results from octave and numpy. Here are my Data (in fact they are far larger than given data below):
A =

 Columns 1 through 6:

   1.000000000000000e+00   9.954090291002812e-01   9.820064469806473e-01   9.908807141567176e-01   9.954090291002812e-01   9.908807141567179e-01
   9.954090291002812e-01   1.000000000000000e+00   9.954090291002812e-01   9.776578008378289e-01   9.908807141567179e-01   9.954090291002812e-01
   9.820064469806473e-01   9.954090291002812e-01   1.000000000000000e+00   9.567491788333946e-01   9.776578008378289e-01   9.908807141567179e-01
   9.908807141567176e-01   9.776578008378289e-01   9.567491788333946e-01   1.000000000000000e+00   9.954090291002812e-01   9.820064469806473e-01
   9.954090291002812e-01   9.908807141567179e-01   9.776578008378289e-01   9.954090291002812e-01   1.000000000000000e+00   9.954090291002812e-01
   9.908807141567179e-01   9.954090291002812e-01   9.908807141567179e-01   9.820064469806473e-01   9.954090291002812e-01   1.000000000000000e+00
   9.776578008378289e-01   9.908807141567179e-01   9.954090291002812e-01   9.608235911808946e-01   9.820064469806473e-01   9.954090291002812e-01
   9.776578008378289e-01   9.649505047327671e-01   9.448300707857176e-01   9.954090291002812e-01   9.908807141567179e-01   9.776578008378289e-01
   9.820064469806473e-01   9.776578008378289e-01   9.649505047327671e-01   9.908807141567179e-01   9.954090291002812e-01   9.908807141567179e-01
   9.776578008378289e-01   9.820064469806473e-01   9.776578008378289e-01   9.776578008378289e-01   9.908807141567179e-01   9.954090291002812e-01
   9.649505047327671e-01   9.776578008378289e-01   9.820064469806473e-01   9.567491788333946e-01   9.776578008378289e-01   9.908807141567179e-01
   9.567491788333946e-01   9.448300707857176e-01   9.259179407344914e-01   9.820064469806473e-01   9.776578008378289e-01   9.649505047327671e-01
   9.608235911808946e-01   9.567491788333946e-01   9.448300707857176e-01   9.776578008378289e-01   9.820064469806473e-01   9.776578008378289e-01
   9.567491788333946e-01   9.608235911808946e-01   9.567491788333946e-01   9.649505047327671e-01   9.776578008378289e-01   9.820064469806473e-01
   9.448300707857176e-01   9.567491788333946e-01   9.608235911808946e-01   9.448300707857176e-01   9.649505047327673e-01   9.776578008378289e-01

 Columns 7 through 12:

   9.776578008378289e-01   9.776578008378289e-01   9.820064469806473e-01   9.776578008378289e-01   9.649505047327671e-01   9.567491788333946e-01
   9.908807141567179e-01   9.649505047327671e-01   9.776578008378289e-01   9.820064469806473e-01   9.776578008378289e-01   9.448300707857176e-01
   9.954090291002812e-01   9.448300707857176e-01   9.649505047327671e-01   9.776578008378289e-01   9.820064469806473e-01   9.259179407344914e-01
   9.608235911808946e-01   9.954090291002812e-01   9.908807141567179e-01   9.776578008378289e-01   9.567491788333946e-01   9.820064469806473e-01
   9.820064469806473e-01   9.908807141567179e-01   9.954090291002812e-01   9.908807141567179e-01   9.776578008378289e-01   9.776578008378289e-01
   9.954090291002812e-01   9.776578008378289e-01   9.908807141567179e-01   9.954090291002812e-01   9.908807141567179e-01   9.649505047327671e-01
   1.000000000000000e+00   9.567491788333946e-01   9.776578008378289e-01   9.908807141567179e-01   9.954090291002812e-01   9.448300707857176e-01
   9.567491788333946e-01   1.000000000000000e+00   9.954090291002812e-01   9.820064469806473e-01   9.608235911808946e-01   9.954090291002812e-01
   9.776578008378289e-01   9.954090291002812e-01   1.000000000000000e+00   9.954090291002812e-01   9.820064469806473e-01   9.908807141567179e-01
   9.908807141567179e-01   9.820064469806473e-01   9.954090291002812e-01   1.000000000000000e+00   9.954090291002812e-01   9.776578008378289e-01
   9.954090291002812e-01   9.608235911808946e-01   9.820064469806473e-01   9.954090291002812e-01   1.000000000000000e+00   9.567491788333946e-01
   9.448300707857176e-01   9.954090291002812e-01   9.908807141567179e-01   9.776578008378289e-01   9.567491788333946e-01   1.000000000000000e+00
   9.649505047327673e-01   9.908807141567179e-01   9.954090291002812e-01   9.908807141567179e-01   9.776578008378289e-01   9.954090291002812e-01
   9.776578008378289e-01   9.776578008378289e-01   9.908807141567179e-01   9.954090291002812e-01   9.908807141567179e-01   9.820064469806473e-01
   9.820064469806473e-01   9.567491788333946e-01   9.776578008378289e-01   9.908807141567179e-01   9.954090291002812e-01   9.608235911808946e-01

 Columns 13 through 15:

   9.608235911808946e-01   9.567491788333946e-01   9.448300707857176e-01
   9.567491788333946e-01   9.608235911808946e-01   9.567491788333946e-01
   9.448300707857176e-01   9.567491788333946e-01   9.608235911808946e-01
   9.776578008378289e-01   9.649505047327671e-01   9.448300707857176e-01
   9.820064469806473e-01   9.776578008378289e-01   9.649505047327673e-01
   9.776578008378289e-01   9.820064469806473e-01   9.776578008378289e-01
   9.649505047327673e-01   9.776578008378289e-01   9.820064469806473e-01
   9.908807141567179e-01   9.776578008378289e-01   9.567491788333946e-01
   9.954090291002812e-01   9.908807141567179e-01   9.776578008378289e-01
   9.908807141567179e-01   9.954090291002812e-01   9.908807141567179e-01
   9.776578008378289e-01   9.908807141567179e-01   9.954090291002812e-01
   9.954090291002812e-01   9.820064469806473e-01   9.608235911808946e-01
   1.000000000000000e+00   9.954090291002812e-01   9.820064469806473e-01
   9.954090291002812e-01   1.000000000000000e+00   9.954090291002812e-01
   9.820064469806473e-01   9.954090291002812e-01   1.000000000000000e+00

and
b =

  -1.024208397018539
  -1.055718555015945
  -1.066560607689640
  -1.187368188387253
  -1.258866007703282
  -1.305258462589997
  -1.321354530870290
  -1.333661132027602
  -1.421384660329320
  -1.478743779481671
  -1.498725636719488
  -1.385960967135295
  -1.479663779776475
  -1.541078471216082
  -1.562500000000000

In octave I have x = b'/A. I could not find corresponding numpy function for /. So far I tried x = np.dot(b.T,np.linalg.inv(A)) from numpy but the results are not same as octave.
The results of octave for x = b'/A are:
x =

 Columns 1 through 6:

  -5.642309525591432e+00   7.813412870218545e+00  -1.559855155426489e+02  -3.597241224212262e+01   2.201914551287831e+02  -3.100354445411479e+02

 Columns 7 through 12:

   7.253956488595386e+02   7.369595892720794e+01  -4.313273469816049e+02   6.064725968037579e+02  -9.855235323530542e+02  -4.111380598448122e+01

 Columns 13 through 15:

   2.334109900297194e+02  -3.269547704109582e+02   4.254317069619117e+02

and the results of numpy are
x=np.array([[-5.642310487492068,    7.813414778371225,  -155.9855165364133, -35.9724138597885,  220.1914623928024,  -310.0354544342263, 725.3956532399461,  73.69596218669903,  -431.3273588509765, 606.472611254314,   -985.5235383154941, -41.11380770278629, 233.4109958125337,  -326.9547770833597, 425.4317096135928]])

I would appreciate if someone can help me to find same results as in  octave by numpy. Or closer than current the results to Octave results.

A: It looks like Matlab and numpy use different precisions for their calculations. I'd try to force both to use the some floating point precision.
By default matlab uses a 16-bit precision for numerical calculation (see https://www.mathworks.com/help/symbolic/increase-precision-of-numeric-calculations.html). On this site it is also describe how to change the precision.
numpy, as far as I am concerned uses 32-bit precision (You might find this article useful: how set numpy floating point accuracy?).

A: Take both arrays (copy and pasted from your post)
x = [-5.642309525591432e+00, 7.813412870218545e+00, -1.559855155426489e+02, -3.597241224212262e+01, 2.201914551287831e+02, -3.100354445411479e+02, 7.253956488595386e+02, 7.369595892720794e+01, -4.313273469816049e+02, 6.064725968037579e+02, -9.855235323530542e+02, -4.111380598448122e+01, 2.334109900297194e+02, -3.269547704109582e+02, 4.254317069619117e+02]
y = [-5.642310487492068,    7.813414778371225,  -155.9855165364133, -35.9724138597885,  220.1914623928024,  -310.0354544342263, 725.3956532399461,  73.69596218669903,  -431.3273588509765, 606.472611254314,   -985.5235383154941, -41.11380770278629, 233.4109958125337,  -326.9547770833597, 425.4317096135928]

and run them through allclose
import numpy as np
np.allclose(x, y) # True

They are (within a some tolerance) the same.


text:
Q: How to delay a commandLink in jsf with javascript or primefaces? I have a commandLink which calls a backend page bean method. but I want to make a delay before it calls that method. How to do this using javascipt or primefaces?

A: PrimeFaces offers p:remoteCommand. It can be called via javascript and execute, do action and ajax process and updates. Use the p:commandLink to call a javascript function with a timeout. In short
<p:commandLink onclick="delayIt()" />

<p:remoteCommand name="remoteCommandName" ... action ... update ... process/>

<script type="text/javascript">
    var delayIt = function(){
       setTimeout( remoteCommandName,5000) //don't write () as it would execute it immediately
    }
</script>

A: In primefaces try 'delay' as attribute. delay is null as default.
<p:commandLink id="clid" actionListener="#{buttonView.buttonAction}" delay="1000">
    <h:outputText value="text" />
</p:commandLink>


text:
Q: how does parallel transport work on the sphere I am starting to try to understand the concept of parallel transport from differential geometry and I have run into a problem. I have been attempting to compute parallel transport on a sphere (embedded into $\mathbb{R}^3$, with the Levi-Civita connection), along a circle (not necessarily the equator). I keep getting the result that in the general case, after a full rotation, the vector changes. My intuition tells me this can't be right, but the calculations say otherwise. Would someone be as kind as to explain to me how it works?

A: If the circle you're transporting along is not a great circle, then you should not expect parallel transport all the way around the circle to be the identity.
Imagine a conic surface that touches your circle everywhere. If you cut up the cone, you can unroll it into part of a flat plane, but then you will find that the two ends of the circle that meet the cut will point in different directions after the cone is unfolded. Therefore, if you start parallel transporting a vector from the cut point an all the way around the circle, it will not point int he same direction relative to the circle locally when you reach the other side of the cut.
(Parallel transport in the plane keeps the vector actually parallel at all times, and since the cone is tangent to your spherical circle everywhere, parallel transport in the cone agrees with parallel transport in the sphere).


text:
Q: Use machine learning algorithms data structure to store information (memory)
DISCLAIMER : I'm pretty new to machine learning field, so forgive me
  if my questions are somehow naive ... I already searched on Internet
  about this topic and find nothing interesting so I am asking here ....

I wonder if a ML algorithm can be consider as a way to store data ?
There is programs that "contains" thousands of decimal of PI (e.g. https://www.quora.com/What-is-the-smallest-C-program-generating-pi-without-using-the-math-library) : in some way it's a "compressed" version of the first thousands decimal of PI, right ?
In the same way ML (e.g. Deep Neural Net) seems to store information. Can we mesure how many bits is stored in a Deep Neural Net ? Can we use ML  algorithms data structure to compress information and retrieve it later (even if it's not 100% accurate) ? ...
Is there (not too technical ) papers that discuss these possibilities ?
Thanks :)

A: In the link you postet the complete (infinitly long) information of PI is stored, not only 1000 decimals. But it would need inifinite time/iterations to get it all ;-).
To your question:
Like you mentioned the Learners/Classifiers store informaiton about the data you train them with. But their purpose is not to retrieve the original data back but classify/assess new data. So with caution i say:
"no we don't simply compress data with AI algorithms and can't get the original back".
One special case would be the K-Nearest-Neighbor Algorithm.
Here you can restore the original data but thats because its not compressed, but just saved in form of hyperdimensional datapoints.
The hardest part of your question is how we could quantify the information stored in a Classifier (Deep Neural Network). If you have a Hopfield-Network (wich saves and recognizes images/patterns. But is not a Deep Neural Network) you could quantify the information by counting the saved patterns and their size. For a decision tree you could count the rules (and the information gain of each rule maybe). For a neural network  you could take the number of neurons and maybe the entropy of each or all. But as you see its a really hard to answer question to specify the information stored in a trained learning algorithm.
I hope i could answer some of your questions a little bit.
Cheers


text:
Q: Is it possible to use extension methods which are added at implementation file rather than interface file in objective c? This is header file/Interface file(className.h).
Here printSomething method is declared as an extension. And I'll call it later in main.m
extension.h
#import <Foundation/Foundation.h>

@interface extension_class : NSObject

@end

@interface extension_class ()       // This is the external method which is added using extension
- (void) printSomething;
@end

This is the Implementation file(className.m). Here printSomething method is defined.
extension.m
        #import "extensions.h"

        @implementation extension_class

        - (void) printSomething
        {
            NSLog(@"I'm the method defined inside extension class but declared by using extensions");
        }
        @end

So far everything works fine. Now My question is simple why can't I access that printSomething method if I declare(until now declaration and definition was not done in same file) it in implementation file. As in the below code snippet? (Please compare and observe the changes among above two .h and .m files with below ones to get my point)
extension.h
#import <Foundation/Foundation.h>

        @interface extension_class : NSObject

        @end

extension.m
    #import "extensions.h"

    @interface extension_class ()       // This is the external method which is added using extension
    - (void) printSomething;
    @end

    @implementation extension_class
    - (void) printSomething
    {
        NSLog(@"I'm the method defined inside extension class but declared by using extensions");
    }
    @end

This is main method which is common in both cases.
main.m
#import "extensions.h"
int main()
{
    @autoreleasepool
    {
        extension_class *object = [[extension_class alloc]init];
        [object printSomething];
    }
    return 'O';
}

So what is point in having extensions in objective C if it doesn't allow us to add methods anywhere we like? or Is there any other method to achieve what I said above?

A: You're free to define extensions in the .m file. This is incredibly common. Those extensions won't generally be known to importers of the .h file, so they won't easily be callable from other files. That's a good thing. It lets us make "private" extensions, which is very useful and common.
They're not really private. Anything can call anything in ObjC. Outside callers just won't know about the method. But they can declare the method themselves as a category (note the text inside the parentheses) and call it:
OtherClass.m
#import "ExtensionClass.h"

@interface ExtensionClass (ThingsIKnowYouHave)
- (void) printSomething;
@end

...

[extensionClass printSomething];

Or they could of course just call it directly without declaring it (though this can cause ARC problems, so avoid this in modern ObjC):
[(id)extensionClass printSomething];

Or they could call it as a selector (again, this can cause ARC problems; so using the category is best):
[extensionClass performSelector: NSSelectorFromString(@"printSomething")];

There's really not much point to creating extensions in the header file (i.e. "public" extensions). If it's in the header file, you might as well just put it in the interface. The most common use of extensions (basically why they were invented), is so you can define methods inside the implementation file.
Extensions shouldn't be confused with categories, where there is text inside the parentheses. These were created to help organize large classes, and later were used for "informal protocols" before @optional was added. Extensions can add methods directly to the base class. Category interfaces just say "this method might exist." Extension interfaces are formal continuations of the primary interface (the compiler requires that they be implemented).
For more on categories and extensions, see Customizing Existing Classes in the Programming with Objective-C guide. See also Defining Classes in the same guide, which may clear up some confusion I believe you have about header files and interfaces.