text:
Q: Error 1046:Type not found or was not a compile-time constant:Listing2 I am trying to add a movieclip that is generated through a loop from SearchVectorTest class file, and put that into sresultnologin class file. Then i will make that movieclip clickable, and when clicked, goes to next class,display a new stage, pull the information from that specific stored in that movieclip, and pull the rest of the information from the database and display them.
I am having an error at the moment, Type not found. I can't seem to add the Movieclip(box) as a button. on this line var newListing:Listing2 = Bolder.getChildAt(0);
sresultnologin.as
    package com.clark

{
import com.clark.SearchVectorTest;
    import flash.display.*;
    import flash.events.Event;
    import flash.events.MouseEvent;
    import flash.display.Stage;
    import fl.controls.Button;
    import flash.display.MovieClip;
    import flash.text.TextField;
    import flash.text.TextFieldAutoSize;
    import flash.text.TextFormat;
    import flash.text.TextFormatAlign;
    import flash.display.Sprite;
    import flash.events.Event;
    import flash.events.MouseEvent;

       public class sresultnologin extends MovieClip {

public var s1:Searchreult = new Searchreult ();

               public function sresultnologin(){
                  // init

            addEventListener(Event.ADDED_TO_STAGE, onadded);
         function onadded (event:Event):void{

            s1.x=-10;
            s1.y=10;

            addChild(s1);
         }

var s3:SearchVectorTest= new SearchVectorTest(new Vector.<searchVO1>);
                 addChild (s3);

            s1.SRhome.addEventListener(MouseEvent.CLICK, fl_ClickToGoTol);
            s1.ARsearch.addEventListener(MouseEvent.CLICK, fl_ClickToGosearch);

 if( s3.listings.length > 0 )
        {
            // get the first listing in the listing array
            var newListing:Listing8 = s3.listings[0];
            newListing.addEventListener(MouseEvent.CLICK, gotoscener);
        }
        else
        {

        }

           }

               // private methods
           private function gotoscener(event:MouseEvent):void
        {

            var s9:Listingdetail = new Listingdetail ();
    removeChild(s1);
            addChild(s9);

       }

        private function fl_ClickToGoTol(event:MouseEvent):void
        {

            var s9:Account = new Account ();
    removeChild(s1);
            addChild(s9);

        }

        private function fl_ClickToGosearch(event:MouseEvent):void
        {

            var s9:searchVO1 = new searchVO1 ();
    removeChild(s1);
            addChild(s9);

       }

}
}

SearchVectorTest.as
   package  com.clark
{
    import flash.display.MovieClip;
    import flash.text.TextField;
    import flash.text.TextFieldAutoSize;
    import flash.text.TextFormat;
    import flash.text.TextFormatAlign;
    import flash.display.Sprite;
    import flash.events.Event;
    import flash.events.MouseEvent;
    public class SearchVectorTest extends MovieClip
    {
        public var listings:Vector.<Listing8>;

        public function SearchVectorTest(test:Vector.<searchVO1>)
        {

for (var j:int = 0; j < test.length; j++)
            {

                trace(test[j].nobed);
                trace(test[j].zip);
                trace(test[j].Location);
                trace(test[j].price);

        }

            var len:int = test ? test.length : 0;
         // create your vector for your listings with the len size
         listings = new Vector.<Listing8>(len, true);
            var currentY:int = 200;

            for (var k:int = 0; k < test.length; k++)
            {
                var Bolder:Listing8 = new Listing8();

                Bolder.x=20;

                var bf:TextField = new TextField();
                var bf1:TextField = new TextField();
                var bf2:TextField = new TextField();
                var bf3:TextField = new TextField();

                bf3.width = 100;
                bf.defaultTextFormat = new TextFormat("Arial", 12, 0, null, null, null, null, null, TextFormatAlign.CENTER);

                bf.width = 100;
                bf.autoSize = TextFieldAutoSize.CENTER;
                bf1.width = 100;
                bf1.autoSize = TextFieldAutoSize.CENTER;
                bf2.autoSize = TextFieldAutoSize.CENTER;
                bf3.autoSize = TextFieldAutoSize.CENTER;
                bf3.width = 100;
                bf1.y= bf.height+5;

                bf.text = test[k].nobed;
                bf1.text = test[k].zip;
                bf2.text = test[k].Location;
                bf3.text = test[k].price;

                bf.x = (Bolder.height-bf.height)*.2
                Bolder.addChild(bf);
                Bolder.addChild(bf1);
                Bolder.addChild(bf2);
                Bolder.addChild(bf3);
                Bolder.properties = test[k].nobed;
                Bolder.properties = test[k].zip;

                    // position the object based on the accumulating variable.
                Bolder.y = currentY;

                addChild(Bolder);
                 Bolder.mouseChildren = false;    // ignore children mouseEvents
            Bolder.mouseEnabled = true;      // enable mouse on the object - normally set to true by default
            Bolder.useHandCursor = true;     // add hand cursor on mouse over
            Bolder.buttonMode = true;
                 listings[k] = Bolder;
                currentY += Bolder.height + 10;
            }

        }

    }

}

SearchVO1
package com.clark
{

    import flash.display.MovieClip;
    import flash.events.Event;
    import flash.events.MouseEvent;
    import flash.display.Stage;
    import fl.controls.Button;
    import flash.net.URLLoader;
    import flash.net.URLRequest;
    import flash.net.URLRequestMethod;
    import flash.net.URLLoaderDataFormat;
    import flash.net.URLVariables;
    import flash.utils.*;
    import flash.sampler.NewObjectSample;
    import flash.text.TextField;
    import flash.text.TextFieldAutoSize;
import flash.text.TextFormat;
    import flash.text.TextFormatAlign;

       public class searchVO1 extends MovieClip {
        private var Arvariables:URLVariables;
        private var SrSend:URLRequest;
        private var SaLoader:URLLoader;
           public var nobed:String;
        public var zip:String;
        public var Location:String;
        public var price:String;
           public var callMethod:Function;

public var s1:searchpage = new searchpage ();

               public function searchVO1():void{

addEventListener(Event.ADDED_TO_STAGE, onadded);                  // init
function onadded (event:Event):void{

            s1.x=-10;
            s1.y=10;

            addChild(s1);
             s1.account.addEventListener(MouseEvent.CLICK, fl_ClickToGoToaccount);
             s1.searchs.addEventListener(MouseEvent.CLICK, ValidateAndsearch);
            s1.Au.addEventListener(MouseEvent.CLICK, fl_ClickToGoToautomatch);
            s1.setting.addEventListener(MouseEvent.CLICK, fl_ClickToGoToss);
            s1.Shome.addEventListener(MouseEvent.CLICK, fl_ClickToGoTohom);

            // Build the varSend variable
            SrSend = new URLRequest("http://localhost/search.php");
            SrSend.method = URLRequestMethod.POST;
                   Arvariables = new URLVariables;
            SrSend.data = Arvariables;

            SaLoader = new URLLoader();
            SaLoader.dataFormat = URLLoaderDataFormat.TEXT;
            SaLoader.addEventListener(Event.COMPLETE,Asandler);

 // private methods

           function Asandler(event:Event):void{

 // retrieve data from php call
var resultString :String = event.target.data;
// parse result string as json object and cast it to array
var resultArray  :Array  = JSON.parse( resultString ) as Array;
// get the length of the result set
var len:int = resultArray.length;

// create vector of SearchVO
var searchVOs:Vector.<searchVO1> = new Vector.<searchVO1>();
// loop the result array
               var i:int;
for(i=0; i<len; i++ )
{
    searchVOs[i] = new searchVO1();
    searchVOs[i].nobed = resultArray[i].nobed;
    searchVOs[i].zip = resultArray[i].zip;
    searchVOs[i].Location = resultArray[i].Location;
    searchVOs[i].price =  resultArray[i].price;
}

// call a function to create your boxes

// or maybe create your SearchVector class and pass it your search vector
var mySearchVector:SearchVectorTest = new SearchVectorTest(searchVOs);
addChild(mySearchVector);
       }
   }
   }

    public function searchVOs( nobed:String, zip:String, location:String, price:String )
        {
            this.nobed      = nobed;
            this.zip        = zip;
            this.Location   = Location;
            this.price      = price;
        }
        public function ValidateAndsearch (event:MouseEvent):void {

        // validate fields

         Arvariables.nobed = s1.nobed.text;
        Arvariables.zip = s1.zip.text;
            Arvariables.Location = s1.Location.text;
            Arvariables.price = s1.price.text;
    SaLoader.load(SrSend);
            var s7:sresultnologin = new sresultnologin()
    removeChild(s1);
            addChild(s7);

        }
         // close else condition for error handling

         // close validate and send function

        private function fl_ClickToGoToautomatch(event:MouseEvent):void
        {
            var s7:Auto = new Auto ();
    removeChild(s1);
            addChild(s7);
        }

        private function fl_ClickToGoToss(event:MouseEvent):void
        {
            //
        }
        private function fl_ClickToGoToaccount(event:MouseEvent):void
        {
            var s7:Account = new Account ();
    removeChild(s1);
            addChild(s7);
        }

        private function fl_ClickToGoTohom(event:MouseEvent):void
        {

            var s7:homepage = new homepage ();
    removeChild(s1);
            addChild(s7);

        }

       }

}

A: i think you have to remove these lines:
public var Bolder:MovieClip;
public var Listing2:MovieClip;

and try to get your Listing2 object like this:
var newListing:Listing2 = s3.getChildAt(0);

but if you want to access your listings in the SearchVectorTest class it's better to keep a public reference of them like this (maybe in an array or a vector):
SearchVectortest class:
public class SearchVectorTest extends MovieClip
{
    /** the array of listings **/
    public var listings:Vector.<Listing2>;

    public function SearchVectorTest(test:Vector.<searchVO1>)
    {
         // put the array length in a variable -> if test = null make len = 0
         var len:int = test ? test.length : 0;
         // create your vector for your listings with the len size
         listings = new Vector.<Listing2>(len, true);
         // ...
         for( var k:int = 0; k < len; k++ )
         {
            var bolder:Listing2 = new Listing2();

            bolder.mouseChildren = false;    // ignore children mouseEvents
            bolder.mouseEnabled = true;      // enable mouse on the object - normally set to true by default
            bolder.useHandCursor = true;     // add hand cursor on mouse over
            bolder.buttonMode = true;        // this must be set to true to have hand cursor
            // add your linsting to the vector
            listings[k] = bolder;
            //...
         }
         // ...
    }
}

after that you could get your listing like this:
sresultnologin.as
public class sresultnologin extends MovieClip
{
    public var s1           :Searchreult = new Searchreult ();

