text:
Q: I want texts inside 2 cells start on the same line I am having a little problem with my table.
On my third row I have 2 cells with texts inside of them , but in one of them the text is longer and in the other one the text is shorter..
Is there any way to make the texts start on the same line without adding/deleting text ?

        Our services

        Isolation and loneliness
        Family conflict or separation

        Human beings are naturally social animals. When we find
         ourselves becoming isolated, we should take that as a warning sign
         that we are turned against ourselves in some basic way. If not
         already there, we are on a path toward feeling bad, lonely,
         introverted or even depressed. Read more...
        Parental separation often initially leads to an increase in
         parental conflict and anger, although for some families the level
         of conflict reduces when parents do not see each other regularly.
         Read more...

        Death of loss
        Child psychological program

             There are many kinds of loss and each has its own kind of
        grief. People lose loved ones like spouses, partners, children,
        family members, and friends. Even pet losses can cause grief. job or
        property loss can be painful. Read more...
        The basic premise of the program is that children who avoid
        interactions with their peers or have difficulties in these
        interactions do so because of a skill deficit or excessive anxiety.
        Read more...

    ---CSS---

.section2 table {
    align:center;
    margin-top:80px;
}

.section2 table tr:first-child>th {
   font-size:25px;
}

.section2 table tr:nth-child(3) {
   height:auto;
}

.section2 table tr:nth-child(3) td {
   width:200px;
   background-color:blue;
   padding:20px;
   text-align:center;
}

.section2 table tr:nth-child(6) td {
   padding:20px;
   text-align:center;
   background-color:red;
}

A: Simply add
.section2 table tr td {
    vertical-align: top;
}

to your code.
Fiddle: https://jsfiddle.net/32n2zjky/

A: you can use vertical-align: top to td in your head tag like this

A: You want to add
.section2 table tr {
     vertical-align: top;
}

And by the way, instead align:center should by text-align:center

.section2 table {
    text-align:center;
    margin-top:80px;
}

.section2 table tr {
     vertical-align: top;
}

.section2 table tr:first-child>th {
   font-size:25px;
}

.section2 table tr:nth-child(3) {
   height:auto;
}

.section2 table tr:nth-child(3) td {
   width:200px;
   background-color:blue;
   padding:20px;
   text-align:center;
}

.section2 table tr:nth-child(6) td {
   padding:20px;
   text-align:center;
   background-color:red;
}

        Our services

        Isolation and loneliness
        Family conflict or separation

        Human beings are naturally social animals. When we find
         ourselves becoming isolated, we should take that as a warning sign
         that we are turned against ourselves in some basic way. If not
         already there, we are on a path toward feeling bad, lonely,
         introverted or even depressed. Read more...
        Parental separation often initially leads to an increase in
         parental conflict and anger, although for some families the level
         of conflict reduces when parents do not see each other regularly.
         Read more...

        Death of loss
        Child psychological program

             There are many kinds of loss and each has its own kind of
        grief. People lose loved ones like spouses, partners, children,
        family members, and friends. Even pet losses can cause grief. job or
        property loss can be painful. Read more...
        The basic premise of the program is that children who avoid
        interactions with their peers or have difficulties in these
        interactions do so because of a skill deficit or excessive anxiety.
        Read more...


text:
Q: Python Bisection Number Guessing Game I am trying to write a simple bisection method question and it works perfectly fine as long as I don't have a certain conditional statement which I have commented out. What is the reason for this? This is not a homework question.
low = 0
high = 100
ans = (low+high)/2
print "Please think of a number between 0 and 100!"
print "Is your secret number " + str(ans) + "?"
response = raw_input("Enter 'h' to indicate the guess is too high. Enter 'l' to indicate the guess is too low. Enter 'c' to indicate I guessed correctly. ")
response = str(response)
while response != "c":
   if response == "h":
        high = ans
        ans = (low + high)/2
        print "Is your secret number " + str(ans) + "?"
        response = raw_input("Enter 'h' to indicate the guess is too high. Enter 'l' to indicate the guess is too low. Enter 'c' to indicate I guessed correctly. ")
        response = str(response)

   if response == "l":
        low = ans
        ans = (low + high)/2
        print "Is your secret number " + str(ans) + "?"
        response = raw_input("Enter 'h' to indicate the guess is too high. Enter 'l' to indicate the guess is too low. Enter 'c' to indicate I guessed correctly. ")
        response = str(response)

   if response == "c" :
        break

  # if response != "c" or response != "h" or response != "l":
   #     response = raw_input("Please enter a 'h', 'l', or 'c' ")
    #    response = str(response)

print "Game over. Your secret number was: " + str(ans)

Is this because the while loop has the same condition as the while loop? If so what is the best way to change this?

A: That condition will always be true because you are comparing for inequality with multiple things. It would be like asking "If this character isn't c, or if it isn't h, or if it isn't l, do this. It can't be three things at once, so it will always evaluate as true.
Instead, you should use if response not in ['c','h','l'], which is basically like replacing or with and in the sentence above. Or even better in your case, just use an else statement because your existing conditions already ensure what you are trying to check for.

A: I suggest you use a double while loop :
while True:
    response = None
    print "Is your secret number " + str(ans) + "?"
    response = str(raw_input("Enter 'h' to indicate the guess is too high. Enter 'l' to indicate the guess is too low. Enter 'c' to indicate I guessed correctly."))

    while response not in ['h', 'c', 'l']:
        response = str(raw_input("Please enter a 'h', 'l', or 'c' "))

    if response == 'c':
         break

    if response == 'l':
        low = ans
    else:
        high = ans
    ans = (low + high)/2

redpajama_set_name: RedPajamaStackExchange


text:
Q: Kotlin Android extension can't resolve "text" So I'm trying to get rid of "findViewById" and decided to add Kotlin Android extension to my project
Inside my gradle:
apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'

In project level gradle.build:
classpath "org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version"

In my MainActivity:
import kotlinx.android.synthetic.main.activity_main.*

However, I still need var editTextCity = editText_city.findViewById<EditText>(R.id.editText_city)
to resolve  var city = editText_city.text.toString()
seems like the extension is not working

A: Try to edit classpath in the project level gradle.build to:
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

and add this to your app level gradle.build as dependency:
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"

Hope that works.

A: for edit text  you have to use :
 etEmail.setText(preferenceKeeper?.user?.email)

and if you want to get text from there then :
val valueFromEditText=etEmail.text.toString()

And if you are using Kotlin extension then you can directly access by  id in your activity which is mention in you .xml


text:
Q: How to do 'show all posts except mine' in MEAN stack? I created my MEAN stack app based on this tutorial.
This is my thoughtsIndex.js in /client/app/thoughtsIndex/. You can think 'thought' as post.
angular.module('meanGoroApp')
  .config(function ($stateProvider) {
    $stateProvider
      .state('main', {
        url: '/',
        templateUrl: 'app/thoughtsIndex/thoughtsIndex.html',
        controller: 'ThoughtsIndexCtrl',
        resolve: {
            query: function($stateParams) {
            return {
              // I need help here!!
            }
          }
        }
      })

      .state('collectedThoughtsIndex', {
        url: '/users/:userId/collected',
        templateUrl: 'app/thoughtsIndex/thoughtsIndex.html',
        controller: 'ThoughtsIndexCtrl',
        resolve: {
            query: function($stateParams) {
                return {
                    collectedBy: $stateParams.userId
                }
            }
        }
      })

      .state('userThoughtsIndex', {
        url: '/users/:userId',
        templateUrl: 'app/thoughtsIndex/thoughtsIndex.html',
        controller: 'ThoughtsIndexCtrl',
        resolve: {
            query: function($stateParams) {
                return { user: $stateParams.userId };
            }
        }
      });
  });

'collectedThoughtsIndex' state and 'userThoughtsIndex' state are working fine.
Problem is, when the state is 'main', I want to show all thoughts in db, except current user's thoughts. If there is no current user, I want to show all thoughts in db.
I asked to the tutorial author, and he said try {user: {$ne: $stateParams.userId}}. But this gave me this error.
    Unhandled rejection CastError: Cast to ObjectId failed for value "[object Object]" at path "user"
    at MongooseError.CastError (/Volumes/Garage/GORO/mean_goro/node_modules/mongoose/lib/error/cast.js:19:11)
    at ObjectId.cast (/Volumes/Garage/GORO/mean_goro/node_modules/mongoose/lib/schema/objectid.js:147:13)
    at ObjectId.castForQuery (/Volumes/Garage/GORO/mean_goro/node_modules/mongoose/lib/schema/objectid.js:187:15)
    at cast (/Volumes/Garage/GORO/mean_goro/node_modules/mongoose/lib/cast.js:141:34)
    at Query.cast (/Volumes/Garage/GORO/mean_goro/node_modules/mongoose/lib/query.js:2570:10)
    at Query.find (/Volumes/Garage/GORO/mean_goro/node_modules/mongoose/lib/query.js:1087:10)
    at /Volumes/Garage/GORO/mean_goro/node_modules/mongoose/lib/query.js:2164:21
    at Query.exec (/Volumes/Garage/GORO/mean_goro/node_modules/mongoose/lib/query.js:2157:10)
From previous event:
    at index (/Volumes/Garage/GORO/mean_goro/server/api/thought/thought.controller.js:78:55)
    at Layer.handle [as handle_request] (/Volumes/Garage/GORO/mean_goro/node_modules/express/lib/router/layer.js:95:5)
    at next (/Volumes/Garage/GORO/mean_goro/node_modules/express/lib/router/route.js:131:13)
    at Route.dispatch (/Volumes/Garage/GORO/mean_goro/node_modules/express/lib/router/route.js:112:3)
    at Layer.handle [as handle_request] (/Volumes/Garage/GORO/mean_goro/node_modules/express/lib/router/layer.js:95:5)
    at /Volumes/Garage/GORO/mean_goro/node_modules/express/lib/router/index.js:277:22
    at Function.process_params (/Volumes/Garage/GORO/mean_goro/node_modules/express/lib/router/index.js:330:12)
    at next (/Volumes/Garage/GORO/mean_goro/node_modules/express/lib/router/index.js:271:10)
    at Function.handle (/Volumes/Garage/GORO/mean_goro/node_modules/express/lib/router/index.js:176:3)
    at router (/Volumes/Garage/GORO/mean_goro/node_modules/express/lib/router/index.js:46:12)
    at Layer.handle [as handle_request] (/Volumes/Garage/GORO/mean_goro/node_modules/express/lib/router/layer.js:95:5)
    at trim_prefix (/Volumes/Garage/GORO/mean_goro/node_modules/express/lib/router/index.js:312:13)
    at /Volumes/Garage/GORO/mean_goro/node_modules/express/lib/router/index.js:280:7
    at Function.process_params (/Volumes/Garage/GORO/mean_goro/node_modules/express/lib/router/index.js:330:12)
    at next (/Volumes/Garage/GORO/mean_goro/node_modules/express/lib/router/index.js:271:10)
    at Layer.handle [as handle_request] (/Volumes/Garage/GORO/mean_goro/node_modules/express/lib/router/layer.js:91:12)
    at trim_prefix (/Volumes/Garage/GORO/mean_goro/node_modules/express/lib/router/index.js:312:13)
    at /Volumes/Garage/GORO/mean_goro/node_modules/express/lib/router/index.js:280:7
    at Function.process_params (/Volumes/Garage/GORO/mean_goro/node_modules/express/lib/router/index.js:330:12)
    at next (/Volumes/Garage/GORO/mean_goro/node_modules/express/lib/router/index.js:271:10)

