text:
Q: Is it kosher to assign to $! in Perl? Is it OK to assign to $! on an error in Perl?
E.g.,
if( ! (-e $inputfile))
{
      $! = "Input file $inputfile appears to be non-existent\n";
      return undef;
}

This way I can handle all errors at the top-level.
Thanks.

A: Well, the documentation  says it's an indicator for system errors, basically. So I wouldn't assign to it, you just make your lib's users mad.
Use exceptions instead:
eval { # this ain't the evil eval
   # some code
   die $something;
}
if (my $err = $@) {
   # exception handling
}

Note that you can "throw", or die, with about anything you need..

A: My Rabbi said "no!"

A: Setting $! is fine, but:

*

*you should do it at the end of your function

*you should return a different value that indicates that an error occurred

*you should use your OS's errno values rather than strings for setting purposes

*the checking code needs to check the value should do so immediately on failure of the function (and only if a failure is indicated by the function)

Something to keep in mind is that die uses the value in $! for its exit code (so long as it is not zero).

A: Yes you can assign stuff(#'s) to $!, just be wary of where you do it so you don't mess up some other functions message.

A: If you assign to $!, it is placed in the system errno variable, which only takes numbers.  So you can in fact do:
use Errno "EEXIST";
$! = EEXIST;
print $!;

and get the string value for a defined system error number, but you can't do what you want - setting it to an arbitrary string.  Such a string will get you a Argument "..." isn't numeric in scalar assignment warning and leave errno set to 0.
The other problem is that $! may be changed by any system call.  So you can only trust it to have the value you set until you do a print or just about anything else.  You probably want your very own error variable.

A: If you only have one variable to store errors, you'll have problems if you have more than one error occurring in your program before checking the status of your error variable. That's worth avoiding if you can help it.
Thankfully in Perl you can help it. A really nice solution is to use object-oriented exception handling from Error.pm. This module will allow you to write try/catch blocks, like this:
try {
    some code;
    code that might thrown an exception;
    more code;
    return;
}
catch Error with {
    my $ex = shift;   # Get hold of the exception object
    # handle the exception;
};

The CPAN documentation for the module is quite good, and there is a Perl.com article on the subject too.

A: $! has so many caveats, being a global variable which lots of functions assign to (some of them C functions which Perl calls), that I would simply throw an exception (which in Perl means dying) and let the user trap it if they care.  So instead of writing:
$obj->foo or die $!;
$obj->bar or die $!;
$obj->baz or die $!;

or even
$obj->foo or die $obj->error;
$obj->bar or die $obj->error;
$obj->baz or die $obj->error;

you can just write
$obj->foo;
$obj->bar;
$obj->baz;

and know that if there is an error you'll be informed of it.  Also anyone above you will be informed and can trap it.  Since that's the most common case make it happen without the user needing to remember it and type it over and over and over again.
Should you want to ignore or recover from the error, simply use eval BLOCK.
eval { $obj->foo };   # don't care if it works or not
eval { $obj->bar } or do { ...something when it doesn't work... };

Since this is the exceptional case it should be where the user has to remember to add more code and does more work.
Examples of this approach include DBI's RaiseError flag, which is only off by default for backwards compatibility, and the wonderful autodie module.


text:
Q: Why can't std::pair construct from function type that is passing by reference? I read from somewhere that constructor of std::pair is passing by value(before c++11) because if it's passing by reference, std::pair can't construct from reference function type. why?
//https://godbolt.org/z/5dMaG8E11
#include <iostream>
#include <utility>

void fun();

template <typename T>
void use(const T &)
{}

template <typename T, typename U>
std::pair<T, U> mp(const T & t, const U & u)
{
    return std::pair(t, u);
}

int main()
{
    use(::mp(fun, 3)); // failed
    use(std::make_pair(fun, 3)); // ok
}

/opt/compiler-explorer/gcc-10.3.0/lib/gcc/x86_64-linux-gnu/10.3.0/../../../../include/c++/10.3.0/bits/stl_pair.h:217:11: error: data member instantiated with function type 'void ()'
      _T1 first;                 ///< The first member
          ^
<source>:18:9: note: in instantiation of template class 'std::pair<void (), int>' requested here
    use(::mp(fun, 3)); // failed
        ^
<source>:13:12: error: no viable conversion from returned value of type 'pair<void (*)(), [...]>' to function return type 'pair<void (), [...]>'
    return std::pair(t, u);
           ^~~~~~~~~~~~~~~
<source>:18:11: note: in instantiation of function template specialization 'mp<void (), int>' requested here
    use(::mp(fun, 3)); // failed
          ^

redpajama_set_name: RedPajamaStackExchange


text:
Q: Cannot get FullCalendar to populate with my event array I have researched and I cannot get my solution to work.  I have created my rest service to provide the event data as needed...
[
  {"id":"cb2eb05b-7a24-431c-8948-d08fb51f6bab","title":"Happy Birthday Pat!","allDay":false,"start":"2017-12-30T03:00:00","end":"2017-12-31T02:30:00","url":""},
  {"id":"89fdeab5-1f49-4416-b81c-d9d9a3c4fbde","title":"RailJam on Westway","allDay":false,"start":"2017-12-31T15:00:00","end":"2017-12-31T19:00:00","url":""},
  {"id":"37afb0e6-e659-46a3-a048-5f13560ebe87","title":"Senior OEC Clinic","allDay":false,"start":"2018-01-07T11:00:00","end":"2018-01-07T19:00:00","url":""},
  {"id":"6d74033c-39ce-4d43-b642-bceed34e2294","title":"Senior OEC Clinic","allDay":false,"start":"2018-01-21T11:00:00","end":"2018-01-21T19:00:00","url":""},
  {"id":"36ca8f3b-6696-49f4-b7b7-a405660358e8","title":"Senior OEC Clinic","allDay":false,"start":"2018-01-28T11:00:00","end":"2018-01-28T19:00:00","url":""},
  {"id":"3b1a86ec-d09a-467d-ad83-43864439db1f","title":"Senior OEC Clinic","allDay":false,"start":"2018-02-03T11:00:00","end":"2018-02-03T19:00:00","url":""}
]

I have create my MVC page with the fullcalendar plug in...
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<dynamic>" %>

<link href="../../FullCalendar/fullcalendar.css" rel="stylesheet" type="text/css" />

But I am still not able to get my events to publish on the calendar.
Missing Events In FullCalendar
I am sure it is a simple mistake that I have missed...can anyone shed some light?

A: Success. My results were wrapped in HTML so not pure JSON. Corrected by returning a stream returned pure JSON string, not an HTML representation of the string.


text:
Q: restsharp postman code multipart post request sending 0kb images to JIRA i am working on posting images to a JIRA ticket via their rest API( requires a multipart post with custom headers) .
Everything works when in postman , the restsharp code that it generates is as follows :
var client = new RestClient("jira link here");
var request = new RestRequest(Method.POST);
request.AddHeader("cache-control", "no-cache");
request.AddHeader("Connection", "keep-alive");
request.AddHeader("Content-Length", "31321");
request.AddHeader("Cookie", "atlassian.xsrf.token=BMR0-T49H-M7PK-ZG4J_4f2a8b5df5dfd91780d88b5ea26f8de0_lin; JSESSIONID=CE20BD6E7D3FABA7A0E8F9403907CD97");
request.AddHeader("Accept-Encoding", "gzip, deflate");
request.AddHeader("Host", "classified");
request.AddHeader("Postman-Token", "b5f2a773-532a-47b7-83bd-36c3cce16b55,d07661e4-abf5-408e-be59-0360938b6b77");
request.AddHeader("Cache-Control", "no-cache");
request.AddHeader("Accept", "*/*");
request.AddHeader("User-Agent", "PostmanRuntime/7.18.0");
request.AddHeader("Authorization", "classified");
request.AddHeader("X-Atlassian-Token", "no-check");
request.AddHeader("Content-Type", "multipart/form-data");
request.AddHeader("content-type", "multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW");
request.AddParameter("multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW", "------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"file\"; filename=\"1280px-Microsoft_Azure_Logo.svg - Copy.png\"\r\nContent-Type: image/png\r\n\r\n\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW--", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);

i suspected the issue could be not having the full path of the image , tried adding the path , now it is posting the image , but the image is blank , 0kb. the image name is correct when posted to JIRA.
the image seems to be right , but is blank with the right name .
i also tried including request.addFile("x",@path);
still doesn't work .
This is the response from the server :
enter image description here

A: It turns out , postman adds a bunch of extra stuff to its auto generated code , anyways the code generation on postman needs to be fixed , here's how i fixed mine :
RestClient restClient = new RestClient("link here");
            RestRequest restRequest = new RestRequest("/attachments");
            restRequest.RequestFormat = DataFormat.Json;
            restRequest.Method = Method.POST;
            restRequest.AddHeader("Content-Length", int.MaxValue.ToString());
            restRequest.AddHeader("Authorization", "secret");
            restRequest.AddHeader("X-Atlassian-Token", "no-check");

            restRequest.AddHeader("content-type", "multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW");
            restRequest.AddHeader("Content-Type", "multipart/form-data");
            restRequest.AddFile("file", path);

            var response = restClient.Execute(restRequest);


text:
Q: password_hash не работает с файлами? Если вместо $a написать пароль в строку 'admsh1216hs' и сравнить он сработает, но после прочтения из файла сравнивать не хочет , это баг?
Файл читается , права на чтение есть.
$hello = 'admsahra1216hs';

$a = file_get_contents('content/pss.txt');
echo $a;
if (password_verify($hello, $a)) {
    echo "True<br>";
}
else {
    echo "err";
}

A: Решено, Создал текстовые документы через Netbeans IDE pss.txt и заработало , видимо проблема была все же в BOM.
P.S Видимо gedit тот что на UBUNTU не далеко ушел от notepad.exe на Windows


text:
Q: How to merge two databases for Magento Situation
To get this out first thing: I am not a Magento developer. Don't know much about it. I just consult when it comes to server and project management issues. I'll occasionally get my hands dirty with a rough patch for issues, but I don't know anything about the "Magento Way" of doing things.
We have a Magento site (1.9.3.4) we perform active development on. We have a production server and a development server.
Problem
Magento (like WordPress) is very database-dependent. We can version and transfer code without issue. We need an easy and reliable method for merging the databases, however.
On production we want to retain products, orders, reviews, site configurations (such as URL), etc; and on develop we want to retain CMS, plugin configurations (especially troublesome when we install a new plugin), etc.
Currently, I manually backup both databses, trim out the table I don't want from each, and combine them. I then push the resulting Frankensteinian database to production. This is as error prone as you can imagine.
There has to be a better way to do this.
Other Paths
I've toyed with the idea of a shared database, but that isn't ideal, as unapproved changes to products and pages would reflect on the production site.
I've also toyed with the idea of piping the database dumps into Git, but that still requires me to know which tables to keep from each respective database.
Update
Now that I think about it, would the better path here be to have a second "staging" store on the production environment rather than a separate development server? Caveats?

A: The correct environment in security and operation would be:

*

*Two different servers: avoids potential security problems that may exist in an developer environment and that can be harmful to the production environment.

*Two different databases in different server: for the same reason as before. How to work? First modifications are made in the development environment, if they are correct and everything works well, they are made in the production server.

*Files: use a repository system, like git, well configured, with .gitignore, and separating development and production in different branches.

Maybe this answer will not help you, but what are you proposing isn't safe nor is it a good practice to work in a project.
I hope to help you.

A: Interesting question although does confuse me a little bit, here is my take on it though, which is heavily based on opinion.
In reality Your product and Development database should match (mostly)
The way I currently work is, the database from product is pulled down to a staging/local environment without customer data, no orders, customer accounts, quotes etc.
I then do my development and if there is anything database wise that needs to change when going to production then these are done in an upgrade script, these are run automagically either on deployment using something like magerun or when logging into the admin.
For store configuration type things I normally have a Client_Core module and system config data upgrade scripts go inside there, then upon deployment these are run and the changes can be seen straight away.
As all the work i do has to go onto the staging environment first this basically means that after deploying to production the two environments match again, until the next release is built.
The only downside so far to this process is that if I were to create a release with 3/4 new features in it and deploy this to the staging environment and then the client decides they don't want one of those features, then we roll back the release so the code is rolled back and then we re-sync the database.
Basically what i'm saying is we almost never do any manual changes even to things like cms blocks/pages. The only caveat to this is that the client may make changes so before we do any deployments/database resync we make sure there is nothing on staging that the client wants to keep.

Hope this gives you some thoughts/insight to help you, as i said it's just my work process and opinions.


text:
Q: Using Twitter API's upload_with_media with iOS SDK? I've been looking for a Objective-C version of this PHP code sample on how to use Twitter's upload_with_media for an iPhone application.
I have been able to find one. Could you point me to ane example or explain how I could translate this code to Objective-C?
Thanks

A: You can Do like this for upload_with_media,
TWRequest *postRequest = [[TWRequest alloc] initWithURL:[NSURL URLWithString:@"https://upload.twitter.com/1/statuses/update_with_media.json"] parameters:nil requestMethod:TWRequestMethodPOST];

            UIImage * image = [UIImage imageNamed:@"myImage.png"];

            //add text
            [postRequest addMultiPartData:[@"I just found the secret level!" dataUsingEncoding:NSUTF8StringEncoding] withName:@"status" type:@"multipart/form-data"];
            //add image
            [postRequest addMultiPartData:UIImagePNGRepresentation(image) withName:@"media" type:@"multipart/form-data"];

            // Set the account used to post the tweet.
            [postRequest setAccount:twitterAccount];

            // Perform the request created above and create a handler block to handle the response.
            [postRequest performRequestWithHandler:^(NSData *responseData, NSHTTPURLResponse *urlResponse, NSError *error) {
                NSString *output = [NSString stringWithFormat:@"HTTP response status: %i", [urlResponse statusCode]];
                [self performSelectorOnMainThread:@selector(displayText:) withObject:output waitUntilDone:NO];
            }];


text:
Q: double ID exception throws when parse date parameter in ksoap in android I am working with SOAP parsing in android.
Actually my problem is that when I am trying to pass date as parameter it throws the doubleID exception.
My code is as follows:
public SoapPrimitive getUserList() {

        SoapPrimitive result = null;

    String isNewTask = null;

    SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);

    String startTime = "02-06-2013";
    SimpleDateFormat dateFormat = new SimpleDateFormat("MM-dd-yyyy");

    try {
        date1 = dateFormat.parse(startTime);
        System.out.println(date1);
    }
    catch (ParseException e1) {
        // TODO Auto-generated catch block
        Log.i("ParseException",e1.getMessage());
    }

    request.addProperty("fromDate", date1);

    request.addProperty("toDate", date1);

    SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);

    envelope.dotNet = true;
    envelope.setOutputSoapObject(request);
new MarshalDate().register(envelope);

    AndroidHttpTransport transport = new AndroidHttpTransport(URL);

        transport.debug = true;

        try {

            transport.call(SOAP_ACTION, envelope);

            result = (SoapPrimitive)envelope.getResponse();

            int count = request.getPropertyCount();

            String c = String.valueOf(count);

            Log.i("Count Value",c);

            isNewTask = result.toString();

            Log.i("Test", "------------------------------" + isNewTask);

        }
        catch (IOException e) {
            Log.i("IOException",e.getMessage());
        }
        catch (XmlPullParserException e) {
            Log.i("XmlPullParserException",e.getMessage());
        }

        return  result;
    }

