text:
Q: How do I remove the Exchange 2007 graphical part of the Over quota message? I am trying to remove the graphical representation of the users mailbox. I do not want the user to see how much space they have either in a number or Graphically in exchange 2007.
How do I customize the message to remove this.
Any help greatly appreciated.
Rob

A: The short, technical answer:
This cannot be done using the primary management tools that come bundled with Microsoft Exchange Server (or Microsoft Outlook, for that matter). The only way that I can think of doing this—and please note that I am very hesitant to suggest this at all—would be to intercept and modify communication between the client and server on the fly (either using a very intrusive proxy server of some kind or through some creative modification of the localization resource dll using the Resource Localization Tool from the Exchange Resource Kit).
That said, before reading any further, please ask yourself "why do I even want to do this, and what are the benefits and/or hindrances for my users, my organization, and me?"
... which leads me to...
The longer, zen mistress answer:
Users are people. People are lazy. If you think that your users will be any less diligent about archiving old email if they happen to know what their maximum quota is, you are deluding yourself. Moreover, users detest having a quota message thrown at them all of a sudden, especially when they didn't even know that they were subject to a quota in the first place. Then, having received the message, the user still has no idea how much they need to archive (because the quota is in megabytes, and mail users tend to think in terms of "number of messages"). So they eventually clean out enough to stop the warning message, and they are back in the position of not knowing when the warning will pop up next. This is just not at all user-friendly, and only serves to exacerbate helpdesk calls from users who are probably receiving the warning at a time when they are hard at work and don't have time at that moment to dedicate to administrative tasks. If the information is easily available (as it is now, the user is empowered by being able to see that they are nearing the need to do some housekeeping and can schedule a time that suits them.
In summary:
IMHO, the mere thought of taking this long-sought-after informational feature away from your users is a Very Bad Thing™, especially after Microsoft finally made the effort to add it to the software following more than a decade of hearing and seeing their users begging, pleading, kicking, and screaming for a way to see their quota usage.
Please do your users—and yourself—a favor by giving your users the freedom to choose how they want to work. Remember that the less you do to annoy your users, the less they will end up annoying you. Also, the more you empower them now in small ways, the less critical of you and the more willing to try to understand your decisions they will be in the future when you have a justifiable need to impose some kind of restriction on them.
...and one last thing:
Oh, and just in case it was the "pointy-haired boss" that told you to do this and you're just following orders, please sit them down, make them read this, and point out that a complete stranger on the Worldwide Interhighway Superweb took the time to write this answer—complete with a little attention to grammar, punctuation, spelling, formatting, and a sprinkling of tongue-in-cheek humor—so there must surely be some merit to what she is saying, right?  ;-)


text:
Q: Validations for QR code obtained I am able to scan and obtain a QR code using ZXING. Based on the QR code obtained, I would like to navigate to a website if it is a URL or add to the contacts if its a contact detail. Are there any functions available in ZXING to do validations on the scanned QR Code?

A: Most definitely. Within core/ look at ResultParser (see http://code.google.com/p/zxing/source/browse/trunk#trunk%2Fcore%2Fsrc%2Fcom%2Fgoogle%2Fzxing%2Fclient%2Fresult) This is where a raw result string is parsed into something structured. The Barcode Scanner source code in android/ has even more code that then ties in these results to platform actions.

A: Yes. https://market.android.com/details?id=com.google.zxing.client.androidtest&hl=de
Somewhat beta, but should help you.

Oh sorry, now I got it. Basically a QR-Code is just a String with some fancy stuff arround. If your App scans a QR-Code via xzing, you should only get the information without the fancy stuff. But if its an URL or a Contact or something else you have to decide yourself programatically, because you can store every kind of information inside a QR-Code.

redpajama_set_name: RedPajamaStackExchange


text:
Q: How can I avoid Eloquent query to be chained? I'm new to Laravel.
I wonder how I can avoid query to be chained.
$visitRecords = VisitRecord::whereDate('visited_at', '=', Carbon::today()->toDateString());

$knockBounce = $visitRecords->where("bounce_zone", "1")->get()->count();

$approachBounce = $visitRecords->where("bounce_zone", "2")->get()->count();

This is the code I wrote but this gives me the result I don't expect...
Result
select * from `visit_records` where date(`visited_at`) = '2017-05-12'

select * from `visit_records` where date(`visited_at`) = '2017-05-12' and `bounce_zone` = '1'

select * from `visit_records` where date(`visited_at`) = '2017-05-12' and `bounce_zone` = '1' and `bounce_zone` = '2'

I checked the query conducted and this is what I got.
What I expect...
select * from `visit_records` where date(`visited_at`) = '2017-05-12'

select * from `visit_records` where date(`visited_at`) = '2017-05-12' and `bounce_zone` = '1'

select * from `visit_records` where date(`visited_at`) = '2017-05-12' and `bounce_zone` = '2'

I want to conduct this query instead via Eloquent methods.

A: You've only instantiated a single QueryBuilder object.
You should create a second QueryBuilder object for the second query.
//Only create one carbon object
$date = Carbon::today()->toDateString()

$knockBounce = VisitRecord::whereDate('visited_at', '=', $date)->where("bounce_zone", "1")->count();

$approachBounce = VisitRecord::whereDate('visited_at', '=', $date)->where("bounce_zone", "2")->count();

Updated as per Matthew's comment, Laravel will execute a ->get() anyway for aggregate functions (count, min, max, avg) under the hood so it's not needed.

A: You need to have two different objects
you might try below code
$visitRecords = VisitRecord::whereDate('visited_at', '=', Carbon::today()->toDateString());

$visitRecords1 = clone $visitRecords;

$knockBounce = $visitRecords->where("bounce_zone", "1")->get()->count();

$approachBounce = $visitRecords1->where("bounce_zone", "2")->get()->count();

Here I have used clone to copy the $visitRecords object
Further reading about php clone

A: Edit to take only the needed bounce_zone
Alternatively, you can use collections :
$visitRecords = VisitRecord::whereDate('visited_at', '=', Carbon::today()->toDateString())->where("bounce_zone", "1")->orWhere("bounce_zone", "2")->get();

$knockBounce = $visitRecords->where("bounce_zone", "1")->count();

$approachBounce = $visitRecords->where("bounce_zone", "2")->count();

You run only one query and use all the power of Laravel :)


text:
Q: what's the difference between rdd from PythonRDD and ParallelCollectionRDD I am learning how to program with Spark in Python and struggle with one problem.
The problem is that I have a PythonRDD loaded as id and description:
pythonRDD.take(1)
## [('b000jz4hqo', ['clickart', '950', '000', 'premier', 'image', 'pack', 'dvd', 'rom', 'broderbund'])]

And ParallelCollectionRDD loaded as id and description:
paraRDD.take(1)
## [('b000jz4hqo', ['clickart', '950', '000', 'premier', 'image', 'pack', 'dvd', 'rom', 'broderbund'])]

I can do a count on the paraRDD like this:
paraRDD.map(lambda l: (l[0],len(l[1]))).reduce(lambda a,b: a[1] + b[1])

or simply
paraRDD.reduce(lambda a,b: len(a[1]) + len(b[1]))

but on pythonRDD it ran into bug, the bug says:

"TypeError: 'int' object has no attribute 'getitem'".

def countTokens(vendorRDD):
    return vendorRDD.map(lambda l: (l[0],len(l[1]))).reduce(lambda a,b: a[1] + b[1])

Any idea on how this happened would be appreciated?!

A: Difference between PythonRDD and ParallelCollectionRDD is completely irrelevant here. Your code is just wrong.
reduce method takes an associative and commutative function with the following signature:
(T, T) => T

In other words both arguments and returned object have to be of the same type and an order of operations and a parenthesizing cannot affect the final result. Function you pass to the reduce simply doesn't satisfy these criteria.
To make it work you'll need something like this:
rdd.map(lambda l: len(l[1])).reduce(lambda x, y: x + y)

or even better:
from operator import add

rdd.values().map(len).reduce(add)


text:
Q: Angular 2 method for querySelectorAll and className I would like to know the best way to define functions to get all elements of a list and apply/remove a class style to all of it.
var x = document.querySelectorAll(".example > li");

x.className = "";

How to angularize 2 the above? Can anyone help with an example?

A: Angular 2 best practices are that the document as written in the templates is the document that gets shown to the user. Full stop. The document can have conditional elements that may change their appearance, content, and even existence depending on data provided by the controller, but those are still defined in the document.
To implement this by Angular 2 best practices, you must specify in the document template that each list item has whatever class you're concerned with, conditional on some variable or expression that uses values provided by the controller. NgClass is the usual way to do this. Then the controller updates that variable, and lets Angular change detection figure out all the classes that need to update in response.


text:
Q: Mail Server suggestion for large inboxes The employees in the company that I working are using mails alot. Some employees have more than 20GB of mail archive (Checked from Outlook data files). I am using hMailServer for mail server. The reason why they have such a high archives is this: Some files are sending to others as attachment. Sometimes for information they are adding other people. So basicly a 2MB file can be 20MB sometimes.
I am thinking to buy a new blade server and make it a linux mail server And store all mails in there. Then backup the all mails periodicly. So I need 20GB - 50GB mailbox size for all employees.
Questions:

*

*Is this a good aproach or there is a better solution for this?

*Are the mail servers storing attachments in one place for different users? Same file is not in several mailboxes.

*50GB mailbox and 30 users (this count can go upto 150 users) makes 1.5TB total space. When backuping how much this size compress?

*Is it possible to make a linux mail server work with Windows Active Directory?

*Is it possible for that mail server to store contacts and calendar activities?

*Outlook storing mails on its own file. Is it possible to make Outlook to just get the mails not store them in local PC?

A: This seems to be a good case for Microsoft Exchange, with the assistance of someone well-versed in Exchange deployments.
The main reasons I recommend that is that your users seem to be Outlook-based on the client side, you're seeing groupware functionality (calendar and contacts) and you have an Active Directory setup. Also, your document retention and per-user/group/database settings can be very granular...
Linux-based solutions don't really seem to be a good fit here. Is there a reason Exchange hasn't been considered?

A: Consider Zarafa out of the many mail servers available. It's a flexible, open source and enterprise grade mail (and groupware) solution perfectly capable of huge amounts of email.

*

*It uses MySQL for the storage of mail data with the exception of attachments on local filesystem by default. Make sure you know MySQL well and you'll be able to scale it up to very large instance including hot backup (Percona XtraBackup for example) or even master-slave replication and do the backup on the slave machine.

*It features single instance storage for attachments. If an email is delivered to multiple recipients, the attachments is only stored once on disk. Depending on your users, this might save you huge amounts of data on disk. Be sure to use the LMTP approach in the DAgent for this feature.

*The Zarafa Archiver can help you reduce the load and storage of your primary mail server(s) by moving older messages to a slower but cheaper server. This will help your system to keep fast and makes backing up of data easier.

*While it's an open source Linux solution, it's primary client support is Microsoft Outlook and secondary it's own web clients Webapp and the older Webaccess.

*Yes it works with Active Directory.

Disclaimer: I worked for Zarafa. (not anymore)


text:
Q: How do I show the following property of a factorial? How do I show the following?
$$\frac{n!}{(k+1)!(n-(k+1))!}=\frac{n-k}{k+1}\frac{n!}{k!(n-k)!} \text{ for } k=0,1,\ldots,n-1$$

A: It's just algebra:
$$\begin{align*}
\frac{n-k}{k+1}\cdot\frac{n!}{k!(n-k)!}&=\frac{(n-k)n!}{(k+1)k!(n-k)!}\\
&=\frac{(n-k)n!}{(k+1)!(n-k)!}\quad\text{since}(k+1)!=(k+1)k!\\
&=\frac{\color{red}{(n-k)}n!}{(k+1)!\color{red}{(n-k)}(n-k-1)!}\quad\text{since}(n-k)!=(n-k)(n-k-1)!\\
&=\frac{n!}{(k+1)!(n-k-1)!}\\
&=\frac{n!}{(k+1)!\big(n-(k+1)\big)!}
\end{align*}$$

A: $$\frac{n!}{(k+1)!(n-(k+1))!}=\frac{n!}{(k+1)k!(n-k-1)!}=\frac{n!}{(k+1)k!\frac{(n-k)!}{n-k}}=\frac{n-k}{k+1}\frac{n!}{k!(n-k)!}$$


text:
Q: Radio Buttons for a custom dialog I  have a custom dialog with radio buttons , I need to listen for change (in case any )  from the dialog opened and set text from that. Since I have done that using java , I dont know how to use onCheckedChangedListener. How do I do that . I am new to android and I dont know much .Please help me.
public class Availability extends Activity implements OnClickListener {
    ToggleButton override;
    TextView status;
    Button Overridestatus;
    CharSequence [] choice = {"RemoteOffice","Office","Personel mobile","Home","Mobile","Temporary","Do not Disturb","Working Remotely","Non work day","Work Day"};

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        setContentView(R.layout.availability);
        override = (ToggleButton) findViewById(R.id.tbOver);
        override.setOnClickListener(this);
        status = (TextView) findViewById(R.id.tvstatus);
        Overridestatus = (Button) findViewById(R.id.bstatus);
        Overridestatus.setOnClickListener(this);

    }

    public void onClick(View view) {
        // TODO Auto-generated method stub
        switch (view.getId()) {
        case R.id.tbOver:

            if (override.isChecked()) {

                status.setText("Override");
                Overridestatus.setText("Personal Mobile");

            } else {
                status.setText("Currently");
                Overridestatus.setText("Use Schedule - Do Not Disturb");

            }
            break;

        case R.id.bstatus:

            {
                if (override.isChecked()){
                showDialog(0);
                }
            }

            break;
        }
    }
    @Override
    protected Dialog onCreateDialog(int id) {
        // TODO Auto-generated method stub
        switch (id) {
        case 0:
            AlertDialog.Builder builder = new AlertDialog.Builder(this);
            builder.setTitle("Select System Server");
            builder.setIcon(R.drawable.ic_btn_round_more_normal);
            builder.setPositiveButton("OK",
                    new DialogInterface.OnClickListener() {

                        public void onClick(DialogInterface dialog, int id) {
                            // TODO Auto-generated method stub
                            Intent menu = new Intent(Availability.this,MenuScreen.class);
                            startActivity(menu);

                        }
                    });
            builder.setNegativeButton("CANCEL",
                    new DialogInterface.OnClickListener() {

                        public void onClick(DialogInterface dialog, int which) {
                            // TODO Auto-generated method stub

                        }
                    });

            builder.setSingleChoiceItems(choice, -1,
                    new DialogInterface.OnClickListener() {

                        public void onClick(DialogInterface dialog, int item) {
                            // TODO Auto-generated method stub

                        }
                    });

            builder.create();
            builder.show();
        }
        return null;

    }

}