So far, I tried
{user: {$ne: $stateParams.userId}}
{user: {$not: $stateParams.userId}}
{$ne: {user: $stateParams.userId}}
{$not: {user: $stateParams.userId}}

but none of these worked.
Please help me.. I'm desperate :-(
++
This is my 'thoughtsIndex.controller.js' file.
'use strict';

angular.module('meanGoroApp')
  .controller('ThoughtsIndexCtrl', function ($scope, $http, Auth, $location, query, socket) {
    $scope.busy = true;
    $scope.noMoreData = false;

    $http.get('/api/thoughts', {params: {query: query}}).success(function(thoughts) {
        $scope.thoughts = thoughts;
      socket.syncUpdates('thought', thoughts);
        if($scope.thoughts.length < 20) {
            $scope.noMoreData = true;
        }
        $scope.busy = false;
    });

    $scope.nextPage = function() {
        if($scope.busy) { return; }
        $scope.busy = true;
        var lastId = $scope.thoughts[$scope.thoughts.length-1]._id;
        var pageQuery = _.merge(query, {_id: {$lt: lastId}});

        $http.get('/api/thoughts', {params: {query: pageQuery}}).success(function(thoughts) {
            $scope.thoughts = $scope.thoughts.concat(thoughts);
            $scope.busy = false;
            if(thoughts.length === 0) {
                $scope.noMoreData = true;
            }
        });
    }

    $scope.isOwner = function(obj) {
      return Auth.isLoggedIn() && obj && obj.user && obj.user._id === Auth.getCurrentUser()._id;
    }

    $scope.isCollected = function(obj) {
        return Auth.isLoggedIn() && obj && obj.collectedBy && obj.collectedBy.indexOf(Auth.getCurrentUser()._id) !== -1;
    }

    $scope.isLoggedIn = function() {
      if(!Auth.isLoggedIn()) {
        $location.path('/login');
        $location.replace();
        return;
      }
    }

    $scope.submit = function() {
      $http.post('/api/thoughts', $scope.thought).success(function() {
        $location.path('/users/' + Auth.getCurrentUser()._id);
        $scope.clearInput();
      });
    }

    $scope.clearInput = function() {
      $scope.thought.main_sentence = null;
      $scope.thought.sub_sentence = null;
    }
  });

A: The collectedThoughtsIndex and the userThoughtsIndex routes takes the userId params from the url but the main route takes no such params.

Your api call takes the query object that you generate from the stateProvider and makes a call to the server. However, since you have no query params to generate in the main route, you have to make the api call without any query params.

You have to update the backend in this way -

*

*when no query params are passed

*if a user is logged in

*

*return all thoughts except his

*else

*

*return all thoughts

I hope this makes sense to you. :)


text:
Q: Do you typically need to program-in a USB communication protocol? I have usb communication set up between a microcontroller I have and a VB.Net script. I am somewhat familiar with how the USB protocol works.
My question is: Do I need to program in start frames, tokens, and handshaking, or is this all done by the device hardware? I see on Microsoft's vb wiki that the serialport.Readline method reads a buffer up to the first new line character, and to me that looks like it does more than the USB protocol allows for. You shouldn't be able to continuously stream data to the port, it should be sent discretely in frames.
Thanks in advanced.

A: It's already in the name of the function: serialport.Readline. This function operates on serial ports, not on raw USB endpoints. Your microcontroller "pretends" to be a serial port that's attached to your computer via USB. A serial port driver on your system takes care of converting the data from your program into USB packets (and vice-versa).
There's more software on your computer than just your own program. The operating system does a lot of stuff for you.
If you want to write your own driver, you can of course do that, but it's quite difficult to say the least. As long as serial communication is enough, you don't have to write one. However, if you want to create your own custom USB endpoints, you will have to write a driver for them.

A: If you have a USB serial port, then to your program, it's a serial port.
And you don't need to know or care if it is a standard serial port, USB serial port, virtual serial port extended over LAN, or something else, as long as your program sees a serial port.

A: Like any protocol stack, USB incorporates components representing various layers. High-level drivers and libraries provide higher-layer functionality on top of lower layers, effectively abstracting those lower layers away and out of sight.
In the case of USB, there are a number of so-called device classes which provide standardized interfaces on top of USB, with a coordinated protocol on the host side (implemented by a driver or a stack of drivers) and on the peripheral side (implemented by firmware or drivers). Examples of these device classes include HID devices like keyboards/mice, mass storage devices such as flash drives, image storage using PTP/MTP, and so on. These abstract away the USB protocol - for example, the FAT filesystem driver used to mount a flash drive sees a block storage device and doesn't need to worry about USB framing, packetization, etc, thanks to the USB drivers lower in the stack.
In your case, the relevant class is USB CDC (Communications Device Class). The CDC drivers present a serial port to user-land programs on your computer, which can read and write a stream of data. Meanwhile, the CDC driver will do the work of converting a stream of serial bytes and control signals into USB packets, and it will receive help from the underlying USB drivers down the stack for even lower level tasks such as establishing pipes to endpoints.
Because the specification is standardized, you benefit from knowing that your application on top of USB CDC should work regardless of what vendor your CDC-compatible device is from (as long as they follow the spec), because your system's drivers are likely implemented to the spec1.
Meanwhile, your application can use the serial port without needing to worry about what physical hardware underpins it. It could be serial over USB, it could be a nine-pin D-sub connector serial port implemented with a UART on your motherboard's IO controller, it could be a virtual serial port on Linux, or it could perhaps be a serial link on top of TCP/IP.
1 or more loosely, to give leeway for devices that may not follow the spec exactly.

A:
My question is: Do I need to program in start frames, tokens, and
handshaking, or is this all done by the device hardware?

Ok, let me try to paint a broad picture of what you are asking about, in up-down way:

*

*Your script makes calls to USB driver stack;

*USB driver sets a linked list of data structures in PC memory, various "ring" and "transaction buffers", per requests from the script;

*USB driver then loads the starting address for the structure and "rings" a "doorbell register" in USB host controller hardware.

*USB host controller HARDWARE uses DMA (Direct Memory Access) to walk through the linked list of structures, on its own;

*The HC (host controller) hardware interprets the incoming data structures and sends sequences of raw data to USB PHY - physical layer translator. Host HW follows USB protocols per SIE - Serial Interface Engine (sends proper tokens and waits/evaluates bus responses (handshakes), sending and receiving data packets to/from PHY), and calculates/verifies CRC.

*PHY arranges parallel data into serial, appending SYNC and EOP to tokens, and performs data encoding for proper balancing of data toggling;

*Host hardware continuously generates frame tokens on enabled ports, and SW stack watches the frame timing and schedules transaction packets in accord with bus rules;

*Devices implement USB protocol in a similar form of SIE, receiving/analyzing packets, decoding addresses/endpoints, and responding in proper and timely manner.

With a rare exception of Low Speed protocol (like mouse/keyboard, where some enthusiasts managed to implement the USB SIE and PHY in bit-banging manner, loosely), all microprocessors with USB functionality implement all major protocol functions in hardware.
So, to answer this direct question, no, you don't program start of frames and specific tokens or wait for handshakes, it is all done in hardware under USB driver stack control.


text:
Q: installation did not succeed for my application on android studio <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.video.maker1">

    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="com.google.android.finsky.permission.BIND_GET_INSTALL_REFERRER_SERVICE" />

    <application
        android:name="com.video.maker1.MyApplication"
        android:allowBackup="true"
        android:extractNativeLibs="true"
        android:hardwareAccelerated="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:largeHeap="true"
        android:networkSecurityConfig="@xml/network_security_config"
        android:requestLegacyExternalStorage="true"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/theme"
        android:usesCleartextTraffic="true"
        >

        <uses-library
            android:name="org.apache.http.legacy"
            android:required="false" />

        <meta-data
            android:name="com.google.android.gms.ads.APPLICATION_ID"
            android:value="ca-app-pub-9731420309932281~3771749504" />

<!--        <activity-->
<!--            android:name="com.facebook.ads.AudienceNetworkActivity"-->
<!--            android:hardwareAccelerated="true" />-->

        <provider
            android:name="androidx.core.content.FileProvider"
            android:authorities="${applicationId}.provider"
            android:exported="true"
            android:grantUriPermissions="true">
            <meta-data
                android:name="android.support.FILE_PROVIDER_PATHS"
                android:resource="@xml/provider_paths" />
        </provider>

        <activity
            android:name="com.video.maker1.activity.SplashActivity"
            android:exported="true"
            android:screenOrientation="nosensor">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name="com.video.maker1.activity.MainActivity"
            android:exported="true"
            android:screenOrientation="portrait">

        </activity>
        <activity
            android:name="com.video.maker1.activity.ImagePickerActivity"
            android:exported="true"
            android:screenOrientation="portrait" />
        <activity
            android:name="com.video.maker1.activity.SwapImageActivity"
            android:exported="true"
            android:screenOrientation="portrait" />
        <activity
            android:name="com.video.maker1.activity.SelectFrameActivity"
            android:exported="true"
            android:screenOrientation="portrait" />
        <activity
            android:name="com.video.maker1.activity.VideoPlayerActivity"
            android:exported="true"
            android:screenOrientation="portrait" />
        <activity
            android:name="com.video.maker1.activity.SongGalleryActivity"
            android:exported="true"
            android:screenOrientation="portrait" />
        <activity
            android:name="com.video.maker1.activity.VideoThemeActivity"
            android:exported="true"
            android:screenOrientation="portrait" />

        <service android:name="com.video.maker1.theme.service.ServiceAnim" />

        <activity
            android:name="com.video.maker1.activity.MyVideo"
            android:exported="true"
            android:screenOrientation="portrait" />
        <activity
            android:name="com.video.maker1.activity.VideoMakerActivity"
            android:exported="true"
            android:screenOrientation="portrait" />

        <activity
            android:name="com.video.maker1.activity.PrivacyActivity"
            android:exported="true"
            android:screenOrientation="portrait" />

        <activity
            android:name="com.theartofdev.edmodo.cropper.CropImageActivity"
            android:exported="true"
            android:theme="@style/Base.Theme.AppCompat" />
        <activity android:name="com.video.maker1.activity.VideoTrimActivity" />

        <activity
            android:name="com.video.maker1.activity.VideoEditorActivity"
            android:exported="true"
            android:screenOrientation="portrait" />
        <activity
            android:name="com.video.maker1.activity.LibraryActivity"
            android:exported="true"
            android:screenOrientation="portrait" />

        <activity
            android:name="com.video.maker1.activity.SaveVideoFileActivity"
            android:exported="true"
            android:screenOrientation="portrait" />

        <activity android:name="com.video.maker1.activity.VideoListActivity" />

        <activity
            android:name="com.infiapp.imagelibrary.editimage.EditImageActivity"
            android:exported="true"
            android:screenOrientation="portrait"
            android:windowSoftInputMode="adjustPan"></activity>
    </application>

