text:
Q: Is there a complete eclipse package? Until now I used Netbeans and want to try eclipse now.
I went to the eclipse site and wanted to download it. I am totally confused with the package.
There are different packages for C, Java, PHP ... development. Well I want to develop in all these languages and in addition in PERL and Python.
When I download one of these packages, do I have to add plugins for all the other languages, or is there a general package, which is packed with many plugins?

A: As far as I know there is not a ready-made package that contains support for everything.
You can download one of the packages and add support for other languages, frameworks etc. later by installing more plug-ins (select Help / Install New Software... in Eclipse's menu).

A: Maybe the Compare page can give you some clarification
http://www.eclipse.org/downloads/compare.php


text:
Q: how to convert symfony2 datetime object from MongoDB Hi I need to check multiple dates for reminder section of my application.
But when I fetch dates from mongodb I am getting this:
DateTime Object
(
    [date] => 2014-03-31 15:00:00
    [timezone_type] => 3
    [timezone] => Europe/Berlin
)

I am trying this to access date parameter but it is showing me error that dateTime object can not converted into string.
I am looping dateandtime.
Please let me know how can I access date in this situation in symfony.
Thanks

A: The assumption of others is that you recieve a MongoDate object back but you don't since I beleive Symfony actually converts it to a DateTime: http://www.php.net/manual/en/class.datetime.php (I think this comes from Doctrine 2)
What you can do is use the format function: http://www.php.net/manual/en/datetime.format.php like so:
$date->format('Y-M-d h:i:s')

A: You can do this in php (symphony is a php-framework).
All you need is something like this:
date('Y-M-d h:i:s', $yourDateTimeObject->sec);

You can also use __toString method from MongoDate class, but I actually prefer the previous method with sec.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Send images via HTML form I would like to use a form to send a few pictures via email. Unfortunately, this does not work as reliably as I had hoped. If I want to send a few small pictures it works but as soon as the pictures get a little bit bigger they are not noticed at all.
Here is my code
HTML:

                                <button type="button" class="btn btn-outline-send" data-bs-toggle="modal" data-bs-target="#exampleModal">
                                <svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="upload" class="svg-inline--fa fa-upload " role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
                                    <path fill="currentColor" d="M296 384h-80c-13.3 0-24-10.7-24-24V192h-87.7c-17.8 0-26.7-21.5-14.1-34.1L242.3 5.7c7.5-7.5 19.8-7.5 27.3 0l152.2 152.2c12.6 12.6 3.7 34.1-14.1 34.1H320v168c0 13.3-10.7 24-24 24zm216-8v112c0 13.3-10.7 24-24 24H24c-13.3 0-24-10.7-24-24V376c0-13.3 10.7-24 24-24h136v8c0 30.9 25.1 56 56 56h80c30.9 0 56-25.1 56-56v-8h136c13.3 0 24 10.7 24 24zm-124 88c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20zm64 0c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20z"></path>
                                </svg>
                                Dokumente hochladen
                                </button>

Bitte wählen Sie aus, welche Dokumente Sie hochladen möchten.

                                        <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>

                                      <input type="file" class="form-control" id="files" name="uploaded_file[]" accept="image/jpeg, image/jpg, image/gif, image/png, application/pdf" multiple="multiple" value=""/>
                                      <output id="list"></output>

0%

                                              Hinweis: Es können maximal 15 Dateien aufeinmal versendet werden!
Unterstützte Dateiformate: PDF, JPG und PNG

                                          <button type="button" class="btn btn-outline-send" id="clearFiles">Inhalte löschen</button>
                                          <button type="button" class="btn btn-outline-send" data-bs-dismiss="modal">Weiter</button>

PHP:
$totalFiles = count($_FILES['uploaded_file']['tmp_name']);
                    for ($i = 0; $i < $totalFiles; $i++) {
                        //if (($_FILES['uploaded_file']) && $_FILES['uploaded_file']['error'] == UPLOAD_ERR_OK) {
                            $fileMimeType = mime_content_type($_FILES['uploaded_file']['tmp_name'][$i]);
                            $path = $_FILES['uploaded_file']['tmp_name'][$i];
                            $name = $_FILES['uploaded_file']['name'][$i];
                            if(in_array($fileMimeType, $imageMimeTypes)) {
                                $mail->addattachment($path,$name);
                                echo $name . ' successfull
';
                            }
                    }

JavaScript:
    function handleFileSelect(evt) {
  var files = evt.target.files; // FileList object

  // Loop through the FileList and render image files as thumbnails.
  for (var i = 0, f; f = files[i]; i++) {

    // Only process image files.
    if (!f.type.match('image.*') && !f.type.match('pdf')) {
    console.log(f.type)
      continue;
    }

    // A flag to know if the file is an image or a PDF
    let source_is_image = true;
    if(!f.type.match('image.*')){
      source_is_image = false;
    }

    var reader = new FileReader();

    // Closure to capture the file information.
    reader.onload = (function(theFile) {
      return function(e) {
        // Render thumbnail.
        var span = document.createElement('span');

        // Based on the flag, decide to use the image or the PDF logo
        var file = source_is_image ? e.target.result : "images/PDFlogo.png";//"https://upload.wikimedia.org/wikipedia/commons/8/87/PDF_file_icon.svg";

        span.innerHTML = [''
        ].join('');
        document.getElementById('list').append(span);
      };
    })(f);

    // Read in the image file as a data URL.
    reader.readAsDataURL(f);
  }
}

document.getElementById('files').addEventListener('change', handleFileSelect, false);

// To clear the images
document.querySelector("#clearFiles").addEventListener("click", function(){
  document.querySelector("#list").innerHTML = "";
  document.querySelector("#progress_bar").innerHTML = "";
  document.querySelector("#uploaded_image").innerHTML = "";
});

I can not say exactly what it is and hope that I can be helped here


text:
Q: Are all marked order polytopes normal? Richard Stanley showed that order polytopes have a unimoudlar triangulation.
In particular, this implies that they are integrally closed/normal.
One can generalize order polytopes to marked order polytopes,
where the smallest and largest elements are not always 0 and 1 respectively,
but other integers, and the poset do not have unique top and bottom.
For example, Gelfand-Tsetlin polytopes can be realized as the construction above, and it is quite easy to show that these particular polytopes are integrally closed.
However, is it known if ALL marked order polytopes are integrally closed?
Reminder: A convex polytope $P$ with integer vertices is integrally closed if
we have that each integer point $p$ in $kP$ can be expressed as
$p=p_1+\dots+p_k$ where each $p_i$ is an integer point in $P$.

A: I have found a positive answer to this question: One can interpret $p$
as a point in some $kP'$ where $P'$ is the poset where the unknowns are totally ordered, and have fixed lower and upper bounds.
This poset $P'$ can then be seen as a face in a GT-polytope,
so using that the GT-polytopes are integrally closed, it follows that $p$
can be expressed as a sum of points in $P'$, and the inequalities between coordinates are by construction compatible with those in $P$.
Actually, one can show a stronger statement, that each such polytope has regular, unimodular triangulation.


text:
Q: Finding security vulnerabilites in my code - LDAP Search How do i find vulnerabilites in my code here. My assignment is asking me to find the vulnerabilites using no programm so no spotbugs, etc. Is there any website and/or tips for me to find the vulnerabilites. Here's my code
I've tried to google but i've had a hard time finding solid website or doc for finding or helping me find vulnerabilites.
User search in an LDAP directory:
public class LsiLDAPUsers
{
    private void searchRecord( String userSN, String userPassword ) throws NamingException
    {
        Hashtable<String, String> env = new Hashtable<String, String>();
        env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");

        try
        {
            DirContext dctx = new InitialDirContext(env);

            SearchControls sc = new SearchControls();
            String[] attributeFilter = { "cn", "mail" };
            sc.setReturningAttributes(attributeFilter);
            sc.setSearchScope(SearchControls.SUBTREE_SCOPE);
            String base = "dc=lsi,dc=com";

            String filter = "(&(sn=" + userSN + ")(userPassword=" + userPassword + "))";

            NamingEnumeration<?> results = dctx.search(base, filter, sc);
            while (results.hasMore())
            {
                SearchResult sr = (SearchResult) results.next();
                Attributes attrs = (Attributes) sr.getAttributes();
                Attribute attr = (Attribute) attrs.get("cn");
                System.out.println(attr);
                attr = (Attribute) attrs.get("mail");
                System.out.println(attr);
            }
            dctx.close();
        }
        catch (NamingException e)
        {
            // Forward to handler
        }
    }
}

I need to make the code more secure basically. This is one of my code. But i have a lot of work on other part of it. I just need to get a good exemple and/or tips from this one, thanks !!

A: Just a few hints:

*

*a major pillar of secure coding is proper verification of user input. That is the main entry point for most hacks.

*using SSL or TLS for network connections is today's default

*anonymous searching is disabled in most systems today


text:
Q: Is there a method for getting the timezone_type ? (CakePHP 3.x) To get the timezone_type, I can use:
use Cake\I18n\Time;
$now = Time::now();

$type = get_object_vars($now->timezone)['timezone_type'];
// or
$type = $now->getOffset()/60/60;

But is there a more correct solution in СакеPHP 3.x ?

A: As a result, my decision was reduced to the following:
use Cake\I18n\Time;
$now = Time::now();
$res = $now->format('d.m.Y в G:i:s').' UTC'. $now->format('O ') . $now->timezoneName;


text:
Q: Examples where correlation is a misleading measure of dependence between random variables The correlation coefficient (a.k.a. Pearson correlation or linear correlation), measures the strengths of a linear relationship between two random variables. A standard example in quantitative finance textbooks where correlation fails to capture the relationship between two variables is when $X=e^{Z}$ and $Y=e^{\sigma Z}$, where $Z\sim\mathcal{N}(0,1)$ and $\sigma>1$.
It is easy to show that as $\sigma$ increases, the correlation between $X$ and $Y$ becomes zero, even though they are comonotonic, i.e., both are increasing functions of a common factor $Z$, which is the strongest possible form of dependence.
In this example, $X$ and $Y$ are log-normal. This is a common situation in financial applications where prices may have log-normal distributions, except one would typically look at the log-prices $\log(X)$ and $\log(Y)$ for which correlation actually is the appropriate measure of dependence.
Are there other simple examples (ideally related to finance) where correlation is a really misleading measure of the dependence between random variables?


text:
Q: Simulate Concurrent WCF Client Calls And Measure Response Time I am trying to simulate X number of concurrent requests for a WCF Service and measure the response time for each request. I want to have all the requests hit the Service at more or less the same time.
As the first step I spawned X number of Threads, using the Thread class, and have invoked the Start method. To synchronize all the requests, on the Thread callback I open the connection and have a Monitor.Wait to hold the request from being fired, till all the Threads are created and started. Once all the Threads are started, I call Monitor.PulseAll to trigger the method invocation on the WCF Client Proxy.
When I execute the requests this way, I see a huge delay in the response. A request that should just a few milliseconds, is taking about a second.
I also noticed huge lag between the time the request is dispatched and the time it was received at the service method. I measured this by send sending client time stamp as a parameter value to the service method for each request.
I have the following settings. Assume "X" to the Concurrent number of requests I want to fire. Also note with the following settings I don't get any Denial of Service issues.

*

*The Call chain is as follows,Client->Service1->Service2->Service3

*All Services are PerCall with Concurrency set to Multiple.

*Throttling set to X Concurrent calls, X Concurrent Instances.

*MaxConnections, ListenBacklog on the Service to X.

*Min/Max Threads of ThreadPool set to X on both Client and Server (I have applied the patch provided by Microsoft).

Am not sure if the response time I'm measuring is accurate. Am I missing something very trivial?
Any inputs on this would be of great help.
Thanks.
-Krishnan

A: I did find the answer by myself the hard way. All this while, the way I was measuring the response time was wrong. One should spawn X number of threads, where X is the number of concurrent users one wants to simulate. In each thread, open the connection only once and have while loop to only execute the WCF Method that you want to test for a given duration. Measure the response time against each return, accumulate it and average it out against the number of calls that were executed within the given duration.

A: If all your outgoing calls are coming from a single process, it is likely that the runtime is either consolidating multiple requests onto a single open channel or capping the number of concurrent requests to a single target service.  You may have better results if you move each simulated client into its own process, use a named EventWaitHandle to synchronize them, and call #Set() to unleash them all at once.
There is also a limit to the number of simultaneous pending (TCP SYN or SYN/ACK state) outgoing TCP connections allowed by desktop builds of Windows; if you encounter this limit you will get event 4226 logged and the additional simultaneous connections will be deferred.


text:
Q: Why hidden field values not get passed to controller Ionic v1 Hi I have a form in ioinc v1.
<form name="add-form">
        <input type="hidden" ng-model="data.usersId" ng-value="{{userId}}"/>
        <input type="hidden" ng-model="data.loggedInUserId" ng-value="{{LoggedInUserId}}"/>

            Send Message:

                <textarea name="comment" id="comment-textarea" cols="6" rows="6" ng-model="data.message">
                </textarea>

            <button ui-sref="app.profile" style="background-color:red;" class="button button-full button-assertive ink" ng-click="sendMessage()">Send</button>

        </form>

But on click I am not able to get the values of above hidden field in controller its says

undefined

.
//Controller is.

 $scope.sendMessage = function() {
  $scope.data.userId = $scope.data.userId;
  $scope.data.loggedInUserId = $scope.data.loggedInUserId;

  $ionicLoading.show();
   messagingService.storeMessages($scope.data.message,$scope.data.userId,$scope.data.loggedInUserId)

});