A: You can extract the states of the radio buttons and save them in your local variables for further use.
Please refer the excellent developers guide here:
https://developer.android.com/guide/topics/ui/dialogs.html
Read through it once and you'll figure out how to extract and save the states of various elements in your custom dialogs.

A: You can do it in the following way:
public class Availability extends Activity implements OnClickListener,OnCheckedChangeListener {
    ....
    @Override
    public void onCheckedChanged(RadioGroup group, int checkedId) {
    switch(group.getId())
    {
    }
}

You can put the RadioButtons in a RadioGroup.


text:
Q: Success function bound to x-editable not executing with correct parameters I call the following function several times after my page is loaded.  The intent is to incrementally load a lot of similarly-formatted companies from the server.  For each company I would like to find all the x-editable elements and bind a success handler function.  The success handler in each case should call a refresh function passing in the name and id of this particular company.
This all more or less works -- the companies load incrementally, I'm able to find the matching x-editables and bind my success function to them.
The problem is that when the page is fully loaded and I use an x-editable to edit some data the refreshCompany() function is executed but with the wrong company_name and company_guid.  The name and id that appear in the Refresh. . . console message are the same for all companies in a container, and always the last one from company list, not the one that appeared in the Load. . . console message.
I believe one of two things may be happening:

*

*The company_name and company_guid values are remaining bound to the current (ish) values in the outer scope due to closure rules I do not fully understand.

*

*My .find('.editable') search is operating not on my newly created company-specific object but rather on the container holding all the companies (my original implementation used .append() instead of .appendTo() and definitely suffered from this problem).

How can I modify the following code such that refreshCompany() will be executed using the name and id values at the time the function is bound?
 function loadCompanies(company_list, container_name, link_container_name) {

    var searchTerm = '#' + container_name;

    for (company of company_list)
    {

        var company_name = company.name;
        var company_guid = company.id;
        console.log('Load ' + company_name + ' ' + company_guid);

        $.ajax(
            {
                url : '${fund.name}/' + encodeURIComponent( company_name ),
                type : 'GET'
            }
        ).done (
            function (company_html) {
                var newElement = $(company_html).appendTo('#' + container_name);
                newElement.find('.editable').editable(
                    {
                        success : function (response, newValue) {
                            console.log('Refresh ' + company_name + ' ' + company_guid)
                            refreshCompany(company_name, company_guid);
                        }
                    }
                );
            }
        );

    }
}

A: I hope this helps but it seems the problem is that by the time you get a response from the asynchronous GET request you have already looped through
all of the companies in the list, so when the success method runs,
company_name and company_guid are bound the last company in the list.
I think you should be able to solve this problem with a closure.  Perhaps something like defining a function outside loadCompanies like :

function refreshClosure(companyName, companyGuid) {
 return function () {
  console.log('Refresh ' + companyName + ' ' + companyGuid)
  refreshCompany(companyName, companyGuid);
 }
}

...and using it in your code like this:

function loadCompanies(company_list, container_name, link_container_name) {

    var searchTerm = '#' + container_name;

    for (var company in company_list)
    {

        var company_name = company.name;
        var company_guid = company.id;

        // Enclose the current value of company_name and company_guid
        var refreshCurrent = refreshClosure(company_name, company_guid);

      console.log('Load ' + company_name + ' ' + company_guid);

        $.ajax(
            {
                url : '${fund.name}/' + encodeURIComponent( company_name ),
                type : 'GET'
            }
        ).done (
            function (company_html) {
                var newElement = $(company_html).appendTo('#' + container_name);
                newElement.find('.editable').editable(
                    {
                        success : function (response, newValue) {
                        // Invoke the function returned from the closure
                            refreshCurrent();
                        }
                    }
                );
            }
        );

    }
}

I also changed the for statement in case that was part of the problem.  Let me know if this helps at all.


text:
Q: Kafka java UNKNOWN_TOPIC_OR_PART error intermittent I use Kafka in my Java Application.
When I send message to Kafka to use Producer, sometimes throw UNKNOWN_TOPIC_OR_PART execption then resend message, but it will fail with TIMEOUT execption.
But if run it again, it will work normally.
This happens very intermittently..
My Producer Setting:
Properties props = new Properties();
props.put("bootstrap.servers", servers);
props.put("key.serializer", StringSerializer.class.getCanonicalName());
props.put("value.serializer", StringSerializer.class.getCanonicalName());
props.put("metadata.fetch.timeout.ms", "10000");

producer = new KafkaProducer<>(props);
producer.send(new ProducerRecord<>("log", message), (metadata, exception) -> {
  if(exception != null) {
    LOGGER.error("Failed to send log - " + message, exception);
    LOGGER.debug("Resend log - " + message);
    send(message);
  }
});

I don't know what cause about this problem...
Why is this?


text:
Q: Load and Parse WPF Window XAML File I am creating a Visual Studio Add-in that gets access to the currently opened file. The intention later to load XAML file, loop through its controls, convert each control to a different format stored in XML file.
So far, I was able to get this far. Problem is, no UIElements are being returned when I call FindVisualChildren() method.
Any idea?
StreamReader mysr = new StreamReader(pathToXaml);
DependencyObject rootObject = XamlReader.Load(mysr.BaseStream) as DependencyObject;

string s = "";
foreach (UIElement ui in FindVisualChildren<UIElement>(rootObject))
{
      s += ui.GetType().Name + "\n";
}

public static IEnumerable<T> FindVisualChildren<T>(DependencyObject depObj) where T : DependencyObject
    {
        if (depObj != null)
        {
            for (int i = 0; i < VisualTreeHelper.GetChildrenCount(depObj); i++)
            {
                DependencyObject child = VisualTreeHelper.GetChild(depObj, i);
                if (child != null && child is T)
                {
                    yield return (T)child;
                }

                foreach (T childOfChild in FindVisualChildren<T>(child))
                {
                    yield return childOfChild;
                }
            }
        }
    }


text:
Q: Can I pass in a NLTK tree instead of the original text to a LinearSVM in Python using SK-Learn, if not, what is the best way? I have been studying argumentation. I have written some software which interacts with the Twitter api, and enables me to build very weakly 'auto-annotated' datasets. The goal of the software is exactly that, easy creation of datasets for classification using distant supervision. It works great so far. I downloaded 1000 tweets which contained the phrase 'I argue that', assuming that the vast majority of these tweets will contain claims. I labelled them all as 'argumentative'. I then compiled another list of 1000 non-argumentative tweets. I know I can calculate the tree kernel for the constituency trees for argumentative sentences and use the kernel in a SVM, which is the best way to do it from the literature I've read, but that is outside my knowledge at this moment. So to keep it simply I have just been using a linear svm adapted from a sentiment analysis tutorial. I have generated the constituency trees using Spacy and library named Benepar, and have simply replaced the sentiment analysis data with my new data and labels, but the data being a set of trees rather than textual sentences. The classifier is set up as follows
unigram_bigram_clf = Pipeline([
  ('vectorizer', CountVectorizer(analyzer="word",
                               ngram_range=(1, 2),
                               tokenizer=word_tokenize)),
                              # preprocessor=lambda text: text.replace("<br />", " "),)),
('classifier', LinearSVC(max_iter=1000000, verbose=True))
])

The max iterations was set to a million because it wasn't converging at 100000. I suspect 150000 would be enough as it usually converges around iteration 100k. I run the classifier and I'm getting roughly 80% accuracy predicting argumentative tweets which just seems high given it's set up for sentiment analysis using words. How would I know if it is overfitting, and is this even a reasonable way to classify? Given that the input is a list of trees, labelled as argumentative or not, what would be a good way to feed that data into an SKLearn classifier?


text:
Q: NSURL: Escape Backslash using NSCharacterSet This may be a duplicate question, but I have checked all over and can't find a working answer for iOS9. -stringByAddingPercentEscapesUsingEncoding has been deprecated. I need to use -stringByAddingPercentEncodingWithAllowedCharacters
Below is the string that needs the backslashes escaped so that the API can authenticate the session and return a response.
NSString *base = @"http://domain.com/interface/?end=imember";
NSCharacterSet *set = [NSCharacterSet URLQueryAllowedCharacterSet];
NSString *key = [@"&client_key=KOB3N6KX9JXF2MRPO5U.BRFYM7TYVE\/16KIJVXZA6R7H\/1LD1K\/JYIYG7IZP2HA7NUYOVNT3CJG==&token=SGD7E9B29TQ.8HIITZ37XW3GLK5OGLZNLCDM=" stringByAddingPercentEncodingWithAllowedCharacters:set];

The standard URL Character sets don't escape the backslashes, I have tried them all:
URLUserAllowedCharacterSet
URLPasswordAllowedCharacterSet
URLHostAllowedCharacterSet
URLPathAllowedCharacterSet
URLQueryAllowedCharacterSet
URLFragmentAllowedCharacterSet

Please if someone could assist, I am rather new to development. Is it possible to create a custom allowed set which includes the backslash?
EDIT:
This is what the url should look like:
http://domain.com/interface/?end=imember&client_key=KOB3N6KX9JXF2MRPO5U.BRFYM7TYVE\/16KIJVXZA6R7H\/1LD1K\/JYIYG7IZP2HA7NUYOVNT3CJG==&token=SGD7E9B29TQ.8HIITZ37XW3GLK5OGLZNLCDM=

A: The exact solution for you answer is below.I got it from Zaph's answer.That is the better answer than other answer.
NSString *unescaped = @"http://domain.com/interface/?end=imember"];
NSString *escapedString = [unescaped stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLHostAllowedCharacterSet]];
NSLog(@"escapedString: %@", escapedString);

