text:
Q: How to best estimate the time remaining for a variable-length questionnaire? The greatest gain of the statistics classes in both school and university seems to be that I now have an inkling of which QA site to use for this question. :)
I'm a programmer and I'm making a questionnaire with a financial background. There will be many (probably over 100) questions, which will be presented to the user one-by-one, like in a wizard. Since it answering them all will be quite time consuming (likely over an hour), it would be best if the user interface could show the estimated time remaining - both for the current question and all remaining together.
As there is no way of determining beforehand how long a question will take, my idea was to gather statistical data about it (especially during alpha/beta stages). The naive approach would be to just average the times taken for each question, but (thanks again to the above mentioned statistics classes) I'm aware that this isn't really the best way to do it. There are all kinds of normal distribution curves, error calculations, approximation methods, and other arcane mathematical artifacts that I could not even begin to dream about.
Some more information:

*

*Questions are of very varying lengths. There are simple yes/no questions, and there are questions that will make you scratch your head. There are questions that ask to enter your contact details, and there are questions that require to meticulously fill a 30-row table. Some questions will ask you to calculate stuff. Some questions will require you to fetch some paperwork from your employer or something. Which brings up another point:

*The whole process can be suspended/saved and resumed at a later time. This shouldn't happen very often, but given the length of the process, and that some people don't pay attention to the pre-requirements, it can happen.

*Some questions may not be applicable based on answers to previous questions. For example, there might be a row of questions which are only applicable to businesses and not private persons.

*Some questions are essentialy duplicated based on previous questions. For example, if you entered that in the past year you worked for 4 employers, you will need to enter the same data for each of them.

*I can detect:

*

*When the user starts/finishes a question. Hence, I can calculate the duration.

*When the user goes idle. This is rather imprecise. I can only detect when there is no keyboard/mouse activity. This can be because the user has gone away, but it can also mean that he is digging through the papers looking for numbers. Or (since it will be a webpage), maybe he simply switched to another program - or another tab in the browser.

*Which questions have been answered, which definately will need to be answered, which definately won't need to be answered, and which might need to be answered. For the last type of questions, I'm not sure if it might be possible to calculate a meaningful probability based on previous answers. Perhaps.

So... any ideas on how to tackle this estimate? Remember - I'm going for maximum accuracy (or is it precision? better make it both), and would rather have better estimates than lower resource usage.

A: I do not see why averages should not work.  You might want to use winsorized or trimmed averages  to  guard against outliers, which are likely due to inability to tell exactly whether user is idle or not. Then for the estimated time remaining show the sum of the averages for each question. You could build more complicated and precise methods if you collected data on the completed time together with user characteristics. For that though you will probably need another questionaire, so unless you are expecting a lot of feedback in alpha and beta phases, I suggest using the simple averages. Sometimes simplest methods work the best.

A: As @mpiktas points out, simple is good.  But I can't help thinking there will be substantial variation among users.  Roughly, we can conceive of the time to complete each question as depending on the question and on the user, so the trick is to tease out the question-specific timing factors from the experience of previous users and to estimate the user-specific timing factor from the user's experience with the questions they have already tackled.
This opens up the possibilities greatly.  A good answer would rely on exploratory analysis of preliminary data.  In general, though, a combination of (1) determining a suitable way to express question completion times (logarithms?  square roots?) and (2) robust analysis of variance techniques (such as median polish) or IRLS regression is likely to do far better than ignoring the user-specific factors ("simple averaging").
Once you have estimated question-specific timing factors, which could be as simple as computing median or mean times per question, you could easily estimate the timing factor for a new user by comparing their times to typical times for the questions they have already attempted.  For instance (this is truly simplistic, but gives the flavor of the idea) if they take twice as long to complete the first five questions as the sum of the typical completion times for those questions, you could estimate that this user will take twice as long as the average to complete the next 95 questions.  You can then add the average completion times for those 95 questions and double the sum.