    //public var Bolder     :MovieClip;     // never used -> useless
    //public var Listing2   :MovieClip;     // never used -> useless

    public function sresultnologin()
    {
        // init
        addEventListener(Event.ADDED_TO_STAGE, onadded);

        function onadded (event:Event):void
        {
            s1.x=-10;
            s1.y=10;

            addChild(s1);
        }

        var s3:SearchVectorTest= new SearchVectorTest(new Vector.<searchVO1>);
        addChild (s3);

        s1.SRhome.addEventListener(MouseEvent.CLICK, fl_ClickToGoTol);
        s1.ARsearch.addEventListener(MouseEvent.CLICK, fl_ClickToGosearch);

        // verify if there are enties in the array
        if( s3.listings.length > 0 )
        {
            // get the first listing in the listing array
            var newListing:Listing2 = s3.listings[0];
            newListing.addEventListener(MouseEvent.CLICK, goto);
        }
        else
        {
            // do something if there are no results
        }
    }
    //...
}

hope that helps ;)


text:
Q: Is there a way to make my touchscreen monitor work sooner after startup? I recently got an iBUYPOWER desktop tower and a 24" acer touchscreen monitor, which I absolutely love.
My only problem is, while my computer starts up from a powered off state very quickly(less than 5 seconds usually), I sometimes have to wait as long as 20-30 seconds for the touchscreen monitor to start recognizing my finger touches.  I'm running Windows 8.1 which requires a password or pin to unlock the computer after it's been off, and I like to use the touchscreen to enter my pin, so I'd rather not have to wait.  I've been forced to use mouse and keyboard to sign in, which is obviously just a convenience issue, but like I said, I'd like to have my finger touches recognized as soon as my computer starts up.
Is this a BIOS thing?  Can I change some kind of boot order so my computer loads up the monitor right after it loads up the OS?  If you need more info about my computer or hardware, please leave a comment.

redpajama_set_name: RedPajamaStackExchange


text:
Q: send mail with smtp and Qt I have a problem in sending mails by Qt
my code is based on this http://www.qtcentre.org/threads/2221-Sending-email-using-Qt.
but the problem is that the program told me that the user was not authenticated

thanks for the help

A: I actually wrote a modified version of that very same code that handles SMTP auth and multiple recipients, you can grab it from GitHub. It's not perfect but it should work, you'll need a username and password for your mail server encoded as Base64.

A: Witold Wysota's qwwsmtpclient class might be what you're looking for— it's a reasonably complete implementation of the mail-submission part of SMTP but it's just a simple class not a part of a huge framework.


text:
Q: Combobox to retain value I have a textbox which is being used as a combobox when using the following code:
Sys.Application.add_load(function () {
    $('#<%=txtCatToUpdate.ClientID %>').combobox({
        webServiceMethodName: Magelia.WebStore.Admin.Scripts.Services.AutoCompleteServices.GetCategoriesFull,
        additionalWebServiceParameter: ['<%=this.Page.UnitOfWorkContext.StoreId.ToString() %>'],
        objectIdGetter: 'CategoryId',
        labelGetter: function (o) { if (o != null) { return o.CatalogCode + ' > ' + o.CategoryCode } },
        valueGetter: function (o) { if (o != null) { return o.CatalogCode + ' > ' + o.CategoryCode } },
        hiddenField: $('#<%=hfCatToUpdateId.ClientID %>')
    });
});

My problem is that if the category does not exists, it gets cleared. It shouldn't get cleared. Could anyone please help me? Thanks


text:
Q: Upper limit of Schumann resonance harmonics? This is a re-post from the Earth Science Stack Exchange which was posted two month ago. Due to the nature of the question and the SE site, it might be better to post this question here.

As the Earth's surface-ionospheric gap acts as a resonator for electromagnetic waves, it should have several harmonic values from the base, fundamental frequency of 7.83 Hz. (Schumann resonances) These are integer multiples, but there is a limit as to how high the frequency can go for it to have an effect, especially so for the Schumann resonance, as the gap between the lithosphere and ionosphere can change due to events in space, mainly the sun. Hence, what is the maximum range of integer frequency values for the Schumann resonance?

 source


text:
Q: Problema con estilos en formulario creado con ASP.NET MVC 5 Estoy creando un formulario utilizando tecnologías MVC de Microsoft. Básicamente es un
 que se dividen para tener dos columnas y ahí poner las etiquetas y controles. El problema es que la caja de texto del Email sale desalineada.
Este es el formulario:

Este es el código con la herramienta Visual Studio:

Y esta es la forma de cómo se renderea en Chrome:

¿Alguna idea del por qué esté pasando esto?

A: Una forma práctica y efectiva de crear este tipo de alineación es agregando todos estos elementos dentro de una tabla, asi no tienes que preocuparte porque la tabla organiza de forma automática los elementos que la componen. Seria algo asi:

 Nombre	  <input type="text" size="30">

 Apellido Materno	  <input type="text" size="30">

Y asi sucesivamente. Espero te sirva.


text:
Q: Is it true that etymology is the leading tool to understand the correct use of words? In discussions about the meanings of words I often find participants bring up the etymologies as though they are conclusive deciding factors.
On the other hand there is concept of the "etymological fallacy" as discussed in Wikipedia.

The etymological fallacy is a genetic fallacy that holds that the present-day meaning of a word or phrase should necessarily be similar to its historical meaning. This is a linguistic misconception, and is sometimes used as a basis for linguistic prescription. An argument constitutes an etymological fallacy if it makes a claim about the present meaning of a word based exclusively on its etymology.
An etymological fallacy may involve looking for the true meaning of words by delving into their etymologies, or claiming that a word should be used in a particular way because it has a particular etymology.

Which is true? Or is the truth somewhere between? If words change over history how relevant is their origin to their current meaning? If the etymology of a word is a trump card which can settle debates about correct usage of words, does this mean words cannot in fact change over time?

A: The etymological fallacy does not state that knowing the etymology of a word will lead you to misunderstand its present meaning, it merely states that the original meaning is not necessarily systematically equated to the present meaning which, on the face of it, seems a fair statement.
The etymological fallacy is a genetic fallacy that holds, erroneously, that the historical meaning of a word or phrase is necessarily similar to its actual present-day meaning.
That is however a reductive use of the word etymology itself.
Etymology cannot be reduced to the original meaning of a word (if there ever was such a thing – words themselves having a life of their own).  Instead it has to be envisioned as the whole path that leads from former meanings to present day meanings.  It is not a static snapshot taken at an arbitrary point in the past; it is, as much as one can reconstruct it, the whole history of how words and cultures interact with each other to lead from stems to words and meanings. It is a dynamic thing leading to the present.
Let's take just one example: to tally.  If you look it up online in the free dictionary, you will discover a whole list of apparently unrelated meanings such as:

*

*To reckon or count.

*To record by making a mark.

*to score (a point or goal) in a game or contest.

*To be alike; correspond or agree.

The way these seemingly unrelated meanings are actually connected becomes glaringly obvious if you know the etymology of the word: The base meaning of a tally is "a tick marked with notches to indicate amount owed or paid" (see French une entaille).
In the old times, people would keep counts of what they owed to each other by dividing a stick in two pieces and each time a new debt was contracted a new notch (a tally) was carved into the reunited pieces.  Each party would keep its own piece and, every now and then, accounts were settled with the two pieces matching.  Because two different sticks can't be broken in the same way, there was no possible argument.
This is the kind of gem etymology brings to the knowledge of a given language.

A: Emphatically not. Etymology will sometimes help you know what a word means and how to use it, but is never reliable for this purpose.

A: Since language is not something fixed and, instead, it evolves through usage, sometimes the modern word you know might be different (in usage/meaning/etc.) from the original form.
The etymology of a word will usually give you an idea of its original meaning and where it comes from.
But remember this: Etymology isn't just related to the "original form" of some word, but it studies its evolution too, so that's why it's mostly reliable. Of course, this is unless there is some case of "unclear etymology" or the word has some obscure history.

A: Yes. From the etymology one can determine the current meaning or usage of a word. That's because the etymology is not just the origin of a word, but its whole historical development until present usage.
If etymology meant just the origin of a word, then the answer would be "no, etymology does not determine the current usage or meaning". But that's not the case.

A: To add a nuance, an etymology can help understand the current meaning (semantics) of a word but it is in no way the primary means (especially since if the history is non-trivial then it will have non-trivial changes in meaning). An etymology is useful for more latinate neologisms where the parts of the word are easily extractable and were intended by the neologizer.
More common methods for determining the semantics of words would be to see examples in context, lists of conceptually similar words, or simple exchange of alternates in context.

A: This is another of those 'Yes and No' questions.
Google itself gives two definitions of the word etymology, though to be honest, I don't see much difference between them.
The important thing is both definitions encompass 'subsequent development' as well as 'origin'. So if you want to go by the book, the etymology of a word inherently includes its current meaning. It's just that we're used to seeing etymologies in dictionaries, immediately after the definition(s). So we tend to think it just means the historical stuff.
The reason it's a bit of a hot potato is simply that there will always be some people arguing in favour of the historical meaning of a word, while the rest of us have moved on to accepting some new sense.


text:
Q: Need to call custom action when form is requesting for sots am using rasa 1.9.5.
I have a form that gets activated and it will ask for the slots to fill. When it is asking for a slot to fill it's calling utter_slots_name. But my requirement is, I need to call custom action instead like action_slots_name.
I need to call custom action for all slot filling questions.
NLU:
## intent:greet
- Hi
- Hello
- I need a help
- just need help
- can you server me

## intent: greeting_with_name
- Hi I am [sharath](name), I need some services
- Hi myself [sharath](name), Need some services
- Hi this is [sharath](name), need some services

## intent: are_u_bot
- are you a bot?
- are you a human?
- am I talking to a bot?
- am I talking to a human?

## intent: my_name_is
- my name is [sharath](name)
- [sharath](name)
- I am [sharath](name)
- Myself [sharath](name)

Stories:
## bot challenge
* bot_challenge
  - utter_iamabot

## happy path
* greet
  - action_greeting
  - user_details
  - form{"name":"user_details"}
  - form{"name":null}
  - action_askfor_services

Domain:
actions:
  - action_askfor_services
  - action_slots_name
  - user_details
  - action_greeting

intents:
  - greet
  - bot_challenge
  - my_name_is
  - greeting_with_name

form:
  - user_details

entities:
  - name
  - phoneNo
  - tenentId
  - language

slots:
  language:
    type: text
  name:
    type: text
  phoneNo:
    type: text
  tenentId:
    type: text
  requested_slot:
    type: text