URL Encoding Character Sets are
URLFragmentAllowedCharacterSet  "#%<>[\]^`{|}
URLHostAllowedCharacterSet      "#%/<>?@\^`{|}
URLPasswordAllowedCharacterSet  "#%/:<>?@[\]^`{|}
URLPathAllowedCharacterSet      "#%;<>?[\]^`{|}
URLQueryAllowedCharacterSet     "#%<>[\]^`{|}
URLUserAllowedCharacterSet      "#%/:<>?@[\]^`


text:
Q: How to put a trailing slash from a mod rewrite I'm having a problem using this rewrite:
RewriteCond %{HTTP_HOST} www.example.com$
RewriteRule ^(.*)$ http://example.com$1 [R=301,L]

to remove the www url
But the return is a url without a trailing slash. For example: example.com/subfolder which supposedly has a url of example.com/subfolder, but the result is example.comsubfolder whch breaks the url. Anyone could help me solving this? Many thanks!
EDIT: here's my whole .htaccess
Header unset Pragma
FileETag None
Header unset ETag

# 1 YEAR
<FilesMatch "\.(ico|pdf|flv)$">
Header set Cache-Control "max-age=29030400, public"
</FilesMatch>
# 1 WEEK
<FilesMatch "\.(jpg|jpeg|png|gif|swf)$">
Header set Cache-Control "max-age=604800, public"
</FilesMatch>
# 2 DAYS 172800
<FilesMatch "\.(xml|txt|css|js)$">
Header set Cache-Control "max-age=604800, proxy-revalidate"
</FilesMatch>
# 1 MIN
<FilesMatch "\.(html|htm)$">
Header set Cache-Control "max-age=60, private, proxy-revalidate"
</FilesMatch>

<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
Header set Expires "Thu, 15 Dec 2011 20:00:00 GMT"
</FilesMatch>

RewriteEngine On

RewriteCond %{QUERY_STRING} (^|\?)f=([0-9]+)&t=([0-9]+)($|&)
RewriteRule ^viewtopic\.php$ /index.php?threads/%3/ [R=301,L]

RewriteCond %{QUERY_STRING} (^|\?)f=([0-9]+)($|&)
RewriteRule ^viewforum\.php$ /index.php?forums/%2/ [R=301,L]

RewriteCond %{HTTP_HOST} www.example.com$
RewriteRule ^(.*)$ http://example.com/$1 [R=301,L]

# Use PHP5.4 Single php.ini as default
AddHandler application/x-httpd-php54s .php
#
# Uncomment the statement below if you want to make use of
# HTTP authentication and it does not already work.
# This could be required if you are for example using PHP via Apache CGI.
#
## EXPIRES CACHING ##

<IfModule mod_expires.c>

# Enable expirations
ExpiresActive On

# Default directive
ExpiresDefault "access plus 1 month"

# My favicon
ExpiresByType image/x-icon "access plus 1 yearâ€

# Images
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType image/jpg "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"

# CSS
ExpiresByType text/css "access 1 monthâ€

# Javascript
ExpiresByType application/javascript "access plus 1 year"

</IfModule>

## EXPIRES CACHING ##
#<IfModule mod_rewrite.c>
#RewriteEngine on
#RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
#</IfModule>

<Files "config.php">
Order Allow,Deny
Deny from All
</Files>

<Files "common.php">
Order Allow,Deny
Deny from All
</Files>
DirectoryIndex portal.php index.php index.html index.htm

RewriteCond %{HTTP_REFERER} !^http://example.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://example.com$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.example.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.example.com$      [NC]
RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ - [F,NC]

# Start CloudFlare:example.com rewrite. Do not Edit
RewriteCond %{HTTP_HOST} ^example.com
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
# End CloudFlare rewrite.

#   Mod_security can interfere with uploading of content such as attachments. If you
#   cannot attach files, remove the "#" from the lines below.
#<IfModule mod_security.c>
#   SecFilterEngine Off
#   SecFilterScanPOST Off
#</IfModule>

ErrorDocument 401 default
ErrorDocument 403 default
ErrorDocument 404 default
ErrorDocument 405 default
ErrorDocument 406 default
ErrorDocument 500 default
ErrorDocument 501 default
ErrorDocument 503 default

<IfModule mod_rewrite.c>

#   If you are having problems with the rewrite rules, remove the "#" from the
#   line that begins "RewriteBase" below. You will also have to change the     path

#   This line may be needed to enable WebDAV editing with PHP as a CGI.
#RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule     ^(data/|js/|styles/|install/|favicon\.ico|crossdomain\.xml|robots\.txt) - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
</IfModule>


text:
Q: Is natural isomorphism unique? suppose $F,G\in Ob(Fct(\mathscr C_1,\mathscr C_2))$ are functors,and $\theta:F\Leftrightarrow G$ is an natural isomorphism between $F$ and $G$
my question is : Are there any other $\theta':F\Leftrightarrow G$ is also an natural isomorphism between $F$ and $G$ but different from $\theta$ ? Meaning exist $X\in Ob(\mathscr C_1)$, s.t. $\theta_X$ is different from $\theta'_X$

A: In general, there can be many, just as there can be many bijections from a set to itself or many automorphisms of an algebraic object. Actually, this allows you to  easily construct concretecounterexamples if you choose your categories in a smart way.


text:
Q: Upgrading old thread-pool code to new concurrency classes I am in the process of updating some old Java code which I haven't touched in ages. My question relates to what is the best way to do thread pools now?
Previously I used the concurrency util class's:
import EDU.oswego.cs.dl.util.concurrent.BoundedBuffer;
import EDU.oswego.cs.dl.util.concurrent.PooledExecutor;

However I don't think that is the best way now that I am updating to Java 7.
Here is my code snippet:
Static PooledExecuter pooledExecuter = null;

....
private ThreadPoolExample(Int initialCapactiy, int initThreadPoolSize,
                   int maxThreadPoolSize, int minThreadPoolSize,
                   int time) throws Exception
{
  pooledExecuter = new PooledExecuter(new BoundedBuffer(initialCapactiy),     maxThreadPoolSize);
pooledExecuter.setMinimumPoolSize(minThreadPoolSize);
pooledExecuter.setKeepAliveTime(1000 * time);
pooledExecuter.waitWhenBlocked();
pooledExecuter.createThreads(initThreadPoolSize)

    //setup thread
 this.thread = new Thread(this);
 this.thread.setName("threadtest");
   try
{
   this.thread.setDaemon(this)
}
catch (Exception e)
{
}
}

in my run method, I also call pooledExecuter.execute(new TestClass)
Basically, I want to know which way I should be doing my thread pool now?
Any help would be greatly appreciated.

A: I'm not exactly sure how the BoundedBuffer comes into play but I believe you just need to say:
threadPool = Executors.newFixedThreadPool(maxThreadPoolSize, new ThreadFactory() {
    public Thread newThread(Runnable r) {
        Thread thread = new Thread(r);
        thread.setDaemon(true);
        return thread;
    }
});

The BoundedBuffer may be replaced by the BlockingQueue which is created internally using a LinkedBlockingQueue.
If you want more fine grained control over the keep-alive settings (etc) then you can call the ThreadPoolExecutor constructor directly.
public ThreadPoolExecutor(int corePoolSize,
    int maximumPoolSize,
    long keepAliveTime,
    TimeUnit unit,
    BlockingQueue<Runnable> workQueue,
    ThreadFactory threadFactory)

Something like:
threadPool = new ThreadPoolExecutor(initialCapactiy, maxThreadPoolSize,
    time, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(),
    new ThreadFactory() {
        public Thread newThread(Runnable r) {
            Thread thread = new Thread(r);
            thread.setDaemon(true);
            return thread;
        }
    });

A: You should probably use ExecutorService, which you can construct from one of numerous convenience methods in Executors, including methods to specify a bounded queue, etc, for inserting items.
I see numerous spelling mistakes in your code, for example the Static keyword (with capital S) is not valid and PooledExecutor is spelled differently. Are you sure that compiles?

A: You can use Java Concurrency Utils. Look at the Executor framework for working with thread pools.
http://docs.oracle.com/javase/1.5.0/docs/api/java/util/concurrent/Executor.html
http://www.vogella.com/articles/JavaConcurrency/article.html#threadpools
Alternatively if you are using Spring look at TaskExecutor.
http://static.springsource.org/spring/docs/3.0.x/reference/scheduling.html
If you are running your code inside a Java EE application server, you may have to look at the server's documentation to find out the best way of using a thread pool.

A: Java 7 introduced ForkJoinPool.  Article on when to use it here.


text:
Q: Facebook Session null on OnActivityResult Using the facebook sdk 3.14 for android when i change my password and then try to login into the app, the facebook native app opens and ask me to enter the new password. The problem is that if i put my app in background and then again resume my app and enter the new password and press log in, the app crashes as my session gets null on OnActivityResult. Can someone suggest that how to avoid session getting null or how to handle it.
// This method gets the user logged in without any permission(basic
// permissions which are default will be asked).
@Override
public void login() {
    session = Session.getActiveSession();

                if (session == null
                || session.getState() == SessionState.CLOSED_LOGIN_FAILED
                || session.getState() == SessionState.CLOSED) {
            session = new Session(context);
        }
        if (!session.isOpened()) {
            session.openForRead(new Session.OpenRequest(this));
        }
        Session.setActiveSession(session);

}

protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    session = Session.getActiveSession();
    session.onActivityResult(this.activity, requestCode, resultCode,
                data);
    if (resultCode == Activity.RESULT_OK && session.isOpened()) {
        loginResult(true);
    }

    // If the user cancels the login process or it gets cancelled due to
    // some another reason.
    if (resultCode == Activity.RESULT_CANCELED) {
        Log.e("LOGIN", "CANCELLED");
        inter.loginResult(false);
    }

}

// Facebook Login Result
@Override
public void loginResult(boolean result) {
    // TODO Auto-generated method stub
    if (result) {
        Log.e("Facebook Login ", "Successful");
    } else {
        Log.e("Facebook Logout", "Un Successful");
    }
}

The exception which it shows is:
java.lang.RuntimeException: Unable to resume activity   {com.example.FirstDemo/com.example.FirstDemo.FC_LoginActivity}: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=199188, result=-1, data=Intent { (has extras) }} to activity {com.example.FirstDemo/com.example.FirstDemo.FC_LoginActivity}: java.lang.NullPointerException

A: Try out as below:
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    session = Session.getActiveSession();
    if(session !=null)
     {
       session .onActivityResult(this.activity, requestCode, resultCode,
                data);
       if(session.isOpened())
       {
            loginResult(true);
       }
       else
        {
                loginResult(false);
         }
    }
}


