text:
Q: ASP.NET MVC FX sending error message string to another action method not working I'm catching an error in an action method as there are currently a couple different things that could go wrong (working on it). There are a number of people testing the app and I'd like them to be able to see the exact error. Here is the try block in the action method for creating a new employee:
try
{
    db.Employees.Add(employee);
    db.SaveChanges();
}
catch (DbEntityValidationException ex)
{
    foreach (var entityValidationErrors in ex.EntityValidationErrors)
    {
        foreach (var validationError in entityValidationErrors.ValidationErrors)
        {
            Response.Write("Property: " + validationError.PropertyName + " Error: " + validationError.ErrorMessage);
            var err = validationError.ErrorMessage;
            System.Diagnostics.Debug.WriteLine("Property: " + validationError.PropertyName + " Error: " + validationError.ErrorMessage);
            System.Diagnostics.Debug.WriteLine("err: " + err);
            RedirectToAction("ErrorMessage", new { message = err });
        }
    }
}

This does successfully print the error message to my console in Visual Studio but it does not redirect the user to the ErrorMessage screen. Rather, the catch block simply moves on. I do not want this to happen.
Any time an error occurs I want the error message to be saved to the string err and then sent to the Error Message page.
ErrorMessage Action Result
public ActionResult ErrorMessage(string message)
{
    ViewBag.ErrorMessage = message;
    System.Diagnostics.Debug.WriteLine("Error message: " + message);
    return View(message);
}

What do I need to change?
EDIT: Based on the first answer I added the return (my mistake) but I'm still not redirected to the correct error page. Instead I am directed to this:

This is the try/catch block now:
catch (DbEntityValidationException ex)
{
    var err = new StringBuilder();
    foreach (var entityValidationErrors in ex.EntityValidationErrors)
    {
        foreach (var validationError in entityValidationErrors.ValidationErrors)
        {
            Response.Write("Property: " + validationError.PropertyName + " Error: " + validationError.ErrorMessage);
            err.AppendLine(validationError.ErrorMessage);
            System.Diagnostics.Debug.WriteLine("Property: " + validationError.PropertyName + " Error: " + validationError.ErrorMessage);
            System.Diagnostics.Debug.WriteLine("err: " + err);
        }
    }
    return RedirectToAction("ErrorMessage", new { message = err.ToString()});
}

EDIT 2:
This is what I have right now:
try
{
    db.Employees.Add(employee);
    db.SaveChanges();
}
catch (DbEntityValidationException ex)
{
    var err = new StringBuilder();
    foreach (var entityValidationErrors in ex.EntityValidationErrors)
    {
        foreach (var validationError in entityValidationErrors.ValidationErrors)
        {
            Response.Write("Property: " + validationError.PropertyName + " Error: " + validationError.ErrorMessage);
            err.AppendLine(validationError.ErrorMessage);
            System.Diagnostics.Debug.WriteLine("Property: " + validationError.PropertyName + " Error: " + validationError.ErrorMessage);
            System.Diagnostics.Debug.WriteLine("err: " + err);
            return RedirectToAction("ErrorMessage", "Employees", (object)err.ToString());
        }
    }
}

Which actually does redirect me to the ErrorMessage.cshtml page. However, I'm not quite sure how to retrieve (object)err.ToString() on the ErrorMessage ActionResult. This is what I am trying right now:
public ActionResult ErrorMessage(object err)
{
    ViewBag.ErrorMessage = err.ToString();
    System.Diagnostics.Debug.WriteLine("Error message: " + err.ToString());
    return View(err);
}

And the actual view:
@{
    ViewBag.Title = "ErrorMessage";
}

Error message page.

@ViewBag.ErrorMessage

But it simply gives me System.Object instead of the actual error message.

A: It is necessary to return result object to be able make the RedirectToAction() working:
var err = new StringBuilder();
foreach (var entityValidationErrors in ex.EntityValidationErrors)
{
    foreach (var validationError in entityValidationErrors.ValidationErrors)
    {
        Response.Write("Property: " + validationError.PropertyName + " Error: " + validationError.ErrorMessage);
        err.AppendLine(validationError.ErrorMessage);
        System.Diagnostics.Debug.WriteLine("Property: " + validationError.PropertyName + " Error: " + validationError.ErrorMessage);
        System.Diagnostics.Debug.WriteLine("err: " + err);
    }
}
return RedirectToAction("ErrorMessage", (object)err.ToString());


text:
Q: Error when redirecting with http 308 in Safari I have a service which uses Http 308 code to redirect user from http to https version of my service. All of browsers I tested have no problem with this status code except Safari 7 on iOS 7 device which complains by Service Unavailable.
I tested Safari using httpbin service too and this error happens again so I concluded this is a bug in Safari not in my service. Is this correct? And if so how can I fix this?
Following is the url I used for testing Safari: http://httpbin.org/redirect-to?url=https://www.google.com&status_code=308

redpajama_set_name: RedPajamaStackExchange


text:
Q: Split Javascript values in JSON I need to split an array into an JSON array which should be following pattern.
{{"url":url, "north":True "side":True}, {"url":url, "north":False, "side":True}}