</manifest>

this is my manifest code when i try to install my app on the emulator it shows me this error
^^The application could not be installed: INSTALL_PARSE_FAILED_MANIFEST_MALFORMED^^
i'hv tryed evrything that i know but it still showing me the same error
as you see i have tried the ^^android exported true commnd on all my activity but it doesn't work.


text:
Q: Eisenbud 1.21a $G(n):= F(n)-F(n-1)$, given $G(n)$ is integer-valued, then so is $F(n)$. This question is based on a subproblem from 1.21 (a) from Eisenbud's commutative algebra
Given $F: \mathbb Z \to \mathbb Z$,  we then define $G(n):= F(n)-F(n-1)$. Is it then true that:

$G(n)$ is  an integer-valued polynomials (with rational coefficients) $\implies F(n)$ is an integer-valued polynomial (with rational coefficients).

Therefore, suppose $$G(n):= q_0 + q_1 n + \dots q_k n^k $$
We get that:
$$ F(1)-F(0) = G(0)=q_0 \in \mathbb Z$$
$$ F(2)-F(1) = G(1) \in \mathbb Z$$
$$ F(3)-F(2) = G(2) \in \mathbb Z$$
$$\vdots$$
$$ F(n)-F(n-1) = G(n) \in \mathbb Z$$
Okay great, so we deduce that this function differs an integer value from its previous value, which is great, but I am missing a step or argument here.
Any ideas?
Note:
I have used the hint, and was able to prove that any such integer-valued polynomial has a basis of $G_k(n)= \binom{n}{k} \in \mathbb Q[n]$. I do not see how this can be used.

A: $$F(n)-F(0)=G(1)+G(2)+... +G(n)$$
$$=nq_0+\frac{n(n+1)}{2}q_1+...$$
and is therefore a rational polynomial in $n$ by Faulhaber's formula.
It is integer valued since $F(0)$ and all $G(i)$ are.


text:
Q: ASP.NET Connection loss handling How would you go about and handle lost data from a sql connection loss on a ASP.NET application.
Lets say your running an algorithm adding and removing certain roles. A midst it, the connection to the SQL database is lost. And because the connection is not there, wont even be able to backtrack the steps done. The whole state is lost, leaving the database in an error nous condition.
Would you set the IIS Rapid Fail Protection to shut the site down upon 1 exception and manually force the function to run again (after connection have been fixed).
Or how is the professional way of handling it, i am quite new to it. Maybe there's something i do not know of it (such as iis maybe trying to rerun it/caching)
(Using entity framework)
This is not a coding problem in its own way, it is more of a question of best practice handling data loss with sql database on asp.net

A: You need to do batch SQL Operations inside a SQL Transaction. So that whatever the error, a rollback happens. This is a built-in SQL feature and nothing special needs to be done.
Once you start a SQL Transaction, a Commit is issued only when all operations succeed. The default behavior is normally Rollback in case of all other non-success scenarios.
If you're encountering issues with any specific logic, post the code snippet and we're glad to help.


text:
Q: 2 Column Fluid Layout with Header I've tried to describe my problem clearly. If I left out something or I should clarify, leave a comment.
The Problem
I'm trying to create a pretty simple HTML / CSS Layout with a few features.
I've tried to add these:

*

*A header of an unknown height

*A content div which can scroll if it's contents overflows

*A sidebar which can scroll if it's contents overflows

What I've Tried
Here's what I've tried so far

body,html { width: 100%; height: 100%; margin: 0; }
#header {
  text-align: center;
  padding: 1rem;
  background-color: #AAA;
}
#main-content {
  margin-right: 25%;
  background-color: #CAC;
  height: 100%;
  max-height: 100%;
}
#sidebar {
  width: 25%;
  float: right;
  padding: 0 0 0 15px;
  background-color: #ACA;
  height: 100%;
}

  Header

  Sidebar (coming over "Inner Content")

  Inner Content. 100% causes a scrollbar to get added to the whole page

(Bad) Picture

Limitations

*

*I'm trying to make this easily modifiable so any hacks such as margin + absolute positioning won't work.

*I'm avoiding the table tag.

*No JavaScript
Support
I'm supporting all modern browsers (IE10+)

A: You should use flexbox. It was made for creating flexible layouts like this. The only caveat is that since you want your header to have fluid height, you'll need to use nested flexboxes, which means you will need to add a parent element for the main content and sidebar.
Here's the code (the Javascript is just for the "fill" button -- it fills the content so the scrollbar can be tested):

window.onload = function () {
    var btn = document.querySelector("#fill");
    btn.onclick = function () {
        var content = btn.parentNode;
        content.removeChild(btn);
        for (var i = 0; i < 7; i++) {
            content.innerHTML += content.innerHTML;
        }
    };
};
body, html {
    width: 100%;
    height: 100%;
    margin: 0;
}
body {
    display: flex;
    flex-direction: column;
}
#header {
    flex: 0 0 auto;
    text-align: center;
    padding: 1rem;
    background-color: #AAA;
}
main {
    flex: 1;
    display: flex;
}
#main-content {
    flex: 75%;
    overflow: auto;
    padding: 15px;
    background-color: #CAC;
}
#sidebar {
    flex: 25%;
    padding: 15px;
    background-color: #ACA;
}

Header
Auto height

        Inner Content. 100% causes a scrollbar to get added to the whole page

        <button id="fill">Fill content</button>

Sidebar (coming over "Inner Content")

A: try adding this :
#main-content {
  margin-right: 25%;
  background-color: #CAC;
  height: 100%;
  max-height: 100%;
  overflow-y: scroll;
}
#sidebar {
  width: 25%;
  float: right;
  padding: 0 0 0 15px;
  background-color: #ACA;
  height: 100%;
  overflow-y: scroll;
}


text:
Q: Widgets on a webapplication I am writing a webapplication which will have widgets like iGoogle does (but with different information ;)). Since there will be different colomns I would love to hear your ideas on how to call the modules in the code. I want to define in the database what widgets are enabled and in what column they are and in what order they should appear. I am working with PHP and the Zend Framework. Is there any good practice to add the widgets?
I was thinking of doing it like this:
You save the widgets name and there would be a folder with widgets in them and with require_once I would include the file and execute a default command like:
echo ExampleWidgetClass::run();

A: Depending on what you are trying to achieve for your users, you may also want to consider external widget specifications like W3C Widgets (Apache Wookie) or OpenSocial Gadgets (Apache Shindig)

A: Your approach sounds reasonable: insist on a well-defined interface for each widget, and then invoke that method (or those methods) for each registered widget.  Some things to keep in mind:

*

*abstraction: do the widgets know where they are on the page, or how big their window is?

*security: are the widgets written by 3rd parties?  do you trust them?  does their output need to be escaped or sanitized?

*backend: some widgets may need to make backend calls to get data.  consider how they request backend calls be made in a batch before the page is rendered.  dispatching multiple backend requests (such as sql queries) simultaneously can yield better page performance than querying sequentially.

A: What kind of confirmation are you looking for from us? If it's your system, your widgets, then just run them the way you think is best ?
What you describe sounds a lot like a solid setup. Just go for it I'd say and not ask StackOverflow? :-P


text:
Q: Asset fingerprint differs between servers I am deploying my rails 3.2.14 application to 2 different servers with a load balancer in front of them.  The assets are currently being precompiled on the server (via capistrano deployment).
For some reason the fingerprint on the application.js file is different between the two servers.  The source file is identical.  IF I remove the //= require_tree . from the application.js then they both magically have the same fingerprint.
I've come across a few posts that mention this issue, but never really address the root cause:

*

*https://github.com/sstephenson/sprockets/issues/158#issuecomment-1837340

*https://github.com/rails/rails/issues/2569#issuecomment-1879181
I'm trying to avoid pre-compiling the assets locally as a way to solve this issue (at least for now...).

A: I was unable to easily work around this issue (i.e. did not want to fully spell out the assets tree in my application.js), so I ended up overriding the deploy:assets task to compile assets locally and push to each server in my cluster.
namespace :deploy do
  namespace :assets do
    desc 'Run the precompile task locally and scp to server'
    task :precompile, :roles => :web, :except => { :no_release => true } do
      if releases.length <= 1 || capture("cd #{latest_release} && #{source.local.log(source.next_revision(current_revision))} vendor/assets/ app/assets/ | wc -l").to_i > 0
        run_locally "bundle exec rake assets:precompile"
        run_locally "cd public; tar -zcvf assets.tar.gz assets"
        top.upload "public/assets.tar.gz", "#{shared_path}", :via => :scp
        run "cd #{shared_path}; tar -zxvf assets.tar.gz"
        run_locally "rm public/assets.tar.gz"
        run_locally "bundle exec rake assets:clean"
      else
        logger.info 'Skipping asset pre-compilation because there were no asset changes'
      end
    end
  end
end


text:
Q: How to pass a data from Javascript to PHP Laravel? what I'm trying to do is a function in javascript that sends a simple data to a laravel controller and then upload it to the database, the problem I have is that until now I have not been able to find a way to send this data, always I get error 500.
Laravel Controller:
public function crearRegistro(Request $request){

$registro = new Registro();
$registro->indicador = $request->indicador;
$registro->save();
}

Javasript Function:
    $scope.calculoIndicador = function(){
  $http.post("/calculoIndicador")
  .then(function(response) {
    });
  $scope.indicador = 5 +5;
   alert('Se ha guardado correctamente');

}

view:
<input class="btn btn-success" style="" ng-click="calculoIndicador()"
 type="submit" value="Enviar"/>

Route:
Route::post('/calculoIndicador', 'TecnologiaController@crearRegistro');

A: (First, sorry with my bad english)
I assume that you use Laravel 5.6. On controller you have to use:
$request->all() method to get the data passed to controller via post on javascript. On your code i assume yout want the "indicador", so:
$requestData = $request->all();
$registro->indicador = $requestData['indicador'];

But on your javascript you have to pass "indicador" as parameter on post request data. So, on javascript (or typescript of Angular) post do something like this:
$http.post("/calculoIndicador", {indicador: 'your_data'}).then(
    function(response) {
      $scope.status = response.status;
      $scope.data = response.data;
    }, function(response) {
      $scope.data = response.data || 'Request failed';
      $scope.status = response.status;
    }
)

Can you update this page with stack trace of this error?


text:
Q: (iphone) where is "Reject Binary" button? I just submitted my app for test purposes
(seems like you need to submit/reject the binary to test in-app-purchase)
http://troybrant.net/blog/2010/01/in-app-purchases-a-full-walkthrough/
I submitted through xcode4 organizer "submit" button.(and it completed successfully)
When I look at my app page in itunes-connect, it's still waiting for upload and there's no "reject binary" button.
Does this status change from "waiting for upload" -> "waiting for review" takes a while?
I need to reject this binary since it's not fully ready yet, and in a panic.
Any prompt response would be appreciated

A: Log in To iTunes connect --> Manage your Application --> Click on your Application --> Again Click on your Application Icons --> Binary Details --> Reject Binary button Right top side.

Hope this help you.
See I have one app in Waiting for Review status and still I have Binary details option and you can reject your binary from there. See attached screenshot.