text:
Q: How to create a connectionstring without using the admin I want to connect to my database from my website without using an admin account.  I would prefer a user with a role that has limited access CRUD and Procs but without the ability to modify much else.

*

*I am using SQL Server.

*I am building everything in C#.NET.

*I am using SQL Server Object Explorer and T-SQL to manipulate the database.

I can create a user and password in the DatabaseServer.Security folder.
But I can only create a role in the DatabaseServer.Databases.MyDatabase.Security
I can only assign a user created in the DatabaseServer.Databases.MyDatabase.Security to this role.
The users in the DatabaseServer security have a password but those in the Database.Security don't seem to have a password (or way to login).

A: You need to map a login to a user.
ALTER USER <your user name>
           WITH login = <your login name>;

For more information see the documentation.


text:
Q: What specific Apache modules come bundled in MAMP/MAMP Pro 3? (mod_deflate?) I am trying to figure out which Apache modules come with with MAMP.  The marketing website
http://www.mamp.info/en/mamp-pro/
somewhere just says something like "over 70 modules" and there is a screenshot of the incomplete list.  I can't find in the the User Manual either. Specifically, I would like to know if it comes with mod_deflate (on OSX).
If you own a copy on MAMP PRO 3 on OSX, I believe you can figure this out by doing an
ls /Applications/MAMP/Library/modules

I didn't want to download and install it yet b/c I'm worried it may mess with my current MAMP install, and I'm also not sure if the free MAMP comes with the same modules as MAMP PRO.  If I can figure this out, I can probably convince my boss to upgrade our production server :)

A: Ok, turns out a co-worker has a machine I could install it on.  Here is the output if anyone is curious (no mod_deflate)
httpd.exp
mod_actions.so
mod_alias.so
mod_asis.so
mod_auth_basic.so
mod_auth_digest.so
mod_authn_anon.so
mod_authn_dbd.so
mod_authn_dbm.so
mod_authn_default.so
mod_authn_file.so
mod_authz_dbm.so
mod_authz_default.so
mod_authz_groupfile.so
mod_authz_host.so
mod_authz_owner.so
mod_authz_user.so
mod_autoindex.so
mod_bucketeer.so
mod_cache.so
mod_case_filter.so
mod_case_filter_in.so
mod_cern_meta.so
mod_cgi.so
mod_cgid.so
mod_charset_lite.so
mod_dav.so
mod_dav_fs.so
mod_dbd.so
mod_deflate.so
mod_dir.so
mod_disk_cache.so
mod_dumpio.so
mod_echo.so
mod_env.so
mod_example.so
mod_expires.so
mod_ext_filter.so
mod_fastcgi.so
mod_file_cache.so
mod_filter.so
mod_headers.so
mod_ident.so
mod_imagemap.so
mod_include.so
mod_info.so
mod_log_config.so
mod_logio.so
mod_mem_cache.so
mod_mime.so
mod_mime_magic.so
mod_negotiation.so
mod_perl.so
mod_proxy.so
mod_proxy_ajp.so
mod_proxy_balancer.so
mod_proxy_connect.so
mod_proxy_ftp.so
mod_proxy_http.so
mod_proxy_scgi.so
mod_python.so
mod_reqtimeout.so
mod_rewrite.so
mod_setenvif.so
mod_speling.so
mod_ssl.so
mod_status.so
mod_substitute.so
mod_unique_id.so
mod_userdir.so
mod_usertrack.so
mod_version.so
mod_vhost_alias.so
mod_wsgi.so


text:
Q: RDS does not support creating a DB instance with the following combination AWS recently notified me I need to upgrade an RDS instance that's using an instance type that's being removed.
So I logged in, and bumped up my instance size from m1.small to m5.large (the smallest they still have), clicked apply, and it gave me this error message:
RDS does not support creating a DB instance with the following combination: DBInstanceClass=db.m5.large, Engine=postgres, EngineVersion=9.4.25, LicenseModel=postgresql-license. For supported combinations of instance class and database engine version, see the documentation.

I tried a few different instance sizes and engine versions, and it gives me the same general message.
Googling the error messages finds me no documentation about which combinations are supported. How do I fix this error?
From this similar article, I found I can get a list of allowed Postgres versions by running:
aws rds describe-orderable-db-instance-options --engine postgres --db-instance-class db.m5.large --query 'OrderableDBInstanceOptions[].EngineVersion'

However, I can't find any instance class that lists an engine version shown in the admin console. For example, the UI lists:
10.11, 11.6

but the command line tool only lists:
10.17, 10.18, 10.19, 10.2, 11.12, 11.13, 11.14, 11.15

Why is AWS forcing me to upgrade, but not giving me any options to upgrade?


text:
Q: Workaround for wrapping a JS function in python in Jupyter notebook So in an IPython Jupyter notebook one can add JavaScript functions via the %% javascript magic cell syntax or via the Python kernel with IPython.display.HTML and one can alter Python variables in JS with IPython.notebook.kernel.execute.
However, the kernel call is done when the kernel is idle.
cell 1, magic cell JS to add the function.
%%javascript
window.act = () => IPython.notebook.kernel.execute('flag = False');

cell 2, python kernel
from IPython.display import display, HTML
flag = True
display(HTML('''
New DOM element added

                '''))
import time
time.sleep(2)  #wait in case it's a JS async issue.
print('JS did not change Py variable.' if flag else 'JS successfully changed Py variable.')
>> New DOM element added and changed.
>> JS did not change Py variable.

The result shows the JS is working and changing the #newDOMElement element. But the kernel did not change as it waited.
In fact, once the cell was done with the kernel, the variable changed. As show with this.
print('JS did not change Py variable.' if flag else 'JS successfully changed Py variable.')
>> JS successfully changed Py variable.

This experiment means that one cannot wrap the JS function in a Python method that changes data continually at runtime. Is there a way around this?

A: Code sent to the kernel is executed one snippet at a time. Although you're calling sleep, the cell is still executing. So the snippet sent by JS won't be executed until after the cell is done, as you've observed.
If you want to do something asynchronously, you could send a custom message through the Jupyter protocol from the browser to the kernel, and install a custom message handler in the Python kernel to process it. Some attempts in that direction are linked in the "Previous work" section of IPEP-8:
https://github.com/ipython/ipython/wiki/IPEP-8:-Custom-messages-and-message-handlers#previous-work


text:
Q: Trace of Matrices multiplication Problem:
I want to obtain the trace:
$tr\left( {{A^H}{C^{ - 1}}A} \right)$
where $A$ is a $S \times L$ matrix, $A^H$ is conjugate transpose of $A$, $C$ is a $S \times S$ matrix, ${A^H} A=I$ identity matrix.
Thanks!


text:
Q: Customize existing built in Liferay portlet I went through Liferay documentation and many other tutorials. But I am still struck with getting my requirement done.
This is what I need to achieve:
1.)Create new custom button or a link(href) in Wiki (built in) Portlet (anywhere in the portlet)
2.)On clicking of that button, I want to open a new jsp page in that portlet only.
This is What I did:
I created a Liferay-hook project and selected /wiki/view.jsp to customize.
Added a button  by :
<liferay-ui:icon image="history" label="<%= true %>"
                    message="Notify Users" method="get"
                    url=<%="/c/portal/sample"%>" />
This is my liferay hook.xml:
<?xml version="1.0" encoding="UTF-8"?>
  <!DOCTYPE hook PUBLIC "-//Liferay//DTD Hook 6.1.0//EN" "http://www.liferay.com/dtd/liferay-hook_6_1_0.dtd"><hook><custom-jsp-dir>/META-INF/custom_jsps</custom-jsp-dir>
<struts-action>
    <struts-action-path>/wiki/testing</struts-action-path>
    <struts-action-impl>
        com.liferay.sample.hook.action.WikiEmailHandlerAction
    </struts-action-impl>
</struts-action> <struts-action><struts-action-path>/portal/sample</struts-action-path><struts-action-impl>
    com.liferay.sample.hook.action.WikiEmailHandlerAction
</struts-action-impl>