Can anyone assist me what is wrong with this?
thanks in advance

A: Is $scope.data initialized in the controller prior to the form function?
This might be caused if it's not.
Try the following code us
 $scope.data = {
   'userId'= null,
   'loggedInUserId': "",
   'message'=''

 }
 $scope.sendMessage = function() {
    $ionicLoading.show();
    messagingService.storeMessages(
    $scope.data.message,
    $scope.data.userId,
    $scope.data.loggedInUserId)
   });

A: The values on ng-model are different to the ones in ng-value.
data is not initialized.
Look at this snippet it may help.

angular.module('myApp', []);

angular.module('myApp')
  .controller('MessageController', ['$scope', MessageController]);

function MessageController($scope) {
  $scope.init = function() {
    $scope.data = {};

    //Data initialized on ctrl start:
    $scope.data.userId = "1234";
    $scope.data.loggedInUserId = "test";

  }

  $scope.sendMessage = function() {
    $scope.data.userId = $scope.data.userId;
    $scope.data.loggedInUserId = $scope.data.loggedInUserId;

    console.log('Do something with data', $scope.data.userId, $scope.data.loggedInUserId,
      $scope.data.message);
  }

  $scope.init();

}
<!DOCTYPE html>

    <form name="add-form">
      <input type="hidden" ng-model="data.usersId" ng-value="{{data.userId}}" />
      <input type="hidden" ng-model="data.loggedInUserId" ng-value="{{data.loggedInUserId}}" />

          Send Message:

                <textarea name="comment" id="comment-textarea" cols="6" rows="6" ng-model="data.message">
                </textarea>

          <button style="background-color:red;" class="button button-full button-assertive ink" ng-click="sendMessage()">Send</button>

    </form>

A:

<form name="add-form">
        <input type="hidden" ng-model="data.userId" ng-value="{{userId}}"/>
        <input type="hidden" ng-model="data.loggedInUserId" ng-value="{{LoggedInUserId}}"/>

            Send Message:

                <textarea name="comment" id="comment-textarea" cols="6" rows="6" ng-model="data.message">
                </textarea>

            <button ui-sref="app.profile" style="background-color:red;" class="button button-full button-assertive ink" ng-click="sendMessage(data)">Send</button>

        </form>

and for fetching data use this:


text:
Q: why aspnetcore service responsetime increase with increase in number of concurrent clients? I have ASPNETCORE webapi.
controller:
[Route("api/[controller]")]
[ApiController]
public class ValuesController : ControllerBase {
    // GET api/values
    [HttpGet]
    public ActionResult<IEnumerable<string>> Get() {
        return new string[] { "value1", "value2" };
    }

    [HttpGet("data")]
    public Stream GetData() {
        var files = Directory.GetFiles(@"C:\TestData\1");
        MemoryStream stream = new MemoryStream();
        foreach (var file in files) {
            var bytes = System.IO.File.ReadAllBytes(file);
            stream.Write(bytes, 0, bytes.Length);
        }
        stream.Seek(0, SeekOrigin.Begin);
        return stream;
    }
}

program.cs:
 public class Program {
        public static void Main(string[] args) {
            CreateWebHostBuilder(args).Build().Run();
        }

        public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
            WebHost.CreateDefaultBuilder(args)
                .UseKestrel()
                .UseStartup<Startup>();
    }

startup class:
 public class Startup {
    public Startup(IConfiguration configuration) {
        Configuration = configuration;
    }

    public IConfiguration Configuration { get; }

    // This method gets called by the runtime. Use this method to add services to the container.
    public void ConfigureServices(IServiceCollection services) {
        services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
    }

    // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
    public void Configure(IApplicationBuilder app, IHostingEnvironment env) {
        if (env.IsDevelopment()) {
            app.UseDeveloperExceptionPage();
        }

        app.UseMvc();
    }
}

Below requests are sent using jmeter with ramp up duration as 0, which means all requests are concurrent.
Below is the response time table req: http://localhost:5000/api/values/data (involves IO)

Below is the response time table req: http://localhost:5000/api/values (involves NO IO)

So my question is, why as the number parallel/concurrent requests increase the response time increasing?
though apsnetcore webapi uses worker threads to serve each request why cant they all complete in same time?
Could any one please explain why does independent worker threads taking more time when there more concurrent requests.
Thanks in advance.


text:
Q: Sorting output from high to low I made a simple program that would just show the input as the output.
My main problem is that I want to sort the output from high to low.
Instead of being sorted from high to low, the output is just the same order as the input.
Can someone check my codes and see why it is not sorting.
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#define size 7
#include<stdlib.h>
struct books
{
    int profit;
};
void load(struct books b[], int n)
{
    int i;
    for (i = 0; i < n; i++)
    {
        printf("Enter profit:\n");
        scanf("%d", &b[i].profit );
    }
}
void print(struct books b[], int n)
{
    int i;
    for (i = 0; i<n; i++)
    {
        printf("Profit is:%d\n",b[i].profit);
    }
}
void sort(struct books b[], int n)
{
    int i; int j;
    books t;
    for (i = 0; i < n-1; i++)
        for (j = 0; j < n-1 ; j++)
            if (b[j].profit < b[j + 1].profit)
            {
                t = b[j];
                b[j] = b[j + 1];
                b[j+1] = t;
            }
}
void main()
{
    books b[size];
    load(b, size);
    print(b, size);
    sort(b, size);
    system("pause");
}

A: If you want to print the sorted list, you need to call sort before calling print:
void main()
{
    books b[size];
    load(b, size);

    sort(b, size);
    print(b, size);

    system("pause");
}

Also, I think you need to define the books struct as
    struct books b[size];