A: The "Binary Details" button will not appear while the app state is "Upload Received".
You need to wait until the app state changes to "Waiting for Review".
Sometimes that can take as long as 10-15 minutes.


text:
Q: How return name of image from FormControl in ReactivForms I want to get the name from FormControl of the image in Angular ReactivForms. I got the full path of the image like file = "C:\fakepath\Screenshot (1).png" but I want only Screenshot (1).png.
I using control.value for getting the name of the image.
I want to add I do not have this folder in my C: directory C:\fakepath\
This is my method :
 requiredFileType(categoryList: CategoryModel[]) {
    return function (control: FormControl) {
      const file = control.value;
      if (file) {
        const extension = file;

        for (let i = 0; i < categoryList.length; i++) {

          for (let j = 0; j < categoryList[i].productModel.length; j++) {
            for (let k = 0; k < categoryList[i].productModel[j].imageProduct.length; k++) {
              console.log(categoryList[i].productModel[j].imageProduct[k].image_path);
              if (categoryList[i].productModel[j].imageProduct[k].image_path.includes(extension)) {
                console.log(categoryList[i].productModel[j].imageProduct[k].image_path);

                return{
                  requiredFileType: true
                };

              }
            }

          }

        }
        return null;

      }

      return null;

    };
  }

Does anyone know the resolution of this?

A: Use substring if your path has static number of characters (not changing):
const file = control.value;
const fileName = file.substring(10, str.length);

Demo:

let str = "C:\fakepath\Screenshot (1).png";
const mystr = str.substring(10, str.length);
console.log(mystr)

