text:
Q: Trigger Button click without mouse My problem is that I want to implent Key-Shortcuts in my Silverlight application and there is a difference between calling Button_Save with Mouse-Click or manuel call in own function.
By manuel call, the silverlight function has not the actual values in controls. Otherwise when I click the Button_Save with mouse (onClick).
Is there any chance to get the same to call the Button_Save event just like to click the button with mouse?
Thank's for help.
Patrik


text:
Q: Cauchy Sequences--is the floor function of a Cauchy sequence also a Cauchy sequence? Okay so say you have some Cauchy sequence (a_n). And c_n=[[a_n]], where [[x]] refers to the greatest integer less than or equal to x.
Is c_n also a Cauchy sequence?
This is what I've got so far, not much cause this is really stumping me:
+I know that a_n converges to some real number, say a.
+I was considering a_n=1-(1/n). That gives c_n={0,0,0,0,....}. Is a sequence of all one constant integer a Cauchy sequence?
+If I can't prove that c_n is a Cauchy sequence I need to show a counterexample.
+I can't figure out how to use the Cauchy sequence definition in this problem, not sure if that's the right way to go about it or not.
Thank you for your time!

A: HINT: Consider the sequence $\langle x_n:n\in\Bbb N\rangle$ defined by
$$x_n=\begin{cases}
0,&\text{if }n\text{ is even}\\
-\frac1n,&\text{if }n\text{ is odd}\;.
\end{cases}$$

redpajama_set_name: RedPajamaStackExchange


text:
Q: Scraping an Angular website with selenium and C# returns the angular script, not the rendered web page This seems to be by design as far as I can tell. Selenium can see the initially loaded HTML, but not the HTML after it's been massaged. I've tried IE, Chrome and PhantomJS and they all show the same behavior. So does the built-in Chrome debugger, until you inspect an element on the page, you can't query any of the rendered HTML.
I'm looking for any suggestions about how to scrape the web page. The only option I see right now is finding the chrome process, triggering the inspector, clicking inside, then running the Javascript. Needless to say, this sounds fragile.
I also haven't been able to find anything on capturing the Ajax calls from selenium so I can make them and capture the JSON. When tried copy / paste from the chrome network tab into selenium I got a missing application block message.
Does anyone have any other advice?
Since I can replicate the issue in the chrome debugger, I don't see posting code as useful. It looks like a design decision.
Ralph

A: Sadly, I wasn't able to do things in a straightforward way. Instead, I used Selenium to do the login and navigate to the page, then use windows API calls to click inside the window send ^a^c to copy the data and an absolute location to click on the button to go to the next page.
The site is set up so that ^a^c copies the raw data for this site. I don't know if that's standard for Angular or not.
Fragile, but it works.


text:
Q: Fastest way to save and load a large dictionary in Python I have a relatively large dictionary. How do I know the size? well when I save it using cPickle the size of the file will grow approx. 400Mb. cPickle  is supposed to be much faster than pickle but loading and saving this file just takes a lot of time. I have a Dual Core laptop 2.6 Ghz with 4GB RAM on a Linux machine. Does anyone have any suggestions for a faster saving and loading of dictionaries in python? thanks

A: Use the   protocol=2 option of cPickle. The default protocol (0) is much slower, and produces much larger files on disk.
If you just want to work with a larger dictionary than memory can hold, the shelve module is a good quick-and-dirty solution. It acts like an in-memory dict, but stores itself on disk rather than in memory. shelve is based on cPickle, so be sure to set your protocol to anything other than 0.
The advantages of a database like sqlite over cPickle will depend on your use case. How often will you write data? How many times do you expect to read each datum that you write? Will you ever want to perform a search of the data you write, or load it one piece at a time?
If you're doing write-once, read-many, and loading one piece at a time, by all means use a database. If you're doing write once, read once, cPickle (with any protocol other than the default protocol=0) will be hard to beat. If you just want a large, persistent dict, use shelve.

A: Sqlite
It might be worthwhile to store the data in a Sqlite database.  Although there will be some development overhead when refactoring your program to work with Sqlite, it also becomes much easier and performant to query the database.
You also get transactions, atomicity, serialization, compression, etc. for free.
Depending on what version of Python you're using, you might already have sqlite built-in.

A: I have tried this for many projects and concluded that shelve is faster than pickle in saving data. Both perform the same at loading data.
Shelve is in fact a dirty solution.
That is because you have to be very careful with it. If you do not close a shelve file after opening it, or due to any reason some interruption happens in your code when you're in the middle of opening and closing it, the shelve file has high chance of getting corrupted (resulting in frustrating KeyErrors); which is really annoying given that we who are using them are interested in them because of storing our LARGE dict files which clearly also took a long time to be constructed
And that is why shelve is a dirty solution... It's still faster though. So!

A: I know it's an old question but just as an update for those who still looking for an answer to this question:
The protocol argument has been updated in python 3 and now there are even faster and more efficient options (i.e. protocol=3 and protocol=4) which might not work under python 2.
You can read about it more in the reference.
In order to always use the best protocol supported by the python version you're using, you can simply use pickle.HIGHEST_PROTOCOL. The following example is taken from the reference:
import pickle
# ...
with open('data.pickle', 'wb') as f:
    # Pickle the 'data' dictionary using the highest protocol available.
    pickle.dump(data, f, pickle.HIGHEST_PROTOCOL)

A: You may test to  compress your dictionnary (with some restrictions see : this post) it will be efficient if the disk access is the bottleneck.

A: That is a lot of data...
What kind of contents has your dictionary? If it is only primitive or fixed datatypes, maybe a real database or a custom file-format is the better option?


text:
Q: Date Output error in Batch Script only on the 8th I current run the below script to get the current day minus 1 and the current month.  It works great for all days and month except for the 8th of every month and August of every year. I have to change the script to setting it manually for August. Does anyone know why and is there a fix.
SET m=%date:~4,2%
SET /A m -= 1

SET m=0%m%

REM ****** SET m=08 this was used because the date was not right ******

REM SET m=08

SET currMon=%date:~4,2%/%date:~10,4%

REM ****** SET PriorMon=12/2017 this was used for Year End because the date was not right ******

REM SET PriorMon=08/2018

SET PriorMon=%m:~-2%/%date:~10,4%

A: This is a hybrid vb/batch script. It is a proper way to get the date -1 or whatever amount of days you want:
@echo off
set day=-1
echo >"%temp%\%~n0.vbs" s=DateAdd("d",%day%,now) : d=weekday(s)
echo>>"%temp%\%~n0.vbs" WScript.Echo year(s)^& right(100+month(s),2)^& right(100+day(s),2)
for /f %%a in ('cscript /nologo "%temp%\%~n0.vbs"') do set "result=%%a"
del "%temp%\*%~n0.vbs"
set "yyyy=%result:~0,4%"
set "mm=%result:~4,2%"
set "dd=%result:~6,2%"
set "final=%dd%-%mm%-%yyyy%"
echo %final%

I simply echo the final result here which as far as today's date goes (for me as it is the 7th) should echo 06-09-2018
You can change the format of %final% as you please to suit your date..

A: Proper date calculatons in pure batch are possible but tedious.
Your approach relies on possibly unknown locale/user settings dependant date format.
From Win7 on Powershell is available as a tool:
On cmd line:
For /f "usebackq" %A in (`powershell -Nop -C "(Get-Date).AddDays(-1).ToString('MM\/yyyy')"`) Do Set Yesterday=%A

In a batch file:
For /f "usebackq" %%A in (`
    powershell -Nop -C "(Get-Date).AddDays(-1).ToString('MM\/yyyy')"
`) Do Set Yesterday=%%A
Echo Yesterday=%Yesterday%

Modify the format string to your liking:
dd   = day   2 places
MM   = month 2 places
yyyy = year  4 places

Other characters have to be escaped with a backslash.


text:
Q: Detecting errors generated by $wpdb->get_results() How do I detect errors when using $wpdb->get_results()?
For example:
$result = $wpdb->get_results("SELECT * FROM this is not a valid query");

The preceding code doesn't generate any exceptions or errors; it simply sets $result to an empty array.  How do we reliably detect errors generated by get_results()?

A: There is a class variable that stores the last error string - $wpdb->last_error. By the looks of the way $wpdb is coded, if the query succeeds, $wpdb->last_error will be an empty string, if it fails, it will be the error string returned by MySQL. So something like this would do the trick.
$result = $wpdb->get_results("SELECT * FROM this is not a valid query");
if ($wpdb->last_error) {
  echo 'You done bad! ' . $wpdb->last_error;
}

A: The best I can find is:
$wpdb->show_errors();
$result = $wpdb->get_results("SELECT * FROM this is not a valid query");
$wpdb->hide_errors();

Unfortunately, that hardly solves the problem.  I want to handle the error programmatically, not just echo it to the output stream.


text:
Q: AutoHotKey Mouse down Continue press a key, until mouse up I was trying make a script that enable me to continue press a certain key, for example "1", when I hold my left mouse click for more than 0.5 sec, and will continue until I release the left mouse button.
Hope someone can help me with it.

A: You could try something like this. I used the Middle Mouse button to test.
I commented out the lines that are application specific.
SetTitleMatchMode, 2 ; Put at the top of your script.

MButton:: ; Start this script when the Middle Mouse Button is pressed
;ifWinActive, Your Application Name ; Place the application name as in the windows title.
;{
    KeyWait, MButton, T0.5 ; Wait for MButton to be released within 0.5 sec
    if  (ErrorLevel) ; Not released within 0.5 sec.
    {
        Send, {1 Down} ; Press 1 down, will not autorepeat unless placed in a while loop
        KeyWait, MButton ; Wait for Mbutton to be released
        Send, {1 Up} ; Once MButton is released, undo the press 1 down
    }
    else ; If MButton was released within 0.5 sec.
    {
        Click ; press click
    }
;}
;else
;{
;   Click ; perform normal click behaviour when outside of the target application
;}
Return


text:
Q: Remove lines from index.html after building with Ant task and regex I'm building an ExtJS application with Sencha Cmd and would like to remove some lines from the index.html file after it has been built.
I know that this can basically be done by placing Ant tasks inside the build.xml file. Those tasks can look something like this:
<target name="-after-build">
    <replace file="index.html" token="some text" value="some new text"/>
