text:
Q: Why is my gallery app (designed using Glide) taking nearly 500mb RAM I made a gallery app which show offline stored images using GLIDE library in recyclerView but when i view the Profiler in android Studio it shows me that the app is taking nearly 500mb memory. Is this normal that my app is taking this much memory.
However my app is not crashing but it hang sometimes while showing images and also images are load all togethor (i can see the size of scrollbar getting smaller)
Also after asking User-permission images are not shown instantly. I have to start the app again to view these images. Those images should have been visible after accepting the permission.

1This is the normal look of my app.
2Sometime when scrolling some white space also come between the images (shown in brown shaped oval).
for reducing the memory, I tried to decrease the height of the imageView (thinking that may be now glide had to load less pixels) but didn't work at all.
for user-permission i tried using Android Developers Guide but still no luck.
// this is my main activity
    private static final int MY_PERMISSIONS_REQUEST = 100;
    private Cursor mCursor=null;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // layout initialization code
        mCursor = getImageCursor();
        requestStoragePermission();

        recyclerView = findViewById(R.id.imageRecyclerView);
        mAdapter = new mayankImageAdapter(this,mCursor);

      //..... (setting the recyclerView)
        RecyclerView.LayoutManager mLayoutManager = new StaggeredGridLayoutManager(2,StaggeredGridLayoutManager.VERTICAL);
        recyclerView.setLayoutManager(mLayoutManager);
        recyclerView.setItemAnimator(new DefaultItemAnimator());
        recyclerView.setAdapter(mAdapter);

    }

    private void requestStoragePermission() {
        if (ContextCompat.checkSelfPermission(MainActivity.this,
                Manifest.permission.READ_EXTERNAL_STORAGE)
                != PackageManager.PERMISSION_GRANTED) {
            ActivityCompat.requestPermissions(MainActivity.this,
                    new String[]{Manifest.permission.READ_EXTERNAL_STORAGE},
                    MY_PERMISSIONS_REQUEST);
        }
    }

    @Override
    public void onRequestPermissionsResult(int requestCode,
                                           String permissions[], int[] grantResults) {
        switch (requestCode) {
            case MY_PERMISSIONS_REQUEST: {
                // If request is cancelled, the result arrays are empty.
                if (grantResults.length > 0
                        && grantResults[0] == PackageManager.PERMISSION_GRANTED) {

                    // permission was granted, yay! Do the
                    // file-related task you need to do.

                }
                else {

                    // permission denied, boo! Disable the
                    // functionality that depends on this permission.
                }
                return;
            }
        }
    }

    public Cursor getImageCursor(){
        try{
            Uri externalUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI;
            String[] projection = new String[]{MediaStore.Images.Media._ID, MediaStore.Images.Media.TITLE,
                            MediaStore.Images.Media.SIZE, MediaStore.Images.Media.DATA};
            String sortOrder = MediaStore.Images.Media.TITLE+" ASC";

            Cursor imageCursor = getContentResolver().query(externalUri,
                        projection,null,null,sortOrder);
            return imageCursor;
        }catch(Exception e){
            return null;
        }
    }
    @Override
    protected void onDestroy() {
        mCursor.close();
        super.onDestroy();
    }
}

mayankImageAdapter.java
\\ onBindViewHolder method
    @Override
    public void onBindViewHolder(@NonNull MyViewHolder myViewHolder, int position) {
        if(imageCursor!=null) {
            imageCursor.moveToFirst();
            imageCursor.moveToPosition(position);
            int strIndex = imageCursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);

            String str = imageCursor.getString(strIndex);
            File myimageloc = new File(str);
            GlideApp.with(callingActivity).load(myimageloc).into(myViewHolder.imgView);
        }else{
            return;
        }
    }

acitivity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.RecyclerView android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:scrollbars="vertical"
    android:id="@+id/imageRecyclerView"
    xmlns:android="http://schemas.android.com/apk/res/android" />

I want to know the reason why my app is taking so much memory and what are steps to decrease this memory and how can i show images just after asking permissions from the user.
Thanks
Edit: I have updated the user-permission code and RecyclerView adapter code.


text:
Q: Trying to pause whilst running mplayer from webserver Hi i am creating my own user interface using python.
In this i currently run mplayer from a click with nohup (so as not to mess up the server running), what i would like to do is add a pause button.
Is this possible when running nohup or is there a better way to do it?
so trying
os.system("nohup mplayer file.mp3 &")

does not allow a pause as far as i could find.
then;
os.system("rm /tmp/mplayer")
os.system("mkfifo /tmp/mplayer")
os.system("nohup mplayer -slave -input file=/tmp/mplayer file.mp3 &")

My pause button is then created using;
os.system("echo pause > /tmp/mplayer") ##click again to unplay

works if typed in new terminal but kills my webserver whilst playing. So does not work from webserver.
Currently working with Flask/Python and jinja templates.
Many thanks