I have follow the question kSOAP2 double ID exception
And according to that also done ...but not get successs.
Please help me...Thanks in advance...:)


text:
Q: React Native - Sensitive Data We are building a mobile application using React-Native and need to embedd some sensitive data such as client secret keys/passwords into the mobile application itself.
What is the standard practice on this in terms of security (hardest to reverse-engineer)? Should the data be at native code level as constants, resource files or react native javascript files?

A: You could use a library like react-native-keychain, which uses the native keychain libraries on iOS and Android.

A: Old question but really, the answer is obvious and I'm very surprised by the other answers you've got.

...need to embedd some sensitive data such as client secret
  keys/passwords into the mobile application itself.

NO. You do not need to do this. This is poor design on so many levels, not only security wise because you are giving away your secrets. What happens when your client secret is leaked and you need to quickly replace it. Do you want to call all your users and ask them to please upgrade?
If you need to call third party services then really you need to make a proxy service that authenticates the user based on their credentials and then fetches the information with whatever client authentication you have.
This is not different from any other client -> server architecture. Anything that is on the client you can assume WILL be reverse engineered. It is not even very hard to do.


text:
Q: Search inside sharepoint designer I'm using SharePoint designer and trying to find the "search in files option" throw all SharePoint project, something like in visual studio "search and replace".
Is such simple option available in visual designer 2010?

A: That option is not available in Sharepoint Designer.
Search in files option searches on files in your file system.
Sharepoint designer runs on your computer but it extracts data from the server using web services no files are actually on your computer so that feature is obviously not implemented.
It could be implemented on the server side and provided as a service. But bear in mind that data is also not stored on the file system in sharepoint but in the database.

A: Luis answer is not correct, at least not for Sharepoint Designer 2013. Click on "Site Pages", choose any page, press control + f to bring up find. Sharepoint Designer 2013 will pull down all the files associated with your site and begin searching them. You will need appropriate permissions.

A: The "All Pages" option will search your entire SharePoint site. I don't recommend it, it can be quite time-consuming and give you a lot of false positives.
Unfortunately, the only way to search multiple files is brute force:

*

*Close all open tabs.

*In the Navigation Pane, open the folder you want to search (such as "Site Assets").

*Right-click each file you want to search, and click "Edit in Advanced Mode".

*Repeat for each folder.

*Open the Find dialog.

*Click "Open page(s)" under "Find where:"

*Your search will include all open tabs.


text:
Q: Routine for authentication to clear local data In android mobiles there is possibility for clearing local data stored without any authentication.If we go to application manager and select an app->click clear data button the local data including files,database will get erased.I have an idea of introducing a routine to authenticate to clear the local data.So that other than user no one can clear it.Is it possible ?

A: This "CLEAR DATA" option is severely broken for the use-case of Home Screen widgets that may have shared preferences and/or some local cached data.
It is also completely against the developer documentation which says:
"You can save files directly on the device's internal storage. By default, files saved to the internal storage are private to your application and other applications cannot access them (nor can the user). When the user uninstalls your application, these files are removed."

A: I don't know if this answer is going to be helpful or not anyway i will tell you my idea,
i don't know if there is any mechanism that prevents the user from clearing the /data/data/<applicaton folder> but you can refer the Android device admin API at http://developer.android.com/guide/topics/admin/device-admin.html another approach is that(Don't know if that's even possible) to listen to the Settings>apps activity and show an authentication form but i think that wont be able to solve this problem here anyway maybe this idea may ring a bell


text:
Q: Is there a short word or slang for "matchmaker"? I'm trying to find an appropriate name for kind of a dating website. The purpose of the website is to match between people, hence the description - matchmaker. However this word isn't catchy enough.
Any suggestions for some catchy, appealing and "cute" word?

A: Cupid might be a good idea.
Play Cupid: to try to arrange for two people to fall in love.

He was playing cupid when he introduced John to Sheila.

According to ldoce:

a character based on the Roman god of sexual love, who was the son of Venus. Cupid is usually shown in pictures as a young boy with wings, holding a  bow  and  arrow . His picture is often used on  Valentine card s  to represent love. People sometimes say that they have been hit by Cupid's arrow when they have started to have romantic feelings for someone.

Accroding to MSN Dictionary:

Synonyms for matchmaker: marriage broker, go-between, fixer, intermediary, cupid

A: Here is are some words:

proxy
cupid

A: Continuing the stapler theme, how about

www.gluelove.com

as a play on "true love" (rather than a solvents problem...)


text:
Q: Can deployment diagrams have components in UML? I have these two questions:
Can deployment diagrams have components in UML?
Can component diagrams have nodes in UML?
I've seen many diagrams mixing diagrams elements and is making me confused.

A:
UML specification does not preclude mixing of different kinds of
  diagrams, e.g. to combine structural and behavioral elements to show a
  state machine nested inside a use case. Consequently, the boundaries
  between the various kinds of diagrams are not strictly enforced. At
  the same time, some UML Tools do restrict set of available graphical
  elements which could be used when working on specific type of diagram.