responses:
  utter_iamabot:
  - text: I am a bot, powered by Rasa.
  utter_bye:
  - text: bye

session_config:
  carry_over_slots_to_new_session: true
  session_expiration_time: 60


text:
Q: Shortcut to open terminal in `pwd` if active window is another terminal or Nautilus I have made a custom keybinding in Gnome such that Super+t opens a gnome terminal. Now I would like to improve it such that if the window active when pressing Super+t is Nautilus or another Gnome terminal, the opened terminal's working directory is the same as the previously active window. Allow me to present a few of the ideas which have failed:

*

*At least in Gnome terminal you get the desired behaviour from File -> Open Terminal (how about Nautilus?). You can add a shortcut Super+t to this action, however, it is overridden by the system-wide Super+t which opens a terminal at $HOME.

*I have seen some people in here alias the cd command such that it always stores the entered directory in a file. I do not think this is a good solution: You can use cd in one terminal, then switch to another and hit Super+t. You will not get the desired behaviour. I also don't like tinkering with cd in this way.

*I tried looking for ways to query Gnome for it's active window from bash (or Python), and possibly it's working directory. In X there's tools such as xdotool but I use Wayland. It seems that Wayland prevents such actions out of security.
Any suggestions much appreciated! Thank you.


text:
Q: need to give animation to revolution slider instead of slides I have wordpress site and i installed revolution slider in it.
site : http://secondplacecroatia.com/
Using 6 Slider in my home page..
Now , i want to animate each slider, repeating it i want to animate each slider.. Not individual slides...
Any one know ? how can i give fade in and slide up animation to each slider ???
Do i have simple solution with  jquery animate or other ??
$("").animate({}, "slow" );

A: To be honest i can not really follow what you try to achieve here. You have 6 sliders added into 1 page, each slider has "x" slides.  Normally all slider start the slideshow and rotating the slides in unlimited loops.  Dont really understand which kind of "animation" do you try to add to the sliders ?
As best, contact us directly via our support center at http://themepunch.com/support-center and we help you as good we can !


text:
Q: Why (sender as "something") have null value in c# windows forms app I'm trying to write an form_close event in C# windows forms app that will do different things depending on what control launched application close.
I have
    private void exitToolStripMenuItem_Click(object sender, EventArgs e)
    {
        Close();
    }

to close application from main menu, and
    private void frmMain_FormClosing(object sender, FormClosingEventArgs e)
    {
        if ((sender as ToolStripMenuItem).Name == @"exitToolStripMenuItem")
        { }
}

to process form_closing, and show different message depending on control.
Problem is, that value of "sender as toolstripmenuitem" is always null, and exception is thrown.
Can someone help me to fix this?

A: sender here is a Form itself.  That is why the problem appears.  To implement this task, you need to create a property in the form and set its value when you call the Form's Close method.  Then check this property value and show messages as required.
Another solution would be to create a new method and use it when you need to close it:
protected void CloseCore(object control) {
  // show message base on the control
  Close();
}

A: frmMain_FormClosing is attached to the Form, not to the ToolStripMenuItem, so the sender is the Form.
sender as ToolStripMenuItem will return null.
sender as Form will return the form.

A: The as keyword does an attempted cast on reference types only and returns null if the cast fails (including when the item itself is already null). This differs from explicit casting in that no exception is thrown on a failed cast.
You simply need to check for nulls. In this case, a ToolStripMenuItem will never be the sender for this event.
Using that keyword, your code is potentially unsafe as you do your cast assuming it will pass by immediately trying to access a member:
(sender as ToolStripMenuItem).Name == "";

Sometimes assuming it will pass is fine, I do that ocassionally when I know what it will do. In the general case however, you'll likely want to null check:
var typedSender = sender as ToolStripMenuItem;

if (typedSender != null && typedSender.Name == "")
{
}

A: The as keyword will try and cast the object against the type and return either the cast instance or null if the instance cannot be cast.
You need to do something like this:
private void frmMain_FormClosing(object sender, FormClosingEventArgs e)
{
    var toolStripMenuItem = sender as ToolStripMenuItem;

    if (toolStripMenuItem !=null && toolStripMenuItem .Name == @"exitToolStripMenuItem")
    {
    }
}