A: You can use the substring() and lastIndexOf() functions in javascript
const path = control.value;
const fileName = path.substring(path.lastIndexOf('\') + 1, path.length);


text:
Q: PlaceholderAdmin throws () takes exactly 1 argument (2 given) I've wrote a plugin for django-cms which has it's own model with one PlaceholderField. When I add a PlaceholderAdmin for model admin I'm getting this on admin site:
Exception Type: TemplateSyntaxError
Exception Value:
Caught TypeError while rendering: <lambda>() takes exactly 1 argument (2 given)
Exception Location: <blablapath>/python2.6/site-packages/cms/forms/widgets.py in render, line 199

I've been searching for solution and found only some problems with django-cms example which would not run without uncommenting some path in urls.py so I guess it might be problem with urls, especially that I do some magic in my urls. The question is: what conditions should hold for django-cms url's to be valid? Any ideas? Any solutions? Anybody had this problem before?

A: This issue is caused when you are not subclassing the PlaceholderAdminField in your admin class.
For example:
from cms.admin.placeholderadmin import PlaceholderAdmin
from cms.models.fields import PlaceholderField

class MyModel(models.Model):
    name = models.CharField(max_length=100)
    sidebar = PlaceholderField('sidebar')

class MyAdmin(PlaceholderAdmin):
    """ Put your usual admin stuff here. If you use fieldset,
    include the sidebar as its own tuple """
    fieldsets = (
        (None, {
            'fields': ('name',),
        }),

        ('Sidebar', {
            'classes': ('plugin-holder', 'plugin-holder-nopage'),
            'fields': ('sidebar',)
        }),
    )
admin.site.register(MyModel, MyAdmin)

A: Well, this appears to be a bug in Django-CMS. I've never used it, but looking at the code, it's clear that the default formfield for PlaceholderField creates a lambda which takes a single argument - a queryset, but the render function for that formfield calls the lambda with two arguments - the request, and the queryset.
Probably the best way to fix this is to define your own subclass of PlaceholderField which redefines the formfield method so it returns a correct lambda:
class FixedPlaceholderField(PlaceholderField):
    def formfield(self, **kwargs):
        return self.formfield_for_admin(None, lambda request, qs: qs, **kwargs)

and use this field in your model instead.
If this fixes it, it's probably worth raising a bug in Django-CMS.

A: Ok. I've solved the problem for me. I still don't know what was happening but maybe my answer will help you figure it out ;).
I've used a method:
def formfield_for_dbfield(self, db_field, **kwargs):
    ...

which substituted one text field into TinyMCE editor. When I removed the whole method the problem vanished. If I have time later on maybe I'll try to dig into it a little bit deeper.
I'm still not convinced that that was the only problem. I have a hunch that it also might be something with data because I've filled placeholder with text plugin from code.
Hope it helps somehow.


text:
Q: How to Use Cron expression for running a job in spring I want to run a job based on the cron expression, but it should look for the cron expression from the DB after a rest call.
@SpringBootApplication
@EnableScheduling
public class DemoApplication {
    public static void main(String[] args) {
        SpringApplication.run(DemoApplication.class, args);
    }
}

Controller
**************
        @PostMapping
    @RequestMapping(value = "/addProduct")
    public ResponseEntity saveProduct(@RequestBody Product product){

        prodList.add(product);
        startJob();
        return new ResponseEntity("Product saved successfully", HttpStatus.OK);
    }

    @Scheduled(cron = "*/2 * * * * *")
    public void startJob() {
        System.out.println("printing"+ new Date());
    }

Once the REST API will be hit, it should wait for the cron expression, which we can get from the database or from any method, then it should start at the specified time.
It is working like a normal method call.

A: You can make your controller to implement SchedulingConfigurer which has a callback called configureTasks() which will be invoked when Spring starts up.
In this callback , you can access the ScheduledTaskRegistrar which is a helper bean that can used to programatically schedule a task. So , save this helper bean into the controller 's internal field such that your controller can access it to schedule a new task later .
@RestController
public class MyController implements SchedulingConfigurer{

    private ScheduledTaskRegistrar scheduledTaskRegistrar;

    @Override
    public void configureTasks(ScheduledTaskRegistrar taskRegistrar) {
        this.scheduledTaskRegistrar = taskRegistrar;
    }

    @PostMapping
    @RequestMapping(value = "/addProduct")
    public ResponseEntity saveProduct(@RequestBody Product product){

        //.....

        //Load the cron expression from database
        String cronExpression = loadCronExpressionFromDatabase();
        CronTask cronTask = new CronTask(() -> startJob() ,cronExpression);
        scheduledTaskRegistrar.scheduleCronTask(cronTask);

        return new ResponseEntity("Product saved successfully", HttpStatus.OK);
    }

    public void startJob() {
        System.out.println("printing"+ new Date());
    }
}


text:
Q: "Projections to..." meaning in this context Read the following statement.

The graph below gives information about cinema attendance in Australia between 1990 and the present, with projections to 2010.

I'm confused with "Projections to 2010", Can someone please make it clear? Web's empty!

A:
project (v): 1. Estimate or forecast (something) on the basis of present trends.

A projection is therefore a forecast or an estimate of future possibility.  In this case the graph uses existing data from 1990 to the "present" to project the trend forward to 2010.
It sounds strange in this context because, at the moment, 2010 is in the past.  We have to assume the sentence is from something that was written before 2010.

A: Where did you read that? Where is the graph? It seems that "the present" used in your sentence was a few years back.
According to Cambridge Dictionary
projection

a calculation or guess about the future based on information that you have

to preposition (UNTIL)

until a particular time, state, or level is reached

projections to 2010 indicate that estimations for future values go from present to 2010 in the graph. 2010 is the temporal upper limit.


text:
Q: jasonp cross domain request "wrapping json into a callback method" I added  ?callback=? to the url in the get request with an anonymous function, what do I have to add to my server side code to make it work cross domain.
Is it right to use getJSON here?
here is an example of the player without JSONP
http://www.freeenergymedia.com/shared/PLAYER/player/player.php
PHP script which returns JSON data
  <?php
header('Access-Control-Allow-Origin: *');
$url = 'http://www.startalkradio.net/?page_id=354';
$rss = simplexml_load_file($url);

$items = $rss->channel->item;

$i = 0;
$data = array();
foreach ($items as $item) {
    $data[] = array(
        'title' => (string) $item->title,
        'mp3'   => (string) $item->enclosure['url'],

    );
    if (++$i == 3) break;
}

$jsdata = json_encode($data);
$test = htmlspecialchars($jsdata, ENT_NOQUOTES, 'utf-8');

$jsdata = ($_GET['callback'].'('.json_encode($data).');');

echo $jsdata
?>

get request, loads JSON into player
   $(document).ready(function() {

    $.getJSON("http://www.freeenergymedia.com/getxml2.php?callback=?", function callback(json)
    {

        new jPlayerPlaylist({
            jPlayer: "#jquery_jplayer_1",
            cssSelectorAncestor: "#jp_container_1"
        }, json, {
            swfPath: "js",
            supplied: "mp3, oga",
            wmode: "window"
        });
    })
});

markup
<!DOCTYPE html>

<meta charset=utf-8 />

<title>Demo : jPlayer as an audio playlist player</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<link href="http://www.freeenergymedia.com/shared/PLAYER/player/skin/pink.flag/jplayer.pink.flag.css" rel="stylesheet" type="text/css" />

previous

play

pause

next

stop

mute

unmute

max volume

shuffle

shuffle off

repeat

repeat off

                    Update Required
                    To play the media you will need to either update your browser to a recent version or update your Flash plugin.

A: Your PHP script is returning JSONP and not JSONP. To make it working cross-domain you must actually modify your PHP to return a call to a callback function.
So you must make sure that the PHP code is returning data in a form callback(data);.
$jsdata = ($_GET['callback'].'('.json_encode($data).');');

Change your JavaScript .getJSON() call to:
$.getJSON("http://www.freeenergymedia.com/getxml2.php?callback=?", function(json) {
  // ... rest of the code
});

jQuery will insert into the URL generated callback name.
See documentation.


text:
Q: Why function's stack memory can be overwritten by calling a function without overflow behavior? In CSAPP attack lab, the hand-out of level3 said:
"When functions hexmatch and strncmp are called, they push data onto the stack, overwriting
portions of memory that held the buffer used by getbuf. As a result, you will need to be careful where you place the string representation of your cookie."
I see it and pass the lab, but I literally don't understand why the stack memory of a function can be destroyed by calling a function without overflow behavior.
The 40 bytes stack memory held in 'getbuf' seems to be overwritten after there is a code injection to switch the execution flow to 'touch3'. More accurately, after the 'hexmatch' and 'strncmp' are called.
00000000004017a8 <getbuf>:
  4017a8:   48 83 ec 28             sub    $0x28,%rsp
  4017ac:   48 89 e7                mov    %rsp,%rdi
  4017af:   e8 8c 02 00 00          call   401a40 <Gets>
  4017b4:   b8 01 00 00 00          mov    $0x1,%eax
  4017b9:   48 83 c4 28             add    $0x28,%rsp
  4017bd:   c3                      ret
  4017be:   90                      nop
  4017bf:   90                      nop
000000000040184c <hexmatch>:
  40184c:   41 54                   push   %r12
  40184e:   55                      push   %rbp
  40184f:   53                      push   %rbx
  401850:   48 83 c4 80             add    $0xffffffffffffff80,%rsp
  401854:   41 89 fc                mov    %edi,%r12d
  401857:   48 89 f5                mov    %rsi,%rbp
  40185a:   64 48 8b 04 25 28 00    mov    %fs:0x28,%rax
  401861:   00 00
  401863:   48 89 44 24 78          mov    %rax,0x78(%rsp)
  401868:   31 c0                   xor    %eax,%eax
  40186a:   e8 41 f5 ff ff          call   400db0 <random@plt>
  40186f:   48 89 c1                mov    %rax,%rcx
  401872:   48 ba 0b d7 a3 70 3d    movabs $0xa3d70a3d70a3d70b,%rdx
  401879:   0a d7 a3
  40187c:   48 f7 ea                imul   %rdx
  40187f:   48 01 ca                add    %rcx,%rdx
  401882:   48 c1 fa 06             sar    $0x6,%rdx
  401886:   48 89 c8                mov    %rcx,%rax
  401889:   48 c1 f8 3f             sar    $0x3f,%rax
  40188d:   48 29 c2                sub    %rax,%rdx
  401890:   48 8d 04 92             lea    (%rdx,%rdx,4),%rax
  401894:   48 8d 04 80             lea    (%rax,%rax,4),%rax
  401898:   48 c1 e0 02             shl    $0x2,%rax
  40189c:   48 29 c1                sub    %rax,%rcx
  40189f:   48 8d 1c 0c             lea    (%rsp,%rcx,1),%rbx
  4018a3:   45 89 e0                mov    %r12d,%r8d
  4018a6:   b9 e2 30 40 00          mov    $0x4030e2,%ecx
  4018ab:   48 c7 c2 ff ff ff ff    mov    $0xffffffffffffffff,%rdx
  4018b2:   be 01 00 00 00          mov    $0x1,%esi
  4018b7:   48 89 df                mov    %rbx,%rdi
  4018ba:   b8 00 00 00 00          mov    $0x0,%eax
  4018bf:   e8 ac f5 ff ff          call   400e70 <__sprintf_chk@plt>
  4018c4:   ba 09 00 00 00          mov    $0x9,%edx
  4018c9:   48 89 de                mov    %rbx,%rsi
  4018cc:   48 89 ef                mov    %rbp,%rdi
  4018cf:   e8 cc f3 ff ff          call   400ca0 <strncmp@plt>
  4018d4:   85 c0                   test   %eax,%eax
  4018d6:   0f 94 c0                sete   %al
  4018d9:   0f b6 c0                movzbl %al,%eax
  4018dc:   48 8b 74 24 78          mov    0x78(%rsp),%rsi
  4018e1:   64 48 33 34 25 28 00    xor    %fs:0x28,%rsi
  4018e8:   00 00
  4018ea:   74 05                   je     4018f1 <hexmatch+0xa5>
  4018ec:   e8 ef f3 ff ff          call   400ce0 <__stack_chk_fail@plt>
  4018f1:   48 83 ec 80             sub    $0xffffffffffffff80,%rsp
  4018f5:   5b                      pop    %rbx
  4018f6:   5d                      pop    %rbp
  4018f7:   41 5c                   pop    %r12
  4018f9:   c3                      ret

00000000004018fa <touch3>:
  4018fa:   53                      push   %rbx
  4018fb:   48 89 fb                mov    %rdi,%rbx
  4018fe:   c7 05 d4 2b 20 00 03    movl   $0x3,0x202bd4(%rip)        # 6044dc <vlevel>
  401905:   00 00 00
  401908:   48 89 fe                mov    %rdi,%rsi
  40190b:   8b 3d d3 2b 20 00       mov    0x202bd3(%rip),%edi        # 6044e4 <cookie>
  401911:   e8 36 ff ff ff          call   40184c <hexmatch>
  401916:   85 c0                   test   %eax,%eax
  401918:   74 23                   je     40193d <touch3+0x43>
  40191a:   48 89 da                mov    %rbx,%rdx
  40191d:   be 38 31 40 00          mov    $0x403138,%esi
  401922:   bf 01 00 00 00          mov    $0x1,%edi
  401927:   b8 00 00 00 00          mov    $0x0,%eax
  40192c:   e8 bf f4 ff ff          call   400df0 <__printf_chk@plt>
  401931:   bf 03 00 00 00          mov    $0x3,%edi
  401936:   e8 52 03 00 00          call   401c8d <validate>
  40193b:   eb 21                   jmp    40195e <touch3+0x64>
  40193d:   48 89 da                mov    %rbx,%rdx
  401940:   be 60 31 40 00          mov    $0x403160,%esi
  401945:   bf 01 00 00 00          mov    $0x1,%edi
  40194a:   b8 00 00 00 00          mov    $0x0,%eax
  40194f:   e8 9c f4 ff ff          call   400df0 <__printf_chk@plt>
  401954:   bf 03 00 00 00          mov    $0x3,%edi
  401959:   e8 f1 03 00 00          call   401d4f <fail>
  40195e:   bf 00 00 00 00          mov    $0x0,%edi
  401963:   e8 d8 f4 ff ff          call   400e40 <exit@plt>

A: The stack grows downwards and data is written upward.
When getbuf is called the stack pointer has a definite value, let's call it sp0.
getbuff then grows the stack by 0x30 bytes: 0x8 with its return address and 0x28 with sub rsp, 0x28. The stack pointer is now at sp0 - 0x30. Your input is copied at this address upward (sp-0x30, sp-0x2f, sp-0x2e, ...).
When getbuf returns, the stack is shrunk back to sp0 but this is not a destructive operation, the data is still there. The shrinking is done with an add.
The red zone will also guarantee that no external event will overwrite this data.
Remember: The input data is at
sp0-0x30 and continues upward, the stack pointer is at sp0, 0x30 bytes above the data, and move downward.
Lately, touch3 and hexmatch are called. When this happens the stack pointer is at sp0 and both these functions can push data and move the stack pointer down towards sp0-0x30, where your input string starts.
If these functions end up pushing too much data on the stack they will reach your string.
| sp0        | <-- The stack pointer before touch3 is here
|            |
|            |    | direction of successive push on the stack
|            |    V
|            |
|            |    ^
|            |    | direction of successive chars in the string
|            |
| sp0 - 0x30 | <-- Your string starts here.

If the string will be overwritten depends on its length and the exact calling sequence and the code executed.


text:
Q: How would I create a matrix using strings? For example, if I have {[1 0 3; 2 0 3; 3 0 3]}, how would I make it look like
1 0 3
2 0 3
3 0 3
I know I have to use delimters to separate 1 0 3 from 2 0 3. I can use the size of the string as my rows right? If I can get some help that would be fantastic.

A: If you want to print them in a console window then do something like this:
string str = "1 0 3; 2 0 3; 3 0 3";
string[] split = str.Split(';');

foreach (string s in split) //OR for (int i = 0; i < split.Length; i++)
{
    Console.WriteLine(s);
}

If those {} and [] are actually your unwanted characters then just do a String.Trim or String.Remove
When you do str.Split(';'), 1 0 3 is stored in split[0], 2 0 3 in split[1], and so on. And of course, split[0][0] would be 1, split[0][1] would be 0. With that in mind you should know what to do with these arrays.
edit: I guess this is what you want:
for (int i = 0; i < split.Length; i++)
{
    for (int j = 0; j < split[i].Length; j++)
    {
        Console.Write(split[i][j]);
    }
    Console.WriteLine();
}


text:
Q: Valor nothing em uma consulta a uma tag da xml usando linq .net Tenho a seguinte xml:
<ns1:TRetLote_GNRE xmlns="http://www.gnre.pe.gov.br" xmlns:ns1="http://www.gnre.pe.gov.br">
  <ns1:ambiente>1</ns1:ambiente>
  <ns1:situacaoRecepcao>
    <ns1:codigo>100</ns1:codigo>
    <ns1:descricao>Lote recebido com Sucesso</ns1:descricao>
  </ns1:situacaoRecepcao>
  <ns1:recibo>
    <ns1:numero>1600831117</ns1:numero>
    <ns1:dataHoraRecibo>2016-01-14 14:18:48</ns1:dataHoraRecibo>
    <ns1:tempoEstimadoProc>2000</ns1:tempoEstimadoProc>
  </ns1:recibo>
</ns1:TRetLote_GNRE>

E estou usando o seguinte código para pegar o valor da tag 'codigo'
   Dim xmlBase As String = retorno.OuterXml
   Dim xXml As XElement = XElement.Parse(xmlBase)
   Dim num As String = xXml.Elements("codigo").Value

Porém está retornando 'Nothing', pode ser o namespace da xml ?

A: É preciso criar uma variável com o namespace e depois concatena-lo junto a tag de busca:
    Dim xmlBase As String = retorno.OuterXml
    Dim xXml As XDocument = XDocument.Parse(xmlBase)

    Dim nspace As XNamespace = "http://www.gnre.pe.gov.br"

    Dim num As String = xXml.Descendants(nspace + "codigo").Value


text:
Q: Istio istio-ingressgateway throwing "no cluster match for URL '/'" I have Istio installed on docker-desktop.  In general it works fine.  I'm attempting to setup an http-based match on a very simple virtual service, but I'm only able to get 404s.  Here are the technical details.
My endpoint image is hashi http-echo which uses the net/http library to create a trivial http server that returns a message you supply.  It works just fine and couldn't be more trivial.
Here is my pod and service configuration:
kind: Pod
apiVersion: v1
metadata:
  name: a
  labels:
    app: a
    version: v1
spec:
  containers:
  - name: a
    image: hashicorp/http-echo
    args:
    - "-text='this is service a: v1'"
    - "-listen=:6789"
---
kind: Service
apiVersion: v1
metadata:
  name: a-service
spec:
  selector:
    app: a
    version: v1
  ports:
  # Default port used by the image
  - port: 6789
    targetPort: 6789
    name: http-echo

And here is an example of the service working by my curling it from another pod in the same namespace:
/ # curl 10.1.0.29:6789
'this is service a: v1'

And here's the pod running in the docker-desktop cluster:
NAME       READY   STATUS    RESTARTS   AGE     IP          NODE             NOMINATED NODE   READINESS GATES
a          2/2     Running   0          45h     10.1.0.29   docker-desktop   <none>           <none>

And here is the service registering and administrating the pod:
NAME         TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)    AGE     SELECTOR
a-service    ClusterIP   10.101.113.9   <none>        6789/TCP   45h     app=a,version=v1

Here is my istio istio-ingressgateway pod specification via Helm (seems to work fine) which I list as this is the only part of the installation I've changed and the change itself is utterly trivial (just add a single new port block which seems to work fine as listening is indeed occurring):
gateways:
  istio-ingressgateway:
    name: istio-ingressgateway
    labels:
      app: istio-ingressgateway
      istio: ingressgateway
    ports:
    - port: 15021
      targetPort: 15021
      name: status-port
      protocol: TCP
    - port: 80
      targetPort: 8080
      name: http2
      protocol: TCP
    - port: 443
      targetPort: 8443
      name: https
      protocol: TCP
    - port: 6789
      targetPort: 6789
      name: http-echo
      protocol: TCP

And here is the kubectl get svc on the istio-ingressgateway just to show that indeed I have an external-ip and things look normal:
NAME                   TYPE           CLUSTER-IP      EXTERNAL-IP   PORT(S)                                                     AGE     SELECTOR
istio-ingressgateway   LoadBalancer   10.109.63.15    localhost     15021:30095/TCP,80:32454/TCP,443:31644/TCP,6789:30209/TCP   2d16h   app=istio-ingressgateway,istio=ingressgateway
istiod                 ClusterIP      10.96.155.154   <none>        15010/TCP,15012/TCP,443/TCP,15014/TCP                       2d16h   app=istiod,istio=pilot