https://www.uml-diagrams.org/uml-25-diagrams.html
So, Answering your questions:
Yes, deployment diagrams can have components in UML and
Yes, component diagrams can have nodes in UML.
It's not against of UML specification.
From my experience combining deployment diagram and component diagram can be very descriptive for visualizing application architecture.


text:
Q: Distinguishing hats earned on current site If I look at any user profile on any site, there's no easy way to distinguish hats earned on the current site and hats earned elsewhere. It would be nice if there was a toggle button for that. This is especially inconvenient if you try to collect hats on multiple sites, as it becomes harder and harder to keep track of which hats you're still missing on each.
This has been requested last year, and the year before too.
So crossing fingers for next year :p
As @Abby pointed out in last year's answer,
on the leaderboard we can see the top 9 hats for a given site.
But that's really not the same,
especially considering the total number of available hats (38?).
I ended up tracking my progress on multiple sites using gists (on GitHub),
which is less than ideal.

A: I have written some JavaScript that only shows the hats of the site on which you are:
var hats = $(".wb-outer");
var currSite = document.title.split("-")[1].replace(/&/g, "&")
    .replace(/Stack Exchange/g, "")
    .trim();
for (var i = 0; i < hats.length; i++) {
    var curr = $("#" + hats[i].id);
    curr.click();
    var sitesHtml = $("#wb-hat-details-info").last("p").html();
    if (sitesHtml.indexOf(currSite) === -1) {
        curr.hide();
    }
}

What it does: it simulates a click on all hats, looks at the displayed sites where you earned the hat, and if you have not earned it on the current side, the hat gets hidden.
I have tried to put this in a userscript, but that didn't work because the Winterbash JavaScript didn't load when I tried that. You could save it in a bookmarklet and run that when you need it. Here is a one-liner that can be used for that purpose:
var h=$(".wb-outer");var c=document.title.split("-")[1].replace(/&/g,"&").replace(/Stack Exchange/g,"").trim();for(var i=0;i<h.length;i++){var n=$("#" +h[i].id);n.click();var t=$("#wb-hat-details-info").last("p").html();if(t.indexOf(c)===-1){n.hide();}}

And here is a version that highlights the hats earned on the current site, which Martin Büttner suggested:
var hats = $(".wb-outer");
var currSite = document.title.split("-")[1].replace(/&/g, "&")
    .replace(/Stack Exchange/g, "")
    .trim();
for (var i = 0; i < hats.length; i++) {
    var curr = $("#" + hats[i].id);
    curr.click();
    var sitesHtml = $("#wb-hat-details-info").last("p").html();
    if (sitesHtml.indexOf(currSite) !== -1) {
        curr.css('background-color', '#ace89b');
    }
}

One-liner:
var h=$(".wb-outer");var c=document.title.split("-")[1].replace(/&/g,"&").replace(/Stack Exchange/g,"").trim();for(var i=0;i<h.length;i++){var n=$("#" +h[i].id);n.click();var t=$("#wb-hat-details-info").last("p").html();if(t.indexOf(c)!==-1){n.css('background-color','#ace89b');}}


text:
Q: Error installing Net::LDAP on Oracle Enterprise Linux I am trying to install the Net::LDAP module on an OEL box using CPAN, but I get the following error:
[root ~]# cpan -i Net::LDAP

CPAN: Storable loaded ok

Going to read /root/.cpan/sources/authors/01mailrc.txt.gz
Could not pipe[  --decompress --stdout /root/.cpan/sources/authors/01mailrc.txt.gz |]: No such file or directory at /usr/lib/perl5/5.8.8/CPAN.pm line 5726.

Can someone please guide me on how to troubleshoot this?

A: CPAN needs to be configured before you can use it to install stuff.
There should be a whole bunch of stuff under
/root/.cpan

Generally cpan gets this stuff automatically, but for some reason it's
not there on your machine. In particular it needs this file.
/root/.cpan/sources/authors/01mailrc.txt.gz

If that file is there, then cpan man be missing the gzip binary needed to uncompress that file.