Where, WikiEmailHandlerAction is my Java class which extends BaseStrutsPortletAction.
When I click on the button "Notify Users", it is opening the new jsp page (but not inside the portlet but as a new page.
Liferay Experts, Please let me know how to meet this requirement.

A: Your jsp is opening into whole page is due to /c/portal/sample url.
You should create renderURL with some parameter set. And in Overridden StrutsAction class's render method check for that parameter and render your custom jsp.
Similarly go for action method, set some parameter in actionURL and check that parameter in processAction of Overridden StrutsAction class.

A: First of all, your liferay-hook.xml doesn't look proper. It should also have  element which should point to the folder inside your hook where you've put customized view.jsp of Wiki portlet.
<custom-jsp-dir>/custom_jsps</custom-jsp-dir>

This folder should also contain the other JSP file that you want to open when clicking the button.

NOTE: In portlet environment, you can NOT open a jsp by simply hyper-linking its path. It will be served as stand-alone jsp by your web container. So you'll have to generate a PortletURL and from your Portlet/StrutsAction dispatch request to appropriate JSP.

So, in your view.jsp, you need to create a PortletURL using <portlet:renderURL> or <portlet:actionURL> tag (as Pankaj mentioned above) as per your requirement.
Or, another simpler solution (or hack rather) is to use JQuery.ajax and load the JSP's content using Ajax.


text:
Q: Null a dictionary inside a function in python I'm not quite sure why the following doesn't work.  I tried to send a dictionary object to a function, test a few things and make the dict null if certain criteria was met.  I don't know why.
A simple version of what I tried to do:
def destroy_bad_variables(a):
    # test if a is a bad variable, nullify if true
    #del a # doesn't work.
    a = None
    print a # this says its null

def change(a):
    a['car'] = 9

b = {'bar':3, 'foo':8}
print b

change(b)
print "change(b):", b

destroy_bad_variables(b)
print "destroy_bad_variables(b):", b

It produces the following output:
{'foo': 8, 'bar': 3}
change(b): {'car': 9, 'foo': 8, 'bar': 3}
None
destroy_bad_variables(b): {'car': 9, 'foo': 8, 'bar': 3}

The dict can be modified by a function as is expected, but for some reason it can't be set to None.  Why is this?  Is there some good reason for this seemingly inconsistent behaviour?  Forgive my ignorance, none of the books I've read on python explain this.  As I understand it dicts are "mutable", the function should null the dict object and not some copy of it.
I know I can work around it by setting b = destroy(b) and returning None from destroy(), but I don't understand why the above doesn't work.

A: When you say
a = None

you are making a refer to None, which was earlier pointing to the dictionary object. But when you do
a['car'] = 9

a is still a reference to the dictionary object and so, you are actually adding a new key car to the dictionary object only. That is why it works.
So, the correct way to clear the dictionary is to use dict.clear method, like this
a.clear()

A: the thing why its not working:
>>> a=[1,2,3,4]
>>> def destroy(a):
...     del a          # here a is local to destroy only
...
>>> destroy(a)
>>> a
[1, 2, 3, 4]

A: You're not destroying anything, you're just changing a's value to None in destroy's local scope.
Why are you not simply using:
some_dictionary = None

To remove reference to some_dictionary? The garbage collector will do the destruction when no one references some_dictionary anymore.
In your code:
b = None # replaced: destroy(b)


text:
Q: how to set border to layout I want set a border to Relativelayout. I make relativelayout clickable and use selector for changing selected color, also I use shape for rounding corners of layout. But when I select the layou the shape takes all background including the border. I can't find a way for solving this problem.
This is my main.xml
<RelativeLayout android:id="@+id/map_refresh"
                android:layout_height="fill_parent" android:layout_width="wrap_content"
                android:background="@drawable/settings_selector_up"
                android:padding="15dp"
                android:layout_marginLeft="15dip" android:layout_marginRight="15dip" android:layout_marginTop="5dip">
                <TextView android:id="@+id/Text1"
                    android:layout_height="wrap_content" android:layout_width="wrap_content"
                    android:text="Map refresh period">
                </TextView>
                <TextView android:id="@+id/TextView09"
                    android:layout_height="wrap_content" android:layout_width="wrap_content"
                    android:text="1 min"
                    android:layout_alignParentRight="true"
                    android:paddingRight="5dp">
                </TextView>
            </RelativeLayout>
</LinearLayout>

this is my settings_selector_up.xml
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <!-- Non focused states -->
    <item android:state_focused="false" android:state_selected="false"
        android:state_pressed="false" android:background="@drawable/settings_border_roundup" />
    <item android:state_focused="false" android:state_selected="true"
        android:state_pressed="false" android:drawable="@drawable/settings_border_roundup" />

    <!-- Focused states -->
    <item android:state_focused="true" android:state_selected="false"
        android:state_pressed="false" android:drawable="@drawable/settings_border_roundup" />
    <item android:state_focused="true" android:state_selected="true"
        android:state_pressed="false" android:drawable="@drawable/settings_border_roundup" />

    <!-- Pressed -->
    <item android:state_selected="true" android:state_pressed="true"
        android:drawable="@drawable/selector_pressed" >
        </item>
    <item android:state_pressed="true" android:drawable="@drawable/list_selector_pressed" />
</selector>

And this is my selector_pressed
<shape
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <solid android:color="#E6E6E6"></solid>
    <corners android:radius ="10dp" />
</shape>

Is there a way receive same result as we go for example using listselector in listView (in listview when I select the listitem only background color changed but border stayed unchanged).

A: Put the whole thing in another parent layout that handles the drawing of the border, like this:
<FrameLayout
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="your background 9-patch or shape of the border"
    android:padding="some padding value so the border looks ok">

    < Your RelativeLayout without the border stuff >

</FrameLayout>


text:
Q: JSON to Dart conversion errors: doesn't print I'm trying to get a data from a JSON Response.
Here's my sample JSON data:
{
            "id": 97,
            "parentWo": "2022-178348",
            "parentWoDesc": "COMMERCIAL - BUSINESS ESTABLISHMENT - LUMBIA HOSPITAL - PN 21.0130",
            "parentWoStatus": "APPR",
            "parentWoStatusDate": "2022-03-22T13:36:00+08:00",
            "parentWoWorkType": "CP",
            "parentWoClass": "COMM",
            "parentWoCrew": "",
            "parentWoLead": "",
            "parentWoLocation": "210130",
            "parentWoDepartmentDescription": "Line Maintenance Department",
            "parentWoSectionDescription": "Line Section",
            "status": "I",
            "approvedBy": "eams.extension2",
            "approvedDate": "2022-07-21T09:59:09.727428+08:00",
            "disapprovedBy": null,
            "disapprovedDate": null,
            "issuedBy": "eams.extension2",
            "issuedDate": "2022-07-21T11:19:39.717066+08:00",
            "voidedBy": null,
            "voidedDate": null,
            "receivedBy": "ALEX",
            "receivedDate": "2022-07-21T11:19:39.717073+08:00",
            "children": [
                {
                    "id": 27,
                    "woNum": "2022-178349",
                    "woDesc": "Installation of POLE, CON, SPUN TY, (45) 14M X 500 [Rocky]",
                    "woStatus": "APPR",
                    "woStatusDate": "2022-03-22T13:36:01+08:00",
                    "woCrew": "",
                    "woLead": "",
                    "woLocation": "212636",
                    "materials": [
                        {
                            "id": 36,
                            "itemNum": "2001409",
                            "itemDescription": "POLE, CON, SPUN TY, (45) 14M X 500",
                            "itemQuantityPlan": 1.0,
                            "itemQuantityIssued": 1.0,
                            "itemWoBalance": 0.0,
                            "itemInventoryBalance": -1669.0,
                            "itemCommodity": "",
                            "itemIssueUnit": "LEN",
                            "itemStructure": false,
                            "itemDtPole": true,
                            "requestQuantity": "10.00",
                            "approvedQuantity": "8.00",
                            "issuedQuantity": "5.00",
                            "timestamp": "2022-07-20T11:21:37.607303+08:00",
                            "updated": "2022-07-21T11:19:39.730245+08:00"
                        }
                    ]
                }

            ]
            }

Then here's my Class for the JSON above:
class MROParent {

  int? id;
    String? parentWo;
    String? parentWoDesc;
    String? parentWoStatus;
    DateTime? parentWoStatusDate;
    String? parentWoWorkType;
    String? parentWoClass;
    String? parentWoCrew;
    String? parentWoLead;
    String? parentWoLocation;
    String? parentWoDepartmentDescription;
    String? parentWoSectionDescription;
    String? status;
    String? approvedBy;
    DateTime? approvedDate;
    String? disapprovedBy;
    DateTime? disapprovedDate;
    String? issuedBy;
    DateTime? issuedDate;
    String? voidedBy;
    DateTime? voidedDate;
    String? receivedBy;
    DateTime? receivedDate;
    List<MROChild>? children;

  MROParent({
    this.id,
        this.parentWo,
        this.parentWoDesc,
        this.parentWoStatus,
        this.parentWoStatusDate,
        this.parentWoWorkType,
        this.parentWoClass,
        this.parentWoCrew,
        this.parentWoLead,
        this.parentWoLocation,
        this.parentWoDepartmentDescription,
        this.parentWoSectionDescription,
        this.status,
        this.approvedBy,
        this.approvedDate,
        this.disapprovedBy,
        this.disapprovedDate,
        this.issuedBy,
        this.issuedDate,
        this.voidedBy,
        this.voidedDate,
        this.receivedBy,
        this.receivedDate,
        this.children,
  });

  factory MROParent.fromJson(Map<String, dynamic> json) {
    var list = json['children'] as List;
    print(list.runtimeType);
    List<MROChild> childrenlist = list.map((i) => MROChild.fromJson(i)).toList();

    return MROParent(
      id: json["id"],
        parentWo: json["parentWo"],
        parentWoDesc: json["parentWoDesc"],
        parentWoStatus: json["parentWoStatus"],
        parentWoStatusDate: DateTime.parse(json["parentWoStatusDate"]),
        parentWoWorkType: json["parentWoWorkType"],
        parentWoClass: json["parentWoClass"],
        parentWoCrew: json["parentWoCrew"],
        parentWoLead: json["parentWoLead"],
        parentWoLocation: json["parentWoLocation"],
        parentWoDepartmentDescription: json["parentWoDepartmentDescription"],
        parentWoSectionDescription: json["parentWoSectionDescription"],
        status: json["status"],
        approvedBy: json["approvedBy"],
        approvedDate: DateTime.parse(json["approvedDate"]),
        disapprovedBy: json["disapprovedBy"],
        disapprovedDate: DateTime.parse(json["disapprovedDate"]),
        issuedBy: json["issuedBy"],
        issuedDate: DateTime.parse(json["issuedDate"]),
        voidedBy: json["voidedBy"],
        voidedDate: DateTime.parse(json["voidedDate"]),
        receivedBy: json["receivedBy"],
        receivedDate: DateTime.parse(json["receivedDate"]),
      children:
          childrenlist,
    );
  }

  Map<String, dynamic> toJson() => {
        "id": id,
        "parentWo": parentWo,
        "parentWoDesc": parentWoDesc,
        "parentWoStatus": parentWoStatus,
        "parentWoStatusDate": parentWoStatusDate!.toIso8601String(),
        "parentWoWorkType": parentWoWorkType,
        "parentWoClass": parentWoClass,
        "parentWoCrew": parentWoCrew,
        "parentWoLead": parentWoLead,
        "parentWoLocation": parentWoLocation,
        "parentWoDepartmentDescription": parentWoDepartmentDescription,
        "parentWoSectionDescription": parentWoSectionDescription,
        "status": status,
        "approvedBy": approvedBy,
        "approvedDate": approvedDate!.toIso8601String(),
        "disapprovedBy": disapprovedBy,
        "disapprovedDate": disapprovedDate!.toIso8601String(),
        "issuedBy": issuedBy,
        "issuedDate": issuedDate!.toIso8601String(),
        "voidedBy": voidedBy,
        "voidedDate": voidedDate!.toIso8601String(),
        "receivedBy": receivedBy,
        "receivedDate": receivedDate!.toIso8601String(),
        "children": List<dynamic>.from(children!.map((x) => x.toJson())),
      };
}

class MROChild {

  int? id;
    String? woNum;
    String? woDesc;
    String? woStatus;
    DateTime? woStatusDate;
    String? woCrew;
    String? woLead;
    String? woLocation;
    List<MROMaterial>? materials;

  MROChild({
    this.id,
        this.woNum,
        this.woDesc,
        this.woStatus,
        this.woStatusDate,
        this.woCrew,
        this.woLead,
        this.woLocation,
        this.materials,
  });

  factory MROChild.fromJson(Map<String, dynamic> json) {
    var list = json['materials'] as List;
    print(list.runtimeType);
    List<MROMaterial> materialslist = list.map((i) => MROMaterial.fromJson(i)).toList();

    return MROChild(
        id: json["id"],
        woNum: json["woNum"],
        woDesc: json["woDesc"],
        woStatus: json["woStatus"],
        woStatusDate: DateTime.parse(json["woStatusDate"]),
        woCrew: json["woCrew"],
        woLead: json["woLead"],
        woLocation: json["woLocation"],
        materials: materialslist,
      );
  }

  Map<String, dynamic> toJson() => {
        "id": id,
        "woNum": woNum,
        "woDesc": woDesc,
        "woStatus": woStatus,
        "woStatusDate": woStatusDate!.toIso8601String(),
        "woCrew": woCrew,
        "woLead": woLead,
        "woLocation": woLocation,
        "materials": List<dynamic>.from(materials!.map((x) => x.toJson())),
      };
  get length => null;
}

class MROMaterial {

  int? id;
    String? itemNum;
    String? itemDescription;
    double? itemQuantityPlan;
    double? itemQuantityIssued;
    double? itemWoBalance;
    double? itemInventoryBalance;
    String? itemCommodity;
    String? itemIssueUnit;
    bool? itemStructure;
    bool? itemDtPole;
    double? requestQuantity;
    double? approvedQuantity;
    double? issuedQuantity;
    DateTime? timestamp;
    DateTime? updated;

  MROMaterial({
    this.id,
        this.itemNum,
        this.itemDescription,
        this.itemQuantityPlan,
        this.itemQuantityIssued,
        this.itemWoBalance,
        this.itemInventoryBalance,
        this.itemCommodity,
        this.itemIssueUnit,
        this.itemStructure,
        this.itemDtPole,
        this.requestQuantity,
        this.approvedQuantity,
        this.issuedQuantity,
        this.timestamp,
        this.updated,
  });

  factory MROMaterial.fromJson(Map<String, dynamic> json) => MROMaterial(
        id: json["id"],
        itemNum: json["itemNum"],
        itemDescription: json["itemDescription"],
        itemQuantityPlan: json["itemQuantityPlan"],
        itemQuantityIssued: json["itemQuantityIssued"],
        itemWoBalance: json["itemWoBalance"],
        itemInventoryBalance: json["itemInventoryBalance"],
        itemCommodity: json["itemCommodity"],
        itemIssueUnit: json["itemIssueUnit"],
        itemStructure: json["itemStructure"],
        itemDtPole: json["itemDtPole"],
        requestQuantity: json["requestQuantity"],
        approvedQuantity: json["approvedQuantity"],
        issuedQuantity: json["issuedQuantity"],
        timestamp: DateTime.parse(json["timestamp"]),
        updated: DateTime.parse(json["updated"]),
      );

  Map<String, dynamic> toJson() => {
        "id": id,
        "itemNum": itemNum,
        "itemDescription": itemDescription,
        "itemQuantityPlan": itemQuantityPlan,
        "itemQuantityIssued": itemQuantityIssued,
        "itemWoBalance": itemWoBalance,
        "itemInventoryBalance": itemInventoryBalance,
        "itemCommodity": itemCommodity,
        "itemIssueUnit": itemIssueUnit,
        "itemStructure": itemStructure,
        "itemDtPole": itemDtPole,
        "requestQuantity": requestQuantity,
        "approvedQuantity": approvedQuantity,
        "issuedQuantity": issuedQuantity,
        "timestamp": timestamp!.toIso8601String(),
        "updated": updated!.toIso8601String(),
      };
  @override
  String toString() {
    // TODO: implement toString
    return '$id';
  }
}

The code below doesn't seem to work when I try to save it as a new class, and try to print a value from it:
      print('THIS HAVE RESULTS IN MRO PARENT'); //this one prints
      final parentMROResponse = jsonResponse['results']['data'];
      print(parentMROResponse); //this one prints

      mainParentMROO = MROParent.fromJson(parentMROResponse);
      print(mainParentMROO.id); //THIS IS DOESN'T PRINT

Is there something I'm missing? I tried checking the data types and I think all are correct. thanks!

A: Change int to dynamic your problem will be solved !
class MROMaterial {

      dynamic id;
        String? itemNum;
        String? itemDescription;
        dynamic itemQuantityPlan;
        dynamic itemQuantityIssued;
        dynamic itemWoBalance;
        dynamic itemInventoryBalance;
        String? itemCommodity;
        String? itemIssueUnit;
        bool? itemStructure;
        bool? itemDtPole;
        dynamic requestQuantity;
        dynamic approvedQuantity;
        dynamic issuedQuantity;
        DateTime? timestamp;
        DateTime? updated;


text:
Q: How to use FindRoot to solve Hypergeometric1F1 imaginary number solution? I want to use FindRoot to solve Hypergeometric1F1 imaginary number solution.
First of all, I try to use NSolve to solve the equation, and have made the following attempts:
NSolve[x^2 + 1 == 0, x]
(* {{x -> 0. - 1. I}, {x -> 0. + 1. I}} *)

However, NSolve cannot solve the system at present.
NSolve[0 == Hypergeometric1F1[1 - x, 2, 2/x], x]

Therefore, I want to use FindRoot to solve the imaginary number solution of the function.
At present, I have tried ReImpPlot, but the effect is not very good.
How can I use FindRoot to solve all imaginary solutions of Hypergeometric1F1 function? Thanks.

A: If you restrict the domain, then NSolve can find solutions:
NSolve[0 == Hypergeometric1F1[1 - x, 2, 2/x] && Abs[x]<1, x]

{{x->0. -0.0227961 I},{x->0. -0.0290547 I},{x->0. -0.035574 I},{x->0. +0.035574 I},{x->0. -0.0400755 I},{x->0. -0.0458896 I},{x->0. +0.0458896 I},{x->0. +0.0536934 I},{x->0. -0.458929 I},{x->0. +0.458929 I}}

A: There are countably infinitely many zeros of your $f(x)$, which we can enumerate as follows.
For small $x$, your function is approximated by $e^{1/x} x \sinh(1/x)$:
f[x_] = Hypergeometric1F1[1 - x, 2, 2/x];
g[x_] = E^(1/x) x Sinh[1/x];

ReImPlot[{f[I x], g[I x]}, {x, -0.1, 0.1}]

This approximation gives excellent starting points for numerical root-finding: for $n\in\mathbb{Z}\setminus\{0\}$ we have $g[i/(n\pi)]=0$, and find the $n^{\text{th}}$ zero of $f$ from this starting point:
zf[n_Integer /; n != 0] := x /. FindRoot[f[x], {x, I/(n*π)}]

Array[zf, 10] // Chop
(*    {0. + 0.458929 I, 0. + 0.173708 I,
       0. + 0.110616 I, 0. + 0.0815787 I,
       0. + 0.0647315 I, 0. + 0.0536934 I,
       0. + 0.0458896 I, 0. + 0.0400755 I,
       0. + 0.035574 I, 0. + 0.0319845 I}    *)

Much higher zeros can be found in this way:
zf[10^6]
(*    0. + 3.1831*10^-7 I    *)

For added stability we can extract more factors from $g(x)$ to regularize your $f(x)$ before nulling: notice that $g(i/y) y e^{i y} = \sin y$ with zeros at $y_n=n\pi$, and further that $f(i/y) y e^{i y}\in\mathbb{R}$ if $y\in\mathbb{R}$; and hence
zf2[n_Integer /; n != 0] :=
  I/y /. FindRoot[Re[f[I/y] E^(I y) y], {y, n*π}]

zf2[10^6]
(*    0. + 3.1831*10^-7 I    *)

ReImPlot[{f[I/y] E^(I y) y, Sin[y]}, {y, 0, 50}]


text:
Q: Parsing SNMP responses with PHP I'm currently successfully reading out several properties on our switches over SNMP with php. Now i'm looking at making the resulting output of snmpget and snmpwalk actually usefull for the consumers of our API's.
Problem is that the responses look like this: INTEGER: up(1) and INTEGER: 10103 ...
Is there any convention/standard on how to parse this response format or is the response vendor specific for each device we are trying to read?
Is there by any chance already a PHP library, function or extension that can cast these responses in php native variables or at least something usefull that we can work with?

UPDATE:
I've found out a few new things namely that there are indeed several libraries in php that can parse binary ASN.1 strings which basically are BER encoded strings if i'm right. Problem is that i can't seem to find a way to get the binary data from the devices with php ...

A: You can simply use this function at the beginning of your script :
snmp_set_quick_print(TRUE);

It will returns only the value you are searching for, without the leading "INTEGER" or so ;)
Hope this helps !

A: I'm not sure about your particular PHP methods, but the difference between your two INTEGER examples is likely to be whether your system has an SNMP MIB corresponding to the OID (e.g. to determine that 1 means "up").
If you only want the integers, you should be able to pass a parameter to your get or walk command.  For example, net-snmp's snmpget or snmpwalk commands will take -Oe to remove symbolic labels.  From the manpage:
              $ snmpget -c public -v 1 localhost ipForwarding.0
              IP-MIB::ipForwarding.0 = INTEGER: forwarding(1)
              $ snmpget -c public -v 1 -Oe localhost ipForwarding.0
              IP-MIB::ipForwarding.0 = INTEGER: 1

If you are parsing net-snmp output, I recommend reading the snmpcmd man page as it has a lot of output options that will interest you especially the display of other types such as timeticks and strings.
If you do want to retrieve SNMP in PHP you could look at how Cacti does it.


text:
Q: How to prevent infinite recursion in a non-destructive way? that's my first question here, so I'm apologizing in advance if I didn't data-mined well enough and duplicate the question.
So I'm trying to create some sort of a game where at some point you have a matrix like this:
 _ _ _ _ _ _
|_|_|h|h|h|h|
|_|_|_|_|_|_|
|_|#|#|#|_|_|
|_|_|_|#|_|_|
|_|h|_|_|_|_|
|_|h|#|_|_|_|

And I need a method that checks if there are "elements" made up only by 'h'-es and if it finds one, to change all chars from 'h' to something else like 'd' for example so it becomes:
 _ _ _ _ _ _
|_|_|d|d|d|d|
|_|_|_|_|_|_|
|_|#|#|#|_|_|
|_|_|_|#|_|_|
|_|h|_|_|_|_|
|_|h|#|_|_|_|

While it shouldn't change the other 'h'-es, that touch '#'-s
I can either use for-cycles to run through the whole matrix, or start directly from the element, as I have the arr[y][x] coordinates. Either way, I'm using recursion to check the neighbors, but how do I prevent the method from stepping in back to the previous element and oscillate between them until... StackOverflow occurs? So far this is where I am:
public class matrixRec {
    public static void main(String[] args) {
        char[][] matrix = {
            {' ',' ',' ',' ',' ',' '},
            {' ','h','h','h','h',' '},
            {' ',' ',' ',' ',' ',' '},
            {' ',' ',' ','#','#',' '},
            {' ','h',' ',' ','#','#'},
            {' ','h','#',' ',' ',' '}
        };
        System.out.println(elementChange(matrix, 1, 2));
    }
    static boolean elementChange(char[][] matrix, int y, int x){

        if (matrix[y][x] == ' '){
            return true;
        }
        else if (matrix[y][x] == '#'){
            return false;
        }
        else if (matrix[y][x] == 'h'){
            return (elementChange(matrix, y, x-1) && elementChange(matrix, y, x+1));
        }
        else {
            return false;
        }
    }
}

So is there a way I prevent infinite recursion, without changing the 'h'-es, until I am sure that they're all 'h'?

A: Couple of things to do:
Create a boolean aray to check visited cells each time we check an area
public class matrixRec {
    public static void main(String[] args) {
        char[][] matrix = {
            {' ',' ',' ',' ',' ',' '},
            {' ','h','h','h','h',' '},
            {' ',' ',' ',' ',' ',' '},
            {' ',' ',' ','#','#',' '},
            {' ','h',' ',' ','#','#'},
            {' ','h','#',' ',' ',' '}
        };
        boolean visited[][] = new boolean[6][6] //boolean arrays default to false
        System.out.println(elementChange(matrix, 1, 2, visited));
    }
    static boolean elementChange(char[][] matrix, int y, int x. boolean[][] visited){
        if(visited[y][x]) return ((matrix[y][x] == ' ' || matrix[y][x] == 'h')? true: false);
        visited[y][x] = true; //We have visited this cell
        if (matrix[y][x] == ' '){
            return true;
        }
        else if (matrix[y][x] == '#'){
            return false;
        }
        else if (matrix[y][x] == 'h'){
            return elementChange(matrix, y, x-1,visited) && elementChange(matrix, y, x+1,visited);
        }
        else {
            return false;
        }
    }
}

Are we just checking up left and right? What about up and down?
public class matrixRec {
    public static void main(String[] args) {
        char[][] matrix = {
            {' ',' ',' ',' ',' ',' '},
            {' ','h','h','h','h',' '},
            {' ',' ',' ',' ',' ',' '},
            {' ',' ',' ','#','#',' '},
            {' ','h',' ',' ','#','#'},
            {' ','h','#',' ',' ',' '}
        };
        boolean visited[][] = new boolean[6][6] //boolean arrays default to false
        System.out.println(elementChange(matrix, 1, 2, visited));
    }
    static boolean elementChange(char[][] matrix, int y, int x. boolean[][] visited){
        if(visited[y][x]) return ((matrix[y][x] == ' ' || matrix[y][x] == 'h')? true: false);
        visited[y][x] = true; //We have visited this cell
        if (matrix[y][x] == ' '){
            return true;
        }
        else if (matrix[y][x] == '#'){
            return false;
        }
        else if (matrix[y][x] == 'h'){
            return elementChange(matrix, y, x-1,visited) && elementChange(matrix, y, x+1,visited) && elementChange(matrix, y-1, x,visited) && elementChange(matrix, y+1, x,visited);
        }
        else {
            return false;
        }
    }
}

Use a conditional to only change areas that we want to
public class matrixRec {
    public static void main(String[] args) {
        char[][] matrix = {
            {' ',' ',' ',' ',' ',' '},
            {' ','h','h','h','h',' '},
            {' ',' ',' ',' ',' ',' '},
            {' ',' ',' ','#','#',' '},
            {' ','h',' ',' ','#','#'},
            {' ','h','#',' ',' ',' '}
        };
        boolean visited[][] = new boolean[6][6] //boolean arrays default to false
        System.out.println(elementChange(matrix, 1, 2, visited));
    }
    static boolean elementChange(char[][] matrix, int y, int x. boolean[][] visited){
        if(visited[y][x]) return ((matrix[y][x] == ' ' || matrix[y][x] == 'h')? true: false);
        visited[y][x] = true; //We have visited this cell
        if (matrix[y][x] == ' '){
            return true;
        }
        else if (matrix[y][x] == '#'){
            return false;
        }
        else if (matrix[y][x] == 'h'){

            if((elementChange(matrix, y, x-1,visited) && elementChange(matrix, y, x+1,visited) && elementChange(matrix, y-1, x,visited) && elementChange(matrix, y+1, x,visited))
                matrix[y][x] = 'd'; //Will only change areas that were searched to not be next to a #
        }
        else {
            return false;
        }
    }
}

For the future
This is an area of algorithms that takes a little bit of thought and planning. For future research/programs be sure to do some searching on flood fills, recursive backtracking, graph searching, and recursive maze solving.


text:
Q: Suggestion of research papers I'm trying to find the research papers related to Hopf algebra over non commutative polynomial rings  O( M_n(H))
to get concrete understanding about it. But unfortunately I couldn't find any favorable research paper about it.seeking for your help in this regard ...
Thank you


text:
Q: Lodash Debounce: not invoked as often as expected As per https://stackoverflow.com/a/41215941/7858768 the debounced function is defined outside the render method. The debounced function is invoked but not nearly as often as expected. I would expect it to be triggered on around each second of passed time when the button is pressed (with the wait time set to 1000 ms). However, as you can see from the logs below, over 15 seconds pass before the first debounced print is triggered.
import React from 'react';
import { Button, StyleSheet, View, ViewStyle } from 'react-native';
import * as _ from 'lodash';

interface DebounceDemoProps {

}

const debouncedFunc = _.debounce(() => {
  console.log(`DEBOUNCED PRINT`);
}, 1000);

export const DebounceDemo: React.FunctionComponent<DebounceDemoProps> = (props: DebounceDemoProps) => {
  return <View style={styles.viewStyle}>
    <Button title={'Debounce Test'} onPress={() => {
      console.log(`non debounced print.`);
      debouncedFunc();
    }}/>
  </View>;
}

const styles = StyleSheet.create({
  viewStyle: {} as ViewStyle,
});

[Tue Jul 27 2021 21:07:08.505]  LOG      non debounced print.
[Tue Jul 27 2021 21:07:09.271]  LOG      non debounced print.
[Tue Jul 27 2021 21:07:09.883]  LOG      non debounced print.
[Tue Jul 27 2021 21:07:09.884]  LOG      non debounced print.
[Tue Jul 27 2021 21:07:09.884]  LOG      non debounced print.
[Tue Jul 27 2021 21:07:09.957]  LOG      non debounced print.
[Tue Jul 27 2021 21:07:10.183]  LOG      non debounced print.
[Tue Jul 27 2021 21:07:10.350]  LOG      non debounced print.
[Tue Jul 27 2021 21:07:10.518]  LOG      non debounced print.
[Tue Jul 27 2021 21:07:10.695]  LOG      non debounced print.
[Tue Jul 27 2021 21:07:10.861]  LOG      non debounced print.
[Tue Jul 27 2021 21:07:11.270]  LOG      non debounced print.
[Tue Jul 27 2021 21:07:11.207]  LOG      non debounced print.
[Tue Jul 27 2021 21:07:11.374]  LOG      non debounced print.
[Tue Jul 27 2021 21:07:11.540]  LOG      non debounced print.
[Tue Jul 27 2021 21:07:11.719]  LOG      non debounced print.
[Tue Jul 27 2021 21:07:11.888]  LOG      non debounced print.
[Tue Jul 27 2021 21:07:12.550]  LOG      non debounced print.
[Tue Jul 27 2021 21:07:12.221]  LOG      non debounced print.
[Tue Jul 27 2021 21:07:12.398]  LOG      non debounced print.
[Tue Jul 27 2021 21:07:12.557]  LOG      non debounced print.
[Tue Jul 27 2021 21:07:13.472]  LOG      non debounced print.
[Tue Jul 27 2021 21:07:14.395]  LOG      non debounced print.
[Tue Jul 27 2021 21:07:15.110]  LOG      non debounced print.
[Tue Jul 27 2021 21:07:15.518]  LOG      non debounced print.
[Tue Jul 27 2021 21:07:15.728]  LOG      non debounced print.
[Tue Jul 27 2021 21:07:16.234]  LOG      non debounced print.
[Tue Jul 27 2021 21:07:16.484]  LOG      non debounced print.
[Tue Jul 27 2021 21:07:16.780]  LOG      non debounced print.
[Tue Jul 27 2021 21:07:17.268]  LOG      non debounced print.
[Tue Jul 27 2021 21:07:17.446]  LOG      non debounced print.
[Tue Jul 27 2021 21:07:17.990]  LOG      non debounced print.
[Tue Jul 27 2021 21:07:18.325]  LOG      non debounced print.
[Tue Jul 27 2021 21:07:18.706]  LOG      non debounced print.
[Tue Jul 27 2021 21:07:18.953]  LOG      non debounced print.
[Tue Jul 27 2021 21:07:19.148]  LOG      non debounced print.
[Tue Jul 27 2021 21:07:19.616]  LOG      non debounced print.
[Tue Jul 27 2021 21:07:19.808]  LOG      non debounced print.
[Tue Jul 27 2021 21:07:20.101]  LOG      non debounced print.
[Tue Jul 27 2021 21:07:20.321]  LOG      non debounced print.
[Tue Jul 27 2021 21:07:20.521]  LOG      non debounced print.
[Tue Jul 27 2021 21:07:20.722]  LOG      non debounced print.
[Tue Jul 27 2021 21:07:20.888]  LOG      non debounced print.
[Tue Jul 27 2021 21:07:21.760]  LOG      non debounced print.
[Tue Jul 27 2021 21:07:21.270]  LOG      non debounced print.
[Tue Jul 27 2021 21:07:21.463]  LOG      non debounced print.
[Tue Jul 27 2021 21:07:21.660]  LOG      non debounced print.
[Tue Jul 27 2021 21:07:21.864]  LOG      non debounced print.
[Tue Jul 27 2021 21:07:22.250]  LOG      non debounced print.
[Tue Jul 27 2021 21:07:22.213]  LOG      non debounced print.
[Tue Jul 27 2021 21:07:22.399]  LOG      non debounced print.
[Tue Jul 27 2021 21:07:22.758]  LOG      non debounced print.
[Tue Jul 27 2021 21:07:22.946]  LOG      non debounced print.
[Tue Jul 27 2021 21:07:23.149]  LOG      non debounced print.
[Tue Jul 27 2021 21:07:23.329]  LOG      non debounced print.
[Tue Jul 27 2021 21:07:23.529]  LOG      non debounced print.
[Tue Jul 27 2021 21:07:23.730]  LOG      non debounced print.
[Tue Jul 27 2021 21:07:23.917]  LOG      non debounced print.
[Tue Jul 27 2021 21:07:24.114]  LOG      non debounced print.
[Tue Jul 27 2021 21:07:24.275]  LOG      non debounced print.
[Tue Jul 27 2021 21:07:25.348]  LOG      DEBOUNCED PRINT
[Tue Jul 27 2021 21:07:27.358]  LOG      non debounced print.
[Tue Jul 27 2021 21:07:27.542]  LOG      non debounced print.
[Tue Jul 27 2021 21:07:27.916]  LOG      non debounced print.
[Tue Jul 27 2021 21:07:28.942]  LOG      DEBOUNCED PRINT
[Tue Jul 27 2021 21:07:32.322]  LOG      non debounced print.
[Tue Jul 27 2021 21:07:32.938]  LOG      non debounced print.
[Tue Jul 27 2021 21:07:34.560]  LOG      DEBOUNCED PRINT

Dependency:
    "lodash": "^4.17.21",


text:
Q: Zapier: How to make sure that I return items only once for polling trigger I am implementing a Zapier Integration's polling trigger. I have built a trigger and an API which serves the data correctly. However my concern is about: how to make sure that I provide the new data only, when zapier polls.
I know about the deduplication mechanism. I provide ids in all the items and Zapier makes sure that one item is used only once. However in my application the items can go into hundreds very quickly and in months they will be in thousands and beyond. I want an optimised solution where I serve only the items which will eventually be used by Zapier, thus reducing the memory usage in my application.
Some timestamp can be save for every call, which I can store inside my application but that will not be a foolproof solution. Same API can be used by user in multiple zaps, plus there are sample calls etc.

A: Great question! The simplest way to do this is to add a date parameter to your API that lets you filter for items created after that date.
Then, in your Zapier code, provide that param for all trigger calls. I'd set the time to 24 hours ago. So, when a trigger fires, it'll only get items created in the last 24 hours. That could be a big list, but items will cycle out after a day.


text:
Q: View disappears near end of RotationY animation I'm attempting to put together a slick animation in which a view that takes up most of the screen space rotates to reveal another view on the rear side:
rotatingView.animate().rotationY(90)
            .setDuration(250)
            .setInterpolator(new AccelerateInterpolator())
            .withEndAction( /* Runnable that sets up the rear side of the view,
                               then rotates Y another 90 degrees */);

Problem is, about 80% of the way through this animation, the view disappears. The view doesn't reappear until about 20% of the way into the second half. Put another way, it disappears at 11 o'clock and reappears at 1 o'clock. Why is this?

A: I finally stumbled on the answer to this type of problem.  UsesetCameraDistance(), but note that:

The distance is expressed in "depth pixels." The default distance depends on the screen density. For instance, on a medium density display, the default distance is 1280. On a high density display, the default distance is 1920.

So, to "raise" the camera to the point where the near edge of a view doesn't clip it, set the distance to several times the "default" distance.  In my case with several tablet screens, a value of 4000f was needed.  See the link for more onsetCameraDistance()parameter calculation.
You may want to combinesetCameraDistance()with clipToPadding="false" and clipChildren="false" in your XML file; these control masking of one view by another.
Also, I suspect YMMV across different Android releases and vendors.


text:
Q: "inline" editing in a mvc 4 list of objects I have a strange problem and I don't know if this is actually possible.
What I want is, to be able to list all the values from my model and and edit them directly in the list.
Here's what I have:
Model Linker:
     public class StoreLinkerModel
      {
        //public Guid? id { get; set; }
        public IEnumerable<Stores> StoresAndOpeninghours { get; set; }
      }

public class Stores
  {
    public long ID { get; set; }
    public string StoreName { get; set; }
    public string Address { get; set; }
    public string Zip { get; set; }
    public string City { get; set; }
}

My Controller:
public ActionResult Overview()
      {

        var model = new StoreLinkerModel
        {
          StoresAndOpeninghours = new[]
            {
              new Stores()
                {
                  ID = 0,
                  Address = "Enghavevej 70"
                },
                new Stores()
                  {
                    ID=1,
                    Address = "Løngangsgade 30"
                  },
            }

        };
        return View(model);
      }

      [HttpPost]
      public ActionResult Overview(StoreLinkerModel model)
      {
        if (ModelState.IsValid)
        {
          var x = "go go go";

        }

        return RedirectToAction("Overview");
      }

My overview.aspx page:
@model streetoffrs.web.Models.StoreLinkerModel
@{
    ViewBag.Title = "Overview";
    Layout = "~/Views/Shared/_dashboard.cshtml";
}

@Html.EditorFor(x => x.StoresAndOpeninghours)

and my EditorTemplate stores.aspx
@model streetoffrs.web.Models.Stores

@using (Html.BeginForm("Overview", "Dashboard", FormMethod.Post, new { name = "id" + @Html.DisplayFor(m => m.ID) }))
{

  @Html.EditorFor(x => x.Address)
  <input type="submit" class="left btn btn-primary" value="Ret butiksdata">
}
<br />

The list is being generated as it should, and when I hit the first button at the first editorfor it will post the model to my controller, but when I push the 2nd button, the model is null, but the first button still works!
Is this possible at all, if yes what am I missing, if not, tell me how I can accomplish this.
thanks in advance!

A: you need edit post action like this:
  [HttpPost]
  public ActionResult Overview(StoreLinkerModel model)
  {
    if (ModelState.IsValid)
    {
      var x = "go go go";

    }

    return View(model);
  }

the RedirectToAction will be go to the first Overview Action,so you will be lost the data.


text:
Q: Azure - how to route traffic away from a server during an update What's the best practice for routing traffic away from an Azure website / role when you want to run an update.
Would you simply route away traffic using the Traffic Manager and wait the 5 minutes or however long you have the DNS TTL set to?
That would work fine but it adds a lot of delay to deployments. Is there a better/faster way to route traffic away during a deployment?

A: You need to use what is called "Staged Deployment" in Azure.
When you create a site/role on Azure, you're actually using a production environment to host your site/roles in, this production environment is live and is serving people in real time, thus you can't actually do testing and bug fixing on it.
The Staged Deployment solution, you can create a replica of your production environment, this environment is live but it is not being used to serve people on the internet, so you may use it for your testing and bug fixing purposes.
Once your testing and fixing is done, you can "swap" both environment by a click of a button, where the production will become a staged environment, and the staged environment will become a production.
The benefit of this approach is that

*

*You will be avoiding all downtime for your end users when moving from testing to production.

*You can swap back the environments back to the way they were in case you found a problem in your new sites or app.

*You will have an environment that matches your production for your testing purposes that can be later used as a production site.

More info can be found here on how to use and activate the feature: http://azure.microsoft.com/en-us/documentation/articles/web-sites-staged-publishing/
Hope this helps.


text:
Q: Visual studio 2015 hitting breakpoint When I run the code I get the messege Scattegories.exe has triggered a breakpoint.
It happens after I enter the 12th nuber into my array, but the array still has a "spot" for it.
There is also a thread so maybe it's that, but it seems to work fine.
So I don't know what it is, thank you.
// A program to keep track of points and time and to give a random letter for the game scattergories
#include<iostream>
#include<ctime>
#include<string>
#include <chrono>
#include <thread>
using std::cout;
using std::cin;
using std::string;
using std::getline;
using namespace std::chrono_literals;
using std::this_thread::sleep_for;

void ltr()    //gives a random letter
{
    char letter;
    letter = rand() % 26 + 65;         //assigns a random letter in ascii code to a char (resulting in a random letter)
    cout << "The letter is " << letter << "\n";
}

void timer()
{
    cout << "You got 1.5 minutes to finish\n";    //Changing the duration of the timer is done by changing the value of 'i' in the "for" loop
    for (int i = 10; i > 0; i--)
    {
        sleep_for(1s);
    }
    cout << "DING DONG!!! DING DONG!!! Time's up!!!\n";
}

void table(int plr)
{
    string ctr[12] = { "A cuntry", "A city", "An animal", "A plant", "A object", "A name", "Food", "Drink", "A game", "A movie", "A book", "A famous person" };
    string lst[6][12];           //first dimantion: how many players. second dimantion: how many catagories, third dimantion(if added) will be the round
    cin.ignore();                  //To avoid the "getline" reading the last input
    for (int x = 0; x<plr; x++)       //the player changes only after the previus player finishes
    {
        std::thread t1(timer);       //gives time to write the words. Optimaly it would run in the background while each player writes the words.
        for (int i = 0; i<12; i++)        //changing catagory
        {
            cout << ctr[i] << ": ";
            getline(cin, lst[x][i]);
        }
        system("cls");
        cout << "Next player\n";
    }
    for (int x = 0; x<plr; x++)                   //this part (the whole "for" loop) is for confirming evreything is writen down
    {
        cout << "Player number " << x + 1 << ": ";
        for (int i = 0; i<12; i++)
        {
            cout << lst[x][i] << "    ";
        }
        cout << "\n";
    }
    sleep_for(5s);
}

int points()        //points gained per round
{
    int a, b, c, sum;
    cout << "How many sections only you got?\n";          //worth 15 points
    cin >> a;
    cout << "How many words only you got?\n";       //worth 10 points
    cin >> b;
    cout << "How many words you and another person got?\n";    //worth 5 points
    cin >> c;
    sum = a * 15 + b * 10 + c * 5;
    return sum;           //Note: It doesn't matter how many sections there are.
}

int act()    //running the program
{
    int Players, Points[6];
    cout << "How many people are playing? (Up to six players)";
    cin >> Players;
    ltr();
    table(Players);
    //Points = points();
    cout << "You have earned " << Points << " this round\n\n";
    return 1;
}

int main()
{
    auto start = std::chrono::high_resolution_clock::now();
    srand(time(NULL));    //gives a differant pattern of letters every time
    int Points;
    Points = act();
    for (;;)          //inf loop
    {
        int ph;
        cout << "Press 1 to continue or anything else to stop\n";
        cin >> ph;
        if (ph == 1)
        {
            Points += act();    //keeping score of the rounds
        }
        else
        {
            auto end = std::chrono::high_resolution_clock::now();
            break;
        }
    }
    cout << "You have earned a total of " << Points << " great job!";
    sleep_for(5s);       //time to read the last text
    return 0;
}

/*
   To do list:
   -Convert to arduino
   -Make timer work in background of of table
   -Check if words in the table (for differant players) are the same and give points accordingly
   -Check if words are actual words (connect an online dictonary?)
   -Make interface? (if possible and I have time to learn how)
   -Think of what to do with Hardwear
   -Comment rest of the code
*/

A: std::thread::~thread says this :

If *this has an associated thread (joinable() == true), std::terminate() is called.

If you ever destroy a std::thread that is joinable, std::terminate() is called. Visual Studio kindly breaks on std::terminate() to allow you to inspect what went wrong. In void table(int plr) you create a thread with std::thread t1(timer); but you never join with it or detach from it.
To solve this, your timer method should be changed to return immediately when the player has finished his turn, and then the main thread should join with it.


text:
Q: What is not_found in this geocouch error? I'm a bit new to geocouch, and have basically no experience with erlang, currently I am getting what I think might be an index corruption that leads to badmatch errors, but I'm not entirely sure. This response is returned after the server has been running for a while, and seems to increase in frequency over time. If I cleanup the spatial indexes, the error goes away for a few hours.
We are currently running couchbase-server-community_x86_64_1.1.deb and couchbase server says its version 1.0.2 in futon.
The query we are sending looks something like this:
'_design/blah/_spatial/customView?43.07960959232345743,-88.20843166111015421,43.08021240619384429,-88.20760633888984614'

where customView looks like this:
"customView": "function(doc) {if (doc.type && doc.type == \"Custom\") {emit({type: \"Point\", coordinates: [doc.loc[0], doc.loc[1]]}, doc);}};"

and the Custom doc type has this kind entry:
"loc": [
       42.873055,
       -73.767514
   ],

the response we get is this
ServerError: (500, ("{{badmatch,not_found},\n [{vtree,'-add_remove/5-fun-0-',3},\n  {lists,foldl,3},\n  {vtree,add_remove,5},\n  {couch_spatial_updater,'-write_changes/4-fun-2-',5},\n  {lists,zipwith,3},\n  {couch_spatial_updater,write_changes,4},\n  {couch_spatial_updater,update,2}]}", '{gen_server,call,[<0.12711.178>,{request_group,241518},infinity]}'))

so the issue is I understand this is a callstack, but I'm not entirely sure whats going on and was hoping someone could assist by providing some clues/context on what kind of error this is, ie. is this actually a corrupt index? or is this a known bug in the version of geocouch I'm using? or even what kind of actions can cause a not_found error? etc.
Thanks

A: Your query URL looks wrong, it's missing the "bbox=", but that's probably not the issue.
You are using a very old version of GeoCouch, it's actually a version using an now unsupported product of Couchbase. I suggest that you upgrade to a recent version of Apache CouchDB together with a recent version of GeoCouch.
Let me know if you still see the same error.


text:
Q: What's the proper way to save data? I'm making a game like logo quiz;
Would using the below code be appropriate for saving and loading data:
This code would only allow the user to play that specific logo once and once only!
of course I'd wire up each and every outlet that has an action!
Is this the right way or should I try something else?
[super viewDidLoad];

{  NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
   NSString *loadstring = [defaults objectForKey:@"savedstring"];
   [_textbox setText:loadstring];
}

- (IBAction)btncheck:(id)sender {
   NSString *savestring = _textbox.text;
   NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
   [defaults setObject:savestring forKey:@"savedstring"];
   [defaults synchronize];
}

A: I just wanted to add a bit of clarity, if this is the actual code you are going to use then I don't think it is appropriate. You mention that you only want each logo to be answered once and once only. How does saving a string to NSUserDefaults achieve this?
Given the code and assuming you are letting the user enter something into the text box you will get a different value stored with the key savedstring no previous value will be remembered.
Or assuming you don't allow the user to add anything into the textbox and keep adding to the string and saving it you don't show how you are going to check that its already been used/checked?
Instead of a string you could save a NSDictionary to NSUserDefaults, Saving NSDictionary to NSUserDefaults, each key could relate to the logo. You could then just check if the key already exists in the dictionary. Add any new ones to that dictionary and save it again.


text:
Q: how can i use fb_server_fbml helper method in facebooker2? I am developing a facebook app using rails 3 and facebooker2
i cannot find any example on how to use fb_server_fbml helper method.
what is "proc" in its paramter. Can anyone provide me with sample code?
Thanks

A: The &proc parameter is used as a content block that is inserted between the <fb:serverFbml> tags. You can learn more about block helpers and differences between Rails 2.3 and Rails 3 here: Block Helpers in Rails 3
So, try something like this:
<% fb_server_fbml do %>
  <%#Insert here your content %>
<% end %>

If you want to use the request form, try the following:
<% fb_server_fbml do %>
  <% fb_request_form("Your app name","http://www.example.com/callback","Try this out!") do %>
    <%= fb_multi_friend_selector("Invite your friends:", {:rows => 3}) %>
  <% end %>
<% end %>


text:
Q: How to get `geom_smooth` style CIs when using `emmip` I have a model and a graph in R:
fit.lmer = lmer(std_brain ~ std_beh*type*taught + (1|subject/run), data=avg_data)
graph_lmer =  emmip(fit.lmer, type~std_beh | taught , at=list(type=type, std_beh=std_beh,
                                                             taught=taught), CIs=FALSE)

I always set CIs to false because the default style of the CIs makes the graph totally illegible -- there's a colorful vertical bar at every marking point on three different lines.  You can't see the actual lines on the graph.  But I see examples of the kind of bands I'd like using geom_smooth and stat_smooth with ggplot. Here's an example -- there's a solid band, rather than bars on points, and it's gray:  However, I am not graphing points, I'm graphing marginal means, and so I don't think geom_smooth or stat_smooth are appropriate.  What I really want is just to apply that style to my emmip graph.  I can't find an example.