</target>

Now I don't want to just replace some text but want to remove some complete lines that are recognized by regex. I also managed to replace multiple lines by regex with the replaceregexp task but don't now how to completely remove them. I only managed to replace them with a blank.
The lines I'd like to remove from my index.html file look something like this:
//<dev>
<script type="text/javascript" src="dev-files.js"></script>
...
//</dev>

Thanks & best regards


text:
Q: DexException with FirebaseUI: com.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/internal/zzeg; I'm trying to include Firebase Authentication (specifically, Email/Password Authentication using FirebaseUI Auth) in a project. Since I'm a novice, I'm using the examples of a book ("Firebase Essentials Android Edition"). They work as expected, the problem appears when I'm forced to use:
compile 'com.google.firebase:firebase-auth:11.2.0'

instead of the version 11.0.4 suggested in the book (in order to use google maps). The ability to sign out and delete account stops working.
I've searched info and I'm trying to update all I can. I'm using Android Studio 2.3.3. Currently, I have the following build.gradle scripts:
project build.gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.3'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
        classpath 'com.google.gms:google-services:3.0.0'
    }
}

allprojects {
    repositories {
        jcenter()
        maven { url 'https://maven.google.com' }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

app build.gradle:
apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.2"
    defaultConfig {
        applicationId "com.doov.firetest"
        minSdkVersion 16
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:26.0.0'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.google.firebase:firebase-auth:11.2.0'
    compile 'com.firebaseui:firebase-ui:2.0.1'
    compile 'com.firebaseui:firebase-ui-auth:2.0.1'
    testCompile 'junit:junit:4.12'
}

apply plugin: 'com.google.gms.google-services'

But when I build I get the next error (I've seen them at other times, that's why I made a"generic" question that maybe could solve all these types of questions):

Error:Execution failed for task
  ':app:transformClassesWithDexForDebug'.>
  com.android.build.api.transform.TransformException:
  com.android.ide.common.process.ProcessException:
  java.util.concurrent.ExecutionException: com.android.dex.DexException:
  Multiple dex files define Lcom/google/android/gms/internal/zzeg;

How do I solve it?
Thank you very much for your time and assistance in this matter.

A: You are using:
    compile 'com.google.firebase:firebase-auth:11.2.0'
    compile 'com.firebaseui:firebase-ui:2.0.1'
    compile 'com.firebaseui:firebase-ui-auth:2.0.1'

Check the official doc.
You need to make sure that you use the same version that your chosen version of FirebaseUI requires.
FirebaseUI Version  ->  Firebase/Play Services Version
     3.1.0              11.4.2
     3.0.0              11.4.2
     2.4.0              11.4.0
     2.3.0              11.0.4
     2.2.0              11.0.4

You have to use:
    compile 'com.google.firebase:firebase-auth:11.4.2'
    compile 'com.firebaseui:firebase-ui:3.1.0'
    compile 'com.firebaseui:firebase-ui-auth:3.1.0'

or another combination as in the table.


text:
Q: Bash "Syntax error: end of file unexpected" when called from Python's (2.7) subprocess.call() I have a python (v2.7) script that needs to clear the contents of a file before writing to it (if it exists). I'm able to execute the 'same' command on the command line without issue, but I get a either a python or bash error when calling variations of this command from python. Don't know what I'm missing.
Ultimate question: How can I create an empty file (or clear, if it exists) using a system call from Python (v2.7)?
Bash (successfully creates empty or clears existing file)
$ > test.txt
$ ls -l test.txt
-rw-rw-r--+ 1 <owner> <group> 0 Feb  9 11:26 test.txt

Python (w/o `shell=True'; fails with error)
I get the following error without using shell=True: OSError: [Errno 2] No such file or directory. Another post suggests I shouldn't get this error if I pass all arguments as individual string parameters. Not sure why I get this error.
$ python
>>> import subprocess
>>> subprocess.call(['>', 'test.txt']) # Same result w/ single/double quotes
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/subprocess.py", line 172, in call
    return Popen(*popenargs, **kwargs).wait()
  File "/usr/lib/python2.7/subprocess.py", line 394, in __init__
    errread, errwrite)
  File "/usr/lib/python2.7/subprocess.py", line 1047, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

Python (w/ `shell=True'; fails with error)
I tried adding shell=True per suggestions from the other post (shouldn't be security risk since the command is static), but I get the following bash error: Syntax error: end of file unexpected. I thought it might need an ending ; (maybe because of how python makes the call?), so I tried two adding a ; argument with the same end result.
$ python
>>> import subprocess
>>> subprocess.call(['>', 'test.txt'], shell=True) # Same result w/ single/double quotes
test.txt: 1: test.txt: Syntax error: end of file unexpected
2

>>> import subprocess
>>> subprocess.call(['>', 'test.txt', ';'], shell=True)  # Same result w/ single/double quotes
test.txt: 1: test.txt: Syntax error: end of file unexpected

A: shell=True Error
When using this, the command given is meant to be formatted as ONE string
The command string given is then interpreted as a raw shell command
The correct usage should be like this:
>>> import subprocess
>>> subprocess.call('> test.txt', shell=True)
0
>>>
# There will now be an empty file called
# 'test.txt' in the same directory

shell=False Error
The command you are running is meant to be ran on top of a shell, but when using this way, it tries to run your string by calling it as a command found in your PATH
However, I don't know how to solve this part of the issue for your case.


text:
Q: Expanding the values of an array when debugging in XCode While debugging in XCode, is there a way to expand a collection or dictionary variable completely so that I can see the values of the individual properties?
For example, I have this object:
User:
name
email
phone

When I then have an array of two users that's being passed around when the application is running, and try to look into it in the debugger, I see this:
po users
▿ 2 elements
  ▿ [0] : <User: 0x7fa3ab597fd0>
  ▿ [1] : <User: 0x7fa3ab597bb0>

po debugPrint(users)
[MyApp.User, MyApp.User]

po users[0].name
"John"

How can I see the value of all the properties without having to dig in individually?

A: You can override description property and provide your own string.
override var description: String {
    return String(format: "Name: %@, Email: %@, Phone: %@", name, email, phone)
    // Or simpler: return "Name: \(name), Email: \(email), Phone: \(phone)"
}

Edit: This solution is for the case when your class inherits from NSObject. If this is not the case, conform to CustomStringConvertible, as other solutions suggest.

A: Implement CustomStringConvertible for your User object or value and they'll be printed as you want.
extension User: CustomStringConvertible {
    var description: String {
        return "Name: \(name)"
    }
}

A: First of all, try using p myArray instead of po myArray.
If that doesn't work and you're already in the debugger and don't want to recompile with a new description of your object, you can do this instead:
po myArray.map { "\($0.val1), \($0.val2)"}

A: Try using dump instead of debugPrint.
From the Swift Standard Library Functions Reference:

dump(_:name:indent:maxDepth:maxItems:)
Dump an object's contents using its mirror to standard output.
Declaration
func dump<T>(_ x: T, name name: String? = default, indent indent: Int = default, maxDepth maxDepth: Int = default, maxItems maxItems: Int = default) -> T

A: CustomDebugStringConvertable
Kilian Koeltzsch's answer is good, but I suggest a slight improvement:
Make your type conform to CustomDebugStringConvertable by implementing debugDescription:
extension User: CustomDebugStringConvertable{
    var debugDescription: String {
        return "Name: \(name)"
    }
}

Using debugDescription allows you to be more verbose for debugging purposes, whilst still reserving description for general use.


text:
Q: I am trying to display data that is typed in textbox ,but it gets displayed when the page is loading but disappears after page loads why? I am making an app using SharePoint 2013 in which user inputs some text in TextBox, and that text I want to display in button click but that's not happening completely the text gets displayed when the page is loading and disappears after the page is completely loaded.
Here is my code,
<%-- The following 4 lines are ASP.NET directives needed when using SharePoint components --%>
<%@ Page Inherits="Microsoft.SharePoint.WebPartPages.WebPartPage, Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" MasterPageFile="~masterurl/default.master" Language="C#" %>
<%@ Register TagPrefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

<%-- The markup and script in the following Content element will be placed in the  of the page --%>
<asp:Content ContentPlaceHolderID="PlaceHolderAdditionalPageHead" runat="server">

    <link rel="Stylesheet" type="text/css" href="../Content/App.css" />

</asp:Content>

<%-- The markup in the following Content element will be placed in the TitleArea of the page --%>

<asp:Content ContentPlaceHolderID="PlaceHolderPageTitleInTitleArea" runat="server">
    Page Title
</asp:Content>

<%-- The markup and script in the following Content element will be placed in the  of the page --%>
<asp:Content ContentPlaceHolderID="PlaceHolderMain" runat="server">

        Paragraph

<asp:Label id="Label1" runat="server" ClientIDMode="Static">FirstName:</asp:Label>&nbsp&nbsp
<asp:Textbox id="Textbox1" runat="server" ClientIDMode="Static"></asp:Textbox>

<asp:Label id="Label2" runat="server" ClientIDMode="Static">Lastname:</asp:Label>&nbsp&nbsp
<asp:Textbox id="Textbox2" runat="server" ClientIDMode="Static"></asp:Textbox>

<asp:Button id="Button1" runat="server" ClientIDMode="Static"></asp:Button>

</asp:Content>

And Client side code,

'use strict';

var context = SP.ClientContext.get_current();
var user = context.get_web().get_currentUser();

var surname;
var nm;
(function() {

    // This code runs when the DOM is ready and creates a context object which is
    // needed to use the SharePoint object model
    $(document).ready(function() {
        getUserName();
            $("#Button1").click(function()
            {
                 nm = $("#Textbox1").val();
                 surname = $("#Textbox2").val();
            //  $("#Label3").html(""+name+""+surname);
            //  $("#Label3").append(""+name+""+surname);
            //  alert(name+''+surname);
            //  $("#Label3").val(""+name+""+surname);
            //  $("#lblupdate").text(""+name+" "+surname);
                lblupd();
            });

    });

    // This function prepares, loads, and then executes a SharePoint query to get
    // the current users information
    function getUserName() {
        context.load(user);
        context.executeQueryAsync(onGetUserNameSuccess, onGetUserNameFail);
    }

    function lblupd()
    {
            $("#lblupdate").text(""+nm+" "+surname);
        //  document.getElementById("#<%lblupdate.ClientID%>").innerHTML=""+name+""+surname;
    }

    // This function is executed if the above call is successful
    // It replaces the contents of the 'message' element with the user name
    function onGetUserNameSuccess() {
        $('#message').text('Hello ' + user.get_title());
        $("#Button1").val("CLick");
    }

    // This function is executed if the above call fails
    function onGetUserNameFail(sender, args) {
        alert('Failed to get user name. Error:' + args.get_message());
    }

})();

A: On your success callback 'onGetUserNameSuccess', did you want to auto click the button? If so, replace
$("#Button1").val("CLick");

with
$("#Button1").click();

Since, your #lblUpdate is a paragraph, you may want to update it as:
function lblupd() {
    $("#lblupdate").html(nm + " " + surname);
}

Also, use e.preventDefault(); inside your click event of your button.
$("#Button1").on("click", function(e) {
    nm = $("#Textbox1").val();
    surname = $("#Textbox2").val();

    e.preventDefault();
});

A: The page is not fully loaded at $(document).ready, as you expected.
Try calling your function like this instead:
_spBodyOnLoadFunctionNames.push("getUserName")

See this related post for further details.


text:
Q: Android getting error Ksoap in android 4 or above My application could running in android 2.* without any problem and that can correctly use KSoap module. but after installing app in Android 4 or above i get this error:
627-627/ir.tsms E/AndroidRuntime﹕ FATAL EXCEPTION: main
    android.os.NetworkOnMainThreadException
            at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1099)
            at java.net.InetAddress.lookupHostByName(InetAddress.java:391)
            at java.net.InetAddress.getAllByNameImpl(InetAddress.java:242)
            at java.net.InetAddress.getAllByName(InetAddress.java:220)
            at libcore.net.http.HttpConnection.<init>(HttpConnection.java:71)
            at libcore.net.http.HttpConnection.<init>(HttpConnection.java:50)
            at libcore.net.http.HttpConnection$Address.connect(HttpConnection.java:351)
            at libcore.net.http.HttpConnectionPool.get(HttpConnectionPool.java:86)
            at libcore.net.http.HttpConnection.connect(HttpConnection.java:128)
            at libcore.net.http.HttpEngine.openSocketConnection(HttpEngine.java:308)
            at libcore.net.http.HttpEngine.connect(HttpEngine.java:303)
            at libcore.net.http.HttpEngine.sendSocketRequest(HttpEngine.java:282)
            at libcore.net.http.HttpEngine.sendRequest(HttpEngine.java:232)
            at libcore.net.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:80)
            at org.ksoap2.transport.ServiceConnectionSE.connect(ServiceConnectionSE.java:46)
            at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:68)
            at ir.tsms.wsdl.WSDLHelper.call(WSDLHelper.java:34)
            at ir.tsms.wsdl.TSMS.checkUserAuth(TSMS.java:64)

My WSDLHEPLER is:
public class WSDLHelper {
    public static String call(SoapObject request) throws TException {
        String result;

        SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
        envelope.setOutputSoapObject(request);

        AndroidHttpTransport transport = new AndroidHttpTransport(Strings.URL_TSMS);
        transport.debug = true;

        try {

            /*  GETTING ERROR IN BELOW LINE  */
            transport.call(Strings.URL_TSMS + request.getName(), envelope);
            result = envelope.getResponse().toString();
        } catch (IOException ex) {
            Log.e("" , ex.getMessage());
            throw new TException(PublicErrorList.NOT_EXIST_ERROR_DETAIL);
        } catch (XmlPullParserException ex) {
            Log.e("" , ex.getMessage());
            throw new TException(PublicErrorList.NOT_EXIST_ERROR_DETAIL);
        }
        if (result.equals(String.valueOf(Integers.CODE_USER_PASS_FALSE)))
            throw new TException(PublicErrorList.USERNAME_PASSWORD_ERROR);

        return result;
    }

    public static String convert1(String str) {
        return str.substring(1, str.length() - 1);
    }

    public static String[] convert2(String str) {
        return str.split(", ");
    }

    public static String[] convert3(String str) {
        return str.split(",");
    }

}

after testing in android 2.2,3,3.* not problem. i dont know why this module could not running in android 4. please help me. thanks
my Ksoap is :
ksoap2-android-assembly-2.4-jar-with-dependencies.jar

A: LogCat tells you whats wrong :
FATAL EXCEPTION: main
android.os.NetworkOnMainThreadException

You are Networking on your MainThread , in Android 3.0 and above you have to do Networking on Background Thread.
Edit : this is just an example and it might contain errors!
public class WSDLHelper  extends AsyncTask<String, String, String>{

private static String SOAP_ACTION = "http://tempuri.org/***";
//private static String SOAP_ACTION = "http://tempuri.org/***";
private static String NAMESPACE = "http://tempuri.org/";
private static String METHOD_NAME = "yourMethodName";
private String Url;

private Context context;

public WSDLHelper()
{

}

public WSDLHelper(Context context)
{
    this.context = context;
}

@Override
public void onProgressUpdate(String... data)
{
}

@Override
protected String doInBackground(String... uri)
{
        publishProgress("prepare sending");
        SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);

        request.addProperty("YourKey",Key);

        SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);

        new MarshalDate().register(envelope);

        envelope.setOutputSoapObject(request);
        envelope.dotNet = true;
        envelope.implicitTypes= false;

        try {
            HttpTransportSE androidHttpTransport = new HttpTransportSE(url);
            androidHttpTransport.call(SOAP_ACTION, envelope);
            // Get the SoapResult from the envelope body.
            SoapObject result = (SoapObject)envelope.bodyIn;
            String Test = result.toString();
            String Test1 = result.getProperty(0).toString();
            publishProgress("data accepted - " + result.getProperty(0).toString());
            return result.getProperty(0).toString();

            }
        catch (Exception e) {
            return null;
            }

}