text:
Q: Cannot get vars displayed in my 'template' using Handlebars.js correctly I have a Handlebars script that I am trying to get to iterate through an object to my 'template' below. Even though I can see the 'badNodes' in the object (an object when i do a console.log(row) it doesn't ever pass to the template and all I see is a blank entry next to address in the view/template.
Can anyone suggest what I may have done wrong - P.S I am new to Handlebars.js

// latter part of ajax request
    .done(function (data, result, jqXHR) {
        var checkinData = JSON.parse(data).data;
        var rows = [];

        //_.templateSettings.variable = "badNode";
        var source = $("script.template").html();
        var template = Handlebars.compile(source);

        $.each(checkinData, function (index, row) {
                row.badNodesHTML = "";
                var AB_action_login = ' App';
                if (row.postid == null) {
                    var AB_action_order = ' Order';
                } else {
                    var AB_action_order = ' Order';
                }
                row.AB_login = AB_action_login;
                row.AB_order = AB_action_order;
                row.AB_actions = AB_action_login + AB_action_order;

                if (row.badNodes.length) {
                    $.each(row.badNodes, function (idx, badNode) {
                        badNode.address.toString()
                        badNode.address = /:(.+)/.exec(badNode.address)[1];
                        row.badNodesHTML += template(badNode);
                        row.AB_actions;
                    });
                }
            }
        );

A: You are accessing the object via #row inside your template even though the object you pass into the template looks like this:
{
    hash: 'some hash',
    address: 'some address'
}

So, in order to bind it try to access it by key instead like this:

Also, assuming that badNodes is an array of bad nodes, you could use each in your declaration when you pass row to the template directly. Try this:

I suggest you prepare a javascript object that has the exact shape and form you would like and then pass it to the template. You are formatting the output in an $.each loop and pass each row individually which could get messy from an organizational perspective. Also, you are creating html inside your javascript for the button which you could put in the template as well. Then, all you have to do is pass one row object to the template that has all required information.
A refactored version could look like this:

Note, I put the button templates in an arbitrary spot. I'm sure you would want to re-organize where they belong. This is for demonstration only.


text:
Q: MVVM model binding beginner I am new to MVVM and WPF and I am a little bit confused.
Let's say I have 2 models, like this:
public class Category
{
    public int Id { get; set; }
    public string Name { get; set; }
}

and
public class Product
{
    public int Id { get; set; }
    public Category Category { get; set; }
    public string Name { get; set; }
    public decimal Price { get; set; }
}

I am not sure what is the recommended way of implementing the ProducViewModel class for adding a new Product:
Is it OK to just use a public property of type Product and bind it to the view, like this:
public class ProductViewModel : Screen
{
    private Product _product;
    public BindableCollection<Category> Categories;

    public ProductViewModel(Product product, BindableCollection<Category> categories)
    {
        _product = product;
        Categories = categories;
    }

    public Product Product
    {
        get { return _product }
        set
        {
            _product = value;
            SetAndNotify(ref _product, value);
        }
    }
}

In this case I will use the Category collection in the form to choose a category.
My view should look something like this:
<StackPanel Orientation="Vertical">
    <StackPanel Orientation="Horizontal">
        <Label Content="Catgory" />
        <ComboBox
            ItemsSource="{Binding Categories}"
            DisplayMemberPath="Name"
            SelectedValue="?????? What comes here? "/>
    </StackPanel>
</StackPanel>

Is this correct?
And also, how I will bind Product.Category in a ComboBox in the view?
Thanks!

A: In your View Model you should expose properties that are needed in your view. This case you can bind directly to your Product.Category or create a new property in your view model, and i think this last option is well suited in a MVVM scenario.
In your case you should create a selected category property your ProductViewModel:
public Category SelectedCategory { get { return _selectedCategory; }
    set
    {
        _selectedCategory = value;
        SetAndNotify(ref _selectedCategory, value);
        Product.Category = _selectedCategory;
    } }

And then in your xaml, you bind combobox's selected value to this new property:
<StackPanel Orientation="Vertical">
<StackPanel Orientation="Horizontal">
    <Label Content="Catgory" />
    <ComboBox
        ItemsSource="{Binding Categories}"
        DisplayMemberPath="Name"
        SelectedValue="{Binding SelectedCategory}"/>
</StackPanel>


text:
Q: SQUISH issue to recognize "&" in GUI object names I use SQUISH to perform automated tests (written in python) on a GUI application (based Linux SUSE 15) with Qt version 5.9.4.
This application contains objects with properties (example name of a menu) containing the character "&".
My test script crashes everytime an object containing the character "&" (in its properties) is called in the script.
The error is :
"LookupError: Object 'Hardwired links from RCSL to turbine I&C' not found
For debugging, I erase this character from the the application design ==> No more issues were observed, the test scripts passed.
But, it is not a sustainble solution, I need the "&" character in my application.
Do you guys have any information about SQUISH having problem with managing certain characters as "&" ?

A: The error message may indicate a special case: Using the plain text of an object to look up the same.
Please do not use this undocumented (and generally unsupported) approach.
Instead, please record an interaction with the respective object, and then make use of the object name that Squish automatically generated for it.
Or pick the object and copy the object name.


text:
Q: Multiplying every Nth element in a list by M I have a problem I can't seem to figure out.  I am very new to Python and have only been coding for three weeks.  Any help is appreciated.
Problem:
We are passing in 3 inputs:

*

*a list of numbers

*a multiplier value, M

*a value, N

You should multiply every Nth element (do not multiply the 0th element) by M. So if N is 3, you start with the 3rd element, which is index 2.
If there are less than N elements then you should output the unchanged input list.

I can't seem to figure this out.  I have tried many different things here. Currently, I have the following, which is not working at all.
Provided:
import sys
M= int(sys.argv[2])
N= int(sys.argv[3])

numbers= sys.argv[1].split(',')
for i in range(0, len(numbers)):
  numbers[i]= int(numbers[i])

My Code:
for N in numbers:
    if numbers[i] > 0:
    total = N * M
    print(total)
else:
    print(numbers)

Output:
I am not even close to what the output should be. Feeling lost on this. Here is what my code comes to. It looks like they want the output in a list.
Program Failed for Input: 1,2,3,4,5,6 5 3
Expected Output: [1, 2, 15, 4, 5, 30]
Your Program Output:
5
10
15
20
25
30

A: You could try a list comprehension with slicing.
numbers[N-1::N] = [x * M for x in numbers[N-1::N]]

A: A more elegant solution using list comprehensions ;)
[item*M if (index and not (index+1)%N) else item for index, item in enumerate(items)]

A: This solution is based on your original one. A more pythonic one would use for instance, a list comprehension so keep that in mind in the future,
output = [numbers[0]]
if len(numbers) >= N:
    for i in range(1,len(numbers)):
        if ((i+1)%N) is 0:
            output.append(numbers[i]*M)
        else:
            output.append(numbers[i]);
else:
    output = numbers

If N is not larger than the list size, the program constructs a new list of numbers with each Nth number being multiplied by M. This is done with a simple modulo operator. Indexing in Python starts with zero and i iterates through index values but your desired output counts the elements as if starting from 1 - thus i+1 in the modulo. If it is not every Nth - program just append the old value. If the list is shorter than N altogether, it assigns the whole unchanged list to the output list.

A: will this work for you?
res = []
for num in numbers:
    if num > 0:
        total = num * M
        res.append(total)

if len(res) != len(numbers):
    print (numbers)
else:
    res.reverse()
    print (res)

A: So after many attempts and bouncing this off of a friend who works as a programmer, I ended up with this that gave me the proper output:
newlist = []

if len(numbers) < N:
  newlist = numbers
else:
  for i in range(0, len(numbers)):
    num = numbers[i]
    if (i+1) % N == 0:
      newlist.append(num*M)
    else:
      newlist.append(num)
      i+=1

print(newlist)

A: # Input
import sys
M= int(sys.argv[2])
N= int(sys.argv[3])

# convert strings to integers
numbers= sys.argv[1].split(',')
for i in range(0, len(numbers)):
  numbers[i]= int(numbers[i])

# if the length of our list is greater than our supplied value
# loop to multiply(starting at the 3rd position in the list) by M
if len(numbers) > N :
  for num in range(2, len(numbers), 3) :
    numbers[num] = numbers[num] * M
print(numbers)


text:
Q: Modifying HashMap in Rust (mutable borrow occurs here) I have a variable called address_mapping that is part of a public struct. I've put all of the code in the same function, and I'm running into some issues with referencing.
match self.address_mapping.get(&tx_outpoint) {
    Some(address_info) => {
        balances.push(address_info.clone().current_balance as f64);
        address_info_vec.push(address_info);
        tx_outpoint_vec.push(tx_outpoint);
    }
};
...
self.address_mapping.remove(&tx_outpoint);

match self.address_mapping.get(&tx_outpoint) {
      |                               -------------------- immutable borrow occurs here
self.address_mapping.remove(&tx_outpoint);
      |                 ^^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here

It happens again in another section of the code, even if I use {} to set the scope. I also tried using the drop method on _borrow. Also, I think it's a bad idea to use the clone method because this data structure can get quite big.
{
     let _borrow = &mut self.address_mapping;
     for (tx_outpoint, address_info) in _borrow {
         txoutpoint_to_delete.push(tx_outpoint);
     }
}
...
for tx_outpoint in &txoutpoint_to_delete { self.address_mapping.remove(tx_outpoint); }


text:
Q: Is there a more succinct way to use an enum especially when it only has primitive types? I'm using an enum for polymorphism in Rust. I need to have a vector that can have integers or floating point values in it:
enum Value {
    Float(f32),
    Int(i32),
}

let vec = Vec::<Value>::new();
vec.push(Value::Int(0));
vec.push(Value::Float(1.0));

Is there a more succinct way to do this, particularly when you're only using primitive types?

A: No, there is not.
There are tricks to reduce the amount of code:

*

*There's no need to specify the type of the vector.

*You could construct the vector all at once.

*You could import the enum variants.

fn main() {
    use Value::*;
    let vec = vec![Int(0), Float(1.0)];
}

it mostly feels strange that I'm effectively just renaming the primitive types

That's just an artifact of your program. For example, there's no real difference to the computer between your enum and this one:
enum MagicSpell {
    Multiplier(f32),
    NumberOfStomachs(i32),
}

However, the semantics (a.k.a. the names) are highly different.


text:
Q: Usage of definite article with "last episode" I have a question about the usage of the definite article with the phrase "last episode". Compare the following examples:

*

*In last episode, John met with Karen.

*In the last episode, John met with Karen.
Am I correct in assuming that the first sentence speaks about the previous episode while the second about the final one? Or is the first sentence incorrect at all and the definite article is necessary in both cases?
Furthermore, can you use this phrase without the definite article in the same way you would use last time/last week etc.? Example:

*

*Last episode, John met with Karen.
Thank you kindly for your help.

A: You can use the phrase "last episode" the same way you'd use "last year," or "yesterday" that is, as an adverb, which means in the most recent prior episode:
Yesterday/Last year, he went to the park -> Last episode, he went to the park
I think he was sick yesterday/last year -> I think he was sick last episode
On yesterday/In last year, he went to the park -> In last episode, he went to the park
I think he was sick on yesterday/in last year -> I think he was sick in last episode
Or, you can use "the last episode" as you would a standard superlative adjective, meaning either the most recent prior episode or the final episode - the ambiguity comes from the word "last" which has both meanings (it has nothing to do with TV series). Superlatives always require the definite article. You cannot say "a last episode" for the same reason you cannot say, "I am a best student."
Beyond that, the standard rules for articles with nouns and noun phrases apply. Hopefully these rules are clear to you. Here are some examples, in case they're not:
Best episode is the one where Kramer gets a hot tub -> The best episode is the one where Kramer gets a hot tub.
During long episode, I have to take a break -> During a long episode, I have to take a break.
In last episode, John met with Karen. -> In the last episode, John met with Karen.


text:
Q: PCRE - можно ли в один карман положить значения разных кусков строки? К примеру есть строка

    Дата прибытия: <input type="text" value="14.11.2016" />

    Склад получения: <input type="text" value="Москва, ул. Тратата, 37" />

Можно ли как-то в один карман с помощью preg_math() положить такой текст Дата прибытия: 14.11.2016?
Еще пока не весь PCRE изучил.

A: Нет. Это невозможно.
Сохраняющая группировка (карман) содержит внутри себя непрерывную последовательность из текста, к которому было применено регулярное выражение.
Делайте несколько группировок (карманов) и объединяйте их средствами PHP для достижения необходимого результата.


text:
Q: How can I make a ruby enumerator that does lazy iteration through two other enumerators? Let's say I have two enumerators, enum1 and enum2 that must be lazily iterated through (because they have side effects). How do I construct a third enumerator enum3 where enum3.each{|x| x} would lazily return the equivalent of enum1 + enum2?
In my real world use case, I'm streaming in two files, and need to stream out the concatenation.

A: This seems to work just how I want;
enums.lazy.flat_map{|enum| enum.lazy }

Here's the demonstration. Define these yielding methods with side-effects;
def test_enum
  return enum_for __method__ unless block_given?
  puts 'hi'
  yield 1
  puts 'hi again'
  yield 2
end

def test_enum2
  return enum_for __method__ unless block_given?
  puts :a
  yield :a
  puts :b
  yield :b
end

concated_enum = [test_enum, test_enum2].lazy.flat_map{|en| en.lazy }

Then call next on the result, showing that the side effects happen lazily;
[5] pry(main)> concated_enum.next
hi
=> 1
[6] pry(main)> concated_enum.next
hi again
=> 2

A: Here's some code I wrote for fun awhile back with lazy enumeration thrown in:
def cat(*args)
  args = args.to_enum

  Enumerator.new do |yielder|
    enum = args.next.lazy

    loop do
      begin
        yielder << enum.next
      rescue StopIteration
        enum = args.next.lazy
      end
    end
  end
end

You would use it like this:
enum1 = [1,2,3]
enum2 = [4,5,6]
enum3 = cat(enum1, enum2)

enum3.each do |n|
  puts n
end
# => 1
#    2
#    3
#    4
#    5
#    6

...or just:
cat([1,2,3],[4,5,6]).each {|n| puts n }

A: Since Ruby 2.6 you can use Enumerable#chain/Enumerator::Chain:
a = [1, 2, 3].lazy
b = [4, 5, 6].lazy

a.chain(b).to_a
# => [1, 2, 3, 4, 5, 6]

Enumerator::Chain.new(a, b).to_a
# => [1, 2, 3, 4, 5, 6]


text:
Q: Simple reports in rails -- from_date to to_date So basically, I want to create reports for my Attendance Records Table.
Table has :user_id, :clock_in, :clock_out, :seconds columns that are being updated.
Basically my report needs: to calculate (sum of :seconds) for a given period.
I.e. Jan 1, 2014 to Jan 31, 2014 ... I would like to list all records from this daterange, and in the end would calculate sum of :seconds.
Any ideas how would I approach this?

A: Your question is very general, please, before question try to do some work and come with technical questions.
Tips

*

*Your question is related about SQL, basically you need to perform a select query
select * from your_table where date <= your_date and date >= your_date

Need help on mysql date range query

*In rails, where clauses are build by ActiveRecord
YourModel.where('date <= ? and date >= ?', your_date. your_date)

Rails where date is greater than given date query

*If you need something more advanced, use Ransack
http://railscasts.com/episodes/370-ransack

Hope I can help you ;)


text:
Q: Getting a TypeError #1123: Filter operator not supported on type, MainTimeline/enterFrameHandler () I'm trying to take an older tutorial for a star field from AS2 and port it over to AS3. I am no longer getting any compiler errors, but I am getting a TypeError.
Here is the code:
this.addEventListener(Event.ENTER_FRAME, enterFrameHandler);

import flash.display.MovieClip;
import flash.events.Event;

var stars = 100;
var maxSpeed = 16;
var minSpeed = 2;

for( var i = 0; i<stars; i++)
{
    var mc:MovieClip = new MovieClip();
    addChild(mc);
    mc.name = "star","star"+i,i;
    mc.x = Math.random() * stage.stageWidth;
    mc.y = Math.random() * stage.stageHeight;
    mc.speed = Math.random() * (maxSpeed-minSpeed)+minSpeed
    var size = Math.random() * 2+(0.6*(Math.random() * 4));
    mc.width = size;
    mc.height = size;
}

function enterFrameHandler(event:Event):void
{
    var target:MovieClip = MovieClip(event.target);
    for (var j = 0; j<stars;j++)
    {
        var mc = this.("star"+j);
        if (mc.y>0)
        {
            mc.y -= mc.speed;
        }
        else
        {
            mc.y = stage.stageHeight;
            mc.speed = Math.random() * (maxSpeed-minSpeed)+minSpeed;
            mc.x = Math.random() * stage.stageWidth;

        }
    }
};

The TypeError I am getting is this:

TypeError: Error #1123: Filter operator not supported on type
  SpaceBoost_loadscreen_star_fla.MainTimeline.  at
  SpaceBoost_loadscreen_star_fla::MainTimeline/enterFrameHandler()

I am very new to coding in Actionscript, and am just learning as I go.
Also, any helpful suggestions on how to clean it up are also welcome!

A: Two issues I see after a quick glance:
Issue 1:
In your first for loop, this line: mc.name = "star","star"+i,i;
The name for each item will end up being the same ("star"), because after the comma it's just going to be a string literal command (assuming this isn't throwing an error as well).
Correct by changing this to:
mc.name = "star" + i;

Issue 2:
What is throwing the current error,   var mc = this.("star"+j);
In AS3, object.(expression) is E4X filtering.   To access an object via instance name, do the following instead:
var mc = getChildByName("star" + j);

I'm pretty rusty on this, so let me know if doesn't solve your issue.


text:
Q: Android: which parts in the XML files cause an InflateException on long click of the view Here's the screen of what I am struggling with.

The white box in the centre of the screen are two EditTexts. There is no problem when simply clicking the EditText, but If I long-click them, the app quits with an error, leaving the following exception in the log.
android.view.InflateException: Binary XML file line #17: Error inflating class <unknown>
                                                       at android.view.LayoutInflater.createView(LayoutInflater.java:626)
                                                       at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
                                                       at android.view.LayoutInflater.onCreateView(LayoutInflater.java:675)
                                                       at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:700)
                                                       at android.view.LayoutInflater.inflate(LayoutInflater.java:470)
                                                       at android.view.LayoutInflater.inflate(LayoutInflater.java:398)
                                                       at android.view.LayoutInflater.inflate(LayoutInflater.java:354)
                                                       at android.widget.Editor$ActionPopupWindow.initContentView(Editor.java:3474)
                                                       at android.widget.Editor$PinnedPopupWindow.<init>(Editor.java:2654)
                                                       at android.widget.Editor$ActionPopupWindow.<init>(Editor.java:3398)
                                                       at android.widget.Editor$ActionPopupWindow.<init>(Editor.java:3398)
                                                       at android.widget.Editor$HandleView.showActionPopupWindow(Editor.java:4466)
                                                       at android.widget.Editor$InsertionHandleView.showWithActionPopup(Editor.java:4896)
                                                       at android.widget.Editor$InsertionPointCursorController.showWithActionPopup(Editor.java:5361)
                                                       at android.widget.Editor.performLongClick(Editor.java:1001)
                                                       at android.widget.TextView.performLongClick(TextView.java:10113)
                                                       at android.view.View$CheckForLongPress.run(View.java:19242)
                                                       at android.os.Handler.handleCallback(Handler.java:733)
                                                       at android.os.Handler.dispatchMessage(Handler.java:95)
                                                       at android.os.Looper.loop(Looper.java:146)
                                                       at android.app.ActivityThread.main(ActivityThread.java:5602)
                                                       at java.lang.reflect.Method.invokeNative(Native Method)
                                                       at java.lang.reflect.Method.invoke(Method.java:515)
                                                       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
                                                       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
                                                       at dalvik.system.NativeStart.main(Native Method)
                                                    Caused by: java.lang.reflect.InvocationTargetException
                                                       at java.lang.reflect.Constructor.constructNative(Native Method)
                                                       at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
                                                       at android.view.LayoutInflater.createView(LayoutInflater.java:600)
                                                       at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
                                                       at android.view.LayoutInflater.onCreateView(LayoutInflater.java:675)
                                                       at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:700)
                                                       at android.view.LayoutInflater.inflate(LayoutInflater.java:470)
                                                       at android.view.LayoutInflater.inflate(LayoutInflater.java:398)
                                                       at android.view.LayoutInflater.inflate(LayoutInflater.java:354)
                                                       at android.widget.Editor$ActionPopupWindow.initContentView(Editor.java:3474)
                                                       at android.widget.Editor$PinnedPopupWindow.<init>(Editor.java:2654)
                                                       at android.widget.Editor$ActionPopupWindow.<init>(Editor.java:3398)
                                                       at android.widget.Editor$ActionPopupWindow.<init>(Editor.java:3398)
                                                       at android.widget.Editor$HandleView.showActionPopupWindow(Editor.java:4466)
                                                       at android.widget.Editor$InsertionHandleView.showWithActionPopup(Editor.java:4896)
                                                       at android.widget.Editor$InsertionPointCursorController.showWithActionPopup(Editor.java:5361)
                                                       at android.widget.Editor.performLongClick(Editor.java:1001)
                                                       at android.widget.TextView.performLongClick(TextView.java:10113)
                                                       at android.view.View$CheckForLongPress.run(View.java:19242)
                                                       at android.os.Handler.handleCallback(Handler.java:733)
                                                       at android.os.Handler.dispatchMessage(Handler.java:95)
                                                       at android.os.Looper.loop(Looper.java:146)
                                                       at android.app.ActivityThread.main(ActivityThread.java:5602)
                                                       at java.lang.reflect.Method.invokeNative(Native Method)
                                                       at java.lang.reflect.Method.invoke(Method.java:515)
                                                       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
                                                       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
                                                       at dalvik.system.NativeStart.main(Native Method)
                                                    Caused by: java.lang.ArrayIndexOutOfBoundsException: length=15; index=659
                                                       at android.content.res.StringBlock.get(StringBlock.java:65)
                                                       at android.content.res.XmlBlock$Parser.getPooledString(XmlBlock.java:459)
                                                       at android.content.res.TypedArray.loadStringValueAt(TypedArray.java:721)
                                                       at android.content.res.TypedArray.getString(TypedArray.java:125)
                                                       at android.widget.TextView.<init>(TextView.java:1509)
                                                       at android.widget.TextView.<init>(TextView.java:908)
                                                       at java.lang.reflect.Constructor.constructNative(Native Method)
                                                       at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
                                                       at android.view.LayoutInflater.createView(LayoutInflater.java:600)
                                                       at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
                                                       at android.view.LayoutInflater.onCreateView(LayoutInflater.java:675)
                                                       at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:700)
                                                       at android.view.LayoutInflater.inflate(LayoutInflater.java:470)
                                                       at android.view.LayoutInflater.inflate(LayoutInflater.java:398)
                                                       at android.view.LayoutInflater.inflate(LayoutInflater.java:354)
                                                       at android.widget.Editor$ActionPopupWindow.initContentView(Editor.java:3474)
                                                       at android.widget.Editor$PinnedPopupWindow.<init>(Editor.java:2654)
                                                       at android.widget.Editor$ActionPopupWindow.<init>(Editor.java:3398)
                                                       at android.widget.Editor$ActionPopupWindow.<init>(Editor.java:3398)
                                                       at android.widget.Editor$HandleView.showActionPopupWindow(Editor.java:4466)
                                                       at android.widget.Editor$InsertionHandleView.showWithActionPopup(Editor.java:4896)
                                                       at android.widget.Editor$InsertionPointCursorController.showWithActionPopup(Editor.java:5361)
                                                       at android.widget.Editor.performLongClick(Editor.java:1001)
                                                       at android.widget.TextView.performLongClick(TextView.java:10113)
                                                       at android.view.View$CheckForLongPress.run(View.java:19242)
                                                       at android.os.Handler.handleCallback(Handler.java:733)
                                                       at android.os.Handler.dispatchMessage(Handler.java:95)
                                                       at android.os.Looper.loop(Looper.java:146)
                                                       at android.app.ActivityThread.main(ActivityThread.java:5602)
                                                       at java.lang.reflect.Method.invokeNative(Native Method)
                                                       at java.lang.reflect.Method.invoke(Method.java:515)
                                                       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
                                                       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
                                                       at dalvik.system.NativeStart.main(Native Method)