text:
Q: How to encode post content as JSON? I`m trying to construct a json object but are having difficulties with the_content since it returns newlines, which causes the script to fail. The error messages received is: Uncaught SyntaxError: Unexpected token ILLEGAL
Example of the json:
[ {image : 'http://localhost/wp-content/uploads/2012/04/example.png', title: 'Example string

with newlines
that outputs illegally!'}]

Ideally I'd want it to output the HTML content (as seen when pressing the HTML tab in the editor).

A: To output JSON always the function json_encode( $string ). The function is not available on all hosts. Don't worry, WordPress offers a fallback in wp-includes/compat.php. That's a wrapper for class Services_JSON::encodeUnsafe() (see wp-includes/class-json.php).
If you take a look at the source you'll see: It's not a trivial job to encode a string. :)
There is a small difference: The native PHP json_encode() accepts a second parameter $options since PHP 5.3.0. The WordPress fallback doesn't.
New lines are encoded as '\n' in JSON; you cannot get the same output as in the HTML tab in TinyMCE.
And there is, of course, also a fallback for json_decode() in case you need it.

A: You also have a wp function : wp_json_encode() that can do the job
https://developer.wordpress.org/reference/functions/wp_json_encode/

redpajama_set_name: RedPajamaStackExchange


text:
Q: NullPointerException on a button click in Android I am really stuck on this issue I have in my app, which causes a crash after a button click.
I have a singleton class of "Comment" objects(CommentLab class, saves comments in an arrayList), a CommentListFragment that has a listView of my comments, and PostCommentFragment for the purpose of adding new comments to the arrayList in CommentLab.
I added a OptionMenu to my CommentListFragment, and when I click on New Comment item in optoinMenu, I want it to start the CommentListFragment class where I can edit and add a new comment.
Here are the parts of code that are working together to make it possible:
In CommentListFragment:
// method to add an option menu to the fragment
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    super.onCreateOptionsMenu(menu, inflater);
    inflater.inflate(R.menu.fragment_comment_list, menu);
}

// method to indicate what to do when an item is selected on the menu(which,what)
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()){
        case R.id.menu_item_new_comment:
            Comment comment = new Comment();
            CommentLab.get(getActivity()).addComment(comment);
            Intent i = new Intent(getActivity(), PostCommentActivity.class);
            i.putExtra(PostCommentFragment.EXTRA_COMMENT, comment.getId());
            startActivity(i);
            return true;
        default:
            return super.onOptionsItemSelected(item);
    }
}

PostCommentActivity(a hosting activity for PostCommentFragment):
public class PostCommentActivity extends SingleFragmentActivity{

@Override
protected Fragment createFragment() {
    UUID commentId = (UUID)getIntent().getSerializableExtra(PostCommentFragment.EXTRA_COMMENT);
    return PostCommentFragment.newInstance(commentId);
}

}
PostCommentFragment:
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    UUID commentId = (UUID)getArguments().getSerializable(EXTRA_COMMENT);
    mComment = CommentLab.get(getActivity()).getComment(commentId);
}

    @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.fragment_post_comment, container, false);
    mCommentEditText = (EditText) v.findViewById(R.id.title_edit_text);
    mCommentEditText = (EditText) v.findViewById(R.id.comment_edit_text);
    mDateTextView = (TextView) v.findViewById(R.id.date_text_view);
    mDateTextView.setText(mComment.getDate().toString());
    mPostButton = (Button) v.findViewById(R.id.post_button);

    mPostButton.setOnClickListener( new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            String title = mTitleEditText.getText().toString();
            String comment = mCommentEditText.getText().toString();
            mComment.setTitle(title);
            mComment.setComment(comment);
        }
    });

    return v;
}

When I click the Post button in PostCommentFragment, the app crashes...here is the logcat:
08-01 00:39:29.720    7442-7442/com.example.ashl7.E/AndroidRuntime﹕ FATAL EXCEPTION: main
    java.lang.NullPointerException
            at com.example.ashl7.PostCommentFragment$1.onClick(PostCommentFragment.java:46)
            at android.view.View.performClick(View.java:3534)
            at android.view.View$PerformClick.run(View.java:14263)
            at android.os.Handler.handleCallback(Handler.java:605)
            at android.os.Handler.dispatchMessage(Handler.java:92)
            at android.os.Looper.loop(Looper.java:137)
            at android.app.ActivityThread.main(ActivityThread.java:4441)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:511)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
            at dalvik.system.NativeStart.main(Native Method)

Anyone can figure this out please?

A: You made a copy-paste error. You're assigning to mCommentEditText twice, and never assigning to mTitleEditText.

A: mCommentEditText = (EditText) v.findViewById(R.id.title_edit_text);
mCommentEditText = (EditText) v.findViewById(R.id.comment_edit_text);

Initializing twice ..
please check it

A: Becasuse you are using  mTitleEditText  without reference it with object R.id.title_edit_text
Simply Change the below code
mCommentEditText = (EditText) v.findViewById(R.id.title_edit_text);
mCommentEditText = (EditText) v.findViewById(R.id.comment_edit_text);

to
mTitleEditText = (EditText) v.findViewById(R.id.title_edit_text);
mCommentEditText = (EditText) v.findViewById(R.id.comment_edit_text);

It will work for you .


text:
Q: NiFi How to Add Months to a Date I know one can add milliseconds to a date for adding days or weeks:
https://nifi.apache.org/docs/nifi-docs/html/expression-language-guide.html#now
But since months' lengths are different, that will not work. How can I add 6 months to the now() function of NiFi?

A: Unfortunately doing this reliably (as you've noted) is not really ideal using only Expression Language.
The most reliable method to do this would be:

*

*UpdateAttribute to set a new attribute with ${now()}

*ExecuteGroovyScript with a simple piece of Groovy to

*

*Get the attribute

*Use Groovy date/time functions to safely add to the date

*Set the attribute value

Cookbook Part 1 covers how to work with FF Attributes.
E.g.
flowFile = session.get()
if(!flowFile) return
my_date = flowFile.getAttribute('my_date')
// Modify your date here
flowFile = session.putAttribute(flowFile, 'my_date', my_date)

A: this code subtract 60 days from a attribute named 'date_original' and add new attribute with the new date
flowFile = session.get()
if(!flowFile) return
     formatoAccettato = "yyyy-MM-dd"
     dataOriginale = flowFile.getAttribute('data_originale')
     dataOriginaleDate = Date.parse(formatoAccettato, dataOriginale)
     sottrazione = dataOriginaleDate - 60
     dataSottratta = sottrazione.format(formatoAccettato)
     flowFile = session.putAttribute(flowFile, 'data_modificata', dataSottratta)
session.transfer(flowFile, REL_SUCCESS)

A: After needing this time and again, I just decided to do it the workaround way without using external scripts which potentially break with upgrades and adds complexity. The below deducts one month.

use below for testing dates:
${literal('2022-01'):toDate('yyyy-MM')} #202112
${literal('2022-09'):toDate('yyyy-MM')} #202208
${literal('2022-11'):toDate('yyyy-MM')} #202210

${this_month:equals("1"):ifElse("12",${this_month:minus(1)})}
${this_month:equals("1"):ifElse(${this_year:minus(1)},${this_year})}

${new_year:append(${new_month:padLeft(2,"0")})}

Hope this helps someone somewhere out there.


text:
Q: Can anyone simplify this python (Jupyterlab) code? I'm learning from IBM skill dev. and I don't understand why they makes it so complex(for ex: using if not, why did they use if not?).
I understand they write the xlxs data into airport_data but there must be some easy way. can anyone explain?
code:
if not os.path.isfile("./Airport_Data.xlsx"):
    r = requests.get("https://cf-courses-data.s3.us.cloud-object-storage.appdomain.cloud/analysing-spreadsheet-data-with-python/Airport_Data.xlsx")
    f = open("./Airport_Data.xlsx", mode = "wb+")
    f.write(r.content)
    f.close()

A: 'Checking if the file exists already, if it dosent go forward'
if not os.path.isfile("./Airport_Data.xlsx"):

'Creating a get Request from the url where the data is'
r = requests.get("https:'cf-courses-data.s3.us.cloud-object-storage.appdomain.cloud/analysing-spreadsheet-data-with- python/Airport_Data.xlsx")

'Open-Create the file in wb+ mode'
f = open("./Airport_Data.xlsx", mode = "wb+")

'Write Data and close the file'
f.write(r.content)
f.close()

It seems like it's for checking if the file already Exists, in that case it wouldn't be neccesary to download it. I scrambled the syntax a bit to make it easier to see whats going on.

A: Simplified code:
with requests.get("https://cf-courses-data.s3.us.cloud-object-storage.appdomain.cloud/analysing-spreadsheet-data-with-python/Airport_Data.xlsx") as r:
    df = pd.read_excel(r.content)


text:
Q: how to access an ecs task with out using any port I have an ecs task running and to access that currently, I am using:
http://domainname:port

I don't want to mention the port in the URL when I am using http://domainname it should automatically redirect to port . What is the best way to do this?

A: The default port for HTTP traffic is port 80. If you try to attempt an HTTP connection without specifying a port, then port 80 will be used. So if you want to access your URL without specifying a port, you need to configure it to use port 80.


text:
Q: How to get an arraylist in a javascript file? I'm here because I want to get an arraylist from database but when i refresh my page the function is not instantly executed. I want to use a for loop on that array but it doesn't initialize the array before entering in the for loop.
Here is my function to request the array from database :
function fetch_constraint(){

    $.ajax({
        type:"GET",
        dataType: 'text',
        url: build_url(url_ttconstraints),
        async: true,
        contentType: "application/json",
        success: function(msg){
            constraints = JSON.parse(msg);
        },
        error: function (msg){
            console.log("error");
            show_loader(false);
        }
    })
    return constraints;
};

Then I call that function so the array can be in the head of the js file:
fetch_constraint();

as a result with console.log(fetch_constraint()); after the fetch function I get:
undefined
But when i use the function in the console it works and I get the array.
Sorry for my bad english.


text:
Q: NodeJs - sockets io - client system auto reconnect I want to create a client of socket's io server, where in x and x seconds try make a connection to socket's io server, to verify is server is already up.
What i have in client:
src="http://localhost:90/socket.io/socket.io.js" - load script
var serverStatus = recconectToServer();

        setInterval(function(){

            if (serverStatus) {
                $(".results-server").append("
connection up.
");
            } else {
                recconectToServer();
            }
        },3000);

        function recconectToServer() {
            $(".results-server").append("
try connection.
");
            try {
                var socket = new io.connect("http://localhost:90");
                return true;
            } catch(err) {
                $(".results-server").append("
server down.
");
                console.log(" Erro = "+ err);
                return false;
            }
        }

Situations:
IF client try to connect when server is down i receive this message:
"ReferenceError: io is not defined"
That is normal because server is down, then i start server and client when try make connection (without refresh page) continues receive this message "ReferenceError: io is not defined"
But why this happen?
NOTE: If i execute refresh client page, when server is running, client connect without any problem.
UPDATED:
Real problem: the event connected_failed from sockets.io dont work, like others questions that exist in stackoverflow. So for resolve this i did the next solution:
My solution:

Conclusion:
   When server become up again, will be redirect to other page, where continue the initial process.
I don't know if this is the best solution, if someone have one better, please tell me.

A: When your server is down, you cannot serve the client script for socket.io. Therefore io is not defined.
The reconnect will not work because the client never tries to reload the client script.
When the server is already running, the client script can be accessed and io is defined.
Therefore you should extend your reconnectToServer function to try to reload the client script if neccessary, perhaps something like
if(io === undefined)
    $(".results-server").append("


text:
Q: Sparkle Error: The update is improperly signed I am using sparkle for software update. I signed my app with Apple developer certificate and uploaded the build. Then I tried to update by calling 'checkForUpdates:' method. But I am getting an error saying "Update is not properly signed". What might be the reason? Did I miss anything?

A: You likely need to review the tips about how to codesign properly for Sparkle here:
https://github.com/sparkle-project/Sparkle/issues/216
Specifically, sign all binaries and frameworks, and do so with the proper codesign arguments.


text:
Q: Simulink: fatal error: MQTTAsync.h: No such file or directory I am trying to build an MQTT system on a raspberry pi. I was studying about MQTT and read about it a lot. I found a set of MQTT blocks in the Simulink Raspberry Pi Hardware Support Package that I assumed I could directly use. I configured an MQTT server and got all the right credentials and everything but I am now stuck on one part that has left me stumped.
I keep getting this error saying that "fatal error: MQTTAsync.h: No such file or directory". I have looked a lot trying to find anything that might help me but I couldn't. I don't know where to get the necessary files that I need or if there is any solution to sort this. I'm sharing the entire snippet of the error if that is of any help. Thanks in advance.
I apologize I'm not able to get to the whole error into a code block
Error executing command "touch -c /home/pi/MATLAB_ws/R2022a/C/Users/User/Documents/MATLAB/Project_RPi_ert_rtw/*.*;make  -f Project_RPi.mk all MATLAB_WORKSPACE="/home/pi/MATLAB_ws/R2022a" -C /home/pi/MATLAB_ws/R2022a/C/Users/User/Documents/MATLAB/Project_RPi_ert_rtw LC_ALL=C". Details:

STDERR: In file included from /home/pi/MATLAB_ws/R2022a/C/ProgramData/MATLAB/SupportPackages/R2022a/toolbox/realtime/targets/linux/src/MW_MQTT.c:5:
/home/pi/MATLAB_ws/R2022a/C/ProgramData/MATLAB/SupportPackages/R2022a/toolbox/realtime/targets/linux/include/MW_MQTT.h:49:10: fatal error: MQTTAsync.h: No such file or directory
 #include <MQTTAsync.h>
          ^~~~~~~~~~~~~
compilation terminated.
make: *** [Project_RPi.mk:411: MW_MQTT.c.o] Error 1

STDOUT: make: Entering directory '/home/pi/MATLAB_ws/R2022a/C/Users/User/Documents/MATLAB/Project_RPi_ert_rtw'
gcc -c -MMD -MP -MF"MW_MQTT.c.dep" -MT"MW_MQTT.c.o" -O2  -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -DMW_CAN_BITRATE=500000 -DMW_CAN_ALLOWALLMSGS=1 -DMW_NUM_MQTT_SUBSCRIBE=1 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTERMFCN=1 -DONESTEPFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0  -DTID01EQ=0 -D__linux__ -DARM_PROJECT -D_USE_TARGET_UDP_ -D_RUNONTARGETHARDWARE_BUILD_ -DSTACK_SIZE=64 -DRT -DMODEL=Project_RPi -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DMODEL_HAS_DYNAMICALLY_LOADED_SFCNS=0 -I/home/pi/MATLAB_ws/R2022a/C/Users/User/Documents/MATLAB -I/home/pi/MATLAB_ws/R2022a/C/ProgramData/MATLAB/SupportPackages/R2022a/toolbox/realtime/targets/linux/include -I/home/pi/MATLAB_ws/R2022a/C/ProgramData/MATLAB/SupportPackages/R2022a/toolbox/target/shared/svd/include -I/home/pi/MATLAB_ws/R2022a/C/ProgramData/MATLAB/SupportPackages/R2022a/toolbox/realtime/targets/raspi/include -I/home/pi/MATLAB_ws/R2022a/C/Users/User/Documents/MATLAB/Project_RPi_ert_rtw -I/home/pi/MATLAB_ws/R2022a/C/Program_Files/MATLAB/R2022a/extern/include -I/home/pi/MATLAB_ws/R2022a/C/Program_Files/MATLAB/R2022a/simulink/include -I/home/pi/MATLAB_ws/R2022a/C/Program_Files/MATLAB/R2022a/rtw/c/src -I/home/pi/MATLAB_ws/R2022a/C/Program_Files/MATLAB/R2022a/rtw/c/src/ext_mode/common -I/home/pi/MATLAB_ws/R2022a/C/Program_Files/MATLAB/R2022a/rtw/c/ert -I/home/pi/MATLAB_ws/R2022a/C/Program_Files/MATLAB/R2022a/toolbox/coder/rtiostream/src/utils -I/home/pi/MATLAB_ws/R2022a/C/Program_Files/MATLAB/R2022a/toolbox/target/codertarget/rtos/inc -o "MW_MQTT.c.o" "/home/pi/MATLAB_ws/R2022a/C/ProgramData/MATLAB/SupportPackages/R2022a/toolbox/realtime/targets/linux/src/MW_MQTT.c"
make: Leaving directory '/home/pi/MATLAB_ws/R2022a/C/Users/User/Documents/MATLAB/Project_RPi_ert_rtw'


text:
Q: Is "autonym" an autonym? I believe this is set theory, but I don't really know set theory, so...
An autonym is a word that refers to a property that the word itself happens to possess. For example "noun" is an autonym because "noun" is a noun. "Word" is an autonym. "Pentasyllabic" is too. "Poop" is not, unless you can poop words. (I can't.)
So. Is "autonym" an autonym? If you can't prove "yes" or "no" exclusively, does that make it a restatement of some axiom of set theory?


text:
Q: How to run multiple Test Group in single .jmx using jmeter I have created one Test plan, and inside it have added 5 Test Group.
I am able to run 1 Test Group at a single time.
Is there any way, where 5 test group can be run in single jmx file ?

A: Check "Run Test Groups consecutively" box status (under Test Plan properties). If you uncheck it you'll have all your thread groups running in parallel.
However you need to remember that variables cannot be passed between different thread groups and if your test logic assumes creating some entities in one thread group, reading them in another, editing in the third and deleting in the fourth you may wish to learn how to pass variables and cookies between different thread groups.


text:
Q: Download javascript data to a file in IE8 I have code to download javascript variables as files but it is not working in IE8, how would I do this in IE8?
function download(filename, text) {
    var pom = document.createElement('a');
    pom.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text));
    pom.setAttribute('download', filename);

    document.body.appendChild(pom)
    pom.click();

    // Remove anchor from body
    document.body.removeChild(pom)
}

A: In IE 8 and 9 data URIs can only be used for images, but not for navigation or Javascript generated file downloads.
see http://en.wikipedia.org/wiki/Data_URI_scheme#Disadvantages
you can achieve the download with server side processing of the file.


text:
Q: Using a ICollection Value in sqlite SELECT parameterized statment Im trying to get all the entrys from a sqlite Database which have the same name
as the keys in a Hashtable.
My Statement looks like this.
// the keys from the hashtable are names equivalent
// to name entrys in the SomeTable Names Collumn
Hashtable names;

String query = "SELECT Id, Name FROM SomeTable WHERE Name LIKE (@Names)";
SQLiteCommand command = new SQLiteCommand(query, _databaseConnection);
command.Parameters.AddWithValue("@Names", names.Keys);
SQLiteDataReader reader = reader.ExecuteReader();

while(reader.Read())
{
     Console.WriteLine("Name: {0}, ID: {1}", reader[1].ToString(), reader[0].ToString());
}

Im totally sure there are similar values in the Database, but i get nothing back and the reader does not execute.
Is it impossible to add a ICollection as a Parameter Value so i need to start the reader only one time?

A: You don't want a LIKE clause in that select, you want an IN clause.
e.g. ultimately, you'd like to execute a query such as:
SELECT Id, Name FROM SomeTable WHERE Name IN ('case23', 'carson63000', 'fred')

Unfortunately, it seems that adding this in as a Parameter is not straightforward.
I found an older question, "Parameterizing a SQL IN clause?", which may provide some ideas.

A: SO to finish this up. Thanks to the link i got from Carlson63000 i got somthing working.
// First i build two String[] based on my Hastable.Keys.
// One which holds the values, one which creates parameter names.

Hashtable hashNames;
String[] names = new String[hashName.Keys.Count];
String[] nameTags = new String[hashName.Keys.Count];
int c = 0;

foreach (String k in hashName.Keys)
{
     names[c] = k;
     nameTags[c] = "@tag" + c.ToString();
     c++;
}

// after this i create my statement using the nameTags String[]

String statementValueTags = String.Join(",", nameTags);
String query = String.Format("SELECT Name, FROM SomeTable WHERE (Name IN ({0}))", statementValueTags);

// for adding the parameterized Statements i use a for loop
// where i add the values from my String[]
SQLiteCommand command = new SQLiteCommand(query, _databaseConnection);
for (int i = 0; i < names.Length; i++)
{
     command.Parameters.AddWithValue(nameTags[i], names[i]);
}
SQLiteDataReader reader = command.ExecuteReader();

while(reader.Read())
{
     Console.WriteLine(reader[0]);
}


text:
Q: Build Clickable Link Using Multiple Attributes I am trying to build a function for WordPress (running Elementor, if that matters) that will concatenate 3 items to build a URL, then display that URL in a link that will open in a new window.   The start and end of the URL are both static text, and the middle comes from another function via shortcode.  I plan to add this to the site in a snippet.
Here is what I have so far.  As you will see, I don't have anything in the heart of the function, which is the "Build URL" section, and I'm not sure if the other sections are done right either.  Other than that, it's pretty much complete ;-)
// Function content
function item_link( $atts ) {

    // Only run on pages tied to a single product
    global $post, $product;

    // Get the item data from the shortcode
    $URLslug = do_shortcode( '[contractAddress]' );

    // Set pre- and post- text for URL
    $PREtext = 'https://finance.yahoo.com/quote/';
    $POSTtext = '/history';

    // Build URL
    // This should create clickable link with URL equal to $PREtext + $URLslug + $POSTtext
    // Link text should be 'Click here to view results'
    // Link should open in new window

}

// Assign function to shortcode
add_shortcode('See In New Window', 'item_link');

Any help greatly appreciated!


text:
Q: Installing Octave 4.2.0 from source on ubuntu? I'm trying to build octave 4.2.0 from source, but couldn't due to dependencies.
I'm following instructions at Obtaining the Dependencies Automatically.
but I'm unable to install and am getting following error:
You must put some 'source' URIs in your sources.list

I need help to build octave on ubuntu?

A: You can try out this for version 4.2.1:
First remove any version of Octave if present
sudo apt-get remove octave

then do the following:
sudo apt-add-repository ppa:octave/stable
sudo apt-get update
sudo apt-get install octave

A: if u want to compile from source make sure this all dependence are installed:
sudo apt-get openjdk-8-jdk gcc g++ gfortran libpcre3-dev libqhull-dev libbz2-dev libhdf5-dev libfftw3-dev libsndfile1-dev libglpk-dev libcurl4-gnutls-dev libfreetype6-dev libgraphicsmagick1-dev libgraphicsmagick++1-dev libparpack2 libncurses5-dev libreadline6-dev libsqlite3-dev tix-dev libssl-dev gperf flex bison gnuplot libfltk1.3-dev libarpack++2-dev libqrupdate-dev libosmesa6-dev libqscintilla2-qt5-dev libqscintilla2-dev  qttools5-dev-tools libxft-dev libgl2ps-dev libgdbm-dev liblzma-dev libffi-dev  libsundials-dev

or you could just do sudo apt-get build-dep octave to install all the above dependences though its not the best way to do so as the Wiki Octave Page explains
Then :
## wget ftp://ftp.gnu.org/gnu/octave/octave-<version-preferred>
wget ftp://ftp.gnu.org/gnu/octave/octave-4.4.1.tar.xz

## tar xf octave-<version-preferred>
tar xf octave-4.4.1.tar.xz

## rm octave-<version-preferred>
rm octave-4.4.1.tar.xz

## cd octave-<version-preferred>/
cd octave-4.4.1/

./configure
make -j8
sudo make install


text:
Q: Which zsh shell theme is this? I got an image from Facebook which is beautiful i want to make my Arch Linux machine just like this image,

 I have installed Arch Linux with Deepin Desktop Environment also installed neofetch, i am stuck on zsh shell theme which you can see in image, i tried to search in oh-my-zsh repositorieshttps://github.com/robbyrussell/oh-my-zsh/wiki/Themes but can't find also i am unable to install Arc-Flatabulous theme & Flat-Remix icons

A: Try this below instruction:
first list all the install shell in your current system:
chsh -l
then change your shell like this: (in your case zsh:
chsh -s /bin/zsh
and now restart or logout and login.
then install oh-my-zsh theme from here :
https://github.com/robbyrussell/oh-my-zsh
installation command looks like:
sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"
after this open file ~/zshrc: nano ~/.zshrc
and change the ZSH_THEME to: ZSH_THEME="fino" (you can set to any theme you like)
now open a new terminal.. and check its work or not.
let me know this works or not. if its work..
add a screenshot in your question and mark my post as answer.

A: The theme in your screenshot is jovial.
It can be found here: https://github.com/zthxxx/jovial


text:
Q: How to connect to a database with all saved connections at a time in Oracle SQL Developer I have around 20 DB connections in Oracle SQL Developer and to connect each separate connection eats my time so I want to know any option to connect all DB connections using single click or minimum efforts.

A: There is no option to connect more than one database at a time.
So it would be 20 mouse-clicks, and 20 right-arrows to open 20 connections.
I would advise you to open them as needed, as connections are not cheap, client or server perspective. And we run a ton of queries on a connect, so it's not a simple thing in and of itself either.

A: What I found after trial and error that if I shut down my machine and restart then it takes less time to connect even less than 10 seconds.


text:
Q: using form, javascript validation is not working I want to post value to next page, so I have to used <form></form>tag. But when I insert  tag in code, then validation code is not working, I have no idea what is going with my code. Can anybody please tell me how to solve it.
Using  tag, 1 and 4 options validation is not working but at same time using  2 & 3 option validation is working.
My question is - what exactly happen with subquestion of 1 & 4, code validation, why it is not working.

window.onload=function(){
  document.getElementById("firstsubque1").style.display='none';
  document.getElementById("firstsubque2").style.display='none';
  document.getElementById("second").style.display='none';
  document.getElementById("third").style.display='none';
  document.getElementById("fourthsubque1").style.display='none';
  document.getElementById("fourthsubque2").style.display='none';

}
function showtech()
{
  if(document.getElementById("ques1").checked)
  {
 document.getElementById("first").style.display='none';
    return false;
  }
}

function firstque()
{
   if(document.getElementById("ques1").checked)
   {
   document.getElementById("subopt1").style.display='block';
   document.getElementById("tbl1").style.display='none';
      document.getElementById("subopt2").style.display='block';
   document.getElementById("subopt22").style.display='none';
   document.getElementById("firstsubque1").style.display='block';
   document.getElementById("firstsubque2").style.display='block';
    }
}

function firstqueUnchk()
{
   if(!(document.getElementById("ques1").checked))
   {
   document.getElementById("subopt1").style.display='none';
   document.getElementById("subopt11").style.display='none';
      document.getElementById("subopt2").style.display='none';
   document.getElementById("subopt22").style.display='none';
   document.getElementById("firstsubque1").style.display='none';
   document.getElementById("firstsubque2").style.display='none';
   }
}

function subopt1()
{
 if(document.getElementById("subopt1").checked)
 {
   document.getElementById("tbl1").style.display='block';
   document.getElementById("subopt22").style.display='none';
   document.getElementById("subopt1").style.display='block';
      document.getElementById("subopt2").style.display='block';
   document.getElementById("firstsubque1").style.display='block';
   document.getElementById("firstsubque2").style.display='block';
 }
}
function subopt1Unchk()
{
 if(!(document.getElementById("subopt1").checked))
 {
   document.getElementById("tbl1").style.display='none';
   document.getElementById("subopt22").style.display='none';
   document.getElementById("subopt1").style.display='block';
      document.getElementById("subopt2").style.display='block';
   document.getElementById("firstsubque1").style.display='block';
   document.getElementById("firstsubque2").style.display='block';
 }
}
function subopt2()
{
 if(document.getElementById("subopt2").checked)
 {
   document.getElementById("subopt11").style.display='none';
   document.getElementById("tbl2").style.display='block';
   document.getElementById("subopt1").style.display='block';
      document.getElementById("subopt2").style.display='block';
   document.getElementById("firstsubque1").style.display='block';
   document.getElementById("firstsubque2").style.display='block';
 }
}
function subopt2Unchk()
{
 if(!(document.getElementById("subopt2").checked))
 {
   document.getElementById("subopt22").style.display='none';
   document.getElementById("subopt11").style.display='none';
   document.getElementById("subopt1").style.display='block';
      document.getElementById("subopt2").style.display='block';
   document.getElementById("firstsubque1").style.display='block';
   document.getElementById("firstsubque2").style.display='block';
 }
}
function allChecked()
{
 if((document.getElementById("subopt1").checked) && (document.getElementById("subopt2").checked))
 {
   document.getElementById("subopt22").style.display='block';
   document.getElementById("subopt11").style.display='block';
   document.getElementById("subopt1").style.display='block';
      document.getElementById("subopt2").style.display='block';
   document.getElementById("firstsubque1").style.display='block';
   document.getElementById("firstsubque2").style.display='block';
 }
 else if((document.getElementById("subopt1").checked) && (!(document.getElementById("subopt2").checked)))
 {
   document.getElementById("subopt11").style.display='block';
   document.getElementById("subopt22").style.display='none';
   document.getElementById("subopt1").style.display='block';
      document.getElementById("subopt2").style.display='block';
   document.getElementById("firstsubque1").style.display='block';
   document.getElementById("firstsubque2").style.display='block';
 }
 else if((document.getElementById("subopt2").checked) && (!(document.getElementById("subopt1").checked)))
 {
   document.getElementById("subopt11").style.display='none';
   document.getElementById("subopt22").style.display='block';
   document.getElementById("subopt1").style.display='block';
      document.getElementById("subopt2").style.display='block';
   document.getElementById("firstsubque1").style.display='block';
   document.getElementById("firstsubque2").style.display='block';
 }
 else if((document.getElementById("ques1").checked) && (document.getElementById("ques2").checked))
 {
   document.getElementById("subopt1").style.display='block';
   document.getElementById("subopt11").style.display='none';
      document.getElementById("subopt2").style.display='block';
   document.getElementById("subopt22").style.display='none';
   document.getElementById("firstsubque1").style.display='block';
   document.getElementById("firstsubque2").style.display='block';
   document.getElementById("second").style.display='block';
 }
 else if((!(document.getElementById("thirdsubque11").checked)) && (document.getElementById("thirdsubque222").checked))
 {
  document.getElementById("thirdsubque2").style.display='none';
  document.getElementById("thirdsubque2222").style.display='none';
  document.getElementById("thirdsubque2222").style.display='none';
 }
 else if((document.getElementById("thirdsubque11").checked) && (document.getElementById("thirdsubque222").checked))
 {
  document.getElementById("thirdsubque2").style.display='block';
  document.getElementById("thirdsubque22").style.display='block';
  document.getElementById("thirdsubque2222").style.display='block';
 }
 else if((document.getElementById("ques4").checked) && (document.getElementById("fourthsubque11").checked))
 {
  document.getElementById("fourthsubque1").style.display='block';
  document.getElementById("fourthsubque2").style.display='block';
  document.getElementById("fourthsubque111").style.display='block';
 }
}

function secondque()
{
   if(document.getElementById("ques2").checked)
   {
   document.getElementById("subopt22").style.display='none';
   document.getElementById("subopt11").style.display='none';
   document.getElementById("subopt1").style.display='none';
      document.getElementById("subopt2").style.display='none';
   document.getElementById("firstsubque1").style.display='none';
   document.getElementById("firstsubque2").style.display='none';
   document.getElementById("second").style.display='block';
   document.getElementById("secondsubque11").style.display='none';
   document.getElementById("secondsubque1").style.display='block';
   document.getElementById("secondsubque2").style.display='block';
 }
}

function secondqueUnchk()
{
 if(!(document.getElementById("ques2").checked))
   {
   document.getElementById("second").style.display='none';
   document.getElementById("secondsubque1").style.display='none';
   document.getElementById("secondsubque2").style.display='none';
   }
}
function secondsubque1Chk()
{
 if(document.getElementById("secondsubque12").checked)
 {
     document.getElementById("secondsubque11").style.display='block';
  document.getElementById("second").style.display='block';
  document.getElementById("secondsubque111").style.display='none';
 }
}
function secondsubque1Unchk()
{
 if(!(document.getElementById("secondsubque12").checked))
 {
     document.getElementById("secondsubque11").style.display='none';
  document.getElementById("second").style.display='block';
  document.getElementById("secondsubque111").style.display='none';
 }
}

function secondsubque2Chk()
{
 if(document.getElementById("secondsubque13").checked)
 {
     document.getElementById("secondsubque11").style.display='block';
  document.getElementById("second").style.display='block';
  document.getElementById("secondsubque111").style.display='block';
 }
}
function secondsubque2Unchk()
{
 if(!(document.getElementById("secondsubque13").checked))
 {
     document.getElementById("secondsubque11").style.display='block';
  document.getElementById("second").style.display='block';
  document.getElementById("secondsubque111").style.display='none';
 }
}

function thirdque()
{
 if(document.getElementById("ques3").checked)
 {
  document.getElementById("third").style.display='block';
  document.getElementById("thirdsubque2").style.display='none';
  document.getElementById("thirdsubque222").style.display='none';
 }
}
function thirdqueUnchk()
{
 if(!(document.getElementById("ques3").checked))
 {
  document.getElementById("third").style.display='none';
  document.getElementById("thirdsubque2").style.display='none';
  document.getElementById("thirdsubque222").style.display='none';
 }
}
function thirdsubque1()
{
 if(document.getElementById("thirdsubque11").checked)
 {
  document.getElementById("third").style.display='block';
  document.getElementById("thirdsubque2").style.display='block';
  document.getElementById("thirdsubque222").style.display='block';
  document.getElementById("thirdsubque2222").style.display='none';
 }
}
function thirdsubque1Unchk()
{
 if(!(document.getElementById("thirdsubque11").checked))
 {
  document.getElementById("third").style.display='block';
  document.getElementById("thirdsubque2").style.display='none';
  document.getElementById("thirdsubque2222").style.display='none';
 }
}
function thirdsubque2()
{
 if(document.getElementById("thirdsubque222").checked)
 {
  document.getElementById("third").style.display='block';
  document.getElementById("thirdsubque2").style.display='block';
  document.getElementById("thirdsubque2222").style.display='block';
 }
}
function thirdsubque2Unchk()
{
 if(!(document.getElementById("thirdsubque222").checked))
 {
  document.getElementById("third").style.display='block';
  document.getElementById("thirdsubque2").style.display='block';
  document.getElementById("thirdsubque2222").style.display='none';
 }
}

function fourthque()
{
 if(document.getElementById("ques4").checked)
 {
  document.getElementById("fourthsubque1").style.display='block';
  document.getElementById("fourthsubque2").style.display='block';
  document.getElementById("fourthsubque111").style.display='none';
 }
}
function fourthqueUnchk()
{
 if(!(document.getElementById("ques4").checked))
 {
  document.getElementById("fourthsubque1").style.display='none';
  document.getElementById("fourthsubque2").style.display='none';
 }
}

function fourthsubque1()
{
 if(document.getElementById("ques4").checked)
 {
  document.getElementById("fourthsubque1").style.display='none';
  document.getElementById("fourthsubque2").style.display='none';
 }
}
function fourthsubque11()
{
 if(document.getElementById("fourthsubque11").checked)
 {
  document.getElementById("fourthsubque1").style.display='block';
  document.getElementById("fourthsubque2").style.display='block';
  document.getElementById("fourthsubque111").style.display='block';
 }
}

/*function validateque1()
{
 document.getElementById("error1").innerHTML="";
 if((document.getElementById("ques1").checked) && (document.getElementById("tbl1").checked))
 {
    if((document.getElementById("select1").value=='') && (document.getElementById("select2").value=='') && (document.getElementById("select3").value=='') && (document.getElementById("select4").value=='') && (document.getElementById("select5").value=='') && (document.getElementById("select6").value=='') && (document.getElementById("select7").value=='') && (document.getElementById("select8").value==''))
  {
   document.getElementById("error1").innerHTML="mandetory field";
   document.form.tbl1.focus();
   return false;
  }
 }
return true;
}
*/
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>

<form >

  <input type="checkbox" name="que1" id="ques1" onclick="firstque();firstqueUnchk();allChecked();" />
  Network

<input type="checkbox" name="select" style="float:left;" id="subopt1" onclick="subopt1();subopt1Unchk();allChecked();" />Internal

     Number of Ips
  <input type="text" placeholder="Number of IPs" name="select1" id="select1"/>

     Servers
  <input type="text" placeholder="Servers" name="select2" id="select2" />

     Firewalls
  <input type="text" placeholder="Firewalls" id="select3" name="select3" />

<input onclick="subopt2();subopt2Unchk();allChecked();" style="float:left;" type="checkbox" name="select" id="subopt2" />External

      Ips
   <input type="text" placeholder="Number of IPs" name="select3" id="select3" />

<input type="checkbox" name="que2" id="ques2" onclick="secondque();secondqueUnchk();allChecked();" />	Website

websites
<input type="text" size="30"  placeholder="number of websites to be tested" />

language	<select style="width: 70%;height: 22px;">
    <option>-------select-------</option>
 <option value="">php</option>
 <option value="">Dot Net</option></select>

Browser	<select style="width: 70%;height: 22px;">
     <option>------select------</option>
  <option value="">php</option>
  <option value="">Dot Net</option></select>

Backend	<select style="width: 70%;height: 22px;">
     <option>------select------</option>
  <option value="">php</option>
  <option value="">Dot Net</option></select>

<input type="checkbox" id="secondsubque12" onclick="secondsubque1Chk();secondsubque1Unchk()" />Regular

<input type="checkbox" id="secondsubque13" onclick="secondsubque2Chk();secondsubque2Unchk()"/>Third party framework used

pages     <input type="text" name="pages" style="float:left;" />

<input type="checkbox"  id="secondsubque2" onclick="allChecked();"/>

Cloud hosted

 <input type="checkbox" name="que3" id="ques3" onclick="thirdque();thirdqueUnchk();allChecked()" />
 Cloud

Cloud Apps
<input type="text" size="30" placeholder="number of Cloud Apps to be tested" />

language	<select style="width:70%;height:22px;">
    <option>-------select-------</option>
 <option value="">php</option>
 <option value="">Dot Net</option></select>

Browser	<select style="width: 70%;height: 22px;">
     <option>------select------</option>
  <option value="">php</option>
  <option value="">Dot Net</option></select>

 Database	<select style="width: 70%;height: 22px;">
     <option>------select------</option>
  <option value="">php</option>
  <option value="">Dot Net</option></select>

<input type="checkbox" id="thirdsubque11" onclick="thirdsubque1();thirdsubque1Unchk();allChecked()" />

Amazon Cloud Hosting

<input type="checkbox" id="thirdsubque222" onclick="thirdsubque2();thirdsubque2Unchk();allChecked()"/>

framework used

pages

<input type="text" name="pages2" placeholder="Number of pages" />

<input type="checkbox" />Cloud Hosting

<input type="checkbox" />Cloud Hosting

<input type="checkbox" />Other cloud hosting

<input type="text" placeholder="Other cloud hosting" />

 <input type="checkbox" name="que4" id="ques4" onclick="fourthque();fourthqueUnchk();allChecked()" />	Mobile

     <input type="checkbox" name="select" id="fourthsubque11" onclick="fourthque();fourthsubque11();allChecked() " />Android App

<input type="checkbox" />Calls

<input type="checkbox" />Uses

<input type="checkbox" />Performs

<input type="checkbox" name="select" id="external" onclick="fifthque()" />iOS App

<input type="submit" value="submit" />
</form>

A: I think it will be wise if you start to learn how to debug Javascript code, you can start by the link below:
http://www.w3schools.com/js/js_debugging.asp
I hope it could help.


text:
Q: How do I change the border geometry of LaTeX-formatted text in draw.io In a figure in draw.io, I have arrows pointing basically everywhere. When I LaTeX-format the "label" in a "connector with 3 Labels" object, the formatted text is given a fixed border, which I find impossible to change. Below is an image of the label with its borders illustrated:
The thick, outer border is changeable, no problems there. I can go into the Style menu on the right-hand side and choose all sorts of options for the outer border.
The thin, inner border originates from giving the LaTeX-formatted $$(1,3)$$ text the property of "Background Color" and "Border Color" in the Text menu on the right-hand side. This is mostly for illustrating how the inner border looks.
The problem: For the life of me, I cannot change this inner border's geometry. It clips with every object it is in front of, and if I don't have a clipping border at all, it is still just awful for my figure. I need to change the inner border's geometry, make it a circle, triangle, whatever. I just need to find out how to customize it.


text:
Q: How to know if the wikipedia content from API contains an useful article or an ambiguous one I can get the Wikipedia article in XML or any other format. But for a term I want to know first if the returned text contains full article or simply contains ambiguous terms like the entered one.
So "SEO" is an ambiguous(or redirect) term, but how to know this from the results?
While "New York" returns complete article.
EDIT
My simple question is, I've 400 city names and I want the wikipedia content of it using API and I don't want those pages which are not city articles but only contain some redirection or other ambiguous terms. I want to discard those.

A: All disambiguation pages are in the aptly named category All disambiguation pages, so you can just check for that category.
As an alternative, you could check for the presence of the Disambiguation template, or one of its variants and their redirects.

A: You can check with the "Disambiguation" ppprop:

http://en.wikipedia.org/w/api.php?action=query&prop=pageprops&ppprop=disambiguation&redirects&format=xml&titles=BNI

A: Update: Disambiguation pages are a content-type of WikiPedia (the installation), and not a page-type in MediaWiki (the software). Thus, the MediaWiki API has no knowledge of what disambiguation pages are, and has not method for retrieving them.
See this related discussion.
Other than the often-but-not-always method I layout below, you would basically have to retrieve the page body, and check for the presence of a disambiguation marker.

The below sometimes works:
When I search for SEO I get: https://en.wikipedia.org/wiki/SEO
Are you referring to disambiguation pages? like https://en.wikipedia.org/wiki/SEO_%28disambiguation%29 ?
If so, check the title for disambiguation.
for instance, the following search : https://en.wikipedia.org/w/api.php?action=query&list=search&format=json&srsearch=SEO&srwhat=text&srlimit=2
yeilds
{
    "query": {
        "searchinfo": {
            "totalhits": 3507
        },
        "search": [
            {
                "ns": 0,
                "title": "Search engine optimization",
                "snippet": "Search engine optimization (SEO<\/span>) is the process of improving the visibility of a website  or a web page  in search engine s via the \" ...<\/b> ",
                "size": 40468,
                "wordcount": 5269,
                "timestamp": "2012-03-11T11:43:26Z"
            },
            {
                "ns": 0,
                "title": "SEO (disambiguation)",
                "snippet": "SEO<\/span>  or search engine optimization, the process of improving ranking in search engine results.  SEO<\/span> may also refer to:  Seo<\/span> (surname), a  ...<\/b> ",
                "size": 955,
                "wordcount": 103,
                "timestamp": "2012-02-22T12:51:20Z"
            }
        ]
    },
    "query-continue": {
        "search": {
            "sroffset": 2
        }
    }
}

You can play around with this @ the Wikipedia API Sandbox.


text:
Q: Issue when attempting to Add data entered by user See code attached. The main intent here is to create a program(Java) that Adds, Divides, etcetera etcetera. So far I've only gotten as far as the addition block. for some reason when I attempt to add two user inputs together it concatenates them instead, when they are clearly entered separately as they are meant to be entered, according to my code. I have attached the code as well as several images to help you all understand what im trying to achieve. Any and all constructive criticism is welcome, I'm open to any suggestions...
PS: Using IntelliJ as Primary IDE.
Code Run Run Run Run Run Result
PS: Images marked "run" are when code is running.
Thanks, hope you can help!

A: The user input is a string. String represents text and when you add two strings together they will be concatenated. What you want is to add two numbers.
You can make an int(which represents a number) from the string by using the ParseInt() method:
int firstNumber =Integer.parseInt(useInput1);
int secondNumber = Integer.parseInt(useInput2);

When you have two ints you can add them together:
int total = firstNumber + secondNumber;

I advise you to read a bit about basic/primitive data types in Java.


text:
Q: JSON Parsing in AngularJS Service I have Angular service and in that service I have a code:
this.testMethod = function( ) {
    this.jsonTest = "[{'id':'123','title':'XYZ','id2':'456','status':2}]";
    this.parseTest(this.jsonTest);
};

this.parseTest = function(jsonTest) {
    var jsonTestObj = JSON.parse(jsonTest); // I get error hear
}

Test method is getting called on ng-click event.
Error that I am getting while testing in latest chrome browser:
SyntaxError: Unexpected token ' at Object.parse (native)
......

I tried multiple things to fix it but nothing seems to work.
Every time I get undefined value error.
Basically I want to parse JSON object and get the values.
What am I doing wrong?

A: You need to use double quotes in your string, other than that your code should work.
To quote from specification

A value can be a string in double quotes, or a number, or true or false or null, or an object or an array. These structures can be nested.

A: Use this
this.jsonTest = '[{"id":"123","title":"XYZ","id2":"456","status": "2"}]';

Or this
this.jsonTest = "[{\"id\":\"123\",\"title\":\"XYZ\",\"id2\":\"456\",\"status\": \"2\"}]";

You either need to use ' outside or " outside and escape the quotes inside.
Both the key and value need to be in double quotes.

A: Your JSON is not valid. Always check your JSON integrity in those cases, i personaly use
http://jsonlint.com/


text:
Q: Topological Sort - Creating a Direct Graph Issue So I'm trying to implement the code, but it's not working properly. I'll put into comments where I'm pretty sure I'm making a mistake. I just started learning this chapter, and it's pretty hard and confusing, but I'm getting into it, that's why I have no idea what's wrong or not, please help.
#include "graph.h"
#include "queue.c"
#include "queue.h"
#include "topsort.c"
#include "fatal.h"
#include <stdlib.h>
#include <stdio.h>

Graph CreateDirectGraph(void)
{
    int N, i;
    Vertex v, w;
    Graph G;
    PtrToNode p;

    printf("Create Directed Graph:\n");
    printf("Number of vertexs in the graph:\n");
    scanf("%d",&N);
    G = (struct GraphRecord *)malloc(sizeof(struct GraphRecord));
    G->vertices = (struct VertexRecord *)malloc(sizeof(struct VertexRecord) * (N + 1));
    G->vexnum = N;

    for (i = 1; i <= N; i++)
        G->vertices[i].adjto = NULL;
    printf("Number of edges in the graph:\n");
    scanf("%d",&N);
    printf("Input %2d edges:\n", N);
    for (i = 1; i <= N; i++) {
        scanf("%d%d", &v, &w);
        p = ( struct Node *) malloc( sizeof( struct Node ) );
        p->adjvex = NextAdjVex(G, v, w);                         /* <-- HERE */
        p->next = G->vertices[v].adjto;                          /* <-- HERE */
        G->vertices[v].adjto = p;
    }
    return G;
}

void DestroyGraph(Graph G)
{ /*free space*/
    free(G->vertices);
    free(G);
    return;
}

Vertex FirstAdjVex(Graph G, Vertex v)
{
    if (G->vertices[v].adjto)
        return G->vertices[v].adjto->adjvex;
    else return 0;
}

Vertex NextAdjVex(Graph G, Vertex v, Vertex w)
{
    PtrToNode p;

    p = G->vertices[v].adjto;
    while (p->adjvex != w)
        p = p->next;
    if (p->next) return p->next->adjvex;
    return 0;
}

int NumOfVex(Graph G)
{
    return G->vexnum;
}

int Topsort( Graph G, int TopNum[] )
{
    Queue Q;
    int V, W, N;
    int  Counter = 0;
    int *Indegree;
    PtrToNode p;

    N = NumOfVex(G);
    Indegree = (int *)malloc(sizeof(int)*(N + 1));
    for (V=1; V<=N; V++)
        Indegree[V] = 0;
    for (V=1; V<=N; V++)
        for (p =G->vertices[V].adjto; p; p = p->next)
            Indegree[p->adjvex]++;
    Q = CreateQueue( N );
    for (V = 1; V <= N; V++)
        if ( Indegree[ V ] == 0 )   Enqueue( V, Q );
    while ( !IsEmpty( Q ) ) {
        V = Dequeue( Q );
        TopNum[ ++ Counter ] = V; /* assign next */                   /* <-- HERE */
        for (W = FirstAdjVex(G, V); W; W = NextAdjVex(G, V, W))
            if ( --Indegree[W] == 0 )  Enqueue( W, Q );              /* <-- HERE */
    }  /* end-while */
    DisposeQueue( Q ); /* free memory */
    if ( Counter != N )
        return 0;
    return 1;
}

/* <-- HERE */ means I probably made a mistake there, because I'm 99% sure the rest is correct, as I was being partly guided
OUTPUT:
Number of vertexs in the graph:
4
Number of edges in the graph:
4
Input  4 edges:
1 2

Then the runtime stops


text:
Q: lightweight access point? Im moving from an all in one to a router + access point. In doing googling and reasearch and talking to friends I ended up with

*

*router - cisco rv016

*wifi access point - airnet 1142 lightweight access point. (lap1142n)
In trying to set all this up and reading I think I bought the wrong access point. It seems I need a wireless controller? Can someone confirm that I should not have bought the lightweight one?

A: You need a Cisco Wireless LAN Controller to configure and deploy a LAP. They don't run full-blown iOS, but rather a slimmed down OS that only boots the radios and physical interfaces and then "calls out" to a controller for the remainder of their configuration.
You can purchase autonomous (stand-alone) 1142s, Their part/model number is just AP1142. Anything that starts with LAP is a Lightweight Access Point and requires a controller.

tl;dr - You bought the wrong thing.


text:
Q: Image added with jquery is not showing in webkit browsers I create an image node with jquery and want to show it as a bigger version on top of the original.
The copied image does not show up in Chrome and Safari, but works in Internet Explorer and Firefox. The console does not report errors. The inspector shows the the cloned image element with all the right css properties, but gives the element a 0 x 0 pixels size.
I don't see any css rules that would hint to a 0x0 size.
here is a screenshot illustrating the situation

(http://i.stack.imgur.com/AhiPf.png)
here is a link to demo the behaviour, try clicking on the image with firefox and chrome:
download.toastlab.ch/segtest

edit:
the Javascript code that creates the element:
$('.streamcontent').on('click', 'img.clickable', function () {
    var img = new Image();
    img.src = $(this).attr('src');
    var w = img.width,
        h = img.height;
    img = $(img).addClass('bigger');

    var tw = $(this).width();
    var th = $(this).height();

    var pos = $(this).position();
    var center = {
        top: pos.top + th / 2,
        left: pos.left + tw / 2
    };

    img.css({
        position: 'absolute',
        top: pos.top,
        left: pos.left,
        width: tw,
        height: th,
        opacity: 0
    }).animate({
        top: center.top - h / 2,
        left: center.left - w / 2,
        height: h,
        width: w,
        opacity: 1
    }, 300, function () {
        $('body').one('click', function () {
            img.animate({
                top: pos.top,
                left: pos.left,
                width: tw,
                height: th,
                opacity: 0
            }, function () {
                img.remove();
            });
        });
    });
    $(this).parent().append(img);

});

A: Found it.
There is a CSS rule that specifies a maximum size (with max-width and max-height), I needed to override that rule to allow the bigger image... to be bigger.
To do this I overwrote max-width & height with a ridiculously high value (999999999px). It seems like this value crashed the "webkit renderers image size calculation", leaving the image size at 0 x 0. Setting the value to 9999px resolved the problem
I don't know if this qualifies as webkit bug or not.

A: In your JS code
$('.streamcontent').on('click', 'img.clickable', function() {
    var img = new Image();
    img.src = $(this).attr('src');
    var w = img.width, h = img.height;
    img = $(img).addClass('bigger');
    ...

I think you must change
var w = img.width, h = img.height;

by
var w = img.width(), h = img.height();

because width and height are function in object Image, but I'm not sure.


text:
Q: Check for custom interface in the beforeExecute and afterExecute always fails I have an extended ThreadPoolExecutor with overridden beforeExecute and afterExecute methods. So my class kind of looks like this
class MyExtendedExecutor extends ThreadpoolExecutor {
    ...
    ...
    @Override
    protected void afterExecute(Runnable r , Throwable t) {
        if(r instance of MyInterface)
            // cast r to MyInterface and call a method available in MyInterface
            // then something in MyExtendedExecutor does something with the return value
    }

    @Override
    protected void beforeExecute(Thread t, Runnable r) {
        if(r instance of MyInterface)
            // cast r to MyInterface and call a method available in MyInterface
            // then something in MyExtendedExecutor does something with the return value

    }
}

and this is always failing although I've made sure that all the Runnables that I submit to the executor implement MyInterface, basically
class MyTask implements MyInterface, Runnable {
    ...
    ...
}

and doing
myextendedExecutor.submit(new MyTask())

then why is the instanceof check failing?

A: Based on the JavaDoc you have to call super and r is actually an instance of Future from which you can retrieve your MyInterface object, not your MyInterface directly.
 class MyExtendedExecutor extends ThreadPoolExecutor {
   // ...
   protected void afterExecute(Runnable r, Throwable t) {
     super.afterExecute(r, t);
     if (t == null && r instanceof Future<?>) {
       try {
         Object result = ((Future<?>) r).get();
       } catch (CancellationException ce) {
           t = ce;
       } catch (ExecutionException ee) {
           t = ee.getCause();
       } catch (InterruptedException ie) {
           Thread.currentThread().interrupt(); // ignore/reset
       }
     }
     if (t != null)
       System.out.println(t);
   }
 }


text:
Q: angularfire2 phone auth with invisible recaptcha i try to get phone auth with Angularfire2, Angular6 and Ionic4Alpha working.
I can signIn/signUp with it, but the console logs some errors.
This is how i use invisible recaptcha:
ngAfterViewInit() {
    let vm = this;
    window.recaptchaVerifier = new firebase.auth.RecaptchaVerifier('sign-in-button', {
      'size': 'invisible',
      'callback': (response) => {
        vm.loginWithPhoneNumber();
      }
    });
  }

With visible Recaptcha everything was working well, but now i receive this error.
How can i solve it?


text:
Q: julia: `using` module with listed functions does not define the module itself julia> using Random: rand; Random
ERROR: UndefVarError: Random not defined
julia> using Random; Random
Random

Is this working as intended? I have a dirty workaround: using Random: Random, rand. But that is quite ugly. Does there exist a better one?

A: I think you might be looking for:
import Random


text:
Q: Is it true that a tarball can change where files are extracted to regardless of the commands used to extract it? I have a coworker who says you need to be careful extracting tarballs because they can make changes you don't know about. I always thought a tarball was just a hierarchy of compressed files, so if you extract it to /tmp/example/ it can't possibly sneak a file into /etc/ or anything like that.

A: One of the hilarious things that happen with tar bombs is that they change the permissions of the current directory to the one included in the tarball.
For instance, if a tarball includes the '.' directory, and you unpack it in /tmp as root, it will wreck your system by making the /tmp unwritable by anybody but root.

A: Different tar utilities behave differently in this regard, so it's good to be careful. For a tar file that you didn't create, always list the table of contents before extracting it.
Solaris tar:

The named files are extracted from the tarfile and written to the directory specified in the tarfile, relative to the current directory. Use the relative path names of files and directories to be extracted.
Absolute path names contained in the tar archive are unpacked using the absolute path names, that is, the leading forward slash (/) is not stripped off.

In the case of a tar file with full (absolute) path names, such as:
/tmp/real-file
/etc/sneaky-file-here

... if you extract such a file, you'll end up with both files.
GNU tar:

By default, GNU tar drops a leading / on input or output, and complains about file names containing a .. component. There is an option that turns off this behavior:
--absolute-names
-P
Do not strip leading slashes from file names, and permit file names containing a .. file name component.

... if you extract a fully-pathed tar file using GNU tar without using the -P option, it will tell you:

tar: Removing leading / from member names

and will extract the file into subdirectories of your current directory.
AIX tar:
says nothing about it, and behaves as the Solaris tar -- it will create and extract tar files with full/absolute path names.
HP-UX tar:
(better online reference welcomed)

WARNINGS
There is no way to restore an absolute path name to a relative position.

OpenBSD tar:

-P
Do not strip leading slashes (/) from pathnames.  The default is to strip leading slashes.

There are -P options implemented for tar on macOS, FreeBSD and NetBSD as well, with the same semantics, with the addition that tar on FreeBSD and macOS will "refuse to extract archive entries whose pathnames contain .. or
         whose target directory would be altered by a symlink" without -P.
schilytools star:

-/
Don't  strip  leading  slashes  from  file  names  when extracting  an  archive.  Tar archives containing absolute pathnames are usually a bad idea. With  other  tar implementations,  they  may possibly never be extracted without clobbering existing files. Star for  that  reason,  by  default strips leading slashes from filenames when in extract mode.


text:
Q: Probability [Sum of digits is even for a random number] A number of 6 digit numbers is written down at random. Probability that the sum of the digits is an even number is? Please answer with explanation.

A: Let $p_n $ be the probability that an $n$-digit number has even parity.
We see that $p_1 = {1 \over 2}$.
Suppose we are given an $n$ digit number and add one digit. Then there are two ways the $n+1$ digit number can have even parity: (1) The $n$ digit number has even parity and the new digit is even, and (2) the $n$ digit number has odd parity and the new digit is odd.
Then $p_{n+1} = {1 \over  2} p_n + {1 \over 2} (1- p_n) = { 1 \over 2}$.

A: The result is independent of whether the first digit has to be zero or not. By the same logic as my answer here, the answer is immediately seen to be $\frac12$.

A: Hint: think of choosing the first five digits, then the last digit. If the sum of the first five digits is odd, the sixth digit has to be odd to make the sum of all six even. What is the chance of this? If the sum of the first five is even,....

A: Let $p$ be the probability that the sum of the first (leftmost) five digits is even. Then the probability that the sum of the first five digits is odd is $1-p$.
Now let us find the probability that the sum of all the digits is even. This can happen in two disjoint ways: (i) The sum of the first five is even, and the last is even or (ii) the sum of the first five is odd, and the last is odd.
The probability of (i) is $(p)(1/2)$. The probability of (ii) is $(1-p)(1/2)$. Add. We get $1/2$.
Remark: There is  more "bijective" way of seeing this. Let $E$ be the set of numbers with even digit sum, and $O$ the set of numbers with odd digit sum.
If $e$ is a digit string in $E$, let $\varphi(e)$ be the digit string obtained by replacing the last digit of $e$ by $9$ minus the last digit of $e$.
Then $\varphi(e)$ has odd digit sum, and all numbers in $O$ can be obtained in this way. It follows that $E$ and $O$ have the same size.

A: Hint: Note down all the cases where a $6$ digit number can have its sum of digits even.
$1.$ All $6$ digits even: Is this possible? Yes. With repetition.
$2.$ $4$ digits even($2$ digits odd): Is this possible? Yes. With/Without repetition.
$3.$ $2$ digits even($4$ digits odd): Is this possible? Yes. Yes. With/Without repetition.
$4.$ $6$ digits odd. Is this possible? Yes. With repetition.


text:
Q: Problem with angular showing adverts by category I have symfony5/angular10 project, in angular three components: categories (which I use to create a menu - simple list of categories), adverts (list all adverts), single advert (shows advert by id).
Based on these components in app-routing I got three routes:
{ path: 'adverts', component: AdvertsComponent },
{ path: 'advert/category/:name', component: AdvertsComponent },
{ path: 'advert/:id', component: AdvertSingleComponent },

First and last route work fine, I can list all ads and show single ad, but am unable to list ads by category - I get same result as when listing all ads (network inspector shows the same route is being hit).
I checked my api with Postman so I know all three routes work fine, so I guess the problem is with my angular code.
I suspect adverts component
import { Component, OnInit } from '@angular/core';
import { DatePipe } from '@angular/common';

import { Advert } from '../advert';
import { AdvertService } from '../advert.service';

@Component({
    selector: 'app-adverts',
    templateUrl: './adverts.component.html',
    styleUrls: ['./adverts.component.css']
})
export class AdvertsComponent implements OnInit {

    adverts: Advert[];

    constructor(private advertService: AdvertService, public datepipe: DatePipe) {}

    ngOnInit() {
        this.getAdverts();
    }

    getAdverts(): void {
        this.advertService.getAdverts()
        .subscribe(adverts => this.adverts = adverts);
    }

    getAdvertsByCategory(name): Advert {
        return this.adverts.find(advert => advert.category === name);
    }

}

As you can see ngOnInit has only getAdverts method, if I add getAdvertsByCategory there, in the console I get this.adverts is undefined.
Any clues?
UPDATE
Thanks to user2403735's answer and his note on doing heavy lifting in the api rather that angular, I came up with this code, fetching prefiltered date from api in order to avoid client side filtering.
See the line commented out in the ngOnInit method? It's because snapshot won't work if the html component is reused, if I clicked one category and then another, the view wouldn't update with the second category data, it would just keep the data from the first clicked category. Hence the need to use different approach - check out this video for an explanation Angular Tutoria 26 - ParamMap Observable
import { ActivatedRoute, ParamMap } from '@angular/router';
...
constructor(private advertService: AdvertService, private route: ActivatedRoute, public datepipe: DatePipe) {}

ngOnInit() {
    //let categoryName = this.route.snapshot.paramMap.get('name');
    this.route.paramMap.subscribe((params: ParamMap) => {
        let categoryName = params.get('name');
        if (categoryName){
            this.getAdvertsByCategory(categoryName);
        } else {
            this.getAdverts();
        }
    });
}

getAdverts(): void {
    this.advertService.getAdverts()
    .subscribe(adverts => this.adverts = adverts);
}

getAdvertsByCategory(name): void {
    this.advertService.getAdvertsByCategory(name)
    .subscribe(adverts => this.adverts = adverts);
}

A: You use the same component (AdvertsComponent) for two routes. However, on initialization of the component, _AdvertsComponent loads all adverts, because of this rule:
ngOnInit() {
    this.getAdverts();
}

The component does not know when to apply the filter. To solve this you can do two things.

*

*The easy way is to create a new component where you do exactly the same, but apply the filter immediately.

export class CategoryComponent implements OnInit {

    adverts: Advert[];

    ...

    ngOnInit() {
        const categoryName = this.route.snapshot.paramMap.get("name")
        this.getAdvertsByCategory(categoryName);
    }

    getAdvertsByCategory(categoryName) {
        this.getAdverts();
        this.adverts.find(advert => advert.category === categoryName);
    }

    getAdverts(): void {
        this.advertService.getAdverts()
        .subscribe(adverts => this.adverts = adverts);
    }
}

*In the current component, check if a category name is set, and if it is, apply the filter:

export class AdvertsComponent implements OnInit {

    adverts: Advert[];

    ....

    ngOnInit() {
        const categoryName = this.route.snapshot.paramMap.get("name");

        if(categoryName) {
          this.getAdvertsByCategory(categoryName);
        } else {
          this.getAdverts();
        }

    }

    getAdvertsByCategory(name) {
        this.getAdverts()
        this.adverts.find(advert => advert.category === name);
    }

    getAdverts(): void {
        this.advertService.getAdverts()
        .subscribe(adverts => this.adverts = adverts);
    }
}

NOTE: In general I would suggest to apply the filters in your API instead of doing the heavy lifting on the client side. So in your http request, apply params to filter out data in your API.


text:
Q: Razor template variable scope Are variables I define in a shared layout _Layout.cshtml within scope of a View page?
_Layout.cshtml varibles:
@{
    ViewBag.url = "http://www.website.com/site/";
}

Index.cshtml:
Continue

This outputs: /our-vision/

A: You could try answer from this question: How do I set ViewBag properties on _ViewStart.cshtml?
Set (Note: code is for _ViewStart, not for _Layout)
@{
    PageData["message"] = "Hello";
}

Get

@PageData["message"]

OR
Create more interesting solution: How to set ViewBag properties for all Views without using a base class for Controllers?

A: Explanation:
ViewBag is different for each view/layout and razor renders view firstly and it's layout afterwards.
Solution for this issue could be setting common constant in base controller orview or global filter instead of layout.


text:
Q: Combine data frames and add file name with PANDAS I have a question about PANDAS.
I have many dataframes like below.

I would like to combine these dataframes and add file name as right figure.
Does anyone know how to do that?

A: I think you need concat of list of DataFrames with parameter keys for df names, then remove MultiIndex and create new column File:
dfs = [df1,df2, df3]
df = pd.concat(dfs, keys=range(1, len(dfs) + 1))
       .reset_index(level=1, drop=True)
       .rename_axis('File')
       .reset_index()

Sample:
df1 = pd.DataFrame({'Product':['a','b','c'],
                   'Price':[4,5,6]})

print (df1)

   Price Product
0      4       a
1      5       b
2      6       c

df2 = pd.DataFrame({'Product':['d','e','g'],
                   'Price':[9,8,7]})

print (df2)
   Price Product
0      9       d
1      8       e
2      7       g

df3 = pd.DataFrame({'Product':['f','z','h'],
                   'Price':[1,2,4]})

print (df3)
   Price Product
0      1       f
1      2       z
2      4       h

dfs = [df1,df2, df3]
df = pd.concat(dfs, keys=range(1, len(dfs) + 1)) \
       .reset_index(level=1, drop=True) \
       .rename_axis('File').reset_index()
print (df)
   File  Price Product
0     1      4       a
1     1      5       b
2     1      6       c
3     2      9       d
4     2      8       e
5     2      7       g
6     3      1       f
7     3      2       z
8     3      4       h

You can also use custom names from list:
dfs =   [df1,df2,df3]
names = ['file1','file2','file3']

df = pd.concat(dfs, keys=names)
df = df.reset_index(level=1, drop=True).rename_axis('File').reset_index()
print (df)
    File  Price Product
0  file1      4       a
1  file1      5       b
2  file1      6       c
3  file2      9       d
4  file2      8       e
5  file2      7       g
6  file3      1       f
7  file3      2       z
8  file3      4       h


text:
Q: GLOBIGNORE='**/dont_doc/**' does not work! I wanted to create a glob expression to ignore any file inside a dont_doc directory, but when I tried using using GLOBIGNORE to do it, it did not work:
$ GLOBIGNORE='**/dont_doc/**'
$ echo dont_doc/**
dont_doc/customBlockHelpers.hbs.js dont_doc/RoClasses.js dont_doc/RoEnums.js dont_doc/RoModules.js dont_doc/RoTypes.js

this is what I want to happen:
dont_doc/doc.js #Fail
dont_doc/lol/doc.js #Fail
lol/dont_doc/doc.js #Fail
lol/dont_doc/lol/doc.js #Fail
lol.js #Succsed
index.html #Fail
oof/lol.js #Succsed

how do I fix this?
Edit: I also want to ignore the node_modules folder

A: Try with:
GLOBIGNORE='dont_doc:*/dont_doc:dont_doc/*:*/dont_doc/*'

Note that it doesn't stop bash from looking into those directories, it just removes the entries matching those patterns from the glob expansion. So here we have 4 patterns separated with :, one to exclude dont_doc alone, one to exclude ones ending in /dont_doc, one to exclude ones starting with dont_doc/, and the last one to exclude ones containing /dont_doc/.
It's similar to what the ~ operator does in zsh -o extendedglob (like in print -rC1 -- **/*~(|*/)dont_glob(/*|))
In ksh93, you just need FIGNORE=dont_doc for dont_doc directory entries to be ignored. Like zsh -o extendedglob's (^dont_glob/)#^dont_glob, though beware that in ksh93, setting FIGNORE also disables the hiding of filenames starting with ..
Note that ** only makes sense if you enable the globstar option to enable zsh-style recursive globbing.
If you turn the extglob option on in bash (shopt -s extglob), a subset of ksh's extended glob operators become available, and you can shorten the pattern to:
GLOBIGNORE='?(*/)dont_glob?(/*)'

Or to exclude more than one directory:
GLOBIGNORE='?(*/)@(dont_glob|node_modules)?(/*)'


text:
Q: How to filter databases on its Id I need to search for data and show it on the page. I want a code in the index to be something similar to this
If Not String.IsNullOrEmpty(searchString) Then
   students = students.Where(Function(s) s.LastName.ToUpper().Contains(searchString.ToUpper()) _
   Or s.FirstMidName.ToUpper().Contains(searchString.ToUpper()))

but instead of string I am searching for ID which is integer. How can I do that?
I am creating a asp.net mvc web application using vb.net

A: Since it is an integer you may just check for equality.
students = students.Where(Function(s) s.Id = searchId)


text:
Q: ActiveMQ 5.15 HTTP ERROR: 503 Run environment :linux (CentOS 7), JDK 1.8, & ActiveMQ 5.15
I started Activemq then visit the management page with Chrome,when I try to log in with the default username & password I get the following error;

HTTP ERROR: 503
Problem accessing /admin/. Reason:
Service Unavailable Powered by Jetty://

How can I resolve this problem?

A: I was getting this same error.  It turns out that I had run it as root user originally, then later I stopped it and ran it as a non-root user.  Certain data files that had been created and owned by the original root instance were not accessible to the non-root user.
Check the ownership of the files, and change them if necessary to match the user that the broker is running as.

A: Had the same issue.
Maybe something went wrong the extraction of the package.
I downloaded this:
wget https://archive.apache.org/dist/activemq/5.15.0/apache-activemq-5.15.0-bin.tar.gz

and extracted it with:
sudo tar -zxvf apache-activemq-5.15.0-bin.tar.gz -C /opt

then it worked for me.

A: My two cents:
I start with the activemq in Ubuntu Repo, but then later change to binary package from official website.
In my case, the repo version left an /etc/default/activemq config file, which runs activemq with user "activemq". It turns out in previous experiments, I did not kill the old processes running under "activemq" when I start activemq under my own user name. There are two activemq processes running under different user names, and when connecting to admin console, I have a 503.
I delete the /etc/default/activemq file, and kill all activemq processes running under "activemq", then restart activemq with my user name, the 503 is gone.


text:
Q: Can you create an array inside of a struct initialization? So I have a struct:
typedef struct Board {
    size_t size;
    char* board;
} Board;

I was wondering if it was possible to then do something like this, during initialization of the struct:
Board boardStruct = {
    solutionLength,
    char emptyBoard[size]
};

Unfortunately, when I try to do it this way I get the compilation error:
expected expression before 'char'
Any ideas? I'm trying to avoid declaring the array outside of the struct initialization, but if that is the only option I guess that is the route I will have to go with.

A: You can do something like that :
#include <stdlib.h>

typedef struct Board {
    size_t size;
    char* board;
} Board;

int main()
{
  const int solutionLength = 3; /* or #define solutionLength 3 */

  Board boardStruct = {
    solutionLength,
    malloc(solutionLength)
  };

  return 0;
}

or closer to your proposal :
#include <stdlib.h>

typedef struct Board {
    size_t size;
    char* board;
} Board;

int main()
{
  const int solutionLength = 3; /* or #define solutionLength 3 */
  char emptyBoard[solutionLength];

  Board boardStruct = {
    solutionLength,
    emptyBoard
  };

  return 0;
}

A: @bruno's solution will work. Another thing you could try is to put the array within the Board struct. E.g:
typedef struct Board {
    size_t size;
    char board[size];
} Board;

Upside: Avoids a malloc/free for each Board.
Downside: Board is larger, so it costs more to copy it. Also, you must know how big the board is before your program runs.


text:
Q: How to correctly handle daylight saving times with timestamps I'm trying to create a table in Postgres that stores events which occur once every full hour every day for the next couple of years. So I populated a coloumn using the following expression:
INSERT INTO tablename(time)
SELECT CAST('2013-01-01' AS DATE) + (n || ' hour')::INTERVAL
 FROM generate_series(0, 100000) n;

As a datatype for this column I chose timestamp with time zone and hoped in this way daylight saving time would be automatically taken into account. (Btw, my default time zone is CET, so it's UTC+1 or UTC+2 when DST applies). As a result of the above query I get this:

*

*2013-03-31   00:00:00   +01

*2013-03-31   01:00:00   +01

*2013-03-31   03:00:00   +02

*2013-03-31   03:00:00   +02

*2013-03-31   04:00:00   +02

*...

*2013-10-27   00:00:00   +02

*2013-10-27   01:00:00   +02

*2013-10-27   02:00:00   +01

*2013-10-27   03:00:00   +01

*2013-10-27   04:00:00   +01

*...

The offset to UTC changes and I expected that 02:00 is left out on March 31st as this day only has 23 hours, but I don't know why 03:00 is there twice, whereas on October 27th 02:00 is only there once instead of twice as this day has 25 hours. What I would like to achieve is that for all years on the specific day in March 2 o'clock is not skipped (I would rather put in 'n. a.' or something for the corresponding value) and that there are two entries for 3'oclock on the specific day in October (but not in March), so that I'll get a column of the following form (where 1 stands for the hour from 00:00-1:00, 2 for 1:00-2:00, etc.):

*

*2013-03-31   1   +01

*2013-03-31   2   +01

*2013-03-31   3   +02

*2013-03-31   4   +02

*2013-03-31   5   +02

*...

*2013-10-27   1      +02

*2013-10-27   2      +02

*2013-10-27   3A  +02

*2013-10-27   3B  +01

*2013-10-27   4      +01

*2013-10-27   5   +01

*...

Has anybody an idea how to go about it? Am I doing something basically wrong? Is it just a matter of formatting? Do I have to write a function? Any help would be appreciated. Thank you.

A: Date and time in Postgres are stored in UTC and are converted into local time according to the zone specified by the timezone configuration.
This means that you only need to solve the representation problem. Try using AT TIME ZONE 'UTC+2' to convert UTC time to your timezone and see the result. Here's query:
SELECT (CAST('2013-03-30' AS DATE) + (n || ' hour')::INTERVAL) AT TIME ZONE 'UTC+2'
    FROM generate_series(0, 1000) n;

A: The timestamp is always stored as UTC regardless of time zone settings. From the manual

For timestamp with time zone, the internally stored value is always in UTC (Universal Coordinated Time, traditionally known as Greenwich Mean Time, GMT). An input value that has an explicit time zone specified is converted to UTC using the appropriate offset for that time zone. If no time zone is stated in the input string, then it is assumed to be in the time zone indicated by the system's TimeZone parameter, and is converted to UTC using the offset for the timezone zone.

set time zone 'CET';

drop table if exists events;
create table events (
    tstz timestamp with time zone
);
insert into events (tstz)
select generate_series('2013-01-01', '2013-10-28', interval '1 hour') s(tstz)
;

Notice the use of the generate_series function.
select
    tstz at time zone 'UTC' as "UTC",
    tstz at time zone 'CET' as "CET",
    tstz at time zone 'CEST' as "CEST",
    tstz as "LOCAL"
from events
where date_trunc('day', tstz) in ('2013-03-31', '2013-10-27')
order by tstz
;
         UTC         |         CET         |        CEST         |         LOCAL
---------------------+---------------------+---------------------+------------------------
 2013-03-30 23:00:00 | 2013-03-31 00:00:00 | 2013-03-31 01:00:00 | 2013-03-31 00:00:00+01
 2013-03-31 00:00:00 | 2013-03-31 01:00:00 | 2013-03-31 02:00:00 | 2013-03-31 01:00:00+01
 2013-03-31 01:00:00 | 2013-03-31 02:00:00 | 2013-03-31 03:00:00 | 2013-03-31 03:00:00+02
 2013-03-31 02:00:00 | 2013-03-31 03:00:00 | 2013-03-31 04:00:00 | 2013-03-31 04:00:00+02
 2013-03-31 03:00:00 | 2013-03-31 04:00:00 | 2013-03-31 05:00:00 | 2013-03-31 05:00:00+02
...
 2013-10-26 22:00:00 | 2013-10-26 23:00:00 | 2013-10-27 00:00:00 | 2013-10-27 00:00:00+02
 2013-10-26 23:00:00 | 2013-10-27 00:00:00 | 2013-10-27 01:00:00 | 2013-10-27 01:00:00+02
 2013-10-27 00:00:00 | 2013-10-27 01:00:00 | 2013-10-27 02:00:00 | 2013-10-27 02:00:00+02
 2013-10-27 01:00:00 | 2013-10-27 02:00:00 | 2013-10-27 03:00:00 | 2013-10-27 02:00:00+01
 2013-10-27 02:00:00 | 2013-10-27 03:00:00 | 2013-10-27 04:00:00 | 2013-10-27 03:00:00+01
 2013-10-27 03:00:00 | 2013-10-27 04:00:00 | 2013-10-27 05:00:00 | 2013-10-27 04:00:00+01
 2013-10-27 04:00:00 | 2013-10-27 05:00:00 | 2013-10-27 06:00:00 | 2013-10-27 05:00:00+01

If a timestamp with timestamp column is selectec without using at time zone as in the LOCAL column above, it will be outputed at the server time zone at that timestamp. That is why there are missing and duplicated hours.
I think your desired output is wrong. But it is achievable with some query fu
I can't reproduce your actual output. What is the server time zone?
show time zone;
 TimeZone
----------
 CET


text:
Q: No manual entry msg - Fedora I'm trying on to use the man pages on RHEL.
Every time I'm searching for manuals, I'm getting this error message:
# man ls
No manual entry for ls

I've tried those solutions:

*

*mandb -c

# mandb -c
Processing manual pages under /usr/share/man...
Updating index cache for path `/usr/share/man/man2'. Wait...done.
Checking for stray cats under /usr/share/man...
Checking for stray cats under /var/cache/man...
Processing manual pages under /usr/local/share/man...
Updating index cache for path `/usr/local/share/man/man2'. Wait...done.
Checking for stray cats under /usr/local/share/man...
Checking for stray cats under /var/cache/man/local...
41 man subdirectories contained newer manual pages.
0 manual pages were added.
0 stray cats were added.

*To set the the $MANPATH to the /usr/share/man path

*yum install man-pages
What else can I do?


text:
Q: Stop Checkbox click form other function I want to stop click event of checkbox on this below button's function call
//Checkbox

    <input id="chksetreflayout" class="data_checkbox" onchange="RefLayoutDisplay();" type="checkbox" style="display:none; margin-right: 8px;" disabled="disabled">Set Reference Module Layout

//Button

Detail View

get_fields(name){
    //I want to stop checkbox click for full execution of this function
    code
    //enable that click
 }

A: You can disable the checkbox while the function executed
get_fields(name){
    document.getElementById("chksetreflayout").disabled = true;
    code
    document.getElementById("chksetreflayout").disabled = false;
 }


text:
Q: TabIndex vue emit change tab value from another component I need to emit tabIndex value from another component after successfully submitting a form so it can go back to the first index, how can I achieve this?
This is my component:
<template>

          Batches (age shown in weeks)

              <pie-chart
                :chartData="chartData"
                :options="chartData.options"
              ></pie-chart>

             Total Stock:{{ farmStock }}{{ measurement }}

you have no stocks

      <BatchMain></BatchMain>

</template>


text:
Q: Modify attributes in xml file <?xml version="1.0" encoding="UTF-8"?>
<suite name="Test Suite Name" parallel="none">
<listeners>
    <listener class-name="testng.MyListener"></listener>
</listeners>
  <test name="Test localhost">
    <parameter name="Browser" value="chrome"/> <!-- chrome or firefox or IE or Android Native-->
    <parameter name="url" value='' /> <!-- URL of the webpage you want to test -->
    <parameter name="CSV" value="data.csv"/> <!-- Location of the CSV file that you want to run tests with -->
    <parameter name="resultLocation" value="C:\Users\xvdf\Desktop\testmap"/> <!-- TestNG will create two folders in this location, screenshots and test-output-datestamp -->
    <parameter name="runType" value="baseline" /> <!--  actual or baseline . baseline = first run. actual is second run, to do a compare for example -->
    <classes>
      <class name="testng.runTest"></class>
    </classes>
  </test> <!-- Test CAN YOU SEE THIS?-->
</suite> <!-- Suite end of suite -->

I am trying to edit this XML so I can change 2 parameters, resultLocation and runType. So far I have tried a few things with the DocumentBuilder, but I cant see to get it to find the attributes. This is the code I have tried so far. The first part works, I can get to the test element.
package testng;

import java.io.File;
import java.io.IOException;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;

public class ModifyXMLFile {

    public static void main(String argv[]) {

       try {
        String filepath = "testng.xml";
        DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
        DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
        Document doc = null;
        try {
            doc = docBuilder.parse(filepath);
        } catch (SAXException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

        // Get the root element
        Node suite = doc.getFirstChild();
        Node test = suite.getFirstChild().getNextSibling().getNextSibling().getNextSibling();
        System.out.println(test);
        NamedNodeMap testName = test.getAttributes();
        Node nsdf = testName.getNamedItem("name");
        if(nsdf.getNodeValue().equals("Test localhost")){
            System.out.println("Found Element!");
        }//This actually works.

        Node loc = test.getFirstChild().getNextSibling().getNextSibling();
        System.out.println(loc);
        NamedNodeMap sdf = loc.getAttributes();
        Node as = sdf.getNamedItem("Browser");
        if(as.getNodeValue().equals("chrome")){
            System.out.println("Browser found!");
        }
       } catch (ParserConfigurationException pce) {
        pce.printStackTrace();
       }
    }
}

A: Seems like a homework of some kind so not gonna give you full source but below snippet takes care of the first parameter you want to change. Its cleaner than your attempted solution and more resistant to XML structure changes. You can use it to do the same thing for second parameter.
XPath xp = XPathFactory.newInstance().newXPath();
Element node = (Element) xp.evaluate("//test/parameter[@name='resultLocation']",
                    doc, XPathConstants.NODE);
node.setAttribute("name", "new attribute value");


text:
Q: Clash of connection between serial port read and write codes This is the code that reads from the z1 mote
while True:
   if not ser.isOpen():
      try:
        ser = serial.Serial(z1port, z1baudrate,timeout=0, parity=serial.PARITY_NONE,

                    stopbits=serial.STOPBITS_ONE, bytesize=serial.EIGHTBITS)
      except:
        sys.exit("Error connecting device")

   queue = ser.inWaiting()
   if queue > 0:
      data = ser.read(1000)
      print data
   time.sleep(0.2)

And this is the code that I have that I use it to write to the mote
# some event-driven code here so that whenever a message is received then do:
print(str(msg.payload))
ser = serial.Serial("/dev/ttyUSB1")
print ser.isOpen()
ser.write(msg.payload)

The output from the second code should be if msg.payload = "hello":
hello
True

But then the read code stops reading from the serial port (the code will run but no input). How do I solve this problem?

A: You can only create one serial connection to a device. The code in your question creates two connections, one in the main routine and one in the subroutine. In the main routine, you create a connection to establish communication with the device:
ser = serial.Serial(z1port, z1baudrate) # I assume z1port='/dev/ttyUSB1'

Then in your subroutine you also create a connection:
ser = serial.Serial("/dev/ttyUSB1")

So there are now two connections trying to use the same port. This will not work.
Instead, you should use the original connection throughout your program,
and define your subroutines to receive the connection as an input parameter. For example:
ser = serial.Serial(z1port, z1baudrate)
# do whatever to make connection to the device
getMessage(ser) # call subroutine to read data *with the existing connection*
ser.close()     # close connection when finished

def getMessage(serConn):
  # read data
  data = serConn.read(1000)
  # send ack
  serConn.write(b'OK')

Another option is to open and close serial connections throughout your code, whenever you need to do communication. This is usually much less efficient, and only makes sense if there will only be intermittent communication with the device.

A: I used the idea by @mhopeng to write a code that implements multithreading programming, where one function handles the reading and the other handles the writing. And before they are both called, I will connect to the serial port and pass it to both of the threads.
I had to use multithreading because I needed a separate thread for writing at any time from the user input.


text:
Q: how to make api response not be the same as previous result in React JS I am using an Free API of Advice Slip and when I am fetching data from API on Button click some time it gives me the same result from API Response how can I manage to filter that if the API response is same as previous so call the API again. you can check the code below.
 getAdvice = async () => {
    this.setState({ advice: "", load: true });
    await fetch("https://api.adviceslip.com/advice")
    .then((response) => response.json())
    .then((data) => {
    this.setState({ advice: data.slip.advice, load: false })});
    };

A: You need to check the returned value from API and if different, set it as new state value, or fetch again.
I used an approach with hooks but the code should be similar with setState
  const getAdvice = async () => {
    setLoading(true);
    setAdvice("");
    await fetch("https://api.adviceslip.com/advice")
      .then((response) => response.json())
      .then((data) => {
        if (advice === data.slip.advice) {
          getAdvice();
        } else {
          setAdvice(data.slip.advice);
          setLoading(false);
        }
      });
  };

sandbox

A: Can be like this:
getAdvice = async () => {
  this.setState({ load: true });
  await fetch("https://api.adviceslip.com/advice")
  .then((response) => response.json())
  .then((data) => {
     if (data.slip.advice === this.state.advice) {
       this.getAdvice();
     } else {
        this.setState({ advice: data.slip.advice, load: false)}
     }
   });
}

If result is the same we recursively call same function, if not we update state.