@Override
protected void onPostExecute(String result) {

    super.onPostExecute(result);

    if("OK".equals(result) )
    {
        // Do What you Want
    }
    else
    {
    }
}

}

A: If the other answer does not work, then try this in your onCreate method,
    StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
    StrictMode.setThreadPolicy(policy);


text:
Q: Display (dry-run) revision numbers for Alembic migrations I can't seem to find some command that would display entire migration sequence  from start to finish without applying them.
Something like alembic history but in a "dry run" mode and for all of the revisions. Is such a thing available?


text:
Q: Is there a way to hide the URL bar in Edge kiosk mode or to keep the finish button up I have to do a kiosk computer for all administration purpose (taxes, credit card etc..)
After testing openkiosk that was not stable keep rolling back
I try porteus-kiosk but horrible to configure and no way to came back to the homepage with a button
After some research I found that is possible to config edge in kiosk mode with a special account and it's perfect because you can't do anything else than browser through the administration ui I made and there is a special button that finish the session and remove all cookies, login.
But the URL search is still up and I don't want that.
So is there a way to remove it? Or if I put the fullscreen mode is there a way to keep the special button?

A:
the url search it's still up and I don't want that So is there a way
  to remove it

Do you mean you want to hide the address bar in Edge browser? If that is the case, you can find the Microsoft Edge Group Policy settings in the following location of the Group Policy Editor unless otherwise noted in the policy,and disable Address bar drop-down list suggestions:
  Computer Configuration\Administrative Templates\Windows Components\Microsoft Edge\

if I put the fullscreen mode is there a way to keep the special
  button ?

Please explain more detail about the special button, might be on your website, you could use layout template, and add the button in the template, Then, all the content page using this template.


text:
Q: How to kill all child processes of a terminal, not a tty session? At my workplace, we have a high-performance computing-cluster managed by SLURM.
Some people's jobs spawn lots of processes with, as a federation, are one job. They also write the top-level controller poorly, so SIGINT causes the child processes to become zombies.
Because of the nature of this environment, it's not reasonable (for no actually valid reason) to expect them to fix this.
So I'm trying to make a submission wrapper which, at the end of the job, will kill all the child processes.
ps by default grabs all processes associated with the current tty session. However, SLURM does stupid stuff and ps isn't just the processes for THIS task of this job, but also OTHER tasks as well so it kills everything on a physical node whenever one job dies.
So, how do I get/kill all the jobs which are children of the current bash script?

A: The current process (the scripts process or shells, whichever the case may be) is stored in $$
Using that PID, you can use the pgrep command with the -P flag:
pgrep -P $$
to get a list of all PIDs with the parent PID of $$
Here is a super simple proof-of-concept script:
#!/bin/bash

curpid="$$"
#launch 2 useless child processes
cat /dev/random > /dev/null &
cat /dev/random > /dev/null &
cpid=`pgrep -P $curpid`  && echo "$(basename $0) pid: $curpid; child pids:" $cpid
#kill the child pids
kill $cpid
# check if any child pids still exist
newcpid=`pgrep -P $curpid`
if [ $? -ne "0" ] || [ "$newcpid" != "" ]; then
  echo "no child pids left..."
else
  echo $newcpid
fi

Output:
{0} 02:34:57] $ ./test3.sh
test3.sh pid: 7015; child pids: 7016 7017
./test3.sh: line 12:  7016 Terminated              cat /dev/random > /dev/null
./test3.sh: line 12:  7017 Terminated              cat /dev/random > /dev/null
no child pids left...

If you launch any child processes as another user (e.g. sudo), then you may not have permission to kill the process even though you are the parent.
If you change one of the
cat /dev/random > /dev/null &
lines to
sudo cat /dev/random > /dev/null &
you will not be able to kill that process (assuming you launched the script initially with a regular user account)
Modified script (running one child as root and outputting diff info at end):
#!/bin/bash

curpid="$$"
#launch 2 useless child processes
cat /dev/random > /dev/null &
sudo cat /dev/random > /dev/null &
cpid=`pgrep -P $curpid`  && echo "$(basename $0) pid: $curpid; child pids:" $cpid
#kill the child pids
kill $cpid
sleep 0.5
#check on children
for i in $cpid; do
  echo -n "PID: $i; Orig PPID: $curpid; Cur PPID: "`/usr/bin/ps --ppid $i | grep -Eo '[0-9]{3,}'`
  echo