I think this is due to some misled attributes on the XML files used in this activity.
Here is the layout that contains two EditTexts.
<RelativeLayout
    android:id="@+id/rlLoginBox"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerVertical="true"
    android:layout_centerHorizontal="true"
    android:visibility="invisible">

    <EditText
        android:id="@+id/etEmail"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:padding="15dp"
        android:background="@drawable/login_box_top"/>

    <EditText
        android:id="@+id/etPassword"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/etEmail"
        android:padding="15dp"
        android:background="@drawable/login_box_bottom"/>

</RelativeLayout>

As you can see, each EditText is referring to its respective drawable files, called login_box_top.xml and login_box_bottom.xml.
The login_box_top.xml file is as follows.
<?xml version="1.0" encoding="utf-8"?>
<inset android:insetBottom="-2px" xmlns:android="http://schemas.android.com/apk/res/android">
    <selector>
        <item android:state_pressed="true">
            <shape android:shape="rectangle">
                <corners  android:topLeftRadius="4dip"
                    android:topRightRadius="4dip"
                    android:bottomLeftRadius="0dip"
                    android:bottomRightRadius="0dip" />
                <stroke android:width="2px" android:color="#E6E6E6" />
            </shape>
        </item>
        <item>
            <shape android:shape="rectangle">
                <corners  android:topLeftRadius="4dip"
                    android:topRightRadius="4dip"
                    android:bottomLeftRadius="0dip"
                    android:bottomRightRadius="0dip" />
                <solid android:color="#FFFFFFFF" />
                <stroke android:width="2px" android:color="#E6E6E6" />
            </shape>
        </item>
    </selector>
</inset>