In your case you also have another problem which is that your exitToolStripMenuItem handler is calling Form.Close() which means that the sender in frmMain_FormClosing(object sender will always be the form.


text:
Q: GIS data visualization I have a huge data set with geolocation information. I am trying to visualize the data but the tools cannot handle such a big graph. Size of the file is about 5GB and has more than 3 million rows.
What is the best way to visualize the time-series and geolocation based data?
I have a CSV and I did try using online tools like CartoDB, Plotly and did try using ArcGIS but that is commercial tool.
I got stuck as the file is too big and the tools won't allow loading the files. It is a social network data with spatio-temporal information. I used gepi, cytoscape, ScoNet, Tupil, Anaconda GraphViz but nothing would even load the file. The same if I use sample 10 rows it would work good.


text:
Q: Retrieve Data save through metabox to DB to the Web page I developed a customer metabox plugin to save user details to db and retrieve them back to front end.
I want to data save through these text fields to the db
to
retrieve and display into relevant fields frontend es in 2nd image.
This is my code for metabox plugin.
metabox.php
<?php

add_action('add_meta_boxes', 'wpl_owt_register_metabox_cpt');
function wpl_owt_register_metabox_cpt()
{
    global $post;

    if(!empty($post))
    {
        $pageTemplate = get_post_meta($post->ID, '_wp_page_template', true);

        if($pageTemplate == 'page-contact.php' )
        {
            add_meta_box(
                'owt-cpt-id', // $id
                'Contact Details', // $title
                'wpl_owt_book_function', // $callback
                'page', // $page
                'normal', // $context
                'high'); // $priority
        }
    }
}

   /**********Callback function for metabox at custom post type book******************/

 function wpl_owt_book_function( $post ) {
    //echo "
Custom metabox for custom post type
";

    define("_FILE_", "_FILE_");

    wp_nonce_field( basename(_FILE_), "wp_owt_cpt_nonce");

    echo "Phone
";
    $phone_num = get_post_meta($post->ID, "telNo" , true);
    echo "<input type ='tel' name = 'txtPhoneNum' value = '" . $phone_num . "'' placeholder = 'Phone Number' />

";

    echo "Email
";
    $email = get_post_meta($post->ID, "email" , true);
    echo "<input type ='email' name = 'txtEmail' value = '" . $email . "'' placeholder = 'Email Address' />

";

    echo "Hours of Operation
";
    $hours = get_post_meta($post->ID, "hourofOps" , true);
    echo "<input type ='text' name = 'txtHours' value = '" . $hours . "'' placeholder = 'Working Hours' />

";
}

add_action("save_post" , "wpl_owt_save_metabox_data" , 10 , 2);

function wpl_owt_save_metabox_data($post_id, $post){

    //verify nonce
    if(!isset($_POST['wp_owt_cpt_nonce']) || !wp_verify_nonce($_POST['wp_owt_cpt_nonce'], basename(_FILE_))){
        return $post_id;
    }

    //verify slug value
    $post_slug = "page";
    if($post_slug != $post->post_type){
        return;
    }

    //save value to db filed
    $pub_tel = '';
    if(isset($_POST['txtPhoneNum'])){
        $pub_tel = sanitize_text_field($_POST['txtPhoneNum']);
    }

    else{
        $pub_tel = '';
    }

    update_post_meta($post_id, "telNo", $pub_tel);

    $pub_email = '';

    if(isset($_POST['txtEmail'])){
        $pub_email = sanitize_text_field($_POST['txtEmail']);
    }

    else{
        $pub_email = '';
    }

    update_post_meta($post_id, "email", $pub_email);

    $pub_hours = '';

    if(isset($_POST['txtHours'])){
        $pub_hours = sanitize_text_field($_POST['txtHours']);
    }
    update_post_meta($post_id, "hourofOps", $pub_hours);
}

?>

This is the code of the form which you see in 2nd page (Contact Page in web site).
page-contact.php

  Contact Info

IT'S SHOWTIME TOWING

  Phone: 0450749863

  Email: info@itsshowtimetowing.com.au

  Hours of Operation

24/7

 Terms And Conditions Click Here

Please look into this code and kindly tell me a way to retrieve the data updated through metabox.php to page-contact.php .

A: So finally I found a way to do this after a sleepless night. Thanks for the "Support".
Here is the code.
page-contact.php

                        Contact Info

IT'S SHOWTIME TOWING

                            Phone: <?php echo get_post_meta( $post->ID, 'telNo', true );?>

                            Email: <?php echo get_post_meta($post->ID, "email" , true); ?>

                            Hours of Operation

                            <?php echo get_post_meta($post->ID, "hourofOps" , true); ?>

                            Terms And Conditions Click Here

Hope this answer will helpful for a newcomer to the industry like me.


text:
Q: App engine -- how to handle shutdown hooks now that backends are deprecated? I noticed that the shutdown hook has been deprecated:
Runtime API
I moved my app from using backends to modules, but obviously App Engine will still shutdown instances sometimes. How should we handle that going on because I don't see any documentation in the Modules section?
Thanks.


text:
Q: On the truncation of spherical harmonics Suppose there is a function $f(\theta,\phi)$ defined on the surface of a sphere, and $\theta$ and $\phi$ are the polar and azimuthal angles respectively. Similar with the fact that a function defined on a line or a circle can be expanded with respect to the Fourier bases, this function $f$ can be expanded in terms of the spherical harmonics $Y_l^m(\theta, \phi)$:
$$f(\theta,\phi)=\sum_{l=0}^{\infty} \sum_{m=-l}^l F_l^m Y_l^m(\theta,\phi),$$
where $l$ and $m$ are the degree and order of the harmonics. In order for the expansion to achieve a perfect fitting to the original function, $l$ needs to go from 0 to $\infty$.
In our experiment design, however, we cannot detect directly the value of the original function but can only detect the expansion coefficients $F_l^m$, and unfortunately, the orders of $F_l^m$ we are able to detect is limited, ie. $l \leq l_0$, so in fact we are using a truncated summation $$\sum_{l=0}^{l_0} \sum_{m=-l}^l F_l^m Y_l^m(\theta,\phi)$$ to simulate the original function. When $l_0$ is small, even though the truncated function captures the overall variation trends of the original function well, the amplitudes are significantly different from the originals.
So my question is: is there a way to mathematically scale the truncated function value to a direct comparable level with the original function? If so, how to do it please? Any input would be greatly appreciated, thanks a lot!


text:
Q: What are Carnot groups? I'm trying to learn the Pansu differentiability theorem and I need to know what Carnot groups are. Can someone please explain what Carnot groups are? An introductory reference would be greatly appreciated as well.
Thanks.

A: A Carnot group is a special type of Lie group $\mathcal{G} $ that is nilpotent (almost abelian) and simply connected. Its Lie algebra $\mathcal{g}$ gives a nilpotent stratification consisting of $k$ steps. This can be represented in the form $\mathcal{V}_1\oplus\cdots \oplus \mathcal{V}_k$ with $[\mathcal{V}_1,\mathcal{V}_m]=\mathcal{V}_{1+m},~m=1,\cdots ,k-1$. For example, the space $\mathbb{R}^n$ under the binary operation of addition is a commutative Carnot group. Carnot groups possess a Carnot-Caratheodory metric (a metric space with integer Hausdorff dimension greater than its dimension) and Pansu derivative (a special type of derivative adapted to a Carnot group).

A: I am reading them from a Doctoral Thesis:
Distances, boundaries and surface
measures in Carnot-Carath´eodory spaces
Roberto Monti
However, without the first 20 pages of "Hardy spaces on homogeneous groups, G.B. Folland and E.M. Stein" I would have had a difficult time understanding the whole picture.


text:
Q: How to disable "No space allowed around keyword argument assignment" in Pylint? How to disable "No space allowed around keyword argument assignment" in Pylint?
I found why it checks for the spaces (PEP 8, why no spaces around '=' in keyword argument or a default parameter value?), but I don't agree because this means I need to spend hours of solving only this message.
I looked for the message so I can disable it in the rcfile here: http://pylint-messages.wikidot.com/all-codes
But the message does not appear in the pylint documentation?!

A: Disabling in Pylint
This can be disabled in Pylint with bad-whitespace:
$ cat a.py
myfunca(myargb = 3)

$ pylint a.py --reports=n
No config file found, using default configuration
************* Module a
C:  1, 0: No space allowed around keyword argument assignment
myfunca(myargb = 3)
               ^ (bad-whitespace)
C:  1, 0: Missing module docstring (missing-docstring)
E:  1, 0: Undefined variable 'myfunca' (undefined-variable)

$ pylint a.py  --disable bad-whitespace --reports=n
No config file found, using default configuration
************* Module a
C:  1, 0: Missing module docstring (missing-docstring)
E:  1, 0: Undefined variable 'myfunca' (undefined-variable)

Disabling in PEP8 Checker
For completeness, you can disable the same for pep8's checker with E251:
$ pep8 a.py
a.py:1:15: E251 unexpected spaces around keyword / parameter equals
a.py:1:17: E251 unexpected spaces around keyword / parameter equals

$ pep8 a.py --ignore=E251

Update - Info on suppressing just that message
AFAIK you can only disable messages down to the granularity of IDs in pylint, as all the whitespace has the same id bad-whitespace aka C0326 you can therefore either ignore all or none.
This is the code that checks if a message is disabled, as you see it only receives the id to check against:
def is_message_enabled(self, msg_descr, line=None, confidence=None):
    """return true if the message associated to the given message id is
    enabled

    msgid may be either a numeric or symbolic message id.
    """

When the message is added to the lint results, you can see that bad-whitespace is all that is passed in. The around and keyword argument assignment are simply arguments to the message.
warnings = []
if not any(good_space) and policies[0] == policies[1]:
    warnings.append((policies[0], 'around'))
else:
    for ok, policy, position in zip(good_space, policies, ('before', 'after')):
        if not ok:
            warnings.append((policy, position))
for policy, position in warnings:
    construct = _name_construct(token)
    count, state = _policy_string(policy)
    self.add_message('bad-whitespace', line=token[2][0],
                     args=(count, state, position, construct,
                           _underline_token(token)))

The arguments to the message are displayed using the formatting string:
'C0326': ('%s space %s %s %s\n%s',
          'bad-whitespace',
          ('Used when a wrong number of spaces is used around an operator, '
           'bracket or block opener.'),

All that should help if you want to customize pylint to do what you want, and if so, a pull-request back to them would hopefully be well received.

A: One way in which we can ignore a specific pylint check is to include the following line at the top of your python code -
# pylint: disable=C0326
# pylint: disable=C0303
... your code goes here

pylint then ignores the mentioned warnings as well as ignores these checks while calculating the pylint score.
For the above code, it will ignore both Trailing whitespaces (C0303) and Space before and after brackets, operators, comma (C0326)


text:
Q: Simple opensource javascript library for creating (stacked) line graph? I need a lightweight javascript library to create a stacked line graph (a bit like what is used in financial graphs). The X axis will be dates and the Y axis will be ordinary float values.
There will be two sections of the graph:

*

*Top graph which is a line graph. I want to be able to specify the color of a line segment (i.e. joining two dated points)

*The bottom part is just a rectangle/bar which represents the value. Once again, I want to be able to specify the color of the bar for a particular date.
It would be cool if the library used JQuery (since I have used jQuery in the past) - but even plain old JS code library would be equally useful.

A: I recommend Google Chart API / Chart Tools (examples) and Google Visualization API (examples).
The former being less powerful than the latter, but also more low-tech, so possibly easier to use (and more portable across platforms. The basic Chart API generates static images for you).
But you can also use:

*

*gRaphael

*Bluff

*PlotKit

*CanvasGraphJS

*Grafico

*RGraph

*Plotr
Or even use a more high-level library like ExtJS (examples).

A: look at JQPlot http://www.jqplot.com/

A: UPDATE: Here is a recent and very impressive chart library built by Baidu folks:
http://ecomfe.github.io/echarts/index-en.html
And this one is open source.

Another free option are the Google visualisations.
They could be an overkill for your needs. But you can provide to the users different kind of graphics as they all share the same dataset structure.
The good, you don't host them, they are on the Google's infrastructure and save you the bandwith. The bad, you don't host them... It is not opensource, you can't hack them if you want.
We use them in our web app and are quite happy from it.
Except they don't work with Android, as many use SVG/VML that is off by default for now.

A: Use raphaeljs and the complimentary charting library.  The charting library link has a few examples that will show you what you can do - just view source them to see how easy it is.


text:
Q: Clear all cells from a certain range that starts from the next blank cell in Column A I am trying to write some VBA in excel that will clear all cells starting from the next empty cell in Column A (data starts from A2). For example, if A5 is blank then I want A5:P300 to all be cleared (as in all Formula and Data gone). And so on... so if A20 is blank then it deletes everything from A20:P300..
How would I go about writing this? I also need it to refer to the active workbook but a specific worksheet called ("Develop").
Thanks for any help provided.
Sub Clear()

Dim x As Worksheet
Dim rng, cell As Range

Set x = ThisWorkbook.Worksheets("R&DCosts(2)")

Set rng = x.Range("A2:A340").Cells(Rows.Count, 1).End(xlUp)

  For Each cell In rng
   If cell.Value = "" Then

      x.Range(cell.Address & ":P350").ClearContents
      End

    End If

  Next cell

 End Sub

A: Try this code, please:
Sub clearRange_Bis()
  Dim sh As Worksheet, firstEmpt As Long
  Set sh = ThisWorkbook.Worksheets("R&DCosts(2)")
  firstEmpt = sh.Range("A1").End(xlDown).Row + 1
    If firstEmpt > 1000000 Then
        sh.Range("A2:P300").Clear
    Else
        sh.Range("A" & firstEmpt  & ":P300").Clear
    End If
End Sub

A: A more simple solution
Option Explicit

Sub Clear()

 Dim x As Worksheet
 Dim rng, cell As Range

 Set x = ThisWorkbook.Worksheets("RDCosts(2)") ' you cannot use "&"

 Set rng = x.Range("A2:A340", Cells(Rows.Count, 1).End(xlUp))

 For Each cell In rng
    If cell.Value = "" Then

        x.Range(cell.Address & ":P350").ClearContents
        End

    End If

 Next cell

 End Sub


text:
Q: When launching ddms from the cli OS X (10.7.3) I get an error: "Failed to get the adb version...." When launching DDMS from the command line in Lion (10.7.3) I get the following error:
E/adb: Failed to get the adb version: Cannot run program "/Users/stevieo/android-sdk-macosx/tools/adb": error=2, No such file or directory

This makes sense to me because adb is actually in: /Users/stevieo/android-sdks/platform-tools
How can I modify this path so that ddms will launch on my system?
I have looked into the ddms file itself, but cannot decipher its intent.
One note, I do NOT have this issue on Snow Leopard (10.6.8)....
TIA for any thoughts or assistance.
Regards,
Steve O'Sullivan

A: If you look into your tools directory where you launched ddms, you will see the adb_has_moved.txt which says:

The adb tool has moved to platform-tools/
If you don't see this directory in your SDK,
  launch the SDK and AVD Manager (execute the android tool)
  and install "Android SDK Platform-tools"
Please also update your PATH environment variable to
  include the platform-tools/ directory, so you can
  execute adb from any location.

To solve this, I would change your ~/.bash_profile to have a line like:
# --- add Android platform-tools directory
PATH=~/android-sdks/platform-tools:$PATH
export PATH

Make sure to open up a new Terminal window so it will reload ~/.bash_profile
Note that a possible reason why it is working on your 10.6.8 installation is that you may have an older version of the Android SDK, where adb was in still in the tools directory.

A: If you are trying from eclipse,
Please make sure to create a adb link in /usr/bin/ directory which should solve the problem:
Ex: ln -s /Users//android-sdks/platform-tools/adb /usr/bin/adb
Note: logging as sudo/root may be required


text:
Q: Spring JAVAX Validation Year Greater or Equal to Current Year I am beginner for Spring and JAVAX Validation.
I have DTO class to collect credit card information.
One of the field is expire year, is there any annotation or way to validate the year value that it should be equal or greater than current value.
Something as below.
public class CreditCardDTO
{
     @Range(min=<currentYear>)
     private Interger expireYear;
}

Please guide.
Thanks,
Ankur

A: You should implement a custom constraint for this use case.


text:
Q: YouTubePlayerSupportFragment No views can be added on top of the player I am struggle with YouTubePlayerSupportFragment for 3 days tried to make it run in a swipe fragment. It's show this error now, I have tried others ways and get NullPointerException. Is there a possible way to put YouTubePlayerSupportFragment in a swipe Fragment?

java.lang.UnsupportedOperationException: No views can be added on top
  of the player
                                                                                at com.google.android.youtube.player.YouTubePlayerView.a(Unknown
  Source)
                                                                                at com.google.android.youtube.player.YouTubePlayerView.addView(Unknown
  Source)
                                                                                at
  android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1083)
                                                                                at
  android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1252)
                                                                                at
  android.support.v4.app.BackStackRecord.run(BackStackRecord.java:742)
                                                                                at
  android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1617)
                                                                                at
  android.support.v4.app.FragmentManagerImpl.executePendingTransactions(FragmentManager.java:570)
                                                                                at
  android.support.v4.app.FragmentStatePagerAdapter.finishUpdate(FragmentStatePagerAdapter.java:164)
                                                                                at android.support.v4.view.ViewPager.populate(ViewPager.java:1177)
                                                                                at android.support.v4.view.ViewPager.populate(ViewPager.java:1025)
                                                                                at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1545)
                                                                                at android.view.View.measure(View.java)
                                                                                at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java)
                                                                                at
  android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java)
                                                                                at android.widget.LinearLayout.measureVertical(LinearLayout.java)
                                                                                at android.widget.LinearLayout.onMeasure(LinearLayout.java)
                                                                                at
  android.support.design.widget.AppBarLayout.onMeasure(AppBarLayout.java:199)
                                                                                at android.view.View.measure(View.java)
                                                                                at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java)
                                                                                at
  android.support.design.widget.CoordinatorLayout.onMeasureChild(CoordinatorLayout.java:668)
                                                                                at
  android.support.design.widget.CoordinatorLayout.onMeasure(CoordinatorLayout.java:735)
                                                                                at android.view.View.measure(View.java)
                                                                                at
  android.support.v4.widget.DrawerLayout.onMeasure(DrawerLayout.java:1075)
                                                                                at android.view.View.measure(View.java)
                                                                                at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java)
                                                                                at android.widget.FrameLayout.onMeasure(FrameLayout.java)
                                                                                at
  android.support.v7.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:135)
                                                                                at android.view.View.measure(View.java)
                                                                                at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java)
                                                                                at
  android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java)
                                                                                at android.widget.LinearLayout.measureVertical(LinearLayout.java)
                                                                                at android.widget.LinearLayout.onMeasure(LinearLayout.java)
                                                                                at android.view.View.measure(View.java)
                                                                                at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java)
                                                                                at android.widget.FrameLayout.onMeasure(FrameLayout.java)
                                                                                at android.view.View.measure(View.java)
                                                                                at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java)
                                                                                at
  android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java)
                                                                                at android.widget.LinearLayout.measureVertical(LinearLayout.java)
                                                                                at android.widget.LinearLayout.onMeasure(LinearLayout.java)
                                                                                at android.view.View.measure(View.java)
                                                                                at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java)
                                                                                at android.widget.FrameLayout.onMeasure(FrameLayout.java)
                                                                                at
  com.android.internal.policy.PhoneWindow$DecorView.onMeasure(PhoneWindow.java)
                                                                                at android.view.View.measure(View.java)
                                                                                at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java)
                                                                                at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java)
                                                                                at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java)
                                                                                at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java)
                                                                                at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java)
                                                                                at android.view.Choreographer$CallbackRecord.run(Choreographer.java)
                                                                                at android.view.Choreographer.doCallbacks(Choreographer.java)
                                                                                at android.view.Choreographer.doFrame(Choreographer.java)
                                                                                at
  android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java)
                                                                                at android.os.Handler.handleCallback(Handler.java)
                                                                                at android.os.Handler.dispatchMessage(Handler.java)
                                                                                at android.os.Looper.loop(Looper.java)
                                                                                at android.app.ActivityThread.main(ActivityThread.java)
                                                                                at java.lang.reflect.Method.invoke(Native Method)