done

Output with one of the children running as root:
[{0} 02:53:51] $ ./test3.sh
test3.sh pid: 8144; child pids: 8145 8146
./test3.sh: line 9: kill: (8146) - Operation not permitted
./test3.sh: line 10:  8145 Terminated              cat /dev/random > /dev/null
PID: 8145; Orig PPID: 8144; Cur PPID:
PID: 8146; Orig PPID: 8144; Cur PPID: 8150

The child PID launched that was launched as root no longer considers the initial script as it's parent, instead it's the subshell created with the sudo call. The output from ps auxf
shows this clearly as well:
root      8146  0.0  0.0 244996  7444 pts/2    S    02:54   0:00 sudo cat /dev/random
root      8150  0.0  0.0 113828   744 pts/2    S    02:54   0:00  \_ cat /dev/random

This issue isn't the crux of your question, but its something to keep in mind.


text:
Q: What is a good memory management strategy for precaching unbounded data set in Android? I am working on an Android app that deals with an arbitrary number of user-defined Views.  The Views can be very simple and lightweight, or they can be very complex and take a relatively long time to instantiate.
I want to use a background thread to precache some of these Views to improve responsiveness when the user switches from one View to the other.  I have a way to set priorities for each View to determine the order they should be added to the cache or removed from cache.
My problem is that I need to determine when I'm running low on memory.  I think I can use MemoryInfo to determine how much memory I have available.  But is there a good rule of thumb for setting thresholds?  At what point should I stop caching additional Views?  At what point should I consider removing lower-priority Views from the cache?

A: I don't think there is universal answer.
It generaly depends on how your UI is build, how you expect user to work with Views and how many Views can fit on screen (even if they are variable height).
You can see some template in how Android works with creating/pre-caching views in ListView/Adapter combination.
AbsListView implementation

A: From what I've read, the memory limit I need to be concerned about is the Dalvik heap limit rather than the total memory available on the device. I use this process to get the current heap utilization:
Java.Lang.Runtime rt = Java.Lang.Runtime.GetRuntime();
long heapused = rt.TotalMemory() - rt.FreeMemory();
long heapmax = rt.MaxMemory();
double ratio = (double)heapused / (double)heapmax;

I pre-cache aggressively at low utilization ratios, and I clear the cache aggressively at high ratios.


text:
Q: PostgreSQL average for every field I'm trying to calculate the average in this sample; This example is working (but only when I select a specific ID, rather than the avg for every ID limited to 20 entries) but I'm having a hard time remembering how to calculate this for every id within the database, rather than the developer specifying the ID explicitly (in this case as 2958). I.E. It would be optimal to have the following rows (assuming this is grouped by each primary key with a limit of 20 values per avg):

*

*ID: 1 -> avg 5

*ID: 2 -> avg 2

*ID: 3 -> avg 7

*etc....
select avg(acc.amt)
from (
    select acc.amt amt
    from main_acc main_acc
      join transactions trans on main_acc.id = trans.main_acc_id
    where main_acc.id = 2958
    order by main_acc.track_id, transactions.transaction_time desc
    limit 20
) acc;

Any help at all would be greatly appreciated. The only relevant columns are the ones shown above, I can add a schema definition if requested. Thank you!

A: select main_acc.id, avg(acc.amt) from (select acc.amt amt
    from main_acc main_acc
             join transactions trans on main_acc.id = trans.main_acc_id

    order by main_acc.track_id, transactions.transaction_time desc) acc
group by main_acc.id;

In fact you do not need the subquery.
select acc.id, avg(acc.amt)
    from main_acc acc
             join transactions trans on acc.id = trans.main_acc_id
group by acc.id

A: How do you define most recent. Is there a timestamp which is not shown, do you use the greatest id, something else? Basically, you order by that criteria and then use limit. So expanding the answer from @Tarik and assuming highest ids as most recent would yield something like:
select acc.id, avg(acc.amt) avg_for_id
    from main_acc acc
             join transactions trans on acc.id = trans.main_acc_id
group by acc.id
order by acc.id desc
limit 20;


text:
Q: Cant access wamp from Local network I installed on VM--->server 2019, and on the server  i have configured a Wamp server 3.1.9 version php 7.1,  I have access to my project on my server, also i changed my localhost project to domain name and again i access to my project(url with authentication with no problem) its a ticketing system my project
The real problem now is that i can't connect from another pc on my local network from another vm machine
both the server and the client are on the same  VMnet(0)
this is my conf file

A: Problem solved!!
Adding httpd.exe(WAMP Apache) application to firewall, rule application open connections for port 80, And one more rule for MySQL database tcp rule open connections for port 3306!!


text:
Q: Making an Angular 2 button component that brings the user to the top of a webpage My goal is to program a button that brings the user to the top of a webpage on click. I am applying this logic directly in the button angular component file, then including it into the webpage through nesting it under a main component. I think there is a timing issue for when I am wiring up the logic. I have included all relevant code snippets, if there is anything else I can provide to better help users answer this question please let me know.
HACK: I've found that wrapping the angular component logic in a System.import promise introduces proper timing in wiring up the button logic. Not sure why though :/. Notice the commented code in the "Button component TypeScript" as an example of this.
HTML snippet from index.html where the main component is defined

        Loading...

Main component TypeScript
import {bootstrap} from "angular2/platform/browser";
import {Component} from "angular2/core";

import {FloatingActionButtonComponent} from "./shared/floating-action-button/floating-action-button-component";

/**
 * Configuration for the main Angular Component
 * @Component
 * @attribute {directives} defines a list of components, allowing angular to properly identify the component selector
 */
@Component({
    directives: [
        FloatingActionButtonComponent
        ],
    selector: "main",
    templateUrl: "./src/development/app/main-view.html"
})

export class MainComponent { }

bootstrap(MainComponent);

Main component view HMTL

    <floating-action-button></floating-action-button>

Button component TypeScript
import {Component} from "angular2/core";

@Component({
    selector: "floating-action-button",
    templateUrl: "./src/development/app/shared/floating-action-button/floating-action-button-view.html"
})

export class FloatingActionButtonComponent {

    constructor() {

        //System.import("path/to/a/directory/file.js").then(() => {
            if (document.getElementById("to-top-button") !== null) {
                document.getElementById("to-top-button").addEventListener("click", () => {
                    window.scrollTo(0, 0);
                    console.log("click");
                });
            }
        //});
    }
}

Button component HTML

    <button id="to-top-button">

Top
    </button>

A: If you think it's a timing issue, wrap the call in a setTimeout:
setTimeout(() => window.scrollTo(0, 0), 1);

If this doesn't work wrap the whole constructor content.