if you want to avoid compiler errors.
Finally, to print the list from low to high rather than high to low you can either modify the sorting algorithm as suggested in the another answer, or you can modify the printing algorithm as below:
void print(struct books b[], int n)
{
    int i;
    for (i = n-1; i>0; i--)
    {
        printf("Profit is:%d\n",b[i].profit);
    }
}

A: Use something like this(inverted bubble sort):
void inverted_sort(books b[], int size){
    int profit;
    bool swap;

    do{
        swap = false;
        for (int i= 0; i < (size - 1); i++){
            if (b[i].profit < b[i + 1].profit){
                profit = b[i].profit;
                b[i].profit = b[i + 1].profit;
                b[i + 1].profit = profit;
                swap = true;
            }
        }

    } while (swap);
}

And remember to change the functions order, inverted_sort() must go before print().
void main()
{
    books b[size];
    load(b, size);
    inverted_sort(b, size);
    print(b, size);

}

Hope this helps!

A: use this :
void sort(struct books b[], int n)
{
    int i; int j;
    books t;
    for (i = 0; i < n; i++)
        for (j = i + 1; j < n ; j++)
            if (b[j].profit > b[i].profit)
            {
                t = b[j];
                b[j] = b[i];
                b[i] = t;
            }
}


text:
Q: How to debug a jQuery autocomplete that is showing only one result? I am new in JS programming. I have designed a jQuery autocomplete functionality in which when user search in search box then matched result will displayed in highlighted text.
But in my code I have a problem: it is displaying search result while searching but it show only first row text highlighted. Other matching result text are not highlighted. Also when I click matched result then list should disappear but list is not disappearing.
Here is my code with HTML and jQuery autocomplete:
HTML Code:-

