text:
Q: Jquery code breaking the rest of my code I have some Jquery that I've added to a load of other Jquery (which all works fine) but it's breaking the rest of my code. There's an error in there somewhere but I just can't work out where!
//Retrieve the customization summary area:
var summary = $('#customise-area-3 p');

//Use jQuery to select all the checkboxes with the name hardware that are checked.
$('input[type=checkbox][name=hardware\[\]]:checked').each(function(k,v) {
    //Retrieve the value of the checkbox.
    var checkboxValue = v.val();

    //Add the checkbox value to the summary area:
    summary.innerHTML += checkboxValue + '
';
});

This is within Wordpress so all the rest of my Jquery is in the style of:
jQuery(document).ready(function( $ )
{
    $("#customise").click(function()
    {
        $(".entire_product").hide();
        $(".customise").show();
    });
});

To get the code working within the Wordpress environment I've done the following:
jQuery(document).ready(function( $ )
{
   var summary = $('#customise-area-3 p').get(0);

   $('input[type=checkbox][name="hardware[]"]:checked').each(function(k,v) {
    //Retrieve the value of the checkbox.
    var checkboxValue = v.val();

    //Add the checkbox value to the summary area:
    summary[0].innerHTML += checkboxValue + '
';
});
});

Although this stops the rest of my code from breaking, it doesn't actually do anything. I.e add the selected checkbox value to the summary.

A: You are incorrectly using \ slash in selector and you are using innerHTML on jQuery object which is wron
Change
$('input[type=checkbox][name=hardware\[\]]:checked')

To
$('input[type=checkbox][name="hardware[]"]:checked')

You better use wild card if you need to check name that starts with hardware
$('input[type=checkbox][name^=hardware]:checked')

Change
summary.innerHTML += checkboxValue + '
';

To
summary[0].innerHTML += checkboxValue + '
';

A: your line
//Add the checkbox value to the summary area:
    summary.innerHTML += checkboxValue + '
';