text:
Q: for loop in shell This is a homework I have for my Operative Systems class...
This program sums all the digits from a number and returns the sum e.g. 123  1+2+3 = 6
I have an error in the for statement, but I don't know what I'm doing wrong... please help!
#!/bin/sh
read number
len=${#number}
cont=0
for(( i = 0 ; i < $len; i++ ))
do
     cont=expr `$cont + number%10`
     number=`$number / 10`
done
echo "$cont"

Terminal gives me the error ./ej.sh: 5: Syntax error: Bad for loop variable

A: 1) write the shebang as /bin/bash
2) you don't need the dollar sign in the expression
3) you should wrap the entire expr in backticks
#!/bin/bash
read number
len=${#number}
cont=0
for (( i = 0 ; i < len; i++ )); do
     cont=`expr $cont + $number % 10`
     number=`expr $number / 10`
done
echo "$cont"

A: You did not mention whether its purely bash or not..
$ echo "1234"|sed 's/\(.\)/\1+/g;s/\+$//' | bc
10


text:
Q: is there a way to convert a scratch 3.0 file into a .swf file? I tried scratch 2.0 but I use Sinhala language because l am Sri Lankan. So I can't use Sinhala in scratch 2.0 So I can't convert using scratch 2.0
Is there any other way we can convert an Sb3 file to a Swf file?

A: I hope I understood correctly. You want to convert a Scratch project to SWF. Scratch 2.0 is not an option due to lack of language support; you feel obliged to create the project in Scratch 3.0.
I guess it should be possible to convert SB3 to SWF in two steps: first convert SB3 to SB2, then convert SB2 to SWF.
This wiki article explains both steps:
https://en.scratch-wiki.info/wiki/Porting_Scratch_Projects
SB3 to SB2

Scratch user -Rex- made a .sb3 to .sb2 converter here.
Run sb3tosb2.py (requires Python) to run the converter.
After the .sb2 is saved, the guides below can be followed (.mp3 files will not be converted to .wav to be used in the .sb2).

Note: it wasn't clear to me what 'guides' the last sentence refers to.
SB2 to SWF

You can download an SB2 to SWF converter or use an online converter at this site.

Note: the link above now redirects to: https://asentientbot.github.io/converter/

A: I've been struggling with this as well but only because when I go to the converter on asentienbot.github.io it tells me this "Quite a few years ago, I wrote a tool to port Scratch projects to SWF files and standalone applications. It is now obsolete and unsupported."  And doesn't let me press any buttons just tells me I can download the source code.  Does this happen to you?

A: As @Ruud Helderman said,  you can convert SB3 to SB2 using this converter made by -Rex-.
For the SB2 to SWF part, you can use the Wayback Machine to access older versions of the website.
Here, I linked the latest available version of the page.
EDIT: You have to download the converter since the online version redirects you to: https://asentientbot.github.io/converter/


text:
Q: Spark 3.0.0 error creating SparkSession: pyspark.sql.utils.IllegalArgumentException:  I'm trying to build Spark 3.0.0 for my Yarn cluster, with Hadoop 2.7.3 and Hive 1.2.1. I downloaded the source and created a runnable dist with
./dev/make-distribution.sh --name custom-spark --pip --r --tgz -Psparkr -Phive-1.2  -Phadoop-2.7 -Pyarn
We're running Spark 2.4.0 in production so I copied the hive-site.xml, spark-env.sh and spark-defaults.conf from there.
When I try to create a SparkSession in a normal Python REPL, I get the following uninformative error. How can I debug this? I can run the spark-shell and get to a scala prompt with Hive access seemingly without error.
Python 3.6.3 (default, Apr 10 2018, 16:07:04)
[GCC 4.8.3 20140911 (Red Hat 4.8.3-9)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> import sys
>>> os.environ['SPARK_HOME'] = '/home/pmccarthy/custom-spark-3'
>>> sys.path.insert(0,os.path.join(os.environ['SPARK_HOME'],'python','lib','py4j-src.zip'))
>>> sys.path.append(os.path.join(os.environ['SPARK_HOME'],'python'))
>>> import pyspark
>>> from pyspark.sql import SparkSession
>>> spark = (SparkSession.builder.enableHiveSupport().config('spark.master','local').getOrCreate())

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/pmccarthy/custom-spark-3/python/pyspark/sql/session.py", line 191, in getOrCreate
    session._jsparkSession.sessionState().conf().setConfString(key, value)
  File "/home/pmccarthy/custom-spark-3/python/lib/py4j-src.zip/py4j/java_gateway.py", line 1305, in __call__
  File "/home/pmccarthy/custom-spark-3/python/pyspark/sql/utils.py", line 137, in deco
    raise_from(converted)
  File "<string>", line 3, in raise_from
pyspark.sql.utils.IllegalArgumentException: <exception str() failed>

A: I also encountered pyspark.sql.utils.IllegalArgumentException: <exception str() failed>. It was caused on my side by using an option removed in Spark 3 (spark.sql.legacy.allowCreatingManagedTableUsingNonemptyLocation).


text:
Q: Turn off windows 8 update to 8.1 and delete downloaded update Is there any possibility to turn off windows 8 update to windows 8.1? First it was asking me all the time if I want to update it, I pressed deny, now it changed the strategy and it automatically downloaded the update and after installation, it will update my system from windows 8 to windows 8.1, which I really don't want to. I don't need to have pc full of bugs. Is there possibility remove this update before installation and deny it at all to prevent it in feature?

A: Yes you can.  Under Control Panel you will find at the bottom Windows Update.  There you will see a status of what can be updated.  At your left you'll see a Change Settings link in Blue.  At this point you will select Check for updates but let me choose whether to download them.  Contrary to popular Belief this is the safest setting due to M$ inability to properly write updates that are not malicious to everyday use.  Select Ok to apply your settings.


text:
Q: Android Material Date Range Picker - How to change the text color of only the selected range dates? I am attempting to reproduce this style with the Material Range Date Picker:
[Calendar date picker with all the selected days in white textColor. The unselected days have a black textColor]
This is what I have been able to achieve so far:
[Calendar date picker with only the selected boundary days in white textColor. The unselected days have a black textColor and the days within the selected boundaries are in black as well]
  <style name="MyMaterialCalendarTheme" parent="ThemeOverlay.MaterialComponents.MaterialCalendar">
    <item name="colorOnSurface">@color/black</item>
    <item name="materialCalendarStyle">@style/MyMaterialCalendarStyle</item>
  </style>

  <style name="MyMaterialCalendarStyle"  parent="Widget.MaterialComponents.MaterialCalendar">
    <item name="rangeFillColor">@color/dark_green</item>
    <item name="daySelectedStyle">@style/MyDaySelectedStyle</item>
  </style>

  <style name="MyDaySelectedStyle" parent="Widget.MaterialComponents.MaterialCalendar.Day.Selected">
        <item name="itemTextColor">@color/white</item>
  </style>

Apparently the colorOnSurface attribute sets the textColor for all days in the calendar and daySelectedStyle attribute sets the textColor only for the pair of final and initial days.
Is there a way to make the textColor of days between the start and end date white while keeping the text color of the unselected days black?

A: Well there is no direct way to do that. But you can edit the source code to achieve this.

daySelectedStyle attribute sets the textColor only for the pair of final and initial days.

If you see the source code of RangeDateSelector, you can see that the getSelectedDays() method only adds the start and end date.

You can change the logic to include all the dates between the two selected dates.
For example, you can add this code in between the two if statements :
if (selectedStartItem != null && selectedEndItem != null) {
  Long l = selectedStartItem + 86401000;
  for (; l < selectedEndItem;) {
    selections.add(l);
    l = l + 86401000;
  }
}

The function will look like this :

The coloring part is executed in the MonthAdapter.java
Final Result :


text:
Q: Почему объект не наследует свойство своего прототипа?

var object1 = {
 property: "property1"
};

object1.__proto__.property = "property2";
console.log(object1.property); //property1

Почему object1 не наследует свойство своего прототипа?

A: Ещё как наследует:

var object1 = {
 property: "property1"
};

object1.__proto__.property = "property2";
console.log(object1.property); //property1
delete object1.property;
console.log(object1.property); //property2

Так и работает прототипное наследование - если свойства нет в объекте, оно ищется в свойствах прототипа, и так далее, пока не найдём или не кончится цепочка прототипов.

A: Объекты в JavaScript — динамические "контейнеры", наполненные свойствами (называемыми собственными свойствами). Каждый объект содержит ссылку на свой объект-прототип.
При попытке получить доступ к какому-либо свойству объекта, свойство вначале ищется в самом объекте, затем в прототипе объекта, после чего в прототипе прототипа, и так далее. Поиск ведется до тех пор, пока не найдено свойство с совпадающим именем или не достигнут конец цепочки прототипов.


text:
Q: VBA InStr() Not working the way I thought it would I have a quick question:
For i = 0 to 8 Step 1
    If InStr(cell.Text, Str(i)) <> 0 Then
        'Do stuff
    End  If
Next i

Now, using msgbox(cell.text) i've been able to determine my string is "0N"
And Str(i) is "0". The way I understand InStr() is that it returns a integer for the position of what you are looking for. If it doesnt contain what you are looking for it returns 0. Why does this not work?

A: Your understanding of the InStr function is correct. Your assumption about the Str function, however, is incorrect :)
The Str function adds a leading space if there is no sign, so you are comparing a single character to two characters: " 0" which will always be false.

When numbers are converted to strings, a leading space is always reserved for the sign of Number. If Number is positive, the returned string contains a leading space, and the plus sign is implied.

Use Cstr(i) to avoid this,
If InStr(cell.Text, CStr(i)) <> 0 Then

or nest your Str function within a Trim:
If InStr(cell.Text, Trim(Str(i))) <> 0 Then

Note also that 0 = "0" in VBA, so you technically don't need to cast explicitly to string, though it's probably a good habit.
If Instr(cell.Text, i) <> 0 Then ' <-- this should also work


text:
Q: css style for a button does not work I have an extremely trivial case. I have a button and I want to add an icon to this button. The file structure of the project looks like this:
testpackage/
    - Test.java
    - add.gif
    - my.css

So, this code works relatively fine:
Button b1 = new Button();
b1.setStyle("-fx-background-image: url('/testpackage/add.gif');" +
            "-fx-background-repeat: no-repeat;" +
            "-fx-background-position: center;");

But I do not want to hardcode css style, instead I want to use my.css. This file - my.css - looks like:
.add-button {
  -fx-background-image: url('/testpackage/add.gif');
  -fx-background-repeat: no-repeat;
  -fx-background-position: center;
}

However, when I try to use it like so
 Button b1 = new Button();
 b1.getStyleClass().add("add-button");

it does not work. Thanks fro help in advance!

A: You have to add the stylesheet to your scene first:
Scene scene = new Scene(new Group(), 500, 400);
scene.getStylesheets().add("path/stylesheet.css");

Then you can assign classes, like you did above.

A: You should add the style sheet as well .
b1.getStylesheets().add(this.getClass().getResource("my.css").toExternalForm();
b1.getStyleClass().add("add-button");


text:
Q: Testing XPages with Selenium IDE I wanted to create a demo of using Selenium within XPages development. So demo 1 would be to start using the Selenium IDE and the playback tool but I quickly ran into the problem that when I use a namespicker (bootstrap enabled) it could not playback the highlighted name in the namespicker.
So I am wondering, how useful is this Selenium IDE for XPages developers anyway?

A: Typically you end up writing Selenium scripts (in JavaScript, Java or Python). You might want to checkout UiLicious as an alternative. It is almost like writing English sentences.


text:
Q: One word for an excuse given to make the excuse-giver not look stupid Is there a word that names an excuse made so as to not look stupid?
Here is an example that actually happened:

A guy walks up to a girl and starts talking to her. After talking for some time, the girl asks the guy to give her a kiss, but the guy refuses. So to this, the girl said, "I just wanted to test you if you are a good guy or a bad one."

A: It's not one word, but I would call such an excuse "face-saving", which is defined by oxforddictionaries.com as "preserving one's reputation, credibility, or dignity".

A: (Not a one word) She tried to keep up appearances.

Definition: to make things look all right whether they are or not; to pretend to be happier, less poor, etc. than you really are, because you do not want people to know how bad your situation is.
Examples: We must keep up appearances even if it means little sacrifices here and there. Things may be unpleasant, but we will keep up appearances. They were very unhappily married but kept up appearances for the sake of their children.

A: Justification. "So to this, the girl justified herself by claiming she was testing him."

A: How about cop-out?

: an excuse for not doing something
: something that avoids dealing with a problem in an appropriate way

So it's an excuse, except more emphasis on avoiding something (like not looking stupid in your example). so I think it fits perfectly.
And perhaps if you were to continue the dialogue in your example, the boy might respond "Don't give me that cop-out". And that sounds perfect to me.

A:
pretext
noun
A reason given in justification of a course of action that is not the
  real reason:
  the rebels had the perfect pretext for making their moveOED

So you could say

A guy walks up to a girl and starts talking to her. After talking for
  some time, the girl asks the guy to give her a kiss, but the guy
  refuses. To this, the girl had the perfect pretext, "I just wanted to
  test you if you are a good guy or a bad one."

A: Depending on context I suggest
"an extemporaneous excuse"

*

*composed, performed, or uttered on the spur of the moment

"an ad hoc excuse"

*

*made or done without planning because of an immediate need

or "a lame excuse"

*

*lame  (adj) not very convincing or effective

A: An example using 'face-saving' (as suggested by Doug Warren):

So to save face, the girl said, "I just wanted to test you if you are
  a good guy or a bad one."

A: Lifesaver is what comes to mind.
lifesaver: a person or thing that saves a person, as from a difficult situation or critical moment (Dictionary.com)
The lawyer excuse was a lifesaver
Alternately, face-saver might come close to what ypu're looking for.
face-saver: something that saves one's prestige or dignity (Random House Dictionary)


text:
Q: How to compile and add the form designed by user to a project I am going to let users create Forms during RunTime and add them to a project. I have done the designing and the UI of the form with the help of an open source Form Designer.
Here is the image of the Form Designer:
Lets assume I have the Form1.cs and Form1.cs[Designer] files which are enough for a WinForm. But how do I compile it to a DLL or an EXE and add it to the project? Any ideas? Any clues?
Thanks!!
EDIT
It creates this code.
public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();
    }

    private System.Windows.Forms.Button button1;

    private System.Windows.Forms.TextBox textBox1;

    private System.Windows.Forms.CheckBox checkBox1;

    private void InitializeComponent()
    {
        this.button1 = new System.Windows.Forms.Button();
        this.textBox1 = new System.Windows.Forms.TextBox();
        this.checkBox1 = new System.Windows.Forms.CheckBox();
        this.SuspendLayout();
        //
        // button1
        //
        this.button1.Location = new System.Drawing.Point(71, 49);
        this.button1.Name = "button1";
        this.button1.Size = new System.Drawing.Size(75, 23);
        this.button1.TabIndex = 0;
        this.button1.Text = "button1";
        this.button1.UseCompatibleTextRendering = true;
        this.button1.UseVisualStyleBackColor = true;
        //
        // textBox1
        //
        this.textBox1.Location = new System.Drawing.Point(71, 94);
        this.textBox1.Name = "textBox1";
        this.textBox1.Size = new System.Drawing.Size(100, 20);
        this.textBox1.TabIndex = 1;
        //
        // checkBox1
        //
        this.checkBox1.Location = new System.Drawing.Point(38, 184);
        this.checkBox1.Name = "checkBox1";
        this.checkBox1.Size = new System.Drawing.Size(104, 24);
        this.checkBox1.TabIndex = 2;
        this.checkBox1.Text = "checkBox1";
        this.checkBox1.UseCompatibleTextRendering = true;
        this.checkBox1.UseVisualStyleBackColor = true;
        //
        // form1
        //
        this.ClientSize = new System.Drawing.Size(292, 273);
        this.Controls.Add(this.checkBox1);
        this.Controls.Add(this.textBox1);
        this.Controls.Add(this.button1);
        this.Name = "form1";
        this.ResumeLayout(false);
        this.PerformLayout();
    }

}