A: Is there any specific reason why you are not using the python-mplayer wrapper to control mplayer from python? This module is pretty complete and gives you control over the playback functions including pausing.
EDIT:
for non-standard mplayer binary location introspection method may need to be called (based on wiki entry from official page.
from mplayer import Player

# First, specify the correct path to the MPlayer executable
Player.exec_path = '/actual/path/to/the/mplayer-bin'

# Then, manually call the introspect() class method
Player.introspect()

# Since autospawn is True by default, no need to call player.spawn() manually
player = Player()

# Play a file
player.loadfile('/path/to/file.mkv')

# Pause playback
player.pause()

redpajama_set_name: RedPajamaStackExchange


text:
Q: How not to change the web page URL? I need to set the href value of a button relative to the current page url using jQuery mobile.
So I naively wrote the following code :
var path = window.location;
path = path.replace( "shop","edit" );
$("#btnEdit").setAttr( "href", path );

The url of the page is http://mysite/shop/1 and the href of the button should be set to http://mysite/edit/1.
When this code is inserted at the top of my 'pageinit' handler I see the url in the location bar of the browser (firefox & chrome) changing to http://mysite/shop/shop and the page is apparently reloaded, so I get a 404 error since it must have a number after /shop/ and it should have the value 1.
Even if I comment it out, restart the web server, the browser automatically replaces the http://mysite/shop/1 with the http://mysite/shop/shop in its url location field. ?!
I have to comment these instructions, restart the server and whatever to avoid this url replacement.
What is going on ?
How can I get the page location url and set my button href value without this nasty side effect ?

Edit 1:

*

*I should indeed use .attr or .prop instead of .setAttr that doesn't exist.

*The url change only show up with chrome and firefox, not in iPad, Android or IE9. Running the chrome debugging tool, it seems there is a DOMException thrown by jQuery at the instruction matches.call( document.documentElement, "[test!='']:sizzle" );. I have no idea what it means and why it causes the page to be reloaded with a different url.

Edit 2:

*

*I'm using fapws as web server and mako for templates. After I erased the cached python files generated by mako, the url change disappeared. ?!

*as suggested I should use .attr and window.location.href. This worked and the href attribute of the button was set to the correct value.

*Though it still doesn't work as it should. I now see a new unexpected and undesirable behavior. When clicking on the button, the url in the location bar is changed into http://mysite/edit/1, it executes the pageinit of the shop page (?!), then loads the edit page without executing its pageinit event.

Solution:
In the html file I defined this button with a default href value and nothing special:
<a href="#" data-role="button" data-icon="pencil" id="btnEdit"> Edit </a>

In the script file, more precisely in the handler of the $(document).on('pageinit',...) I now have this code which sets the href value but also adds the rel="external" attribute to the button.
var path = window.location.href;
path = path.replace( "shop","edit" );
$("#btnEdit").attr( "href", path ).attr( "rel", "external" );

There are no more automatic reload of the page and the weird behavior of the load has been removed. It happened because the default behavior of the <a> tag in jQuery Mobile is to load the target page using ajax and not with a normal full page load. The attribute rel="external" disables this behavior and the referenced page is then fully loaded normally. This behavior is described in the jQM documentation here.
Note: Although many answers contributed concretely to help me solve this problem, I checked Mad Man Moon's answer because he was very helpful and had the less points. If it was possible to check multiple answers I would have done it.

A: Use attr instead of setAttr (unless you are not using custom function or some framework/library)
$("#btnEdit").attr( "href", path );

As for URL automatically changing, see if you have URL Rewriting put in place in .htaccess file or possibility of code which is changing the URL in some other file.

A:
Even if I comment it out, restart the web server, the browser
  automatically replaces the ~/shop/1 with the
  ~/shop/shop in its url location field. ?!
I have to comment these instructions, restart the server and whatever
  to avoid this url replacement.

*

*I am a little confused. What is "it" that you are commenting out?

*Even with your replace being executed against your variable reference to window.location, it should be replacing "shop" with "edit", so the re-direct should be "mysite/edit/1" (unless the js regex engine is treating the 1 as the capture index?)

*Based on your RESTful style URL, I suspect that you are using some sort of server side MVC framework. If so, there's a good chance that the redirect is a server side issue and has nothing to do with the replace.

*Finally, instead of setting path = window.location, set it equal to window.location.href. window.location is the object which contains the URI properties (href, search, hash, etc). window.location.href is the string property of the complete the URL.

EDIT: I decided to do a little test of my own and confirmed that the issue is that you are setting path = window.location. Set path = window.location.href and your code will work.

A: try this
var path = window.location;
path = path.replace( "shop","edit" );
$("#btnEdit").prop( "href", path );

A: Your problem is that path is acting as an alias for window.location, so path.replace() is window.location.replace(), which triggers a redirect.
The solution: add .toString() on the end of window.location to get the string value instead of the object. var path = window.location.toString()


text:
Q: Which for loop is better/faster? Is there a difference between:
for (int i = 0; i < n; i++)

and:
for (int i(0); i != n; ++i)

They seem to be virtually identical to me. Which one is better than the other?

A: The second will fail if n is negative; i < n is a safer termination condition.
Apart from that, there's no difference for simple types like int.
For more complicated types, one might prefer the direct initialisation and pre-increment of the second. The first, at least in principle, might require a copy during initialisation and each increment, although in many cases these can be optimised out.

A: There is nearly no difference. I compiled a demo software with g++.
Here is the assembly for for(int i = 0; i < n; i++):
main:
.LFB0:
    .cfi_startproc
    pushq   %rbp
    .cfi_def_cfa_offset 16
    .cfi_offset 6, -16
    movq    %rsp, %rbp
    .cfi_def_cfa_register 6
    movl    $10, -4(%rbp)
    movl    $0, -8(%rbp)
    jmp .L2
.L3:
    addl    $1, -8(%rbp)
.L2:
    movl    -8(%rbp), %eax
    cmpl    -4(%rbp), %eax
    jl  .L3    ;------ if compiled with other for loop there is "jne   .L3"
    movl    $0, %eax
    popq    %rbp
    .cfi_def_cfa 7, 8
    ret
    .cfi_endproc
.LFE0:
    .size   main, .-main
    .ident  "GCC: (Ubuntu 4.8.2-19ubuntu1) 4.8.2"
    .section    .note.GNU-stack,"",@progbits

I commented the line that is different if you compile it with for(int i(0); i != n; ++i). As you can see the only difference is that in one case the compare operation is jump if less and in the other case there is jump if not equal.

A: It makes no sense to talk about speed, since the two do
different things.  Generally, however:

*

*For historical reasons, all of the code I've seen uses copy
initialization in the for-init-statment (to the point where
I wan't sure that the second was even legal).  In practice,
unless you have a very, very bad compiler, and a horribly
complicated iterator, it shouldn't make a difference.  Just use
which ever the local coding standards say, and don't worry about
it.

*Historically, the i < n has been preferred, on the grounds
that it works even if you happen to increment i in the loop as
well.  In C++, however, the i != n has become idiomatic, since
it also works with iterators and pointers.  It has also been
argued that if you do accidentally increment the index or
iterator once too many in the loop, it's better to go off into
nowhere land than for the program to seem to work.  Anyway, in
modern C++, I'd recommend i != n, unless your local coding
standard explicitly says otherwise, of the algorithm
intentionally expects i to possibly go beyond n (e.g. you're
using a stride, and the incrementation is i += step, where
step isn't guaranteed to be a multiple of n).

*Despite claims to the contrary, there's no difference between
i++ and ++i with any modern compiler and any reasonable
iterator.  Because some authors have claimed that ++i may be
faster, however, it's become usual in C++.  If you have existing
code using i++, or the local coding standard says to use it,
use i++; otherwise, use ++i, simply to avoid arguments with
people who've read that it's faster.  (The authors claiming that
it's faster never actually published a benchmark supporting
their claim.)
The result is that:
for ( int i = 0; i != n; ++ i )

is probably the most idiomatic in C++ code, but in all cases,
you should follow the local coding standard and existing code
(if working on a legacy project).  And don't worry about the
relative speed of each; it almost certainly won't make
a difference.

A: Others already said that in practice, it makes no difference. I agree on that, because modern compilers simply optimize away the differences.
If you are talking about principle, though, there is a difference (three to be exact). Lets assume preconditions ensure that the two variants have the same effects.
1: int i = 0 asks the compiler to create a variable, initialize it, and then set it to 0 (using its operator =). That initialization might, on theoretical platforms and compilers, include setting i to some defined value. int i(0) on the other hand tells the compiler to initialize the variable to 0, thus possibly saving the superfluous initialization.
2: This part is, in lack of precise knowledge, a bit vague. i < n requires, for many CPUs, the compiler to generate a subtraction, extract a sign bit, then conditionally jump on that. i != n on the other hand requires a subtraction, then jump on the 'is zero' bit.
3: i++ asks the compiler to make a copy of i (that is returned and not used later), then increment it. ++i on the other hand increments, then returns a reference to i.
In conclusion: In all three cases is the second variant in principle less work to do for the executing processor.


text:
Q: How do I rename a package in Lerna? Can I simply rename the folder? I don't see any specific command in the manual.
Current folder structure:
/
|
+-- package.json
+-- lerna.json
+-- packages/
    |
    +-- dep1
    +-- dep2
    +-- app

Root package.json contents:
{
  "name": "splitting",
  "version": "0.0.1",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "lerna": "^3.20.2"
  }
}

Root lerna.json contents:
{
  "packages": [
    "packages/*"
  ],
  "version": "independent"
}

File package.json in packages/app/ contents:
{
  "name": "app",
  ...
  "dependencies": {
    ...
    "dep1": "^0.0.1",
    ...
  }
  ...
}

A: from https://chat.openai.com/chat
To rename a package in Lerna, follow these steps:

*

*Rename the folder containing the package in the file system.

*Update the name property in the package.json file of the package.

*Update any references to the old package name in the other packages' dependencies or devDependencies sections in their package.json files.

*Run lerna bootstrap to update the symlinked dependencies between packages.

If you have a lot of packages, you can use a command-line tool like grep or find to automate the search and replace of the references.


text:
Q: Are high-school contest problems "harder" than college mathematics? At my own college and on this site as well, in fact, anywhere where there are a lot of people who study mathematics, I have noticed an interesting pattern.
What I've noticed is that, a lot of people at college level or above can solve problems such as this with little to no difficulty if they've learned the material well. In fact, I showed this very same problem to some of my college classmates and they too were able to solve it with no difficulty. There's nothing unique about this problems, it's something you'd learn to solve in college in a mathematics course, just a simple ODE problem.
However, and this where the interesting part is, when they encounter problems such as this, a problem that has been derived from another that appeared in a High-school mathematics contest, they seem to struggle, quite a lot. The same group of classmates that I asked to solve the previous problem, were not able to solve this, only one of them managed to give me the right answer and the solution was, let's just say, not very good and not something that I believe would be awarded a high score on that contest. The same seems to be true (as far as I have seen) on this site, too. A lot of people generally struggle with such contest-type problems, as I have observed by having posted many such questions here.
So, my question is really simple, why is this the case? Why is it that a college-level calculus problem, something you'd never ask a high-schooler to even look at, is little more than a trivial calculation yet problems like these, that appear in contests, seem to be more challenging and difficult? Are they genuinely more difficult? Are there other factors involved that are being overlooked? Or is it simply a lack of exposure to contest-oriented problems that drive this "issue" rather than a lack of mathematical prowess? What do you think?

A: Computation is only one aspect (albeit, an important one) of the mathematical problem-solving process in general.  The "difficulty" of a math problem, as perhaps characterized by the likelihood* of an individual with the prerequisite knowledge to understand the question to be able to solve it, is not merely a function of the complexity of the computation involved; it is also to a great extent determined by what one might call "creativity" or "original thought" in the approach.
To a degree, it is possible to train students to get better at problem solving by exposing them to a wider array of strategies.  Learning how to attack problems by teaching previously solved problems is a form of pattern recognition development that is commonly used in contest preparation, much in the same way that we teach computational techniques through practice problems.  However, this approach is not guaranteed to be successful, especially when faced with a question that might be solved only through some line of reasoning that is profoundly different than what was prepared before.
And I would argue that this is the essence of mathematics research:  the ability to craft novel logical statements that might build on previous knowledge but require a certain kind of what I referred to above as "creativity."  The ability to do this is something of great interest to mathematicians (and non-mathematicians alike!), and if history is any indication, success in math contests seems to be a fairly good predictor of future ability in this regard.
That said, I would actually like to turn your claim around and question it, because I suggest that some the problem-solving methods that we regard as routine today (e.g., the differential equation example you provided), would not have been straightforward in Newton's time, when the calculus was still being discovered and formalized.  Similarly, a sophisticated high school student would have no problem applying the cubic formula, but at the time the formula was discovered, it was a secret known only to a select few.  Or consider the general solution in integers to the Pell equation $$x^2 - N y^2 = \pm 1,$$ which again, is something we can do today with minimal effort, but was at one point highly nontrivial.  Even in the realm of contest math, the "Vieta jumping" technique that was used to solve the notoriously difficult IMO 1988 #6, is now part of the arsenal of strategies regularly taught as part of contest preparation today.  This is the nature of mathematics discovery and education.
In closing I should note that there exist contests that require a higher level of prerequisite knowledge (e.g., undergraduate mathematics instead of high school or middle school), the most famous of these is the William Lowell Putnam competition.
*"Likelihood" in this case might be established by imagining that we could gather a random sample of students with the required knowledge and see what proportion could answer the question--in other words, do something not unlike entering them into a contest.


text:
Q: Active Directory Realm trust with MIT KDC and Referrals/Host Mappings I can create a one-way trust between an Active Directory and a MIT KDC but what I'd like to know is whether Active Directory supports Kerberos Referrals (RFC 6806) as well in this scenario.
This'd allow clients to automatically figure out which hosts belong to which Realm and also which KDC to contact.
Currently, we always have to run ksetup /addkdc <...> and ksetup /addhosttorealmmap <...> on every client which is a bit tedious (I'm no Windows expert but I assume this can also be rolled out to all clients using Group Policies)


text:
Q: web service is not running I am new to this WEB SERVICE concept so pardon me if I ask some stupid question. Here is what I am trying to do.
1) I have created a dynamic project in Eclipse with Jboss as App server with Dynamic web module version as 2.5
2) I have created a simple java class annotated @webService.
@WebService
public class SampleWebServiceExample {
public String getStringWebService(String a)
{
    return "Web Service is running with input: "+a;
}}

Now when I am deploying it service is getting deployed but I am not able to find my wsdl file. Heres is Jboss AS 7.1 server log
18:23:40,415 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-2)