And here is the login_box_bottom.xml file.
<?xml version="1.0" encoding="utf-8"?>
<inset android:insetTop="-1px" xmlns:android="http://schemas.android.com/apk/res/android">
    <selector>
        <item android:state_pressed="true">
            <shape android:shape="rectangle">
                <corners
                    android:bottomLeftRadius="4dip"
                    android:bottomRightRadius="4dip"
                    android:topLeftRadius="0dip"
                    android:topRightRadius="0dip"  />
                <stroke android:width="2px" android:color="#E6E6E6" />
            </shape>
        </item>
        <item>
            <shape android:shape="rectangle">
                <corners
                    android:bottomLeftRadius="4dip"
                    android:bottomRightRadius="4dip"
                    android:topLeftRadius="0dip"
                    android:topRightRadius="0dip" />
                <solid android:color="#FFFFFFFF" />
                <stroke android:width="2px" android:color="#E6E6E6" />
            </shape>
        </item>
    </selector>
</inset>

A: This was a very simple issue. I could prevent the exception simply by adding the attribute android:longClickable="false" to each EditText.


text:
Q: Edit a .liquid file from shopify in eclipse with correct code styling I am building a store using shopify.
I'd like to edit the template files offline in eclipse, but they are .liquid files, which eclipse doesn't recognize.
How do I make a custom content type for the liquid template files that eclipse will recognize?

There are two types of markup in liquid: Output and Tag.
Output is surrounded by:
{{ two curly brackets }}

Tags are surrounded by:
{% a curly bracket and a percent %}

A: This question might already have your answer:
Eclipse plug-in: Create a new file extension for a language not supported by Eclipse

If you aren't opposed to using a different editor, there is a Liquid mode for TextMate, which I think may also work on Sublime Text (if you aren't using a mac).  Then of course there's surely got to be an emacs or vim plugin.


text:
Q: storage location of server objects in SQL Server Subquestioning [1] and [2].
Where does SQL Server store server objects?
And why there?
Update:
This question is defined as subquestion and in context of cited questions...
Should I understand the answer that sql_policy_trigger, shown under Server Objects\Triggers in Object Explorer of SSMS (MS SQL Server R2), is stored in master database?

=====Update2:
Please give me the references to msdn docs in your answer(s).
It is not obvious that system or server configuration objects, meta-information or catalogs are stored in database(s). For ex., FTS catalog is not stored in database but in file (system), etc.
[3] (BOL2005-2008R2) tells that:

*

*"master Database
Records all the system-level information for an instance of SQL Server"

*

*"In SQL Server, system objects are no longer stored in the master database; instead, they are stored in the Resource database"

So, it is  instance-wide (but not server-wide) and it clearly mentions "system".
As well as it hints that "they" are not stored in master database.
Also, I would like to understand why SSMS permits to script server objects (for ex., right-click in Object Explorer under Server Objects --> Triggers on  syspolicy_server_trigger --> Script Server Trigger as...---> ) while, for ex., system views do not have such possibility.

Cited:
[1]
Where does a Server trigger save in SQL Server ?
Where does a Server trigger save in SQL Server?
[2]
"system objects" vs. "server objects" in SQL Server - terms definitions?
"system objects" vs. "server objects" in SQL Server - terms definitions?
[3]
master Database
[3a]
(SQL Server 2008 R2 Books Online)
http://msdn.microsoft.com/en-us/library/ms187837.aspx
[3b]
(SQL Server 2005 Books Online)
http://msdn.microsoft.com/en-us/library/ms187837(v=SQL.90).aspx

A: sys.objects, sys.indexes etc (as per your trigger question). See Object catalog views in MSDN
As for why, a relational database may as well use a relation structure to store information about itself, no? Apart from a few registry settings used on start up, almost every setting and object is stored in a table somewhere in SQL Server.
Examples:

*

*sys.messages = error messages

*sys.configurations = sp_configure

Edit, I had to dredge my memory about why this is so...
Rule zero in Codd's law

The system must qualify as
  relational, as a database, and as a
  management system. For a system to
  qualify as a relational database
  management system (RDBMS), that system
  must use its relational facilities
  (exclusively) to manage the database.

This ignores the "relational" puritans and zealots but explains why sys.objects etc are used.
Edit:
Making a guess at what OP really wants... server level objects are stored in the master database.


text:
Q: Limit of sequence of rationals in $A \subset \mathbb{R}$ Say $\{x_n\}$ is a sequence of rational numbers in $A \subset \mathbb{R}$. I think that I understand why this sequence will always converge (because $\mathbb{R}$ is an ordered set, so $\{x_n\}$ can be rearranged if necessary to obtain a monotonic sequence, which always converges).
But is it always true that $x = \lim_n\{x_n\} \in A$?
I'm looking at an example where $A = (0, 1]$, and $x \in A$, but I can't tell if it's because of the choice of $A$ or if it's a general result. I suspect that it's the latter, and that it may related to the denseness of $\mathbb{Q}$, but I can't formalize it. Any help is appreciated!

A: Unless $A$ contains only a single number, which would be rather pathological, the sequence $\{x_n\}$ does not have to converge. One could take two different numbers $a$ and $b$ and alternate between them to get an oscillating sequence $(a,b,a,b,a,\dots)$ which will not converge.

Neither does the additional requirement that $\{x_n\}$ is monotonic make it converge: Let $A=\Bbb N$, then the sequence $(1,2,3,4,5,\dots)$ does not converge. To be certain that the sequence converges, you need it to be monotonic and $A$ needs to be bounded. That is: bounded monotonic sequences do converge.

For a general $A\subset \Bbb R$ and sequence $\{x_n\}$ with terms in $A$, it does not have to hold that $x=\lim_n \{x_n\}\in A$. For example, we could take $A=(0,1]$ and let $x_n=\frac 1n$ for each $n$, then $\lim_n\{x_n\}=0$ and $0\notin A$. The property that every converging sequence with terms in $A$ converges to a limit in $A$ holds if and only if $A$ is a closed set.


text:
Q: How to expand a column and merge with another dataframe by these columns? I have the following two dataframes:
df1
col1  col2
A     5, 3, 4
B     5, 1
C     3, 4

df2
c1   c2
1    XXX
2    CCC
3    AAA
4    DDD
5    FFF

Script to create df1 and df2:
import pandas as pd

data1 = [['A', '5, 3, 4'], ['B', '5, 1'], ['C', '3, 4']]
df1 = pd.DataFrame(data1, columns = ['col1', 'col2'])

data2 = [['1', 'XXX'], ['2', 'CCC'], ['3', 'AAA'], ['4', 'DDD'], ['5', 'FFF']]
df2 = pd.DataFrame(data2, columns = ['c1', 'c2'])

I need to expand the col2 in df1 and merge the expanded columns with c2 of df2 by c1.
I know how to expand col2, but the challenge is that the number of expanded values is different for different rows. Therefore I don't know how to merge df_expanded with df2.
df_expanded = df1['col2'].str.split(', ', expand=True)

The expected result:
col1  col2_1    col2_2   col2_3   col2_1_title   col2_2_title   col2_3_title
A     5         3        4        FFF            AAA            DDD
B     5         1                 FFF            XXX
C     3         4                 AAA            DDD

How can I get such result?

A: Let us do it step by step
s = df1.col2.str.split(',').apply(pd.Series).add_prefix('col_')
t = s.astype(float).replace(df2.set_index(['c1'])['c2'])

out = df1.join(s).join(t.add_suffix('_title'))
Out[42]:
  col1     col2 col_0 col_1 col_2 col_0_title col_1_title col_2_title
0    A  5, 3, 4     5     3     4         FFF         AAA         DDD
1    B     5, 1     5     1   NaN         FFF         XXX         NaN
2    C     3, 4     3     4   NaN         AAA         DDD         NaN

A: Here is one approach using the stacked data for a merge and a reshape to a MultiIndex. Note that it has a slightly different output:
df3 = (df1['col2']
 .str.split(', ', expand=True)
 .stack()
#.astype(int) # only if df2 has integers in c1
 .to_frame('col2')
 .merge(df2.set_index('c1').rename(columns={'c2': 'col2_title'}),
        left_on='col2', right_index=True)
 .unstack(1)
)
df3.columns = df3.columns.map(lambda x: f'{x[0]}_{x[1]}')

df_expand = df1[['col1']].join(df3)

output:
  col1 col2_0 col2_1 col2_2 col2_title_0 col2_title_1 col2_title_2
0    A      5      3      4          FFF          AAA          DDD
1    B      5      1    NaN          FFF          XXX          NaN
2    C      3      4    NaN          AAA          DDD          NaN

A: I really wanted a prettier way to do this but I don't think this is any better than the other answers.
get = dict(zip(*map(df2.get, df2))).get
d = df1.col2.str.split(', ', expand=True).add_prefix('col2_')
df1[['col1']].join(d).join(d.applymap(get).add_suffix('_title'))

  col1 col2_0 col2_1 col2_2 col2_0_title col2_1_title col2_2_title
0    A      5      3      4          FFF          AAA          DDD
1    B      5      1   None          FFF          XXX         None
2    C      3      4   None          AAA          DDD         None

Maybe this isn't exactly what OP wanted, output wise, but this seems better is some subjective way.
s = df1.set_index('col1').col2
m = df2.set_index('c1').c2
pd.concat({
    'number': s, 'title': s.replace(m, regex=True)
}).str.split(', ', expand=True).unstack(0)

          0            1            2
     number title number title number title
col1
A         5   FFF      3   AAA      4   DDD
B         5   FFF      1   XXX   None  None
C         3   AAA      4   DDD   None  None

A: trying using the numbers to create the new columns.  I wish python allow for dynamic column creation based on a condition, but it doesn't.
data1 = [['A', '5, 3, 4'], ['B', '5, 1'], ['C', '3, 4']]
df1 = pd.DataFrame(data1, columns = ['col1', 'col2'])

data2 = [['1', 'XXX'], ['2', 'CCC'], ['3', 'AAA'], ['4', 'DDD'], ['5', 'FFF']]
df2 = pd.DataFrame(data2, columns = ['c1', 'c2'])

print(df1)
print(df2)

for key,item in df1.iterrows():
    for value in item['col2'].split(','):
        df1[value.strip()]=''

for key,item in df1.iterrows():
    for value in item['col2'].split(','):
        buffer=df2.where(df2.c1==value.strip(),axis=0).dropna()
        df1.loc[key,value.strip()]=buffer['c2'].values[0]

print(df1)

output:
  col1     col2    5    3    4    1