I will do some extra coding to the rest of the code myself. but I dont know how to compile it and add it to the main exe?

A: The clue is System.CodeDom.Compiler
i think Form1.cs will contain no code (other then InitializeComponents call in constructor). so if you merge it with the designer code with simple string operations your job will be easier.


text:
Q: How can we type Arabic in textboxes using mvc3? In my project i need to enter data to textboxes in arabic.shall it is possible to enter the data  in arabic by using culture settings.?

A: You need to have Arabic language install on your computer.
Control Panel > Region and Language >

Then you can select whatever language you want to type from language toolbar.

A: Simplest solution I can think of:

*

*Go to Google Translate.

*Set to Translate from English to Arabic

*Type your phrase

*Copy and Paste

Example: http://translate.google.com/#auto/ar/I%20like%20coffee


text:
Q: Change aot metdata.json file generated directory when building library with ng-packagr I have created an Angular library. I'm using ng-packagr to build the library. When I am building the library with ng-packagr it creates the .metada.json for AOT in the directory where the public_api.ts file exists.
Can we change the .metdata.json generated directory to be inside the 'dist' folder?

ng-package.json

{
  "$schema": "./node_modules/ng-packagr/ng-package.schema.json",
  "lib": {
    "entryFile": "public_api.ts",
    "languageLevel": [
      "dom",
      "es2017"
    ]
  },
  "whitelistedNonPeerDependencies": [
    "@angular/*",
    "core-js",
    "rxjs",
    "zone.js",
    "moment",
    "aws-sdk"
  ]
}

tsconfig.json

{
  "compileOnSave": false,
  "compilerOptions": {
    "baseUrl": ".",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "module": "commonjs",
    "moduleResolution": "node",
    "rootDir": ".",
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "inlineSources": true,
    "skipLibCheck": true,
    "noImplicitAny": false,
    "declaration": false,
    "target": "es5",
    "lib": [
      "es7",
      "dom"
    ],
    "typeRoots": [
      "node_modules/@types"
    ],
    "types": [
      "node",
      "jasmine"
    ]
  },
  "angularCompilerOptions": {
    "skipTemplateCodegen": true,
    "strictMetadataEmit": true,
    "fullTemplateTypeCheck": true
  },
  "exclude": [
    "node_modules"
  ]
}

A: If you creating this project from start and using the latest angular version or even angular version 5, Then I would suggest you use Nx Workspace.
It make this angular package creation process very simple,


text:
Q: Sitefinity 8.1 custom MVC routing not working After update to V8.1 from V6.1, our MVC custom code not working, it returned 404 (custom code is some APIs read content and commerce data using Sitefinity APIs).
According to documentation "here" , it said that "Bootstrapper.MVC.MapRoute is removed. Call the RouteTable.Routes.MapRoute (System.Web.Mvc)instead." , so I changed my code from
public static void RegisterRoutes(RouteCollection routes)
{
    routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

    Bootstrapper.MVC.MapRoute(
           "ExternalAccess",
           "baseApi/{controller}/{action}/{id}",
           new { controller = "MvcMainApiCntr", action = "Index", id = "" }
           );
}

to
public static void RegisterRoutes(RouteCollection routes)
{
    routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

    routes.MapRoute(
        "ExternalAccess",
        "baseApi/{controller}/{action}/{id}",
        new { controller = "MvcMainApiCntr", action = "Index", id = "" }
        );
}

But the routing still not working.
Here is a sample of our MVC classes:
using System;
using System.IO;
using System.Net;
using System.Web.Mvc;
using HtmlAgilityPack;
using Telerik.Sitefinity.Abstractions;

namespace SitefinityWebApp.Mvc.Controllers
{
    public class SharedAssetsController : Controller
    {
        [HttpGet]
        public ViewResult GetScripts()
        {
            var rootUrl = anyfunction();
            return View("Scripts", (object) rootUrl);
        }
    }
}

And here is how we bind routing in global.ascx:
protected void Application_Start(object sender, EventArgs e)
{
    RouteConfig.RegisterRoutes(RouteTable.Routes);  //the first method in that post
    Bootstrap.BootstrapSitefinity();
}

Any idea how can we resole that?

A: I got the below advice from Sitefinity Support, I think it's working well now.
Regarding this issue, try to move the route registration in the HttpApplication global class like:
void Bootstrapper_Initialized(object sender, Telerik.Sitefinity.Data.ExecutedEventArgs e)
{
    if (e.CommandName == "RegisterRoutes")
    {
        RegisterRoutes(RouteTable.Routes);
    }
}

And also in the "baseApi" try to avoid using the prefix "ext" as such prefix is used by Sitefinity and might have some issues.


text:
Q: Java Glassfish sudden and persistent slowdown I have a java web application running in Glassfish 3.1 that is load balanced between 5 servers. Occasionally, a single server will start taking up to 5 times as long as the others to process requests. It will continue this poor performance until it has been restarted. After a quick restart of Glassfish the server begins responding as normal.
During a slow period I have connected to the VM with jVisualvm and everything seemed to be working as expected. There was no prolonged garbage collection and no stuck threads. Also there was plenty of heap head space. I also connected to glassfish admin console and that was running slow as well. The slowness appears to be VM wide.
What could cause VM wide general sluggishness?
Thread Dump:
Dump file


text:
Q: c++ CRTP stack corruption when running the following code on MSVC 2013, x64 Debug config, it will show up a message box with this famous error message when quitting the main() function
"Run-Time Check Failure #2 - Stack around the variable 'tmp' was corrupted.".

The question I can't answer is: Why?
note that no error message will occur when running on Release config. (why?)
disclaimer: this is just a sample code, meaning that I'm trying to use this same design on other classes (one base and several derived) with much more methods and template arguments and with a much more complex data type than the basic int*.
#include <iostream>

template <class T>
class base {
public:
    base() {
        static_cast<T*>(this)->setData();
    }
    ~base() {
        static_cast<T*>(this)->destroyData();
    }

    void print() {
        static_cast<T*>(this)->print_int();
    }
};

class derived : public base<derived> {
public:

    void setData() {
        x = new int();
    }

    void destroyData() {
        delete x;
        x = nullptr;
    }

    void print_int() {
        std::cout << "x = " << *x << std::endl;
    }

private:

    derived() {}
    derived(const derived& other) {}
    inline derived& operator= (derived copy) {}

    int *x;
};

int main() {
    base<derived> tmp;

    tmp.print();

    return 0;
}

EDIT:
@Yakk if I understand correctly, you propose as solution this code:
#include <iostream>

template <class T>
class mix_in : public T
{
public:
    mix_in() { (this)->setData(); }
    ~mix_in() { (this)->destroyData(); }
    void print() { (this)->print_int(); }
};

class foo
{
public:

    void setData()
    {
        x = new int();
    }

    void destroyData()
    {
        delete x;
        x = nullptr;
    }

    void print_int()
    {
        std::cout << "x = " << *x << std::endl;
    }

    foo() {}

private:

    int *x;
};

int main()
{
    mix_in<foo> tmp;

    tmp.print();

    return 0;
}

It works just fine, thank you. I'll probably use this pattern since it seems that there's no solution to use CRTP for what I'm trying to do.
But I still would like to understand why the stack corruption happens. In spite of all the discussion around use or not use CRTP for all things, I'd like to understand very precisely why it happens.
Thank you again.

A: As for your code shown in main():
int main() {
    base<derived> tmp;

    tmp.print();

    return 0;
}

base<derived> tmp; that's wrong usage of this pattern, you wanted derived tmp;.
The point of the CRTP is that the derived class is injected to the base class and provides implementations for certain features that are resolved at compile time.
The base class is inherently intended, to be instantiated exclusively via inheritance. Thus you should ensure not to have any instantiations outside an inheritance context.
To avoid users of your implementation trapped by this misconception, make base's constructor(s) protected:
template <class T>
class base {
public:
    ~base() {
        static_cast<T*>(this)->destroyData();
    }

// ...
protected:
    T* thisPtr;
    base() : thisPtr(static_cast<T*>(this)) {
    }
};