JBAS015876: Starting deployment of "SampleWebService.war"
18:23:40,915 INFO  [org.jboss.wsf.stack.cxf.metadata.MetadataBuilder] (MSC service thread 1-4) Add Service
 id=SampleWebServiceExample
 address=http://localhost:8090/SampleWebService/SampleWebServiceExample
 implementor=SampleWebServiceExample
 invoker=org.jboss.wsf.stack.cxf.JBossWSInvoker
 serviceName={http:///}SampleWebServiceExampleService
 portName={http:///}SampleWebServiceExamplePort
 wsdlLocation=null
 mtomEnabled=false
18:23:41,261 INFO  [org.apache.cxf.service.factory.ReflectionServiceFactoryBean] (MSC service thread 1-4) Creating Service {http:///}SampleWebServiceExampleService from class SampleWebServiceExample
18:23:42,376 INFO  [org.apache.cxf.endpoint.ServerImpl] (MSC service thread 1-4) Setting the server's publish address to be http://localhost:8090/SampleWebService/SampleWebServiceExample
18:23:42,541 INFO  [org.jboss.wsf.stack.cxf.deployment.WSDLFilePublisher] (MSC service thread 1-4) WSDL published to: file:/D:/JavaWork/JBoss_AS/jboss-7.1.1.Final/standalone/data/wsdl/SampleWebService.war/SampleWebServiceExampleService.wsdl

A: Anyways I got solution.JBoss AS keeps the generated wsdl files from EJBs with @Webservice annotation in the data folder. So if we want to access the wsdl we can access it as
http://localhost:8090/SampleWebService/SampleWebServiceImpl?wsdl

we can find the publish address from server log and add ?wsdl... thats it :)


text:
Q: Why is SQL Server returning a nullable bit when CASE is used? Assume the following table structure:
CREATE TABLE [dbo].[TEST_TABLE]
(
   [TEST_VALUE] [smallint] NOT NULL
)

The value in the column can be 0, 1 or 2. The rationale why this can happen is irrelevant for the sake of the question.
Now, assume we create a view to encapsulate a simple query to this table:
CREATE VIEW [dbo].[TEST_VIEW]
AS
SELECT RETURN_VALUE =
       CASE
           WHEN TBL.[TEST_VALUE] = 1 THEN CAST(1 as bit)
           ELSE CAST(0 as bit)
       END
FROM [dbo].[TEST_TABLE] AS [TBL]

After this view is created if we check what columns the view returns then the RETURN_VALUE column is typed as (bit, null) in SQL Server Management Studio, and no constructs such as wrapping the entire CASE ... END clause into a CAST() seems to change this fact.
In which scenario can the return value truly be NULL? Or is SQL Server just being extra-cautious here? Is there a way how I can enforce the view column's datatype to be (bit, not null)?


text:
Q: Cannot successfully disconnect from remote machine using 'nohup' or 'screen' I am trying to do some work on a remote machine and disconnect without terminating the work. I have tried both nohup and screen, unfortunately it is not working out. After I type exit to logout my work also terminates immediately.
I am trying to run 108 simulations on a remote machine. For that purpose I have written a script named batch.sh which runs one simulation after the other until all 108 are done. The program that actually runs a simulation launches 5 programs in 5 different terminals (using xterm -e). I run batch.sh using:
nohup bash batch.sh &
As long as I am connected everything works just fine. If I disconnect and then reconnect to check whether everything is working as it should...no joy :(
Are there any caveats I am overlooking? Possibly because my program launches other programs in external terminals?
UPDATE
If I use the suggestions of adding -oForwardX11=no to ssh and unset DISPLAY before launching my script I get these errors:
nohup: ignoring input and appending output to nohup.out
In nohup.out I have these messages:
xterm Xt error: Can't open display:
xterm:  DISPLAY is not set

A: Apparently your script/program is trying to launch xterm on its own. These days many systems enable X11 forwarding for their SSH client by default - as a result the DISPLAY variable is set in your shell session but becomes invalid once you disconnect. Therefore, as long as you are connected to the remote system, the xterm processes can access the X server on your local machine through the SSH connection, but die once that connection is severed.
I have occasionally encountered the same issue with Java programs that use e.g. the Java AWT subsystem to generate image files, even when there is no actual graphical window. You should first see if your program will somehow adapt if there is no X server available. One option is to disable X11 forwarding with the -oForwardX11=no option to ssh:
$ ssh -oForwardX11=no user@server.host.name

You could also try unsetting the DISPLAY environment variable before starting your script and see what happens.
However, if your program is launching xterm windows indiscriminately then you'd have to make it e.g. use an output file on the server instead - by modifying it, if necessary. As an added advantage, you would get rid off the network load and timing overhead involved with forwarded X connections.
If you cannot change the way your program works and you do not actually care about the output in those xterm windows, then you could try launching a virtual framebuffer X server on the remote system and have your script use that for xterm.


text:
Q: SSL handshake problems with Qt 5.9 only when deployed in client I have a desktop application built in Qt 5.9 using MinGw in Windows, it pulls data from a database and displays it in the GUI in a organized manner.
Deploy of the project in release configuration is working fine in 4 different computers that i tested (windows 10 and windows 7)
But, in my client's computer, there are SSL handshake errors whenever a connection is tried.
Error that occurs is:
qml: Error during SSL handshake: error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version

Current solutions that i found here and tried:

*

*Deploy openssl newest dlls in my release folder (alongside qt's dlls)

*Implement ignoreSslErros(), as in the code bellow:
QObject::connect(_socket, SIGNAL(sslErrors(QList<QSslError>)), _socket,SLOT(ignoreSslErrors()));

Where the signal and slot used are defined in QWebSocket's documentation.
SLOT: http://doc.qt.io/qt-5/qwebsocket.html#ignoreSslErrors
SIGNAL: http://doc.qt.io/qt-5/qwebsocket.html#sslErrors
This implementation didn't work.
I got to the point of remote accessing my client's computer and running Qt in debug configuration, and the only thing i got was these build warnings that dont occur when i build on my computer:
qt.network.ssl: QSslSocket: cannot resolve TLSv1_1_client_method
qt.network.ssl: QSslSocket: cannot resolve TLSv1_2_client_method
qt.network.ssl: QSslSocket: cannot resolve TLSv1_1_server_method
qt.network.ssl: QSslSocket: cannot resolve TLSv1_2_server_method
qt.network.ssl: QSslSocket: cannot resolve SSL_select_next_proto
qt.network.ssl: QSslSocket: cannot resolve SSL_CTX_set_next_proto_select_cb
qt.network.ssl: QSslSocket: cannot resolve SSL_get0_next_proto_negotiated
qt.network.ssl: QSslSocket: cannot resolve SSL_set_alpn_protos
qt.network.ssl: QSslSocket: cannot resolve SSL_CTX_set_alpn_select_cb
qt.network.ssl: QSslSocket: cannot resolve SSL_get0_alpn_selected

A: Given the warnings I would suggest that the OpenSSL library at the clients computer does not support TLS 1.1+ but that the server requires it. And while you might have attempted to provide the new SSL libraries these messages show that your program does not use these new libraries.


text:
Q: Android Logcat: W/ApplicationPackageManager(22470): getCSCPackageItemText() I'm working on a big Android project and recently the logcat shows so many  W/ApplicationPackageManager(22470): getCSCPackageItemText() log.
This seems only occurring on Galaxy S4.
Anyone would kindly tell me the cause of such log? such as invoking some specific API.
01-26 12:03:13.820: W/ApplicationPackageManager(22470): getCSCPackageItemText()
01-26 12:03:13.820: W/ApplicationPackageManager(22470): getCSCPackageItemText()
01-26 12:03:13.820: W/ApplicationPackageManager(22470): getCSCPackageItemText()
01-26 12:03:13.825: W/ApplicationPackageManager(22470): getCSCPackageItemText()
01-26 12:03:13.825: W/ApplicationPackageManager(22470): getCSCPackageItemText()
01-26 12:03:13.825: W/ApplicationPackageManager(22470): getCSCPackageItemText()


text:
Q: Synchronize with stream clear case integration view On my clear case integration view there is an option 'Synchronize with stream' which is sometimes enabled and sometimes disabled. What governs if this is enabled or disabled? Also it seems when i click this, it just updates the integration view. So why we need a separate function like 'Synchronize with stream' when we can just update the integration view?

A: That button is only active when the configuration of your view (ie the list of baselines listed by your config spec) isn't the same than the configuration of your stream.
The fact that is also update the view is only a side-effect of your view being a snapshot one.
For a snapshot view (ie a view on your disk):

*

*updating only the view will update the content based only on the config spec of said view (unchanged)

*synchronizing the view with the stream will trigger an update which will be based on the updated config spec of the view (ie the config spec of the view rewritten automaticaly for you, after reading the configuration of the associated Stream)

The fact that it updates your "integration view" is just because your view happens to be associated with the Integration Stream.
But as my previous answer on "Integration stream vs integration view in ClearCase" shows, there can be many other views (associated to many other sub-streams, also called "Development Streams").
Note: the cleartool command actually behind that button is:
cleartool -tag view setcs -stream.

If you execute it at the root directory of a snapshot view:
cleartool setcs -stream

It will trigger the update (after updating the config spec)


text:
Q: How to deploy a Vue.js app with env vars on Google Cloud Build? I want to deploy a Vue.js app with google cloud build (to Firebase Hosting). Even if this is a fairly trivial use of the two products, the implementations of the two service for environment variables seems contradictory.
Google Cloud Build requires environment variables to start with "VUE_APP" prefix otherwise it completely ignores them and their content is undefined. On the other hand, Google cloud build requires variables to have the prefix "_", otherwise it throws the substitution variable is not "a valid built-in substitution". So I don't see anyway to pass the variables from the Google Cloud Build to the Vue.js app.
I also tried the following:
- name: 'gcr.io/cloud-builders/npm'
  args: [ 'ci', '--prefix', 'web/vue_js_landing/' ]
  env: [ 'VUE_APP_FIREBASE_WEB_API_KEY=${_FIREBASE_WEB_API_KEY}' ]

But it throws 'key in the template "VUE_APP_FIREBASE_WEB_API_KEY" is not a valid built-in substitution'
Anyone aware of a workaround for this situation?
Correction:
This question was misleading. The code above answers my question. There's also a typo in it. It should have been "args: [ 'build', '--prefix', 'web/vue_js_landing/' ]". The error I mentioned, if someone else stumbles upon, this was triggered because I did "echo $VUE_APP_FIREBASE_WEB_API_KEY" at some other point in my config and that's maybe because the ALLOW_LOOSE flag was not set.

A: Is this your entire build config?  Please post if you have more
I'm not sure how the VUE_APP prefix is required in your context, but you can set substitutions and env vars without this prefix regularly.
Substitutions need _ prefix are replaced during build but are not in env during build step. Env vars don't need extra prefix, but need to be called with $$.
How are you passing the web API Key?  Here is an example passing it through cli
gcloud builds submit --no-source --substitutions _SECRET_KEY='123'
cloudbuild.yaml
steps:
- name: 'gcr.io/cloud-builders/npm'
  entrypoint: 'bash'
  args: ['-c', 'echo $$FIREBASE_WEB_API_KEY']
  env: ['FIREBASE_WEB_API_KEY=${_SECRET_KEY}']

Here is another example showing both substitutions and env variables.  You can run with gcloud builds submit --no-source if you want to play with it.
cloudbuild.yaml
steps:
- id: 'breakout syntax'
  name: 'gcr.io/cloud-builders/npm'
  entrypoint: 'bash'
  args:
   - '-c'
   - |
     echo 'print all env vars'
     env
     echo 'print one env var with $$'
     echo '1: '$$BUILD_ENV_VAR
     echo '2: '$$STEP_ENV_VAR
     echo '3: '$$SUB_IN_ENV_VAR
     echo 'print one substitution with $ or ${}'
     echo '1: '${_SUB_VAR}
     echo '2: ' $$_SUB_VAR ## doesn't exist in env, fails
     echo '3: '$_SUB_VAR
  env: ['STEP_ENV_VAR=step-var']

substitutions:
    _SUB_VAR: sub-var
options:
    env:
     - BUILD_ENV_VAR=env-var
     - SUB_IN_ENV_VAR=env-var-with-${_SUB_VAR}

sources: cloud build docs: subs, cloud build docs: build steps, mastering cloud build syntax (bash things)


text:
Q: Python, import random not showing a new random number when its called again I need a random number each time self.damage or self.dodge is called. But once its called, it doesn't change.
class Character:
is_dead = 0

def __init__(self, race, health, damage, dodge):
    self.race = race
    self.health = health
    self.damage = random.randint(damage[0], damage[1])
    self.dodge = random.randint(0, round(100 / dodge))

def hit(self, attack):
    if self.dodge == 0:
        self.health = self.health
    elif attack > 100:
        self.health = 0
    elif attack < 0:
        self.health = 100
    elif self.health - attack <= 0:
        self.health = 0
    else:
        self.health = self.health - attack
    return self.health

Here is where i call it.
ork = Character("Ork", 150, (50, 80), 1)
human = Character("Human", 100, (40, 60), 33)

ork.hit(human.damage)

It's called in a loop each time, the whole code is too long to show.


text:
Q: jQuery access element after DOM loaded I have loaded some content via innerHTML.
    $('#load-text-button').click(function () {
         document.getElementById("text-area").innerHTML="Some text The Footnote Some other text.
    });

Now I want to access the newly created span (with a class of "footnote") when the "bold-footnote-button" is clicked. The footnote button was loaded on document load, but the text was loaded after the DOM loaded.
    $('#bold-footnote-button').click(function () {
        $(".footnote").addClass('bold');
    });

The ".footnote" element can't be found. Everything I've read points to using the .live method, but the docs say it's now deprecated. How do I access the new  ".footnote" element without having to click on it directly?

A: The click function should work fine, as you're not targeting the newly inserted element with the event handler, but inside the event handler. The problem is probably that no such element was inserted as you have some issues with the quoting, do it like so:
$('#load-text-button').click(function () {
    $("#text-area").html('Some text The Footnote Some other text.');
});

A: maybe i'm missing something but if you change your html on the first click() when you ask for $(".footnote") you should find the newly created span. Sometimes there are problem with the lag between DOM modification and DOM query but you have those problem only when you have your statements one after the other. In your case the browser has all the time to update itself while the user goes to #bold-footnote-button. Maybe the problem is that you use doublequote for the string and for the class attribute in your first example.
Check with your browser developement tools if it gets the class attribute correctly


text:
Q: Is it possible to add tags for each row in table data @case1
Scenario: CreateDog Testcases

*

*table CreateDog
|testcaseName|name|gender|status
|"Test for Male Dog"|"Titus"|"male"|201|
|"Test for Male Dog"|"Serena"|"female"|201|

*string jsonStringForCreateDog = CreateDog

*JavaUtil.writeJsonToFile(jsonStringForCreateDog, "CreateDog.json")
I have a feature file that uses a table to create data for each of the test cases for a particular usecase. The actual test feature file then reads the json file created from the above step in the scenario outline example and runs all the tests for which the data is available in the json file.
I do not want to generate the data for some of the rows in the table above when run on a particular test environment. Is there a way to add tags for each row ? Or is there any other options to achieve this?


text:
Q: Middle mouse click emulation on trackpad, how can I set it? I've just updated to Ubuntu 11.10 and I'm using Unity. Since the update I can no longer use 'Middle Clicks' with the Track-pad. Tab-browsing in Firefox has become a pain :(
I used to swap the 'three finger tap' middle click and the 'two finger tap' right click, since I nearly never use right clicks. This was done trough the mouse configuration I guess but I can't find it now.
Where can I set this?
To make things even worse the three finger tap does nothing, so middle clicks are not possible at all since the update.
How can I fix this?
I know I can remove the install (i got a separate home partition) and install an old version but I would like to use the actual software and recent Unity if possible.

A:
leoperbo's answer worked for me with Ubuntu 12.04 but I
  had to change the 266 number at leoperbo's suggested command.
  You shouldn't use this command without carefully finding the 3-digit number
xinput set-int-prop NN 266 8 2 3 0 0 1 2 3

The other command though should work without problems (had numbers for the setup which didn't make sense hence that I changed them)
xinput set-prop "ETPS/2 Elantech Touchpad" "Synaptics Tap Action" 2, 3, 0, 0, 1, 2, 3

Just in case I wrote the following guide to find your NN and 266 for your
  touchpad. At the end also I explain the values you set so you can choose your optimal settings. Also you should probably read leoperbo's answer for setting it up permanently

1st use the following command in the terminal
xinput list

You will get something like this
⎡ Virtual core pointer                      id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
⎜   ↳ ETPS/2 Elantech Touchpad                  id=13   [slave  pointer  (2)]
⎣ Virtual core keyboard                     id=3    [master keyboard (2)]
    ↳ Virtual core XTEST keyboard               id=5    [slave  keyboard (3)]
    ↳ Power Button                              id=6    [slave  keyboard (3)]
    ↳ Video Bus                                 id=7    [slave  keyboard (3)]
    ↳ Power Button                              id=8    [slave  keyboard (3)]
    ↳ Sleep Button                              id=9    [slave  keyboard (3)]
    ↳ 1.3M WebCam                               id=10   [slave  keyboard (3)]
    ↳ AT Translated Set 2 keyboard              id=11   [slave  keyboard (3)]
    ↳ Acer WMI hotkeys                          id=12   [slave  keyboard (3)]

What we need is the touchpad's id (in my case 13)
2nd use the following command in the terminal replacing the XX with the id number you found above
xinput list-props XX

You will get something like this
Device 'ETPS/2 Elantech Touchpad':
Device Enabled (144):   1
Coordinate Transformation Matrix (146): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
Device Accel Profile (269): 1
Device Accel Constant Deceleration (270):   2.500000
Device Accel Adaptive Deceleration (271):   1.000000
Device Accel Velocity Scaling (272):    12.500000
Synaptics Edges (273):  56, 1352, 34, 606
Synaptics Finger (274): 1, 1, 256
Synaptics Tap Time (275):   180
Synaptics Tap Move (276):   68
Synaptics Tap Durations (277):  180, 180, 100
Synaptics ClickPad (278):   0
Synaptics Tap FastTap (279):    1
Synaptics Middle Button Timeout (280):  75
Synaptics Two-Finger Pressure (281):    282
Synaptics Two-Finger Width (282):   7
Synaptics Scrolling Distance (283): 30, 30
Synaptics Edge Scrolling (284): 0, 0, 0
Synaptics Two-Finger Scrolling (285):   1, 0
Synaptics Move Speed (286): 1.000000, 1.750000, 0.129366, 40.000000
Synaptics Edge Motion Pressure (287):   30, 160
Synaptics Edge Motion Speed (288):  1, 123
Synaptics Edge Motion Always (289): 0
Synaptics Off (290):    2
Synaptics Locked Drags (291):   0
Synaptics Locked Drags Timeout (292):   5000
Synaptics Tap Action (293): 2, 3, 0, 0, 1, 3, 0
Synaptics Click Action (294):   1, 1, 0
Synaptics Circular Scrolling (295): 0
Synaptics Circular Scrolling Distance (296):    0.100000
Synaptics Circular Scrolling Trigger (297): 0
Synaptics Circular Pad (298):   0
Synaptics Palm Detection (299): 0
Synaptics Palm Dimensions (300):    10, 200
Synaptics Coasting Speed (301): 20.000000, 50.000000
Synaptics Pressure Motion (302):        ... of unknown type CARDINAL

Synaptics Pressure Motion Factor (303): 1.000000, 1.000000
Synaptics Resolution Detect (304):  1
Synaptics Grab Event Device (305):  1
Synaptics Gestures (306):   1
Synaptics Capabilities (307):   1, 0, 1, 1, 1, 1, 1
Synaptics Pad Resolution (308): 1, 1
Synaptics Area (309):   0, 0, 0, 0
Synaptics Noise Cancellation (310): 7, 7
Device Product ID (263):    2, 14
Device Node (264):  "/dev/input/event11"

What we need to find above is this line
    Synaptics Tap Action (293): 2, 3, 0, 0, 1, 3, 0

and note down the number inside the ( ), which in my case is 293
3rd and final command at the terminal
( Replace XX with the id and YYY with the number inside the ( ) which for my laptop were XX=13 and YYY=293 )
xinput set-int-prop XX YYY 8 2 3 0 0 1 2 3

The values 2 3 0 0 1 2 3 are the following settings at the correct order
0=disabled 1=left click 2=middle 3=right
Option "RTCornerButton"
Which mouse button is reported on a right top corner tap.

Option "RBCornerButton"
Which mouse button is reported on a right bottom corner tap.

Option "LTCornerButton"
Which mouse button is reported on a left top corner tap.

Option "LBCornerButton"
Which mouse button is reported on a left bottom corner tap.

Option "TapButton1"
Which mouse button is reported on a non-corner one-finger tap.

Option "TapButton2"
Which mouse button is reported on a non-corner two-finger tap.

Option "TapButton3"
Which mouse button is reported on a non-corner three-finger tap.

A: To fix the middle click you can use the following command:
xinput set-int-prop NN 266 8 2 3 0 0 1 2 3
Where NN is the id of the mousepad device, you can see it with the command xinput list. 266 is the id of the property "Synaptics Tap Action" you can see it with xinput list-props NN. Example:
xinput set-prop "ETPS/2 Elantech Touchpad" "Synaptics Tap Action" 8, 9, 0, 0, 1, 2, 3

You have to run that command after each resume. To preserve your synaptics configuration after resume, you can follow this steps (from wiki.archlinux.org):

Gnome settings daemon may override existing settings (for example ones
  set in xorg.conf.d) for which there is no equivalent in any of the
  graphical configuration utilities. It is possible to stop gnome from
  touching mouse settings at all:
1. Run dconf-editor
2. Edit /org/gnome/settings-daemon/plugins/mouse/
3. Uncheck the active setting

It will now respect your system's existing synaptics configuration.

It worked for me on Ubuntu 11.10 AND now I have:
Two-finger scrolling.
Middle Click with two fingers tap.
Right Click (tap at bottom right of scroll area).


text:
Q: c++ strange variable values I have a code snippet that is just originating two int values for the first time. Here's the line of code:
int xb2,yb2 = 0;

But, according to the debugger, when it hits this line of code, the value of xb2 is 4262504!
What could have caused this?
By the way, sorry if I am missing something obvious, I am new to C++.

A: xb2 is set to 4262504 (some arbitrary value, usually whatever happened to be at that location on the stack beforehand) because you never initialized it to 0.
The correct way to do it is
int xb2 = 0, yb2 = 0;

In addition, you state it's a strange value "when it hits this line of code". Make sure you actually execute that line in the debugger. If the cursor position or highlight is on that line, it usually means it's the one to be executed next. In other words, you may need to do one more step operation.

A: Your code
int xb2,yb2 = 0;

is just setting the value 0 to yb2,
try this:
int xb2=0,yb2=0;


text:
Q: How to create mysql database using a form .i am using spring boot I am in training now and I have to create mysql database from a form, where I  have to enter the name of the database and its details, all spring with the boot,

A: in first time you need to add thes dependencies in your pom.xml
<dependencies>
  <dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
  </dependency>
  <dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-data-jpa</artifactId>
  </dependency>
  <dependency>
    <groupId>mysql</groupId>
    <artifactId>mysql-connector-java</artifactId>
  </dependency>
</dependencies>

and in the file src/main/resources/application.properties  you will add :
spring.datasource.url = jdbc:mysql://localhost:8889/netgloo_blog
spring.datasource.username = root
spring.datasource.password = root
spring.datasource.driverClassName = com.mysql.jdbc.Driver
spring.jpa.database = MYSQL
spring.jpa.hibernate.ddl-auto = update

good luck


text:
Q: Does plotly have a way to convert a date on the x-axis to a day of the week? I created a line chart in Plotly from a dataset on crime and it is set up roughly how I need it, but I wanted to convert the x-axis tick labels from the date and time it has currently (see below), to a day of the week. For example on the graph the first point is at 2022/06/25 which was a Saturday. I want the label to say just Sat. My table also contains a column that has the day of the week in it for each date, but I can't figure out how to change that day for the date.
Worst case, I would need to hard code each tick label on the x-axis?
Any input is appreciated. Thank you!
My code:
df = pd.read_csv("test.csv")

        df = df[(df['Occurrence_Category'] == 'Non-Violent')]

        df = df.groupby(['Reported_Date', 'Day_of_Week'], as_index=False).size()

        print(df)

        fig = px.line(
            df,
            x='Reported_Date',
            y='size',
            labels={'size': 'Number of Occurrences', 'Reported_Date': 'Day of the Week'},
            title="Number of Non-Violent Crimes in the last 90 days"

        )
        fig.update_layout(
            xaxis=dict(
                tickmode='linear',
                tick0=1,
                dtick=1
            ),
            yaxis=dict(
                tickmode='linear',
                tick0=0,
                dtick=25
            ),
        )

        fig.show()

Edit: here is the dict of the first 10 rows.
data_dict =
    {'Reported_Date': {0: '2022/06/25 12:00:00+00', 1: '2022/06/26 12:00:00+00', 2: '2022/06/27 12:00:00+00', 3: '2022/06/28 12:00:00+00', 4: '2022/06/29 12:00:00+00', 5: '2022/06/30 12:00:00+00', 6: '2022/07/01 12:00:00+00', 7: '2022/07/02 12:00:00+00', 8: '2022/07/03 12:00:00+00', 9: '2022/07/04 12:00:00+00'}, 'Day_of_Week': {0: 'Sat', 1: 'Sun', 2: 'Mon', 3: 'Tue', 4: 'Wed', 5: 'Thu', 6: 'Fri', 7: 'Sat', 8: 'Sun', 9: 'Mon'}, 'size': {0: 113, 1: 94, 2: 165, 3: 141, 4: 153, 5: 129, 6: 65, 7: 104, 8: 74, 9: 167}}

When I print the df, I get:

My current graph:

A: All you have to do is to convert the Reported_Date to datetime type such that:
df['Reported_Date'] = df['Reported_Date'].apply(pd.to_datetime)

and specify the tickformat to extract the week day, and remove other parameters to format x-axis as follows:
fig.update_layout(
            xaxis=dict(
                tickformat = '%a'   #<----- this is the format to get weekday
            ),
            yaxis=dict(
                tickmode='linear',
                tick0=0,
                dtick=25
            ),
        )


text:
Q: Are pointers declared inside struct/class initialized to nullptr by default? I have read on Stack Overflow that global/static variables are initialized to their default value (0).
I also read somewhere else (not sure tho), that class variables (non-static) are also initialized to 0. Is this true?
Specifically, I am wondering whether my pointers are by default initialized to nullptr.
I tried compiling on g++ and clang and both seem to initialize them to nullptr.
#include <iostream>

struct Foo {
    int *ptr;
};

int main() {
    Foo f;
    std::cout << f.ptr;
}

printed:

0

If it's only my compiler doing it, is there any way I can tell my compiler not to do this (using some compiler flag)?

A:
I also read somewhere else (not sure tho), that class variables (non-static) are also initialized to 0.

Wherever you read that (if you read that), then stop reading that source!

Is this true?

No.
Here's a short example:
#include <iostream>

class Foo {
public:
    int* ip; // Do we get default initialization to "nullptr" ?? ...
    Foo() = default;
};

int main()
{
    Foo Bar;
    std::cout << Bar.ip << std::endl; // ... print the "ip" pointer to see!
    return 0;
}

The output when building with clang-cl and running on Windows 10 is (but the actual value varies):
00000272B7D941D0

When compiling with MSVC, the following message is given:

warning C4700: uninitialized local variable 'Bar' used

Of course, some compilers may set such uninitialized memory to zero, and even when built with Clang or MSVC, as above, the initial value of the pointer may occasionally just happen to be zero. However, the warning from MSVC should be taken seriously. Furthermore, the static analyser that clang-cl uses gives a more specific warning:
std::cout << Bar.ip << std::endl;
^
warning GDEC5F24A: 1st function call argument is an uninitialized value [clang-analyzer-core.CallAndMessage]

… is there any way I can tell my compiler not to do this
(using some compiler flag)?

Probably not – but you can enable all compiler warnings, which will show you cases where you have such behaviour.

A: Pointers are not initialized when they are instantiated. Unless a value is assigned, a pointer will point to some indeterminate value (garbage address) by default. Some compilers will assign nullptr for pointers but that's not standard so don't count on it. Always initialize raw pointers and check against null before using them.
Moreover, structs and classes are interchangeable. Of course, a struct default visibility for its members is public while class attributes are private.


text:
Q: Android Studio Rendering Problems : Top Bar Missing I am new to android development and was developing an overflow menu. For that I had to change the theme of my app so that the action bar that contains the overflow menu was visible.
But android studio is not rendering any of the themes with the action bar.
I searched the internet for solutions and found one on stackoverflow that said I had to update my res/values/styles.xml file. I updated the tag named AppTheme, but it didn't solve my problem.
I tried to invalidate cache and restart but still not solved. I also tried to clean the project and rebuild it. Nothing worked.
I am attaching a screenshot of the errors.
Please Help.

Here is my styles.xml file:
 <resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
    </style>

    <style name="AppTheme.NoActionBar">
        <item name="windowActionBar">false</item>
        <item name="windowNoTitle">true</item>
    </style>

    <style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />

    <style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />

</resources>

AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.naveenjain.test3">

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name"
            android:theme="@style/AppTheme.NoActionBar">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

A: According to issue: You need to use a Theme.AppCompat theme (or descendant) with this activity
 you need to follow these steps:

The reason you are having this problem is because the activity you are
  trying to apply the dialog theme to is extending ActionBarActivity
  which requires the AppCompat theme to be applied.
Change the Java inheritance from ActionBarActivity to Activity and
  leave the dialog theme in the manifest as it is.

Check link above for more solutions
Hope it help


text:
Q: Bootstrap Carousel and Responsive Questions on Test Website In the course I am doing I have to create an example index page based on BootStrap framework.
This is all new to me and uploaded my page to GitHubPages:
https://github.com/matiashuarta/clase-bootstrap-75
https://matiashuarta.github.io/clase-bootstrap-75/#
I found BootStrap extremely efficient to create quick websites and make them responsive automatically, however, I am struggling with two specific sections in the responsive side.
The div in the main section that contains the profile pictures and descriptions, all three are shown horizontally on desktop and transform into columns when mobile, which is what I expect, but is there anyway to make that content a little bit smaller on width and height? I found that they take too much space in my phone. Also I find it extremely difficult to edit classes that are already pre-made in the framework.
The second problem I am facing is regarding the image carousel, all three images are set in the carousel as background images because I want to put a text on top and a button. Is there any guidance I can get to get this done through bootstrap?
Any other info you need? Hopefully with GitHub links you can get access to the code


text:
Q: Yii - Saving data back to Many-to-Many Relation database, from a dropdownlist with multiple-selection (Please pardon my poor English.)
I am having 3 tables, say Blog, User and user_blog.
Blog
CREATE TABLE `Blog` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `title` varchar(64) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB;

User
CREATE TABLE `User` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(256) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB;

user_blog
CREATE TABLE IF NOT EXISTS `user_blog` (
  `user_id` int(11) NOT NULL,
  `blog_id` int(11) NOT NULL,
  PRIMARY KEY (`user_id`,`blog_id`)
) ENGINE=InnoDB;

and i have declared their relations in the respective AR models.
Blog.php
public function relations() {
   return array(
      'users' => array(self::MANY_MANY, 'User', 'user_blog(blog_id, user_id)'),
   );
}

User.php
public function relations() {
   return array(
      'blogs' => array(self::MANY_MANY, 'Blog', 'user_blog(user_id, blog_id)'),
   );
}

And now, I have in my view the following codes:
<?php
   $data = CHtml::listData(User::model()->findAll(), "id", "name");
   echo $form->dropDownList($blog,'users', $data, array('multiple'=>'multiple', 'size' => '5'));
?>

With the above code, a dropdownlist with multiple selection is successfully created, and the data from the database are successfully retrieved and the items that are supposed to be selected are successfully highlighted.
But here comes the problem. I have no idea how to implement the saving/updating function. No matter what options I have selected, the results are not saved back to the database.
Could anyone please help?
Thank you in advance.

A: You should use CRUD generator or do it yourself like this:
Controller:
public function actionUpdate($id)
{
   $model = $this->loadModel($id, 'User');

   if(isset($_POST['User']))
   {
      $model->setAttributes($_POST['Message']);
      if($model->validate())
      {
         if($model->save()) {
            //do something here, eg. view updated record
         }
      }
   }

   $this->render('update',array('model'=>$model));
}

view/update.php
<?php $form = $this->beginWidget('GxActiveForm', array(
    'id' => 'user-form',
));
?>
<?php echo $form->errorSummary($model); ?>

        <?php echo $form->labelEx($model,'username'); ?>
        <?php echo $form->textField($model, 'username', array('maxlength' => 32)); ?>
        <?php echo $form->error($model,'username'); ?>

...
...

        <?php echo $form->labelEx($model,'users'); ?>
<?php
   $data = CHtml::listData(User::model()->findAll(), "id", "name");
   echo $form->dropDownList($blog,'users', $data, array('multiple'=>'multiple', 'size' => '5'));
?>
<?php echo $form->error($model,'users'); ?>
...
...
<?php
echo GxHtml::submitButton(Yii::t('app', 'Save'));
?>

P.s read this: http://www.yiiframework.com/doc/guide/1.1/en/form.overview


text:
Q: Graphing Polar Functions with UIBezierPath Is it possible to graph a polar function with UIBezierPath?  More than just circles, I'm talking about cardioids, limacons, lemniscates, etc.  Basically I have a single UIView, and want to draw the shape in the view.

A: There are no built in methods for shapes like that, but you can always approximate them with a series of very short straight lines. I've had reason to approximate a circle this way, and a circle with ~100 straight lines looks identical to a circle drawn with ovalInRect. It was easiest when doing this, to create the points in polar coordinates first, then convert those in a loop to rectangular coordinates before passing the points array to a method where I add the lines to a bezier path.

A: Here's my swift helper function (fully commented) that generates the (x,y) coordinates in a given CGRect from a polar coordinate function.
func cartesianCoordsForPolarFunc(frame: CGRect, thetaCoefficient:Double, thetaCoefficientDenominator:Double, cosScalar:Double, iPrecision:Double) -> Array<CGPoint> {

    // Frame: The frame in which to fit this curve.
    // thetaCoefficient: The number to scale theta by in the cos.
    // thetaCoefficientDenominator: The denominator of the thetaCoefficient
    // cosScalar: The number to multiply the cos by.
    // iPrecision: The step for continuity. 0 < iPrecision <= 2.pi. Defaults to 0.1

    // Clean inputs
    var precision:Double = 0.1 // Default precision
    if iPrecision != 0 {// Can't be 0.
        precision = iPrecision
    }

    // This is ther polar function
    // var theta: Double = 0 //  0 <= theta <= 2pi
    // let r = cosScalar * cos(thetaCoefficient * theta)

    var points:Array<CGPoint> = [] // We store the points here
    for theta in stride(from: 0, to: 2*Double.pi * thetaCoefficientDenominator, by: precision) { // Try to recreate continuity
        let x = cosScalar * cos(thetaCoefficient * theta) * cos(theta) // Convert to cartesian
        let y = cosScalar * cos(thetaCoefficient * theta) * sin(theta) // Convert to cartesian

        let scaled_x = (Double(frame.width) - 0)/(cosScalar*2)*(x-cosScalar)+Double(frame.width) // Scale to the frame
        let scaled_y = (Double(frame.height) - 0)/(cosScalar*2)*(y-cosScalar)+Double(frame.height) // Scale to the frame

        points.append(CGPoint(x: scaled_x, y:scaled_y)) // Add the result
    }

    return points
}

Given those points here's an example of how you would draw a UIBezierPath. In my example, this is in a custom UIView function I would call UIPolarCurveView.
let flowerPath = UIBezierPath() // Declare my path

// Custom Polar scalars
let k: Double = 9/4
let length = 50

// Draw path
let points = cartesianCoordsForPolarFunc(frame: frame, thetaCoefficient: k, thetaCoefficientDenominator:4 cosScalar: length, iPrecision: 0.01)      flowerPath.move(to: points[0])
for i in 2...points.count {
       flowerPath.addLine(to: points[i-1])
}

flowerPath.close()

Here's the result:

PS: If you plan on having multiple graphs in the same frame, make sure to modify the scaling addition by making the second cosScalar the largest of the cosScalars used.You can do this by adding an argument to the function in the example.


text:
Q: MacOS - Toggle wifi when screen unlocked I think this will need a combination of AppleScript and Automator, but I don't have much experience in either and Google has been no help. This is basically what I want to do:
WHEN screen unlocked (from screensaver, not sleep) THEN
   IF wifi is NOT connected THEN
      Turn wifi off
      Turn wifi back on again
   END IF
END

Suggestions?


text:
Q: requestBody not displaying subtypes with arrays within a $ref component but shows correctly in response body I've been struggling with an issue in an openapi 3.0.1 spec json document I've been working on.
The issue I'm seeing in the online swagger editor (editor.swagger.io) is very strange where the Request body Example Value section of a POST does not show the "layers", which is an array defined within my MixBase schema component, based on the MixLayer schema component.  The MixLayer schema component has an array of MixLayerComponent schema components.
However, if I include a $ref to the MixBase schema in the responses section, all the elements are shown correctly.
Request body Example Value section that is missing the 'layers':
{
  "mixId": "4f8b533f-7449-4056-92ff-11b1de94d656",
  "mixDescription": "SES5M",
  "mixScaleName": "MyScale",
  "mixRoom": "MixingRoomABC",
  "mixProgramId": "ABC-123-ProgramId",
  "mixDateTime": "2018-06-07T12:51:25.077Z",
  "mixState": "Paused",
  "mixNumber": "131",
  "mixedByUserName": "john.smith@example.com",
  "mixedByFirstName": "John",
  "mixedByLastName": "Smith"
}

Responses Example Value section returning the correct list of elements including 'layers':
{
  "mixId": "4f8b533f-7449-4056-92ff-11b1de94d656",
  "mixDescription": "SES5M",
  "mixScaleName": "MyScale",
  "mixRoom": "MixingRoomABC",
  "mixProgramId": "ABC-123-ProgramId",
  "mixDateTime": "2018-06-07T12:51:25.077Z",
  "mixState": "Paused",
  "mixNumber": "131",
  "mixedByUserName": "john.smith@example.com",
  "mixedByFirstName": "John",
  "mixedByLastName": "Smith",
  "layers": [                   -- this represents the MixLayer component
     {
      "unitOfMeasure": "g",
      "Components": [           -- this represents the MixLayerComponent correctly
        {
          "code": "800C",
          "description": "800C",
          "poured": 204.5,
          "density": 1.041
        }
    ]
 }

]
}
My requestBody section is defined as: (doesn't show 'layers')
 requestBody:
    required: true
    description: Paint mix information to create
    content:
      application/json:
        schema:
          $ref: '#/components/schemas/MixBase'

My responses section is defined as: (and this displays correctly in the Response examples section)
responses:
    '200':
      description: Success
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/MixBase'

Here is the definition of the 'layers' within the MixBase schema component (which is the last element in the MixBase definition which is why additionalProperties is set to false): (The formatting might not be correct in stack overflow but the swagger editor doesn't complain so I don't believe the issue is linked to formatting)
layers:
      description: Layer related information for components of the mix
      type: array
      items:
        $ref: '#/components/schemas/MixLayer'
      readOnly: true
  additionalProperties: false

Here is the definition of the MixLayer:
MixLayer:
  required:
    - Components
  type: object
  properties:
    unitOfMeasure:
      description: Unit of volume for the components of the layer
      maxLength: 10
      type: string
      nullable: true
      example: g
    Components:
      description: The components that make up the layer in the mix
      type: array
      items:
        $ref: '#/components/schemas/MixLayerComponent'
      readOnly: true
  additionalProperties: false

Here is the definition of the MixLayerComponent:
MixLayerComponent:
  required:
    - code
    - density
    - poured
  type: object
  properties:
    code:
      description: The code associated with the mix component of the layer
      maxLength: 25
      minLength: 1
      type: string
      example: 800C
    description:
      description: The description of the mix component of the layer
      maxLength: 120
      type: string
      nullable: true
      example: 800C
    poured:
      description: >-
        The quantity, expressed in the unit of measurement, consumed for the
        mix component
      type: number
      format: double
      example: 204.5
    density:
      description: The density associated with the mix component of the layer
      type: number
      format: double
      example: 1.041
  additionalProperties: false

I thought that the "Components" element in the MixLayer component schema might be a reserved keyword in openapi so I changed the references to something else and it still has the same issue.
I thought this issue might be with the online swagger editor (editor.swagger.io) but the same thing occurs in Postman.  I also tried browsers Chrome, Edge, and Firefox and they all
have the same issue.  I have also tried an XML content type in addition to the JSON I would like to use but still the same issue.
I don't access to post my openapi.json file on stack overflow but I hope this provides enough information.
Any insights anyone has for me to continue a line of investigation would be greatly appreciated.
Thank you for your time in advance,
Dave

A: layers is defined as a read-only property (readOnly: true) - that's why it doesn't appear in the request body example.


text:
Q: Add validations on dynamically created form with Javascript I created a form dynamically with javascript. Now I have to add validations on the form (only mandatory validations) on click of the button which is also dynamically created. Now the issue I am facing is that whenever I try to add addEventListener on the button exactly after creating it, it is giving me error.
        (
        function init() {
    console.log("div created");

    // create a new div element
    var newDiv = document.createElement("div");
    newDiv.id = "registration_form";

    var createForm = document.createElement("form");
    newDiv.appendChild(createForm);

    var heading = document.createElement("h2");
    heading.innerHTML = "Registration Form";
    createForm.appendChild(heading);

    var linebreak = document.createElement('br');
    createForm.appendChild(linebreak);

    createElement(createForm, 'label','','','Name: ');
    createElement(createForm, 'text', 'dname', '','');
    createSpanTag(createForm,'nameError');
    breakTag(createForm);breakTag(createForm);
    createElement(createForm, 'label','','','Email: ');
    createElement(createForm, 'email', 'email', '','');
    createSpanTag(createForm,'emailError');
    createElement(createForm, 'button','Validate','Validate','');
    document.getElementsByTagName('button')[0].addEventListener('click',validate());
    document.getElementsByTagName('body')[0].appendChild(newDiv);

}
)();

function createElement(formElement,type,name,value, placeholder) {
if(type=='label'){
    var element=document.createElement(type);
    if(name!='' && value!=''){
        element.setAttribute('name',name);
        element.setAttribute('value',value);
    }
    element.innerHTML=placeholder;
    formElement.appendChild(element);
} else {
    var element=document.createElement('input');
    if(type!=''){
        element.setAttribute('type',type);
    }
    if(name!=''){
        element.setAttribute('name',name);
    }
    if(value!=''){
        element.setAttribute('value',value);
    }
    if(placeholder!=''){
        element.setAttribute('placeholder',placeholder);
    }
    formElement.appendChild(element);
}

}

function breakTag(createForm){
createForm.appendChild(document.createElement('br'));
}

function validate(){

}
function createSpanTag(createForm, id){
    var element=document.createElement('span');
    element.setAttribute('id',id);
    createForm.appendChild(element);
}

A: The second argument of addEventListener needs to be a function.
Change ...
document.getElementsByTagName('button')[0].addEventListener('click',validate())

to ...
document.getElementsByTagName('button')[0].addEventListener('click',validate);

A: Since your tag name is input, not button. So use input in parameter of the function getElementsByTagName() and then loop through all nodes and find node with type = button.
Try change this line:
document.getElementsByTagName('button')[0].addEventListener('click',validate());

to:
    var nodeList = document.getElementsByTagName("input");

    for (var i = 0; i < nodeList.length; i++)
    {
       if (nodeList[i].getAttribute("type") == "button") {
       {
          nodeList[i].addEventListener('click',validate);
       }
    }


text:
Q: Which subset of $\mathbb{R}$ is not on the Borel $\sigma$-algebra of $\mathbb{R}$? When I learned this $\sigma$-algebra, which is the smallest $\sigma$-algebra that contains all the open intervals of $\mathbb{R}$ (let's denote it by $\mathcal{B}$), I've got the feeling that no subset of $\mathbb{R}$. Because:

*

*Of course $\emptyset \in \mathcal{B}$ and $\mathbb{R} \in \mathcal{B}$

*Also obvious that $(a,b) \in \mathcal{B}$, with $a<b$.

*Since $[a,b] = \displaystyle\cap_{n=1}^{\infty} (a - \frac{1}{n}, b + \frac{1}{n})$, then $[a,b] \in \mathcal{B}$

*$(-\infty,x], (x, \infty), (-\infty,x), [x, \infty) \in \mathcal{B}$

*In the particular case of (3), if x=y, then $\{x\} \in \mathcal{B}$, hence all $\mathbb{N},\mathbb{Z},\mathbb{Q},\mathbb{Q}^c \in \mathcal{B}$.

So, which subset $X$ of $\mathbb{R}$ is not on $\mathcal{B}$?
I appreciate the attention.

A: Without the axiom of choice, it is consistent that all sets of real numbers are Borel (and besides, many definitions which usually coincide and are taken to define Borel sets may in fact describe different families).
This means that you cannot describe any Borel set without (maybe implicitly) invoking some choice principle.
Obviously, any non-measurable set is necessarily non-Borel (but the converse is certainly not true: any uncountable set contains a non-Borel subset). This includes e.g. the Vitali sets mentioned in the comments, as well as even more exotic objects like the Bernstein sets (a set which intersects, but does not contain any uncountable closed set).
As mentioned in the comments, there are only $2^{\aleph_0}$ Borel subsets of the reals, compared to $2^{2^{\aleph_0}}>2^{\aleph_0}$ subsets in total. This shows that in some sense, "most" sets are not Borel. Furthermore, one can show that Borel sets fail some desirable closure properties: for example, the projection of a Borel set need not be Borel. This is the motivation for the introduction of analytic and projective sets (the smallest class of sets containing the open sets, closed under countable unions, continuous images and complements) --- there are still only $2^{\aleph_0}$ many of those, but I think it is not a very controversial thing to say that "reasonable" sets are projective.
Furthermore, one can show that every Borel set is either countable or of cardinality $2^{\aleph_0}$ (in fact, contains a subset homeomorphic to the Cantor set). So if the CH fails, you can just take any set of cardinality strictly between $\aleph_0$ and $2^{\aleph_0}$, and this set will be non-Borel.


text:
Q: R fscaret package error incorrect number of dimensions Having some problems with following the example given in the link
https://cran.r-project.org/web/packages/fscaret/fscaret.pdf
in particular the code
myFirstRES <- fscaret(dataset.train, dataset.test, installReqPckg=FALSE,
preprocessData=FALSE, with.labels=TRUE, classPred=FALSE,
regPred=TRUE, skel_outfile=NULL,
impCalcMet="RMSE&MSE", myTimeLimit=5,
Used.funcRegPred=c("lm","pls","pcr"), Used.funcClassPred=NULL,
no.cores=myCores, method="boot", returnResamp="all",
supress.output=TRUE,saveModel=FALSE)

gives the error: Error in checkForRemoteErrors(val) :
  one node produced an error: incorrect number of dimensions
Any ideas what could be the issue, since I followed the example accordingly?


text:
Q: Why isn't MSVC allocating a 32 byte shadow space in the generated assembly code? I tried to see how MSVC allocates its 32 bytes of shadow space, but it seems like it only allocates 8 bytes shadow space.
// Test.c
int main() {int var1 = 1;}

The program above results in the following .asm file:
var1$ = 0

main    PROC
; Test.c
    sub rsp, 24                    ; allocates 24 bytes
    mov DWORD PTR var1$[rsp], 1
    xor eax, eax
    add rsp, 24
    ret 0
main    ENDP

It only allocates 24 bytes. It allocates the same amount when I declare 4 variables, and since each variable is 4 bytes it must mean that 16 bytes of the 24 bytes are used for the declared variables, leaving 8 bytes for the shadow space.
Only when declaring 5 variables does it then allocate 40 bytes of shadow space. Why does it only allocate 8 bytes of shadow space?
I compiled the program using the command CL Test.c /Fa

A: Subtracting 24 from RSP here doesn't have anything to do with shadow space. Shadow space only applies if main were to call some other 64-bit Microsoft ABI compliant function. Your main function is a leaf function (it doesn't call anything else) so it isn't required to allocate extra space for the shadow space. If you modified main to call something in the C/C++ library or the WinAPI you'd find extra space would be added for the shadow space to make such a call.
Given that your function is dealing with 32-bit values (and no arrays) and doesn't call anything else I see no reason why it needs to align to a 16 byte boundary or add the extra padding, but that is what it appears to be doing. The return address on the stack misaligns the stack by 8. Subtracting 24 aligns it on a 16 byte boundary with padding after the variables.
This is likely a result of code generation inefficiencies when not compiling with any optimizations (like /O1, /O2 etc) or the compiler padding local variable space to a preferred amount. In theory it didn't have to allocate any stack space in this case. It could have reused the shadow space above the return address that would have been allocated for the main function by the C/C++ startup code.
Note: With optimizations the code would be eliminated altogether unless you made var1 a volatile variable. The compiler should recognize the code you wrote doesn't do anything besides return back to the caller.

The following example calls ExitProcessto show shadow space is added; reuse of the shadow space allocated by the C/C++ startup code that called main for local variables; and using some stack space for the variable it couldn't fit in the shadow space. As a WinAPI called ExitProcess needs to have the 32 bytes of shadow space allocated before making a call to it. If you remove it from this example the compiler will not allocate extra space for it.
test.c
// Test.c

// Get prototype for ExitProcess
#include <windows.h>

int main()
{
    volatile int var1 = 1;
    volatile int var2 = 2;
    volatile int var3 = 3;
    volatile int var4 = 4;
    volatile int var5 = 5;

    // Since this is a WinAPI call it needs shadow space allocated
    ExitProcess(var1+var2+var3+var4+var5);

    // We won't get this far
    return 0;
}

If you compile this with /O2 optimizations for maximum speed using CL Test.c /Fa /O2 you would probably see something similar to:
var1$ = 32
var5$ = 64
var4$ = 72
var3$ = 80
var2$ = 88

main    PROC
    sub rsp, 56                 ; 00000038H
    mov DWORD PTR var1$[rsp], 1
    mov DWORD PTR var2$[rsp], 2
    mov DWORD PTR var3$[rsp], 3
    mov DWORD PTR var4$[rsp], 4
    mov DWORD PTR var5$[rsp], 5

    mov edx, DWORD PTR var5$[rsp]
    mov eax, DWORD PTR var4$[rsp]
    add edx, eax
    mov ecx, DWORD PTR var3$[rsp]
    add ecx, edx
    mov edx, DWORD PTR var2$[rsp]
    add edx, ecx
    mov ecx, DWORD PTR var1$[rsp]
    add ecx, edx

    call    QWORD PTR __imp_ExitProcess
    int 3
main    ENDP

var1 has an offset of 32 from RSP because the shadow space is the first 32 bytes starting at RSP to make the call to ExitProcess. The other variables var2, var3, var4 and var5 all start at an offset >= 64. The compiler generated an adjustment of 56 to RSP. The return address is at RSP+56 and main has shadow space at RSP+64 to RSP+96, thus var2 to var5 were placed in the shadow space allocated for main.


text:
Q: Do there exist nontrivial quotient groups of arbitrary finite order? For any $n\in \mathbb{N}$, does there exist a group $G$ and a nontrivial normal subgroup $N$ of $G$ such that $\left\vert G/N\right\vert =n$?

A: In a direct product $G_1\times G_2$ of two groups the subset
$\{(g,e)\mid g\in G_1\}$ is always a normal subgroup (isomorphic to $G_1$). Hence quotienting by it gives $G_2$. So any group (whatever be its order) can be obtained as  $G/N$ for suitable $G$ and a suitable normal subgroup $N$ there.


text:
Q: PureVPN connects but very slow So I've a PureVPN connection working great in Windows. But when I try to use it in latest Ubuntu 14.04.1 LTS, it

*

*Using PPTP, connects for a minute, offers no internet service, and then disconnects

*Using OpenVPN, connects but is EXTREMELY slow

*Using SSTP, connects but is EXTREMELY slow

I tried contacting PureVPN support and all they offered me to toggle different settings, switch servers, try TCP or UDP in OpenVPN and see if things get better; which all sound like not-so-great tech support of a VPN company. They seemed like just trying to get through the chat session.
I've tried numerous solutions found online but none worked. I've tried command line configuration and GUI cofiguration, none worked. The only thing holding me back from completely switching to Ubuntu is this VPN issue.
I hope it'll get it resolved using stackexchange's amazing communities help :) I know this is not an active site like stackoverflow but I'm still asking (which shows the level of desperation I'm having LOL)
P.S. I'm not a regular Linux user (trying to switch from windows)

A: I use PureVPN too. Just don`t touch MTU-parameter or smth...
I recommend you to use OpenVPN.
And here is my solution:
For some reason firewall is filtering your TUN/TAP interface by default even without any rules.
So you need to exclude your virtual TUN or TAP interface from Linux firewall.
You can exclude your TUN/TAP just by running these commands in terminal -
sudo iptables -A INPUT -i tun0 -j ACCEPT
sudo iptables -A FORWARD -i tun0 -j ACCEPT
sudo iptables -A INPUT -i tap0 -j ACCEPT
sudo iptables -A FORWARD -i tap0 -j ACCEPT

Or by adding these rules in Ubuntu (g)ufw (best practice).
Edit this file -
sudo gedit /etc/ufw/before.rules

And add this lines at the bottom of the file before line with word COMMIT
 # allow all on loopback (!check if you already have this!)
-A ufw-before-input -i lo -j ACCEPT
-A ufw-before-output -o lo -j ACCEPT

 # allow all traffic via our OpenVPN TUN/TAP interfaces
-A ufw-before-input -i tun0 -j ACCEPT
-A ufw-before-input -i tap0 -j ACCEPT
-A ufw-before-forward -i tun0 -j ACCEPT
-A ufw-before-forward -i tap0 -j ACCEPT
-A ufw-before-forward -o tun0 -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
-A ufw-before-forward -o tap0 -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
-A ufw-before-forward -o tun0 -m state --state RELATED,ESTABLISHED -j ACCEPT
-A ufw-before-forward -o tap0 -m state --state RELATED,ESTABLISHED -j ACCEPT

Save and exit.
And last thing - we need to enable IP-forwarding feature.
Open in terminal file sysctl.conf -
sudo gedit /etc/sysctl.conf

And add this line in the bottom -
# Enable IP forwarding
net.ipv4.ip_forward = 1

Save and exit.
After that apply the changes by running that command in terminal -
sudo sysctl -p

That`s it!
Now reboot, connect to your VPN-server and check youtube or P2P-sharing.

A: If you can't laod your email and/or web pages get stuck when you're connected to VPN server, that usually means you have an MTU issue. Each internet connection has a property called the Maximum Transmission Unit, or MTU. The MTU specifies the size of the largest chunk of data that can flow over that connection.
Most of the time the operating systems automatically detect the MTU of the connection and adjust themselves appropriately. However, some locations have routers that confuse the MTU discovery algorithms. To the best of my knowledge, Ubuntu has fixed MTU settings for VPN connections, which causes problems with some routers.
Here is the easy way to adjust the mtu size manually:
sudo nano /etc/ppp/ip-up

Add this line to the end of the file:
ifconfig $1 mtu 1492

Hope it could solve the problem

A: I add a similar problem with Astrill VPN.

*

*Very slow login (at least 10mn)

*Impossible to share VPN connection with StealthVPN

Then it turns out that few days ago i used to download a script AdZHosts to block advertisements which i add to my /etc/hosts file and it was this script which was blocking all the machines of my LAN using the VPN and slowing down the login process as well.


text:
Q: Change input text to select options & vice versa I have two buttons. On first buttons click, I needs to change input text type to select box & on second buttons click, change the select box to input text type through Javascript. Thanks.

A: Thanks a lot @JoshMein, @Bergi, @Rocket for your time & suggestions. It helped me a lot.  I also tried in diff way as follow.

function changeToText() {
  var obj = document.getElementById('disease1CurrentObject');
  document.getElementById('divDisease1Current').removeChild(document.getElementById(obj));
  var element = document.createElement('input');
  element.setAttribute('type', 'text');
  element.setAttribute('value', 'myVal');
  element.setAttribute('id', 'myId');
  document.getElementById('divDisease1Current').appendChild(element);
}
function changeToSelect() {
  var obj = document.getElementById('disease1CurrentObject');
  document.getElementById('divDisease1Current').removeChild(obj));
  var element = document.createElement('select');
  element.setAttribute('type', 'text');
  element.setAttribute('value', 'myVal');
  element.setAttribute('id', 'myId');
  document.getElementById('divDisease1Current').appendChild(element);
}

& 1 more, setAttribute() is not supported by IE version less than 8 or 8.


text:
Q: Self-modifying file: call versus import Disclaimer: this is about weird language behavior in a crazy edge case. I'm using it to ask a bigger question about python and memory/disk read writes. How does dynamically editing a file and subsequently calling differ from importing the file and then  calling? Is importing the same file different than exporting external modules with respect to loading from memory/ loading from disk? What conditions trigger reloading a function from disk.
I am trying to understand the way that python functions are loaded into memory (and when they are reread from disk). I wrote a simple script (temp.py) that modifies itself in a call to modify_this_function, it writes in a print line. Nothing crazy, predictable behavior, adds a print statement when called.
import dis

def modify_this_function():
    f = open("temp.py", "r")
    contents = f.readlines()
    f.close()

    contents.insert(3, '\tprint("hello!")\n')

    f = open("temp.py", "w")
    contents = "".join(contents)
    f.write(contents)
    f.close()

modify_this_function()
print(dis.dis(modify_this_function))
modify_this_function()

This call doesn't do anything particularly interesting (though it does modify the file on reload, adds two print statements). The output of the call to dis.dis reflects the original function definition.
  4           0 LOAD_GLOBAL              0 (open)
              3 LOAD_CONST               1 ('temp.py')
              6 LOAD_CONST               2 ('r')
              9 CALL_FUNCTION            2
             12 STORE_FAST               0 (f)

  5          15 LOAD_FAST                0 (f)
             18 LOAD_ATTR                1 (readlines)
             21 CALL_FUNCTION            0
             24 STORE_FAST               1 (contents)

  6          27 LOAD_FAST                0 (f)
             30 LOAD_ATTR                2 (close)
             33 CALL_FUNCTION            0
             36 POP_TOP

  8          37 LOAD_FAST                1 (contents)
             40 LOAD_ATTR                3 (insert)
             43 LOAD_CONST               3 (3)
             46 LOAD_CONST               4 ('\tprint("hello!")\n')
             49 CALL_FUNCTION            2
             52 POP_TOP

 10          53 LOAD_GLOBAL              0 (open)
             56 LOAD_CONST               1 ('temp.py')
             59 LOAD_CONST               5 ('w')
             62 CALL_FUNCTION            2
             65 STORE_FAST               0 (f)

 11          68 LOAD_CONST               6 ('')
             71 LOAD_ATTR                4 (join)
             74 LOAD_FAST                1 (contents)
             77 CALL_FUNCTION            1
             80 STORE_FAST               1 (contents)

 12          83 LOAD_FAST                0 (f)
             86 LOAD_ATTR                5 (write)
             89 LOAD_FAST                1 (contents)
             92 CALL_FUNCTION            1
             95 POP_TOP

 13          96 LOAD_FAST                0 (f)
             99 LOAD_ATTR                2 (close)
            102 CALL_FUNCTION            0
            105 POP_TOP
            106 LOAD_CONST               0 (None)
            109 RETURN_VALUE
None

This seems to indicate that the function was in memory, not reloaded from disk. Is that correct?
import dis

def modify_this_function():
    f = open("temp.py", "r")
    contents = f.readlines()
    f.close()

    contents.insert(3, '\tprint("hello!")\n')

    f = open("temp.py", "w")
    contents = "".join(contents)
    f.write(contents)
    f.close()

modify_this_function()
print(dis.dis(modify_this_function))
#modify_this_function()
from temp import modify_this_function

This function call is more interesting.
  4           0 LOAD_GLOBAL              0 (open)
              3 LOAD_CONST               1 ('temp.py')
              6 LOAD_CONST               2 ('r')
              9 CALL_FUNCTION            2
             12 STORE_FAST               0 (f)

  5          15 LOAD_FAST                0 (f)
             18 LOAD_ATTR                1 (readlines)
             21 CALL_FUNCTION            0
             24 STORE_FAST               1 (contents)

  6          27 LOAD_FAST                0 (f)
             30 LOAD_ATTR                2 (close)
             33 CALL_FUNCTION            0
             36 POP_TOP

  8          37 LOAD_FAST                1 (contents)
             40 LOAD_ATTR                3 (insert)
             43 LOAD_CONST               3 (3)
             46 LOAD_CONST               4 ('\tprint("hello!")\n')
             49 CALL_FUNCTION            2
             52 POP_TOP

 10          53 LOAD_GLOBAL              0 (open)
             56 LOAD_CONST               1 ('temp.py')
             59 LOAD_CONST               5 ('w')
             62 CALL_FUNCTION            2
             65 STORE_FAST               0 (f)

 11          68 LOAD_CONST               6 ('')
             71 LOAD_ATTR                4 (join)
             74 LOAD_FAST                1 (contents)
             77 CALL_FUNCTION            1
             80 STORE_FAST               1 (contents)

 12          83 LOAD_FAST                0 (f)
             86 LOAD_ATTR                5 (write)
             89 LOAD_FAST                1 (contents)
             92 CALL_FUNCTION            1
             95 POP_TOP

 13          96 LOAD_FAST                0 (f)
             99 LOAD_ATTR                2 (close)
            102 CALL_FUNCTION            0
            105 POP_TOP
            106 LOAD_CONST               0 (None)
            109 RETURN_VALUE
None
hello!
  4           0 LOAD_CONST               1 ('hello!')
              3 PRINT_ITEM
              4 PRINT_NEWLINE

  5           5 LOAD_GLOBAL              0 (open)
              8 LOAD_CONST               2 ('temp.py')
             11 LOAD_CONST               3 ('r')
             14 CALL_FUNCTION            2
             17 STORE_FAST               0 (f)

  6          20 LOAD_FAST                0 (f)
             23 LOAD_ATTR                1 (readlines)
             26 CALL_FUNCTION            0
             29 STORE_FAST               1 (contents)

  7          32 LOAD_FAST                0 (f)
             35 LOAD_ATTR                2 (close)
             38 CALL_FUNCTION            0
             41 POP_TOP

  9          42 LOAD_FAST                1 (contents)
             45 LOAD_ATTR                3 (insert)
             48 LOAD_CONST               4 (3)
             51 LOAD_CONST               5 ('\tprint("hello!")\n')
             54 CALL_FUNCTION            2
             57 POP_TOP

 11          58 LOAD_GLOBAL              0 (open)
             61 LOAD_CONST               2 ('temp.py')
             64 LOAD_CONST               6 ('w')
             67 CALL_FUNCTION            2
             70 STORE_FAST               0 (f)

 12          73 LOAD_CONST               7 ('')
             76 LOAD_ATTR                4 (join)
             79 LOAD_FAST                1 (contents)
             82 CALL_FUNCTION            1
             85 STORE_FAST               1 (contents)

 13          88 LOAD_FAST                0 (f)
             91 LOAD_ATTR                5 (write)
             94 LOAD_FAST                1 (contents)
             97 CALL_FUNCTION            1
            100 POP_TOP

 14         101 LOAD_FAST                0 (f)
            104 LOAD_ATTR                2 (close)
            107 CALL_FUNCTION            0
            110 POP_TOP
            111 LOAD_CONST               0 (None)
            114 RETURN_VALUE
None

Here, it seems like the print is called and it appears in the disassembler output. So does this indicate that the import triggered a reread from disk? A reread that wasn't initiated by simply calling the function. Is my intuition here correct?

A: You are loading your module twice. That's not normally possible, since Python caches module objects, but it can happen. This time it occurs because the first time you're loading it as the main module, named __main__. The second time you load it as its normal name temp. The second time, you'll see the results of the modifications the module made to its own file prior to the import that loaded again.
After a module is imported, changes to the file it was loaded from won't be reflected in the module's code, which was all compiled at the time the module was loaded. Such changes might confuse some debugging tools into reading the wrong version of the source and misreporting error locations and other details in some situations, but they won't have any effect on how the code runs.
You can also use the reload function (from importlib in modern versions of Python, a builtin in Python 2) to reload a module on demand. The contents of the new version of the module will overwrite the original version. Note though that any external references to objects from the old version of the module will remain pointing to the same old objects.