Here's my virtualservice:
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: a-service
  namespace: default
spec:
  hosts:
  - 'a-service.default.svc.cluster.local'
  gateways:
  - gateway
  http:
  - match:
    - port: 6789
    route:
    - destination:
        host: 'a-service.default.svc.cluster.local'
        port:
          number: 6789

Here's my gateway:
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
  name: gateway
  namespace: default
spec:
  selector:
    app: istio-ingressgateway
  servers:
  - port:
      number: 6789
      name: http-echo
      protocol: http
    hosts:
    - 'a-service.default.svc.cluster.local'

And then finally here's a debug log from the istio-ingressgateway showing that despite all these seemingly correct pod, service, gateway, virtualservice and ingressgateway configs, the ingressgateway is only return 404s:
2021-09-27T15:34:41.001773Z debug   envoy connection    [C367] closing data_to_write=143 type=2
2021-09-27T15:34:41.001779Z debug   envoy connection    [C367] setting delayed close timer with timeout 1000 ms
2021-09-27T15:34:41.001786Z debug   envoy pool  [C7] response complete
2021-09-27T15:34:41.001791Z debug   envoy pool  [C7] destroying stream: 0 remaining
2021-09-27T15:34:41.001925Z debug   envoy connection    [C367] write flush complete
2021-09-27T15:34:41.002215Z debug   envoy connection    [C367] remote early close
2021-09-27T15:34:41.002279Z debug   envoy connection    [C367] closing socket: 0
2021-09-27T15:34:41.002348Z debug   envoy conn_handler  [C367] adding to cleanup list
2021-09-27T15:34:41.179213Z debug   envoy conn_handler  [C368] new connection from 192.168.65.3:62904
2021-09-27T15:34:41.179594Z debug   envoy http  [C368] new stream
2021-09-27T15:34:41.179690Z debug   envoy http  [C368][S14851390862777765658] request headers complete (end_stream=true):
':authority', '0:6789'
':path', '/'
':method', 'GET'
'user-agent', 'curl/7.64.1'
'accept', '*/*'
'version', 'TESTING'

2021-09-27T15:34:41.179708Z debug   envoy http  [C368][S14851390862777765658] request end stream
2021-09-27T15:34:41.179828Z debug   envoy router    [C368][S14851390862777765658] no cluster match for URL '/'
2021-09-27T15:34:41.179903Z debug   envoy http  [C368][S14851390862777765658] Sending local reply with details route_not_found
2021-09-27T15:34:41.179949Z debug   envoy http  [C368][S14851390862777765658] encoding headers via codec (end_stream=true):
':status', '404'
'date', 'Mon, 27 Sep 2021 15:34:41 GMT'
'server', 'istio-envoy'

Here's istioct proxy-status:
istioctl proxy-status                                                                                ⎈ docker-desktop/istio-system
NAME                                                   CDS        LDS        EDS        RDS        ISTIOD                     VERSION
a.default                                              SYNCED     SYNCED     SYNCED     SYNCED     istiod-b9c8c9487-clkkt     1.11.3
istio-ingressgateway-5797689568-x47ck.istio-system     SYNCED     SYNCED     SYNCED     SYNCED     istiod-b9c8c9487-clkkt     1.11.3

And here's istioctl pc cluster $ingressgateway:
SERVICE FQDN                                            PORT      SUBSET     DIRECTION     TYPE           DESTINATION RULE
BlackHoleCluster                                        -         -          -             STATIC
a-service.default.svc.cluster.local                     6789      -          outbound      EDS
agent                                                   -         -          -             STATIC
istio-ingressgateway.istio-system.svc.cluster.local     80        -          outbound      EDS
istio-ingressgateway.istio-system.svc.cluster.local     443       -          outbound      EDS
istio-ingressgateway.istio-system.svc.cluster.local     6789      -          outbound      EDS
istio-ingressgateway.istio-system.svc.cluster.local     15021     -          outbound      EDS
istiod.istio-system.svc.cluster.local                   443       -          outbound      EDS
istiod.istio-system.svc.cluster.local                   15010     -          outbound      EDS
istiod.istio-system.svc.cluster.local                   15012     -          outbound      EDS
istiod.istio-system.svc.cluster.local                   15014     -          outbound      EDS
kube-dns.kube-system.svc.cluster.local                  53        -          outbound      EDS
kube-dns.kube-system.svc.cluster.local                  9153      -          outbound      EDS
kubernetes.default.svc.cluster.local                    443       -          outbound      EDS
prometheus_stats                                        -         -          -             STATIC
sds-grpc                                                -         -          -             STATIC
xds-grpc                                                -         -          -             STATIC
zipkin                                                  -         -          -             STRICT_DNS

And here's istioctl pc listeners on the same ingress:
ADDRESS PORT  MATCH DESTINATION
0.0.0.0 6789  ALL   Route: http.6789
0.0.0.0 15021 ALL   Inline Route: /healthz/ready*
0.0.0.0 15090 ALL   Inline Route: /stats/prometheus*