NOTE: The base class shouldn't call any methods dependent on the fully initialized derived class methods from within your base class constructor though, as you have shown with your sample (static_cast<T*>(this)->setData();)!
You may store the reference to T* for later use though, as shown in the above sample.

class derived : public base<derived> {
public:
    derived() {
        setData();
    }

    void destroyData() {
        delete x;
        x = nullptr;
    }

    void print_int() {
        std::cout << "x = " << *x << std::endl;
    }

private: // ????
   derived(const derived& other) {}
   inline derived& operator= (derived copy) {}

   int *x;
};

Also it's a bit unclear, why you want to hide copy constructor and assignment operator for your class?

A: tmp is a base<derived>, not a derived. The point of CRTP is that the base class "knows" the object's actual type because it's being passed as the template parameter, but if you manually create a  base<derived>, then the base class functions would think the object is a derived, but it isn't - it's just a base<derived>. Weird things (undefined behavior) happen as a result. (As noted in the other answer, you are also printing out something without setting it...)
As to your second question, the checks generated by MSVC to detect those sorts of programmer errors appears to be turned off in Release mode, presumably for performance reasons.

A: template <class T> class mix_in:public T {
  public:
    base() { (this)->setData(); }
    ~base() { (this)->destroyData(); }
    void print() { (this)->print_int(); }
};

Rename derived to foo.  Do not inherit from mix_in or base in foo.
Swap base for mix_in in main.
CRTP is not the solution to all problems.

A: You say in comments,

the derived class will never be instantiated, its constructor is never called

Others have already pointed out the undefined use of an unconstructed object. To be specific, consider that int *x is a derived member, and your base<derived> usage generates calls, in sequence, to derived::set_data(), derived::print_int(), and on exit derived::destroy_data(), all member functions of an object that doesn't exist, referring to a member for which you've never allocated space1.
But I think what you're after is wholly legitimate. Factoring code is the whole point of  templates and inheritance, i.e. to make important code easier to even identify let alone comprehend, and any later refactoring easier to do, by abstracting out boilerplate.
So:
template < class T >
struct preconstruction_access_subset {};  // often left empty

template < class T, class S = preconstruction_access_subset<T> >
struct base : S {
        base() { S::setData(); }
       ~base() { S::destroyData(); }
        void print() { S::print_int(); }
};

// ... later ...

#include <iostream>

struct derived;
template<> struct preconstruction_access_subset<derived> {
        // everything structors in `base<derived>` need
        int *x;
        void setData()     { x = new int; }
        void destroyData() { delete x; }
        void print_int()   { std::cout << x << '\n'; }
};
struct derived : base<derived> {
        // everything no structors in any base class need to access
};

int main() {
        base<derived> tmp;
        tmp.print();
}

In this example print_int() isn't actually accessed during construction, so you could drop it back into the derived class and access it from `base as for "normal" CRTP, it's just a matter of what's clearest and best for your actual code.

1 That isn't the only problem, just the only one that's apparent without considering any reliance the compiler itself might need to place on the construction sequence.  Think independent-name binding and potential inlining and the ways object identity morphs during {de,con}struction and compiler code factoring for all the potential template/inheritance/member-function/etc. combinations.  Don't just hoist the int *x; to solve the current symptom, that would just kick the trouble farther down the road even if  yours doesn't get that far yet.


text:
Q: Python: Time/Frames Conversion Calculator This is a very beginner question but I have really tried and failed.
I am trying to make a simple animation time calculator to help me with work.
I want it to have 3 user inputs:
1) Frames Per Second
2) Total Frames
3) Total Time
Something like:
total_frames = seconds * framerate
total_time = frames / framerate
The problems I'm having are:

*

*How do I link the result of the variables to the user input on the gui ? And then have, for example, total_frames to update when the user has input framerate and total_time, but also have total_time update when the user has input framerate and total_frames .

*How to get the total time to get the format mm/ss/ff ( with ff being frames based on framerate ).
So like a normal minutes and seconds timer but instead of milliseconds you have the framerate as max per second.
I have managed to get the basic code working just printing out the results of the variables.
And I have also managed to make a basic gui that takes input from the user with Qt designer.
I hope I have explained that decently. Any help will be much appreciated. I'm a total noob but trying to get there slowly.
attempt 1:
my code:
    from datetime import time
from calc import *

framerate = 24#input('Frames Per Second ?')
seconds = 10 #input('How Many Seconds ?')

frames = seconds * framerate
total_time = frames / framerate

print(frames)
print(total_time)

if __name__ == "__main__":
    import sys
    app = QtWidgets.QApplication(sys.argv)
    AnimationCalculator = QtWidgets.QMainWindow()
    ui = Ui_AnimationCalculator()
    ui.setupUi(AnimationCalculator)
    AnimationCalculator.show()
    sys.exit(app.exec_())

my gui:
    from PyQt5 import QtCore, QtGui, QtWidgets

class Ui_AnimationCalculator(object):
    def setupUi(self, AnimationCalculator):
        AnimationCalculator.setObjectName("AnimationCalculator")
        AnimationCalculator.resize(341, 224)
        palette = QtGui.QPalette()
        brush = QtGui.QBrush(QtGui.QColor(105, 173, 255))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Base, brush)
        brush = QtGui.QBrush(QtGui.QColor(105, 173, 255))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Window, brush)
        brush = QtGui.QBrush(QtGui.QColor(105, 173, 255))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Base, brush)
        brush = QtGui.QBrush(QtGui.QColor(105, 173, 255))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Window, brush)
        brush = QtGui.QBrush(QtGui.QColor(105, 173, 255))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Base, brush)
        brush = QtGui.QBrush(QtGui.QColor(105, 173, 255))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Window, brush)
        AnimationCalculator.setPalette(palette)
        self.centralwidget = QtWidgets.QWidget(AnimationCalculator)
        self.centralwidget.setObjectName("centralwidget")
        self.label = QtWidgets.QLabel(self.centralwidget)
        self.label.setGeometry(QtCore.QRect(210, 80, 161, 61))
        palette = QtGui.QPalette()
        brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.WindowText, brush)
        brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Text, brush)
        brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ButtonText, brush)
        brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ToolTipText, brush)
        brush = QtGui.QBrush(QtGui.QColor(255, 255, 255, 128))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.PlaceholderText, brush)
        brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.WindowText, brush)
        brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Text, brush)
        brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ButtonText, brush)
        brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ToolTipText, brush)
        brush = QtGui.QBrush(QtGui.QColor(255, 255, 255, 128))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.PlaceholderText, brush)
        brush = QtGui.QBrush(QtGui.QColor(120, 120, 120))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.WindowText, brush)
        brush = QtGui.QBrush(QtGui.QColor(120, 120, 120))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Text, brush)
        brush = QtGui.QBrush(QtGui.QColor(120, 120, 120))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ButtonText, brush)
        brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ToolTipText, brush)
        brush = QtGui.QBrush(QtGui.QColor(0, 0, 0, 128))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.PlaceholderText, brush)
        self.label.setPalette(palette)
        font = QtGui.QFont()
        font.setFamily("Myriad Pro")
        font.setPointSize(36)
        font.setBold(True)
        font.setWeight(75)
        self.label.setFont(font)
        self.label.setInputMethodHints(QtCore.Qt.ImhDigitsOnly|QtCore.Qt.ImhFormattedNumbersOnly)
        self.label.setObjectName("label")
        self.label_2 = QtWidgets.QLabel(self.centralwidget)
        self.label_2.setGeometry(QtCore.QRect(210, 150, 161, 61))
        palette = QtGui.QPalette()
        brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.WindowText, brush)
        brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Text, brush)
        brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ButtonText, brush)
        brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ToolTipText, brush)
        brush = QtGui.QBrush(QtGui.QColor(255, 255, 255, 128))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.PlaceholderText, brush)
        brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.WindowText, brush)
        brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Text, brush)
        brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ButtonText, brush)
        brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ToolTipText, brush)
        brush = QtGui.QBrush(QtGui.QColor(255, 255, 255, 128))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.PlaceholderText, brush)
        brush = QtGui.QBrush(QtGui.QColor(120, 120, 120))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.WindowText, brush)
        brush = QtGui.QBrush(QtGui.QColor(120, 120, 120))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Text, brush)
        brush = QtGui.QBrush(QtGui.QColor(120, 120, 120))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ButtonText, brush)
        brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ToolTipText, brush)
        brush = QtGui.QBrush(QtGui.QColor(0, 0, 0, 128))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.PlaceholderText, brush)
        self.label_2.setPalette(palette)
        font = QtGui.QFont()
        font.setFamily("Myriad Pro")
        font.setPointSize(36)
        font.setBold(True)
        font.setWeight(75)
        self.label_2.setFont(font)
        self.label_2.setInputMethodHints(QtCore.Qt.ImhDigitsOnly|QtCore.Qt.ImhFormattedNumbersOnly)
        self.label_2.setObjectName("label_2")
        self.label_3 = QtWidgets.QLabel(self.centralwidget)
        self.label_3.setGeometry(QtCore.QRect(210, 10, 161, 61))
        palette = QtGui.QPalette()
        brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.WindowText, brush)
        brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Text, brush)
        brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ButtonText, brush)
        brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ToolTipText, brush)
        brush = QtGui.QBrush(QtGui.QColor(255, 255, 255, 128))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.PlaceholderText, brush)
        brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.WindowText, brush)
        brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Text, brush)
        brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ButtonText, brush)
        brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ToolTipText, brush)
        brush = QtGui.QBrush(QtGui.QColor(255, 255, 255, 128))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.PlaceholderText, brush)
        brush = QtGui.QBrush(QtGui.QColor(120, 120, 120))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.WindowText, brush)
        brush = QtGui.QBrush(QtGui.QColor(120, 120, 120))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Text, brush)
        brush = QtGui.QBrush(QtGui.QColor(120, 120, 120))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ButtonText, brush)
        brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ToolTipText, brush)
        brush = QtGui.QBrush(QtGui.QColor(0, 0, 0, 128))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.PlaceholderText, brush)
        self.label_3.setPalette(palette)
        font = QtGui.QFont()
        font.setFamily("Myriad Pro")
        font.setPointSize(36)
        font.setBold(True)
        font.setWeight(75)
        self.label_3.setFont(font)
        self.label_3.setObjectName("label_3")
        self.timeEdit_2 = QtWidgets.QTimeEdit(self.centralwidget)
        self.timeEdit_2.setGeometry(QtCore.QRect(10, 150, 191, 61))
        font = QtGui.QFont()
        font.setPointSize(26)
        self.timeEdit_2.setFont(font)
        self.timeEdit_2.setObjectName("timeEdit_2")
        self.spinBox = QtWidgets.QSpinBox(self.centralwidget)
        self.spinBox.setGeometry(QtCore.QRect(10, 81, 191, 61))
        font = QtGui.QFont()
        font.setPointSize(26)
        self.spinBox.setFont(font)
        self.spinBox.setInputMethodHints(QtCore.Qt.ImhDigitsOnly)
        self.spinBox.setWrapping(False)
        self.spinBox.setAlignment(QtCore.Qt.AlignCenter)
        self.spinBox.setReadOnly(False)
        self.spinBox.setButtonSymbols(QtWidgets.QAbstractSpinBox.PlusMinus)
        self.spinBox.setMaximum(50000)
        self.spinBox.setSingleStep(1)
        self.spinBox.setProperty("value", 0)
        self.spinBox.setObjectName("spinBox")
        self.spinBox_2 = QtWidgets.QSpinBox(self.centralwidget)
        self.spinBox_2.setGeometry(QtCore.QRect(10, 10, 191, 61))
        font = QtGui.QFont()
        font.setPointSize(26)
        self.spinBox_2.setFont(font)
        self.spinBox_2.setInputMethodHints(QtCore.Qt.ImhDigitsOnly)
        self.spinBox_2.setWrapping(False)
        self.spinBox_2.setAlignment(QtCore.Qt.AlignCenter)
        self.spinBox_2.setReadOnly(False)
        self.spinBox_2.setButtonSymbols(QtWidgets.QAbstractSpinBox.PlusMinus)
        self.spinBox_2.setMinimum(1)
        self.spinBox_2.setMaximum(240)
        self.spinBox_2.setSingleStep(1)
        self.spinBox_2.setProperty("value", 24)
        self.spinBox_2.setObjectName("spinBox_2")
        AnimationCalculator.setCentralWidget(self.centralwidget)

        self.retranslateUi(AnimationCalculator)
        QtCore.QMetaObject.connectSlotsByName(AnimationCalculator)

    def retranslateUi(self, AnimationCalculator):
        _translate = QtCore.QCoreApplication.translate
        AnimationCalculator.setWindowTitle(_translate("AnimationCalculator", "Animation Calculator"))
        self.label.setText(_translate("AnimationCalculator", "Frames"))
        self.label_2.setText(_translate("AnimationCalculator", "Time"))
        self.label_3.setText(_translate("AnimationCalculator", "FPS"))
        self.timeEdit_2.setDisplayFormat(_translate("AnimationCalculator", "HH:mm:ss"))