is trying to set the innerHTML of an object, that looks to be where your code is breaking
you should use
summary.html(checkboxValue + '
');

there may be other errors like that in there. but that is the only one i can see


text:
Q: MIPS syscall on MARS: "address out of range" I'm a newbie with MIPS & MARS. As a part of my program, I want to read a string from the user.
I have a simple code as follows
.globl  test
.data   0x10010000
foo: .asciiz "Input a string"
.data   0x10020000
in: .asciiz "xyz"
.text   0x00400000

test:
li  $v0, 54
add $a0, $zero, 0x1001
add $a1, $zero, 0x1002
add $a2, $zero, 3
syscall

The idea is to read a string of say length at most 3 into memory at 0x1002. Running the code gives me "Runtime exception at 0x00400010: address out of range 0x00001001".
Why does this happen? How do I fix it? I suspect I'm doing something very silly, but cannot figure it out.

A: I think you're mixed up with addressing. You've defined your buffer space at 0x10020000 but you're using an address of 0x1002 for the syscall. Same thing with the dialog string.
Your $a0 should be the address of the string that gets shown in the dialog; I suspect this should be foo:
la $a0, foo

And your buffer should be in:
la $a1, in

Edit: these are replacements for the adds, so in the end it should look like:
test:
li  $v0, 54
la  $a0, foo
la  $a1, in
li  $a2, 3
syscall

I've also replaced the $a2 line with something simpler. Try to see how they're equivalent.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Javascript prototype usage performance I want to learn the advantages of using JavaScript prototype. Object prototype usage is increasing performance.
I want to see this by usage of memory.
Case-1
    var Foo1 = function (name) {
        this.name = name;
        getFirstName = function() { return "name1"; };
        getLastName = function() { return "name2"; };
    };
    for (var i = 0; i < 1000; i++) {
        var foo1 = new Foo1();
    }

Case-2
    var Foo2 = function (name) {
        this.name = name;
    };

    Foo2.prototype = {
        getFirstName: function () { return "name1"; },
        getLastName: function () { return "name2"; },
    };

    for (var i = 0; i < 1000; i++) {
        var foo2 = new Foo2();
    }

*

*which case is using memory more than another?

*Can I learn memory usage of cases?

*What is the difference about memory usage of cases?

A: If you define a function or an object to belong to the prototype then it's shared by all instances and creating an object with new does not create it's own instance of the function/object. In this sense defining something to belong to the prototype uses less memory. The precise difference would be that case 1 (look at comments below because your definition is not proper) would create 1000 instances of each function. Case 2 (again look at the comments below) would create only 1 instance of each function.
However case 2 is not defining in the prototype. You're essentially redefining the prototype there. The correct usage would be:
function Foo2 (name) {
    this.name = name;
};

Foo2.prototype.getFirstName = function () { return "name1"; };
Foo2.prototype.getLastName = function () { return "name2"; };

Your case 1 is also not correctly defined in terms of what you're trying to achieve because getFirstName and getLastName are not defined through this (the instance).

A: The second case is more memory-efficient and performant. When you define methods in the constructor then the same functions or methods are allocated for each object so the object consumes more memory. So define methods in the prototype-object then all objects share the same methods only once.
So my advice is that you define attributes (number,string...) in the constructor and methods or functions in the prototype-object like you did it in the second case.
By the way when you define an object this way:
var Foo1 = function (name) {
    this.name = name;
    getFirstName = function() { return "name1"; };
    getLastName = function() { return "name2"; };
};

The method getFirstName and getLastName are properties of window, because you actually write this:
var Foo1 = function (name) {
    this.name = name;
    window.getFirstName = function() { return "name1"; };
    window.getLastName = function() { return "name2"; };
};


text:
Q: Getting product stock levels / quantities in Magento 2.3 I have the following code to get a product collection but how do I also return back the stock levels too
$products = $this->productCollectionFactory->create()
            ->addAttributeToSelect('*')
            ->addAttributeToFilter('type_id', Type::TYPE_SIMPLE);

A: Is this the best way
$products = $this->productCollectionFactory->create()
        ->addAttributeToSelect('*')
        ->joinField(
            'qty',
            'cataloginventory_stock_item',
            'qty',
            'product_id=entity_id',
            '{{table}}.stock_id=1',
            'left'
        )
        ->addAttributeToFilter('type_id', Type::TYPE_SIMPLE);


text:
Q: How to conditionally display a div inside a html erb file in Ruby on Rails I want to display a Button based on wether the id exists.
_form.html.erb
<%= @customer.id? %>

        <%= button_to 'Kundenrofil', customer_path(@customer), method: :get %>

<%= end %>

I use this inside a form for making a new customer and also for editing a customer.
If I edit a customer everything works fine but if I make a new user it gives me an error because
id=nil
How do I do it in the _form.html.erb

A: <% unless @customer.id.nil? %>

        <%= button_to 'Kundenrofil', customer_path(@customer), method: :get %>

<% end %>

You have to put if/unless with expression. So change @customer.id? with unless @customer.id.nil?. Also notice <% instead of <%=.
<%= is used when we want to render something on the page.
<% is used to Execute the ruby code within the brackets.
Change <%= end %> to <% end %>
Ref this to know about the differences.


text:
Q: SSIS Create Folder with CurrentDate I am trying to create a folder with current date using file system task . Package completes the execution successfully, but no folder is created.
I have set the following properties for the file system task
IsSourcePathVariable = True
Operation = Create Directory
SourceVariable = User::DestinationFolder
DestinationRoot = D:\Destination\
DestinationFolder = @[User::DestinationRoot]  + (DT_STR,4,1252)DATEPART( "yyyy" , getdate() ) +
                   RIGHT("0" + (DT_STR,4,1252)DATEPART( "mm" , getdate() ), 2) +
                   RIGHT("0" + (DT_STR,4,1252)DATEPART( "dd" , getdate() ), 2)


text:
Q: How do I open my React app again after restarting my computer on local host? I started a react project but now I don't know how to open it again in the localhost 3000 server. Do I just open the file again or do a npm command?

A: You should run your project through terminal with the npm start command again.

A: Actually just figured it out myself lol I just opened the terminal at my folder and did an 'npm start' command. Sorry newbie here

A: First, check if you have in the package.json file under the script function start if is then in terminal write npm run start

A: Open the terminal and write > cd (your project name) and then press enter, then press npm start and press enter.
Good luck


text:
Q: Proof Question - Fundamental Theorem of Algebra and Rational Functions I have a situation where I have a rational function $f(z)=t(z)/u(z)$, where $t,u$ are polynomials.
I would like to use the Fundamental Theorem of Algebra to show there exists a complex number such that $f(k)=k$.
My thinking is perhaps let $f(z)-k=0$ and try and use the FTA to get a result?
Thank you guys, appreciate your help.


text:
Q: node-gyp build error while running npm install in reactjs I took a frontend project repo which is built on reactjs & WHILE I run npm i command it is giving me whole bunch of error.

*

*I tried deleting package.lock.json file & again run the command

*I tried by doing npm update

*I tried npm i --force & npm update --force
But same error is giving ..

 update
I forcely cache cleaned using this command npm cache clean -f. After that I again run npm i.. now giviing this error...

0 verbose cli [
0 verbose cli   '/usr/local/Cellar/node/16.11.1/bin/node',
0 verbose cli   '/usr/local/bin/npm',
0 verbose cli   'i'
0 verbose cli ]
1 info using npm@8.1.2
2 info using node@v16.11.1
3 timing npm:load:whichnode Completed in 0ms
4 timing config:load:defaults Completed in 2ms
5 timing config:load:file:/usr/local/lib/node_modules/npm/npmrc Completed in 2ms
6 timing config:load:builtin Completed in 2ms
7 timing config:load:cli Completed in 2ms
8 timing config:load:env Completed in 1ms
9 timing config:load:file:/Users/macbookpro/Desktop/private_project/xyzvara/to-let/.npmrc Completed in 1ms
10 timing config:load:project Completed in 1ms
11 timing config:load:file:/Users/macbookpro/.npmrc Completed in 0ms
12 timing config:load:user Completed in 0ms
13 timing config:load:file:/usr/local/etc/npmrc Completed in 0ms
14 timing config:load:global Completed in 0ms
15 timing config:load:validate Completed in 1ms
16 timing config:load:credentials Completed in 1ms
17 timing config:load:setEnvs Completed in 1ms
18 timing config:load Completed in 11ms
19 timing npm:load:configload Completed in 11ms
20 timing npm:load:setTitle Completed in 3ms
21 timing npm:load:setupLog Completed in 0ms
22 timing config:load:flatten Completed in 4ms
23 timing npm:load:cleanupLog Completed in 2ms
24 timing npm:load:configScope Completed in 0ms
25 timing npm:load:projectScope Completed in 1ms
26 timing npm:load Completed in 22ms
27 timing arborist:ctor Completed in 1ms
28 timing arborist:ctor Completed in 0ms
29 timing idealTree:init Completed in 19ms
30 timing idealTree:userRequests Completed in 0ms
31 silly idealTree buildDeps
32 silly fetch manifest @ckeditor/ckeditor5-build-classic@^25.0.0
33 http fetch GET 200 https://registry.npmjs.org/@ckeditor%2fckeditor5-build-classic 2340ms (cache miss)
34 silly fetch manifest @ckeditor/ckeditor5-react@^3.0.2
35 http fetch GET 200 https://registry.npmjs.org/@ckeditor%2fckeditor5-react 2069ms (cache miss)
36 silly fetch manifest react@^16.14.0
37 http fetch GET 200 https://registry.npmjs.org/react 905ms (cache miss)
38 silly fetch manifest @hookform/devtools@^3.1.0
39 http fetch GET 200 https://registry.npmjs.org/@hookform%2fdevtools 1461ms (cache miss)
40 silly fetch manifest react@>=17.0.2
41 timing idealTree Completed in 6832ms
42 timing command:install Completed in 6858ms
43 verbose stack Error: unable to resolve dependency tree
43 verbose stack     at Arborist.[failPeerConflict] (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:1356:25)
43 verbose stack     at Arborist.[loadPeerSet] (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:1322:34)
43 verbose stack     at async Arborist.[buildDepStep] (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:930:11)
43 verbose stack     at async Arborist.buildIdealTree (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:216:7)
43 verbose stack     at async Promise.all (index 1)
43 verbose stack     at async Arborist.reify (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:149:5)
43 verbose stack     at async Install.install (/usr/local/lib/node_modules/npm/lib/install.js:170:5)
44 verbose cwd /Users/macbookpro/Desktop/private_project/xyzvara/to-let
45 verbose Darwin 20.3.0
46 verbose argv "/usr/local/Cellar/node/16.11.1/bin/node" "/usr/local/bin/npm" "i"
47 verbose node v16.11.1
48 verbose npm  v8.1.2
49 error code ERESOLVE
50 error ERESOLVE unable to resolve dependency tree
51 error
52 error While resolving: [1mtolet[22m@[1m0.1.0[22m
52 error Found: [1mreact[22m@[1m16.14.0[22m[2m[22m
52 error [2mnode_modules/react[22m
52 error   [1mreact[22m@"[1m^16.14.0[22m" from the root project
52 error
52 error Could not resolve dependency:
52 error [35mpeer[39m [1mreact[22m@"[1m>=17.0.2[22m" from [1m@hookform/devtools[22m@[1m3.1.0[22m[2m[22m
52 error [2mnode_modules/@hookform/devtools[22m
52 error   [1m@hookform/devtools[22m@"[1m^3.1.0[22m" from the root project
52 error
52 error Fix the upstream dependency conflict, or retry
52 error this command with --force, or --legacy-peer-deps
52 error to accept an incorrect (and potentially broken) dependency resolution.
52 error
52 error See /Users/macbookpro/.npm/eresolve-report.txt for a full report.
53 verbose exit 1

 update 2
I encountered an error that telling network error. So, to faster loading speed I installed yarn & run yarn install. After that strangely It installed node modules that was not happening while I was using npm . After that while tried to run the project It was giving node-sass error. so I did npm audit fix -f. but, It didn't fix all error but if I run command to start the project it is now running without giving error. Very strange , I don't have any perfect answer of this behaviour.

A:  update 2
I encountered an error that telling network error. So, to faster loading speed I installed yarn & run yarn install. After that strangely It installed node modules that was not happening while I was using npm . After that while tried to run the project It was giving node-sass error. so I did npm audit fix -f. but, It didn't fix all error but if I run command to start the project it is now running without giving error. Very strange , I don't have any perfect answer of this behaviour.


text:
Q: divide layout for two parts, analog clock and a listview. android I want to divide layout for two parts in first I will have only an analog clock, in the second I wanto to have a listview.
xml file ;
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <AnalogClock
        android:id="@+id/analogClock1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />

    <include
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        layout="@layout/day_plan" />

</LinearLayout>

xml of the including layout ;
    <?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
   android:id="@+id/countryTextView"
   android:layout_width="fill_parent"
   android:layout_height="wrap_content"
   android:padding="8dp"
   android:textSize="20sp"
   android:textColor="@android:color/white"
   android:minHeight="?android:attr/listPreferredItemHeight"
   android:gravity="center_vertical"/>

I want to display under this clock a list with my events from database:
public class Clock extends ListActivity {

    public static final String ROW_ID = "row_id";
     private ListView conListView;
     private CursorAdapter conAdapter;
     public String opis;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.morning_clock);
        conListView=getListView();
        conListView.setOnItemClickListener(viewConListener);

        AnalogClock ac = (AnalogClock) findViewById(R.id.analogClock1);

        // map each name to a TextView
        String[] from = new String[] { "event" };
        int[] to = new int[] { R.id.countryTextView };
        conAdapter = new SimpleCursorAdapter(Clock.this, R.layout.morning_clock, null, from, to);
        setListAdapter(conAdapter); // set adapter

    }

        @Override
        protected void onResume()
        {
           super.onResume();
           new GetEvents().execute((Object[]) null);
         }

        @Override
        protected void onStop()
        {
           Cursor cursor = conAdapter.getCursor();

           if (cursor != null)
              cursor.deactivate();

           conAdapter.changeCursor(null);
           super.onStop();
        }

        private class GetEvents extends AsyncTask<Object, Object, Cursor>
        {
           DatabaseConnector dbConnector = new DatabaseConnector(Clock.this);

           @Override
           protected Cursor doInBackground(Object... params)
           {
               Intent a = getIntent();
               String d_m_y = a.getStringExtra("d_m_y");
              dbConnector.open();
              return dbConnector.getdate(d_m_y);
           }

           @Override
           protected void onPostExecute(Cursor result)
           {
              conAdapter.changeCursor(result); // set the adapter's Cursor
              dbConnector.close();
           }
        }

        @Override
        public boolean onCreateOptionsMenu(Menu menu)
        {
           super.onCreateOptionsMenu(menu);
           MenuInflater inflater = getMenuInflater();
           inflater.inflate(R.menu.dayplan_menu, menu);
           return true;
        }

        @Override
        public boolean onOptionsItemSelected(MenuItem item)
        {
           Intent addEvent = new Intent(Clock.this, AddEvent.class);
           startActivity(addEvent);
           return super.onOptionsItemSelected(item);
        }

        OnItemClickListener viewConListener = new OnItemClickListener()
        {
           public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,long arg3)
           {
              Intent viewEvent = new Intent(Clock.this, ViewEvent.class);
              viewEvent.putExtra(ROW_ID, arg3);

              startActivity(viewEvent);
           }
        };

    }

and Im getting errors :
   01-02 21:57:50.645: E/AndroidRuntime(1047): FATAL EXCEPTION: main

01-02 21:57:50.645: E/AndroidRuntime(1047): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.examples.android.calendar/com.examples.android.calendar.Clock}: java.lang.RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list'

01-02 21:57:50.645: E/AndroidRuntime(1047):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)

01-02 21:57:50.645: E/AndroidRuntime(1047):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)

01-02 21:57:50.645: E/AndroidRuntime(1047):     at android.app.ActivityThread.access$600(ActivityThread.java:130)

01-02 21:57:50.645: E/AndroidRuntime(1047):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)

01-02 21:57:50.645: E/AndroidRuntime(1047):     at android.os.Handler.dispatchMessage(Handler.java:99)

01-02 21:57:50.645: E/AndroidRuntime(1047):     at android.os.Looper.loop(Looper.java:137)

01-02 21:57:50.645: E/AndroidRuntime(1047):     at android.app.ActivityThread.main(ActivityThread.java:4745)

01-02 21:57:50.645: E/AndroidRuntime(1047):     at java.lang.reflect.Method.invokeNative(Native Method)

01-02 21:57:50.645: E/AndroidRuntime(1047):     at java.lang.reflect.Method.invoke(Method.java:511)

01-02 21:57:50.645: E/AndroidRuntime(1047):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)

01-02 21:57:50.645: E/AndroidRuntime(1047):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)

01-02 21:57:50.645: E/AndroidRuntime(1047):     at dalvik.system.NativeStart.main(Native Method)

A: If you want to use a listactivity, the layout you are using must have a listview whose id is @android/list
Check the doc here
In the example you have
<ListView android:id="@android:id/list"
           android:layout_width="match_parent"
           android:layout_height="match_parent"
           android:background="#00FF00"
           android:layout_weight="1"
           android:drawSelectorOnTop="false"/>

So instead of your textview you really need to have a ListView with  android:id="@android:id/list"


text:
Q: Message about missing } in \int_case:nn I get
! Missing } inserted.
<inserted text>
                }
l.47     Test $\Id$
                   , $\Id{A}$ and $\Id{A,B}$ inline.

when compiling
\documentclass{article}
\usepackage{amsmath}
\usepackage{xparse} % loads expl3
%See interface3.pdf

\ExplSyntaxOn

\NewDocumentCommand \Id {O{}}
  {
     \Id:n #1
  }

\cs_new:Npn \Id:n #1
  {
    \clist_set:Nn \l_tmpa_clist {#1}
    \int_case:nn
      {\clist_count:N \l_tmpa_clist}
      {
        {0}
        {
          \mathop{Id}
        }
        {1}
        {
          \mathop{Id}_{#1}
        }
        {2}
        {
          \mathop{Id}
            ^{\clist_item:Nn \l_tmpa_clist 1}
            _{\clist_item:Nn \l_tmpa_clist 2}
        }
      }
      {
          msg_error:nn {shmuel} {More than one argument for {\backslash}Id}
      }
  }

\begin{document}

\ExplSyntaxOn
\msg_new:nnn {shmuel} {short} {\#1}
\msg_new:nnnn {shmuel} {long} {\#1} {\#2}
%Should it be ## rather than \#?
\ExplSyntaxOff

Test $\Id$, $\Id{A}$ and $\Id{A,B}$ inline.
\begin{equation}
  Test \Id, \\
   \Id{A}, \\
   \Id{A,B}
\end{equation}

\end{document}

I changed the argument specifier to {O{{}}} and changed the incorrect braces in the \Id invocations to brackets. Better, but now the default value is take a {} rather than an empty clist, the _ is taken as a text character rather as a subscript and [A,B] is treated as a single token rather than as a list of two.
\documentclass{article}
\usepackage{amsmath}
\usepackage{xparse} % loads expl3
%See interface3.pdf

\ExplSyntaxOn

\NewDocumentCommand \Id {O{\{\}}}
  {
     \Id:n #1
  }

\cs_new:Npn \Id:n #1
  {
    \clist_set:Nn \l_tmpa_clist {#1}
    \int_case:nnF
      {\clist_count:N \l_tmpa_clist}
      {
        {0}
        {
          \mathop{Id}
        }
        {1}
        {
          \mathop{Id}_{#1}
        }
        {2}
        {
          \mathop{Id}
            ^{\clist_item:Nn \l_tmpa_clist 1}
            _{\clist_item:Nn \l_tmpa_clist 2}
        }
      }
      {
          msg_error:nn {shmuel} {More than two arguments for {\backslash}Id}
      }
  }

\begin{document}

\ExplSyntaxOn
\msg_new:nnn {shmuel} {short} {\#1}
\msg_new:nnnn {shmuel} {long} {\#1} {\#2}
%Should it be ## rather than \#?
\ExplSyntaxOff

Test $\Id$, $\Id[A]$ and $\Id[A,B]$ inline.
\begin{equation}
  Test \Id, \\
   \Id[A], \\
   \Id[A,B]
\end{equation}

\end{document}

A: You defined \Id with an optional argument defaulting to nothing so
 $\Id$

is
$\Id:n $

so gets $ as the argument after which everything goes wrong, you need to pass \Id:n{#1}  with braces to ensure that #1 gets passed on intact.
I'm not sure of the intention of all the code but this runs without error other than the expected error when passed a list of three.
\documentclass{article}
\usepackage{amsmath}
\usepackage{xparse} % loads expl3
%See interface3.pdf

\ExplSyntaxOn

\NewDocumentCommand \Id {O{}}
  {
     \Id:n {#1}
  }

\cs_new:Npn \Id:n #1
  {
    \clist_set:Nn \l_tmpa_clist {#1}
    \int_case:nnTF
      {\clist_count:N \l_tmpa_clist}
      {
        {0}
        {
          \mathop{\mathrm{Id}}
        }
        {1}
        {
          \mathop{\mathrm{Id}}\sb{#1}
        }
        {2}
        {
          \mathop{\mathrm{Id}}
            \sp{\clist_item:Nn \l_tmpa_clist 1}
            \sb{\clist_item:Nn \l_tmpa_clist 2}
        }
      }
      {}
      {
          \msg_error:nnn {shmuel}{long} {#1}
      }
  }

\begin{document}

\ExplSyntaxOn
\msg_new:nnnn {shmuel} {long} {more\ than\ two\ arguments\ for\ \string\Id: #1} {help}
\ExplSyntaxOff

Test $\Id$, $\Id[A]$ and $\Id[A,B]$ $\Id[{too},{many},{parms}] $ inline.
\begin{equation}
  Test \Id, \\
   \Id[A], \\
   \Id[A,B]
\end{equation}

\end{document}

\documentclass{article}
\usepackage{amsmath}
\usepackage{xparse} % loads expl3
%See interface3.pdf

\ExplSyntaxOn

\NewDocumentCommand \Id {O{}}
  {
     \Id:n {#1}
  }

\cs_new:Npn \Id:n #1
  {
    \clist_set:Nn \l_tmpa_clist {#1}
    \int_case:nnF
      {\clist_count:N \l_tmpa_clist}
      {
        {0}
        {
         \operatorname{Id}
        }
        {1}
        {
         \operatorname{Id} \sb {#1}
        }
        {2}
        {
         \operatorname{Id}
           \sp {\clist_item:Nn \l_tmpa_clist 1}
           \sb {\clist_item:Nn \l_tmpa_clist 2}
        }
      }
      {
          \msg_error:nn {shmuel} {More than two arguments for {backslash}Id}
      }
  }

\ExplSyntaxOff

\ExplSyntaxOn
\msg_new:nnn {shmuel} {short} {##1}
\msg_new:nnnn {shmuel} {long} {##1} {##2}
\ExplSyntaxOff

\begin{document}

Test $\Id$, $\Id[A]$ and $\Id[{A,B}]$ inline.
\begin{equation}
  \text{Test} \ \Id, \\
   \Id[A], \\
   \Id[{A,B}]\\
   \Id[A,B,C]\\
\end{equation}

%Test $\Id[{too},{many},{parms}]$

\ExplSyntaxOn
\msg_error:nn {shmuel} {More than two arguments for {backslash}Id}

\end{document}

giving an error
! Package shmuel Error: more than two arguments for \Id:{too},{many},{parms}


text:
Q: How to show widget in frontend? **I'm sorry about my english.
I'm newbie in wordpress. I try to create a small widget for embed video from youtube or others video hosting. Everything is going well in backend (Wordpress adminsitrator).
This is the print screen >> http://i.imgur.com/jfedV4R.gif
When i publish the widget in my sidebar, the widget does not appear anything.
But work fine in my backend.
This is my widget code:
<?php

 /**
 * Today Video Widget Class
 *
 */

class Today_video extends WP_Widget {

    /**
     * Widget setup.
     */
    function Today_video    () {
        /* Widget settings. */
        $widget_ops = array( 'classname' => 'tm_widget_today_video', 'description' => __('Display today video on your site', 'today_video') );

        /* Widget control settings. */
        $control_ops = array( 'width' => 300, 'height' => 350, 'id_base' => 'today_video' );

        /* Create the widget. */
        $this->WP_Widget( 'today_video' , __( 'Today Video' , 'today_video' ), $widget_ops, $control_ops );
    }

    /**
     * The frontend function
     */
    function widget( $args, $instance ) {
        extract( $args );

        /* Our variables from the widget settings. */
        if(isset($instance))
        {
            if( isset( $instance[ 'title' ] ) ) {
                $title =                apply_filters( 'widget_title', $instance[ 'title' ] );
            }

            if( isset( $instance[ 'template' ] ) ) {
                $template =             htmlspecialchars_decode( $instance[ 'template' ] );
            }
        }
    }
    /**
     * Backend widget settings
     */
    function update( $new_instance, $old_instance ) {
        $instance = $old_instance;

        /* Strip tags for title and name to remove HTML (important for text inputs). */
        $instance['title'] =            strip_tags( $new_instance['title'] );

        // htmlspecialchars to save html markup in database, at frontend we use htmlspecialchars_decode
        $instance['template'] =         htmlspecialchars($new_instance['template']);

        return $instance;
    }

    /**
     * Displays the widget settings controls on the widget panel.
     *
     * Backend widget options form
     */
    function form( $instance ) {
        $defaults = array(
            'title' => __(  'Today Video', 'today_video'),
                            'template' => __('', 'today_video'),
                        );

        $instance = wp_parse_args( (array) $instance, $defaults ); ?>

            <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e('Title:', 'hybrid'); ?>
            <input id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo $instance['title']; ?>" style="width:96%;float:right;" />

            <textarea id="<?php echo $this->get_field_id( 'template' ); ?>" name="<?php echo $this->get_field_name( 'template' ); ?>"  style="width:100%;height:100px;"><?php echo $instance['template']; ?></textarea>

    <?php
    }
} //Add function to widgets_init that'll load today_video
add_action( 'widgets_init', create_function( '', 'register_widget( "Today_video" );' ) );
?>

Can someone help me, Please!

A: Your widget method does not echo anything. If you want content to show up the widget needs to echo content.
function widget( $args, $instance ) {
    extract( $args );

    /* Our variables from the widget settings. */
    if(isset($instance))
    {
        if( isset( $instance[ 'title' ] ) ) {
            $title =                apply_filters( 'widget_title', $instance[ 'title' ] );
            // try this
            echo $title;
        }

        if( isset( $instance[ 'template' ] ) ) {
            $template =             htmlspecialchars_decode( $instance[ 'template' ] );
            // try this
            echo $template;
        }
    }

}

That is probably not the format you want but it should display your content. Be aware that widgets support several parameters such as $before_title and after_title. While you don't have to use those, it is generally a good idea.
Reference
http://codex.wordpress.org/Widgets_API


text:
Q: Is it possible to change user's phone orientation using react? I have the next question. I am developing a react application with some images. The user has the possibility to click and open a full-page image. Because the image's orientation is horizontal on the mobile, it does not look good. My idea is when the user clicks on the full page icon, the orientation of the phone becomes horizontal as is implemented on youtube. I tried to find some information about that, but I am not sure if it is even possible, I saw that only by using react native and developing mobile applications you can have access to the user's orientation of the screen. But maybe there are some methods to do in the browser? Thanks in advance.

A: It is not possible to change this from the web, however you could simply rotate the image and display it full screen. This has been done here:
CSS Rotate Portrait Image 90 Degrees and Make Image Full Screen


text:
Q: Deployment en Heroku Estoy intentando subir un proyecto python a heroku pero he estado teniendo problemas, según entiendo para subir un proyecto a heroku es necesario que este utilizando flask o django, pero la verdad no quiero complicarme ya que no se nada de esos framework. Mi proyecto funciona en consola, es un archivo .py normal uso graficas y librerías como numpy, pandas, matplotlib, seaborn. una opcion que investigue es voila ya que tengo un jupyter-notebook pero he visto comentarios de que no funciona con heroku.
Asi que algun consejo o tendre que usar obligatoriamente flask o django

A: He subido un par de proyectos a Heroku. Es una plataforma para publicar aplicaciones web y esto implica que la interacción con el programa debe ocurrir a través de un navegador web en lugar de una consola.
Si lo que necesitas es tener en la web un código que recibe un dato, lo elabora y luego devuelve el resultado deberías considerar utilizar una tecnología diferente como por ejemplo lambda de AWS (Amazon Web Service).
De lo contrario, si lo que quieres es poder acceder a un terminal de comandos e interactuar con el programa en la web como lo haces en tu PC, esto no se puede hacer sin realizar una aplicación web con alguno de los frameworks que mencionas u otros, ya que los navegadores comunican en http y tienes que utilizar este protocolo en tu aplicación para poder interactuar con ellos además de realizar una interfaz amigable en HTML y CSS.
Si no logras con voila, te recomiendo usar Flask porque en comparación con Django trae menos funcionalidades preconfiguradas por defecto y para este proyecto eso es bueno ya que al parecer no necesitas una base de datos ni un sistema de autenticación, además Flask es más sencillo y rápido de entender/aprender y debido a todo esto es más usado en proyectos de baja o media complejidad.


text:
Q: How to handle null values in geolocation (point) object in mongodb? I am currently working with a mongodb containing a collection of companies with the following structure:
{
    "_id": "52cdef7c4bab8bd675297d8e",
    "name": "Facebook",
    "offices": [{
        "description": "Headquarters",
        "address1": "1601 Willow Road",
        "address2": "",
        "zip_code": "94025",
        "city": "Menlo Park",
        "state_code": "CA",
        "country_code": "USA",
        "latitude": 37.41605,
        "longitude": -122.151801,
        "location": {
            "type": "Point",
            "coordinates": [-122.151801, 37.41605]
        }
    }, {
        "description": "Europe HQ",
        "address1": "",
        "address2": "",
        "zip_code": "",
        "city": "Dublin",
        "state_code": null,
        "country_code": "IRL",
        "latitude": 53.344104,
        "longitude": -6.267494,
        "location": {
            "type": "Point",
            "coordinates": [-6.267494, 53.344104]
        }
    }, {
        "description": "New York",
        "address1": "340 Madison Ave",
        "address2": "",
        "zip_code": "10017",
        "city": "New York",
        "state_code": "NY",
        "country_code": "USA",
        "latitude": null,
        "longitude": null,
        "location": {
            "type": "Point",
            "coordinates": [null, null]
        }
    }]
}

I would like to create a geospatial index on the location field:
db.startups.createIndex( { "offices.location" : "2dsphere" } )

However, some of the offices longitude and latitude are null values so that index creation fails with Point must only contain numeric elements.
My question is how I should and/or could handle this problem.

A: Just drop the entire location for the offending element:
"location": {
    "type": "Point",
    "coordinates": [null, null]
}


text:
Q: Find expectation of $\frac{X_1 + \cdots + X_m}{X_1 + \cdots + X_n}$ when $X_1,\ldots,X_n$ are i.i.d
Let $X_1, \ldots, X_n$ be i.i.d. random variables with expectation $a$ and variance $\sigma^2$, taking only positive values. Let $m < n$. Find the expectiation of $\displaystyle\frac{X_1 + \cdots + X_m}{X_1 + \cdots + X_n}$.

My attemps to solve this probles are rather straightforward. Denote $X = X_1 + \cdots + X_m$ and $Y = X_{m+1} + \dots + X_n$. So, $X$ has the expectation $ma$ and the variance $m\sigma^2$. And $Y$ has the expectation $(n-m)a$ and variance $(n-m)\sigma^2$. And also $X$ and $Y$ are independent. So we can compute the expectation by the definition $\mathbb{E}\displaystyle\frac{X}{X+Y} = \int\limits_{\Omega^2}\frac{X(\omega_1)}{X(\omega_1) + Y(\omega_2)}\mathbb{P}(d\omega_1)\mathbb{P}(d\omega_2)$. But we do not know the distribution, so we do not have chance to calculate it.
I would be glad to any help or ideas!

A: Suppose $S_m=\sum\limits_{i=1}^{m} X_i$ and $S_n=\sum\limits_{i=1}^n X_i$.
Now, $$\frac{X_1+X_2+\cdots+X_n}{S_n}=1\,, \text{ a.e. }$$
Therefore,
$$ \mathbb E\left(\frac{X_1+X_2+\cdots+X_n}{S_n}\right)=1$$
Since $X_1,\ldots,X_n$ are i.i.d (see @SangchulLee's comments on main), we have for each $i$,
$$\mathbb E\left(\frac{X_i}{S_n}\right)=\frac{1}{n}$$
So for $m\le n$,   $$\mathbb E\left(\frac{S_m}{S_n}\right)=\sum_{i=1}^m \mathbb E\left(\frac{X_i}{S_n}\right)=\frac{m}{n}$$


text:
Q: exporting a specific row from CSV using csvsimple What is the best way to obtain a specific row (or a subset of row) when I use csvsimple?
⧵csvreader[head to column names]{filename.csv}{}{}
For example, I would like to get only row three from the filename.csv.

A: You can use
\csvreader[head to column names, filter test = \ifnumequal{\thecsvinputline}{x},]

where x denotes the integer number of a particular row.


text:
Q: Mini DisplayPort to HDMI cable vs. adapter - for MBP mid-2012 I've been using a Mini DisplayPort to HDMI adapter to connect to an external monitor for over a year. It stopped working yesterday and I am about to replace it. However, I noticed there are Mini DisplayPort to HDMI cables on Amazon, as well. The cable's length, either 3 or 6 feet, may be useful to me. That said, I have 2 HDMI cables already, so getting another cable may just be a waste of space (pricing is roughly the same, as far as I can tell).
So, what difference, if any, is there between the Mini DisplayPort to HDMI adapter vs. the Mini DisplayPort to HDMI cable? Thank you.

A: The only difference is that with the adapter you can use an existing HDMI cable you might have, and thus save some cost and have flexibility in changing the length of the cable later.


text:
Q: AngularJS $routeParams resolve and promises So... I'm trying to learn some Angular stuff and then I reached a point where I'm stuck. In my app I'm using third party APIs so I cannot rely on $http, that's why you'll see $apply in the code.
So, basically I have this:
.when('/dashboard',{
  controller : 'DashboardController',
  templateUrl : 'ui/modules/dashboard/dashboard.html',
  resolve : {
    data : function(myService){
      return myService.start();
    }
  }
})

So far nothing really strange. That method supposedly have a promise, right? The start function is as follows:
var start = function(){
  return initializeConnection().then(function(){
    return login(false);
  });
};

So, basically, if everything works, all works. That's great. The thing is that, if I get promise rejection on the second function (that's login) I'm not able catch the error in this, which is my AppController which is created on top of the app (so it's always being instantiated):
$rootScope.$on("$routeChangeError", function (event, previous, current, rejection) {
  console.log('Failing');
});

That's basically never called. A solution I tried that works, is to return a promise from the start function, then if any of those async functions fails, fail the returned promise. But as I see it, it should be unnecesary.
Can you point me in the right direction?

A: In your code, if you get promise rejection the DashboardController is never instantiated and your view is never loaded - so not much you can do there. You need to have a controller that will be instantiated even if your promise is rejected.
I think you could create a controller just to handle global events like $routeChangeError. I've created one below called checkConnection and it will be assigned to the root element of the app .
var myApp = angular.module('myApp', []);

myApp.config(function($routeProvider){
  $routeProvider
    .when('/dashboard',{
      controller : 'DashboardController',
      templateUrl : 'ui/modules/dashboard/dashboard.html',
      resolve : {
        data : function(myService){
          return myService.start();
        }
      }
    })
});

myApp.controller('checkConnection', function ($rootScope){
    $rootScope.$on("$routeChangeError", function (event, previous, current, rejection) {
      console.log('Failing');
    });
});

myApp.controller('DashboardController', function($rootScope) {
    // code for your controller goes here
});

And in your index.html you will have:
<div ng-app="myApp" ng-controller="checkConnection">
    <ng-view></ng-view>
</div>

The controller checkConnection is going to be instantiated anyway - so you can rely on that to handle the error.
If no error happens then the specific controller (e.g: DashboardController) for the route you are accessing will be executed normally and your view will be loaded.
There are room for improvements but I think that could work for you.
Hope that helps or at least point you to the right direction.


text:
Q: Wikidata entity value from name Is there a way to get Wikidata page information based on the name of the entity for example if I wanted to get page data for Google.
I think it has to be done using "entity" with the corresponding entity value however I am not sure of there is any easy way to determine the entity value.

A: Maybe you can use sparql, to run a query:
SELECT ?item WHERE {
  ?item rdfs:label "Google"@en
}

You can use in python using pywikibot:
 import pywikibot
 from pywikibot import pagegenerators, WikidataBot

 sparql = "SELECT ?item WHERE { ?item rdfs:label 'Google'@en }"
 entities = pagegenerators.WikidataSPARQLPageGenerator(sparql, site=repo)
 entities = list(entities)

A: If you want to do this using the API, you would first use wbsearchentities to find out which entity do you want. For example:
https://www.wikidata.org/w/api.php?action=wbsearchentities&search=Google&language=en
The problem with this is that there are multiple entities called "Google": the company (Google Inc.), the search engine (Google Web Search), the verb (to google) and even a Wikipedia disambiguation page.
After you somehow decide which entity to access, use wbgetentities to actually get the information you want:
https://www.wikidata.org/w/api.php?action=wbgetentities&ids=Q95&languages=en
Or, if you can't decide which entity to use, you could get information for all of them at the same time:
https://www.wikidata.org/w/api.php?action=wbgetentities&ids=Q95|Q9366|Q961680|Q1156923&languages=en

A: If you are familiar with Python you could do it programmatically with the Wikidata api, using Pywikibot The following python script, obtains the wikidata entities. If you want the data objects for each individual wikidata entity, you need to uncomment the last two lines
 from pywikibot.data import api
 import pywikibot
 import pprint

 def getItems(site, itemtitle):
     params = { 'action' :'wbsearchentities' , 'format' : 'json' , 'language' : 'en', 'type' : 'item', 'search': itemtitle}
     request = api.Request(site=site,**params)
     return request.submit()

 def getItem(site, wdItem, token):
    request = api.Request(site=site,
                          action='wbgetentities',
                          format='json',
                          ids=wdItem)
    return request.submit()

def prettyPrint(variable):
    pp = pprint.PrettyPrinter(indent=4)
    pp.pprint(variable)

# Login to wikidata
site = pywikibot.Site("wikidata", "wikidata")
repo = site.data_repository()
token = repo.token(pywikibot.Page(repo, 'Main Page'), 'edit')
wikidataEntries = getItems(site, "Google")
# Print the different Wikidata entries to the screen
prettyPrint(wikidataEntries)

# Print each wikidata entry as an object
#for wdEntry in wikidataEntries["search"]:
#   prettyPrint(getItem(site, wdEntry["id"], token))

which results in
{   u'search': [   {   u'aliases': [u'Google Inc.'],
                       u'description': u'American multinational Internet and technology corporation',
                       u'id': u'Q95',
                       u'label': u'Google',
                       u'url': u'//www.wikidata.org/wiki/Q95'},
                   {   u'aliases': [u'Google Search', u'Google Web Search'],
                       u'description': u'Internet search engine developed by Google, Inc.',
                       u'id': u'Q9366',
                       u'label': u'Google',
                       u'url': u'//www.wikidata.org/wiki/Q9366'},
                   {   u'description': u'Wikipedia disambiguation page',
                       u'id': u'Q961680',
                       u'label': u'Google',
                       u'url': u'//www.wikidata.org/wiki/Q961680'},
                   {   u'aliases': [u'Google'],
                       u'description': u'verb',
                       u'id': u'Q1156923',
                       u'label': u'google',
                       u'url': u'//www.wikidata.org/wiki/Q1156923'},
                   {   u'id': u'Q10846831',
                       u'label': u'google',
                       u'url': u'//www.wikidata.org/wiki/Q10846831'},
                   {   u'aliases': [u'Google Android'],
                       u'description': u'operating system for mobile devices created by Google',
                       u'id': u'Q94',
                       u'label': u'Android',
                       u'url': u'//www.wikidata.org/wiki/Q94'},
                   {   u'description': u'web browser developed by Google',
                       u'id': u'Q777',
                       u'label': u'Google Chrome',
                       u'url': u'//www.wikidata.org/wiki/Q777'}],
    u'searchinfo': {   u'search': u'Google'},
    u'success': 1}


text:
Q: fwrite portability Is fwrite portable? I'm not really faced to the problem described below but I'd like to understand the fundamentals of C.
Lest assume we have two machines A8 (byte = 8bits) and B16 (byte = 16 bits).
Will the following code produce the same output on both machines ?
unsigned char[10] chars;
...
fwrite(chars,sizeof(unsigned char),10,mystream);

I guess A8 will produce 80 bits (10 octets) and B16 will produce 160 bits (20 octets).
Am I wrong?
This problem won't appear if only uintN_t types were used as their lengths in bits are independent of the size of the byte. But maybe uint8_t won't exist on B16.
What is the solution to this problem?
I guess building an array of uint32_t, putting my bytes in this array (with smart shifts and masks depending on machine's architecture) and writing this array will solve the problem. But this not really satisfactory.There is again an assumption that uint32_t exists on all platforms.The filling of this array will be very dependant on the current  machine's architecture.
Thanks for any response.

A: fwrite() is a standard library function. So it must be portable for each C compiler.
That is it must be defined in C standard library of that compiler to support your machine.
So machine of 8bit, 16 bit, 32 bit give you same high level operation.
But if you want to design those library function then you have to consider machine architecture, memory organization of that machine.
As a C compiler user you should not bother about internal behavior.
I think you just want to use those C library function. So no difference in behavior of the function for different machine.

A: A byte is on almost every modern computer 8 bits. But there is an other reason fwrite isn't portable:
A file which was written on a Little Endian machine can't be readed by a big endian machine and other way.

A: In C, char is defined as "smallest addressable unit of the machine". That is, char is not necessarily 8 bits.
In most cases, it's safe enough to rely on a fact that char is 8 bits, and not to deal with some extreme cases.
To speak generally, you probably won't be able to write "half of a byte" to a file on a storage. Additionally, there will be issues with portability on hardware level between devices which are designed to work with different byte size machines. If you are dealing with other devices (such as telecom or stuff), you will have to implement bit streams.


text:
Q: Non-deterministic conversion from scientific notation to decimal Trying to convert a scientific notation in Spark (PySpark and SQL) and I seem to get really weird, non-deterministic results.
I've even tried to revert to using value times power(10,x) instead of valueEX, however I still get the same issue, where 3 different values are converted to the same value.
Is this some kind of scale setting in the actual conversion? Is this a thing with the Java underneath Spark?

SELECT CAST(3.57080748200000147E17 AS DECIMAL(18,0))
union all
SELECT CAST(3.570807482000001E17 AS DECIMAL(18,0))
union all
SELECT CAST(3.5708074820000013E17 AS DECIMAL(18,0))

SELECT CAST(3.57080748200000147*power(10,17) AS DECIMAL(18,0))
union all
SELECT CAST(3.570807482000001*power(10,17) AS DECIMAL(18,0))
union all
SELECT CAST(3.5708074820000013*power(10,17) AS DECIMAL(18,0))

A: I can see that you're left with 17 significant digits. I used to have this same problem working with Python.
In a nut shell, double precision floating point numbers are created out of what you provide to the programming language. They have 16-17 significant digits. So, even before cast, your number is already changed. It's a normal thing, as people usually don't deal with such high precision numbers.
One way around it would be using strings instead of numbers. Then, after casting, you should get correct value. Also, when working with Python, there's a decimal library dedicated to deal with decimal numbers.


text:
Q: Automatically scroll down page I am trying to get a specific div on my page to automatically start scrolling down, then back up once the page loads.
I have this written for my javascript:
<script> function scroll(speed) {
$('#scrollingcontent').animate({ scrollTop: $(document).height() - $(window).height() }, speed, function() {
    $(this).animate({ scrollTop: 0 }, speed);
});
}

speed = 1000;

scroll(speed)
setInterval(function(){scroll(speed)}, speed * 2);</script>

Chrome is telling me that I have a reference error, and that $ is not defined.
My div that i want animated has the id of scrollingcontent.
Thanks for any help!

A: Check whether you have attached jQuery properly or not.
<head>
<script src="jquery-1.11.1.min.js"></script>
</head>

More : - http://www.w3schools.com/jquery/jquery_install.asp
Hope this helps. Cheers!


text:
Q: My code segfaults when compiled as shared object, works fine as standalone binary I have a vexing C++ problem. I've got a huge, complex wedge of code which is compiled into a Linux shared object. When it goes through one specific code path, it segfaults. (Basically one of the STL iterators seems to point a few bytes to the side of where it should.) But, if I #include all the code into one giant source file and compile it into a stand-alone program, everything works perfectly.
How do I even begin to debug this? The problem appears to not be a source-level problem, but (I guess?) some kind of weird linker issue. I'm completely lost. (I thought STL was all compile-time stuff...)
In case it matters, the SO is compiled like so:
g++ -m64 -c -D_CONSOLE -D__UNICODE__ -fPIC -O0 -g -D_DEBUG -D_GLIBCXX_DEBUG <name> -o <name>.o
g++ -m64 -shared -o MangoLib.so <objects...>

The stand-alone consists of a small driver program with a bunch of #include directives, built like so:
g++ -m64 -fPIC -O0 -g -D_DEBUG -D_GLIBCXX_DEBUG Test.cpp -o Test

I don't think I did anything wrong here... but the SO segfaults every single time, so I guess I did? I don't know what to do now.

A: I would start to check the usage of global variables and static initializers. The order of these things happening is not well defined AFAIK. Every global variable or static initializer that more complicated than "just fill this memory with 0 bits" should be suspect. Several static initializers referencing each other is basically a no go.


text:
Q: What permissions are needed to do an LDAP bind to an Active Directory Server What permissions are needed to perform an LDAP bind to an active directory server?   I have a central domain (call it MAIN) that has two-way trusts to domains in other forests (call then REMOTE and FARAWAY)
Using MAIN\myaccount as the username and my password I can bind to REMOTE fine, but not to FARAWAY; I get an invalid credentials response
80090308: LdapErr: DSID-0C09030B, comment: AcceptSecurityContext error, data 525, v893

In all other ways the trusts seem to work fine.
What permissions do I need to check to figure out why the bind is failing?  My understanding is that anyone in AUTHENTICATED USERS should be able to bind to LDAP, but that only seems to hold true for some domaians and not others.

A: Error 49, subtype 525 is bad user DN.  I.e. The bind DN is not a valid object in the directory.

A: Error 525 is actually a DN not being found, you can take a look at this thread on the Oracle forums : http://forums.sun.com/thread.jspa?threadID=703398

A: Your error isn't that you don't have permission to bind, but that you are binding to a non-existent DN. Please be aware that LDAP DNs do not look like Active Directory usernames, but that they use a different format.


text:
Q: Finding clashes in Access I have two columns in a table; Date and Session. Date is in the format dd/mm/yyyy and session can either be 1 or 2.
What I want to do is make a query that produces a table in which, one date that has two or more of the same session. An example will make it clearer:
DATE          SESSION
28/01/2015     2
06/02/2015     1
28/01/2015     2
etc...

It should return the two rows with 28/01/2015 in since they both have the same Session.

A: 'Date' is a reserved word and should be avoided. I assume that 'Sessions' is text, not number. So try this:
SELECT tblTest.MyDt, Count(tblTest.Session) AS CountOfSession
FROM tblTest
GROUP BY tblTest.MyDt
HAVING (((Count(tblTest.Session))>1));

Was this helpful?


text:
Q: How can I make separator in Tkinter fill whole window height? I want to place separator that goes from top of the window to bottom on specific place with .place() function. When I do it like that, separator is just a little dot. I managed to do it with .pack() function but then it's not on desired place. I searched on internet but I couldn't find solution that uses .place(), only .pack() and .grid().
It's just a dot instead of line from top to bottom.
from tkinter import *
from tkinter import ttk

App = Tk()

ttk.Separator(App, orient=VERTICAL).place(x=275, y=0)

App.mainloop()

Is it possible to do it with .place() and if it is (probably is) how?
I'm using Python 3.6

A: The easiest solution I know of is to specify height= in pixels on place() call:
from tkinter import *
from tkinter import ttk

App = Tk()
App.geometry('1000x100')

ttk.Separator(App, orient=VERTICAL).place(x=275, y=0, height=100)

App.mainloop()

It would also be possible to pair it with automatical height detection:
from tkinter import *
from tkinter import ttk

App = Tk()
App.update()

ttk.Separator(App, orient=VERTICAL).place(x=50, y=0, height=App.winfo_height())

App.mainloop()

And, to update dynamically:
from tkinter import *
from tkinter import ttk

App = Tk()

sep = ttk.Separator(App, orient=VERTICAL)
sep.place(x=50, y=0, height=App.winfo_height())

App.bind('<Configure>', lambda e: sep.place(x=50, y=0, height=App.winfo_height()))

App.mainloop()

Hope that's helpful!


text:
Q: Howto check if first 6 position in received file match on first line or second line in Groovy I want to check in groovy if the first 6 characters on line 1 or line 2 match the text 'ABCDEFG'. How will I do this in Groovy?
def testfile = '''
FEDCBAAVM654321
ABCDEFMVA123456
'''

if ( testfile[0..6].equals("ABCDEF") ) {
    // First line starts with ABCDEF
}

if ( testfile.tokenize("\n").get(1)[0..6].equals("ABCDEF") ) {
    // Second line starts with ABCDEF
}

It should be something like above or the test may be done in one line if possible.

A: You can use:
def testfile = '''FEDCBAAVM654321
                 |ABCDEFMVA123456
                 '''.stripMargin()

testfile.tokenize( '\n' )                     // split on newline
        .take( 2 )                            // take the first two lines
        .every { it.startsWith( 'ABCDEF' ) }  // true if both start with ABCDEF

or
testfile.tokenize( '\n' )                  // split on newline
        .take( 2 )                         // take the first two lines
        .any { it.startsWith( 'ABCDEF' ) } // true if either or both start ABCDEF


text:
Q: iPad Icon names? Do I have to put 2 icon images in my build for iPad? and what are the names of those 2 build, one is Icon.png and what is the other one?
Thanks for all your help

A: For iPhone apps you need to provide a 57x57 Icon.png and may optionally provide a 29x29 Icon-Small.png.
To submit to AppStore you need a 512x512 icon too.
There's no special requirement for iPad. A 57x57 Icon.png is sufficient. Although you can add a larger 72x72 icon and add it into the CFBundleIconFiles key. (See How do I specify both icons for a universal iPhone/iPad app?.)

A: The default name for an iPad icon is Icon-72.png. You do not currently need two icons for iPad submissions, though there are in fact a dozen other icon sizes that a "complete" app should contain.


text:
Q: What is the default fontsize, fontname and shadow for titles in Navigation Bar? I'm trying to have a button on the self.navigationItem.rightButton that toggles a segmented control that is placed in self.navgivationItem.titleView .. this will however remove the title that is first set by self.title when the navbar is created .. I dont know if my approach is bad but I figured I could rotate between a UILabel and the Segmented Control in the titleView.
It works as I would like it to, however I cant figure out what size and font and shadowoffset and shadowcolor the default titles in a navigation bar is .. could you help me with a solution that either not force me to override the navigationItem.titleView or help me figure out the information needed to make a UILabel look exactly like the default titles.
Thankful for any help.

A: In code, something along the lines of:
http://www.iphonedevsdk.com/forum/iphone-sdk-development/11648-change-uisegmentedcontrol-font-size.html
should help, except you'll be querying the size, name etc. of the UILabel.


text:
Q: como saber si un documento que estoy por ingresar en mongodb ya existe? necesito saber si ha alguna manera de poder verificar si un documento existe antes de guardarlo en mongodb a travez de mongoose
const newSchema = new Schema({
  usuario: [{
    type: Schema.Types.ObjetId,
    ref: 'usuarios
  }],
  de: {type: String, require: true}
)}

habra algun metodo para verificar si hay un documento con los mismos datos que se estan por ingresar??


text:
Q: How to export multiple html tables into a single excel worksheet side by side? I have searched google and seen many stackoverflow questions but they had the functions to export multiple html tables to different worksheets in the same excel file.
But what I want is to export multiple html tables to same worksheet in one excel file side by side.
I did get a function made by a stackoverflow user which exports multiple tables to different worksheets in the same excel file. I tried to modify it but I am not able to.
the function link: How to convert html table to excel with multiple sheet?
the one answered by user Butani Vijay


text:
Q: Can I use a breakpoint in a notification listener of a GarbageCollectorMXBean I have registered notification listeners to the GarbageCollectorMXBeans.  I can see that they work, because they log but I want to understand why I cannot debug them, i.e., a breakpoint in my notification listener is not hit.
The log tells me that the listener is called on a thread called "Service Thread".  This thread does not show if I look at all the threads running, so I assume it is a private Jvm thread of some sort.  Is it possible to debug this thread with breakpoints?


text:
Q: Rails best practice question: Where should one put shared code and how will it be loaded? The rails books and web pages I've been following have all stuck to very simple projects for the sake of providing complete examples.  I'm moving away from the small project app and into a realm of non-browser clients and need to decide where to put code that is shared by all involved parties.
The non-browser client is a script that runs on any machine which can connect to the database.  Browser clients write commands into the database, which the script examines and decides what to do.  Upon completion, the script then writes its result back.  The script is not started by the RoR server, but has access to its directory structure.
Where would be the best place for shared code to live, and how would the RoR loader handle it?  The code in question doesn't really belong in a model, otherwise I'd drop it in there and be done with it.

A: I'd put the shared code in the Rails project's /lib directory and consider making it a custom Rake task.

A: It really depends on how much you use this shared code. If you use it everywhere, then throw it in the lib folder (as has already been stated here). If you are only using it in a few places, you might want to consider making a plugin out of it and loading it only in the places that use it. It's nice to only load what you need (one of the reasons I'm loving merb).


text:
Q: How do I get frames one by one from the video in Qt framework? I got a video input with QMediaPlayer and then I wanted to read frames one by one and process all frames with other vision algorithms. But I didn't know how do I get frames one by one from the video and access each pixel of the frame...
In OpenCV library, I'm easily able to solve that problem with cv::VideoCapture and cv::Mat.
cv::VideoCapture capture(filename);
cv::Mat img;

capture >> img; // 'img' contains the first frame of the video.
capture >> img; // 'img' contains the second frame of the video.

If someone has already handle with this kind of problem, please help me.
Thanks a lot.

A: You could write your own implementation of the QAbstractVideoSurface and override its
present method to handle the video frame by frame.
Then you will have to set the video output of the QMediaPlayer via  setVideoOutput.
For details how to access the frame data you should consult the QVideoFrame documentation.

A: A suggestion: you could use OpenCV. That would make things easier to play videos and process them without QImage->Mat conversion.
In order to process videos with OpenCV + Qt you must create a QThread connected to a QTimer signal. The QTimer signal emits every few milliseconds signals to a slot in the worker thread to fetch the next video frame from VideoCapture and work on the data.


text:
Q: What is the origin of the word "Blackmail"? How did the word blackmail originate?
The words 'black' and 'mail' (if you split it out) have no relation to the meaning of the combined word. How was the word choice made?
Also, how has the term's meaning evolved from its original sense, and when did those changes occur?

A: Robert Hendrickson, The Facts on File Dictionary of Word and Phrase Origins (1997) has this:

blackmail Sixteenth-century Scottish farmers paid their rent, or mail, to English absentee landlords in the form of white mail, silver money, or black mail, rent in the form of livestock or produce. The term black mail took on a bad connotation only when greedy landlords forced cashless tenants to pay much more in goods than they would have paid in silver. Later, when freebooters along the border demanded payment for free passage and "protection," the poor farmers called this illegal extortion blackmail, too.

Curiously, the term blackmail doesn't appear in Francis Grose, A Classical Dictionary of the Vulgar Tongue (1796), despite its criminal/underworld overtones. It does, however, show up in John Russell Bartlett, Dictionary of Americanisms (1848):

BLACK-MAIL. Formerly, money paid to men allied with robbers to be protected by them from being robbed. —Cowell. In the United States it means money extorted from persons under the threat of exposure in print, for an alleged offence, or defect.

So in the United States, by 1848, blackmail already had very nearly its present-day meaning.
With regard to the origin of the term mail in the sense of "payment," John Ayto, Arcade Dictionary of Word Origins (1990), says this:

English once had a third word mail, meaning 'payment, tax' [12(th century)]. It was borrowed from Old Norse mál 'speech, agreement.' It now survives only in blackmail [16(th century)].

The other two words spelled mail that Ayto covers have the meanings "chain-armour" and "post" (derived from an old High German word for "bag or pouch").
--------------------------------------------------------------------------------------------------------------------
Additional Investigation
The original meaning of blackmail is less clear-cut than Hendrickson (above) suggests. Indeed, the Online Etymology Dictionary ignores the "tenant's rent" meaning almost entirely in its historical summary of how the term was first used:

From the practice of freebooting clan chieftains who ran protection rackets against Scottish farmers. Black from the evil of the practice. Expanded c.1826 to any type of extortion money. Cf. silver mail "rent paid in money" (1590s); buttock-mail (Scottish, 1530s) "fine imposed for fornication."

Nevertheless, the "tenant's rent" meaning was clearly an early sense of the term. Here are some related entries from Black's Law Dictionary, Revised Fourth Edition (1968):

BLACKMAIL. In one of its original meanings, this term denoted a tribute paid by English dwellers along the Scottish border to influential chieftains of Scotland, as a condition of securing immunity from raids of marauders and border thieves.
Also, rents payable in cattle, grain, work, and the like. Such rents were called "blackmail," (reditus nigri,) in distinction from white rents, (blanche firmes,) which were rents paid in silver. See Black rents.
The extortion of money by threats or overtures towards criminal prosecution or the destruction of a man's reputation or social standing.

Here is the related entry for black rents:

BLACK RENTS. In old English law. Rents reserved in work, grain, provisions, or baser money than silver, in contradiction to those which were reserved in white money or silver, which were termed "white rents," (reditus albi,) or blanch farms. ... See Blackmail.

And finally, here is the entry for the Latin term:

REDITUS NIGRI. Black rent, black mail; rent payable in provisions, corn, labor, etc.; as distinguished from "money rent," called "reditus albi."

Corroborating the reporting in Black's Law Dictionary is this entry from Giles Jacob, A New Law-Dictionary (1729):

ARGENTUM ALBUM, Silver Money, or Pieces of Bullion that antiently passed for Money. By Domesday Tenure, some Rents in Libris Ursis & Pansatis, in Metal of full Weight and Purity : In the next Age, that Rent which was paid in Money, was called Blanch-fearm; and afterwards White Rent ; and what was paid in Provisions was termed Black Mail.

However, this same source, in its main entry for "Black-Mail," makes clear that blackmail in the (relatively) benign sense of rents paid in something other than money was already a thing of the past:

And Black-Rents are the same with Black-Mail ; being Rents formerly paid in Provisions and Flesh.

Most of this dictionary's entry for "Black-Mail" is devoted to the crime of extortion:

Black-Mail, ... Signifies in the North of England, in the Counties of Cumberland, Northumberland, &c, a certain Rent of Money, either of Money, Corn or other Thing antiently paid to Persons inhabiting upon or near the Borders, being Men of Name and Power, ally'd with certain Robbers within the said Counties ; to be freed and protected from the Devastations of those Robbers.

In its main entry for "Black-Mail," Jacobs cites An act for the more peaceable government of the parts of Cumberland, Northumberland, Westmorland, and the bishoprick of Duresme (1601), a law in Queen Elizabeth's reign outlawing the practice of protection-payment blackmail. I should note, too, that Jacobs's New Law-Dictionary only slightly revises the wording present in the 1708 update of John Cowell, A Law Dictionary: or, the Interpreter, which itself goes back in earlier editions to 1607, though I can't say how far back the relevant content in Jacobs and in the 1708 update of Cowell goes.
Returning to more-modern assessments of the original meaning of blackmail, we have Merriam-Webster, Webster's Word Histories (1989), which starts by seeming to affirm the Online Etymology Dictionary's version of events, but then vaguely acknowledges that the black in blackmail might have come into existence as a contrast to white payment (that is, payment in silver). Still Webster's doesn't show any awareness of the use of blackmail as a standard legal term for written or oral tenancy contracts between tenant farmers and their landlords:

blackmail Life was unfair for seventeenth-century Scottish farmers. Not only did they have to struggle to cultivate their land and produce good crops, but they also had to contend with corrupt chiefs who forced them to pay for protection of their land. If a farmer didn't pay the protection fee, these same extortionists would destroy his crops. It is this corrupt practice, not the post office, that has given us our word blackmail.
The mail of blackmail comes from a Scottish word meaning 'rent'. The black in blackmail probably derives from an age-old association between the color black and evil or "dirty deeds." It could also have something to do with the fact that the tribute paid by the farmers was in the form of cattle rather than in silver coin, known as "white money."

Yet another theory is floated in Ernest Weekly, An Etymological Dictionary of Modern English (1921):

Blackmail, orig[inally] tribute paid by farmers to freebooters (Sc[otland] and North [England] is Sc[ottish] mail (still used of rent).... It was perh[aps] called black because often paid in black cattle, rents paid in silver being called white mail.

One can only speculate how confusing things would have been if Scottish farmers had raised proto-Charolais cattle instead of proto-Angus.
My impression from all of these sources is that many of the more-recent ones were either unaware or not fully aware of the legal meaning of blackmail in old English law—which envisioned a contract that was no more coercive than any other contemporaneous landlord-tenant contract was likely to be. Whether blackmail as "protection money" came earlier than blackmail as "tenant's rent paid in kind" is unclear from these sources. All we can say confidently is that blackmail was being used in the sense of extortion no later than 1601 in English law, and that blackmail in the sense of legitimate rent was already deemed a practice of former times in 1708.  Still, it would be rather odd to take a term associated with criminal behavior and use it to describe a lawful contractual relationship, whereas the co-optation of the noncriminal sense of the term by people intending it in a later criminal sense raises no such objections (in my mind, anyway).
It is certainly possible that the two terms arose independently of one another. It is also quite possible that blackmail (legitimate rent) is the source of blackmail (extortion), and somewhat less plausible that blackmail (extortion) begat blackmail (legitimate rent).

A: The first element black is indeed related to the word's meaning.  It is quite common to liken black to evil and white to good, black to immorality and white to purity, et cetera.  The idea is that the act of blackmail is a reprehensible thing to do.
The second element mail comes from Middle English male 'rent, tribute'.
The evidence suggests that to blackmail (someone) is literally to exhort tribute by immoral means.


text:
Q: How to find the intersection of the graphs of $y= x^2$ and $y = 6 - |x|$? I was trying to solve this question in preparation for the Math subject GRE exam:

The region bounded by the graphs of $y=x^{2}$ and $y=6-|x|$ is revolved around the $y$ -axis. What is the volume of the generated solid?
(A) $\frac{32}{3} \pi$
(B) $9 \pi$
(C) $8 \pi$
(D) $\frac{20}{3} \pi$
(E) $\frac{16}{3} \pi$

So first I was trying to find the intersection of the graphs of $y= x^2$ and $y = 6 - |x|.$   I did that by equating $ x^2 = 6 - |x|.$ Then I ended up having 2 equations which are $ x^2 - 6 + x = 0 $ and $ x^2 - 6 - x = 0 $, and then I got four values of $x$, which are $\pm 3, \pm 2.$ But I found in the answer for the question that they consider only the two values $\pm 2.$
Could anyone show me what is wrong in my solution or in the book solution (the book just gave me the values $\pm 2$ without explaining how and why), please?

A: The solutions should be ($x^2-6+x=0$ and $x\ge0$) or ($x^2-6-x=0$ and $x\le0)$.
Can you take it from here?

A: No need to define cases: as $|x|^2=x^2$, you only need to find the nonnegative roots of the equation
$$ t^2+t-6=0.$$
(Vieta's relations show it has a positive and a negative root) and deduve the values of $x$.


text:
Q: Left Join in Entity Framework 3.5 I am trying to left join on entity frame work 3.5 but i am unable to do so...
from i in
    (from ta in context.test_attempt
     join uf in context.user_flag on ta.users.USERID equals uf.UserID)
select i;

I want to use left join instead to join?

A: You need to use DefaultIfEmpty() for an outer join:
from ta in context.test_attempt
join uf in context.user_flag on ta.users.USERID equals uf.UserID into g
from uf in g.DefaultIfEmpty()
select new { ta, uf }

Your outer from/select above is unnecessary, just project ta and uf into what you need.

A: You will find examples of different LINQ joins here: http://code.msdn.microsoft.com/LINQ-Join-Operators-dabef4e9 and loads of other LINQ examples too.

A:
Entity framework in .NET 3.5 doesn't offer left join in Linq queries.
  The way to get "joined records" is through navigation property between
  entities

From here: Left Outer Join in Entity Data Model asp.net


text:
Q: Windows 7 partition shows as "Unknown" in disk part / Windows Recovery So I have a lot going on here, unfortunately. I'm trying to work through the issues but I've found myself stuck. I THINK that the issue in the title is now my problem as I have been able to fix my EFI boot partition, and from my untrained eye things appear to be correct, but I've noticed that my windows partition shows as 'unknown' in disk part and perhaps that is why my win7 is now getting stuck forever at the windows boot logo.
Since I'm a new user I cannot post more than two links, I've edited the URL's so that they can be posted.
My original issue was posted here (for background) -
https://answers.launchpad.net/ubuntu/+question/293607
Since then, I've done a number of things, such as running Easy Recovery Essentials from NeoSmart, and obviously the windows recovery boot repair, endlessly along with ubuntu boot-repair in 16.02 LTS. A quick note, 14.02 LTS i saw a EFI error on boot, so i was thinking maybe that boot-repair wouldn't be able to correctly repair things unless the live cd was correctly launched in EFI mode. The same with recovery essentials, when i boot the cd it doesn't give me the UEFI option for booting the cd, so perhaps that also wont work for my EFI situation? My windows 7 does show UEFI at the boot and I did attempt to do all of the bootrec.exe commands in windows recovery cmd. The only part I could not do was the bootsect.exe /nt60 SYS /mbr command from this guide -
https://neosmart.net/wiki/fix-uefi-boot/#Fix_UEFI_Boot_in_Windows_7
Because it complained that I had to be in bios mode/non EFI mode to do it. When i booted win7 without UEFI, then win7 complained I cannot enter recovery environment because it needs to be EFI. Damned if you do, damned if you dont :) But my understanding is that EFI does not use a MBR so im not sure how that is a relevant fix anyways?
I went from not being able to see the OS, to resolving that part by changing the ID of my windows partition located here -
Issue with a Windows 7 Boot issue - involving the BCD perhaps
Now the windows recovery environment see's my OS, but its location is "(Unknown)" at the first screen and "Unknown" in the 'type' column in disk part.
My most recent boot-repair attempt is located here -
http://paste2.org/9Gb5sUWn
The boot summary info prior to that attempted repair is here -
http://paste2.org/7Xt9jNFs
I'm a little curious as to why my sda3 (windows install partition) was showing up as a EFI partition? In Gparted it shows as a ntfs partition, and I've of course ran all the chkdsk and other tools on it to ensure there's nothing wrong with it.
I'm thinking changing the ID of the partition might have screwed with things, but when i ran bootrec /rebuildbcd I think it should have fixed it? When I first did it, it did see the OS, but running bootrec /rebuildbcd it could not find the OS. Then I changed the ID on partition 3 and it found it.
I've also tried renaming bcd to bcd.old after changing attributes and then trying bootrec /rebuildbcd again, but it identifies "0" windows installations and I've noticed that there is no mounted windows OS during the windows recovery environment. Perhaps this is the issue? It see's the OS because at the very first screen after clicking 'repair windows' from the boot cd, it see's the OS (windows 7 professional) but just status location (Unknown).
I did all of that following this guide -
http://pcsupport.about.com/od/fixtheproblem/ht/rebuild-bcd-store-windows.htm
Maybe it needs to be mounted before I can repair it? Not sure. Losing my mind over this :(
Here is a picture of what disk part shows currently -

The last windows repair attempt I've tried says its unable to repair the system and under the diagnosis and repair details I see "A patch is preventing the system from starting." under the "Software installation log diagnosis" section (there's a lot more but they are all error 0x0 which seems like no issues found)
System Disk =\Device\Hardisk0
Windows directory = \\?\GLOBALROOT\Device\HardiskVolume3\Windows

If you guys need me to generate any information please just advise what to do and I will supply with as much diagnostic info as needed. And if anyone is wondering, the data is fine on the partition, I can mount and access my windows partition in ubuntu or other explorers and transfer the data etc.

A: It is unknown because you have entered an undefined partition type GUID.
What you have entered:

C12A7328-F81F-11D2-BA4B-00A0C93EC930

While the correct type GUID for EFI System partition is:

C12A7328-F81F-11D2-BA4B-00A0C93EC93B

(0 vs B at the end)
In any case, you should use the following type GUID:

EBD0A0A2-B9E5-4433-87C0-68B6B72699C7

which is Basic data partition in Microsoft Windows.
Since your disk is a GPT disk, you must use UEFI boot. There is no boot code from Windows that is capable of legacy booting a Windows installation on a GPT disk.
For UEFI boot, bootsect and bootrec is pretty much useless (except MAYBE bootrec /rebuildbcd), since UEFI boot is purely file-based (EFI binaries/executables), while bootsect/bootrec only deals with boot code on the MBR/boot sector.
If bootrec /rebuildbcd still doesn't help after you revert Partition 3 to Basic data partition, then you may consider bcdboot. You MIGHT want to delete \EFI\Microsoft under the ESP (Partition 1) first after you mount it with mountvol drive: /s (where drive: can be any available drive letter), or simply reformat it (FAT32) if it's not shared with Ubuntu or so. Then, run:

bcdboot X:\Windows

where X: is the drive letter of Partition 3 under the current environment (so check with diskpart or so first).
P.S. There is a high chance that the actual installation (on Partition 3) is broken or messed up. I suppose how to fix that depends on what error you see when you boot it (after you reinstall Windows Boot Manager and build a new BCD store with bcdboot X:\Windows from it).


text:
Q: SwiftUI - ScrollView won't me scroll to the bottom because of minus values in paddings I have a problem with scrollview content size or offset I don't know.
When I try to scroll view it return back me and stick to the top but as you can see I have button at the bottom of screen and want to scroll to the bottom of the view to see entire NEXT button.
Looks like content size is wrong:

Here is a repo with my code https://github.com/matrosovDev/swiftui
There is a WelcomeView component which include all code, but I will copy paste it here as well, probably using minus values for padding or offset leads to this scroll view content size or offset issue:
struct WelcomeView: View {

    @State private var password = ""
    @State var showWelcomeView = false
    @State var showActivityIndicator = false

    @EnvironmentObject var userService: UserService

    var body: some View {

        ZStack {
            Color.customLightGray
            if self.showActivityIndicator {
                VStack {
                    HStack {
                        Spacer()
                        LottieView(named: "19451-blue-preloader",
                                   loop: self.showActivityIndicator,
                                   size: 200
                        )
                        Spacer()
                    }
                }
            } else {

                ScrollView {

                    VStack {
                        Image("MountainWelcomBackground").resizable().frame(height: 300)

                        CircleImage(image: userService.user.image)
                            .padding(.top, -150)
                            .frame(height: 140)
                            .frame(width: 140)

                        VStack(alignment: .leading) {
                            HStack(alignment: .top) {
                                Spacer()
                                Text(userService.user.username)
                                    .font(.headline)
                                Spacer()
                            }
                        }
                        .padding(.top, -70)

                        VStack (alignment: .leading, spacing: 10) {

                            Text("Password:")
                                .font(.headline)

                            TextField("Enter your password", text: $password)
                                .padding(.all)
                                .font(Font.system(size: 18, weight: .medium, design: .rounded))
                                .overlay(RoundedRectangle(cornerRadius: 8).stroke(Color.customCorporateBlue, lineWidth: 1))
                                .foregroundColor(Color.customCorporateBlue)
                                .keyboardType(.emailAddress)
                                .autocapitalization(.none)

                            Button(action: {
                            }) {
                                Text("Forgot password?")
                                    .fontWeight(.bold)
                                    .font(.headline)
                                    .padding(EdgeInsets(top: 20, leading: 10, bottom: 20, trailing: 0))
                                    .foregroundColor(.customCorporateBlue)
                            }

                            HStack {
                                Button(action: {
                                }) {
                                    Text("Create account")
                                        .fontWeight(.bold)
                                        .font(.subheadline)
                                        .padding()
                                        .foregroundColor(.customCorporateBlue)
                                }

                                Spacer()

                                Button(action: {
                                    //self.showActivityIndicator.toggle()
                                    //self.fetchUser(with: self.email)
                                }) {
                                    Text("Next")
                                        .fontWeight(.bold)
                                        .font(.title)
                                        .padding(EdgeInsets(top: 20, leading: 40, bottom: 20, trailing: 40))
                                        .background(Color.customCorporateBlue)
                                        .cornerRadius(8)
                                        .foregroundColor(.white)
                                }

                                //NavigationLink(destination: WelcomeView(), isActive: $showWelcomeView) { EmptyView() }
                            }

                        }.padding(.horizontal, 30)
                            .modifier(AdaptsToKeyboard())
                            .padding(.top, -20)

                        Spacer()
                    }

                }.edgesIgnoringSafeArea(.top)
            }
        }
    }
}

A: It is due to many hardcoding which affect layout of different phones. For this specific use-case I would recommend the following simple solution.
Tested with partially replicated code (Xcode 11.4 / iOS 13.4 / iPhone8 / 11 Max)

// make height of top image relative to available screen space
VStack {
    Image("MountainWelcomBackground")
       .resizable()
       .frame(height: UIScreen.main.bounds.size.height / 3.0)


text:
Q: how to have many Material-ui modal in one page I'm using Next.js and Mateial-ui for my front end project and I want to have many modal on same page and open them separately, I've passing handleClickOpen() as props to my modal and it works good but I have some problem with z-index.
when the first one open I can't click on behind buttons to open the other modals.
function PaperComponent(props: PaperProps) {
    return (
        <Draggable handle="#draggable-dialog-title" cancel={'[class*="MuiDialogContent-root"]'}>
            <Paper {...props} />
        </Draggable>
    );
}

const [zIndex, setZIndex] = useState<number>(5000);
const [open, setOpen] = useState(false);
const handleClose = () => {
    setOpen(false);
};
const handleZIndex = () => {
    setZIndex(zIndex + 1)
}

<Button style={{
                textTransform: 'lowercase',
                width: '100%',
                minHeight: 100,
                marginBottom: '2px',
                padding: '-5px'
            }} variant="outlined" color="primary" onClick={handleClickOpen}>
                {simplifyStrategy(strategy)}
            </Button>

<Dialog
                open={open}
                onClose={handleClose}
                PaperComponent={PaperComponent}
                onClick={handleZIndex}
                disableEnforceFocus // Allows other things to take focus
                hideBackdrop  // Hides the shaded backdrop
                disableBackdropClick  // Prevents backdrop clicks
                aria-labelledby="draggable-dialog-title"
                maxWidth={'md'}
                fullWidth={true}
                style={{
                    top: '85%', // Position however you like
                    left: `${Math.floor(Math.random() * 100)} %`,
                    height: 'fit-content',  // Ensures that the dialog is
                    width: 'fit-content',   // exactly the same size as its contents
                }}
            >
</Dialog>


text:
Q: Theorem about monotone functions integration, a case when it is strictly augmenting function In the proof of the theorem, it is supposed, that for a function, which is monotone and integrable on the interval $[a,b],\ f(a) < f(b)$, and $\delta$ is chosen to be equal to $\frac{1}{2}\frac{\epsilon}{f(b)-f(a)}$
Then the question is whether $\sum_{i=1}^n (w_i(f)\Delta x_i )< \epsilon$,
where $m_i=\min f(x)=f(x_{i-1})$ and $M_i=\sup f(x)=\max f(x)=f(x_i)$ so that $w_i=M_i-m_i=f(x_i)-f(x_{i-1})$. In both cases, $x$ belongs to $[x_{i-1},x_i]$.
So, $\sum\limits_{i=1}^nw_i(f)\cdot\Delta x_i=\sum\limits_{i=1}^n(f(x_{i})-f(x_{i-1})\Delta x_i=\sum\limits_{i=1}^n(f(x_i)-f(x_{i-1})\delta$
My question is why $\Delta x_i$ is substituted with $\delta$ if the expression that $\delta$ concerns values of the given argument, not intervals of $x$. Please clarify if you can!

A: $\Delta x_i$ is chosen to be $\delta$ (or actually, anything not larger than $\delta$), so that the final sum can be estimated by
$$\delta\sum_{i=1}^nf(x_i)-f(x_{i-1})=\delta(f(x_n)-f(x_0))\leq \delta (f(b)-f(a))=\frac{\epsilon}{2}$$
by the definition of $\delta$.


text:
Q: Accordion inside Tab (foundation Framework) I have an issue with putting Accordion inside Tab.

Tab1

Year 1

Content of section 1.

Year 2

Content of section 2.

They appear but on click the accordion doesn't open. Is there is any way to make it?

A: You were missing the data-slug so that it knows what is opening what:

ROOT: Section 1

Content 1 Summary Paragraphs

DETAIL: #1

Detail awesome stuff!

DETAIL: #2

Detail awesome stuff numeroe duo.

ROOT: Section 2

Content 2

A: No need data-slug anywhere.
Solved rewrite CSS with
.accordion > section.active > .content { display: block; position: relative;}


text:
Q: SQL SERVER Virtual Log Files I am new to SQL SERVER, could anyone please explain that why do we have VLFs' in T-LOG and why not have 1 T-log itself. I am aware that VLFs' are logical but my question is why VLFs'? what is the benefit that we get from having VLFs'.

A: SQL Server uses VLF to fragment the log file. This fragmentation of the log file makes log management easier for the engine, as it adds granularity to the file.
As some of the links that Aaron Bertrand has posted in the comment explain (I would like to add this one), SQL Server writes sequentially to the log file. It starts with the first VLF and, once it is full, continues with the next one and so on. Once all VLFs have been used, it starts over again from the first one. This mechanism requires the log file to free up space that is not being used anymore.
The log file keeps all active transactions in SIMPLE recovery model, and all transactions since the last log backup in FULL (or BULK_LOGGED) recovery model. Once a CHECKPOINT or a log backup happens, the transactions that have been either commited or rolled back are no longer active transactions, and the space in the log file they were using can be reused (log truncation).
SQL server will just truncate VLFs that do not contain any active transaction. It won't free up space in VLFs that contain any active transaction. This way, SQL can just keep track of which VLFs contain active transactions or not, and just make the ones without active transactions available for reuse. I guess -this should be better answered by Microsoft's developers and engineers- that this is far easier than having to check a full logical file, that could be physically fragmented, and having to know where exactly is the lower limit of the log in the file (MinLSN).
The number of VLFs in our log file is important. If we have too few, it is very unlikely that log truncation can happen, because VLFs will be so big that they usually will "host" an active transaction. Too may can lead us to log fragmentation. You can read this excellent blog post by Kimberly Tripp on the topic.


text:
Q: Trouble with alignat environment What a shame!  After years of using LaTeX, I'm still truggling with the pesky alignat environment which I don't understand.  Here's a MWE showing what I'm trying to do:
\documentclass[11pt,letterpaper,twoside]{book}
\usepackage{lmodern}
\usepackage{amsmath}

\begin{document}

Blabla bla :
\begin{alignat*}{4}
    x \quad &\Rightarrow \quad y \sim z,
    & a \quad &\Rightarrow \quad b\sim c, \\
    x \quad &\Rightarrow \quad xyz \sim z,
    & a \quad &\Rightarrow \quad 5b \sim c,
\end{alignat*}

\end{document}

Preview:

I need to get a large space on the red line, so each column is well balanced to the left and to the right.  I need the arrows and the tildes to be aligned, without changing the space around them.
I know this should be very basic, but I don't get it!  :-(

A: Here you are. I added a spacing of 4em. Anyway, you only need three alignment columns:
\documentclass[11pt,letterpaper,twoside]{book}
\usepackage{lmodern}
\usepackage{amsmath}

\begin{document}

Blabla bla :
\begin{alignat*}{4}
    x \quad &\Rightarrow \quad & y&\sim z,&\hspace{4em}
    a \quad &\Rightarrow \quad & 4b & \sim c, \\
    x \quad &\Rightarrow \quad & xyz & \sim z,&
     a \quad &\Rightarrow \quad & b & \sim xyzc,
\end{alignat*}

\end{document}