And finally here's istioctl routes:
NOTE: This output only contains routes loaded via RDS.
NAME          DOMAINS                                 MATCH                  VIRTUAL SERVICE
http.6789     a-service.default.svc.cluster.local     /*                     a-service.default
              *                                       /stats/prometheus*
              *                                       /healthz/ready*

I've tried numerous different configurations from changing selectors, to making sure port names match to trying different ports.  If I change my virtualservice from http to tcp the port match works great.  But because my ultimate goal with this is to do more advanced header-based matching I need to be matching on http.  Any insight would be greatly appreciated!

A: It turned out the problem was that I had specified my service in my hosts directive in both my gateway and virtualservice.  Specifying a service as a hosts entry is almost certainly never correct, though one can "workaround" this by adding a host header to curl, i.e. curl ... -H 'Host: kubernetes.docker.internal' ....  But the correct solution is to simply add correct host entries, i.e. - mysite.mycompany.com etc.  Hosts in this case are like vhosts in Apache; they're an fqdn that resolves to something the mesh and cluster can use to send requests to.  host, however, in virtualservice destination is the service, which is a bit convoluted and is what threw me.


text:
Q: Public office draft I remember a story where public offices were filled not by candidates running, but by selection, similar to jury duty.  Does this ring any bells?

A: There is a short story by Asimov, called "Franchise".
But it's the voter, not the candidates, that is drafted. Since computers have become better at predicting the outcome of elections, only a single voter is drafted.

The man presented credentials, stepped into the house, closed the door behind him and said ritualistically, "Mr. Norman Muller, it is necessary for me to inform you on the behalf of the President of the United States that you have been chosen to represent the American electorate on Tuesday, November 4, 2008."

He is then interviewed by the computer, MultiVac, about all kinds of seemingly unrelated issues.

"Now let me explain, Mr. Muller," Paulson went on. "Multivac already has most of the information it needs to decide all the elections, national, state and local. It needs only to check certain imponderable attitudes of mind and it will use you for that. We can't predict what questions it will ask, but they may not make much sense to you, or even to us. It may ask you how you feel about garbage disposal in your town; whether you favor central incinerators. It might ask you whether you have a doctor of your own or whether you make use of National Medicine, Inc. Do you understand?"

From this, the computer decides the outcome of the election.

In this imperfect world, the sovereign citizens of the first and greatest Electronic Democracy had, through Norman Muller (through him!) exercised once again its free, untrammeled franchise.

A: Perhaps the novel version of Clarke's The Songs of Distant Earth? My recollection is that public officials were chosen at random; as long as they weren't criminals or insane, they were compelled to serve a term in whatever job they had been selected for.


text:
Q: Detect keyboard's focus and paste from clipboard, automatically using Python I am using Python and trying to paste an already copied text from the clipboard automatically to an active textbox or anything that has the keyboard's focus. In other words, the program should paste automatically the copied data from clipboard once I click for example on a browser's address bar or any text editor or any text box.
Is this possible in python? is there any function for this? I have searched on the website but did not find any good solution.
If possible, a small demo would be appreciated.
Thank You.

A: You can use SendInput to grab the focus of the current window and input characters. Here is an implementation that should work for your purposes. It takes the contents of the clipboard and types them out if the object in focus collects such keyboard input.
import time
import string
import ctypes
import ctypes.wintypes

# part one: clipboard text retrieval
CF_UNICODETEXT = 13  # unicode text format; terminates with a linefeed

OpenClipboard = ctypes.windll.user32.OpenClipboard
OpenClipboard.argtypes = ctypes.wintypes.HWND,
OpenClipboard.restype = ctypes.wintypes.BOOL

GetClipboardData = ctypes.windll.user32.GetClipboardData
GetClipboardData.argtypes = ctypes.wintypes.UINT,
GetClipboardData.restype = ctypes.wintypes.HANDLE

GlobalLock = ctypes.windll.kernel32.GlobalLock
GlobalLock.argtypes = ctypes.wintypes.HGLOBAL,
GlobalLock.restype = ctypes.wintypes.LPVOID

GlobalUnlock = ctypes.windll.kernel32.GlobalUnlock
GlobalUnlock.argtypes = ctypes.wintypes.HGLOBAL,
GlobalUnlock.restype = ctypes.wintypes.BOOL

CloseClipboard = ctypes.windll.user32.CloseClipboard
CloseClipboard.argtypes = None
CloseClipboard.restype = ctypes.wintypes.BOOL

def get_clipboard_text():
    text = ""
    if OpenClipboard(None):
        h_clip_mem = GetClipboardData(CF_UNICODETEXT)
        text = ctypes.wstring_at(GlobalLock(h_clip_mem))
        GlobalUnlock(h_clip_mem)
        CloseClipboard()
    return text

CB_TEXT = get_clipboard_text()

# part two: typing it into the focused element of a window

LONG = ctypes.c_long
DWORD = ctypes.c_ulong
ULONG_PTR = ctypes.POINTER(DWORD)
WORD = ctypes.c_ushort

VK_SHIFT = 0x10  # Shift key
# special keys
VK_OEM_1 = 0xBA
VK_OEM_PLUS = 0xBB
VK_OEM_COMMA = 0xBC
VK_OEM_MINUS = 0xBD
VK_OEM_PERIOD = 0xBE
VK_OEM_2 = 0xBF
VK_OEM_3 = 0xC0
VK_OEM_4 = 0xDB
VK_OEM_5 = 0xDC
VK_OEM_6 = 0xDD
VK_OEM_7 = 0xDE
KEYEVENTF_KEYUP = 0x0002  # Releases the key
INPUT_KEYBOARD = 1

UPPER = frozenset('~!@#$%^&*()_+QWERTYUIOP{}|ASDFGHJKL:"ZXCVBNM<>?')
LOWER = frozenset("`1234567890-=qwertyuiop[]\\asdfghjkl;'zxcvbnm,./")
ORDER = string.ascii_letters + string.digits + ' \b\r\t'
ALTER = dict(zip('!@#$%^&*()', '1234567890'))
OTHER = {
    '`': VK_OEM_3, '~': VK_OEM_3, '-': VK_OEM_MINUS, '_': VK_OEM_MINUS,
    '=': VK_OEM_PLUS, '+': VK_OEM_PLUS, '[': VK_OEM_4, '{': VK_OEM_4,
    ']': VK_OEM_6, '}': VK_OEM_6, '\\': VK_OEM_5, '|': VK_OEM_5,
    ';': VK_OEM_1, ':': VK_OEM_1, "'": VK_OEM_7, '"': VK_OEM_7,
    ',': VK_OEM_COMMA, '<': VK_OEM_COMMA, '.': VK_OEM_PERIOD,
    '>': VK_OEM_PERIOD, '/': VK_OEM_2, '?': VK_OEM_2
}

class KEYBDINPUT(ctypes.Structure):
    _fields_ = (
        ('wVk', WORD),
        ('wScan', WORD),
        ('dwFlags', DWORD),
        ('time', DWORD),
        ('dwExtraInfo', ULONG_PTR)
    )

class INPUT(ctypes.Structure):
    _fields_ = ('type', DWORD), ('ki', KEYBDINPUT), ('pad', ctypes.c_ubyte * 8)

def Input(structure):
    return INPUT(INPUT_KEYBOARD, structure)

def KeyboardInput(code, flags):
    return KEYBDINPUT(code, code, flags, 0, None)

def Keyboard(code, flags=0):
    return Input(KeyboardInput(code, flags))

def SendInput(*inputs):
    nInputs = len(inputs)
    LPINPUT = INPUT * nInputs
    pInputs = LPINPUT(*inputs)
    cbSize = ctypes.c_int(ctypes.sizeof(INPUT))
    return ctypes.windll.user32.SendInput(nInputs, pInputs, cbSize)

def stream(string):
    mode = False
    for character in string.replace('\r\n', '\r').replace('\n', '\r'):
        if mode and character in LOWER or not mode and character in UPPER:
            yield Keyboard(VK_SHIFT, mode and KEYEVENTF_KEYUP)
            mode = not mode
        character = ALTER.get(character, character)
        if character in ORDER:
            code = ord(character.upper())
        elif character in OTHER:
            code = OTHER[character]
        else:
            continue
            raise ValueError('Undecoded')
        yield Keyboard(code)
        yield Keyboard(code, KEYEVENTF_KEYUP)
    if mode:
        yield Keyboard(VK_SHIFT, KEYEVENTF_KEYUP)

def send_clipboard():
    for k in stream(CB_TEXT + '\r'):
        SendInput(k)

def demo(wait=3):
    time.sleep(wait)
    send_clipboard()

if __name__ == '__main__':
    demo()


text:
Q: How do I use a for loop in a django template? In my django view, I have a list that looks like the above (except 50 lists embedded within the big list.
In my template, how do I use a for loop to reference to display each of the elements within every list?
I am also trying to access a particular element within a list, for example the element 'c' in the below example.  I tried feed[0][1] in the template but received an error.
feed = [ [0,a,b,c], [1,d,e,f], ... ]

{% for video in feed %}
#not sure what to put here
{% endfor %}

A: Something like this:
{% for video in feed %}
    {%for item in video %}
         {{item}} {% comment %} render it appropriately {% endcomment %}
    {%endfor%}
{% endfor %}

video is again a list so you can again iterate over it to get item in it and use it to render appropriate html.
EDIT: With reference to comment by #jdi and updated question, if you want to access particular element of list you can do:
{% video in feed %}
    {{ video.3 }}    {% comment %} To access 3rd element {% endcomment %}
    {{ video|last }} {% comment %} To access last element {% endcomment %}
{%endfor%}

A: I use
 {%for D in TablePivot %}

        {%for valor in D %}
        {{valor}}
        {%endfor%}

 {%endfor%}


text:
Q: При отключении анонимуса в Spring Security все url-ы автоматически выдают 403 Есть Spring Boot проект, где используется Spring Security.
Процесс авторизации идет через сессию и при успешной авторизации приложение сохраняет в cookie информацию.
Для /login и /logout я сделал доступ url-ов как permitAll, а остальные url-ы расписал как authenticated.
Когда пользователь стучится в защищенные url-ы без авторизации пишет что работает anonymousUser.
При отладке видно что Spring Security если не получает запрос от авторизованного пользователя, то автоматом подставляет anonymousUser.
Как решение в Spring Security Configuration я выключил в http.build анонимный доступ(anonymous.disable()), но таким образом все мои url-ы, в том числе и /login и /logout попадают под 403 Forbidden.
В чем дело и как можно решить проблему?
@Configuration
@EnableWebSecurity
public class SecurityConfiguration {

    public static final String SESSION_ATTRIBUTE = "JSESSIONID";

    @Bean
    public SessionRegistry sessionRegistry() {
        return new SessionRegistryImpl();
    }

    @Bean
    public AuthenticationManager authenticationManager(AuthenticationConfiguration authenticationConfiguration)
            throws Exception {
        return authenticationConfiguration.getAuthenticationManager();
    }

    @Bean
    public WebSecurityCustomizer webSecurityCustomizer() {
        return (web) -> web.ignoring()
                .antMatchers("/v3/api-docs/**")
                .antMatchers("configuration/**")
                .antMatchers("/swagger*/**")
                .antMatchers("/webjars/**")
                .antMatchers("/swagger-ui/**");
    }

    @Bean
    public CorsConfiguration corsConfiguration() {
        CorsConfiguration corsConfiguration = new CorsConfiguration();
        corsConfiguration.setAllowCredentials(true);
        corsConfiguration.setAllowedMethods(List.of("GET", "POST", "PUT", "DELETE", "OPTIONS"));
        corsConfiguration.setAllowedOriginPatterns(List.of("*:[*]"));
        corsConfiguration.setAllowedHeaders(List.of("*"));
        corsConfiguration.setExposedHeaders(List.of("*"));
        corsConfiguration.setMaxAge(1000L);
        return corsConfiguration;
    }

    @Bean
    public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
        http
                .cors().configurationSource(cors -> corsConfiguration()).and()
                .csrf().disable()
                .anonymous().disable()
                .httpBasic().disable()
                .logout().invalidateHttpSession(true).deleteCookies(SESSION_ATTRIBUTE)
                .and()
                .authorizeRequests()
                .antMatchers("/api/authentication/login", "/api/authentication/logout").permitAll()
                .antMatchers("/api/file/*", "/api/report/*", "/api/user/information/*").authenticated();

        return http.build();
    }
}

build.gradle:
dependencies {
    implementation group: 'org.springframework.boot', name: 'spring-boot-starter-web', version: '2.7.2'
    implementation group: 'org.springframework.boot', name: 'spring-boot-starter-jdbc', version: '2.7.2'
    implementation group: 'org.springframework.boot', name: 'spring-boot-starter-security', version: '2.7.2'
    implementation group: 'org.springframework.boot', name: 'spring-boot-starter-validation', version: '2.7.2'

    implementation group: 'com.microsoft.sqlserver', name: 'mssql-jdbc', version: '9.4.1.jre16'

    implementation group: 'org.json', name: 'json', version: '20220320'

    implementation group: 'org.springdoc', name: 'springdoc-openapi-ui', version: '1.6.10'

    implementation group: 'javax.xml.bind', name: 'jaxb-api', version: '2.3.1'

    compileOnly 'org.projectlombok:lombok:1.18.24'

    annotationProcessor 'org.projectlombok:lombok:1.18.24'
}

A: Может я конечно с недосыпа не понимаю ничего, но тут вроде все банально.
Спринг делает ровно то, что у Вас написано:
Вы ему к этим страницам не разрешаете никого пускать - он и не пускает!
Просто разрешите доступ к старницам /login, /logout в filterChain()
.formLogin()
    .loginPage("/login")
    .permitAll()
    .and()
.logout()
    .permitAll()

либо банально:
.antMatchers("/login", "/logout").permitAll()

Итого весь метод:
    @Bean
    public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
        http
                .cors().configurationSource(cors -> corsConfiguration()).and()
                .csrf().disable()
                .anonymous().disable()
                .httpBasic().disable()
                .formLogin()
                    .loginPage("/login")
                    .permitAll()
                    .and()
                .logout()
                    .permitAll()
                    .invalidateHttpSession(true) // дополнил вашими правилами
                    .deleteCookies(SESSION_ATTRIBUTE) // дополнил вашими правилами
                  .and()
                .authorizeRequests()
                .antMatchers("/api/authentication/login", "/api/authentication/logout").permitAll()
                .antMatchers("/api/file/*", "/api/report/*", "/api/user/information/*").authenticated();

        return http.build();
    }

A: Если настроить filterChain подобным образом, то проблем с amonymous пользователем не будет:
@Bean
    public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
        http
                .cors().configurationSource(cors -> corsConfiguration()).and()
                .csrf().disable()
                .httpBasic().disable()
                .logout().invalidateHttpSession(true).deleteCookies(SESSION_ATTRIBUTE)
                .and()
                .authorizeRequests()
                .antMatchers("/api/authentication/login", "/api/authentication/logout").permitAll()
                .antMatchers("/api/**").authenticated();

        return http.build();
    }


text:
Q: Offsetting posts and alterating a WP_query the correct way I'm having some trouble with ordering a loop! I want to show posts in a Countdown style (5, 4, 3, 2, 1) but using metadata and user inputted data.
I have this data:
Post A with meta data (score = 2)
Post B with meta data (score = 4)
Post C with meta data (score = 6)
Post D with meta data (score = 8)
Post E with meta data (score = 10)

Example user wants to show a top 3 countdown, so $user_input = 3.
The page should then show: Post C, Post D, Post E. (ordered by meta score and showing the best score last).
I have a wp_query loop as so:
   $args = array('meta_key' => 'score', 'orderby' => 'meta_value_num', 'order' => 'ASC', 'posts_per_page' => $user_input);
   $qry= new WP_Query( $args );
        $count_posts = $qry->post_count;
        $offset = $count_post - $user_input
        while ( $qry->have_posts()  ) : $qry->the_post();
              // echo stuff

It works, except that because it is set to order=ASC and posts per page is now set to 3 (when there are 5 posts in the category) it shows Post A, Post B, Post C. And that is what I need it to show except that it should be C,D,E.
I thought I needed to offset the wp_query, but I can't add an 'offset' into the args array because I don't know how many posts are in the category. I need to do a post_count after the WP_Query and substract user_input to know how many I need to offset by. So that's why I put the calculation for $offset.
My question is. How do I alter the WP_query the correct way? Is a
 query_posts('offset'.$offset.'&showposts'.$user_input)

after the offset is calculated a bad way of doing it because it is doing another query?
Is there a way to easy add a parameter to the wp_query after it has already been set?
Thanks guys

A: A quickfix would be to change the order in your query to 'DESC' instead of 'ASC'. This will get you the 3 biggest scores. Then you can fetch the posts in an array using $qry->get_posts() but they will still be in the wrong order. Simply do a array_reverse() to sort it in  the order you want. The only difference in the loop is that you loop normally through the items like an array and use the setup_postdata() function instead of $qry->the_post()
<?php