(function($) {

  var $project = $('#project');

  var projects = [

    {
      value: "Aditi Deshpande",
      icon: "img-profile-pic-lms.png"
    },
    {
      value: "Aarti Roy",
      icon: "img-profile-pic-lms.png"
    },
    {
      value: "Athiya Patil",
      icon: "img-profile-pic-lms.png"
    },
    {
      value: "Priyanka Deshmukh",
      icon: "img-profile-pic-lms.png"
    },
    {
      value: "Priya Sharma",
      icon: "img-profile-pic-lms.png"
    }
  ];
  var temp = true;
  $project.autocomplete({
    minLength: 0,
    source: projects,
    select: function(event, ui) {
      event.preventDefault();
      $project.val(ui.item.label);
      temp = true;
      return false;
    },
    focus: function(event, ui) {
      if (temp) {
        $(this).autocomplete("search");
        temp = false;
      }

    },
    open: function(e, ui) {
      var acData = $(this).data('ui-autocomplete');
      acData
        .menu
        .element
        .find('a')
        .each(function() {
          var me = $('#this');
          var keywords = acData.term.split(' ').join('|');
          me.html(me.text().replace(new RegExp("(" + keywords + ")", "gi"), '$1'));
        });
    }
  });
  $project.data("ui-autocomplete")._renderItem = function(ul, item) {
    var $li = $('
');
    var $img = $('');
    $img.attr({
      src: '../../images/' + item.icon,
      alt: item.label
    });
    $li.attr('data-value', item.label);
    $li.append('');
    $li.find('a').append($img).append("      ")
    $li.find('a').append($img).find("span").append(item.label);
    return $li.appendTo(ul);
  };
  $('#project').autocomplete("search", "");
})(jQuery);

    <input id="project" type="text" value="" />


text:
Q: Page gets reloaded on CSV download in LWC On click of a button, CSV file should get downloaded. I have used below Javascript code for same.
JS:
functionName(){
var anchorTag = document.createElement('a');
anchorTag.href="data:text/csv;charset=utf-8," + encodeURI(csvStringResult); //csv processed data
anchorTag.target="_self";
anchorTag.download="file name.csv";
anchorTag.innerHTML = "link text";
document.body.appendChild(anchorTag);
anchorTag.click();
}

HTML:
<lightning-button variant="destructive" icon-name="utility:download" label="Download" class="slds-m-left_x-small" title="Download"
                onclick={functionName}></lightning-button>

But when I click the button for 1st time, the page gets reloaded.
When I click the button for the second time, the file gets downloaded and the page is not reloaded.
I tried setting anchorTag.href="test.com";. Blank file gets downloaded but still page is reloaded.  When I comment anchorTag.download="file name.csv"; in this case page is not reloaded.
There are 3 buttons on the page doing the same function.
How should I prevent it from reloading for 1st time while downloading the file?

A: Though the same code works for me https://www.salesforcecodecrack.com/2019/05/export-data-as-csv-file-with-javascript.html , but it depends on your template.
Try to add attribute as type="button", defaults to button which will tell the browser that its a button and don't treat it as a form.
Or else try to return false at the end of the function.
May be you might be having this inside a form and the button might be acting as a submit action.


text:
Q: LotusScript GetDocumentByURL not authenticating in scheduled agent I have a LotusScript agent that works manually when run from the Notes client menu but fails when run as a scheduled agent on the server.  The agent gets a web page using the GetDocumentByURL method.
url$="http://example.com/notesdb.nsf/XAgent.xsp?documentId="+ Quotesdoc.Universalid +"&action=openDocument&login"

Print("url "+ url$)

Set doc = db.GetDocumentByURL(url$, 1, , , "username", "password")
Set rtitem = doc.GetFirstItem( "Body" )
body$ = rtitem.text

Print("status "+body$)

From the Notes client, the agent will authenticate and return a JSON object.  But from a scheduled agent on the server, the authentication appears to fail as the response is 200, login failed.
The Web Retriever service is running, and the web.nsf db has a Cookies view, but the server log shows:
11/13/2018 07:07:36 PM  AMgr: Agent ('Scheduled Agent' in 'mail\mailer.nsf') printing: url http://example.com/notesdb.nsf/XAgent.xsp?documentId=61D46EE586868DBA85256C84005414B9&action=openDocument&login
11/13/2018 07:07:36 PM  WEB(3): Unable to find design note for view 'Cookies': Entry not found in index
11/13/2018 07:07:36 PM  AMgr: Agent ('Scheduled Agent' in 'mail\mailer.nsf') printing: status Forgot password?

My guess is that the SessionID is not being passed via a cookie and the authentication is failing.  Ideas?


text:
Q: First two entrys of a hashmap Java is there a way, i can get the first two entrys of a hashmap? I tried it like this, but it doesnt work
for (Map.Entry<Integer, Integer> entry : m.entrySet()) {
            System.out.println(entry.getValue());
            m.remove(entry.getKey(), entry.);
            System.out.println(entry.getValue());
        }

A: If you just want any two values from the map:
    Map<Integer, Integer> m = Map.of(6, 9, 1, 3, 4, 2);

    Iterator<Integer> intIterator = m.values().iterator();
    if (intIterator.hasNext()) {
        System.out.println(intIterator.next());
        if (intIterator.hasNext()) {
            System.out.println(intIterator.next());

        }
    }

Output on my Java 11:

2
9

You notice that the values printed not the first two (in any sense that I have come to think of).
If you want the first two entries added to the map, use a LinkedHashMap. It maintains insertion order by default.
If you want the values corresponding to the two smallest keys, use streams:
    Map.Entry<Integer, Integer> smallest = m.entrySet()
            .stream()
            .min(Map.Entry.comparingByKey())
            .orElseThrow();
    Integer secondSmallest = m.entrySet()
            .stream()
            .filter(e -> ! e.getKey().equals(smallest.getKey()))
            .min(Map.Entry.comparingByKey())
            .map(Map.Entry::getValue)
            .orElseThrow();

    System.out.println("" + smallest.getValue() + ' ' + secondSmallest);

3 2

A: Your question is about finding but your code is about removing.  In general, if you want to remove entries from a collection you're iterating over, tread very carefully.
The docmentation for a HashMap explicit prohibits what you are doing.

public Set<Map.Entry<K,V>> entrySet()
If the
map is modified while an iteration over the set is in progress (except
through the iterator's own remove operation, or through the setValue
operation on a map entry returned by the iterator) the results of the
iteration are undefined.

The generally-safe method is to use an explicit iterator, and use the iterator's remove method.


text:
Q: How to properly extend Devise Recoverable? I want Recoverable module to send "invite" emails with reset password links for my users (the app is on invite only), I partially declare methods in initializer:
module Devise
  class Mailer
    def invite_new_user(record)
      devise_mail(record, :invitation_instructions)
    end
  end
end

module Devise
  module Models
    module Recoverable
      def send_invite_user_instructions!
        return unless status == User::STATUS_PENDING
        generate_reset_password_token!
        ::Devise.mailer.invite_new_user(self).deliver
      end
    end
  end
end

And recoverable is extended nicely, but it says that my mailer does not have invite_new_user method (rails console output):
1.9.2p290 :002 > user.send_invite_user_instructions!
  User Load (1.4ms)  SELECT "users".* FROM "users" WHERE "users"."reset_password_token" = 'zMQK1CEXYupjNKpH8dph' LIMIT 1
   (0.3ms)  BEGIN
   (15.0ms)  UPDATE "users" SET "reset_password_token" = 'zMQK1CEXYupjNKpH8dph', "updated_at" = '2012-05-01 17:40:32.085256' WHERE "users"."id" = 59
   (4.5ms)  COMMIT
NoMethodError: undefined method `invite_new_user' for Devise::Mailer:Class

but calling has method in the same console session:
1.9.2p290 :003 > ::Devise.mailer.method_defined? 'invite_new_user'
 => true

What am I missing?

A: Devise can be set-up for what you need:
1- Create a Mailer class in app/mailers/auth_mailer.rb file and make it inherit from Devise::Mailer
class AuthMailer < Devise::Mailer
  def invite_new_user(record)
    devise_mail(record, :invitation_instructions)
  end
end

2- Instruct Devise to use your class by editing config/initializers/devise.rb file and adding
config.mailer = 'AuthMailer'

3- (optional) If (and only if) you use a delay email sending such as SideKiq or DelayedJob you may need to eager load in development, or the delayed job may not find your AuthMailer class. In config/environments/development.rb
config.eager_load = true

4- I personally would define your send_invite_user_instructions! method in my User class instead of patching Devise class

Side note: I'm not a big fan or doing a partial declaration of a class in Rails initializer, because depending on how the gem is designed you can have trouble with autoload : There is a gem (Monologue) that reload objects during run time, without running the initializers, so the monkey patch works well on the first call, but not on the next calls.


text:
Q: I'm going on an Easter Egg hunt. Have I missed anything? I've been playing Dying Light and Dying Light The Following for a long while now. I beat the game, found all the skins, everything, but there is on set that I believe I haven't completed.
The Easter Eggs.
I've found:

*

*the dead shallow-diver in the water off the coast (Not sure where.),

*the Clicker Zombie based off of The Last of Us,

*the exploding Teddy Bear,

*the Alien Gun,

*the Pyza Suit,

*the Plants vs Zombies secret,

*the duplication glitch,

*the through-the-wall glitch,

*the Destiny 2 loot cave,

*the EXPcalibur,

*the Korek Machete,

*the Tolga's Folley Button (But for some reason it won't take me to the Harran Power Plant.),

*the Paper Airplane.

And I believe there were a few more that I found but I can't remember them at the moment. If there are any Easter Eggs that weren't on this list, could someone tell me what and where they are? Or even just what they are.

A: The biggest one you missed is The Dancing Zombies Easter egg which can only be completed while you escort the survivor who claims to be a werewolf. Flip a switch in one of of the hangars at the railyard and watch them dance!
You can visit the Left4Bread store in the slums (near the first Safehouse you unlock)
Likewise, visit the Bites Motel also in the slums where you saved that Kristov on the bus in The Prodigal Son side quest
Be sure to pick up the Airstrike developer weapon from the crashed aircraft in the Radio Tower area (same zone as the Plants VS Zombies Easter egg)
Detonate the SECOND NUKE in the Countryside (look up a tutorial on how to do this)
Lastly, be sure to collect the buried Charley DVDs and collect the Chicken Sword
Check out the Wikia Page for more Easter eggs. Good night and good luck
EDIT:
Other Developer Weapons I missed:
Stasis field - grenade that causes zombies to float, activate two pebbles - one in the slums, one in old town
Sick Grenade: Play checkers on the roof of The Tower


text:
Q: alignment of trees in Java I'm looking for any implementation of a Tree data structure for Java and any implementation of alignment of trees.
Anyone knows what implementations exist or have any other idea to achieve this?

A: You can start with binary tree. This is little complex if you have not tried this implementation earlier and if you are relatively new to Java.
You can start here:
http://javarevisited.blogspot.in/2015/10/how-to-implement-binary-search-tree-in-java-example.html


text:
Q: Symfony2: enable absolute path to a folder, I am getting "...as such route does not exist" Good evening everybody,
I'm writing here because I think I have a basic problem. As I said, I think.
I'm actually working on a symfony2 project (my portfolio) and I have an issue since I pushed everything online.
The fact is that, as being a student, I would like to keep some files accessible through some urls targeting a specific folder on my server (to use it as a demo).
Let me give you more details. I have a page project. I'm setting an absolute url from the backend (i.e: www.example.com/project). The project folder itself is uploaded but when I try to access the url by clicking the link I've set I get this error:
"Unable to generate a URL for the named route "http://www.example.com/project" as such route does not exist".
Also in my twig I'm using
{{ path(project.link) }}

EDIT: project.link is the value entered in my backend (the url www.example.com/project) that I'm setting in my controller.
At this point I'm not really sure if it's about .htaccess file or the routing.php. Any idea?
EDIT:
here is the .htaccess I have in my web directory:
<IfModule mod_rewrite.c>
    RewriteEngine On

    #<IfModule mod_vhost_alias.c>
    #    RewriteBase /
    #</IfModule>

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ app.php [QSA,L]
</IfModule>

<files php.ini>
  order deny,allow
  deny from all
</files>

Thanks in advance,
D

A: If project.link is an already generated URL, then just do {{ project.link }}.
{{ path() }} is for generating a named route, for example in your routing.yml file.
As for the .htaccess file. Try changing it to:
<IfModule mod_rewrite.c>
    RewriteEngine On

    #<IfModule mod_vhost_alias.c>
    #    RewriteBase /
    #</IfModule>

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ app.php [QSA,L]
</IfModule>

<files php.ini>
  order deny,allow
  deny from all
</files>


text:
Q: std::vector::size return an int type or unsigned int In most of the programs I write using std::vector, most of my pains are converting
int offset=(int)v.size();
unsigned int offset=(unsigned int)v.size();

It is sad that such problems are reflected in many other questions such as this.
Is there any way to rewire std::vector and force it to give size as an int or unsigned int like?
int offset=v.size_i();

Type-casts make the codes messier that what they are. Although, some programmers enjoy them and feel there is no problem with casting every time.
c++14 solutions are more preferred but c++17 solutions are also welcome.
If some one suggest to change the type of the variable, soon or late another type casting must happen. So it does not solve the problem.
Please consider such ugly phrases
function((int)myvar1.vec[32].size(),(int)myvar2.vec[32].size());

where function only accepts ints. And I have no control over its definition.

A: you can inherit from std::vector and re-implement size() function to return signed value:
template<typename T, typename Alloc = std::allocator<T> >
class my_vector : public std::vector<T, Alloc>
{
    using base_t = std::vector<T,Alloc>;
public:
    using base_t::vector;
    using base_t::operator =;

    int size() const noexcept { return base_t::size(); }
};

A: std::vector<>.size() is going to be unsigned. It is the way the class is wired, it even includes a typedef for what that type i.e. std::vector<>::size_type. It would be much better for you to get in the habit of using unsigned offsets.

A: In c++20 you can use std::ssize which returns a signed int.
Use it as:
std::ssize(my_std_vector)

or:
my_std_vector.ssize()

The proposal introducing it to the standard library was P1227R1.


text:
Q: Get last section of string I have a input field with a name attribute like field[subkey][subkey2]
How can I get the last part of the string, subkey2 in javascript?
$('input').each(function(){
 var name = $(this).attr('name');

 // here I need only the last part of "name"

});

A: First thoughts:
var string = "field[subkey][subkey2]",
    parts = string.split('['),
    variable2 = parts[2].substring(0,parts[2].length - 1);

JS Fiddle demo.
Alternatively:
var string = "field[subkey][subkey2]",
    variable2 = string.substring(string.lastIndexOf('[') + 1,string.length - 1);

JS Fiddle demo.
If you want to use jQuery to select the relevant elements:
$('input').each(
    function() {
        var string = this.name;
        $(this).val(string.substring(string.lastIndexOf('[') + 1, string.length - 1));
    });

JS Fiddle demo.
References:

*

*string.lastIndexOf().

*string.split.

*string.substring().

A: "field[subkey][subkey2]".match(/\[([^\]]*)\]$/)[1]
//"subkey2"

A: str='field[subkey][subkey2]';
spl=str.split('][');
new_str=spl.pop();
final=new_str.substr(0,new_str.length-1);

//final=subkey2

in case you have a variable depth


text:
Q: Listing express.js requests Imagine the scenario in which a express.js app crashes.
Is it possible to log all the running requests before the server actually crashes?
For ex. "when the server crashes it was serving /apples and /lemons ..."

A: You can use a logger like morgan or winston (morgan is specialized on express so it'll probably suits your needs)
It looks like you just need to requrie it and then use it in express, then it'll log every http request made.
https://github.com/expressjs/morgan


text:
Q: Hibernate multiple native SQL statements I want to run a native SQL from a file using Hibernate. The SQL can contain several statements creating the database structure (i.e. tables, constraints but no insert/update/delete statements).
Example, very simple query is below (which contains the following two SQL statements)
CREATE DATABASE test;
CREATE TABLE test.testtbl( id int(5));

I am using MySQL db, and when I run the above query I am gettng syntax error returned. When I run them one by one, its ok.
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException:
You have an error in your SQL syntax; check the manual that corresponds to your
MySQL server version for the right syntax to use near
'CREATE TABLE test.testtbl( id int(5))' at line 1

The code to run the query is below (above statement is assigned to 'sql' variable):
session = sf.openSession();
session.beginTransaction();
Query qry = session.createSQLQuery(sql);
qry.executeUpdate();
session.getTransaction().commit();

Any help would be appreciated.

A: As others have explained
You must run these queries one by one.
The hibernate code gets translated into running one update statement on JDBC.
But you provided two update statements.
In addition,
I personally prefer to have the code that creates tables outside of the Java application, in some DB scripts.

A: The parameters of the method createSQLQuery is t-sql code;
t-sql code to ensure that in the mysql interface analyzer correctly.
You can try changed the sql :'CREATE TABLE testtbl(id int(5));'
by the way you can use JDBC Connection api (Don't recommend to do so)
Such as:
java.sql.Connection conn=session.connection();


text:
Q: Python - Key / Value matching for 1 dictionary I am trying to use a dictionary to store credentials for users. When using the input function to enter a username, this should find and match any entry within the dictionary, and move onto the next section to enter a password, and again match with the corresponding user. However, i can't get this to work.
Please could somebody shed some light on this - any help is appreciated.
Some things i have tried - along with the errors:
Example 1
users = {"test1":"password1", "test2":"password2", "test3":"password3"}

def test_login_script():
    username = (input("Enter Username: "))
    if username == users.values():
        passwd = (input("Enter Password: "))
        if passwd == users.keys():
            print("\nLogin Successful!")
        else:
            print("\nPassword is incorrect. Please try again.\n")
            test_login_script()
    else:
        print("\nUsername is incorrect or does not exist. Please try again.\n")
        test_login_script()
test_login_script()

No Error - but does not recognise the username.
Enter Username: test1
Username is incorrect or does not exist. Please try again.
Enter Username:
Example 2
def test_login_script():
    username = (input("Enter Username: "))
    if username == users:
        passwd = (input("Enter Password: "))
        if passwd == users:
            print("\nLogin Successful!")
        else:
            print("\nPassword is incorrect. Please try again.\n")
            test_login_script()
    else:
        print("\nUsername is incorrect or does not exist. Please try again.\n")
        test_login_script()
test_login_script()

No Error - but does not recognise the username.
Enter Username: test1
Username is incorrect or does not exist. Please try again.
Enter Username:
Example 3
def test_login_script():
    username = (input("Enter Username: "))
    if username == users.get():
        passwd = (input("Enter Password: "))
        if passwd == users.get():
            print("\nLogin Successful!")
        else:
            print("\nPassword is incorrect. Please try again.\n")
            test_login_script()
    else:
        print("\nUsername is incorrect or does not exist. Please try again.\n")
        test_login_script()
test_login_script()

Error message - TypeError: get expected at least 1 argument, got 0
Traceback (most recent call last):
File "removed for privacy", line 31, in
test_login_script()
File "removed for privacy", line 21, in test_login_script
if username == users.get():
TypeError: get expected at least 1 argument, got 0
Process finished with exit code 1

A: For a dictionary, you should use in keyword instead of equality operator and to check if the password is correct, do users[username] == passwd.
users = {"test1":"password1", "test2":"password2", "test3":"password3"}

def test_login_script():
    username = (input("Enter Username: "))
    if username in users:
        passwd = (input("Enter Password: "))
        if users[username] == passwd:
            print("\nLogin Successful!")
        else:
            print("\nPassword is incorrect. Please try again.\n")
            test_login_script()
    else:
        print("\nUsername is incorrect or does not exist. Please try again.\n")
        test_login_script()
test_login_script()


text:
Q: How does font synchronization work on Windows How does fonts sync work on Windows?
For example Adobe Type-Kit: is it actually writing fonts in <system-drive>\Windows\Fonts\ folder or there is another way to initialize fonts in system from different location using Registry hacks?

A: You can use fonts from others folders distinct of the system Fonts folder and it's not even a hack, it's supported by Windows, at least programmatically (this is how I managed to install fonts temporally from any folder in my (old) font viewer).
The list of permanently installed fonts is saved in the registry, in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts (for TrueType and OpenType fonts, Type1 font list is stored in another location). There is an entry for each font file that should be loaded when Windows starts, if no path is specified Windows assumes that the file is located in the system Fonts folder, but if you include a full path Windows loads the font from that location.
As an example, I created an entry in the Registry for a font file located in the C:\Temp folder:

After restarting Windows the font is shown in both Control Panel and system Fonts folder but as link, hinting that the font file is located in another folder:

Apart from that the font is available to other programs in the same way as the fonts located in the system Fonts folder.


text:
Q: NSView set image to webpage image I have a window with a custom view object. The custom view displays an image file that is in my project folder by using an NSView class (my NSView class code is shown below).
Now I'm looking for a way to set the image for the custom view to a webpage image address instead of a local image file.  Note that this is for a Mac application not a Touch application.  As you can see from the implementation that I tried the NSURL approach but it didn't work, it's commented out in the code.  So basically, how do I put a web image into a desktop window?
NSView header file:
#import <Cocoa/Cocoa.h>

@interface OurView : NSView {
    NSImageView *picture;
}

@end

NSView m file:
#import "OurView.h"

@implementation OurView

- (id)initWithFrame:(NSRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        NSRect rect = NSMakeRect(0, 0, 500, 500);
        picture = [[NSImageView alloc] initWithFrame:rect];
        [picture setImageScaling:NSScaleToFit];
        [picture setImage:[NSImage imageNamed:@"earth.jpg"]];
        //[picture setImage:[NSURL URLWithString:@"http://curious.astro.cornell.edu/images/xraysun.gif"]];
        [self addSubview:picture];
    }

    return self;
}

- (void)drawRect:(NSRect)dirtyRect {
    // Drawing code here
}

@end

A: Try:
[picture setImage:
    [[[NSImage alloc] initWithContentsOfURL:
        [NSURL URLWithString:@"http://..."]] autorelease]];


text:
Q: Finding the equation of a curve where slope of tangent at $x=55$ is $1$ I am working on an algorithm for my work and we are using an exponential function where $x =$ the users age and $f(x) = a$ value that will be subtracted from the users compatibility index.
I havent worked with calculus in quite a while so finding an answer to this problem has been imposible. Basically I need an equation that fits the following rules.

*

*vertical asymptote at $x = 100$ ($100$ is the maximum age that can be put in)

*graph is a positive function (in the first quadrant)

*At $x=55$ ($y$ unknown), a tangent line touches the curve; the slope of this tangent line  must equal 1.

*$f(18) = 0$

EDIT: I have another problem as well. SImilar situation.

*

*vertical asymptote at $x = 18$ ($18$ is the maximum age that can be put in)

*graph is a negative function (in the first quadrant)

*At $x=8$ ($y$ unknown), a tangent line touches the curve; the slope of this tangent line  must equal -1.

*$f(0) = 100$

A: If you aren't worried about the function being defined when $x>100$, then you can start with the function $$g_1(x)=-\frac1x$$ to get a workable right general shape. Next, shift it to the right by $100$ to get the correct vertical asymptote--yielding $$g_2(x)=-\frac1{x-100}.$$ This satisfies the first two conditions. To satisfy the third condition, scale by a factor of $A$ to get $$g_3(x)=-\frac{A}{x-100}$$ (You'll need to set $g_3'(55)=1$ and solve to find the appropriate $A$.) Finally, shift vertically by some constant $C$ to get $$g_4(x)=-\frac{A}{x-100}+C$$ (You'll need to set $g_4(18)=0$ to solve for $C$.) Restrict $g_4$ to the interval $[0,100)$ to get the desired function $f$.
If you require that the function be defined for $x>100$, then this won't work. Let me know, if so.
Edit: Apparently, you are looking for an exponential function. That would be a function of the form $f(x)=Ae^{x-B}+C$ for some real $A,B,C$. Such functions have $y=C$ for a horizontal asymptote, but have no vertical asymptote, so such a function cannot satisfy your desired conditions.


text:
Q: How to get parameters out of an ascx back to the main aspx page I've got an aspx page that renders an ascx page with filtering capabilities.
Inside the ascx page, parameters are passed as follows:

    Plataforma
    <%= Html.Lookup("s.Site", null, Url, "Sites") %>

    Data
    <%= Html.TextBox("s.Date", DateTime.Today.ToString("yyyy-MM-dd")) %>

I need to be able to get those parameters on the main aspx page, because they are needed for an action that is called there.
How could I access these parameters?

A: Dy default the same Model is available to the page and all partial views on it so you should be able to get this values from the model. If this is not the case you can use the Items collection to pass values in the same request. In the ascx you can add the value to the items collection like this:
<% this.Context.Items.Add("myValue", myValue); %>

In the aspx you can access it like this:
<%= this.Context.Items["myValue"] %>

This method will work but it is not the right way in MVC world. You should perfectly pass all data using the Model and just display it on the views and partial views.


text:
Q: Fourier series - showing that an expression is true I have this function:
$f(t) = \frac{1}{12} (\pi^2 t-t^3)$ and I have a Fourier series defined by:
$$f(t) = \sum_{n=1}^{\infty} \frac{(-1)^{n+1}}{n^3} \sin (nt)$$
I am then suppose to show that this is true:
$$\sum_{n=1}^{\infty}\frac{1}{n^6} = \frac{\pi^6}{945}$$
I tried doing something like this a few times where you just have to input a $t$ where the function is continuous (like $t = \frac{\pi}{2}$ or something like that), but I just cant seem to figure out a $t$ that makes this true.. Are there other ways of doing it?


text:
Q: the django-debug-tool lead to an redirect-loop on admin site?
302 FOUND
Location: /admin/
The Django Debug Toolbar has intercepted a redirect to the above URL for debug viewing purposes. You can click the above link to continue with the redirect as normal.

the loop is between /admin and /admin/login/?next=/admin/

A: In the situation I encountered this problem, it turned out that a magic settings import improperly set the SESSION_COOKIE_DOMAIN setting. After we corrected this setting, the problem was solved.
We were lead to the solution after reading the following account:
https://www.reddit.com/r/django/comments/2knwo8/migrating_from_heroku_to_digital_ocean_nginx_post/

A: I used a solution and my problem was solved
I deleted the cookies for the hosting address of the Django server (in the corresponding browser like Chrome)
Once I restarted the server, the problem was resolved and I no longer had to redirect


text:
Q: Can people PLEASE spell out their slang acronyms I keep seeing new acronyms internet slang everyday on Stack Overflow.
Such as the following

*

*YMMV

*AFAIK

*IMO

*HTH
Is it possible to make a stack rule guideline (or frequently asked questions entry) that, when you are answering a question, you spell out whatever acronym Internet slang you are using, because not all of us know what a lot of these mean?

A: How could this be enforced? Problem is, acronyms and abbreviations are prevalent. Some to the extent where the short form is far more well-known than the expansion.
Just on Stack Overflow alone, you've got entire tags like sql and linq that are acronyms themselves, and I imagine far more programmers are familiar with calling them SQL and LINQ than to say "Structural Query Language" and "Language Integrated Query" at every bend and turn.
Acronyms are problematic, but they're a part of language. It's definitely better to try and cater to the lowest common denominator, but that's not exactly the easiest thing to identify what people will or will not understand. And as mentioned, having to expand everything will have equal chance of confusing people.

A: While I'm a strong supported of the necessity for people to avoid the "SMS talk" (cmon,ppl! m prity sure u no wat I mean) in writing on a different media (in which you don't pay for each character you're using), I do believe though that acronyms are not to be despised like this.
Without going deeper into the analysys of languages and their tendence towards a progressively simplification, both in speaking and in writing, I think acronyms are still to be considered something that enriches the language; they allow for economy of understanding and expression, and condensation of meaning and semantics.
Of course, you could write "As Far As I Know" but do you see how more powerful is AFAIK as an espression? it's short, direct to the point, and conveys the same meaning. Reading online on a PC or mobile screen doens't give you the luxury of using a lot of words, engaging in complex and long sentences, like those 19th century writers payed by the word. You need to be concise and fast, or you'll lose readers' attention (much like this post is doing), and acronyms (especially in a language like english that tends to contractions, think at "I'm", "won't", etc.) are just the right things for the job.
As long as you make yourself clear, by using standard and well-know (and recognized by the community) acronyms, I see nothing wrong in this. I'm not talking of course of the "techincal acronyms", but the one used in common language and in lieau of idiomatic expressions (sorry I don't know the right english term for this, something like "expression figée").
And, besides, you cannot compel someone to always write in its purest and formal language, for many of us have learnt enligsh as a second or third language, and with the internet and its ever-growing use of acronyms as a teacher.

A: Colloquialisms and short-hands are an inevitability. The technology industry itself is burdened with ambiguous acronyms. The fact that they are used is something we must live with, however the context in which an acronym is used is what is most important.
For example, DOS - Disk Operating System or Denial of service?
While that FAQ could be update to suggest more considerate use of acronyms, their complete removal is unrealistic.

A: While it certainly improves a question or answer when difficult or obscure acronyms are spelled out, I think making it some kind of rule isn't going to scale well - what do you do when someone breaks the rule in an otherwise great answer? Delete the answer? Vote it down? Suspend the user? Those seem a little harsh, and a great way to lose/annoy great contributors.
And that's before we get into the subjective issue of what is or is not an acronym(after something is commonly used for long enough doesn't it become a defacto 'word' in its own right?) or how often it should be spelled out.
Or would you just edit the problematic posts? We can do that already.

A: IMHO, AFAIK "AFAIK" is not in the same class as DOS, LINQ, SQL, etc.
IMNSHO you should edit or suggest edits to posts containing non-technical acronyms which are merely noise (AFAIK, LOL, or OMGWTFBBQ to name a few). Especially in titles.
Sample acronyms which add value:

*

*SQL

*TCP/IP

*RADAR

Sample acronyms which decrease value:

*

*AFAIK

*LOL

Of course YMMV.


text:
Q: what is the method and attribute in python module I am a beginner for programming. My question may be a stupid question.can anyone answer my questions..
what is the method in python module?
method= name,function      is this right?
and what is the attribute in python module?

A: You should read the documentations, check this. https://docs.python.org/3/tutorial/modules.html#


text:
Q: spring websocket makes whole project returns 404 I add websocket to my normal springboot project ,both websocket server and my web api works fine in my local computer, But when I put my project to my server, not only the websocket connection url get 404, but also my web api get 404 either.
Here is my code
WebSocketConfig.java
@Configuration
public class WebSocketConfig {
    @Bean
    public ServerEndpointExporter serverEndpointExporter() {
        return new ServerEndpointExporter();
    }
}

WebSocketServer.java
@ServerEndpoint(value = "/socketServer/{carId}")
@Component
public class WebSocketServer {

    private Session session;
    private static Map<String, Session> sessionPool = new ConcurrentHashMap<>(16);
    private static Map<String, String> sessionIds = new ConcurrentHashMap<>(16);

    @OnOpen
    public void onOpen(Session session, @PathParam(value = "carId") String carId) {
        this.session = session;
        sessionPool.put(carId, session);
        sessionIds.put(session.getId(), carId);
    }

    @OnMessage
    public void onMessage(String message) {
        System.out.println(message);
    }

    @OnClose
    public void onClose() {
        sessionPool.remove(sessionIds.get(session.getId()));
        sessionIds.remove(session.getId());
    }

    @OnError
    public void onError(Session session, Throwable exception) {
        exception.printStackTrace();
    }

    public static void sendMessage(String carId, String message) throws IOException {
        Session session = sessionPool.get(carId);

        if (session != null) {
            session.getBasicRemote().sendText(message);
        }
    }
}

pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.driver</groupId>
<artifactId>alipay</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>

<name>Alipay</name>
<description>Alipay MiniProgram</description>

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.5.8.RELEASE</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <java.version>1.8</java.version>
</properties>

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-jpa</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-redis</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-jdbc</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-websocket</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-security</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-devtools</artifactId>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-tomcat</artifactId>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework.restdocs</groupId>
        <artifactId>spring-restdocs-mockmvc</artifactId>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>net.sf.json-lib</groupId>
        <artifactId>json-lib</artifactId>
        <version>2.4</version>
        <classifier>jdk15</classifier>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>

A: I solved my question after few tests
It seems this is the tomcat problem in your server side
Let us use the springboot inner tomcat

1.set your project packing type to jar
2.set your server.port except 80 and 8080 , I set it to 8081
3.use mvn clean package -DskipTests to package your project to jar
4.upload your jar file to your server except for the tomcat directory
5.run your code with java -jar YOURFILENAME.jar

Here is my pom.xml file after I change my code
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.driver</groupId>
<artifactId>websocket</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>WebSocket</name>
<description>WebSocket for MiniProgram</description>

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.5.9.RELEASE</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <java.version>1.8</java.version>
</properties>

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-websocket</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>

</project>


text:
Q: How far does HttpContext.User.Identity propagate when calling a chain of web applications/APIs? We have a ASP.NET MVC application that sends the user information using Windows Authentication.  All the web APIs are setup to use windows authentication, and the app site has been added to the trusted intranet sites under Internet Options (this is to ensure that windows sends the user information with the calls).
This application talks to a Service Bus that then communications to all the various micro-services.  Currently, there are 10+ web APIs covering various domains of the application.
When checking the user (via HttpContext.User.Identity), we see the user information (Identity w/ user name) on the Bus.  Once the bus calls to another web API, we then lose the identity.
Is there a limit to how far along a chain of calls the Identity will propagate?
More Info

*

*All the APIs are currently running on the same windows server with different app pools.

*The server is in the same domain as the clients.

*This is an intranet application.


text:
Q: Run missed cronjobs when computer turns on I have some cronjobs running at certain times of the day but sometimes my computer is switched off when they are scheduled to run.
Is there anyway for these to run as soon as the computer is turned back on?

A: cron is not designed to do that, there are other tools that will, such as anacron.
A workaround is to specify a task twice in the crontab, once at the time you want it to happen and again with the time @reboot so it will run when the system starts.
If you need a minimum amount of time before this task should run, you can implement that with a wrapper script.

A: If you're interested in a 3rd party solution, I wrote a script that will allow you to run a script in a range of time like 8:30pm-3am every Saturday-Sunday. So the script will run whenever the computer gets turned on again. I call it: LazyCron
I tried to make it easy to use, so you can use natural language inputs instead of messing around with cron format. For example, you can specify multiple time ranges like 1-3am, 5:30-7:30am or date ranges like every 2nd Thursday or sat-sun and it just works.


text:
Q: beforeSubmit event isn't added to the jqgrid-4.5.2 I am using jqgrid 4.5.2 version with Jquery-3.2.1. Not able to bind the beforeSubmit function to the jqgrid.
Below is the sample code to bind the event.
var config = {};
config.beforeSubmit = function(grid, postData, formid, frmoper){
   ....
}
if (config.beforeSubmit) {
    this.grid.off('jqGridAddEditBeforeSubmit').on("jqGridAddEditBeforeSubmit", config.beforeSubmit);
}

Would be thankful if someone could help me on this.
Below is a brief explanation on how the beforeSubmit event is added in my application
In my case we are overriding the jqgrid library with a DataGrid.js file. In this, I have a function named DataGrid.buildGrid = function(configXml, params, cb), which is called at run time and builds the grid dynamically. This function internally calls generateGrid().
DataGrid.buildGrid = function(configXml, params, cb) {
  ....
  ....
  var myGrid = new DataGrid(jqConfig, params);
  myGrid.generateGrid();
}

the below is the sample generateGrid() code:
DataGrid.prototype.generateGrid = function() {
  ...
  var jqConfig = DataGrid.getJqConfig(form, params, cb);
  ...
  this.bindConfigEvents();
}

in getJqConfig() we are adding the beforeSubmit event to jqConfig object
DataGrid.getJqConfig = function(form, options, cb) {
  var jqConfig = {};
  ....
  ....
  config.beforeSubmit = function(grid, postData, formid, frmoper){
  ....
}

in bindConfigEvents() function we are binding the beforeSubmit
DataGrid.prototype.bindConfigEvents = function() {
  ...
  ...
  if (this.jqConfig.beforeSubmit) {
    this.grid.off('jqGridAddEditBeforeSubmit').on("jqGridAddEditBeforeSubmit", this.jqConfig.beforeSubmit);
  }
}


text:
Q: Compile error with escaped string in dotless with VS Web Essentials 2012 We've got some code that I believe came from the .less version of Bootstrap that won't compile on save/build in VS2012 using Web Essentials:
.spanX (@index) when (@index > 0) {
    ~"input.span@{index}, textarea.span@{index}, .uneditable-input.span@{index}" { .span(@index); }
    .spanX(@index - 1);
}

It works fine if we compile it using the LessBundle in System.Web.Optimization, but we are trying to get the Less compiled to CSS in advance. Does anyone know how to make this work with Web Essentials?

A: IIRC, Web Essentials uses less.js for its compilation step. Less.js doesn't seem to recognize your example as valid LESS. If you remove the ~"" from around the selector, less.js recognizes the input, so try doing that:
.spanX (@index) when (@index > 0) {
    input.span@{index}, textarea.span@{index}, .uneditable-input.span@{index} {
        .span(@index);
    }
    .spanX(@index - 1);
}


text:
Q: Which clock should be used for inter process communication in linux? I have implemented two single thread process A & B with two msg queue [separate queue for send and receive].  Process A will send a message to B and wait for reply in the receive queue.
I want to send a time-stamp from process A to process B. If process B receives the message after 10 second, i want to send a Error string from process B to A.
Accuracy should be in milliseconds.
In process A i used ,
  struct timespec   msg_dispatch_time;
  clock_gettime(CLOCK_REALTIME, &msg_dispatch_time);
  :
  :
  add_timestamp_in_msg(msg, msg_dispatch_time);
  :
  if (msgsnd(msqid, msg, sizeof(msg), msgflg) == -1)
      perror("msgop: msgsnd failed");

In process B,
  struct timespec   msg_dispatch_time;
  struct timespec  msg_receive_time;
  :
  clock_gettime(CLOCK_REALTIME, &msg_received_time);
  :
  if( !(time_diff(msg_received_time, msg_dispatch_time) >= 10 ))
      msgsnd(msqid, &sbuf, buf_length, msg_flag)
  else
  {
      /*send the error string.*/
      //msgsnd(msgid,)
  }

My question is,
1) How to write a time_diff function here with millisecond accuracy to compare against 10 seconds?
   if( !(time_diff(msg_received_time, msg_dispatch_time) >= 10 ))

    /********Existing time diff code******************/
  long int time_diff (struct timeval time1, struct timeval time2)
  {
      struct timeval diff,

      if (time1.tv_usec < time2.tv_usec) {
          time1.tv_usec += 1000000;
          time1.tv_sec--;
      }
      diff.tv_usec = time1.tv_usec - time2.tv_usec;
      diff.tv_sec = time1.tv_sec - time2.tv_sec;
      return diff.tv_sec; //return the diff in second
  }

2) Is clock_gettime is fine to use across process in the same system?

A: If you wish to keep using the struct timespec type, then I recommend using a difftime() equivalent for struct timespec type, i.e.
double difftimespec(const struct timespec after, const struct timespec before)
{
    return (double)(after.tv_sec - before.tv_sec)
         + (double)(after.tv_nsec - before.tv_nsec) / 1000000000.0;
}

However, I think there exists a better option for your overall use case.
If you are satisfied for your program to work till year 2242, you could use a 64-bit signed integer to hold the number of nanoseconds since Epoch. For binary messages, it is a much easier format to handle than struct timespec. Essentially:
#define _POSIX_C_SOURCE 200809L
#include <stdint.h>
#include <time.h>

typedef  int64_t     nstime;
#define  NSTIME_MIN  INT64_MIN
#define  NSTIME_MAX  INT64_MAX

nstime nstime_realtime(void)
{
    struct timespec  ts;

    if (clock_gettime(CLOCK_REALTIME, &ts))
        return NSTIME_MIN;

    return ((nstime)ts.tv_sec * 1000000000)
         + (nstime)ts.tv_nsec;
}

double nstime_secs(const nstime ns)
{
    return (double)ns / 1000000000.0;
}

struct timespec nstime_timespec(const nstime ns)
{
    struct timespec  ts;

    if (ns < 0) {
        ts.tv_sec = (time_t)(ns / -1000000000);
        ts.tv_nsec = -(long)((-ns) % 1000000000);
        if (ts.tv_nsec < 0L) {
            ts.tv_sec--;
            ts.tv_nsec += 1000000000L;
        }
    } else {
        ts.tv_sec = (time_t)(ns / 1000000000);
        ts.tv_nsec = (long)(ns % 1000000000);
    }
}

You can add and substract nstime timestamps any way you wish, and they are suitable for binary storage, too (byte order (aka endianness) issues notwithstanding).
(Note that the code above is untested, and I consider it public domain/CC0.)

Using clock_gettime() is fine. Both CLOCK_REALTIME and CLOCK_MONOTONIC are system-wide, i.e. should report the exact same results in different processes, if executed at the same physical moment.
CLOCK_REALTIME is available in all POSIXy systems, but CLOCK_MONOTONIC is optional. Both are immune to daylight savings time changes. Incremental NTP adjustments affect both. Manual changes to system time by an administrator only affect CLOCK_REALTIME. The epoch for CLOCK_REALTIME is currently Jan 1, 1970, 00:00:00, but it is unspecified for CLOCK_MONOTONIC.
Personally, I recommend using clock_gettime(CLOCK_REALTIME,), because then your application can talk across processes in a cluster, not just on a local machine; cluster nodes may use different epochs for CLOCK_MONOTONIC.


text:
Q: dynamically redirect users to specific page based on where they came from Let's say I have a route to register a user like:
router.post('/register', registerSchema, register);

Apparently inside the register function we save the new signed up user to database.
After registration, I want to redirect users to a specific page based on where they come from.
if user's come from button 1 they should go to dashboard page.
if they come from button 2 I want to redirect them to payment page ok?
How can I do this in a appropriate way?
I tried to send users to sign up page when they click on button 1 to href="signup?next=dashboard"
But I cannot get the query string when they click on register button... clicking on register button don't care about where they came from it just hits the register route...


text:
Q: Swift: getting origin coordinates of UIScrollView I have the following UIViewController which contains a UIScrollView and its constraints:

1) left, right, top distances from UIViewController are 5
2) bottom distance from UIViewController is 80
3) the distances between each button and UIScrollView are 10
Moreover the constraints of the UIImageView are set so that its size is the same of UIScrollView (they're all 0)
Anyway, if at runtime in viewDidAppear() method I perform:
print("scroll: \(self.scrollView.contentOffset)")
print("image: \(self.imageView.frame.origin)")

I get
scroll: (0.0, 0.0)
image: (0.0, 0.0)

why this? They should not be positioned at the origin!!


text:
Q: What is the difference between isSaleable() and isAvailable()? I'm working on the display of the stock availability on the (individual) product page of my Magento theme, and there's something I don't completely understand about this.
I see two methods being used in the templates to check whether a product is available for sale:
    Mage_Catalog_Model_Product::isAvailable()
    Mage_Catalog_Model_Product::isSaleable()

My own findings:
I see that isSalable() (which in turn is called by isSaleable()) calls isAvailable() but also dispatches two events (catalog_product_is_salable_before and catalog_product_is_salable_after).
On the frontend, I've noticed that in Magento's base template isAvailable() is used to decide whether to display the product as "in stock" or "out of stock"; isSaleable() is used to decide something like whether to show an "Add to Cart" button.
On the backend, I've noticed that when the stock quantity becomes zero and backorders are not allowed, the stock availability of a product goes to "out of stock".
When the stock quantity becomes zero and backorders are allowed, the stock availability of the product remains unchanged.
Question:
The properties "stock availability" and "stock quantity" are obviously linked with each other and the mentioned PHP methods. I would like to know:

*

*what the semantic difference between the PHP methods isAvailable() and
isSaleable() is and why I would use one over the other;

*what it is I appear not yet to know about their relation with these properties and Magento's behavior.
Thank you.
EDIT:
I've tried every relevant combination of stock quantity (-1,0,1), stock availability (in/out of), and backorders (on/off) for a product and this is the result:

St.Qu  BckOrd  St.Av  isSalable()  isSaleable()  isAvailable()
   -1       0      0            0             0              0
   -1       0      1          N/A           N/A            N/A
   -1       1      0            0             0              0
   -1       1      1            1             1              1
    0       0      0            0             0              0
    0       0      1          N/A           N/A            N/A
    0       1      0            0             0              0
    0       1      1            1             1              1
    1       0      0            0             0              0
    1       0      1            1             1              1
    1       1      0            0             0              0
    1       1      1            1             1              1

Just for the sake of completeness:
St.Av 0  = out of stock
St.Av 1  = in stock
BckOrd 0 = no backorders allowed
BckOrd 1 = backorders are allowed

It is the stock availability switch in Magento that controls the return value of all of the PHP methods, but when backorders are off and stock quantity drops below 1, the stock availability will automatically be reset to 'out of stock' (hence the N/A rows).

A: If I'm not mistaken, the difference in these checks has to do with reservations of products for placed orders. When a customer adds products to an order, these products will still be in your stock, so they are still available. Though, they aren't saleable, because they have already been ordered by another customer.
So the semantic difference is:

*

*saleable means: in stock and not ordered by another customer yet

*available means: in stock but ordered by another customer, so available, but not saleable.

You could try to validate this by placing an order for a product. And doing the same check as you already did. This should cause a difference between the amount of available products and the amount of saleable products.
Edit:
More info here:
https://blog.magestore.com/magento-multi-source-inventory-msi/#a3

A: isSeable() looks like it's checking if it reaches 0
isAvailable() looks like it's counting

A: isAvailable() is used to decide whether to display the product as in stock or out of stock, while  isSaleable() is used to decide whether to show an Add to cart button or not.

A: As far as my concern, isSaleable() means you are checking the top most product that is ready for sale. While isAvailable() means you are checking the product from the lists that are available.

A: I see those having semantic differences.  An item that is not in stock can still be saleable if said item is set to allow backorders.
As far as I can tell, it looks like isAvailable checks a product type instance to see if the product type could be for sale if it is indeed available.
So, to venture a guess at when you might choose one over the other:
If you are checking an individual product to see if said product is actually ready for sale, you should use isSalable(), as it will call isAvailable().
To check if a product (whose type you don't know off hand) could be sold, and I suppose skipping the step of checking the product's type, you could call isAvailable() on the product.
isAvailable() checks if a product's type is salable.
isSalable() checks if a product is salable.
isSaleable() is an alias of isSalable().


text:
Q: Is that possible to overwrite ServerVariables["REMOTE_ADDR"] in asp.net My web application now remove to proxy and all Request.UserHostAddress (same thing to ServerVariables["REMOTE_ADDR"]) return proxy IP adress.
I know I could replace Request.UserHostAddress with ServerVariables["HTTP_X_FORWARDED_FOR"], but it's tedious.
I just wonder if I could overwrite ServerVariables["REMOTE_ADDR"] to real client IP in proxy
So, that no code need change?


text:
Q: Display alert only once per application launch on android I want to add a startup alert for my application,but it keeps showing up each time I go back to the main screen.How can I do it? Newbie here and thanks in regard.
 AlertDialog.Builder alertDialog = new AlertDialog.Builder(this);
        alertDialog.setMessage("About:");
        String alert1 = "Message here " ;
        String alert2 = "Message here "  ;
        String alert3 = "Message here " ;
        alertDialog.setMessage(alert1 +"\n"+ alert2 +"\n"+ alert3);
        AlertDialog alert = alertDialog.create();
        alert.show();

A: Create a boolean variable (initially set to true) to tell you if it is the first run or not and store it in Preferences.
private boolean isFirstRun = true;
private SharedPreferences prefs;

Inside on create(), read that value from Preferences in case it exists. The default value is true.
prefs = PreferenceManager.getDefaultSharedPreferences(this);
isFirstRun = prefs.getBoolean("isFirstRun", true);

Only show your Dialog if that variable value is true.
Once you have shown your Dialog, set that variable to false and save it in Preferences.
if(isFirstRun){
        AlertDialog.Builder alertDialog = new AlertDialog.Builder(this);
        alertDialog.setMessage("About:");
        String alert1 = "Message here " ;
        String alert2 = "Message here "  ;
        String alert3 = "Message here " ;
        alertDialog.setMessage(alert1 +"\n"+ alert2 +"\n"+ alert3);
        AlertDialog alert = alertDialog.create();
        alert.show();
}

isFirstRun = false;

prefs.edit().putBoolean("isFirstRun", isFirstRun).commit();

The next times you run your code, the variable will be always false and therefore the Dialog won't show.
Edit:
Inside onStop(), do:
if(alert!=null && alert.isShowing())
   alert.dismiss();

This will dismiss the Dialog when you exit the Activity to another one. Once you press back Button, the Dialog won't show again.


text:
Q: Sequelize Model.update with include where I want to set the status of Cars model to done based on JobCard Model status
        Cars.update({
            status: 'done'
        },
        {
            where: {
                status: 'pending'
            },
        },
        {
            include: [
                {
                    model: sequelize.models.JobCard,
                    where: {
                        id: jobcard_id
                    }
                }
            ]
        })
        .then((result) => {
            console.log(result);
        });

But in the logs I am seeing this query only
 UPDATE "Cars" SET "status"='done',"updatedAt"='2017-10-22 15:57:24.854 +00:00' WHERE "status" = 'pending';

Am I missing anything?

A: The include attribute should be part of the options object (the second parameter passed to the .update() method where you have where specified), for example:
Cars.update({
        status: 'done'
    },
    {
        where: {
            status: 'pending'
        },
        include: [
            {
                model: sequelize.models.JobCard,
                where: {
                    id: jobcard_id
                }
            }
        ]
    }

However, Sequelize does not (to my knowledge) support the use of include as part of the options parameter passed to the .update() method. Each time I've ever tried to do so, even just now (in Sequelize v4.42.0), an error is thrown and the query is not completed successfully.


text:
Q: Human readable documentation current WebSphere configuration Currently I'm working with a bunch of WebSphere Application Servers for some Java applications. Unfortunately there is poor documentation of the configuration of these servers. I know there a possibilities to generate scripts and configuration archives to migrate these settings. But I was wondering if there is a way to get the server configuration in a human readable format. Does any of you know if there are application servers (WebSphere in particular) that have such a function?
Edit:
Forgot to mention that I work with version 6.1 of WebSphere.

A: I dont know, if you will consider it 'human readable' but you can export the cell configuration in the property based format using following wsadmin task:
AdminTask.extractConfigProperties('[-propertiesFileName  ConfigProperties_cell.props]')

it will give you something like:
#
# SubSection 1.0 # JDBCProvider attributes
#
ResourceType=JDBCProvider
ImplementingResourceType=JDBCProvider
ResourceId=Cell=myCell:JDBCProvider=ID#builtin_jdbcprovider
#

#
#Properties
#
classpath={${DERBY_JDBC_DRIVER_PATH}/derby.jar,/my.jar}
implementationClassName=org.apache.derby.jdbc.EmbeddedXADataSource
name=Derby JDBC Provider (XA)
nativepath={}
description=Built-in Derby JDBC Provider (XA)
providerType=Derby JDBC Provider (XA)
xa=true #boolean

For more details see:

*

*Extracting properties files using wsadmin scripting

*Using properties files to manage system configuration

*PropertiesBasedConfiguration command group for the AdminTask


text:
Q: Remove numeric number 1 after application name from Google play I have upload my android android application to Google Play.That application is already uploaded but I have not keystore and email ID so that I can not update or delete the application.Then I have changed the packages name and upload application on Google market.But some problem are coming that by default in application name lastly add 1.I am not understand from where 1 is coming.Please suggest me hoe to remove numerical 1 after application name from Google play store

A: You can change the title of your application from the Developer Console. Does it look correct there but incorrect on the play store?


text:
Q: Nullable DateTime List to Non Nullable DateTime List I have a list of nullable date times. I need to filter it down to a non-nullable DateTime list by excuding the null values.
var d = NullableDateTimeList;
??//var nonNullableList = d.Where(p => p.DateX.HasValue).Select(p => p.Datex);

How do I go about doing this. Thanks.

A: very close, just add the .Value property when selecting the nullable DateTime:
var nonNullableList = d.Where( p => p.DateX.HasValue )
    .Select( p => p.DateX.Value )
    .ToList();

A: You have to select the Vaue from the Nullable<DateTime> before you call ToList():
List<DateTime> nonNulls = NullableDateTimeList
    .Where(d => d.DateX.HasValue)
    .Select(d => d.DateX.Value)
    .ToList();

A: Just select the .Value
var nonNullableList = d.Where(p => p.DateX.HasValue).Select(p => p.DateX.Value);


text:
Q: Pass ajax form value to controller codeigniter

            <?php echo form_open('welcome/login', array('class' => 'ajax-form','style'=>'z-index: 202')); ?>

            <input name="user_email" type="email" class="login_email" placeholder="Email address" required autofocus>

            <input name="user_pass" type="password" class="login_pass" placeholder="Password" required>

                Forgot login details?
                <button class="btn btn-lg btn-info" id="login_submit" style="margin-left:20px;">Sign in</button>

                    </form>
            <?php if(isset($login_error) && $login_error !=='') { ?>
<?php echo $login_error; ?>
 <?php } ?>

Hi i am trying to pass the email and password to the controller in codeigniter.
Any idea how to do that please help?

A: You could simplify a big deal by doing:
$('#ajax-form').submit(function(){
 var form = $(this);
   $.ajax({
    url: form.attr('action'),
    type: form.attr('method'),
    data: form.serialize(),
    success: function(response) {
      console.log(response);
      // $("#feedback").html(data);
    }
  });
  return false;
});


text:
Q: How can I use GET-request to get a sentence from http-server I am working on a project that consists in making connection between two http-agents via http-protocol. So I am writing a java-program for that purpose. the client will send a GET-request to get a sentence from the http-server. That http-Server is a simple java-program, in which we find the following instruction:
final String id="03788444"

My Aim is to get this id from the server using GET-requet. My small Java Server is running on localhost at port 80. Basically my resource is that id, so I write the following:
GET /id HTTP/1.1

But I get nothing from the server.
From the  server-side I wrote the following:
"http/1.1 200 OK"
 blankline
 id

is it correct?
should I put the id in a txt-file and send the file by using http-protocol. I think that id is not a resource. So I should put it in a file???
public class Server {
     ....
    void send_response(){
        try {
            out= new PrintWriter( socket.getOutputStream());
            //status line
            out.print("http/1.1 200 OK");
            //blank line!!!
            out.print("");
            out.print(id);
        }catch (IOException e) {
            e.printStackTrace();

        }
    }
    void close_connection(){
        out.close();
    }
}

public class Client {
....

void sendGet(){

    final String request_line="GET /id http/1.1";
    PrintWriter out = null;
    .....
    try {
        out = new PrintWriter(ag_socket.getOutputStream(), true);
        // Send request to http-agent
        out.println(request_line);
        out.println();   // blank line separating header & body
    } catch (IOException e) {
        e.printStackTrace();
    }finally{
        //out.close();
    }
}