if __name__ == "__main__":
    import sys
    app = QtWidgets.QApplication(sys.argv)
    AnimationCalculator = QtWidgets.QMainWindow()
    ui = Ui_AnimationCalculator()
    ui.setupUi(AnimationCalculator)
    AnimationCalculator.show()
    sys.exit(app.exec_())

Attempt 2:
import sys
from PyQt5.QtWidgets import QApplication, QWidget, QLineEdit

framerate = 24#input('Frames Per Second ?')
seconds = 5  #input('How Many Seconds ?')

total_frames = seconds * framerate
total_time = total_frames / framerate

def onChangeFPS():
    fps = field_1.text()
    print(fps)

def onChangeFrames():
    framerate = field_2.text()
    print(total_frames)

def onChangeSeconds():
    total_seconds = field_3.text()

    print(total_time)

app = QApplication(sys.argv)

widget_1 = QWidget()

field_1 = QLineEdit(widget_1)
field_1.move(1 , 20)
field_1.resize(200 , 30)
field_1.returnPressed.connect(onChangeFPS)

field_2 = QLineEdit(widget_1)
field_2.move(1 , 50)
field_2.resize(200 , 30)
field_2.returnPressed.connect(onChangeFrames)

field_3 = QLineEdit(widget_1)
field_3.move(1 , 80)
field_3.resize(200 , 30)
field_3.returnPressed.connect(onChangeSeconds)

widget_1.setGeometry(100,100,300,150)
widget_1.setWindowTitle("Animation Time Calculator")
widget_1.show()

sys.exit(app.exec_())

Sorry for the wall of code and thanks again !
UPDATE 2021-09-19: Ok, so I have tried a lot of things and I realised having the script work in a way that chooses the flow of code based on the initial input ( ie: it knows to calculate time if the user put in frames first, or vice versa) is way to hard for me to underdstand with the procedural flow of the code.
So I decided to try break it up into a couple definitions and ask the user which version they would like to use.
I have managed to get it working, it's just getting the miliseconds to be determined by the user input for framerate, and displaying the result in a mm:ss:frames format that I don't understand.
Once I figure that out I'm going to get the gui going and will update that here when I do.
Here's my updated code:
def framecount():

    fps = int(input("Enter Frames per Second: "))
    total_time = float(input("Enter total time: "))
    total_frame = fps * total_time
    print("Total frames: {}".format(total_frame))

def timecount():

    fps = int(input("Enter Frames per Second: "))
    total_frame = int(input("Enter total frame: "))
    total_time = total_frame / fps
    print("Total time: {}".format(total_time)+" seconds")

choose = int(input("What would you like to calculate ? 1. Total Frames 2. Total Time : "))

if choose == 1:
    framecount()

elif choose == 2:
    timecount()

UPDATE 2 2021-09-19:
It seems that datetime.timedelta() can do what I want with the format for total_time
This is the code, the only thing I really can't work out is how to get milliseconds to reset to zero every time it goes +1 over the user input for fps
This is my code:
from datetime import timedelta

def framecount():

    fps = int(input("Enter Frames per Second: "))
    total_time = float(input("Enter total time: "))
    total_frame = fps * total_time
    print("Total frames: {}".format(total_frame))

def timecount():

    fps = int(input("Enter Frames per Second: "))
    total_frame = int(input("Enter total frame: "))

    total_time = timedelta( seconds=(total_frame / fps), milliseconds=total_frame )
    print("Total time: {}".format(total_time))

choose = int(input("What would you like to calculate ? 1. Total Frames 2. Total Time : "))

if choose == 1:
    framecount()

elif choose == 2:
    timecount()

else:
    print("Please choose option 1. or 2.)")

with my test inputs this prints out:

What would you like to calculate ? 1. Total Frames 2. Total Time :
2 Enter Frames per Second: 25 Enter total frame: 107 Total time: 0:00:04.387000

A: fps = int(input("Enter Frames per Second: ") or None)
total_time = int(input("Enter total time: ") or None)
total_frame = int(input("Enter total frame: ") or None)

if not fps is None and not total_time is None:
         total_frame = fps * total_time
elif not fps is None and not total_frame is None:
         total_time = total_frame / fps
else:
     # here you can enter default time, fps

You can use this part at the top of your code to get the user inputs and then process the 3rd variable accordingly to the inputs. Here the priority gets fps and total time first…
This is the easiest version but if you want more sophisticated ones those can be done too… let me know


text:
Q: Will my phonegap app be rejected if it opens a server website I am wondering if my app will get approved or not if it is only a website which is on the server.
I have designed a cordova app which is just redirecting to a website. After redirecting to the website, the user will access whatever there is in the website only.
So is there a chance that my app get rejected by the apple?
This point is from Apple's guideline:
Apps that are not very useful, unique, are simply web sites bundled as Apps, or do not provide any lasting entertainment value may be rejected
And then again this point
Apps that browse the web must use the iOS WebKit framework and WebKit Javascript

A: If you are planing to upload this It will be rejected if its just a sample website. Apple App Review Panel will just reject this application as you have already read apple guideline.

A: Since the reviewers are human, not machines, it could happen that they could accept your app by chance.
However, the normal (and usual) thing is that they reject your app, since it goes against the Apple's guideline.


text:
Q: Java JUnit Refactoring Tests to remove identical tests I am new to JUnit.  Currently have two separate JUnit test classes which both have 4 tests in, except one of the tests is identical for both test classes.  Is there an easy way of somehow refactoring the code so that I can in a way 'import' the common test into both classes?
I have considered making a superclass to extract the common tests, however in this case it seems a bit overkill.
Any suggestions?
Many thanks.

A: It is context dependent but in general you should apply the same refactoring techniques as for your normal code:

*

*it it makes sense for the two classes to inherit a parent class, extract the common code in a parent class

*alternatively you can maybe extract the code in a Helper class that you call as necessary from your two test classes

*or maybe you are testing the same thing with two different sets of data in which case using a parameterized test (data provider in TestNG) could be the solution

*or maybe the fact that the code is the same is a coincidence because the tested classes don't have much in common in which case leaving the duplication may be better...

A: Using a super class isn't completely unheard of.  This could be a pain if however your hierarchy grows.  I've seen webs of super classes be built only to find that the code is tough to follow when debugging (Especially when it isn't yours).  It is still a viable solution though.
Extract the common method into a separate class and simply import it.  If more code comes along that is common between the classes you can add more methods that might be common between the classes.
And if you aren't done with your unit testing you may find that these unit tests may change so keep in mind that you can also parameterize these methods later if you need to.
Hope this helps.


text:
Q: What is the asset Type 0 for containers in yodlee interactive? assetType = 1 indicates asset

assetType = 2 indicates liability

assetType = 0 indicates what ?

Yodlee Interactive

For asset types refer the following link
https://developer.yodlee.com/Aggregation_API/Aggregation_Services_Guide/Aggregation_REST_API_Reference/getAllSiteAccounts
See Sample JSON Response to find assetType = 0

A: assetType= 0 is for container type bills, miles(rewards). Here are some sites for e.g., British Airways Executive Club, AT&T, Vodafone etc.