// Set order to DESC
$args = array('meta_key' => 'score', 'orderby' => 'meta_value_num', 'order' => 'DESC', 'posts_per_page' => $user_input);

$qry = new WP_Query( $args );

// Fetch the posts and reverse it to get the wanted order
$posts = array_reverse( $qry->get_posts() );

foreach ( $posts as $post ) : setup_postdata( $post ); // sets up postdata in the same way as $qry->the_post();

    // ...

endforeach;

wp_reset_postdata(); // reset postdata after the loop

?>


text:
Q: OS X Yosemite (10.10) API for continuous speech recognition OSX has now had continuous speech recognition built in for several versions.
It is remarkably good now.
Does OSX 10.10 have an API for this continuous speech recognition engine?
Googling tells me that circa 2009 there was only NSSpeechRecogniser (MS SAPI sdk equivalent on OSX)
Can anyone confirm whether this is still the case?
I'm asking because I am looking at building my own integrated UI, which would be a mix of Leap controller and speech input.
If only I could use OSX's engine, this would be fantastic. Otherwise I don't think I have any other good/viable option.


text:
Q: changing password - issue with ldap update I have set directory 389 and 1 server to be client for testing authentication of users, etc.
For installation of Directory I have used this tutorial:
Install And Configure LDAP Server In CentOS 7
For installing client I have used this tutorial:
How to Install Configure LDAP Client for 389 Directory Server
Now ds-389 and client authentication works, but when I try to change password of ldap user I get some weird message:

May 20 13:40:55 server passwd: pam_unix(passwd:chauthtok): user "test"
  does not exist in /etc/passwd May 20 13:41:06 server passwd:
  pam_unix(passwd:chauthtok): user "test" does not exist in /etc/passwd
  May 20 13:41:06 server passwd: pam_ldap(passwd:chauthtok): password
  change failed: password change failed: Confidentiality required;
  user=test May 20 13:41:06 server passwd: gkr-pam: couldn't change
  password for the login keyring: the passwords didn't match. May 20
  13:41:06 server passwd: gkr-pam: stopped the daemon

Does anyone know what can be the problem?
my pam config looks like this:
password-auth:
#%PAM-1.0
# This file is auto-generated.
# User changes will be destroyed the next time authconfig is run.
auth        required      pam_env.so
auth        required      pam_faildelay.so delay=2000000
auth        sufficient    pam_unix.so nullok try_first_pass
auth        sufficient    pam_ldap.so use_first_pass
auth        required      pam_deny.so

account     required      pam_access.so
account     required      pam_unix.so broken_shadow
account     sufficient    pam_localuser.so
account     sufficient    pam_succeed_if.so uid < 1000 quiet
account     [default=bad success=ok user_unknown=ignore] pam_ldap.so
account     required      pam_permit.so

password    requisite     pam_pwquality.so try_first_pass local_users_only retry=3 authtok_type=
password    sufficient    pam_unix.so sha512 shadow nullok try_first_pass use_authtok
password    sufficient    pam_ldap.so use_authtok

password    required      pam_deny.so

session     optional      pam_keyinit.so revoke
session     required      pam_limits.so
-session     optional      pam_systemd.so
session     optional      pam_oddjob_mkhomedir.so skel=/etc/skel umask=0077
session     [success=1 default=ignore] pam_succeed_if.so service in crond quiet use_uid
session     required      pam_unix.so
session     optional      pam_ldap.so

system-auth
#%PAM-1.0
# This file is auto-generated.
# User changes will be destroyed the next time authconfig is run.
auth        required      pam_env.so
auth        required      pam_faildelay.so delay=2000000
auth        sufficient    pam_fprintd.so
auth        sufficient    pam_unix.so nullok try_first_pass
auth        sufficient    pam_ldap.so use_first_pass
auth        required      pam_deny.so

account     required      pam_access.so
account     required      pam_unix.so broken_shadow
account     sufficient    pam_localuser.so
account     sufficient    pam_succeed_if.so uid < 1000 quiet
account     [default=bad success=ok user_unknown=ignore] pam_ldap.so
account     required      pam_permit.so

password    requisite     pam_pwquality.so try_first_pass local_users_only retry=3 authtok_type=
password    sufficient    pam_unix.so sha512 shadow nullok try_first_pass use_authtok
password    sufficient    pam_ldap.so use_authtok
password    required      pam_deny.so

session     optional      pam_keyinit.so revoke
session     required      pam_limits.so
-session     optional      pam_systemd.so
session     optional      pam_oddjob_mkhomedir.so skel=/etc/skel umask=0077
session     [success=1 default=ignore] pam_succeed_if.so service in crond quiet use_uid
session     required      pam_unix.so
session     optional      pam_ldap.so

A: OK, in my case I wasted one full day of playing with configuration and wireshark to find out that in order to have ability for users to change their password, you need to have on ds-389 encryption enabled, and your client needs to connect to port 636 SSL/TLS to "SECURELY" pass confidential data, in our case password.
Kinda feel stupid after skipping most important part ;D
So in order for system to run properly, first we need to generate certificate on ds-389
For this, I used this short tutorial:
Configure TLS SSL 389 Directory Server CentOS
Please be aware to set PIN for your ds-389 and restart services, of course...
So after you have set everything on your ds-389, next step is to put client to connect to specific port.
As prerequisite, you need to export crt to pem by using this command:
openssl x509 -in ca-cert.crt -out ca-cert.pem -outform PEM

copy that ca-cert.pem to your (client) for example from home folder where you scp ca-cert.pem (or wherever you copied that file)
mv (scp-cert-path)/ca-cert.pem /etc/openldap/cacerts/

And as a final step use authconfig-tui to set your client to use TLS instead of 389 port with plain text...
You can follow these steps from this link:
How to Install Configure LDAP Client for 389 Directory Server
I hope that I helped someone to save some time and torture of Google-ing around ;)
Cheers.


text:
Q: Changes in ML module in opencv from 3.0.0-beta to 3.0.0 (and rc1) In class EM in ml.hpp,
This piece of code below exists in 3.0.0-dev, 3.0.0-alpha but doesn't exist in 3.0.0 and 3.0.0-rc1 . The documentation for 3.0.0-dev says this exists †
class CV_EXPORTS_W_MAP Params
{
public:
    explicit Params(int nclusters=DEFAULT_NCLUSTERS, int covMatType=EM::COV_MAT_DIAGONAL,
        const TermCriteria& termCrit=TermCriteria(TermCriteria::COUNT+TermCriteria::EPS,
                                                              EM::DEFAULT_MAX_ITERS, 1e-6));
CV_PROP_RW int nclusters;
    CV_PROP_RW int covMatType;
    CV_PROP_RW TermCriteria termCrit;
};

Did opencv change a freaking library in the middle of a major release ? or am I missing something ?


text:
Q: Every locally integrable function defines a Radon measure I have just started with Measure Theory and I have read several times that

Every locally integrable function defines a Radon measure.

I understand this statement in the sense that if we have $f\in L^1_{loc}(\mathbb{R}^N)$ (respecto to Lebesgue measure) , then $\mu(E)=\int_{E}f(x)dx$ (where the integral is respect to Lbesgue measure) defines a Radon measure. Is this right? How could I prove it?
Is there any measure which is not of this form?
Maybe these questions are trivial, but I am a little lost.
Thanks.
Edit: After see the answer of @JustDroppedIn I was wondering what happens if $f$ is not non-negative.  I thought that in this case we would obtain a signed measure. However, if $f$ we descompose $f=f^+-f^-$, where $f^+=\frac{f+|f|}{2}\geq{0}$ and $f^-=\frac{f-|f|}{2}\geq{0}$, then $\mu(E)=\int_E f=\int_E f^+-\int_E f^- $ and, by the answer of @JustDroppedIn, $\mu$ is the difference of two positive Radon measures. The problem is that this difference doesn't have to bee a signed measure so I would like to know what extra hypothesis we neeed above $f$ to obtain a signed Radon measure.

A: Let's recall: a Radon measure is a measure $\mu:\mathcal{B}(\mathbb{R}^N)\to[0,\infty]$ such that $\mu$ is regular and $\mu$ is locally finite. Suppose that $f\in L^1_{loc}(\mathbb{R}^N)$ and that $f\geq0$. Define $\mu(E)=\int_Ef$. This is a measure and the fact that $f\in L^1_{loc}$ shows immediately that $\mu$ is locally finite. Regularity of $\mu$ follows directly from the regularity of the Lebesgue measure and an application of the well-known convergence theorems.


text:
Q: Elementary problems that would've been hard for past mathematicians, but are easy to solve today? I'm looking for problems that due to modern developments in mathematics would nowadays be reduced to a rote computation or at least an exercise in a textbook, but that past mathematicians (even famous and great ones such as Gauss or Riemann) would've had a difficult time with.
Some examples that come to mind are group testing problems, which would be difficult to solve without a notion of error-correcting codes, and -- for even earlier mathematicians -- calculus questions such as calculating the area  of some $n$-dimensional body.
The questions have to be understandable to older mathematicians and elementary in some sense. That is, past mathematicians should be able to appreciate them just as well as we can.

A: This sum-of-squares theorem of Fermat may qualify as an example:

An odd prime $p$ is expressible as the sum of squares $x^2+y^2$ if and only if $p\equiv 1 \text{ mod } 4$.

You can read this Wikipedia article (as of the most recent update to this answer) to see the difference in mental effort in the original proof by Euler, as opposed to a modern treatment using the fact that the Gaussian integers are a Euclidean domain.

A dual example: I think Brouwer would be astonished and pleased to know that the Brouwer fixed point theorem can now be proven for the simplex (and, with more effort, for convex polytopes) with absolutely no knowledge of topology; just some affine geometry and combinatorial intuition to prove Sperner's Lemma, and basic analysis to translate to the continuous setting.
It's still not an "easy" proof but it is an example of a classical problem that we now can solve with considerably less machinery, instead of the above example, whose ease of proof can be chalked up to more machinery.

A: In the nineteenth century expressing the antiderivative of an elementary function as an elementary function was an open problem.
Nowadays, Risch algorithm, which can be run on machines, decides whether such operation can be done and, if so, yields a version of the correct result.
I cannot speak for past mathematicians, but I think this is a useful tool.
Added: @columbus8myhw made a very important technical remark in the comments, which is also explained in the last part of the wikipedia article.

A: That there exist transcendental numbers. This was first shown by Liouville, who proved that Liouville's number:
$$\sum_{i=0}^\infty10^{-i!}$$
is transcendental.
The "modern" proof would be due to Cantor:

There are countably many algebraic numbers and uncountably many reals. Therefore there exists a transcendental number.

Proving that Liouville's number is transcendental isn't so hard, but compared to the above it seems quite torturous.

A: I would say that computing the Fourier coefficients of a tamed function is a triviality today even at an engineering math 101 level.
Ph. Davis and R. Hersh tell the long and painful story of  Fourier series.
I quote from their book:

"Fourier didn't know Euler had already done this, so he did it over. And Fourier, like Bernoulli and Euler before him,  overlooked the beautifully direct method of orthogonality [...]. Instead, he went through an incredible computation, that could serve as a classic  example of physical insight leading to the right answer in spite of flagrantly wrong reasoning."

(Fifth Ch. "Fourier Analysis".)