I get the url parameter with this code. As you can see here, this code displays 3 checkboxes where you can select if the picture is north, on the side or if you want to select it.
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") {
    xmlDoc = xmlHttp.responseXML;
    pictureTemp = [document.getElementById("imgfilename")];

    $('.login-form').append('<button onclick="sendAuswahl()">Send</button>
');
    for (var i = 0; i < xmlDoc.getElementsByTagName("imgfilename").length; i++) {
      pictureTemp[i] = xmlDoc.getElementsByTagName("imgfilename")[i].childNodes[0].nodeValue;
      $('.login-form').append('<input type="checkbox" name="north" value="North"><input type="checkbox" name="orientation" value="Side"><input type="checkbox" name="url" value='+ pictureTemp[i]+'>
');
    };
}

To get all ticked checkboxes, I use this code:
var arrayUrl = $("input[name='url']:checked").map(function(){
      return this.value;
}).get()

var arrayNorth = $("input[name='north']:checked").map(function(){
      return "True";
}).get()

var arrayOrientation = $("input[name='orientation']:checked").map(function(){
      return "True";
}).get()

To convert the selection to a JavaScript object and to get the pattern which I described above, I use this:
var picture = {
      "url" : arrayUrl,
      "North" : arrayNorth,
      "Side" : arrayOrientation
};

But when I alert the value of a selected image I get this:
{"url":http://www.example.com, "north":True "side":True}

And when I select 2 images I get this:
{"url":http://www.example.com, http://www.example2.com, "north":True "side":False}

Instead of this:
{{"url":http://www.example.com, "north":True "side":False}, {"url":http://www.example2.com, "north":False, "side":True}}

So my question is now: How can I adept the values in the pattern which I've described above?

A: var picture = [];
$.each(arrayUrl, function(index,val) {
    val = {
        "url" : val,
        "North" : arrayNorth[index],
        "Side" : arrayOrientation[index]
    };
    picture.push(val);
});

A: var picture = [];
$(arrayUrl).each(function(index) {
    picture.push({
        "url": arrayUrl[index],
        "North": arrayNorth[index],
        "Side": arrayOrientation[index]
    });
});


text:
Q: Compatibility with Tailwindcss and Angular I bought an HTML template under Tailwind, unfortunately I get a lot of errors because of binding like <div @click.outside> in my Angular Component.
Here is an example of code that has problems with the Angular-cli compiler
            <div
            id="sidebar"
            class="flex flex-col absolute z-40 left-0 top-0 lg:static lg:left-auto lg:top-auto lg:translate-x-0 h-screen overflow-y-scroll lg:overflow-y-auto no-scrollbar w-64 lg:w-20 lg:sidebar-expanded:!w-64 2xl:!w-64 shrink-0 bg-slate-800 p-4 transition-all duration-200 ease-in-out"
            :class="sidebarOpen ? 'translate-x-0' : '-translate-x-64'"
            @click.outside="sidebarOpen = false"
            @keydown.escape.window="sidebarOpen = false"
            x-cloak="lg"
        >

In this code  @click.outside="sidebarOpen = false" and @keydown.escape.window="sidebarOpen = false" are problematic
Here is a picture of the errors I get

I already followed this tutorial to install tailwindcss https://tailwindcss.com/docs/guides/angular
And I installed these 3 packages: tailwindcss, postcss and autoprefixer

A: The tailwindcss team, in the example you posted, is using a javascript framework called Alpine.js to render the templates you are seeing. This is a different framework than Angular, and as of today, the tailwind team does not provide any angular components. You can, however, convert these templates into angular code by referencing the alpine.js documentation that I linked, and writing the appropriate angular code to enable the functionality you are looking for.
For example, alpine's @click="" is equivalent to angular's (click)="". Likewise, alpine's :class="" is equivalent to angular's [ngClass]="".
Now, keep in mind that it will not just be a simple conversion of various bindings, and poof, it'll work. You will also have to write all of your own associated javascript in order to enable the desired functionality.


text:
Q: How to display database records in grails This is my gsp page

  <title>GORM APP</title>

 EMPLOYEE ID
 EMPLOYEE NAME

  <g:each in="${table}" var="x">

 ${x.emp_id}
 ${x.emp_name}

 </g:each>

Iam new to groovy grails .Iam try to create employee management application
i tryes

A: enter code here

                        <g:sortableColumn property="employeId" title="EMPLOYEE ID" />

                        <g:sortableColumn property="name" title="EMPLOYEE NAME" />

                <g:each in="${employeInstanceList}" status="i" var="employeInstance">

                        ${fieldValue(bean: employeInstance, field: "employeId")}

                        ${fieldValue(bean: employeInstance, field: "name")}

                </g:each>

`


text:
Q: iPhone--passing data between views in tabbar I am writing an Tab-Based iPhone application (3.1.2).  The purpose of this application is to gather and process data from the GPS, accelerometer, etc. from one view, and then, once data collection has finished, pass this data to another view in order to graph the values.  What is the best way to pass this data?  Would it make sense to use SQLite or CoreData, or is there some other more expedient method?  The graphing and data collection both work separately, but I am at a loss for how to pass the values between the two.  I have read that this is frowned upon, but can I reference the instance of the graphing viewcontroller from the application's UITabBarController in order to pass the data?
Thanks,
James

A: does your graphing viewcontroller show a graph of the most recent data? In that case you might not have to pass it anything. It can simply open te database and ask for the latest data. Your collecting view does the reverse, it opens the database and inserts data.
So no connection between the views. They both simply work on the database directly.


text:
Q: How can I capture an escaped " but not an unescaped one? Suppose the portion that needs to be captured by regex is indicated by PORTION in the following string
,"PORTION","","a",["some_string"]

Examples of PORTION are

*

*\"abc123

*abc123\"

*\"abc123\"

*abc\"123\"

*abc123

so the strings actually look like

*

*,"\"abc123","","a",["some_string"]

*,"abc123\" ","","a",["some_string"]

*"\"abc123\"","","a",["some_string"]

*"abc\"123\"","","a",["some_string"]

*"abc123","","a",["some_string"]

PORTION is surrounded by double quotes. Double quotes inside PORTION are escaped by backslash. My current pattern is
my $pattern = '(.?([\\"]|[^"][^,][^"])*)';

which produces the results for the above examples as follows

*

*\"abc123","","a"

*abc123

*\"abc12

*abc\"123\""

*abc123"

The pattern tries to match everything in front of a sequence that is not ","
and also allow the capturing of \"
But it's not working as intended.
How can I make it work?

A: You're making it way too complicated; there's no rule that says you have to do all your parsing in one monolithic regex. Since your string looks like a comma-delimited sequence, first parse it as such:
my @fields = split /(?<!\\),/, $string;   # use comma as a delimiter (except when escaped)

...And then parse your first field accordingly:
shift @fields unless $fields[0];     # pull off the potentially null first field
$fields[0] =~ s/^"//g;               # remove the leading "
$fields[0] =~ s/(?<!\\)"$//g;        # remove the trailing " that isn't preceded by a \

You could parse all your fields this way by wrapping the above code in a for loop or map().
Note that this code does not account for such occurrences such as \\, (the comma is a valid delimiter here, even though it will pass through the regex incorrectly). Therefore, it would be much preferred to use a proper parser for your format (whatever it is). You may want to take a look at Text::CSV.

A: Just use Text::CSV

A: Your problem calls for the infamous zero-width negative look-behind assertion
...which lets you match a foo that doesn't follow a bar.
The doc is here: http://perldoc.perl.org/perlre.html#Extended-Patterns
and you want something like this in your regexp:
"(.+?)(?<!\\)"

that matches a double quote, as few as possible of any char(s), then another double quote not preceded by a backslash (escaped by doubling, I think). The first set of parens captures as you intend, the second parentheses are not capturing.
Edit: Meanwhile tested using http://www.internetofficer.com/seo-tool/regex-tester/
and it seems to work fine.
Edit: As outis points out, this expression will not correctly match a PORTION in which the final character before the closing quote is an escaped backslash. If you don't anticipate backslashes in your text you should be fine though.

A: Don't forget to allow for escaped backslashes along with escaped quotes. Using REs to matched balanced anything gets ugly fast:
/(?<=")((?:[^"\\]+|\\+[^"\\]|(?:\\\\)+|(?<!\\)\\(?:\\\\)*")*)(?=")/

Do yourself a favor and use a parser, as Ether suggests.

A: if your data is comma delimited and do not have embedded commas, just split on "," and get the appropriate fields
while(<>){
    chomp;
    @s = split /,/;
    if ($s[0] eq ""){
        print "$s[1]\n";
    }else{
        print $s[0]."\n";
    }
}

output
$ perl perl.pl file
"\"abc123"
"abc123\" "
"\"abc123\""
"abc\"123\""
"abc123"

A: If you need to consider escaped backslashes as mentioned by outis, you can use this:
m/"((\\\\|\\"|[^"])+)"/
(It seems I can not leave comment on outis' answer, but outis solution does not work with this:
"abc\\\"123"
will produce
abc\\\
)
Input:

,"\"abc123","","a",["some_string"]
,"abc123\" ","","a",["some_string"]
"\"abc123\"","","a",["some_string"]
"abc\"123\"","","a",["some_string"]
"abc123","","a",["some_string"]
"ab\\c123","","a",["some_string"]
"abc123\\","","a",["some_string"]
"abc123\\\"","","a",["some_string"]
"abc\\\"123\"","","a",["some_string"]
"abc123\\\\\"","","a",["some_string"]

Output:

\"abc123
abc123\"
\"abc123\"
abc\"123\"
abc123
ab\\c123
abc123\\
abc123\\\"
abc\\\"123\"
abc123\\\\\"


text:
Q: Cant import Pillow correctly I got a problem with importing Pillow.
ImportError: cannot import name '_imaging' from 'PIL'

Import way:
from PIL import Image

PIL installation:
pip install Pillow

*

*I hasnt try to install Pillow over a PIL installation (default problem i think, after Internet research)

*I have already reinstalled it with PIP.

*All other imports working correctly

Have a nice day!

A: Pillow docs mention:

Pillow >= 2.1.0 no longer supports import _imaging. Please use from PIL.Image import core as _imaging instead.

Did you try that?

Another attempt:
pip install -U Pillow

Read more in ImportError: cannot import name _imaging.
PS: PIL is deprecated - Pillow is its replacement.


text:
Q: How to design a circular reference to a single database table with an added relationship? I'm not sure how best to phrase the question, but essentially I have a table of contacts, and instead of doing the typical -- a contact has a reference to a table with spouse information, and a table with children, I want each of those people to be a contact, but then define a relationship between those contacts (brother, sister, child, spouse, etc.). So the contacts would exist in a single table, but I'm having trouble determining how best to define the relationship based upon their contact id and the relationship type. Any advice would be appreciated.

A: CONTACTS table

*

*contact_id, pk

CONTACT_RELATIONSHIP_TYPE_CODE table

*

*contact_relationship_type_code, pk

*description
CONTACTS_RELATIONS table

*

*parent_contact_id, pk, foreign key to CONTACTS table

*child_contact_id, pk, foreign key to CONTACTS table

*contact_relationship_type_code, foreign key to CONTACT_RELATIONSHIP_TYPE_CODE table

If you see the need to support multiple relationship types to a pair of people, add the CONTACTS_RELATIONS.contact_relationship_type_code column to the composite primary key

A: This is called a self join, it is pretty common and fairly easy to provide the functionallity you mention above. Take a look at this article.

A: Just implement an intersect table with four columns - key, contactid #1, contact id#2, and relationship.
Why do it this way? Because a contact can have several relationships.


text:
Q: How to launch node server when using a test framework? Just a quick background.  I'm trying to use Cucumber.js to do BDD in an express/node app.  It works really well in Rails so I wanted keep the same framework.  My problem though is that for any of my tests to run I need to manually launch the server.
For example, in my tests/scenarios, I used the zombie module's browser object to visit a page: this.browser.visit(path, function(){ ... });
To get this to work I always have to run npm start or node app.js before I run cucumber.js.  I'd like for the server to start up when I call cucumber.js from the command line to run the tests instead of having to manually start it up before I run my tests.
My failed attempts:
Sample Express app with Cucumber + Makefile

*

*That link above is to a sample repo that uses a Makefile to launch the Node.js server and run the tests.  I tried copying and editing that file to use in my own project but I keep getting an error:
{ [Error: connect ECONNREFUSED]
code: 'ECONNREFUSED',
errno: 'ECONNREFUSED',
syscall: 'connect'
}
If I manually run the server and then run the Makefile, the tests work.

*Grunt.js
Ideally, I'd like to use Grunt to manage my tests but I'm having the same problem.  I've started playing around with grunt-cucumber, but it doesn't have an options for launching the server before running the tests.

A: use grunt.js with grunt-cucumber, and grunt-connect which starts a server in the current directory.
then you could define some alias-task which first starts the connect server and then runs your cucumber tests:
grunt.registerTask("your-task-name", ["connect", "cucumber"]);


text:
Q: Null pointer Exception in the case of reading in emoticons I have a text file that looks like this:
shooting-stars    "are cool"

I have a lexical analyzer that uses FileInputStream to read the characters one at a time, passing those characters to a switch statement that returns the corresponding lexeme.
In this case,  represents assignment so this case passes:
case 'ð' :
            return new Lexeme("ASSIGN");

For some reason, the file reader stops at that point, returning a null pointer even though it has yet to process the string (or whatever is after the ). Any time it reads in an emoticon it does this. If there were no emoticons, it gets to the end of file. Any ideas?

A: I suspect the problem is that the character  (Unicode code point U+1F4AB) is outside the range of characters that Java represents internally as single char values. Instead, Java represents characters above U+FFFF as two characters known as surrogate pairs, in this case U+D83D followed by U+DCAB. (See this thread for more info and some links.)
It's hard to know exactly what's going on with the little bit of code that you presented, but my guess is that you are not handling this situation correctly. You will need to adjust your processing logic to deal with your emoticons arriving in two pieces.


text:
Q: Issue with Protractor .all locator Has anyone encountered an issue where .all locator does not return any elements, although when the locator is tested in chrome console, it returns only the first element.
Example:
<datagrid>
    <row/>
     <row/>
</datagrid>

let rows=element(by.css(datagrid)).all(by.css(row))

returns zero results in my code, or just the first element?
Another issue I have is that csscontainingtext does not work with a regexp although protractor version is 5.4.2...
I am staring to wonder whether these are bugs, or some angular configurations that mess up the protractor testing. Any ideas?

A: Try with quotes:
let rows = element(by.css('datagrid')).all(by.css('row'));
or even:
let rows = element.all(by.css('datagrid > row'));


text:
Q: Django add new Model and Form in a new app i am using Django and trying to add a new model which can only be accessed after user login. Firstly, i built a model class of UserProfile in an app, using
def create_user_profile(sender, instance, created, **kwargs):
    if created:
        UserProfile.objects.create(user=instance)
post_save.connect(create_user_profile, sender=User)

to sync the model into database, it works well by calling UserProfile = request.user.get_profile(), then i built Anther model class called "ControlInformation" in ANOTHER app (called "control"), using
def create_control_information(sender, instance, created, **kwargs):
    if created:
        ControlInformation.objects.create(user=instance)
post_save.connect(create_control_information, sender=User)

to sync this model, but there are some problems to use information in this model by calling Current_Status = request.user.get_profile() , which is "'UserProfile' object has no attribute 'turn_on_off'" when calling on_off = Current_Status.turn_on_off in views.py.
Am i right when building this one on one model in another app? Or is there any other problem?
Edit:
my ControlInformation model is like this:
class ControlInformation(models.Model):
    user = models.OneToOneField(User)

    TURN_ON_OFF = (
        ('ON', 'On'),
        ('OFF', 'Off'),
    )

    AUTO_MANU = (
        ('ON', 'On'),
        ('OFF', 'Off'),
    )

    TEMP_DINNINGROOM = (
        ('HIGH', 'High'),
        ('MEDIUM', 'Medium'),
        ('LOW', 'Low'),
    )

    TEMP_LIVINGROOM = (
        ('HIGH', 'High'),
        ('MEDIUM', 'Medium'),
        ('LOW', 'Low'),
    )

    turn_on_off = models.CharField(max_length=1, choices=TURN_ON_OFF)
    auto_manu = models.CharField(max_length = 1, choices=AUTO_MANU)
    temp_dinningroom = models.CharField(max_length=1, choices=TEMP_DINNINGROOM)
    temp_livingroom = models.CharField(max_length=1, choices=TEMP_LIVINGROOM)

#signal function: if a user is created, add control information to the user
def create_control_information(sender, instance, created, **kwargs):
    if created:
        ControlInformation.objects.create(user=instance)

post_save.connect(create_control_information, sender=User)

Then i use this model in views.py like this:
def current_status(request):
    if not request.user.is_authenticated():
        return HttpResponseRedirect('/keenhome/accounts/login/')
    Current_Status = request.user.get_profile()

    on_off = Current_Status.turn_on_off
    auto_manu = Current_Status.auto_manu
    temp_dinningroom = Current_Status.temp_dinningroom
    temp_livingroom = Current_Status.temp_livingroom

    context = {'on_off': on_off,
               'auto_manu': auto_manu,
               'temp_dinningroom': temp_dinningroom,
               'temp_livingroom': temp_livingroom,
               }
    return render(request, 'control/current_control_status.html', context)

The on_off = Current_Status.turn_on_off is where problem happens. ('UserProfile' object has no attribute 'auto_manu')

A: Since you already have request.user.get_profile() to return UserProfile model, You are looking for ControlInformation object in this case. So, just change
Current_Status = request.user.get_profile()

to
Current_Status = ControlInformation.objects.get(user=request.user)

Or,
from django.shortcuts import get_object_or_404
Current_Status = get_object_or_404(ControlInformation, user=request.user)


text:
Q: Display only the columns of two different select statements containing one row? I have two select statements which both have one row but an fixed number of columns (15).
So far I have tried using intersect but it doesn't seem to do what I want
select 'ABC' as test, 'DEF' as test2, '123' as test3

select 'ABC2' as test, 'DEF' as test2, '124' as test3

Comparing both will display the a string will the differences
The result will the the columns with the different values as a string. In this case:
"'test': 'ABC', 'test3': '123'"

A: Use a bunch of case expressions to compare each column and output a value if different e.g.
select
  case when a.test1 <> b.test1 then 'test1:' + a.test1 else '' end
  + case when a.test2 <> b.test2 then ', test2:' + a.test2 else '' end
  + case when a.test3 <> b.test3 then ', test3:' + a.test3 else '' end
from (
    select 'ABC' as test1, 'DEF' as test2, '123' as test3
) a
cross join (
  select 'ABC2' as test1, 'DEF' as test2, '124' as test3
) b;

Returns:

Result

test1:ABC, test3:123


text:
Q: Why the ConversionData of appsflyer is cached? I am developing an ionic app and we have a need of using deeplinks and I am using appsflyer. I call the below mentioned method by passing the devKey and the appID
    // initialize appsflyer
initAppsflyer() {

    var onSuccess = function (result) {
        //handle result
        console.log('Appsflyer onSuccess ' + result);

    };

    var onError = function (err) {
        // handle error
        console.log('Appsflyer onError ' + err);
    }
    var options = {
        devKey: '',
        appId: '',
        isDebug: true,
        onInstallConversionDataListener: true
    };
    window.plugins.appsFlyer.initSdk(options, onSuccess, onError);
}

when I click on a deep link it opens the app and data loads fine. But when I click on another link it shows the data of the previously clicked link. Have anyone faced this issue when working with apssflyer onelink? if so how to over some this issue?

A: What you are noticing is that the onInstallConversionDataListener is only meant to return install attribution data and this data doesn't change unless a user uninstalls and reinstalls the app.
To get deeplinking data that updates with each new deeplink URL, please refer to our onAppOpenAttribution method which is meant to return the deeplink details of the link that most recently triggered the app open:
https://support.appsflyer.com/hc/en-us/articles/208874366-Deep-Linking-Step-by-Step#the-onappopenattribution-method-
If you have further questions please reach out to support@appsflyer.com and we'd be happy to assist you.
Best,
Joe Williams
AppsFlyer U.S. Support Engineer

A: New version (4.4.9) is released that supports additional callback for onAppOpenAttribution: https://github.com/AppsFlyerSDK/cordova-plugin-appsflyer-sdk#registerOnAppOpenAttribution
Also you can find this example (Ionic3) helpful
platform.ready().then(() => {

  // init AppsFlyer
  const options = new AppsFlyerInitOptions();
  options.devKey = AppsFlyerConstants.DEV_KEY;
  options.isDebug = true; // Optional
  options.onInstallConversionDataListener = true;

  if (platform.is('ios')){
    options.appId = AppsFlyerConstants.APP_ID;
  }

  try {
    const onSuccess: Function = (res: any) => {
      // do something with  JSON.parse(res)
    };
    const onError: Function = (err: any) => {
      //..
    };

    const onAppOpenAttributionSuccess: Function = (res: any) => {
      // do something with  JSON.parse(res)
    };
    const onAppOpenAttributionError: Function = (err: any) => {
      //..
    };

    window.plugins.appsFlyer.registerOnAppOpenAttribution(onAppOpenAttributionSuccess, onAppOpenAttributionError);

    window.plugins.appsFlyer.initSdk(options, onSuccess, onError);
  }
  catch (e) {
    console.error("ERROR: AppsFlyer not initiated", e);
  }

 //...
});


text:
Q: Can you apply time restrictions for ibeacon notifications when exiting a region? I have implemented iBeacon into an app so that it will wake the app briefly from a suspended or killed state.  A push notification is sent which would prompt the user to open the app if they wish to.
The problem is, when a user exits then enters a region again another notification is sent.  In a shopping mall for example a user could walk past many beacons (enter and exit regions).  What they probably will not want is lots of notifications annoying them.
Is there a way that you can control or restrict the number of notifications a user gets?  For example time restrictions?  Once a notification has been received then a user would not get another one for 15 mins or 30 mins etc?
There must be a solution as i am sure Apple would not want users to get lots of notifications that users dont want.

A: There are no built-in tools to iOS SDKs to prevent multiple notifications from being sent in a specific time period.   But you are correct that this is a very common problem.  The solution is to just add a little bit of programming logic.
Here is a typical approach:

*

*Each time you send a notification, record a timestamp of when you sent it.  Store this in the phone's persistent storage, so even if a user restarts the app or reboots the phone you will have a record of when the last notification was sent.
UserDefaults.standard.set(Date().timeIntervalSince1970,
                          forKey: "lastNotificationSentTime")

*Before you send a notification, check to see when the last time you sent one was.  If it was too recent, suppress sending a new notification.
let lastNotificationTime = UserDefaults.standard.value(forKey: "last") as? Double ?? 0.0
if Date().timeIntervalSince1970 - lastNotificationTime < 60.0 {
  print("Not sending notification because I just sent one in the last 60 seconds.")
}
else {
  // TODO: Send notification here
}


text:
Q: Syntax Error in INSERT INTO Statement (Insert Records) can someone help me what is wrong with my code? It always says "Syntax error in INSERT INTO statement. "
try
        {

            OleDbConnection Con = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=..\\MotoFix.mdb;");

            Con.Open();
            OleDbCommand Com = new OleDbCommand();

            Com.Connection = Con;
             Com.CommandText = "INSERT INTO Order VALUES ('" + txtRandomOrder.Text + "','" + txtCode.Text + "')";
              Com.ExecuteNonQuery();
             Con.Close();
        }
        catch (Exception ex)
        {
            XtraMessageBox.Show(ex.Message);
        }

A: Order is a keyword in msaccess refer this link
http://office.microsoft.com/en-us/access-help/access-2007-reserved-words-and-symbols-HA010030643.aspx
change your statement to
"INSERT INTO [Order] VALUES ('" + txtRandomOrder.Text + "','" + txtCode.Text + "')";

and see if it works


text:
Q: flex graph categoryAxis multiline labels not shown completely The same question is asked by others here:
http://www.amcharts.com/forum/viewtopic.php?pid=39204#p39204
But not public and general solution is provided.
For example, my categoryAxis label is composed of day, month and year, which are supposed to be displayed in 3 lines.But sometimes when the chart is zoomed, 'year' may be missing.
Like the graphs shown here:
http://forums.adobe.com/message/4817858#4817858
Anyone knows how to solve this  problem?
I tried to find properties of AxisRenderer that may be related to this but failed.
Any suggestions would be appreciated! Thanks.


text:
Q: defining class variables in method? Every example I've seen for defining a variable in a class, does so outside of any methods, for example:
class Testclass
{
  public $testvar = "default value";

  function dosomething()
  {
    echo $this->testvar;
  }
}

$Testclass = new Testclass();
$Testclass->testvar = "another value";
$Testclass->dosomething();

How would you go about defining a variable inside a method, and making that definition available to any other method inside that class?
Note that I would only want to define the variable in one function, not have a different definition for each function.

A: I think you should read up on good object oriented practices. I mean, why do you want to make a variable available "inside a method"?
Variable's created within methods are local to that specific method and as such, scope is restricted to it.
You should instead use a instance member/variable which is available object wide if your trying to access a variable between methods. Or possibly you could pass the variable by ref between methods. Of course if its a value which never changes then it should be static variable on the class (class member).
I suggest having a read of the the OO tutorial on tutsplus. Tutsplus are generally great quality. http://code.tutsplus.com/tutorials/object-oriented-php-for-beginners--net-12762
Alternatively, you could do the OO python course (intro to computer science) on Udacity - its also very high quality. Don't worry that its Python, specific language and syntax is irrelevant when trying to understand core OO concepts. https://www.udacity.com/course/cs101
Also, this is a common topic so have a search around, ie Passing Variables between methods?
I hope that helps
Edit: to address your comment. something like this:
class Testclass
{
  private $csvResult = []; // instance member array to store csv results

  function dosomething()
  {
    $this->$csvResult = fgetcsv($blah);
  }

  function processResult()
  {
    foreach ($this->$csvResult as $item) {
      var_dump($item)
    }
  }
}

But again, as Adrian Cid Almaguer mentioned, you really are best to build a solid foundation of OO for yourself instead of just using this example without truly understanding it.

A: The real name of the variables class is "properties". You may also see them referred to using other terms such as "attributes" or "fields". In OOP (Object Oriented Programming) You can't define a property inside a method (the real name of a class function is method, not function), because this is a attribute of a class, not an attribute
of a method.
The properties define the attributes of a class, and the methods defines the behavior of a class. For example if you have a class named Person, the person have Name and Age, they are your properties, they are the attributes that describe your class, they can't be inside a method that describe a behavior of your class because the properties of your class must be accessed from any method that need it to show his behavior.
You can read some examples in:

http://www.killerphp.com/tutorials/object-oriented-php/


text:
Q: "Cannot find declaration to go" protos declaration in IntelliJ IDEA I am trying to use gRPC proto file to generate stub code for inter-service communication. Everything is okay and when I run mvn clean install, it installs everything and builds successfully.
But still now protos files are in red color and can't go definition when I click to go to it's definition. It says me Cannot find declaration to go. When build is successful then why it is not possible to find declaration in IntelliJ IDEA?
I clean every cached on IDE and indexing is also successful. I also cleared m2 cache.
Is there anything to find this solution so that I can go to proto class definition?
Any help will be appreciated.
Thanks.

A: Your IntelliJ IDEA  needs to generate Project setup. So you need to execute the main plugin goal, which is idea:idea.
Use this command. It will helped me.
mvn -U idea:idea

Here
-U = Forces a check for missing releases and updated snapshots on remote repositories


text:
Q: Passing input to tf.nn.static_rnn According to the documentation, the second argument of static_rnn should be set to "a length T list of inputs, each a Tensor of shape [batch_size, input_size], or a nested tuple of such elements."
I passed a list of columns to static_rnn, but I get ValueError: linear is expecting 2D arguments. So input_size can't be 1. What exactly does input_size and T refer to? Why can't input_size be 1?
It occurs to me that static_rnn might expect a list whose matrices contain one-hot vectors. In this case, input size would be the vocabulary length. But if static_rnn requires one-hot vectors, the documentation would say so, right?

A: input_size denotes the number of the features and it can be 1, e.g, in ordinary time series prediction. You got this error, most probably, because your tensors are [batch_size], not [batch_size, 1].
So, you don't have to one-hot encode your features (though you can), just set the right rank of input tensors.
Sample code:
n_inputs = 1
n_neurons = 5
X0 = tf.placeholder(dtype=tf.float32, shape=[None, n_inputs])
X1 = tf.placeholder(dtype=tf.float32, shape=[None, n_inputs])
basic_cell = tf.nn.rnn_cell.BasicRNNCell(num_units=n_neurons)
output_seqs, states = tf.nn.static_rnn(basic_cell, [X0, X1], dtype=tf.float32)
Y0, Y1 = output_seqs


text:
Q: Error: Import cv cannot be resolved: How to install OpenCV correctly? To keep a long story short. I copied this code from https://www.geeksforgeeks.org/detect-an-object-with-opencv-python/ (not really import but I still mentioned it)
import cv2
from matplotlib import pyplot as plt

# Opening image
img = cv2.imread("image.jpg")

# OpenCV opens images as BRG
# but we want it as RGB and
# we also need a grayscale
# version
img_gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
img_rgb = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)

# Creates the environment
# of the picture and shows it
plt.subplot(1, 1, 1)
plt.imshow(img_rgb)
plt.show()

Anyways this line below has this error that says "Import "cv2" could not be resolved"
import cv2

When I run this code below to download opencv. I get the message that the "Requirement already satisfied: "
pip install opencv-python

Despit me closing vscode the reopening I still get that message that "Import "cv2" could not be resolved" Ive updated pip, I've printed the version of cv2 in cmd which I get 4.5.5, I've deleted python and python intelligence. I just cant to figure out why opencv isn't working. Any suggestions? (I'm a newbie lol)

A: Two reasons come to mind:
1.) Either the path to the opencv library is not set in the editor so it cannot find it. That happens sometimes if you changed settings in the runtime environment.
2.) Or you created a virtual environment prior to installing opencv. In that case, install opencv for your virtual environment as well.
It is difficult to tell what is going on with so little information. The above causes are just the most likely. Check your runtime environment and your library paths.

A: u need to do several things to clear it up, open cmd and follow this,
step 0: of course u must check python is added in ur system variable path,two path is essential, for me two dir is like this (add for ur installation, if have added this just skip this step)
C:\Python\Scripts\
C:\Python\

step 1:  clear current package from python site package
pip uninstall opencv-python

step 2: clear cache from pip , for fresh install
pip cache dir

u will get a list of dir printed, now browse to that dir using explorer and delete everything in there.
step 3: check pip package install dir for ur python, it should be like "..\python\lib\site-packages" , to  check this type into cmd
pip list -v

this will give u dir reference of all site packages, and u should check whether it is
"..\python\lib\site-packages" or not.
step 4: reinstall the opencv , u can install community contrib version of opencv, this is extended package of opencv-python with extra modules
pip install opencv-python

or
pip install opencv-contrib-python

step 5: type python in cmd, if python idle responded in cmd, then ur system found python, then type import cv2 and make sure it is imported. If it is imported successfully then u need to make sure ur vs code python plugin in up to date and configured well, for me i have added python path to system variable and didn't have to configure the plugin, it works well.
let me know if u have the problem unsolved.

A: According to your description, I think there should be multiple versions of Python in your system.
You could use "ctrl+shift+P" to choose your python interpreter.

You can also use pip's command to install opencv into the current Python package floder.
pip install -t FloderPath opencv-python


text:
Q: type 'Future' is not a subtype of type 'String' I am trying to display an image in my Flutter application (test.jpg) that is stored in FireBase. This is my code so far:
    StorageReference ref = FirebaseStorage.instance.ref().child("/test.jpg");
    String url = (await ref.getDownloadURL()).toString();
    print(url);
    return url;
  }

The correct URL prints to console, but if I then try display the url via:
Text(_imgUrl)

Then I receive the following error:

type 'Future' is not a subtype of type 'String'

Could someone please help me understand what the problem is and how to go about correcting it? Please let me know if I should include any other code or information.
Thanks in advance!

A: Method getDownloadURL() returns a Future<dynamic>. Change type of your url var do dynamic.

A: You probably set _imgUrl with ref.getDownloadURL() directly without the await keyword.
if you set your variable with  var url = ref.getDownloadURL() you'll get a Future<Url>
but if you set your variable with  var url = await ref.getDownloadURL() you'll get a Url


text:
Q: UINavigationController push animation not smooth in iOS 7 I am developing ipad app in which I am using UINavigationController to push another view controller. Everything is working correctly excpet push animation is not smooth. When I push the view controller , for a second I can see previous screen as I am setting the background color of view to clearColor.
But this works correctly in iOS 6. Then I noticed UIViewGroupOpacity in iOS 7 release notes from:
https://developer.apple.com/library/ios/releasenotes/General/RN-iOSSDK-7.0/index.html
I suppose this causing the issue while animating.
Does any one know solution for this issue in iOS 7? Thanks.
Also I don't have any fancy code to push view controller. I am using below code to push
[self.navigationController pushViewController:vc animated:YES];

A: Simply add in:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

This:
[[self window] setBackgroundColor:[UIColor whiteColor]];

The final result:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions (NSDictionary *)launchOptions {
    [[self window] setBackgroundColor:[UIColor whiteColor]];

    // Override point for customization after application launch.
    return YES;
}

A: Well you could try doing it through your storyboards in your project. All you have to do is create your view controller that is enclosed within a UINavigationController, and connect a push segue within the storyboard by holding control and moving from the one vc to the next. Then name it, and within your vc that is presenting the view, just implement the prepareSegue method:
 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
   if (segue.identifier isEqualToString:<#string#>) {
      <#UIViewController#> *viewController = segue.destinationViewController;

      // do any customization with the above variable
   }
}

Hope that helps in any way

A: My issue is solved using UINavigationController+Retro.h provided by Arne in below question
Restore pre-iOS7 UINavigationController pushViewController animation
Thanks you very much Arne


text:
Q: Check if LAN is plugged i want to check if the LAN cable is plugged in on a linux system, is there any file in /sys or /proc that i can check (i would like to do it in C)?

A: To check if a cable is plugged you can look in /sys/class/net/
For ex. for eth0 connection:
$ grep "" /sys/class/net/eth0/*
/sys/class/net/eth0/carrier:0
/sys/class/net/eth0/operstate:down

As you can see, cable isn't plugged.
if it was plugged i was getting:
/sys/class/net/eth0/carrier:1
/sys/class/net/eth0/operstate:up

A: Run the ifconfig command which will show all the interfaces connected.


text:
Q: Remove period after author (year) generated by \usepackage[style=authoryear]{biblatex}? My bib file:
@book{tgt,
  title = {The Great Title},
  author = {Jane Doe},
  year = {2022},
  publisher = {Macmillan},
  address = {Paris},
}

My LaTeX code:
\documentclass{article}
\usepackage[style=authoryear]{biblatex}
\addbibresource{foo.bib}
\begin{document}

A proof can be found at \textcite{tgt}.

\printbibliography
\end{document}

The reference list looks like this:

Doe, Jane (2022). The Great Title. Paris: Macmillan.

How can I remove the period after author (year) so that the reference list looks like this:

Doe, Jane (2022) The Great Title. Paris: Macmillan.

A: The relevant punctuation is controlled by nametitledelim
\documentclass{article}
\usepackage[style=authoryear]{biblatex}

\DeclareDelimFormat[bib]{nametitledelim}{\addspace}

\addbibresource{biblatex-examples.bib}
\begin{document}
A proof can be found at \textcite{sigfridsson}.

\printbibliography
\end{document}


text:
Q: Hibernate batch transaction with multiple ManyToMany Relations I successfully configured Hibernate to use batch query to create/update objects but there is a scenario that isn't working yet.
I've 3 entities:
- Main Entity
- Entity A
- Entity B
Main Entity has ManyToMany relation with both Entity A and Entity B. Main Entity is the owner of the relation:
@ManyToMany
@JoinTable(name = "MAIN_A", joinColumns = {
@JoinColumn(name = "MAIN_UID", nullable = false, updatable = false) }, inverseJoinColumns = {
@JoinColumn(name = "A_UID", nullable = false, updatable = false) })
private Set<EntityA> entitiesA = new HashSet<>(0);

@ManyToMany
@JoinTable(name = "MAIN_B", joinColumns = {
@JoinColumn(name = "MAIN_UID", nullable = false, updatable = false) }, inverseJoinColumns = {
@JoinColumn(name = "B_UID", nullable = false, updatable = false) })
private Set<EntityB> entitiesB = new HashSet<>(0);

I wrote a 3 simple test.
First I create some Entity A and Entity B rows in the database (this is in common with all 2 test cases).
First scenario:
Create n Main Entity and for each set only the Entity A
Result: Only one insert for all the Main Entity and MAIN_A table entries. So in this case the bath insertion is working as expected.
Second scenario:
Create n Main Entity and for each set only the Entity B
Result: Only one insert for all the Main Entity and MAIN_B table entries. So in this case the bath insertion is working as expected.
Third scenario:
Create n Main Entity and for each set both Entity A and the Entity B
Result: Only one insert for all the Main Entity and n insert for both MAIN A and MAIN_B table entries. In this case the batch insert didn't work. I googled and searched but I couldn't find an answer.
Does anyone know why it isn't working as expected in the third case? Am I doing anything wrong? Is there anything in the configuration that address my requirement?
The code of the 3 scenarios is pretty straightforward:
  Set<EntityA> setA;
  Set<EntityB> setB;
  for (long i = 1; i < n; i++) {

  MainEntity e = new MainEntity();
  ac.setEntitiesA(setA); //this is commented in the second scenario
  ac.setEntitiesB(setB); // this is commented in the first scenario

  session.save(e);
}

I posted the same qestion in hibernate forum: Hibernate Forum post

A: It seems that you are only saving the MainEntity (and I assume the EntityA,B added to the sets are new entities).
In my opinion you should add at least this cascade option to each of your uni-directional relationships:
@ManyToMany(cascade = {CascadeType.PERSIST, CascadeType.MERGE})

Otherwise you should invoke save on each of the EntityA, EntityB.


text:
Q: Display HTTP Request Time I'm trying to display the time it takes a function to complete in javascript, and then display the time in an alert window that is called on button click, however the alert box doesn't pop up at all when I click the INFO button:
var xmlhttp;
function loadXMLDoc()
{
    var start= new Date().getTime();
//loadxmldoc function
   return new Date().getTime()-start;
}
function firebug(){

    alert("Status: "+xmlhttp.status+" "+xmlhttp.statusText+"\nReady State: "+xmlhttp.readyState+"\nRequest Method: "+document.getElementById("selector2").value+"\nTime: "loadXMLDoc().getTime());
}
</script>

Button Html:
<button id="btn3" type="button" class="btn btn-warning" style="margin-top:5px;" onclick="firebug();"> INFO</button>

A: your missing a + between these two:
"\nTime: "loadXMLDoc().getTime()

should be
"\nTime: " + loadXMLDoc().getTime()

You also need to return a Date object from the loadXmlDoc function:
return new Date(new Date().getTime()-start);


text:
Q: Which is the best way to find if a key exists in C# SortedList? Which is the best way to find if a key exists in C# SortedList?
The question is quite clear, I have a SortedList represents an associated array. Both key and values are string. I'm thinking of scanning linear but binary search is faster coz it's 'Sorted'.
I wonder if there's a standard way to find the pair by key, like noted in MSDN or some where popular?

A: ContainsKey is the best way to find out if a key exists. It is already optimized, there is no need for you to make a custom search algorithm:

"This method uses a binary search algorithm; therefore, this
  method is an O(log n) operation, where n is Count."


text:
Q: Cannot use function for plot style, but works for plot color //@version=4
study("PlayGround", overlay=true)

f_color() => color.lime
f_style() => plot.style_line

plot(close, color=f_color())
plot(high,  style=f_style())

This script does not compile.
It throws error Cannot read property 'apply' of undefined.
Reason seems to be the use of function f_style() for the plot style.
I don't understand why that doesn't work.
I've found a related question Why is true / false logic on "style=" not working?.
The accepted answer suggests that this should be possible in Pine v4.

A: Using a function for parameters requiring an argument of input form (the style= parameter requires an input integer) sometimes seems to prevent the compiler from keeping track of the fact that the function returns an acceptable form.
You can work around the problem by de-functionalizing the code. Except for the function, these all work:
//@version=4
study("PlayGround", overlay=true)

lineStyle = input(true)

f_color() => color.lime
f_style() => plot.style_line

style2 = lineStyle ? 0 : 6
style3 = lineStyle ? plot.style_line : plot.style_circles
style4 = plot.style_line

plot(close, color=f_color())
plot(high,  style=style3)

I have added the example to a similar bug report we had already created.


text:
Q: Unable to load the AWS console home login page i have been learning AWS. from couple of days i am not able to load the home AWS login page and get into it. i have checked the firewall and tried shutting it down as well. i have cleared the browser cache, resetting etc. everything else is working fine on the system. please let me know which direction to be followed to get this back again.
At the moment it feels like my home has become a no fly zone for AWS  site signals. cant open the same in phone as well..


text:
Q: Symfony service instantiated on every request I have a service called TennantContext which deals with all tenant related functions including keeping track of the current tenant the user has active.
I was under the impression that once instantiated that the service is never instantiated again?  Am I correct.
I have the following issue:
I am Injecting the TenantContect service in to multiple controllers and event triggers, but every time it is injected it is being instantiated again, e.g. the constructor is being run again and all previous values in the service have been reset:
TenantContext:
class TenantContext
{
    private $tenant;
    private $isInitialized = false;
    ...
    ...
    public function __construct(
        Security $security,
        LoggerInterface $logger,
        UserService $userService,
        EntityManagerInterface $entityManager
    )
    {
        $this->logger = $logger;
        $this->logger->info("YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY: Tenant instantiated");
        ...
        ...
    }

This is instantiated first with my LoginEventListener which on successfuly login sets the tenant in the context:
class LoginListener
{
    /**
     *
     * @var EntityManagerInterface
     */
    private $em;

    /**
     *
     * @var TenantContext
     */
    private $tenantContext;

    /**
     *
     * @var LoggerInterface
     */
    private $logger;

    public function __construct(
        EntityManagerInterface $em,
        LoggerInterface $logger,
        TenantContext $tenantContext
        )
    {
        $this->em = $em;
        $this->logger = $logger;
        $this->tenantContext = $tenantContext;
    }

    public function onSecurityInteractiveLogin(InteractiveLoginEvent $event)
    {
        $this->logger->info("------------------------------------- onSecurityInteractiveLogin");
        // Get the User entity.
        /**
         *
         * @var User $user
         */
        $user = $event->getAuthenticationToken()->getUser();
        $this->tenantContext->initialize($user->getTenant());
    }
}

This is working perfectly, however when I navigate to another page (using the routes e.g. In Twig: {{ path('dashboard') }}
Log:
Jan 10 14:38:11 |INFO | PHP    Matched route "dashboard".
Jan 10 14:38:11 |DEBUG| PHP    Read existing security token from the session.
Jan 10 14:38:11 |DEBUG| PHP    SELECT t0.id AS id_1, t0.first_name AS first_name_2, t0.last_name AS last_name_3, t0.email AS email_4, t0.password AS password_5, t0.status AS status_6, t0.guid AS guid_7, t0.created_date AS created_date_8, t0.modif
0, t0.user_type AS user_type_11, t0.roles AS roles_12, t0.created_by_id AS created_by_id_13, t0.modified_by_id AS modified_by_id_14 FROM user t0 WHERE t0.id = ?
Jan 10 14:38:11 |DEBUG| PHP    User was reloaded from a user provider.
Jan 10 14:38:11 |DEBUG| PHP    Checking for guard authentication credentials.
Jan 10 14:38:11 |DEBUG| PHP    Checking support on guard authenticator.
Jan 10 14:38:11 |DEBUG| PHP    Guard authenticator does not support the request.
Jan 10 14:38:11 |DEBUG| PHP    Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\DebugHandlersListener::configure".
Jan 10 14:38:11 |DEBUG| PHP    Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\ValidateRequestListener::onKernelRequest".
Jan 10 14:38:11 |DEBUG| PHP    Notified event "kernel.request" to listener "Nelmio\CorsBundle\EventListener\CorsListener::onKernelRequest".
Jan 10 14:38:11 |DEBUG| PHP    Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\SessionListener::onKernelRequest".
Jan 10 14:38:11 |DEBUG| PHP    Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\LocaleListener::setDefaultLocale".
Jan 10 14:38:11 |DEBUG| PHP    Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\RouterListener::onKernelRequest".
Jan 10 14:38:11 |DEBUG| PHP    Notified event "kernel.request" to listener "Symfony\Bundle\FrameworkBundle\EventListener\ResolveControllerNameSubscriber::onKernelRequest".
Jan 10 14:38:11 |DEBUG| PHP    Notified event "kernel.request" to listener "ApiPlatform\Core\Filter\QueryParameterValidateListener::onKernelRequest".
Jan 10 14:38:11 |DEBUG| PHP    Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\LocaleListener::onKernelRequest".
Jan 10 14:38:12 |DEBUG| PHP    Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\LocaleAwareListener::onKernelRequest".
Jan 10 14:38:12 |DEBUG| PHP    Notified event "kernel.request" to listener "Symfony\Bundle\SecurityBundle\Debug\TraceableFirewallListener::configureLogoutUrlGenerator".
Jan 10 14:38:12 |DEBUG| PHP    Notified event "kernel.request" to listener "Symfony\Bundle\SecurityBundle\Debug\TraceableFirewallListener::onKernelRequest".
Jan 10 14:38:12 |DEBUG| PHP    Notified event "kernel.request" to listener "ApiPlatform\Core\EventListener\AddFormatListener::onKernelRequest".
Jan 10 14:38:12 |DEBUG| PHP    Notified event "kernel.request" to listener "ApiPlatform\Core\EventListener\ReadListener::onKernelRequest".
Jan 10 14:38:12 |DEBUG| PHP    Notified event "kernel.request" to listener "ApiPlatform\Core\Security\EventListener\DenyAccessListener::onSecurity".
Jan 10 14:38:12 |DEBUG| PHP    Notified event "kernel.request" to listener "ApiPlatform\Core\EventListener\DeserializeListener::onKernelRequest".
Jan 10 14:38:12 |DEBUG| PHP    Notified event "kernel.request" to listener "ApiPlatform\Core\Security\EventListener\DenyAccessListener::onSecurityPostDenormalize".
Jan 10 14:38:12 |DEBUG| PHP    Notified event "kernel.request" to listener "ApiPlatform\Core\Bridge\Symfony\Bundle\EventListener\SwaggerUiListener::onKernelRequest".
Jan 10 14:38:12 |DEBUG| PHP    Notified event "kernel.request" to listener "Knp\Bundle\PaginatorBundle\Subscriber\SlidingPaginationSubscriber::onKernelRequest".
Jan 10 14:38:12 |INFO | PHP    User Deprecated: The "templating.locator" service is deprecated since Symfony 4.3 and will be removed in 5.0.
Jan 10 14:38:12 |INFO | PHP    User Deprecated: The Symfony\Bundle\FrameworkBundle\Templating\Loader\TemplateLocator class is deprecated since version 4.3 and will be removed in 5.0; use Twig instead.
Jan 10 14:38:12 |INFO | PHP    User Deprecated: The "templating.name_parser" service is deprecated since Symfony 4.3 and will be removed in 5.0.
Jan 10 14:38:12 |INFO | PHP    User Deprecated: The Symfony\Bundle\FrameworkBundle\Templating\TemplateNameParser class is deprecated since version 4.3 and will be removed in 5.0; use Twig instead.
Jan 10 14:38:12 |DEBUG| PHP    Notified event "kernel.controller" to listener "Symfony\Bundle\FrameworkBundle\DataCollector\RouterDataCollector::onKernelController".
Jan 10 14:38:12 |DEBUG| PHP    Notified event "kernel.controller" to listener "Symfony\Component\HttpKernel\DataCollector\RequestDataCollector::onKernelController".
Jan 10 14:38:12 |DEBUG| PHP    Notified event "kernel.controller" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\ControllerListener::onKernelController".
Jan 10 14:38:12 |DEBUG| PHP    Notified event "kernel.controller" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\ParamConverterListener::onKernelController".
Jan 10 14:38:12 |DEBUG| PHP    Notified event "kernel.controller" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\HttpCacheListener::onKernelController".
Jan 10 14:38:12 |DEBUG| PHP    Notified event "kernel.controller" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\TemplateListener::onKernelController".
Jan 10 14:38:12 |INFO | PHP    YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY: Tenant instantiated
Jan 10 14:38:12 |DEBUG| PHP    Notified event "debug.security.authorization.vote" to listener "Symfony\Bundle\SecurityBundle\EventListener\VoteListener::onVoterVote".
Jan 10 14:38:12 |DEBUG| PHP    Notified event "kernel.controller_arguments" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\SecurityListener::onKernelControllerArguments".
Jan 10 14:38:12 |DEBUG| PHP    Notified event "kernel.controller_arguments" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\IsGrantedListener::onKernelControllerArguments".
Jan 10 14:38:12 |INFO | PHP    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX: Reinitializing tenant
Jan 10 14:38:12 |DEBUG| PHP    SELECT t0.id AS id_1, t0.default_org AS default_org_2, t0.user_id AS user_id_3, t0.organization_id AS organization_id_4 FROM user_organization t0 WHERE t0.user_id = ?
Jan 10 14:38:12 |INFO | PHP    ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ: Tenant initialized with id: 5
Jan 10 14:38:12 |INFO | PHP    User Deprecated: Using the "templating" service is deprecated since version 4.3 and will be removed in 5.0; use Twig instead.
Jan 10 14:38:12 |INFO | PHP    User Deprecated: The Symfony\Bridge\Twig\TwigEngine class is deprecated since version 4.3 and will be removed in 5.0; use \Twig\Environment instead.
Jan 10 14:38:12 |INFO | PHP    User Deprecated: The Symfony\Bundle\FrameworkBundle\Templating\EngineInterface interface is deprecated since version 4.3 and will be removed in 5.0; use Twig instead.
Jan 10 14:38:12 |INFO | PHP    User Deprecated: The Symfony\Bundle\TwigBundle\TwigEngine class is deprecated since version 4.3 and will be removed in 5.0; use \Twig\Environment instead.

I can see tfrom the logs that the constructor is meing called again, this happens for every request.
How do I get TenantContext to be one instance for the whole session?
Thanks in advance.
Edit:
It seems this happens on other services too, I added some logging on another service I have and it performs the same.  I haven't noticed this so far as all my services do not hold any data, just functions.

A: As per the comments, I now realize that my understanding of the Services is incorrect and they are instantiated on each request.
Therefore to get around my problem, I am storing hte ID in the session and retrieving the data when required using the Id from the session.


text:
Q: Cannot use vinylPaths del with gulp I have the following gulp task,  basically what it does is:

*

*compile all .styl files

*put the result in theme/app folder

*minify all file in theme/app folder

*concatenate all file in folder theme/app folder to a single file

*add some license information to the file

*save result in foldertheme

*delete all files in theme/app folder

I cannot make work the last step, I need to delete all files in theme/app.
I have not specific error, what could could be wrong in my script and how to solve it?

   gulp.task('_release-theme:compile', function () {
        gulp.src([
            'app/**/*.styl',
            '!app/**/**mixins**.styl',
            '!app/**/**variables**.styl',
        ])
        .pipe(stylus({
            compress: false,
            use: nib()
        }))
        .pipe(gulp.dest('theme/app'))
        .pipe(cleanCSS())
        .pipe(concat('theme.css'))
        .pipe(header(fs.readFileSync('licenses/app.txt', 'utf8')))
        .pipe(gulp.dest('theme/'))
        .pipe(vinylPaths(del['theme/app/**/*'])); // problem here
    });

A: del is a function. Your object property access del['theme/app/**/*'] makes no sense here.
Instead listen for the end event in your stream and then delete the files using rimraf:
var rimraf = require('rimraf');

gulp.task('_release-theme:compile', function (done) {
    gulp.src([
        'app/**/*.styl',
        '!app/**/**mixins**.styl',
        '!app/**/**variables**.styl',
    ])
    .pipe(stylus({
        compress: false,
        use: nib()
    }))
    .pipe(gulp.dest('theme/app'))
    .pipe(cleanCSS())
    .pipe(concat('theme.css'))
    .pipe(header(fs.readFileSync('licenses/app.txt', 'utf8')))
    .pipe(gulp.dest('theme/'))
    .on('end', function() {
      rimraf('theme/app/**/*', done);
    });
});


text:
Q: How to unit test a class, which is using Console class? I have class, which is using Console class and sets this variables in constructor.
  public Scene() {
        Height = Console.WindowHeight;
        Width = Console.WindowWidth;
    }

and test class, which tests this constructor:
public class SceneTests {
    [Fact]
    public void Contructor_None_ShouldReturnScene() {
        var testScene = new Scene();
        Assert.Equal(Console.WindowHeight, testScene.Height);
        Assert.Equal(Console.WindowWidth, testScene.Width);
    }
}

But while running this test I've got Exeption:
Exception has occurred: CLR/System.IO.IOException
An exception of type 'System.IO.IOException' occurred in System.Console.dll but was not handled in user code: 'Nieprawidłowe dojście'
at System.ConsolePal.GetBufferInfo(Boolean throwOnNoConsole, Boolean& succeeded)
at System.ConsolePal.get_WindowHeight()
at System.Console.get_WindowHeight()

I guess, that's because I don't have actual Console window.
Can I somehow simulate that? Maybe simple creating buffer manually and adding it to Console will solve the problem.

A: In the normal fashion...
Create an interface that describes your access to the console.  Implement that interface in a class that simply uses the System.Console.  Inject that into your running code using your favorite "Dependency Injection" mechanism.
Then create another class for use during testing that implements that same interface, but without using the System.Console class (for example, simply hard-code the WindowHeight and WindowWidth properties, have Console.ReadLine always return the same string, write Console.Write or WriteLine to some other place).  Inject that class into your unit test code.


text:
Q: How do I obtain a Structure.ByReference from a Structure using JNA? I do have a object of Structure in my java code. But the Jar generated using JNAerator expects Structure.ByReference as a data type. Is there any method in jna or code snippet to convert Structure object into Structure.ByReference object?

A: Generally, you don't need to explicitly specify Structure.ByReference when passing parameters.  If it's a parameter, you can drop the .ByReference from the signature and it'll work just fine.
If it's a field within a structure, then JNA interprets Structure as by value, in which case you would need to provide the .ByReference explicitly.
This is one way to do it.
class MyStructure extends Structure {
    class ByReference extends MyStructure implements Structure.ByReference {
        public ByReference() { }
        public Byreference(Pointer p) { super(p); read(); }
    }
    public MyStructure() { }
    public MyStructure(Pointer p) { super(p); read(); }
}

MyStructure s;
// ...
MyStructure.ByReference ref = new MyStructure.ByReference(s.getPointer());


text:
Q: Android contacts use ContactsSource for lower api levels and ContactsAccountType as default in contacts.xml I have been experiencing a small problem with the contacts application for android 2.1 where my app causes the contacts application to crush when displaying contacts due to the contacts xml definition.
<ContactsAccountType
    xmlns:android="http://schemas.android.com/apk/res/android"
    viewContactNotifyService=".ContactViewedService">
   ...
</ContactsAccountType>

The error that was being displayed was :
05-01 12:43:31.960: E/AndroidRuntime(1064): FATAL EXCEPTION: main
05-01 12:43:31.960: E/AndroidRuntime(1064): java.lang.IllegalStateException: Top level element must be ContactsSource
05-01 12:43:31.960: E/AndroidRuntime(1064):     at com.android.contacts.model.ExternalSource.inflate(ExternalSource.java:133)
05-01 12:43:31.960: E/AndroidRuntime(1064):     at com.android.contacts.model.ExternalSource.inflate(ExternalSource.java:104)
05-01 12:43:31.960: E/AndroidRuntime(1064):     at com.android.contacts.model.ContactsSource.ensureInflated(ContactsSource.java:98)
05-01 12:43:31.960: E/AndroidRuntime(1064):     at com.android.contacts.model.Sources.getInflatedSource(Sources.java:311)

I managed to trace and found that I needed to switch ContactsAccountType to ContactsSource in the contacts.xml file which is deprecated so my question is:
Is there a way I can have contactsSource for lower api versions as a fallback and ContactsAccountType as the default in my xml description?

A: Of course you can.
You can define old xml with ContactsSource      in default xml folder
And create second xml with ContactsAccountType in xml-v11 folder.


text:
Q: App installs after every build After building my project for running the app installs on to my device every single time.
Preparing to install on to X's iPhone -> Installing on to X's iPhone...
I was also just added to the development team for this project, could it be something with the provisioning profile?

A:
After building my project for running the app installs on to my device every single time

That's because (1) your destination is the device and (2) the device is connected to the computer. If you don't want to install to the device when you build, then change one or both of those.


text:
Q: Can a new programmer with limited technical expertise ask a quality question about fundamentals on SO? Subtitle:  Should beginner's questions be off-topic strictly because they are beginner's questions?
The sorts of questions that newbie programmers ask has come up before many times in side discussions, and comes up constantly on the main site.  Here are two examples from today:
Usage of "&" in function calls, confused
C++ vertical bar?
Both of the above questions are well-formed, specific, answerable definitively, not open to opinions and are otherwise directly on-topic for StackOverflow.
However both questions were downvoted and closed by users who said they were off-topic because they were too basic in nature.  To quote one particularly pointed comment:

This question appears to be off-topic because it is trivially
answerable by reading a beginners' language tutorial.

That pretty much sums it up.
Here's another case posted yesterday:
Possible segmentation fault: Am I using the "this->" operator correctly?
This is another beginner's question.  The topic is fairly elementary.  The answer can likely be found in Strustrup's book, or any number of other books that we recommend.  Considering only that it is a beginner's question of a fundamental nature, should the question be considered off-topic?
Lots of questions are posted from lazy people who are just looking to be spoon-fed answers.  Those questions should all be closed because they never meet the quality guidelines.  That's not what I'm asking about here.  What I'm asking about is just the elementray nature of the question.  If the question is elementary, but otherwise meets our quality and topical requirements, is it off-topic?
I have always thought that Stack Overflow is for professional and enthusiast programmers, people who write code because they love it.  But enthusiasts come in all shapes and sizes, from the bright-green newbie writing their first program to the grizzled veterans who have seen and done it all a million times before.  I have always felt that SO's stated audience does not, or should not, discriminate based on the expertise of the asker.
Some would say that newbie questions are off-topic because they aren't interesting enough for the answerers.  But this seems highly subjective to me.  After all, every question is a "no-duh softball" to someone.  Just today I provided what I thought was a pretty novel solution to a problem, only to learn a few minutes later that KonradRudolph and Yakk had come up with the same solution over a year before.  No-duh.
It seems to me that this has been coming up much more recently.  Sometimes I'll chime in with a comment to the downvoters and close-voters suggesting that the level of expertise is not a parameter in deciding if a question is topical.  The downvoters will often agree.  But we don't have a difinitive resource to point to that says this is so -- it doesn't say it in the FAQs, and I've not found anything difinitive in meta.
So what says meta?  Can a question about basics be on-topic for Stack Overflow?  If it can be off-topic, how do we know where to draw the line?

A: The difficulty here arises due to the need for a question asker to have some basic, fundamental knowledge of their craft.
Here's why (a trivial example):

GURU: Double Click the Foo Icon.
USER1: OK.
GURU: Double-Click the Foo Icon.
USER2: What do you mean?
GURU Click it twice with your mouse.
USER2: What's a mouse?

You can immediately see the problem, can't you?
When you ask a programmer how to do something, the expectation is that you have enough knowledge to understand the answer.  In most cases, this means that your knowledge will extend beyond simple syntax and other things that can be readily learned from a programming book, or a wealth of tutorials that are available for free on the Internet.

A: Lets define trivial as: "covered explicitly in language tutorials/book for beginners".
There is a common consensus that the fact that something can be found via Google doesn't make the question off-topic, because we'd like ultimately Google results point to SO. Answers to non-trivial questions cover practical problems that have the potential of being helpful to many users, and they're often not an exact copy, but rather a compilation and/or transformation of information found via Google, often with additional explanation in a particular context.
On the other hand answers to trivial questions are so basic they can't be much more than just copy&paste from one of many freely available tutorials. Number of possible trivial questions is enormous in relation to non-trivial questions. For example, if users are allowed to ask about the basics of C++ operators as in questions linked by OP it would then ultimately SO will be just littered with trivial explanations of each part of the language syntax. This is pointless, because answers to these questions won't be helpful to anyone in the future: other users being equally lazy won't find this answer via Google - they will just ask it again. Also it spoils Google search results, when you're interested in an official reference (example - two SO links before the documentation links).

A: You'd probably be happier if these things got closed as duplicates. However, it is real work to track down a good reference question. On the other hand, the triviality of the matter leaves people absolutely convinced that the duplicate is out there, let alone all the other myriad resources that explain & and |.


text:
Q: Find a tag in current element by xpath I'm trying to find 2 tags in a web element. I have a list of these elements found by href ( contains "http://www.example.com/result=" ).
So I have this:
for elem in elements:
    # don't know what to type here

I want to get a touple, in this case ('THS','http://www.example.com/result=1')

     87
     THS

        xxx

I've tried to do this:
for elem in elements:
    shortcut = elem.find_element_by_xpath('//td[@align="center"]/text()')
    href = elem.find_element_by_xpath('//a[contains(@href,"http://www.example.com")]/@href')

But there is a problem that Selenium looks in the whole page source, not just in current element.
Do you know how to look for this tags in current element?

A: First, you need to tell Selenium via the "." operator that you want to search from the current element on.
Then you should extract the values via .text and get_attribute("value")
Just // means "search the whole site"
Using .// means search from the current element on:
Given that elements contains the tr elements, your modified code would be:
for elem in elements:
    shortcut = elem.find_element_by_xpath('.//td[@align="center"]').text
    href = elem.find_element_by_xpath('.//a[contains(@href,"http://www.example.com")]').get_attribute("href")

A: Try relative xpath-
href = elem.find_element_by_xpath('//td[@align="center"]).find_element_by_xpath('.//a[contains(@href,"http://www.example.com")]').get_attribute('@href')

or following axis-
href = elem.find_element_by_xpath('//td[@align="center"]/following::a[contains(@href,"http://www.example.com")][1]').get_attribute('@href')

or descendant axis
href = elem.find_element_by_xpath('//td[@align="center"]/descendant::a[contains(@href,"http://www.example.com")][1]').get_attribute('@href')


text:
Q: Java: Casting and Inheritance Okay, so recently I realized that I have some misunderstandings with extending and inheritance inside of java.
So far, my understanding states that you cannot do this
MySubClass myClass = (MySubClass) new MyClass();

That makes enough sense to me, but there are a few gabs and work-arounds that I don't know how to succeed in, such as if a person is trying to get a SubClass from a method that returns the SuperClass. For example:
public static MyClass getNewMyClass() {
    return new MyClass();
}

And inside of MySubClass there are specific methods I want to access, such as
public void sayBye() {
    System.out.println("Bye.");
}

So what I would think is I need to do is
((MySubClass) myClass).sayBye();

..but of course that throws a ClassCastException.
Summary/Question
So basically my question will be, how do I get the subclass of a returned class from a method, or is it possible?
Example: MyClass.getNewMyClass() returns a new MyClass, but I want to use the method sayBye() in its subclass, MySubClass.
More Information
The reason I'm asking this is because I'm trying to create an API for myself that basically will shorten the development of what I am trying to accomplish. In one of my classes, it contains a whole bunch of methods that returns MyClass. Some method examples could be public MyClass getNewMyClass() {}, public MyClass findMyClass(String name)() {} and so on.
But when I get to exending MyClass for some extra methods, I have about 10 methods from the superclass that returns MyClass, and all of that basically will leave me back to the beginning. Is there the possibility of returning Class<? extends MyClass> instead, or something similar?
Solved
Thank you everyone so much for your help, it is very much appreciated! So I basically decided to go with delegation. To solve my issue, here were all of my code and classes, that allowed me to access the superclass, but return the subclass.
Here was my InheritanceTest.java
public class InheritanceTest {
    public static void main(String[] args) {
        MyClass myClass = MySubClass.doMath();
        if (myClass instanceof MySubClass) {
            ((MySubClass) myClass).sayBye();
        }
    }
}

And my MyClass.java
public class MyClass {

    protected String name;

    public MyClass(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public static MyClass getNewMyClass() {
        return new MyClass("Toshimaru");
    }

    public void sayHi() {
        System.out.println("Hi.");
    }
}

And finally, where it all seems to be resolved, MySubClass.java
public class MySubClass extends MyClass {

    public MySubClass(String name) {
        super(name);
    }

    public static MySubClass doMath() {
        // Got the new instance of MyClass
        MyClass myClass = getNewMyClass();
        // And turned it into a MySubClass with myClass' properties.
        myClass = new MySubClass(myClass.getName());
        return (MySubClass) myClass;
    }

    public void sayBye() {
        System.out.println("Bye.");
    }
}

A: You can't make an Animal to bark, Only a sub class of Animal, Dog can bark.
In the same way, You can't invoke a sub class method on super class instance. Object oriented concepts are very much similar to real world.

A: The trouble with trying to get a subclass from a superclass is you don't know what subclass it is.  You could do an instanceof check first before casting and that would avoid the ClassCastException, but that is nasty.  Ideally you should have your methods return objects that are as high up the hierarchy as possible but if you need a method that belongs to a subclass then that should be the return type of the method.
EDIT:
Your more information is a little vague, but this is legal:
public class MyClass {

    public MyClass getNewMyClass(){
        return new MyClass();
    }
}

public class MySubClass extends MyClass{

    @Override
    public MySubClass getNewMyClass() {
        return new MySubClass();
    }
}

A: MySubClass is an acceptable return for MyClass. I would instead return new MySubClass() which would then be able to call the subclass method. Polymorphism applies.

A: All Toyotas are Cars, but not all Cars are Toyotas.  How does this relate here? In this example, Car is analogous to your MyClass and Toyota is analogous to your MySubClass.
If you create an object as a Car, you won't have access to the methods inside Toyota. However, if you create an object as Toyota, you do have access to the public (or protected) methods inside Car.
If you're the designer of MyClass and MySubClass, and you think sayBye() is a method that should be accessible at the parent level, then maybe you need to consider redesigning/refactoring and making sayBye() a method in your parent class.

A: This cast:
((MySubClass) myClass).sayBye();

does NOT always throw a ClassCastException, as you said, but it depends on what is the actual (more specific) type of the object referenced by the variable myClass.
If the variable MyClass myClass references an object of the class MySubClass, then the cast does not throw any exception.
But the point is that, if you want to call a method of an object, this method must be defined and implemented in the class (or some superclass) of that object, while you can NOT call a method on a object, where this method is only implemented in some of its subclass, because in this case that method is not present in that object (but only on object of its subclass).


text:
Q: Remembering Dynamic/AJAX Form Values Before I start I'm sorry if this has been asked before, however most of the answers I have read have either not worked or are not clear enough.
My first question is how does the browser remember form input values? I.E, you go to GMail and start typing your E-Mail address in and a dropdown appears with the E-Mails that have been typed into your computer. I do KNOW that this is just handled natively by the browser, however how or can I make it work with dynamic/AJAX forms? How does the page's Cache-Control or other headers come into play with this? Or do they at all?
My second question is related, on some web pages when you login the browser (not the website) asks if you would like it to remember your name and password. If you do then the next time you go to the login page the form is filled out for you already in a gold highlight. How can I replicate this behavior?
Thank you in advance.

A: In order for you to save typed in email addresses you will need some sort of database. You would use ajax to record the keystrokes to the database and then retrieve it with ajax. That can be does simultaneously with ajax.
The second question is you need to store a cookie with an id so that you can use the to look up the information in a database and either fill in the username or just log them in.


text:
Q: How to use setup menu(values) behavior of Semantic ui to populate a dropdown with values from database So I have a form created by using JSP and Servlet in that form i have a dropdown which i am trying to populate with the values which are in my database by using semantic UI behavior [enter link description here][1] (setup menu(values)).
Can someone please help regarding this ?? , Any help is appreciated thanks in advance.
I'll add the code which i have tried below.
This is my Dropdown and i am using  element instead of .

                 Main Category
                    <select name = "home_main_category"  id = "home_main_cat_dropdown_id" >
                        <option value = "" > Category </option>
                    </select>

this is how i am trying to use semantic behavior setup menu(values) but i am not sure what to give in place of name text and value.

please can anyone give some sample code of how to implement this behavior ??

A: 1. Better go with Fomantic-UI
First of all, I strongly suggest you to switch to Fomantic-UI, that's a fork of Semantic-UI, but it's actively mantained and updated, while Semantic-UI is kind of abandoned (Semantic-UI last update was in 2018).
Fomantic-UI has the same components and functionalities of Semantic-UI, but Fomantic-UI added new and useful features/settings to several components/modules and also created brand new ones (like toasts or calendar).
2. Dropdown menu
That said, you can setup/re-create a dropdown's menu in this way:
$(dropdownElement)
   .dropdown('setup menu', { values: some_array });

where some_array is an array (You don't say?!? :D ) shaped like this:
some_array = [
   {value: '', name: '', text: ''},
   {value: '', name: '', text: ''},
   ...
   {value: '', name: '', text: ''},
]

*

*value is the value (for the given <option>) that will be stored in dropdown's hidden <input> field

*name is the text (of the given <option>) that is shown in the list of options when you open the dropdown.

*text is the text (of the given <option>) that will be shown in the dropdown when you select that option

Both name and text accept also HTML markup, as you can see in the snippet below.

const menuItems = [{
    value: 'john',
    name: '- John -',
    text: 'John selected'
  },
  {
    value: 'mary',
    name: '- Mary -',
    text: 'Mary selected'
  },
  {
    value: 'james',
    name: '- James -',
    text: 'James!!!'
  },
]

$("#home_main_cat_dropdown_id").dropdown('setup menu', {
  values: menuItems
});
span.name.red {
  background: red;
  padding: 10px;
  color: #cecece;
}

span.text.green {
  background: lightgreen;
  padding: 2px 10px;
}

<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/fomantic-ui@2.8.8/dist/semantic.min.css">

   Main Category
  <select name="home_main_category" id="home_main_cat_dropdown_id">
    <option value=""> Category </option>
  </select>


text:
Q: Can i make Intellij compile single package? I was wondering if it is possible to make intellij compile a single pacakge, and make it ignore the rest of the errors.

A: In the version of IntelliJ I have (14, Community Edition, Windows 7), I can right-click the package, and in the context menu, I can choose "Compile '<package-name>'".  The shortcut key sequence present there is Ctrl-Shift-F9, which compiles the highlighted package.


text:
Q: @restcontroller not accepting any mapping if placed in different package, but accepts if placed in main class package I'm seeting up Rest end point & @Restcontroller doesnt accept/Map any incomming requests if placed in difefrent package,but works fine if placed in main class package
Spring boot being set-up in Eclipse IDE.
SpringApp.java (main method) in com.java package      --------- Work's fine

@SpringBootApplication
@RestController
public class SpringApp
{

       @RequestMapping("/welcome")
    String welcome() {
        return "Hello!! welcome";
    }

    public static void main(String[] args) {
        SpringApplication.run(SpringApp.class, args);

    }

}

TestController.java in com.controller package    ----  Doesn't work

@RestController
public class TestController {

    @RequestMapping("/welcome")
    String welcome() {
        return "Hello!! welcome";
    }

I expected the request to get mapped irrespective of the package in which they are placed

A: you have to specify packages to be scanned while starting application
@ComponentScan(basePackages = { "com.controller"})

A: place it in a package under the package where the main class is
in your case the package name is com.java.controller

A: Duplicate with @RestController in other package doesn't work


text:
Q: Superset & DECK.GL -- cannot display shaded polygons I want to visualize Zip3 polygons, shaded by the population.  I have GeoJSON formatted as text strings in a Snowflake table, and am able to visualize them using the "Deck.GL GEOJSON" map type, but not "Deck.GL Polygon", which is what I need.
I have tested the GeoJSON with geojson.io and they are valid.
This is a "Deck.GL Polygon" type and does not work (showing up blank, but with the Legend correctly displaying):

This is a "Deck.GL GEOJSON" type and which DOES work (but does not allow me to color it by population):

Any ideas how to shade these polygons in Superset?

A: Why do you need PolygonLayer instead of GeoJsonLayer? At the end GeoJsonLayer renders a SolidPolygonLayer
So, GeoJsonLayer = SolidPolygonLayer
One of the differences between rendering a GeoJsonLayer or SolidPolygonLayer is that, if your data is already a geojson format, you don't need to specify an accessor to tell deck.gl where your data coordinates are located (because internally interprets where those are => feature => geometry => coordinates)
I would go using a GeoJsonLayer, and then, for styling polygons, you will need to use getFillColor accessor like:
new GeoJsonLayer({
  ...,
  getFillColor: ({ properties }) => {
    if (properties.population > 1_000_000) {
       return [255, 0, 0]
    }
    return [0, 255, 0]
  }
})


text:
Q: how to align textview according to above imageview in android I m not satisfied with the result of my layout whenever I test it in landscape mode on different screen size devices.
In portrait I like the margin of the textview. Since my current image size of the imageview will not fill the full width of some devices out there in landscape there is some whitespace left and right to it, which is fine.
however, the margin of the textview should also take this whitespace into account and add it somehow. I know i can create a different xml style for landscape modes, but any fixed margin wont help here... thanks for any help in advance

 <ImageView
    android:id="@+id/imageView1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:scaleType="fitStart"
    android:adjustViewBounds="true"
    android:src="@drawable/start1_8" />

<TextView
    style="@style/DescriptionTitle"
    android:id="@+id/textView1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@id/imageView1"
    android:text="Test Titelzeile"   />

<style name="DescriptionTitle" parent="@android:style/TextAppearance">
    <item name="android:textColor">#0099cc</item>
    <item name="android:textStyle">bold|italic</item>
    <item name="android:textSize">20sp</item>
    <item name="android:layout_gravity">center_vertical|left</item>
    <item name="android:gravity">top|left</item>
    <item name="android:layout_marginLeft">15dp</item>
    <item name="android:layout_marginRight">15dp</item>
    <item name="android:layout_marginTop">5dp</item>

</style>

A: I would put it in a Relative Layout like this:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:orientation="vertical"
              android:layout_width="match_parent"
              android:gravity="center_horizontal"
              android:layout_height="match_parent">
    <ImageView
            android:id="@+id/imageView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerHorizontal="true"
            android:scaleType="fitStart"
            android:adjustViewBounds="true"
            android:src="@drawable/Untitled-1" />
    <TextView
            style="@style/DescriptionTitle"
            android:id="@+id/textView1"
            android:layout_alignLeft="@id/imageView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@id/imageView1"
            android:text="Test Titelzeile"   />
</RelativeLayout>

Then it will be in the correct relative position regardless of view size or orientation.

A: resize the view in runtime and use(like screenwidth/4 ) a ratio hor image width and position.
use LayoutParams to do it.


text:
Q: How to open a Bootstrap modal with a specific tab active I am trying to have the tab within the bootstrap modal open depending on what link is being clicked. No matter what I've tried it will only open up on the first tab. The two links are the following:
Mileage
Wrong vehicle?

and the markup for the modal is here:

 Wrong Vehicle?

 Mileage

          <form id="tab-wrong-vehicle" class="tab-pane active" action="" method="post">

Tab 1

          </form>

          <form id="tab-mileage" class="tab-pane">

 Mileage

Tab 2

          </form>

I need the modal to open up on the link that is clicked, for example,if I were to click on the second link it would open up the second tab in the modal. Any help would be greatly appreciated, I haven't been able to find a solution to this anywhere.
I left the original ID's in the code incase I made a mistake in replacing them.

A: Take benefit of the shown.bs.modal event. The event holds info about the href of the clicked , and then you can change the tab according to that :
$("#buyers-report-modal").on('shown.bs.modal', function(e) {
    var tab = e.relatedTarget.hash;
    $('.nav-tabs a[href="'+tab+'"]').tab('show')
})

your code working -> http://jsfiddle.net/pvo1sny8/

A: You need to target the tab's anchor and run the $.tab('show') function.
http://getbootstrap.com/javascript/#tabs
Since you know the tab anchor has attributes of data-toggle=tab and the href=id we can use a href from the link to pass to the selector for the tab.
$('a[data-toggle=modal][data-target]').click(function () {
    var target = $(this).attr('href');
    $('a[data-toggle=tab][href=' + target + ']').tab('show');
})

DEMO:
http://jsfiddle.net/SeanWessell/2ct9zuu9/

A: I've added a class .modal-toggle to the  elements which toggle the modals. Further, I've added some additional function which triggers on click and get's the href of the clicked element, after that I'm using tab("show") on the  element inside the
 which matches the href. (I've added a close button inside your modal, so it's easier to test the demo)
$('.modal-toggle').click(function(e){
    var tab = e.target.hash;
    $('li > a[href="' + tab + '"]').tab("show");
});

Demo Fiddle


text:
Q: how to remove/hide wordpress plugin menu from admin dashboard i want to hide wp menu from my admin dashboard.. how remove/hide wordpress menu from admin dashboard .. i was try many code seems not work I want to hide yith_wacp_panel menu item s. How to remove yith_wacp_panel menu item in admin page?
enter image description here

A: If you only want to hide it you can do this.
if (!function_exists('remove_menus')) {
  function remove_menus () {
    remove_menu_page('plugins.php');
  }
}
add_action('admin_menu', 'remove_menus');

Because we use a very generic function name I wrapped it in function_exists so we don't get a php error for redeclaring a function.
If this doesn't work it might be that the call back doesn't use our function, you can add a prefix, as you should anyway, to the function.
So something like this
if (!function_exists('bt_remove_menus')) {
  function bt_remove_menus () {
    remove_menu_page('plugins.php');
  }
}
add_action('admin_menu', 'bt_remove_menus');

Now with bt_ as our prefix (or anything else that you want) we are less likely to have issues


text:
Q: Path Concatenation Using Remote OS Separator I'm trying to use pysftp with an external Linux server, but when I try to concatentate path and file names using os.path.join() or pathlib.Path() they understandably default to the local (Windows) path separator \\. '/'.join() does the trick, but doesn't feel like the right answer, but might be the best solution.
import os
from pathlib import Path, PosixPath

os.path.join('path', 'to', 'file.txt')
# path\to\file.txt -- Windows

Path('path') / 'to' / 'file.txt'
# path\to\file.txt -- Windows

'/'.join(('path', 'to', 'file.txt'))
# path/to/file.txt -- Posix

Often enough, I'm getting the path/to from the current working directory of pysftp so feeding that in rather than building the entire path string manually, the '/'.join() method is still the only one that works.
os.path.join('path/to', 'file.txt')
# path/to\file.txt -- Mixed

Path('path/to') / 'file.txt'
# path\to\file.txt -- Windows

'/'.join(('path/to', 'file.txt'))
# path/to/file.txt -- Posix

Is there a way to force os.path.join() or pathlib.Path to use the Posix separator while I'm running on Windows? I tried setting the sep attribute of Path, but it seems like that would have to be done for each Path individually even if it didn't raise the AttributeError and it doesn't seem to want to let me instantiate the PosixPath class directly.
p = Path('path/to')
p.sep = '/'
# AttributeError: 'WindowsPath' object has no attribute 'sep'

PosixPath('path') / 'to' / 'file.txt'
# NotImplementedError: cannot instantiate 'PosixPath' on your system

Trying to "trick" the os module with os.name = 'posix' or os.sep = '/' doesn't work either
print(os.name)
# nt
print(os.path.join("path", "to", "file.txt"))
# path\to\file.txt -- Windows as expected
os.sep = '/'
print(os.path.join("path", "to", "file.txt"))
# path\to\file.txt -- Windows as expected

os.name = 'posix'
print(os.name)
# posix
print(os.path.join("path", "to", "file.txt"))
# path\to\file.txt -- still Windows.
os.sep = '/'
print(os.path.join("path", "to", "file.txt"))
# path\to\file.txt -- still Windows.

Should it matter, I'm running python 3.7.0
Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)] on win32

A: Looks like os imports either ntpath or posixpath depending on what it determines your operating system to be from os.name. Unfortunately we know renaming os.name or os.sep doesn't work without a module reload, but you can get away with importing the two path modules directly:
>>> import posixpath
>>> import ntpath
>>> ntpath.join('asds','asdf', 'adf.txt')
'asds\\asdf\\adf.txt'
>>> posixpath.join('asdfa','asdf','asdf.txt')
'asdfa/asdf/asdf.txt'

or setting os.path if you want to use os
>>> import os
>>> os.path
<module 'posixpath' from '/home/usr/anaconda3/lib/python3.7/posixpath.py'>
>>> os.path = ntpath
>>> os.path
<module 'ntpath' from '/home/usr/anaconda3/lib/python3.7/ntpath.py'>
>>> os.path.join('asdfa','asd', 'asdf.txt')
'asdfa\\asd\\asdf.txt'
>>> os.path = posixpath
>>> os.path.join('asdfa','asd', 'asdf.txt')
'asdfa/asd/asdf.txt'

An alternative to using os would be to use the forward slash / as your path separator in your code. This is cross-platform.
'path/to/somefile.txt'