MainActivity.java:
import android.os.Bundle;
import android.support.design.widget.NavigationView;
import android.support.design.widget.TabLayout;
import android.support.v4.view.GravityCompat;
import android.support.v4.view.ViewPager;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;

public class MainActivity extends AppCompatActivity
        implements NavigationView.OnNavigationItemSelectedListener {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);

        TabLayout tabLayout = (TabLayout) findViewById(R.id.tab_layout);
        tabLayout.addTab(tabLayout.newTab().setText("Tab 1"));
        tabLayout.addTab(tabLayout.newTab().setText("Tab 2"));
        tabLayout.addTab(tabLayout.newTab().setText("Tab 3"));
        tabLayout.setTabGravity(TabLayout.GRAVITY_FILL);

        final ViewPager viewPager = (ViewPager) findViewById(R.id.pager);
        final PagerAdapter adapter = new PagerAdapter
                (getSupportFragmentManager(), tabLayout.getTabCount());
        viewPager.setAdapter(adapter);
        viewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout));
        tabLayout.setOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
            @Override
            public void onTabSelected(TabLayout.Tab tab) {
                viewPager.setCurrentItem(tab.getPosition());
            }

            @Override
            public void onTabUnselected(TabLayout.Tab tab) {

            }

            @Override
            public void onTabReselected(TabLayout.Tab tab) {

            }
        });

        DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
        ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
                this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
        drawer.setDrawerListener(toggle);
        toggle.syncState();

        NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
        navigationView.setNavigationItemSelectedListener(this);
    }

    @Override
    public void onBackPressed() {
        DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
        if (drawer.isDrawerOpen(GravityCompat.START)) {
            drawer.closeDrawer(GravityCompat.START);
        } else {
            super.onBackPressed();
        }
    }

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

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

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

        return super.onOptionsItemSelected(item);
    }

    @SuppressWarnings("StatementWithEmptyBody")
    @Override
    public boolean onNavigationItemSelected(MenuItem item) {
        // Handle navigation view item clicks here.
        int id = item.getItemId();

        if (id == R.id.nav_camera) {
            // Handle the camera action
        } else if (id == R.id.nav_gallery) {

        } else if (id == R.id.nav_slideshow) {

        } else if (id == R.id.nav_manage) {

        } else if (id == R.id.nav_share) {

        } else if (id == R.id.nav_send) {

        }

        DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
        drawer.closeDrawer(GravityCompat.START);
        return true;
    }
}

PagerAdapter.java:
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;

public class PagerAdapter extends FragmentStatePagerAdapter  {
    int mNumOfTabs;

    public PagerAdapter(FragmentManager fm, int NumOfTabs) {
        super(fm);
        this.mNumOfTabs = NumOfTabs;
    }

    @Override
    public Fragment getItem(int position) {

        switch (position) {
            case 0:
                TabFragment1 tab1 = new TabFragment1();
                return tab1;
            case 1:
                TabFragment2 tab2 = new TabFragment2();
                return tab2;
            case 2:
                TabFragment3 tab3 = new TabFragment3();
                return tab3;
            default:
                return null;
        }
    }

    @Override
    public int getCount() {
        return mNumOfTabs;
    }
}

TabFragment1.java:
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.google.android.youtube.player.YouTubeInitializationResult;
import com.google.android.youtube.player.YouTubePlayer;
import com.google.android.youtube.player.YouTubePlayerSupportFragment;

public class TabFragment1 extends Fragment  {
    private String currentVideoID = "nCgQDjiotG0";
    public static final String API_KEY = "XXX";
    private YouTubePlayer YPlayer;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

        View rootView = inflater.inflate(R.layout.tab_fragment_1, container, false);

        YouTubePlayerSupportFragment youTubePlayerFragment = YouTubePlayerSupportFragment.newInstance();
        FragmentTransaction transaction = getFragmentManager().beginTransaction();
        transaction.add(R.id.youTubePlayer, youTubePlayerFragment).commit();

        youTubePlayerFragment.initialize(API_KEY, new YouTubePlayer.OnInitializedListener() {

            @Override
            public void onInitializationSuccess(YouTubePlayer.Provider arg0, YouTubePlayer youTubePlayer, boolean b) {
                if (!b) {
                    YPlayer = youTubePlayer;
                    YPlayer.setFullscreen(true);
                    YPlayer.loadVideo("2zNSgSzhBfM");
                    YPlayer.play();
                }
            }

            @Override
            public void onInitializationFailure(YouTubePlayer.Provider arg0, YouTubeInitializationResult arg1) {
                // TODO Auto-generated method stub

            }
        });

        return rootView;
    }

tab_fragment_1.xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <fragment
        android:name="com.google.android.youtube.player.YouTubePlayerSupportFragment"
        android:id="@+id/youTubePlayer"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"/>

</RelativeLayout>

A: First instead of
   <fragment
      android:name="com.google.android.youtube.player.YouTubePlayerSupportFragment"
        android:id="@+id/youTubePlayer"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"/>

use FrameLayout
 <FrameLayout
        android:id="@+id/frame_fragment"
        android:layout_width="match_parent"
        android:layout_height="200dp"></FrameLayout>

then after the initialize use
FragmentTransaction transaction = getFragmentManager().beginTransaction();
        transaction.replace(R.id.frame_fragment, youTubePlayerFragment);
        transaction.commit();

A: Try
transaction.replace(R.id.youTubePlayer, youTubePlayerFragment).commit();

in your onCreateView or simply retrieve the fragment directly (you have it in your layout) using
YouTubePlayerSupportFragment youTubePlayerFragment = getFragmentManager().findFragmentById(R.id.youTubePlayer);


text:
Q: Unable to use composition (embedded class) in Where Queries It seems to be a bug, but before submitting a Jira, I want to make sure I'm not misusing Were Queries.
I'm trying to use Where Queries to filter a simple Composition attribute.
Family.where { address.number == 1 }

where address is a composition mapped in my Family domain class. When running this piece of code I'm getting a "NullPointerException: Cannot get property 'javaClass' on null object" raised inside "grails.gorm.DetachedCriteria.methodMissing(DetachedCriteria.groovy:1136)"
It is probably not a mapping issue, since the alternative Detached Criteria solution is working just as expected:
new DetachedCriteria(Family).build {     eq 'address.number', 1 }

Isn't composition attributes supported by Where Queries or should I submit a Jira for that?