0    A  5, 3, 4  FFF  AAA  DDD
1    B     5, 1  FFF            XXX
2    C     3, 4       AAA  DDD


text:
Q: Center of finite dimensional division $\mathbb{R}$-algebra? Let $D$ be a finite dimensional division $\mathbb{R}$-algebra.

Why is it that $Z(D)=\mathbb{R}$ or $Z(D)=\mathbb{C}$?

I have seen an explanation: It is because $\mathbb{C}$ is the only non trivial algebraic extension of $\mathbb{R}$.
But I don't get how does that explain it?
Thanks. I may be missing something trivial.

A: Since $D$ is a division algebra, $Z(D)$ must be a field (it's easy to see that the inverse of a central element is also central).
Since $D$ is finite-dimensional over $\mathbb{R}$, $Z(D)$ is a finite field extension of $\mathbb{R}$ : it must be $\mathbb{R}$ or $\mathbb{C}$.


text:
Q: Copy Redshift Pipe Delimited enclosed by double Quotes I am trying to load a file from S3 to Redshift. The file is delimited by Pipe, but there are value that contains Pipe and other Special characters, but if value has Pipe, it is enclosed by double quotes.
Example:
Field1|Field2
"abc|dh"|123
efh@ih|233
I have tried using below command but i am getting error saying invalid digit. it is due to the copy command is considering pipe in the value as delimiter.
copy table
from 's3'
iam_role 'arn'
region 'us-east-1'
MAXERROR AS 10 NULL AS '(null)'
'ESCAPE "'
IGNOREHEADER AS 1
DELIMITER '|' timeformat 'auto' GZIP;

A: You are looking for the REMOVEQUOTES parameter. https://docs.aws.amazon.com/redshift/latest/dg/copy-parameters-data-conversion.html#copy-removequotes
ESCAPE requires your data to be prepared with the escape character embedded. For example if your escape character was \ then you would need to prepare the data so that the content was "abc\|dh".
Example:
DROP TABLE IF EXISTS public.quote_test;
CREATE TABLE IF NOT EXISTS public.quote_test (col_a VARCHAR(10), col_b VARCHAR(10));
SELECT * FROM quote_test;

echo '"a|b"|"c|d"' > ~/simple_quotes.txt
aws s3 cp ~/simple_quotes.txt s3://my-bucket/simple_quotes.txt

--Will fail
COPY quote_test FROM 's3://my-bucket/simple_quotes.txt'
CREDENTIALS 'aws_iam_role=arn:aws:iam::012345678901:role/redshift-cluster'
DELIMITER '|' REGION 'us-west-2';

--Succeeds with REMOVEQUOTES
COPY quote_test FROM 's3://benchmark-files/simple_quotes.txt'
CREDENTIALS 'aws_iam_role=arn:aws:iam::012345678901:role/redshift-cluster'
REMOVEQUOTES DELIMITER '|' REGION 'us-west-2';

SELECT * FROM quote_test;
--  col_a | col_b
-- -------+-------
--  a|b   | c|d


text:
Q: coding language customization I've always wondered this since I started to code: is there any way to customize deep portions of a language to your taste.
For example, I code mainly in Python would like to use the | or : characters to denote the boundary of a Set.  I use sets frequently and hate typing set(some_list) or explicitly set([a,b,b,c,d]).  I've been using s() by setting s = set, but this wouldn't work if I was working on code others would have to read.
Perhaps a "translator" text-editor add-on which would save 2 copies of your code, one with your own syntax and one with the standard syntax would be sufficient.  Is there such a thing? (especially for python)

A: Clarity and readability is a very important trait in production code.  Remember that far more effort is generally expended into reading existing code than is spent writing new code.  Maintenance is a serious consideration.
With that in mind, doing something like s = set and using s() instead of set() adds no functional benefit and is detrimental to readability while only offering the savings of a couple keystrokes.  I think you recognize that on some level, but part of you isn't willing to accept the additional keystrokes in the name of readability.
I urge you to consider something like a macro instead so you feel better about pressing only a single key while still producing the same code.  Something like a Logitech G15/G110/G19 keyboard even allows you to do this independent of the editor you're using so you don't need a software add-on.  A few mice would allow you to do something similar as well (oh how I love my Razer Naga).  Of course, a basic macro feature in software would work as well, but you're probably pressing a key combination to do it and just typing set( is probably faster anyway.

A: It is possible indeed to customise your language as you like. Some languages provide powerful metaprogramming features (unfortunately, Python is not one of them). Take a look at Lisp macros, or Nemerle, or Converge (the latter is the closest to Python). Some languages, like Katahdin, would even allow you to modify the very syntax easily.
But this sort of power should not be used for petty language modifications - it would hinder the readability and won't add any significant benefits. It's much better to use metaprogramming for implementing the embedded Domain Specific Languages, preferably with distinctive syntax, so it would be obvious for a reader when you're using the core language constructs and when it is a eDSL code.
Of course, if you're designing your own language from scratch or implementing an existing language, you can also use metaprogramming and syntax alteration tricks for the core language functionality as well, it is a much more flexible approach than having a huge, bloated core language from the very beginning.


text:
Q: Displaying a button under a string message Hello I am very new to android programming. I would like to get some help regarding displaying a button under a string message under an activity which has been newly activated. Hope someone can help me. Here is the code which I have for the class MyActivity which activates when the button app tutorial is pressed. The xml for my main activity is also there. Also the displaymessage activity class and xml is also there.
package com.example.sadi_ace.myfirstapp;

import android.content.Intent;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;

public class MyActivity extends ActionBarActivity {

    public final static String EXTRA_MESSAGE = "com.example.sadi_ace.myfirstapp.MESSAGE";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_my);

        }

    /** Called when the user clicks the Send button */
    public void TutorialText(View view) {
        Intent intent = new Intent(this, DisplayMessageActivity.class);
        String message = "This is the android tutorial, if you want to pass on the to the " +
                "functions please press SKIP!";
        intent.putExtra(EXTRA_MESSAGE, message);
        startActivity(intent);

    }

  //  @Override
//    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
  //      getMenuInflater().inflate(R.menu.menu_my, menu);
    //    return true;
  //  }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();

        //noinspection SimplifiableIfStatement
        if (id == R.id.action_settings) {
            return true;
        }

        return super.onOptionsItemSelected(item);
    }
}

XML for main activity
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:background="#800080"
    android:weightSum="1">

    <Button
        android:layout_width="150dp"
        android:layout_height="wrap_content"
        android:text="@string/button_tutorial"
        android:background="#FFFFFF"
        android:layout_centerVertical="true"
        android:layout_centerHorizontal="true"
        android:onClick="TutorialText"
         />
</RelativeLayout>

DisplayMessageActivity class code
package com.example.sadi_ace.myfirstapp;

import android.content.Intent;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Button;
import android.widget.TextView;

public class DisplayMessageActivity extends ActionBarActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Intent intent = getIntent();
        String message = intent.getStringExtra(MyActivity.EXTRA_MESSAGE);

        // Create the text view
        TextView textView = new TextView(this);

        textView.setText(message);

        // Set the text view as the activity layout
        setContentView(textView);
    }

    //  @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.menu_display_message, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();

        //noinspection SimplifiableIfStatement
        if (id == R.id.action_settings) {
            return true;
        }

        return super.onOptionsItemSelected(item);
    }
}

XML for DisplayMessageActivity class
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:background="#800080"
    android:weightSum="1">

</RelativeLayout>

A: Add button in your xml file activity_my like
   <Button
    android:id="@+id/btnskip"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"/>

After that use this button id in "onCreate " method and assign it to some button
  Button skip;
 @Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_my);
     skip=(Button)findViewById(R.id.btnskip);

  //add on click listener
    skip.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View arg0) {
            // TODO Auto-generated method stub
         Intent intent = new Intent(this, DisplayMessageActivity.class);
    String message = "This is the android tutorial, if you want to pass on the to the " +
            "functions please press SKIP!";
    intent.putExtra(EXTRA_MESSAGE, message);
    startActivity(intent);
    });
    }


text:
Q: Proving that $\lnot(A \cup B) = \lnot A \cap \lnot B$ I'm working on proving the case above thusly:
Note: I should point out that i'm using the $\lnot$ symbol in place of the complement bar that should go over the letters, as i can't seem to get that formatted on this site.

In the first case of $\lnot(A \cup B)$, we know that for every item $x, x \in \lnot (A \cup B)$, which is to say >$x \notin A \cup B$.
From this, we know that $x \notin A$ and $x \notin B$. By the definition of complements, we can conclude that $x\in \lnot A$ and $x \in \lnot B$. As such, $x \in \lnot A \cap \lnot B$, which proves that $\lnot (A \cup B) \subseteq \lnot A \cap \lnot B$.
In the second case of $\lnot A \cap \lnot B$, we know that for every item $x, x \in \lnot A \cap \lnot B$, which is to say that $x \notin  A \cap B$.
From this, we can conclude that $x \notin  A$ or $x \notin  B$. As such, its clear that $x \in \notin A$ or $x \in \lnot B$. Further, from the definition of a union, we can conclude that $x \in \lnot (A \cup B)$, which proves that $\lnot A \cap \lnot B \subseteq \lnot (A \cup B)$.
As such, we have proven that $\lnot (A \cup B) = \lnot A \cap \lnot B$  by proving that $\lnot (A \cup B) \subseteq \lnot A \cap \lnot B$ and that
$\lnot A \cap \lnot B \subseteq \lnot (A \cup B)$.

According to my instructor, the part where i say "in the second case" is where i start to go wrong, however i don't really see what i'm doing incorrectly even after having reviewed the textbook and searched around these forums.
help?

A: Your strategy is right. You want to prove that (i) any element of the left-hand set is an element of the right-hand set and (ii) any element of the right-hand set is an element of the left-hand set.
Task (i) was carried out successfully, though I would not call it the first case.
Task (ii) was (at least) not written out correctly. We do not know something about every item, but we do know that any element $x$ of $\lnot A \cap \lnot B$ is simultaneously an element of $\lnot A$ and $\lnot B$. You say "which is to say $x\not\in A\cap B$." The "which is to say" is wrong, at least if by "which is to say" you mean that the two assertions are equivalent.
Then you say that $x\not\in A$ or $x\notin B$. True, but not helpful. From this you cannot conclude that $x\in \lnot(A\cup B)$. For we can have the "or if $x\not\in A$ but $x\in B$.
The correct way to proceed is to say that since $x\in \lnot A \cap \lnot B$, we have $x\not\in A$ and $x\not\in B$. (The crucial difference is that in what you wrote, you used or.)  From this it follows that $x\not\in A\cup B$, and therefore $x$ is an element of the left-hand set.

A: $x \in \neg A \cap \neg B$ means that $x \notin A$ AND $x \notin B$, whereas you said OR. This implies that $x \notin A \cap B$ but is not equivalent to it.


text:
Q: Is there a way to use sharepoint as the back-end versioning and storage for my custom document management website? I want to build a custom document management web application that ties in with sharepoint for the actual document versioning and storage.  I'm hoping for something like a sharepoint widget that I can plug into my web application that would allow me to tie in with sharepoint and download documents, make edits to them, and upload them back to sharepoint, with sharepoint handling all of the versioning and storage.
Basically I'm looking for a sharepoint API.
If WSS is the answer to this, are there licensing issues that I need to consider?
Thanks.

A: The best way forward is probably to use SharePoint's web services as that way your application can run on a server that doesn't have SharePoint installed.
Regarding Licensing, as long as you are licensed for Windows Server then WSS is free. However, depending on what database you use you may need to make sure that your users are licensed for SQL Server. Have a look at these links:

*

*SharePoint Connections

*Technet

*Eggheadcafe

A: Wouldn't it be easier to do some development to customize SharePoint to your needs instead of just using it as a backend?

A: If it's SharePoint 2007 you're talking about, then on the server side you have the SharePoint API (Microsoft.SharePoint.dll) and on the client side, SP provides web services for manipulating lists, libraries, users and most other things you might need.
As Jeremy said, getting data to and from SharePoint through the Web Services, requires you to write CAML queries, but it's made easier by the help of tools such as this free CamlQueryBuilder
There's loads of documentation on both the API and the web services online.
If you're planning on using SharePoint 2010, all this will be quite easier, as more options are available for developers, e.g. API for the client side as well as the server side. Also new in 2010 is LINQ for SharePoint, which IMO really rocks!

A: Sharepoint is accessible with CAML Queries in that you can create, modify, and delete any object in Sharepoint with this.
You could create your own front end and just communicate to sharepoint.
As far as licensing, WSS comes with any Windows Server OS, so your client would just buy a license to the OS and be fine.


text:
Q: Widget header unique classes I have created the code below for one of my widget sections.
Currently I am able to manipulate the title bar with  (h3.home-widget-header) which is good. But obviously it will be for all widgets in that section. There is 1 or two widgets that I need to style the positioning of the title bar slightly different. My question is - is this possible and how would I go about writing a unique class so I can manipulate each widget in that section individually.
Thanks ahead of time!

*

*Mike

if ( function_exists('register_sidebar') ) {
register_sidebar(array(

    'name' => 'Homepage Widget Area',

    'before_widget' => '
',

    'after_widget' => '
',

    'before_title' => '
',

    'after_title' => '
',

));

}

A: please study the RELATED links here in the right sidebar.
http://codex.wordpress.org/Function_Reference/register_sidebar
refer to this line:
'before_widget' => '
',

%1$s outputs an id specific to the widget type; %2$s outputs a widget specific class including an unique number.


text:
Q: Android vs ASP.NET vs Bootstrap I have created a small site on ASP.NET some time ago.
I have used:
ASP.NET and Bootstrap.
The issue is that all worked fine for few mounths, but today i have noticed that if i request Full Website version in Google Chrome on Android the site doesn't adapt.
All works fine on WP, iOS and even Android 4.4 with Chrome 51.0.2704.81
But my phone shows site not adapted to the screen size. My phone is Android 6.0.1 and Chrome is 52.0.2743.98
On desktop if i resize the Google Chrome window, the site gets adapted.
I have read some articles on stackoverflow, my index.html contains this:
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">

Here how it should look and looks on all devices:

Here how it looks on my Android 6.0.1 and Chrome is 52.0.2743.98:


text:
Q: onClick handler not registering with ReactDOMServer.renderToString I am trying to copy this fiddle:
http://jsfiddle.net/jhudson8/135oo6f8/
(I also tried this example
http://codepen.io/adamaoc/pen/wBGGQv
and the same onClick handler problem exists)
and make the fiddle work for server side rendering, using ReactDOMServer.renderToString
I have this call:
   res.send(ReactDOMServer.renderToString((

                <link href={'/styles/style-accordion.css'} rel={'stylesheet'} type={'text/css'}></link>

            <Accordion selected='2'>
                <AccordionSection title='Section 1' id='1'>
                    Section 1 content
                </AccordionSection>
                <AccordionSection title='Section 2' id='2'>
                    Section 2 content
                </AccordionSection>
                <AccordionSection title='Section 3' id='3'>
                    Section 3 content
                </AccordionSection>
            </Accordion>

        )));

the Accordion element looks like so:
const React = require('react');

const fs = require('fs');
const path = require('path');

const Accordion = React.createClass({

    getInitialState: function () {
        // we should also listen for property changes and reset the state
        // but we aren't for this demo
        return {
            // initialize state with the selected section if provided
            selected: this.props.selected
        };
    },

    render: function () {

        // enhance the section contents so we can track clicks and show sections
        const children = React.Children.map(this.props.children, this.enhanceSection);

        return (

                {children}

        );
    },

    // return a cloned Section object with click tracking and 'active' awareness
    enhanceSection: function (child) {

        const selectedId = this.state.selected;
        const id = child.props.id;

        return React.cloneElement(child, {
            key: id,
            // private attributes/methods that the Section component works with
            _selected: id === selectedId,
            _onSelect: this.onSelect
        });
    },

    // when this section is selected, inform the parent Accordion component
    onSelect: function (id) {
        this.setState({selected: id});
    }
});

module.exports = Accordion;

and the AccordionSection component looks like so:
const React = require('react');

const AccordionSection = React.createClass({

    render: function () {

        const className = 'accordion-section' + (this.props._selected ? ' selected' : '');

        return (

                    {this.props.title}

                    {this.props.children}

        );
    },

    onSelect: function (e) {
        console.log('event:',e);
        // tell the parent Accordion component that this section was selected
        this.props._onSelect(this.props.id);
    }
});

module.exports = AccordionSection;

everything works, and the CSS is working, but the problem is that the onClick doesn't get registered. So clicking on the accordion elements does nothing. Does anyone know why the onClick handler might not get registered in this situation?

A: None of the hooks will register with ReactDOMServer.RenderToString. If you want to accomplish server side rendering + hooks on your react component, you could bundle it on the client (webpack, gulp, whatever), and then also use ReactDOMServer.RenderToString on the server.
Here's a blog post that helped me accomplish this:
https://www.terlici.com/2015/03/18/fast-react-loading-server-rendering.html

A: React DOM render to string only sends the initial HTML as a string without any JS.
You need a client side react router as well which will attach the required JS handlers to the HTML based on their react-id's. The JS needs to run on both sides.
Universal rendering boilerplate for quick start. https://github.com/erikras/react-redux-universal-hot-example
Another question which is similar to yours. React.js Serverside rendering and Event Handlers


text:
Q: ARM MMU page tables in TCM memory A (hopefully) simple question.
Can I create my MMU page tables in ARM tightly coupled memory, or is there a restriction that prevents me doing this.
I have 16k of data TCM that seems quite suitable for this task (the instruction TCM will contain my secure world code), but I'm getting abort exceptions when enabling the MMU.
When I compile my secure world code to target SRAM everything works as expected.  The problem is that on this SoC SRAM is available from an FPGA-like device that does not respect TrustZone at all.
Am I missing something here, or do I need to carve off a small piece of RAM for myself to get this all working?
I'm working on an ARM1176JZ-S.

A: So, many years later I found my answer in the ARM Architecture Reference Manual for ARMv6 while browsing around for something completely different!
In section B4.7.3, Page table translation in VMSAv6 (page B4-25), the answer is mentioned just after discussing whether L1 cache is used in the page table walk, and it says:
Hardware page table walks cannot cause reads from TCM.


text:
Q: SQL insert into using Union should add only distinct values So I have this temp table that has structure like:
col1    col2    col3    col3
intID1  intID2  intID3  bitAdd

I am doing a union of the values of this temp table with a select query and storing
it into the same temp table.The thing is col3 is not part of the union query I will
need it later on to update the table.
So I am doing like so:
Insert into  #temptable
(
intID1,
intID2,
intID3
)
select intID1,intID2,intID3
From
#temptable

UNION

select intID1,intID2,intID3
From
Table A

Issue is that I want only the rows that are not already existing in the temp table to be added.Doing it this way will add a duplicate of the already existing row(since union will return one row)How do I insert only those rows not existing in the current temp table in my union query?

A: Use MERGE:
MERGE INTO #temptable tmp
USING (select intID1,intID2,intID3 From Table A) t
ON (tmp.intID1 = t.intID1 and tmp.intID2 = t.intID2 and tmp.intID3 = t.intID3)
WHEN NOT MATCHED THEN
INSERT (intID1,intID2,intID3)
VALUES (t.intID1,t.intID2,t.intID3)

A: Nice and simple with EXCEPT
INSERT INTO  #temptable (intID1, intID2, intID3)
SELECT intID1,intID2,intID3 FROM TableA
EXCEPT
SELECT intID1,intID2,intID3 FROM #temptable

A: I see where you are coming from. In most programming languages #temptable would be a variable (a relation variable or relvar for short) to which you would assign a value (a relation value) thus:
#temptable := #temptable UNION A

In the relational model, this would achieve the desired result because a relation has no duplicate rows by definition.
However, SQL is not truly relational and does not support assignment. Instead, you are required to add rows to a table using SQL DML INSERT statements (which is not so bad: the users of a truly relational database language, if we had one, would no doubt demand a similar shorthand for relational assignment!) but you are also required to do the test for duplicates yourself.
The answers from Daniel Hilgarth and Joachim Isaksson both look good. It's good practice to have two good, logically sound candidate answers then look for criteria (usually performance under typical load) to eliminate one (but retaining it commented out for future re-testing!)