text:
Q: How to write "Does Not Equal" string operation in Java if (correctAnswer.equals(userChoice.toLowerCase())) {
    System.out.println("Your have provided the correct answer. Well done!");

Where I have .equals above as a String operation, is there a .notequals equivalent for it in Java?

A: You can use negation operator ! to reverse result of equals method like
if (!correctAnswer.equals(userChoice.toLowerCase()))


text:
Q: Создание неопределенного числа виджетов PyQt5 Есть список текста, нужно создать, например, Label в определенном количестве, на каждый элемент списка(список динамический), добавить их в VBoxLayout, например, и как то с ними ещё взаимодействовать(контекстное меню накинуть, например).
upd:
    for i in minds:
        label = QLabel(self)
        label.setText(i)
        vbox.addWidget(label)

Сделал таким образом, но как узнать, это куча разных лэйблов или один, и как можно с ними взаимодействовать?


text:
Q: Couldn't match expected type `Bool' with actual type `[[Integer]] I'm new to Haskell and have a question about types, it error out because it couldn't match expected type. I believe squarePrime is a bool, correct me if i'm wrong and it is complaining because it wants a int? Can someone explain, thanks in advance.
squarePrimes n =  [n^2 | (n) <- [2..n-1], (all (\a -> mod n a /= 0) [2..n-1])]
multiOfFive a = mod a 5 == 0

fun n = [n | n <-[1..n], multiOfFive || squarePrimes n]

A: The 'squarePrimes n' function returns a list of Integers, as opposed to a Bool or a list of Bools. Looking at the list comprehension:
[n^2 | (n) <- [2..n-1], (all (\a -> mod n a /= 0) [2..n-1])]

This will produce a list of n^2, of n pulled from the range [2..n-1], for every n that satisfies the condition:
(all (\a -> mod n a /= 0) [2..n-1])

Then, in the list comprehension used in the definition of 'fun':
[n | n <-[1..n], multiOfFive || squarePrimes n]

A list is being constructed of each n in the range 1 to n, as long as the following condition is true:
multiOfFive || squarePrimes n

Haskell is expecting this to evaluate to a Bool. However, 'multiOfFive' is being called without any argument, and 'squarePrimes n' returns a list of Integers, as opposed to a Bool.
Without knowing exactly what the intention of 'fun n' is, I have altered the provided code a little bit to get a list comprehension that loads without error:
fun n = [n | n <- [1..n], (multiOfFive n) || (elem n (squarePrimes n))]

Now, it uses the 'elem' function to check whether a given 'n' is an element of the list 'squarePrimes n'.

A:
I believe squarePrimes is a Bool, correct me if I'm wrong

GHCi will tell you:
λ> let squarePrimes n = [n^2 | (n) <- [2..n-1], (all (\a -> mod n a /= 0) [2..n-1])]
λ> :t squarePrimes
squarePrimes :: Integral a => a -> [a]

It is complaining because it wants an int? Can someone explain

Here Integral i => i is any integer type. That could for example be Int or Integer. This is because the integer literals 0, 1, 2 and the arithmetic operators you use aren't restricted to a specific integer type.
You're using squarePrimes n as a Bool.
You're also using multiOfFive as a Bool when its type is:
λ> let multiOfFive a = mod a 5 == 0
λ> :t multiOfFive
multiOfFive :: Integral a => a -> Bool

so a function that takes an integer type and returns a Bool.


text:
Q: Should it take more rep to reopen a question than to close on beta Stack Exchange sites? In case you've forgotten the Stack Exchange system's black sheep, Programmers.SE, it's still around and is still in need of serious direction. Even after the Great Subjective Debate of 2010, tons of questions on Programmers.SE are still low-quality and flaunt the guidelines of both the FAQ and Good Subjective, Bad Subjective.
I'd give you examples, but there are so many of them a quick visit to Programmers.SE should provide you several.
Furthermore, there's very little incentive to vote to close questions because there are more people interested in maintaining the anarchistic status quo than there are that are interested in implementing the new guidelines. Many of the questions that are closed are reopened in much less time than it took to get enough votes to close them: right now 1 out of every 3 questions that are closed are reopened.
There are other issues, like closers being cast as villains and a severe collective misunderstanding of what constitutes a good question, but I wonder if there's at least one way to make it a little easier for beta sites to shape the character of the site:

On beta Stack Exchange sites, require (significantly?) more rep to reopen a question than to close it.

This change would, at least ostensibly, still allow many users to get rid of the cruft but also require significantly more time for users to understand the nature of the site before deciding that a question should stay.
This is based on the idea that in the beta, a Stack Exchange site should be more exclusive than inclusive: as Programmers.SE has shown, allowing a site to have a lot of bad questions at the site—in hopes of sparking a critical mass of questions such that the good questions will eventually overtake the bad—is a demonstrably unsound philosophy. And while Programmers.SE is the extreme, the problem of constant off-topic questions can and has affected other sites in their beta.
Would this help? Is there another way to help mitigate the constant reopening of bad questions?

A: It is important that reopening permissions are tied with closing permissions so that any closings actually can be reversed, specifically by the people who closed it. This is more-so important during the Beta since that is when the actual lines for closing are not fully defined, making incorrect closings far more likely to happen.
That, and it's a bit of a kick-in-the-face to the opposition. Even if I'm pro-scope, I think it's fairer that I wait for them to be on equal ground than me in order to argue their vantage point, not require them to be on higher ground than I was when I made the initial choice.

A: If there is more people wanting to reopen, then it simply means that the people wanted such question in the site. I don't think there's any problem with that.
Programmers.SE is still in its formative years, and what constitutes on-topic or off-topic should not be set in the stone yet.


text:
Q: write query without using cursors I wrote this query to display single client's account transactions:
select *
from (
    select top 1
       [id]
      ,[client_id]
      ,[transactionDate]
      ,N'revolving balance' [details]
      ,NULL [amount]
      ,NULL [debit]
      ,NULL [credit]
      ,[balance]
  FROM [dbo].[bsitems]
  where [client_id]=@client_id and
        [transactionDate] < @transactionDateFrom
        order by id desc) t1
        union
SELECT [id]
      ,[client_id]
      ,[transactionDate]
      ,[details]
      ,[amount]
      ,[debit]
      ,[credit]
      ,[balance]
  FROM [dbo].[bsitems]
  where [client_id]=@client_id and
        [transactionDate] between @transactionDateFrom and @transactionDateTo

How to display the transactions for all clients that exists in "client" table? Assume client table structure is (id, name)

A: SELECT *
FROM (
    SELECT TOP 1
         [id]
        ,[client_id]
        ,[transactionDate]
        ,N'revolving balance' [details]
        ,NULL [amount]
        ,NULL [debit]
        ,NULL [credit]
        ,[balance]
    FROM [dbo].[bsitems]
    INNER JOIN [dbo].[client] ON [dbo].[bsitems].[client_id] = [dbo].[client].[id]
    AND [transactionDate] < @transactionDateFrom
    ORDER BY id DESC
) t1

UNION

SELECT
     [id]
    ,[client_id]
    ,[transactionDate]
    ,[details]
    ,[amount]
    ,[debit]
    ,[credit]
    ,[balance]
FROM [dbo].[bsitems]
INNER JOIN [dbo].[client] ON [dbo].[bsitems].[client_id] = [dbo].[client].[id]
AND [transactionDate] between @transactionDateFrom and @transactionDateTo

A: For the second part (which is really what the transactions are), just use join:
SELECT b.id, b.client_id, b.transactionDate, b.details,
       b.amount, b.debit, b.credit, b.balance
FROM [dbo].[bsitems] b join
     clients c
     on b.client_id = c.client_id
WHERE transactionDate between @transactionDateFrom and @transactionDateTo;

This assumes that the client_id is stored in the clients table.
The first part of the query is returning the most recent id before the from date.  It returns no rows if there are no previous transactions.  You can approach this in a similar way.
select id, client_id, transactiondate, details, amount, debit, credit, balance
from (SELECT b.id, b.client_id, b.transactionDate,
             N'revolving balance' as b.details,
             NULL as b.amount, NULL as b.debit, NULL as b.credit,
             b.balance,
             row_number() over (partition by client_id order by TransactionDate desc) as seqnum
      FROM [dbo].[bsitems] b join
           clients c
           on b.client_id = c.client_id
      WHERE transactionDate < @transactionDateFrom
     ) t
where seqnum = 1;

Instead of top 1 this is using row_number() to assign a sequential value to the transactions before the cutoff date.  Then the most recent of these is chosen.
The final result is just the union all of these two queries:
select id, client_id, transactiondate, details, amount, debit, credit, balance
from (SELECT b.id, b.client_id, b.transactionDate,
             N'revolving balance' as b.details,
             NULL as b.amount, NULL as b.debit, NULL as b.credit,
             b.balance,
             row_number() over (partition by client_id order by TransactionDate desc) as seqnum
      FROM [dbo].[bsitems] b join
           clients c
           on b.client_id = c.client_id
      WHERE transactionDate < @transactionDateFrom
     ) t
where seqnum = 1
union all
SELECT b.id, b.client_id, b.transactionDate, b.details,
       b.amount, b.debit, b.credit, b.balance
FROM [dbo].[bsitems] b join
     clients c
     on b.client_id = c.client_id
WHERE transactionDate between @transactionDateFrom and @transactionDateTo;


text:
Q: what is extension, user verification, ctap on fido? I'm studying on FIDO2 these days.
There are three questions.

*

*In registration process, what is the extension field?

*

*purpose, usages

*What means user verification?
I think that user verification is local verification. example, fingerprint on mobile device.
Why do I need to set this(required, preferred, discourage)??
Also what is the attesatation convayance preference??

*I understood that CTAP is a protocol between an external authenticator and a browser.
How can I send data from the authenticator to the browser?

A: *

*Extensions are non-mandatory, weak processed functionality. Lack of them won't affect actual FIDO protocol, and presence will just enhance. Extension field contains a map of requested extension. For example, a relying party might want to store some data with the authenticator(you can do that in CTAP2.1). The RP then set extensions.credBlob to the required value. The platform will forward the extension to the device that will process it and store data with the credential.

*FIDO devices could be UV capable (biometrics, pin, etc) or second factor only (Legacy U2F device, or TUP only FIDO2 devices).
In this situation:

*

*"Required" would cause command fail if device is not capable to verify user.

*"Prefer" would ask for UV when it's available, but still allow non-uv devices.

*"Discourage" would ask UV devices to skip user verification, thus simplifying user experience.

*CTAP protocols (CTAP1 is raw message U2F, CTAP2 is FIDO2 CBOR based protocol) are HID/NFC/BLE based protocols. If you want to play with that I suggesting taking a look at virtual HID emulation like this is done in this project: https://github.com/concise/v2f-nodejs-linux


text:
Q: Is there a PHP equvalent to Python's Counter object? In Python, there exists a Counter class that allows me to do this:
counter = Counter()
counter[2] = 5
counter[3] = 2

for i in range(5):
    print(f'counter[{i}]={counter[i]}')

Which will give me the following output:
counter[0]=0
counter[1]=0
counter[2]=5
counter[3]=2
counter[4]=0

Basically it acts as if any element in the dictionary that has not been explicitly initialized has the value of zero, and will never throw an exception when accessing non-existing element.
Is there a similar entity in PHP, or is the only way to check each index when accessing in a loop?
I am looking for a way to avoid doing this:
for ($i = 0; $i < numOfSomeResults; $i++) {
    if (isset($otherResult[$i]) {
        echo $otherResult[$i];
    } else {
        echo "0";
    }
}

And do something like:
for ($i = 0; $i < $numOfSomeResults; $i++) {
    echo $counter[i];
}

Both the indexes and values I need to work with are integers if that helps.

A: Without reinventing the wheel and following on from Alex's comment, you can use the null coalescing operator (PHP 7+)
for ($i = 0; $i < $numOfSomeResults; $i++) {
    echo $counter[$i] ?? 0;
}

Some background information about what it does:
The null Coalescing operator is mainly used to avoid the object function to return a NULL value rather returning a default optimized value. It is used to avoid exception and compiler error as it does not produce E-Notice at the time of execution.
(Condition) ? (Statement1) ? (Statement2);

This same statement can be written as:
if ( isset(Condition) ) {
    return Statement1;
} else {
    return Statement2;
}

A: Try this:
Put '$' in front of 'i'. The code below must work.
for ($i = 0; $i < numOfSomeResults; $i++) {
    if (isset($otherResult[$i]) {
        echo $otherResult[$i];
    } else {
        echo 0;
    }
}


text:
Q: Overloaded member function not found in variadic template on vs2015 I've tried to boil this down to the essentials.
I have a variadic template class, Foo, containing a "list" of objects indexed with their types. I use the function bar<U>() to extract the element of that type. I solve this using a variadic template and std::enable_if to only define bar<U>() where T == U.
Then I expose all "bar" functions from the base classes with "using".
#include <type_traits>

template<typename... Ts>
class Foo
{
public:
    void bar() {}
};

template<typename T, typename... Ts>
class Foo<T, Ts...> : public Foo<Ts...>
{
public:
    using Foo<Ts...>::bar;

    template<typename U>
    typename std::enable_if<std::is_same<U, T>::value, U >::type
        bar()
    {
        return mObj;
    }
private:
    T mObj;
};

template<typename T>
void bar2()
{
    Foo<int, float, double> list;
    list.bar<T>();
}

int main()
{
    bar2<float>();
    return 0;
}

This works wonderfully, except on Clang and Visual Studio 2015. Tried both MSVC 19.0 and 19.10, and gives the error:
Compiled with  /EHsc /nologo /W4 /c
main.cpp
main.cpp(30): error C2672: 'Foo<int,float,double>::bar': no matching overloaded function found
main.cpp(35): note: see reference to function template instantiation 'void bar2<float>(void)' being compiled
main.cpp(30): error C2770: invalid explicit template argument(s) for 'std::enable_if<std::is_same<U,T>::value,U>::type Foo<int,float,double>::bar(void)'
        with
        [
            T=int
        ]
main.cpp(18): note: see declaration of 'Foo<int,float,double>::bar'

GCC between at least at least 4.7-6.3 compile this fine. I first thought that this might be to some feature from c++11 missing in Visual Studio 2015, but surprisingly this compiles fine in the older Visual Studio 2013 (MSVC 18.0). Clang also fails.
So my question is, is this a shortcoming of these compilers or is there something I'm doing here that isn't allowed?
If I call "bar" with a hard-coded type like list.bar<int>() it compiles on all tested compilers.

A: To use enable_if here, you need to provide an alternate option, for when is_same<U, T>::value == false.  Ideally, this could be done by exposing all base class members bar with a using-declaration...
using Foo<Ts...>::template bar;

Unfortunately, this is forbidden by the standard, and it was decided not to rectify this.  Therefore, we have to expose them another way.  The simplest solution is thus to make a wrapper for Foo<Ts...>::template bar(), as follows:
template<typename T, typename... Ts>
class Foo<T, Ts...> : public Foo<Ts...>
{
public:
    // using Foo<Ts...>::template bar; // Sadly, this is forbidden.

    template<typename U>
    typename std::enable_if<std::is_same<U, T>::value, U >::type
        bar()
    {
        return mObj;
    }

    // Additional wrapper, to compensate for lack of valid syntax.
    template<typename U>
    typename std::enable_if<!std::is_same<U, T>::value, U >::type
        bar()
    {
        return Foo<Ts...>::template bar<U>();
    }

private:
    T mObj;
};

Note, however, that the wrapper cannot call Foo<Ts...>::bar(), due to it returning void.  Assuming that it's the generic case, intended to be used when U isn't a member of the pack, there are two ways to rectify this:

*

*Modify Foo<Ts...>::bar().
template<typename... Ts>
class Foo
{
public:
    template<typename T>
    T bar()
    {
        // Return an invalid value.
        return T{-1};
    }
};

*Provide a third version of Foo<T, Ts...>::bar(), to be used when U isn't a member of T, Ts...; this one returns Foo<Ts...>::bar().  For this, it would be useful to define a trait to detect whether it's in the pack.
template<typename...>
struct is_in_pack : std::false_type {};

template<typename U, typename T1, typename... Ts>
struct is_in_pack<U, T1, Ts...> :
    std::integral_constant<bool,
                           std::is_same<U, T1>::value ||
                           is_in_pack<U, Ts...>::value>
{};

Then, we just need to use the trait.
template<typename T, typename... Ts>
class Foo<T, Ts...> : public Foo<Ts...>
{
public:
    // using Foo<Ts...>::template bar; // Sadly, this is forbidden.

    template<typename U>
    typename std::enable_if<std::is_same<U, T>::value, U >::type
        bar()
    {
        return mObj;
    }

    // Additional wrapper, to compensate for lack of valid syntax.
    // U is a member of <T, Ts...>.
    template<typename U>
    typename std::enable_if<!std::is_same<U, T>::value &&
                            is_in_pack<U, T, Ts...>::value, U >::type
        bar()
    {
        return Foo<Ts...>::template bar<U>();
    }

    // Additional wrapper, to compensate for lack of valid syntax.
    // U isn't a member of <T, Ts...>.
    template<typename U>
    typename std::enable_if<!is_in_pack<U, T, Ts...>::value>::type
        bar()
    {
        return Foo<>::bar();
    }

private:
    T mObj;
};

Of these options, I would suggest the latter, as it matches your current code more closely.
Simple test.
Convoluted test.

A: The above should not compile.  Your enable_if declaration will mean that bar<U> will only exist if U is an int (i.e. the same as T).  Therefore when you are entering list.bar<T>() it is looking for a function that does not exist.
The following will work, as the function will actually exist if you're using int, as that is what you have declared (Foo<int, float, double> list).
int main()
{
    bar2<int /*float*/>();
    return 0;
}

Edit: Just to elaborate a bit more...
I'm not sure what you're trying to accomplish, but maybe you want your class something like this?
template<typename T, typename... Ts>
class Foo<T, Ts...> : public Foo<Ts...>
{
public:
    using Foo<Ts...>::bar;

    template<typename U>
    typename std::enable_if<std::is_same<U, T>::value, U >::type
        bar()
    {
        // Your "int" one will come through here.

        return mObj;
    }

    template <typename U>
    typename std::enable_if<!std::is_same<U, T>::value, void>::type
        bar()
    {
        // Your "float" one will come through here.
    }
private:
    T mObj;
};


text:
Q: Pfsense and Dns Resolver - SSL/TLS for internal access? I have a Pfsense box that is able to issue/renew acme certificates, with haproxy installed, that has two backend servers that use the generated acme certificate that works fine.
(email and nextcloud servers)
From outside my local network, going to nextcloud.site.com or email.site.com works perfectly, it has the secure ssl certificate through haproxy and it correctly either takes you to the mail site or the nextcloud site
However, on my local network which is behind pfsense, I cannot seem to get dns resolver to give a proper ssl connection to either. This is a problem because when using the nextcloud app on my phone, it'll work fine outside the network but inside it complains that the ssl certificate is incorrect (because only http works inside the network)
I have dns resolver set to forward the same exact nextcloud address (nextcloud.site.com) to the internal ip address, which works but isn't using the ssl certificate. I have the same certificate selected under dns resolver > ssl/TLS certificate
Is this even possible with dns resolver or is there another solution??

A: So I'm assuming this:

*

*pfSense runs HAProxy, externally your clients/peers/whatever connect to the pfSense's WAN IP.

*The Nextcloud box is a host in your LAN or DMZ

*pfSense's DNS available only LAN facing and redirects nextcloud.site.com to the Nextcloud box' LAN/DMZ IP.

*pfSense's HAProxy serves TLS (HTTPS by HAProxy) and has the HSTS header set.

*pfSense's HAProxy proxies nextcloud.site.com to the box in LAN/DMZ to serve external clients

In that case, you have these options:

*

*Remove your DNS override and set up NAT hairpinning/reflection

*Reconfigure your Nextcloud Host to serve its content via HTTPS

*Remove the HSTS header from HAProxy


text:
Q: Python: Why doesn't this work? (iteration over non-sequence) I have a dictionary with each key containing a list as a value. And I'm trying to go over all the items in the lists, and let's say I'm trying to print all the items as I go through, I wrote:
for item in aDict:
    for item2 in aDict[item]:
        print item2

This prints out the items in the list for the first value, then it gives me an error saying "iteration over non-sequence". Why is this and how should I do this?
Thanks in advance.

A: One of your dictionary values is not a list!

A: I'm assuming one of the items in aDict is not a sequence, string, list, tuple etc:
>>> aDict = { 'a' : [1, 2, 3,], 'b' : [4, 5, 6,], 'c' : [7, 8, 9,] }
>>> for item in aDict:
...     for item2 in aDict[item]:
...         print item2
...
1
2
3
7
8
9
4
5
6
>>>

A: When you do this:
for item in aDict:
    for item2 in aDict[item]:
        print item2

Your saying, for each item in the dictionary, loop through the item index in the dictionary, which doesn't make any sense.
What you really want to do is for each item, loop through that specific item, like:
for item in aDict:
    for item2 in item:
        print item2

or using better terms:
for dictIndex in aDict:
        for item in dictIndex:
            print item

A: aDict[item] implies that you want the values of the dict, not the keys?  In which case .itervalues() or .iteritems() should be more natural than the default iteration (over keys only).
for key, value in aDict.iteritems():
    for subvalue in value:
        pass

The error points to (at least one of) your values is not iterable.


text:
Q: Custom Button that add to cart and automatically redirect to checkout I'd like to create a custom button on a product page that needs to add automatically the product i'm on into the cart and send you with that product details to the checkout page.
What i've tried so far :
<?php do_action( 'woocommerce_proceed_to_checkout' ); ?>

That doesnt send you on the checkout if you dont have at least 1 product in cart.
function add_to_cart_checkout_redirect() {
    wp_safe_redirect( get_permalink( get_option( 'woocommerce_checkout_page_id' ) ) );
    die();
}
add_action( 'woocommerce_add_to_cart',  'add_to_cart_checkout_redirect', 11 );

Also doesnt work.
Question:
Can be done?
Am i wrong somewhere?
Thanks in advance.

A: If you want user redirect to checkout page then add this code into your function.php file
function my_custom_add_to_cart_redirect( $url ) {

    $url = WC()->cart->get_checkout_url();
    // $url = wc_get_checkout_url(); // since WC 2.5.0

    return $url;

}
add_filter( 'woocommerce_add_to_cart_redirect', 'my_custom_add_to_cart_redirect' );

Hope it will solve your query .

A: if you can check this way may be help
$product = get_product($id);
echo "add_to_cart_url() ."'>add to cart";

Hope this help!


text:
Q: Edit trigger no longer working after adding additional function I had assistance building this trigger a while back, where "When you select a check box on 'sheet 2', cut all associated rows into 'sheet 1'. Code for this below in the first block. This stopped working when I added the second snippet below that is in a separate script file, not tied within the first one but needs to work actively on the same sheet. Any ideas why this is happening and what the fix would be?
Here is a sample sheet for reference if needed - Sample Sheet

/**
* Simple trigger that runs each time the user hand edits the spreadsheet.
*
* @param {Object} e The onEdit() event object.
*/
function onEdit(e) {
  if (!e) {
    throw new Error(
      'Please do not run the onEdit(e) function in the script editor window. '
      + 'It runs automatically when you hand edit the spreadsheet.'
      + 'See https://stackoverflow.com/a/63851123/13045193.'

    );
  }
  moveRowsByUniqueId_(e);
}

/**
* Triggers on a checkbox click and moves rows that match a unique ID.
*
* @param {Object} e The onEdit() event object.
*/
function moveRowsByUniqueId_(e) {
  let sheet;
  if (e.value !== 'TRUE'
    || e.range.rowStart <= 3
    || e.range.columnStart !== 12
    || (sheet = e.range.getSheet()).getName() !== 'Advance') {
    return;
  }
  e.source.toast('Moving rows...');
  const uniqueId = e.range.offset(0, -1).getValue();
  const range = sheet.getRange('A4:H');
  const values = range.getValues();
  const targetSheet = e.source.getSheetByName('Active Processing');
  const _matchWithId = (row) => row[0] === uniqueId;
  const valuesToAppend = values.filter(_matchWithId);
  if (uniqueId && valuesToAppend.length) {
    appendRows_(targetSheet, valuesToAppend, 1);
    range.clearContent();
    const remainingValues = values.filter((row) => !_matchWithId(row));
    range.offset(0, 0, remainingValues.length, remainingValues[0].length)
      .setValues(remainingValues);
    e.source.toast(`Done. Moved ${valuesToAppend.length} rows.`);
  } else {
    e.source.toast('Done. Found no rows to move.');
  }
  e.range.setValue(false);
}
/**
* Appends an array or a value to the bottom of a sheet starting in
* the given column after the last row where the column is blank.
*
* When optColumn is provided, appends data starting in that column
* after the last row where that column has visible content.
*
* When optColumn is not provided, appends data starting in column A
* after the last row that has visible content in any column.
*
* Use Range.getRichTextValues() to preserve text formatting such as bold,
* italic, underlined, font and text colors when appending textual data.
* To append numbers, dates and plain text, use Range.getValues().
*
* @param {SpreadsheetApp.Sheet} sheet A spreadsheet sheet to append the data to.
* @param {Object[][]} data The plain or formatted data to append: a 2D array, a 1D array or a single value.
* @param {Number} optColumn Optional. The column number where to start appending the data. Defaults to 1.
* @return {Object} An object with fields {Range} range, {Number} rowStart, columnStart, numRows, numColumns.
*/
function appendRows_(sheet, data, optColumn) {
  'use strict';
  // version 1.10, written by --Hyde, 15 June 2022
  if (!Array.isArray(data)) {
    data = [[data]];
  } else if (!Array.isArray(data[0])) {
    data = [data];
  }
  let action = 'setValues';
  if (data.some(row => row.some(value => value.getRuns))) {
    action = 'setRichTextValues';
    data = data.map(row => row.map(value => value.getRuns
      ? value
      : SpreadsheetApp.newRichTextValue().setText(value).build()
    ));
  }
  const rowStart = getLastRow_(sheet, optColumn) + 1;
  const columnStart = Number(optColumn) || 1;
  const numRows = data.length;
  const numColumns = data[0].length;
  const range = sheet.getRange(rowStart, columnStart, numRows, numColumns);
  range[action](data);
  return { range: range, rowStart: rowStart, columnStart: columnStart, numRows: numRows, numColumns: numColumns };
}

/**
* Gets the position of the last row that has visible content in a column of the sheet.
* When column is undefined, returns the last row that has visible content in any column.
*
* @param {Sheet} sheet A sheet in a spreadsheet.
* @param {Number} columnNumber Optional. The 1-indexed position of a column in the sheet.
* @return {Number} The 1-indexed row number of the last row that has visible content.
*/
function getLastRow_(sheet, columnNumber) {
  // version 1.5, written by --Hyde, 4 April 2021
  const values = (
    columnNumber
      ? sheet.getRange(1, columnNumber, sheet.getLastRow() || 1, 1)
      : sheet.getDataRange()
  ).getDisplayValues();
  let row = values.length - 1;
  while (row && !values[row].join('')) row--;
  return row + 1;
}

function onEdit(e) {
  var range = e.range;
  var editor = e.user.getEmail();
  const CURRENT_DATE= new Date();
  if (editor == '' || editor == null) {
    editor = 'Unknown';
  }
  editor = editor.split("@")[0];

  if  (range.getValue() >= 1111111 & range.getValue() <= 9999999) {
    if (range.getA1Notation().search('L') != -1) {
        range.offset(0, -2).setValue(editor);
        range.offset(0, 1).setValue(CURRENT_DATE);
    };
  };
}

A: There can only be one active onEdit() function in a script project. Putting the second onEdit() function in a separate file does not help because it is still in the same script project. See Which function runs when there are multiple script projects bound to the same Google Sheet?
To make it work, see these onEdit(e) best practices.


text:
Q: iTextSharp - does not contain a definition for 'getInstance' I'm trying to generate a pdf from image with iTextSharp, but I'm getting the following errors: iTextSharp.Image does not contain a definition for 'getInstance' and 'iTextSharp.text.Document does not contain a definition for 'add' and 'iTextSharp.text.Document does not contain a definition for 'newPage' and iTextSharp.text.Image does not contain a definition for 'scalePercent'**
I have already add the iText Library (itextsharp, itextsharp.pdfa and itextshar.xtra). here is my code:
       private void button3_Click_1(object sender, EventArgs e)
    {

        saveFileDialog1.FileName = "name.pdf";
        if (saveFileDialog1.ShowDialog() == DialogResult.OK)
        {
            using (Bitmap bitmap = new Bitmap(panel1.ClientSize.Width,
                                                panel1.ClientSize.Height))
            {
                panel1.DrawToBitmap(bitmap, panel1.ClientRectangle);
                bitmap.Save("C:\\" + (nPaginasPDF + 1) + ".bmp", ImageFormat.Bmp);
            }

            Document doc = new Document();
            PdfWriter.GetInstance(doc, new FileOutputStream(yourOutFile));
            doc.Open();

            for (int iCnt = 0; iCnt < nPaginasPDF; iCnt++)
            {

                iTextSharp.text.Image image1 = iTextSharp.text.Image.GetInstance("C:\\" + (iCnt + 1) + ".bmp");
                image1.ScalePercent(23f);
                doc.NewPage();
                doc.Add(image1);
            }
            using (var Stream = saveFileDialog1.OpenFile())
            {
                doc.Save(Stream);
            }
            doc.Close();
        }

A: If you use iText documentation or books for Java, you need to adapt things a bit for .NET. In your example, since .NET implicit getters and setters for properties, this:
var instance = iTextSharp.Image.getInstance();

becomes this:
var instance = iTextSharp.Image.Instance;

Second issue: method names in Java are camel case, vs .NET pascal case, so this (camelCase):
image1.scalePercent(23f);
doc.newPage();
doc.add(image1);

becomes this (PascalCase):
image1.ScalePercent(23f);
doc.NewPage();
doc.Add(image1);

And so on. Just apply .NET code naming conventions instead of Java's.

A: Both @Nenad and @MaxStoun are correct, you just need to adapt the Java conventions to .Net. Additionally, you'll also need to swap the Java FileOutputStream for the .Net System.IO.FileStream object.
EDIT
You have some "magic variables" in there that I need to work around. For instance, I'm not 100% sure what you're doing with your for loop so I just removed it for this sample. Also, I don't have write permissions to my c:\ directory to I'm saving to the desktop. Otherwise, this code should hopefully get you on the correct path.
  //I don't know what you're doing with this variable so I'm just setting it to something
  int nPaginasPDF = 10;

  //I can't write to my C: drive so I'm saving to the desktop
  string saveFolder = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);

  //Set the default file name
  saveFileDialog1.FileName = "name.pdf";

  //If the user presses "OK"
  if (saveFileDialog1.ShowDialog() == DialogResult.OK) {
      //Create a bitmap and save it to disk
      using (Bitmap bitmap = new Bitmap(panel1.ClientSize.Width, panel1.ClientSize.Height)) {
          panel1.DrawToBitmap(bitmap, panel1.ClientRectangle);
          //Path.Combine is a safer way to build file pathes
          bitmap.Save(System.IO.Path.Combine(saveFolder, nPaginasPDF + ".bmp"), ImageFormat.Bmp);
      }

      //Create a new file stream instance with some locks for safety
      using (var fs = new System.IO.FileStream(saveFileDialog1.FileName, System.IO.FileMode.Create, System.IO.FileAccess.Write, System.IO.FileShare.None)) {
          //Create our iTextSharp document
          using (var doc = new Document()) {
              //Bind a PdfWriter to the Document and FileStream
              using (var writer = PdfWriter.GetInstance(doc, fs)) {
                  //Open the document for writing
                  doc.Open();
                  //Get an instance of our image
                  iTextSharp.text.Image image1 = iTextSharp.text.Image.GetInstance(System.IO.Path.Combine(saveFolder, nPaginasPDF + ".bmp"));
                  //Sacle it
                  image1.ScalePercent(23f);
                  //Add a new page
                  doc.NewPage();
                  //Add our image to the document
                  doc.Add(image1);

                  //Close our document for writing
                  doc.Close();
              }
          }
      }
  }

A: You'll upper first letter in method name (I just downloaded it from Nuget)
Image.getInstance(); => Image.GetInstance();
doc.add(image1); => doc.Add(image1);