text:
Q: Can you change the order of TukeyHSD in R I've just run an ANOVA (aov) in r between 3 groups. Group 1,2,3.
After running TukeyHSD for my model, my comparisons are compared in the order of groups:
2-1,
3-1,
3-2
can this be changed so is as follows:
1-2,
1-3,
2-3
Thanks

A: Using relevel will not work since you don't want to change the level order, just the labels. First we need some reproducible data:
data(iris)
SL <- iris$Sepal.Length
Sp <- as.factor(as.numeric(iris$Species))
iris.aov <- aov(SL~Sp)
iris.mc <- TukeyHSD(iris.aov)
iris.mc
#   Tukey multiple comparisons of means
#     95% family-wise confidence level
#
# Fit: aov(formula = SL ~ Sp)
#
# $Sp
#      diff       lwr       upr p adj
# 2-1 0.930 0.6862273 1.1737727     0
# 3-1 1.582 1.3382273 1.8257727     0
# 3-2 0.652 0.4082273 0.8957727     0

Now to switch the labels we use expand.grid to create ones with the first and second group id switched:
ngroups <- 3
Grps <- expand.grid(seq(ngroups), seq(ngroups))
Grps <- Grps[Grps$Var1 < Grps$Var2,]   # Unique groups
newlbls <- unname(apply(Grps, 1, paste0, collapse="-"))
dimnames(iris.mc$Sp)[[1]] <- newlbls
iris.mc
#   Tukey multiple comparisons of means
#     95% family-wise confidence level
#
# Fit: aov(formula = SL ~ Sp)
#
# $Sp
#      diff       lwr       upr p adj
# 1-2 0.930 0.6862273 1.1737727     0
# 1-3 1.582 1.3382273 1.8257727     0
# 2-3 0.652 0.4082273 0.8957727     0


text:
Q: Move Listview Position while speking it with texttospeech I have a ListView which i let read position by position by tts.
I want to scroll to the list position that is actually beeing read.
When I start my read method the position jumps immediatly to the last list position, bcs tts creates a speech-queue async and then plays it.
Is there a way to move the listposition synchronously?
  _btnspeak.Click += delegate {

            //vokabeln is a List of Vokabel
            if (vokabeln.Count > 0)
            {
                // _listpos is the current position in the list
                int _listpos = 0;

                while (_listpos < vokabeln.Count)

                {
                    Vokabel v = vokabeln.ElementAt(_listpos);

                    _lvvokabeln.SmoothScrollToPosition(_listpos);

                    textToSpeechd.Speak(v.DE, QueueMode.Add, null);
                    textToSpeechd.PlaySilence(200, QueueMode.Add, null);

                    _listpos += 1;

                }
            }
        };

A: If I understood, you want to scroll only when the list item has been read, so you need to wait until the item is read in order to read the next one.
Regarding your question:

Is there a way to move the listposition synchronously?

That´s exactly what you are doing, the while loop runs until the end in no time (synchronously), and that´s why it scrolls down to the last position.
You need to make it asynchronously:
b.Click += async delegate { // make the delate async
    if(vokabeln.Count > 0)
    {
        while(_listpos < vokabeln.Count)
        {
            // do scroll
            // do speech

            // set here the duration of the speech. 1000 = 1 second
            await Task.Delay(3000);
        }
    }
};

I don´t know the TextToSpeech API, but the best scenario would be if you could get the duration of a particular speech, then await Task.Delay(duration) like the sample above.
If you don´t have that option, but instead the API provides an event when the speech is done/finished, instead of a while loop you could do something like:

*

*set counter to 0

*scroll to first item

*do speech of first item

*listen to finished event of the speech

*counter ++

*if counter <= total items => do the same with the next one

A: you can use getListView().smoothScrollToPosition(position);
to scroll the listview to current position

redpajama_set_name: RedPajamaStackExchange


text:
Q: Screen Recording in Mac using AVFoundation's documentation I have been working on screen recording on MacOS. I have working code for the same based on Apple's Documentation (https://developer.apple.com/library/content/qa/qa1740/_index.html). The problem is that the resolution of the recorded video is very low. According to the logs generated it looks like SD 480x300 is the default resolution. I was unable to find any methods to change the resolution of the video quality. Can somebody help me out here?

A: I found the solution to the problem. You can set the screen resolution at  mSession.sessionPreset = AVCaptureSessionPreset1280x720;
There are several values for the sessionPreset including
AVCaptureScreenPresetLow
AVCaptureScreenPresetMedium
AVCaptureScreenPresetHigh
AVCaptureScreenPreset320x240
AVCaptureScreenPreset352x288
AVCaptureScreenPreset640x480
AVCaptureScreenPreset960x540
AVCaptureScreenPreset1280x720


text:
Q: http call always success regardless the credentials I'm using deployd for simulation of http requests. I want to authenticate with my credentials to the database.
This is my controller code
.controller("authCtrl", function($scope, $http, $location, authUrl) {

$scope.authenticate = function (user, pass) {
    $http.post(authUrl, {
        username: user,
        password: pass
    }).success(function (data) {
        console.log(data);
        $location.path("main");
    }).error(function (error) {
        console.log("error");
        $scope.authenticationError = error;
    });
}

})
I get following message after entering one of credentials wrong.
Object { message: "bad credentials", status: 401 }

and I get following message after entering two credentials correctly.
Object { path: "/users", id: "11a58ccdcc31c9b863b7a5e63d9d672fdae…", uid: "e2ad770f0847f8ac" }

My problem is not to get "error" log. Only success event is being fired. Entering credentials wrong or right does not change the situation.

A: Try catching error.status=401, example from https://github.com/moorthi07/MarsCMS/
 $scope.login = function () {
            $scope.newUser.$login().then(function (success) {
                $rootScope.$broadcast('user:login');
                $state.go('dashboard.intro');
            }, function (err) {
                if (err.status == 401) {

    //                $mdToast.show(
    //                    $mdToast.simple()
    //                    .content('Username or password invalid!')
    //                    .position('right bottom')
    //                );
                } else {

    //                $mdToast.show(
    //                    $mdToast.simple()
    //                    .content('An error occured. Please check log.')
    //                    .position('right bottom')
    //                );
                    console.log(err);
                };

            });
        };


text:
Q: devtools::document looking for uncalled package I am getting an error when I run devtools::document() on my simple test R file. To me it looks like devtools is asking to include the imports package in the DESCRIPTION file, but my test file is using import not imports. Am I missing something for the package name?
My R script, DESCRIPTION file, console output with the error, and folder and file contents below.
test.R file
#' This is the title.
#'
#' This is the description.
#'

import::from(dplyr, filter)

test_str <- "Hello world"

DESCRIPTION file
Package: test
Title: test
Version: 0.1
Depends: R (>= 3.1.0)
Imports:
    dplyr,
    import
Roxygen: list(markdown = TRUE)
Encoding: UTF-8
RoxygenNote: 7.1.1

Console output
devtools::document()
Updating test documentation
Loading test
Error in as.environment(where) :
  no item called "imports" on the search list

File and folder structure
~\test\
      \DESCRIPTION
      \NAMESPACE
      \R\
      \R\test.R


text:
Q: Training data is left skewed, however the resulting predictions are normally distributed I am training a random forest regression model in R using 3 years of historical data. This is the histogram of the left skewed y data:

When I use the model to predict on new data the results are normally distributed, this is the histogram of the normally distributed forecasted ŷ data:

Is this a normal operation of the random forest algorithm? A problem with my implementation?


text:
Q: Limit of an arithmetic average series Sorry in advance as English is not my primary language.
I randomly thought of the following simple problem, and I coudn't solve it after one one hour trying. Maybe you guys can help.
Let $a_1$ and $a_2$ be positive real numbers. Let $a_n$ be the arithmetic average of the previous 2 numbers, i.e.:
$$a_n = \frac{a_{n-1}+a_{n-2}}{2}$$
If I draw this as points on a paper, I can obviously see that the limit of $a_n$ as $n\rightarrow\infty$ is a function of $a_1$ and $a_2$, but I can't solve it.
How do I proceed?

A: If you rewrite the equation as

*

*$2a_n -a_{n-1} - a_{n-2} = 0$
you obtain a so called homogeneous linear difference equation.
This type of equation can be solved.
A possible method is to check what happens if you plug in a "guessed" solution of the form $a_n = c\cdot \lambda^n$ where $c$ is a real constant.
You will find that the solution can be written as
$$a_n = c_1\cdot 1^n + c_2\cdot \left(-\frac{1}{2} \right)^n = c_1 + c_2\cdot \left(-\frac{1}{2} \right)^n$$
The $1$ and $-\frac{1}{2}$ come from solving the quadratic equation $2\lambda^2 - \lambda - 1 = 0$ you will come across when you carry out the suggested approach $a_n = c\cdot \lambda^n$.


text:
Q: Restoring state in Android when using the 'up' button I am using onSaveInstanceState() to store an ArrayList member variable and restore it in the onCreate() method of the main activity.  This works in most circumstances such as rotating the screen etc. but if I open a new activity and use the 'up' button (not the back button) to navigate back to the main screen it seems to create a new main activity without passing the state bundle in onCreate().
I have confirmed that when the up button is pressed the onDestroy() method is called for the original instance of the main activity which makes no sense to me because I want it to resume the existing activity as if I had pressed the back button rather than create a new one.
Is there a way I can force the new activity to restore the old one or just resume the existing activity?

A: Try setting the main activity's launch mode to singleTop, in your manifest:
<activity android:name="activityName" android:launchMode="singleTop" ... />

A: have you tried to use:
 Intent i = new Intent(this, MainScreenActivity.class);
  i.setFlags(Intent.FLAG_CLEAR_TOP);
 startActivity(i);
  finish();

This code should called on pressing up button.


text:
Q: guess lossless and lossy compression scheme to encode picture data (RGGB or YCrCb or YCgCo) I'm trying to guess which compression scheme is encoding a 14 bits picture, based on observing data samples.
The same algorithm (with different parameters) is likely used to compress lossy and lossless.
Here is an example of header data for lossless version of a 1624x1080 picture.
Observations: each ff01 contains 4 ff02 parts. With lossless, each ff02 parts have one ff03 part. The first 32 bytes of compressed data, just after each ff03 header are displayed b'...' below:
ff01 0013af80 0
  ff02 0004e390 0 8 000000
    ff03 0004e390 0 020 0003
      b'0000000000203ac9468260a5227468805f222b9394520c955401bb7b119bd223'
  ff02 0004ee40 1 8 000000
    ff03 0004ee40 0 020 0007
      b'000000000020394f44420d500a990c6d4124091826b2a102225205b0dd3448da'
  ff02 0004ee50 2 8 000000
    ff03 0004ee50 0 020 0007
      b'00000000002039474c4c62120251158e691d184643522002ba2625002a8a00d4'
  ff02 0004ef60 3 8 000000
    ff03 0004ef60 0 020 0007
      b'00000000002038d30347c8722c369121109530a2dc85440004852e04acc1a200'

for lossy compression, each ff02 parts has 10 ff03 :

ff01 00084fe0 0
  ff02 00020328 0 8 000000
    ff03 00001918 0 020 0006
      b'0000000000203ac318425ef6a542510989082c844a24481516268485b225d0a8'
    ff03 00001538 0 020 0003
      b'00ef1e8849731d5028b2248b391413212c401b04595d7d65018054ad899137a8'
    ff03 000016b0 0 020 0006
      b'67ac484c922e025e55034962865cc8168e0b2636db2efa9341cb403a227bea08'
    ff03 00001610 0 020 0007
      b'01fde185a0795dd7b0d0906d0400e2a1272113c64072af1a0423259919531043'
    ff03 00003308 0 080 0005
      b'575d1afb5a4fdb3999ac9249a7a724dcdbe6c7ac550a8849158fa42a0a8f3f05'
    ff03 000037f8 0 080 0000
      b'f65dfb9eddf5ebc65fda716792792f13236f93ab9d0da2a66fe4e37673ecc360'
    ff03 00002a10 0 0b0 0004
      b'fdc31c95bc733fbcea678e9bdaf96ce7cf19361939cffb935c924eceb35c9cd9'
    ff03 00006878 0 0d0 0004
      b'faff6f8ff667774f2f87aaf3efb70f0f971dfb93fa4e1ff1e5ddefc3d5aaf4e7'
    ff03 00007688 0 0d0 0006
      b'ffd370f971feb3d5fb7cf9bd5cbabc5e2f470f7f272ede5efe3cb4de5d3d387c'
    ff03 00003408 1 100 0004
      b'fffffe50e39d0b80fce7d0be73aa736749784ffef5cdb85765fe99f00e45c238'
  ff02 00021928 1 8 000000
    ff03 00001af0 0 020 0006
      b'000000000020394b00104132249729a435ef6b9ef72443204463319422958ac5'
    ff03 00001678 0 020 0005
      b'0a6883f1002cd95ea0b644ff25597844d9312c0bcf70c05d7feb07285981cbda'
    ff03 00001820 0 020 0006
      b'00f93726075a4b4284883e90b12e9a22143f4408b91614214dea400001639382'
    ff03 00001740 0 020 0003
      b'002de326c64264414fb83118876cb201de47caa376ed291305ee4e1548d8ea64'
    ff03 00003690 0 080 0006
      b'95e725faa7c12e1993d7e39f3939e35f32d796553992e4cbe96c936536ef3abf'
    ff03 00003ca8 0 080 0001
      b'33b997a9dff5d57a73a59c7fa4a6d6f32c4d37114ba4fc6755d6f19c0ce76a4e'
    ff03 00002d20 0 0b0 0007
      b'edb3f1bcb3cb93ee79af1b7c4fbc4deb9e279fae7dd9f59c717533dd79c61834'
    ff03 000066f0 0 0d0 0007
      b'fffc9ff0d38df31e139d78de0707f0e4e2b85d0b4cb877543a5594dc93a73e6f'
    ff03 00008188 0 0d0 0006
      b'fff1fd3f43cbe77673be0eddbbbbe9febf97d5e47074e3272e539e926950a293'
    ff03 00002f90 1 100 0001
      b'fffff11fba78cff627067f8f7fe3f75d7ed9e08e4eff06200c825f8d7abf017f'
  ff02 00021878 2 8 000000
    ff03 00001ae0 0 020 0003
      b'00000000002039450031e3050925ef6bdc42c52086731d22773282408eec6675'
    ff03 000016a0 0 020 0001
      b'0303a6926222416e0a16ef0f448cc9280244a838795211adef21410902410f44'
    ff03 000017f8 0 020 0007
      b'0f0847a34b510ea230507509694082b2500e44dc89620fd02f4a9000001676a0'
    ff03 00001758 0 020 0007
      b'2184092c1524802557c35145ec92e1ad7c278157ec7821524c2068288864c81b'
    ff03 00003770 0 080 0000
      b'76be79adf829cbc5249e46c6ee554cd61ae93395366d52b855f1727fa8603648'
    ff03 00003ba8 0 080 0005
      b'cf3ef79fd9f9c5c96f32f19cfce3ccaf5f9e671ecbc56cca052673f3dc438548'
    ff03 00002cd8 0 0b0 0005
      b'3ff85e2bdf1f0db3caf869d752ef971cb357bf5cf12d278f8f8df33bc5c08b29'
    ff03 000072b0 0 0d0 0007
      b'93fff0cffa3cbe37667d4de2e7fc77073789e273e7cdecdd72f454f387a2d39c'
    ff03 000075f0 0 0d0 0002
      b'ffff27f71753e8389ecf87d4e773f4868b924e1d0a53964ace3664c22d2ac14b'
    ff03 00002f18 1 100 0007
      b'fffffea1cc7fa7711cff0c38d383b85ff38712771fea4fe3a70fb9c705c27e56'
  ff02 00021b18 3 8 000000
    ff03 00001a28 0 020 0004
      b'00000000002038d300018e0c284d871320c61443d8531a5a920944208ce410a8'
    ff03 00001628 0 020 0003
      b'101a7072049100699b0bf6f07111d1319234c4d1027a301a7b55040e947a7f13'
    ff03 000017b0 0 020 0000
      b'401a1c148c285383109a5a6a23f96255445880f6729d64256555a40de8070337'
    ff03 00001710 0 020 0004
      b'091016173981b2c822ac2d19824e284551db0c67f976cecc266924c287c3faae'
    ff03 00003770 0 080 0006
      b'db26f3691fb0d252f46721e37cf45f07a49f0c4eb24e7037a8f43323a7524909'
    ff03 00003c60 0 080 0001
      b'65bf936d8f21d725d395d6ab2b6948f2afe569c62308e9a734062c518b18d165'
    ff03 00002d60 0 0b0 0001
      b'dd5a5368dd995fae79362f4d62d6490a9b7ec9ce79269cee993d242b8bacda78'
    ff03 00006f70 0 0d0 0004
      b'ff37eddbd7b79efe3f79f0de5f9a9c39f8a759ce1be6e4f05b5dbcf299b2693e'
    ff03 00007e50 0 0d0 0002
      b'f3ff8e9f0f4efe1edf833f1757074d9dbf17bbacf9f83e2bc386f87a73f17b67'
    ff03 00002d18 1 100 0005
      b'fffff8d7e1efcddf2a704736fe73fe02725734e45f117f09738783386ce67baf'

Could it be wavelet (because of 10 "ff03" subparts for lossy instead of 1 for lossless) with Rice coding (no huffman like tables)?
Kind regards
Laurent (lclevy@free.fr)


text:
Q: update data in Arrays and loops                $buy_amount = 50;

                $amount[0] = 100;
                $amount[1] = 150;
                $amount[2] = 50;

                $test;

                $i = $buy_amount;
                $arrlength = count($amount);

                for ($x = 0; $x < $arrlength; $x++) {

                   $test = $amount[$x] - $i;
                    if ($amount[$x] != $test) {
                        $i = $test;
                        echo $test;
                        echo '<br/>';
                    }
                }

What I need to do is if i send $buy_amount = 50 result need to be subtract like this
Example:
    $amount[0] = 50;
    $amount[1] = 150;
    $amount[2] = 50;

if i send $buy_amount = 150 result need to be subtract like this
Example:
            $amount[0] = 0;
            $amount[1] = 100;
            $amount[2] = 50;

In here what i need to do first subtract from first element and go to other and subtact from that if buy_amount left more go to other element like wise

A: I think this is what your looking for
$amount[0] = 100;
$amount[1] = 150;
$amount[2] = 50;

$buy_amount = 250; // Change to whatever you want

$amount = array_map(
          function ($mValue) use (&$buy_amount)
          {

             if($buy_amount >= $mValue){

                $buy_amount = $buy_amount - $mValue;
                return 0;
             }

             $sReturnValue = $mValue - $buy_amount;
             $buy_amount = 0;

             return $sReturnValue;

          }
          ,$amount);

var_dump($amount);


text:
Q: How do i convert a string to double in java when the string contains math functions? i have a string with a math function, like  "35+20". i want a new double variable that takes in the result of the math function i.e, 55.0 How do i achieve this? this is actually for android, i'm making a calculator..

A: Manually parse the string and do a calculation at each operator symbol. It will get more complicated when dealing with brackets, however.

A: If you want to write it yourself, you'll probably want to implement the Shunting Yard Algorithm.
There are also some libraries that handle it for you.
https://github.com/uklimaschewski/EvalEx

A: Since you have mentioned you are working on a calculator I am assuming that you might not only be interested in just the + operation but on a bunch of other stuffs too.
You can look in to open source GitHub project linked below which provides the JAVA implementation for the stuff you are trying to do https://github.com/uklimaschewski/EvalEx
which can give you a good set of functionality that you desire.
This project takes in a string as an expression and the returns the result in BigDecimal format.
You can always extend it and tweek it to custom suite you needs.


text:
Q: Single Apostrophe Parse issues ASP CLASSIC I have users uploading data from an excel file to my server, parsed, and then displayed on my website. I have an issue where if the user has a single apostrophe in the excel file it will cut off everything after it. This is because both sql(used to grab the excel data) and the asp classic code(used to display dynamic html data) are interpreting this as a field delimiter. I used php to process the excel file and replace the apostrophe with whatever character I desire. I attempted to use escape versions of apostrophe to no avail "\'", "''","\'\'", "'". This is because even the though they fix the issue with the sql grabbing the data properly, the ASP code continues to cut off characters before it can be displayed. I ended up using "**" as the replacement for apostrophe to get past the sql, but must convert it back to an apostrophe before it is outputted for the user by the ASP:
formString= formString & "
" & _"<input name='FirstName' type='text' size='9' maxlength='12' value='"&replace(someUglyString,"**","'")&"'>	"

Has anyone come across this? any ideas?
php as requested:
for ($i = 1; $i <= $objPHPExcel->getActiveSheet()->getHighestRow(); $i++) {
$cell = $objPHPExcel->getActiveSheet()->getCellByColumnAndRow('A', $i);
$cell->setValue(str_replace("'","**",$cell->getValue()));
$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow('A',$i,$cell->getValue());

}

A: &apos did it. I'm really surprised that I couldn't find this anywhere.


text:
Q: SHFileOperation copying folders using strings I am trying to copy a folder by SHFileOperationA function. Here is my code.
int main()  {

    SHFILEOPSTRUCTA sf;
    int result;

    string source = "D:\\check\\folder4";
    string dest = "D:\\Documents\\test\\folder4";

    sf.pFrom = source.c_str( );
    sf.pTo = dest.c_str( );
    sf.wFunc = FO_COPY;
    sf.fFlags = FOF_NOCONFIRMATION | FOF_NOCONFIRMMKDIR | FOF_SILENT;

    result = SHFileOperationA(&sf);

    return 0;
}

I am not able to understand that how to make the string appended by \0 twice.
I tried something like this.
    string source = "D:\\check\\folder4\\0\\0";
    string dest = "D:\\Documents\\test\\folder4\\0\\0";

But, it is not working. I have also tried few more combinations but none of them is working. Please can anyone suggest me how to solve this?
I can solve the problem by directly assigning the paths like this:-
    sf.pFrom = "D:\\check\\folder4";
    sf.pTo = "D:\\Documents\\test\\folder4";

and the problem gets solved but my intention is to make use of strings. Please can anybody help me with this.
Also, if possible can anybody tell me why directly assigning the string constant i.e sf.pFrom = "D:\\check\\folder4"; is working and assigning using a string like sf.pFrom = source.c_str( ); is not working?
Thanks in advance.

A: The std::string does strlen (or similar) to find the end of the constant char array and allocates only the required number of characters. So it stops on the first null and does not copy the other one. If you want to override this, you need to use constructor that takes size, like:
string source("D:\\check\\folder4\\0", 18);

Note that the second null character is added automatically just as with any other string.
Or add the null character explicitly like (way better solution):
std::string source = std::string("D:\\check\\folder4") + std::string(1, '\0');

Or
std::string source = "D:\\check\\folder4";
source.append(1, '\0');

As for the other question, why using constant character array works:
I believe that, if it works, it just a pure luck that the byte/character in memory after the constant character array is null.
You can test this yourself (in debugger or by printing the values):
// this is the compiler generated null
(*(sf.pFrom + strlen(sf.pFrom))) == '\0'

// this is the following byte/character that should be luckily null
(*(sf.pFrom + strlen(sf.pFrom) + 1)) == '\0'

If you find that the following character is not null in debugger, make sure you finish debugging until the SHFileOperationA. As in that particular case it can fail/crash/whatever (while it normally does not) as the fact you are debugging alone may make the memory image different.
Also you have not specified what you exactly mean by "it works". Do you mean result of SHFileOperationA (what is it). Or that the application crashes/throws, when it does not work. Or that the files are copied or not. This might help answering you.


text:
Q: How to backup database (SQL Server 2008) in C# without using SMO? I have this code and it is not working but I don't why?
try
{
   saveFileDialog1.Filter = "SQL Server database backup files|*.bak";
   saveFileDialog1.Title = "Database Backup";

   if (saveFileDialog1.ShowDialog() == DialogResult.OK)
   {
      SqlCommand bu2 = new SqlCommand();
      SqlConnection s = new SqlConnection("Data Source=M1-PC;Initial Catalog=master;Integrated Security=True;Pooling=False");

      bu2.CommandText = String.Format("BACKUP DATABASE LA TO DISK='{0}'", saveFileDialog1.FileName);

      s.Open();

      bu2.ExecuteNonQuery();
      s.Close();

      MessageBox.Show("ok");
   }
}
catch (Exception ex)
{
   MessageBox.Show(ex.ToString());
}

and I get this error :

What is the problem?

A: You never tell your SqlCommand which connection to use (this is what the error message says by the way, did you read it?). Either set the Connection property or use SqlConnection.CreateCommand to create the command in the first place.

A: You need to assign that SqlConnection object to the SqlCommand - try this code:
if (saveFileDialog1.ShowDialog() == DialogResult.OK)
{
    string connStr = "Data Source=M1-PC;Initial Catalog=master;Integrated Security=True;Pooling=False";

    using(SqlConnection conn = new SqlConnection(connStr))
    {
       string sqlStmt = String.Format("BACKUP DATABASE LA TO DISK='{0}'", saveFileDialog1.FileName);

       using(SqlCommand bu2 = new SqlCommand(sqlStmt, conn))
       {
           conn.Open();
           bu2.ExecuteNonQuery();
           conn.Close();

           MessageBox.Show("ok");
       }
    }
}

A: Backup Sql Server 2008 database in C#(100% correct)
using System.Data.SqlClient;
try{
    SqlConnection con = new SqlConnection(cs.conn());
    string database = con.Database.ToString();
    string datasource = con.DataSource.ToString();
    string connection = con.ConnectionString.ToString();
    string file_name =data_loaction+database_name;
    --- "D:\\Hotel BackUp\\" + database + day + month + year + hour + minute + second + ms + ".bak";

    con.Close();
    con.Open();

    string str = "Backup Database  [" + database + "] To Disk =N'" + file_name + "'";// With Format;' + char(13),'') From  Master..Sysdatabases  Where [Name] Not In ('tempdb','master','model','msdb') and databasepropertyex ([Name],'Status') = 'online'";

    SqlCommand cmd1 = new SqlCommand(str, con);
    int s1 = cmd1.ExecuteNonQuery();
    con.Close();
    if (s1 >= -1)
            MessageBox.Show("Database Backup Sucessfull.", "Hotel Management", MessageBoxButtons.OK, MessageBoxIcon.Information);
    else{
            MessageBox.Show("Database Backup Not Sucessfull.", "Hotel Management", MessageBoxButtons.OK, MessageBoxIcon.Information);
    }
}


text:
Q: Java - download .json file using HttpServletResponse,but find file content contain {} I have written code to download json file here is the code

      @RequestMapping(value = "/download", method = RequestMethod.GET)
    public void download(HttpServletResponse response) throws Exception {
        List<String> text = new ArrayList<>();
        text.add("a");
        text.add("b");
        String textString = JSON.toJSONString(text);

        final Path path = Files.createTempFile("text", ".json");
        byte[] buf = textString.getBytes();
        Files.write(path, buf);

        response.reset();
        response.getOutputStream().write(buf);
        response.addHeader("content-type", "application/octet-stream;charset=UTF-8");
        String fileNameEncode = URLEncoder.encode("text", "UTF-8");
        response.addHeader("Content-Disposition", "attachment;filename=" + fileNameEncode + ".json");

    }

file content should return :
["a","b"]

but return:
["a","b"]{}


text:
Q: Returning a button from a function in SwiftUI I need to create a different button based on configuration and then apply a common theme to any button that was created.
Is this even possible in SwiftUI?
func makeButton(type: ButtonType) -> some View {
        var button: Button

        switch type {
        case .overview:
            button = overviewButton
        case .location:
            button = locationButton
        }
        button
            .padding(EdgeInsets(top: 10, leading: 10, bottom: 10, trailing: 10))
            .background(Rectangle()
                .foregroundColor(theme.primaryColor)
                .cornerRadius(10)
                .shadow(color: .gray, radius: 3.0, x: -1.0, y: 1.0)
            )
            .foregroundColor(theme.textColor)
        return button
    }

    @ViewBuilder var overviewButton: some View {
        Button(action: { viewModel.showOverview(isUserInitiated: true) },
               label: {
            Image("overviewIcon", bundle: default.bundle)
                .renderingMode(.template)
                .foregroundColor(theme.textColor)
        })
        .opacity(viewModel.isOverviewMode ? 0.0 : 1.0)
    }

    @ViewBuilder var locationButton: some View {
        Button(action: { viewModel.showLocation(isUserInitiated: true) },
               label: {
            Image("locationIcon", bundle: default.bundle)
                .renderingMode(.template)
                .foregroundColor(theme.textColor)
        })
        .opacity(viewModel.isLocationMode ? 0.0 : 1.0)
    }

But I get an error in the line I declare button:

Reference to generic type 'Button' requires arguments in <...>

How to we declare a variable of type Button?

A: That might not be the best solution (mainly, because of code duplication, of course,) but this should work:
@ViewBuilder func makeButton(type: ButtonType) -> some View {
  switch type {
    case .overview:
      overviewButton
        .padding(EdgeInsets(top: 10, leading: 10, bottom: 10, trailing: 10))
        // Etc.
    case .location:
      locationButton
        .padding(EdgeInsets(top: 10, leading: 10, bottom: 10, trailing: 10))
        // Etc.
    }
}

@ViewBuilder var overviewButton: some View {
  // ...
}

@ViewBuilder var locationButton: some View {
  // ...
}

To reduce code duplication, you could extract another method:
func makeButton(type: ButtonType) -> some View {
  makeButtonBase(type: type)
    .padding(EdgeInsets(top: 10, leading: 10, bottom: 10, trailing: 10))
    // Etc.
}

@ViewBuilder func makeButtonBase(type: ButtonType) -> some View {
  switch type {
    case .overview:
      overviewButton
    case .location:
      locationButton
  }
}

@ViewBuilder var overviewButton: some View {
  // ...
}

@ViewBuilder var locationButton: some View {
  // ...
}


text:
Q: Ionic 2 Modal multiple get data sorry for my english, I try to get multiple data from a modal but this not work.
This is the code in modal.ts:
anadir() {
    this.viewCtrl.dismiss(this.cantidad, this.idpedido, this.posicion);
  }

and this is the code in page.ts:
 myModal.onDidDismiss(data => {
    this.idpedido = data.idpedido;
    this.cantidad = data.cantidad;
    this.posicion = data.posicion;
    console.log(data)

    });

The data that i get is "undefined", thanks for the help.

A: Instead of sending three different properties, you can try by sending a single object with three properties like this:
anadir() {
   this.viewCtrl.dismiss({
       idpedido: this.idpedido,
       cantidad: this.cantidad,
       posicion: this.posicion
   });
}


text:
Q: Can time() and few additional overload the server while displaying/calculating for top 100 users page? So, I need to know if somehow the time() + 10800 and etc can overload a page if its loading data separately for 100 users? It's a ranking page where I am calculating the online time. It's selecting top 100, so if a lot of users check this page, can the following code overload it by the calculation the time separately for each user or it should be fine? I meant that these array values will be included in the user ranking page which contains top 100 users. so if they are ONLINE, it will do some calculation otherwise nope. I ask basically if for example 50-60 are online, and if a lot of people try to view the user ranking (accessing the page) - it will do a lot of calculation, can this be a concern or it should be fine mostly? Server is running on nginx, MSSQL Server 2005 (just to mention it in case :))
$replace = array
(
            'total_time'    => $data['Status'] == offline ? $this->secondsToTime(intval($data['TotalTime'])) : $this->secondsToTime(intval($data['TotalTime']) + (time() + 10800) - intval($data['LoginDT'])),
            'login_time'    => $data['Status'] == offline ? "N/A" : $this->secondsToTimeCurr(time() + 10800 - intval($data['LoginDT'])));
    .....................


text:
Q: IBM Websphere MQ 7.1.0.2 Tracing I have a number of Queue Managers with a number of Queues. Im using Transmission queues, sender and receiver channels to communicate and transfer messages between the different queue managers.
I have been doing some testing and have found that if you put a wrong queue name in the sender channel just sits there retrying.
Is there a way i can enable tracing or error logging to see that there is an error with the queue name i am trying to send to.
Thanks

A: The answer to the question you posed is yes - there's trace facility (strmqtrc -t detail -t all, recreate, endmqtrc, then look in the mqdata\trace directory at the files noting that on unix you need to dspmqtrc *.TRC first to produce readable FMT files). However, thats almost certainly far too much information for what you need.
If you have a channel that wont start, look at the queue manager error logs first (amqerr0*.log in the mqdata\qmgrs\qmgrname\errors), on BOTH sides, and then at the global errors directory (again, both sides).
Generally speaking a sender channel is configured with a transmit queue where it gets the messages off, which obviously needs to exist. I would hope the amqerr0* errors file would give you enough to pin that down. You may also want to play with configuring a dead letter queue to both ends, so if the message cannot be put somewhere it can end up on there, prefixed with a header to say why. If you do this, use MQExplorer to browse the dead letter queue as I believe it expands the header for you (from memory)


text:
Q: Meaning of compilation error : error C2704: __va_start intrinsic only allowed in varargs? I'm using VS2010 Pro compiler, when I build on x64 I get below compilation error. Compiles perfectly on x86.
error C2704: '' : __va_start intrinsic only allowed in varargs
Declaration of method:
int foo(char* buf, int maxChar, const char*& fmt);

definition:
 int foo(char* buf, int maxChar, const char*& fmt)
{
    int numChar = 0;
    if (fmt)
    {
        va_list plist;
        va_start(plist, fmt);
        numChar = _vsnprintf(buf, maxChar, fmt, plist);
        va_end(plist);
    }
    return numChar;
}

What is the meaning of the error? How to fix this?

A: I think it means pretty much what it says. The compiler won't allow you to use va_start, va_arg, etc, except in a variable argument function. Using va_start outside of a vararg function makes no sense.
This doesn't define a variable argument function:
int foo(char* buf, int maxChar, const char*& fmt)

This does:
int foo(char* buf, int maxChar, const char*& fmt, ...)

A: On x86, all arguments are passed on the stack, and it's semantically safe (albeit incorrect) to use va_start and friends to get "arguments".
However, on amd64 (and most likely on ARM), some arguments are passed via registers.  In this case, using va_start in a function that isn't declared to take variable arguments is semantically unsafe - va_start would index into invalid memory.

A: You used a varargs macro in a function with a fixed number of arguments; MSDN link to the error.


text:
Q: Example of HTTP body for URL Encoded HTTP Request from Twilio Studio I am trying to POST with URL encoded data.   Based on the web server logs,  I am not actually sending any data from Twilio (request size is always 131 bytes, no matter what I type in the Studio widget box).
What does a working form body look like?  Do I need to encode it myself?  How do I escape an "=" that is not part of the key-value structure?

A: When making an HTTP request with the widget, when it is set to make Form URL encoded requests you can set the HTTP parameter keys and values which will automatically encode the values. There are known as URL parameter as the encoding is Form URL encoding. The parameters are encoded as if they were in a URL, but they are sent as the POST body.


text:
Q: Creating a function to edit and delete inputs in a table - Laravel 5.2 I have a code that works like this:

*

*I have a DB named 'phonebook'

*Where I store contacts in a table named 'contacts'

*This is my code for the two main pages I use:

FORM PAGE (phonebook.blade.php):
....... some css here and stuff .......

Contact Form

                    {{-- FORM --}}

        <form method = "POST" action = "contacts">

            {{ csrf_field() }}

                Name

                <input type = "text" id = "name" class = "form-control" name = "name" placeholder = "Name your Name" value = "{!! old('name') !!}">

                Lastname

                <input type = "text" id = "lastname" class = "form-control" name = "lastname" placeholder = "Name your Lastname" value = "{!! old('lastname') !!}">

has('email'))
                    has-error
                @endif">
                E-mail

                <input type = "text" id = "email" class = "form-control" name = "email" placeholder = "somesomething@email.com" >
                @if($errors->has('email'))

{{ $errors->first('email') }}

                @endif

has('phone'))
                    has-error
                @endif">
                Phone Number

                <input type = "text" id = "phone" class = "form-control" name = "phone" placeholder = "I'll call you">
                @if($errors->has('phone'))

{{ $errors->first('phone') }}

                @endif

                Address

                <input type = "text" id = "address" class = "form-control" name = "address" placeholder = "I'll even visit you" value = "{!! old('address') !!}">

            <button type = "submit" class = "submit">Submit Information</button>
            <button type = "button">View Contacts</button>
        </form>

When I hit the "Submit Information" button, the contact is stored in the 'contacts' table and I get redirected to the page "contacts.blade.php".
When I hit the "View contacts" button, I get redirected to "contacts.blade.php" too.
This is the "contacts.blade.php"
....... some css and scripts here .......

Contacts

        <button class = "ret" type = "button">Add New Entry</button>

                     ID
                     Name
                     Lastname
                     E-Mail
                     Phone
                     Address
                     Edit
                     Delete

                @foreach($contact as $contact)

                               {{ $contact->id }}
                             {{ $contact->name }}
                         {{ $contact->lastname }}
                            {{ $contact->email }}
                            {{ $contact->phone }}
                          {{ $contact->address }}
                             <button class = "btnedit" onclick = "editContact()">Edit</button>
                           <button class = "btndelete" onclick = "deleteContact()">Delete</button>

                @endforeach

        <button class = "ret" type = "button">Add New Entry</button>

Please, notice I already have a button to edit and delete my contacts, and the name of the functions, editContact() and deleteContact().
What I need:
When I hit "EDIT" I want to be redirected to a page that uses the same structure of the FORM PAGE, with the input fields filled with the info of that specific row where I hit the EDIT button.
Once I finish editing the entry, I hit the "Submit Information" button and the things I just edited replaces the old stuff, instead of creating a new entry in the table. edit: I prefer using Javascript to do this, so no problems about answers where JS appears.
Delete button:
When I hit the "Delete" button, I want the contact to be removed from my table and the next entries goes up one row, taking the place of the old stuff. edit: I also prefer using JS for this button.
Example:
I have a contact in the fourth row.
I delete this contact.
the fifth entry in the table goes up one position
so, it becomes the fourth entry in the table.
also, the sixth entry goes up one position, becoming the fifth entry.
and so on.
I already have the logic, but I lack the commands to make the functions work.
Also, I'm fairly new to PHP and Laravel.

A: The onclick attribute is going to try and use javascript so you don't really want to do that if you are trying to do this with PHP.
It should probably be a link (stylized like a button if you want it to look like a button) which points to whatever route you have setup to edit the contact.  That route would take the ID of the contact and then show a form where all the fields are pre-populated with that contact id's information.
The form would then point to another route which would take the ID and the contact information and update the record in the database with all entered information on the edit form.
Same goes for the delete button, it would just need to be a link which points to a route which is setup for deleting a contact, using the contact id.  Then it would probably redirect back to this same page or wherever you wanted it to go after that.
I'd check out Resource Controllers, it might make your life a lot easier because it basically sets up the controller for you with all the methods it needs for CRUD operations as well as the routes.  You just need to go through each method in the controller which gets generated and implement them how you see fit.
https://laravel.com/docs/5.4/controllers#resource-controllers

A: What you need to do is to create a new page that will use your database to fill in the fields by passing through the ID.

*

*You need a simple SELECT command to get the row depending on the ID you are editing: SELECT FROM table WHERE ID=yourid. Then by submitting you will not use INSERT INTO table VALUES you will use UPDATE table SET NAME=new_name WHERE ID=yourid

*Accordingly on the delete page, pass through the ID and use DELETE FROM table WHERE ID=yourid
If you do not know how to pass the ID through pages it is done through POST and GET


text:
Q: Mongodb findOneAndUpdate is not working I'm trying to update document in mongodb collection but it's not working for me. Here is the function all fields are come to the backend. I use mlab online mongo db
router.post(
  '/accept',
  (req,res) => {
    const leaveFields = {};
    leaveFields._id = req.body.id;
    leaveFields.name = req.body.name;
    leaveFields.reason = req.body.reason;
    leaveFields.from = req.body.from;
    leaveFields.to = req.body.to;
    leaveFields.user_id = req.body.user_id;
    leaveFields.leaveType = req.body.leaveType;
    console.log(req.body.id);
    Leave.find({user_id:req.body.user_id})  //{ "_id":ObjectId("req.body.id") }
      .then(leave =>{
        if(leave){
          Leave.findOneAndUpdate(
            {_id : req.body.id},
            {$set : leaveFields},
            {new : true}
        )}else{
          res.status(400).json(errors);
        }
      }
        )
      .catch(err=>res.status(404).json({ noleavefound: 'No leaves found' }));

A: Here you are setting _id to leavefields object and
const leaveFields = {};
leaveFields._id = req.body.id;

here you are passing _id field also to your update.
{$set : leaveFields}

_id field is an immutable filed. So, Exclude _id field and then check.


text:
Q: Implication of ± 2 standard deviation I am currently taking a statistics class where we are studying about Standard Deviation. Even though it is a new concept for me still I am able to grasp it fairly quickly. But, we discussed something in the class which I could not understand.
The ±2 SD covers 95% of the data set. But when analyzing some data, what are some of the implications of ±2 SD? What I can tell is that you are missing out the 5% of the remaining data that can give you more accurate information about the data as a whole, like the range of the data, etc.
But please please let me know if anyone has more implications of ±2 SD.


text:
Q: Refresh session after an update I want session get new value after an update, but this always get old value until I re-login...
I have small screenshot called VIP for Vip member :
https://i.stack.imgur.com/DVhAZ.png
When I click active Vip, value changes but on View don't have an image.
My view:
@if (session.IsVip == false)
{

Xin Chào @session.UserName!

    @Html.ActionLink("Đăng xuất", "Logout", "User")
}
else
{

Xin Chào @session.UserName!

    @Html.ActionLink("Đăng xuất", "Logout", "User")
}

My controller:
public ActionResult Load(string id,khachhang c)
{
    var session = Session[CommonConstants.USER_SESSION] as UserLogin;
    var mm = new MuaVipModel();
    mm.setupvip(session.UserID);
    return View();
}

View:
@using (Html.BeginForm("Load","MuaVip",FormMethod.Post))
{
    @Html.AntiForgeryToken()

Thanh toán thành công, bạn có thể kích hoạt VIP!

        @Html.ValidationSummary(true, "", new { @class = "text-danger" })

                <input type="submit" value="Kích hoạt vip" class="btn btn-default" />

}

My stored procedure:
create PROCEDURE [dbo].[setupVip]
    @MaKhachHang nvarchar(10)
AS
BEGIN
    SET NOCOUNT ON;

    UPDATE khachhang
    SET IsVip = 1
    WHERE MaKhachHang = @MaKhachHang
END

Login:
var dao = new UserDao();
var result = dao.Login(model.Username, Encryptor.MD5Hash(model.Password), false);
if (result == 1)
{
    var user = dao.GetById(model.Username);
    var userSession = new UserLogin();
    userSession.UserName = user.Username;
    userSession.UserID = user.MaKhachHang;
    userSession.GroupID = user.MaNhomNguoiDung;
    userSession.IsVip = (bool)user.IsVip;
    var listCredentials = dao.GetListCredential(model.Username);
    Session.Add(CommonConstants.SESSION_CREDENTIALS, listCredentials);
    Session.Add(CommonConstants.USER_SESSION, userSession);
    return RedirectToAction("Index", "Home");
}

A: If you want add or update session value anytime then you can write like this:
Session["UserName"]="XYZ";  // Session UserName will have value XYZ

in your other method if want update this.
Session["UserName"]="ABC"; // Session UserName new value ABC


text:
Q: how to send push notification for a specific device in windows phone 8 using azure I am developing windows phone application, For that I need to send push notification for a specific device or specific phone.
       I have succeed to send push notification for all device by one click, But I am unable to achieve to send a push notification for a specific phone. I have tried a lot i net but I can not find it out.

A: Hey you need get token or device id of your phone and save into server and one more thing, when you will register on Microsoft console, It provide us server key that key you need for server side. then you can get notification by MPNS.. thanks
Try this way,hope this will help you to solve your problem


text:
Q: IIS7.5/Win2k8 - Accessing Virtual Directories via UNC from non-domain machine to another non-domain machine Been seriously racking my brain for a while with this.
I'm trying to add a Virtual Directory to a site that points to a UNC share. Both machines are not in a domain and I know the machines both see each other.
I've read that I need to create a user account on both machines with the same user name and password. For the VDir I have set the Specific User in the Connect As dialog and set the Physical Path Credentials Logon Type as "Network." If from the Basic Settings Dialog I run "Test Settings..." Authentication and Authorization both check out ok.
If I try to browse to the virtual directory with http through my site to access a simple graphic, I get a 500 error. Despite turning on all the detailed error message, trace logging - none of the sub error code (500.xx) comes through.
The VDir points to another website on another server that has it's own Web.Config. I had thought that perhaps that Web.Config was getting in the way but when I temporarily removed it, there was no change.
Currently, the App Pool assigned to the site has the Identity set to ApplicationPoolIdentity. I had tried NetworkService, and I tried using a custom account with the same user name and credentials as the accounts that are on both machines
Not quite sure what's left to try or do differently but I hope I've supplied enough information.
I appreciate any input in advance!
EDIT: Strangely enough, I'm seeing on the server with the share, that there's a login from ANONYMOUS LOGON from the Security Event viewer. Then an immediate Log Off...

A: BINGO! I got it.
Hit the Advanced Settings for the Virtual Directory - Physical Path Credentials Logon Type was set to "Network" because well, that had made sense I guess. I changed it back to the default of Interactive and all seems to be fine.
Same User Name on both machines. Same passwords for each user.
That seemed to do it. Hopefully this thread comes up on Google to help some poor sap that struggled with this problem...
Thanks for all who looked at this thread and gave it a thought!


text:
Q: How to use embeddable Python version in C++ project? I am currently running some Python scripts in a Visual Studio C++ application using the Python/C api. The application is using Python that is installed on my system. However, I'd like to distribute the application without requiring the user to install python manually. I was told to use the embeddable Python version. I found and downloaded the Python 3.8.0 Windows x86-64 embeddable zip file from here. I extracted the contents and now have no idea how to continue. I clearly see the python38.dll (I am assuming this needs to the new dll that the application depends on), but how do I pack it into the output .exe file?
I appreciate the help in advance, and let me know if there is any information I am missing!

A: In order to use the Python-C API you need to first import it in your code. This is done by adding #include "Python.h" to your code. However, for this to work you first need to add the python include files to your compiler search directory. In Visual Studio 2019, this is done by adding the include directory from your python install to Properties > C/C++ > General > Additional Include Directories.
Next, you need to add the python library to your linker. Add the libs directory from your python install to Properties > Linker > General > Additional Library Directories.
Lastly, you need to specify the library name to the linker. This is done in Visual Studio by adding the name of the python library (depends on your version of python and is found in {python install directory} \libs) to Properties > Linker > Input > Additional Dependencies.


text:
Q: Intuitive MOBA orbiting camera (Unity) I hardcoded a moba style camera. The camera moves throughout the XZ plane when the cursor is close to the edges of the screen.
View front
Problems arose when I implemented a orbiting camera functionality. Once the camera orbits towards the opposite side of the character, moving the camera with the cursor is no longer very intuitive.
Opposite view
This is due to the fact that the hovering movement of the camera is harcoded to increase Z-value when the cursor is close to upper edge, decrease Z-value when the cursor is close to bottom edge, increase X-value when the cursor is close to right edge, and decrease X-value when the cursor is close to left edge.
How could I script the hovering (XZ plane) of the camera so that it always moves with respect to itself(upper edge = forward, lower edge = back, left edge = left, right edge = right) regardles of the angle of vision? Thanks for considering my question.

A: Without code examples, its difficult yo know where you need to put it, but you should utilise Mathf.sin and Mathf.cos with respect to the angle of your camera to work out how much to shift each axis.
Keep in mind you will need to work on both axis when calculating the shifts, eg your translation on x axis would need to use the cos of x input and sin of z input or vice versa depending on your actual implementation.


text:
Q: Override Swagger path using application.properties I am using springfox-swagger 2.8.0. I want to customize my Swagger documentation and API version path based on my requirement. Able to modify the version path using application.properties and it is coming properly:
springfox.documentation.swagger.v2.path=/v2/availability-service
http://localhost:8080/context-path/v2/availability-service
But want my documentation URL like below, how I can do that using application.properties entry or any method override.
http://localhost:8080/context-path/availability-service.html
N.B. http://localhost:8080/context-path/swagger-ui.html URL returning the documentation properly.
Can anyone please specify how to do it ? Any suggestion will help.

A: you can try this:
server.contextPath=/v2/availability-service

A: My Java code:The prerequisite is that your url has good naming and grouping rules.
@Configuration
@EnableSwagger2
@ConditionalOnProperty("swagger.enable")
public class Swagger2Config {

@Bean
public Docket createRestApi() {
    return new Docket(DocumentationType.SWAGGER_2).groupName("contract")
            .apiInfo(apiInfo())
            .select()
            .apis(RequestHandlerSelectors.basePackage("com.invoice.gateway.api.admin"))
            .paths(PathSelectors.ant("/api/admin/**"))
            .build();
}

private ApiInfo apiInfo() {
    return new ApiInfoBuilder()
            .title("Web APIs")
            .description("Contract Interface")
            .version("1.0")
            .build();`enter code here`
}
}

A: I think the short answer is that you can't. At least one of the reasons for that stems from this function in the springfox.js code where swagger-ui.html is hard coded
const getBaseURL = () => {
    const urlMatches = /(.*)\/swagger-ui.html.*/.exec(window.location.href);
    return urlMatches[1];
};

The longer answer is that you probably can get around that, depending on your requirements and how much work you want to put into it.
If you just want someone to reach the swagger-ui documentation from your specific link, a quick solution would be to redirect any requests to http://localhost:8080/context-path/availability-service.html to http://localhost:8080/context-path/swagger-ui.html
@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Override
    public void addViewControllers(ViewControllerRegistry registry) {
        registry.addRedirectViewController(
                "/context-path/availability-service.html",
                "swagger-ui.html"
        );
    }
}


text:
Q: Convex hull has the smallest perimeter How do you show that the convex hull of a given set of points S, always has the minimum perimeter ? By perimeter i mean the length of the boundary of the hull

A: Take an arbitrary simple polygon $\pi$ including every point of $S$, and take some segment $PQ$ of the convex hull. Extend it into a line $\ell$. Form a new polygon $\pi'$ by locating the "left"most and "right"most intersection points $L,R$ of $\ell$ with $\pi$, adding new vertices to $\pi$ at $L,R$, and replacing the part of $\pi$ between $L$ and $R$ by the single line segment $LR$. The resulting polygon $\pi'$ is a simple polygon including all points of $S$, and the triangle inequality implies that its perimeter is smaller or equal to the perimeter of $\pi$.

A: The steps for such demostration are indicated in the book of Berg "Computational Geometry. Algorithms and aplications".
Exercise 1.1.
The convex hull of a set S is defined to be the intersection of all convex
sets that contain S. For the convex hull of a set of points it was indicated that the convex hull is the convex set with smallest perimeter. We want to show that these are equivalent definitions.
a. Prove that the intersection of two convex sets is again convex. This implies that the intersection of a finite family of convex sets is convex as well.
b. Prove that the smallest perimeter polygon P containing a set of points P is convex.
c. Prove that any convex set containing the set of points P contains the smallest perimeter polygon P.


text:
Q: URL file-access is disabled in the server I Know this is a problem in the php.ini which comes with a default allow_url_fopen = Off and allow_url_include = Off
How could i deal with this... if the hosting place dont change this.. im trying to access an outside url totally diferent from mine, so the server root thing wont work.. what could i do?

A: Use a HTTP client PHP class to obtain the data:
http://scripts.incutio.com/httpclient/
You can save it as a local file, execute it or do anything. Just be careful not to include some malicious code by mistake (that's why allow_url_include is off by default).


text:
Q: Manuell Postback in ASP.Net how I can do a manuell postback in the code?
I don't want a Redirect, because e.g. the user has entered values in fields in the site and decide than to login. I only want a simple Postback.

A: If you have link/image buttons on you page you can do:
__doPostBack('link/image button name',''); // in javascript

or if not:
var f = document.forms[0]; //if you only have one forms(this standard on asp.net)
f.__EVENTTARGET = 'some control name';
f.submit();

A: What's your point? Do you want to generate a postback script?
Page.ClientScript.GetPostBackEventReference(this, "Arguments", false);

Afterward, for handling the postback you must implement the System.Web.UI.IPostbackEventHandler.
But if you want a cross postback, check it out:
http://www.c-sharpcorner.com/UploadFile/DipalChoksi/xpgpostbk_asp2_dc08102006235543PM/xpgpostbk_asp2_dc.aspx


text:
Q: Vb.NET Architecture with Option Strict On I would begin to code with option strict on. I have a class Cell, that can be, numeric,data or string, included in a class table. How do can mask the type handling inside the classes?
At first I thought at an Interface, but the classes that define the interface must have exactly the same signature.
The same for an override , I can not have different methods that differentiate themselves just for return type...
How does Option Strict On works? I must return an Object?
Edit:
Now the class is :
Public Class cell
    Private pvalue As Object
    Public id As Long
    Public Formula As String
    Public ix As Integer
    Public lev As Integer
    Public Property Value() As Object
        Get
            Return pvalue
        End Get
        Set(ByVal value As Object)
            pvalue = value
        End Set
    End Property
End Class

But I think that in an context of Strict On should not work.
 Public Interface ICell
    Property Value() ' I must define an univoque datatype
End Interface

Public dClass cell
    Implements ICell
    Private pvalue As Object
    Public id As Long
    Public Formula As String
    Public ix As Integer
    Public lev As Integer
    Public Property Value() As Date  Implements ICell.Value
        Get
            Return pvalue
        End Get
        Set(ByVal value As date)
            pvalue = value
        End Set
    End Property
   End Class

Public Class cell
    Implements ICell
    Private pvalue As double
    Public id As Long
    Public Formula As String
    Public ix As Integer
    Public lev As Integer
    Public Property Value() As double Implements ICell.Value
        Get
            Return pvalue
        End Get
        Set(ByVal value As Double)
            pvalue = value
        End Set
    End Property
   End Class

The problem get explained partially here :improve the exception handling vb.net

A: Try using Generics.
Public Interface ICell(Of T)
    Property Value As T
End Interface

Public Class cell(Of T)
    Implements ICell(Of T)
    Public Property Value As T Implements ICell(Of T).Value

    Public id As Long
    Public Formula As String
    Public ix As Integer
    Public lev As Integer
End Class

Then both of these are correct:
    Dim newCell As New cell(Of Double)
    Dim strCell As New cell(Of String)

A: Just stick with Object, but maybe add a property to your class that tells what type you actually use in that cell:
 Public Interface ICell
    Property Value As Object
    Property DataType As Type
End Interface


text:
Q: Persistence without database web ideas I am developing a java web software with jsf in a team. We don't want to use a database, but want the persistence done by simple files on the filesystem. Please don't ask why and say that it is stupid, because it is in most cases.
We can't really say something like D:/data or /home/user/data is the place to put the data, because maybe someone is using windows, mac or linux.
Is there some standard way of saving files through the application server that will survive a restart and maybe even a redeployment of the app, update of the server and so on - real persistence? If not, is there a tomcat solution?

A: The standard does not provide access to a location in the file system where a web application can have read/write access to arbitrary files.
You can, however, designate a location and pass in the location through a system property or a property file.
If you just want to have user information available with session scope, then consider putting serializable objects in the session and let the container manage it.

A: You're trying to save files on the server side or the client side?
If it's the server side, then you would have control over the OS (unless of course you are deploying the app server to each user and they'll be running it locally...), but the way I take your question I think you're proposing to store data on the client side.  In that case you may want to use a cookie as long as you're not storing sensitive data.

A: A few suggestions:

*

*If the data you need to store is small enough, do it in a cookie.

*Prompt the user for a file.  If you don't want to ask for a new/existing file every time, store the path in a cookie.

*Try accessing the home directory in the unix, mac, and windows formats and see which one works.
I would say if 1 doesn't work, you should use 2 because you really shouldn't write to the user's drive (especially from an applet) without their knowledge.


text:
Q: How can I automate the running of updatedb on an encrypted partition? On an encrypted partition, normally the updatedb does not index the encrypted home directory. To run locate (updatedb) while the user is logged in, one hast to keep that part of the locate database under user's encrypted $HOME.
export LOCATE_PATH="$HOME/var/mlocate.db"

and then to run updatedb to index the files in $HOME by:
updatedb -l 0 -o $HOME/var/mlocate.db -U $HOME

This gives a complete index of $HOME and the database isn't visible unless $HOME is mounted and decrypted.
As the ubuntu's rc file infrastructure keeps changing, I'm confused what is the right place (i.e. to which file) to add these lines?
Edit: Currently running Ubuntu 14.04

A: Not in the /etc/rc* structure at all - that is for system startup, run level transitions, and NOT for user stuff. When the rc scripts are running, the system is only partially started, the only UID is 0 (root).
I run updatedb from my crontab, at 02:05 daily. Here's the line from my crontab:
02 05  *   *   *     /usr/bin/updatedb -l 0 -o /home/w3/var/mlocate/mlocate.db -U /home/w3

Note that this cron job must be scheduled to run at a time when user w3 is logged in, and the unencrypted directory is mounted.


text:
Q: RSS feed reader plugin for Internet Explorer 6 When I tried to access RSS feed on Internet Explorer 6.0, it is showing raw RSS code. So I installed a RSS reader application such as feed reader. But although I can access the feed via the installed application, I was wondering if the IE6 problem could be overcome by any plugins.
Does installing plugins like blogbot ensure that IE6 behaves like further versions, or do I still have to manually add rss link to the installed readers?
I wish for my application to behave consistently on all browsers (which I know is too much to ask).
Thanks

A: The best thing is to install a plugin called Firefox.  Just forget about IE 6
http://www.mozilla.org/bg/firefox/fx/
http://www.w3schools.com/browsers/browsers_explorer.asp
As you can see only 1.1% of the people who browse on the Internet use IE 6.


text:
Q: Hashcode and equals methods contract I know that when we override equals() method then we need to override hashcode() as well and other way around.
But i don't understand why we MUST do that?
In Joshua Bloch Book it is clearly written that we must do that, because when we deal with hash based collections, it is crucial to satisfy the Hashcode contract and I admit that, but what if I am not dealing with hash-based collections?
Why is it still required ?

A: Why to Override Equals ?

A programmer who compares references to value objects using the equals
  method expects to find out whether they are logically equivalent, not
  whether they refer to the same object .

Now coming to HashCode

Hash function which is called to produce the hashCode should return the same hash code each and every time,
  when function is applied on same or equal objects. In other words, two
  equal objects must produce same hash code consistently.

Implementation of HashCode provided by Object Class is not based upon logical equivalency ,
So Now if you will not override hashCode but override equals, then according to you 2 Objects are equals as they will pass the equals() test but according to Java they are not .
Consequences :

*

*Set start allowing duplicates !!!

*Map#get(key) will not return the correct value !!

*and so on many other consquences..................

A: Data structures, such as HashMap, depend on the contract.
A HashMap achieves magical performance properties by using the hashcode to bucketize entries. Every item that is put in the map that has the same hashcode() value gets placed in the same bucket. These "collisions" are resolved by comparing within the same bucket using equals(). In other words, the hashcode is used to determine the subset of the items in the map that might be equal and in this way quickly eliminate the vast majority of the items from further consideration.
This only works if objects that are equal are placed in the same bucket, which can only be ensured if they have the same hashcode.
NOTE: In practice, the number of collisions is much higher than may be implied above, because the number of buckets used is necessarily much smaller than the number of possible hashcode values.

A: Because that is the way it is meant to be:

Whenever a.equals(b), then a.hashCode() must be same as b.hashCode().

What issues should be considered when overriding equals and hashCode in Java?
There are use-cases where you don't need hashcode(), mostly self-written scenarious, but you can never be sure, because implementations can and might be also relying on hashcode() if they are using equals()

A: As per Joshua Bloch book;

A common source of bugs is the failure to override the hashCode
  method. You must override hashCode in every class that overrides
  equals. Failure to do so will result in a violation of the general
  contract for Object.hashCode, which will prevent your class from
  functioning properly in conjunction with all hash-based collections,
  including HashMap, HashSet, and Hashtable.

Failing to override hashcode while overriding equals is violation the contract of Object.hashCode. But this won't have impact if you are using your objects only on non hash based collection.
However, how do you prevent; the other developers doing so. Also if an object is eligible for element of collection, better provide support for all the collections, don't have half baked objects in your project. This will fail anytime in the future, and you will be caught for not following the contacts while implementing :)

A: This question is answered many times in SO,  but still I will attempt to answer this .
In order to understand this concept completely, we need to understand the purpose of hashcode and equals, how they are implemented, and what exactly is this contract(that hashcode also should be overridden when equals is overridden)
equals method is used to determine the equality of the object. For primitive types, its very easy to determine the equality. We can very easily say that int 1 is always equal to 1. But this equal method talks about the equality of objects. The object equality depends on the instance variables or any other parameter (depend purely on the implementation - how you want to compare).
This equal method needs to be overridden if we want some customized comparison, lets say we want to say that two books are same if they have same title and same author, or I can say two books are equal if they have same ISBN.
hashcode method returns a hash code value of an object. The default implementation of the Object hashcode returns a distinct integers for distinct objects. This integer is calculated based on the memory address of the object.
So we can say that the default implementation of the equals method just comapres the hashcodes to check the equality of the object. But for the book example - we need it differently.
Also Equal objects must produce the same hash code as long as they are equal, however unequal objects need not produce distinct hash codes.
In case of not using a hash based collection, you can break the contract and need not to override the hashcode method - because you ll not be using the default implementations anywhere but still I would not suggest that and would say to have it as you may need it in future when you put those things in collection


text:
Q: mysql transfer old database to new database i developed a new application but i didn't know that my client need old data when development completed he said now i need old data.
**In Old database have 5 tables**
1. Design
2. Design_comments
3. Design_personalConversation
4. Design_logs
5. Design_files (Deisgner + client Upload)

And in my new application the sturcture i sperated Payment and orderstatus and i am using
1. Design
2. Design OrderStatus
3. Design PaymentStatus
4. Design_Comments
5. Design_personalConversation
6. Design_Logs
7. Design_files (Deisgner + client Upload)

*

*In my old database tables there are some entries(PK) which are deleted.

*In my new database tables should i have to transfer same old database with missing entries with for loop first ftech and transfer this will.

*i have added Design order no to all my new tables so i can fetch data easily like i want.

*i have added Design order no to all my new tables so i can fetch data easily like i want.

Now my main point is that:
there are alot of Design_Comments and Design_files are deleted
Eg: 5,7,11,12
Design_1 Order Contains comments_id 6,8.10,13 and comment_id also interlink with Design_files
Like Design 1 with comment 82,82 so these ids in Design_files because my comments contains some files which upload by client or design
What should i do ?

*

*Should i transfer data table wise like 1 complete table transder to new table

*shoud i transfer data like design1 with data which are hosting in others table like so design1 with Design_Comments, Design_personalConversationm,Design_Logs and Design_files so 1 order transfer to new tables with only data which are interlink.

Transfer old data with same old  Primary key to new tables
or is there any way to full fill missing IDs
should i ignore missing entries

A: its easy, create a migrate.php script transfer data table wise  first get data from old table and then break data and transfer data to new table to new structure wise. you have to write more code for more tables.


text:
Q: Force ArcCatalog to refresh TreeView and View after programmatically creating a table I'm programmatically creating a table in a geodatabase and am trying to force ArcCatalog to refresh the display to show the new table.  I've tried the following which does not work:
Dim gxApp As IGxApplication = TryCast(m_application, IGxApplication)
... 'Create table here

'Then trying to force tree view to show new table...
gxApp.Refresh(0)

'And trying to force view to display...
gxApp.View.Refresh()

Missing something simple here.

A: Try calling IGxObject.Refresh for the object corresponding to the IGxDatabase which holds the table.


text:
Q: What is EXTRN in Intel-syntax assembly? x86 CPU: MSVC (2010)
What does EXTRN   _printf:PROC means in code bellow and why after ":" we use some "PROC" directive instead of "near" or "far"?
CONST   SEGMENT
$SG3830 DB     'hello, world', 0AH, 00H
CONST   ENDS
PUBLIC  _main
EXTRN   _printf:PROC  <- what is this funct?!
_TEXT   SEGMENT
_main   PROC
        push   ebp
        mov    ebp,    esp
        push   OFFSET  $SG3830
        call   _printf
        add    esp,    4
        xor    eax,    eax
        pop    ebp
        ret    0
_main   ENDP
_TEXT   ENDS

A: Appears you are reading Reverse Engineering for Beginners by Dennis Yurichev. In 32-bit FLAT model everything is considered a NEAR pointer (within the 4Gib address space). The concept of NEAR/FAR applied to things like the segmented address model of DOS programs. The code you are looking is the assembly code from the MSVC compiler(CL) for a 32-bit Windows console program.
EXTRN just means there is external linkage to a symbol that is a function/PROCedure in some other module/library/object that will eventually be linked to. Without the EXTRN directive the call _printf would produce an error since the _printf function is not defined in the current assembly file.


text:
Q: Decryption process of ECDSA from receiver's end I have seen so many references all over the internet on how to implement ECDSA from the sender's point of view. That is the encryption of the message by signing it and it's validation. I did not find any implementation for the same from the receiver's point of view. I have one reference for the decryption process mentioned here.  But I find it hard to understand. I have seen this. It is easily implemented in C#, but only signing is done. Can anyone show me any example of decrypting ECDSA from receiver's side implemented in C#?

A: Maarten Bodewes, in a comment on the question said:

"That is the encryption of the message by signing it and it's validation." I think that this is simply confusion. Signature generation is not signing with a private key. Transactions need to be put in the ledger, not encrypted. Usually this only comes up with RSA as ECDSA is just signature generation; it doesn't have an encryption equivalent.


text:
Q: Count string occurence in array using only reduce does not read last value I would make a program usin reduce that counts number of occurence of a string in an array.
I should only use reduces.
Here's my program.
function countWords(inputWords) {
  let obj={};
  inputWords.reduce((curr,next )=> {
     obj[curr]=0;
    inputWords.reduce((current,next2)=> {
      if(curr===current) {
        obj[curr]++;
      }
      return next2
    });
    return next;
  })
  return obj
}

What my result prints

My result :   { exercitation: 1, non: 1, irure: 1, commodo: 3, velit:
  2, officia: 1, consectetur: 4, laboris: 2, est: 2, aliquip: 1,
  excepteur: 1, consequat: 1, magna: 1, id: 1, eiusmod: 1, veniam: 1,
  anim: 1, ullamco: 1, elit: 2, nulla: 1, cupidatat: 2, proident: 1,
  lorem: 1, ad: 1, quis: 1, dolore: 1, occaecat: 1, aliqua: 1, tempor:
  1, do: 1, dolor: 1, labore: 1 }

What is expected:

Expected result : { exercitation: 1, non: 1, irure: 1, commodo: 3,
  velit: 2, officia: 1, consectetur: 4, laboris: 2, est: 2, aliquip: 1,
  excepteur: 1, consequat: 1, magna: 1, id: 1, eiusmod: 1, veniam: 1,
  anim: 1, ullamco: 1, elit: 2, nulla: 1, cupidatat: 2, proident: 1,
  lorem: 1, ad: 1, quis: 1, dolore: 1, occaecat: 1, aliqua: 1, tempor:
  1, do: 1, dolor: 1, labore: 1, amet: 1 }

Here's the inputs words:

Input:[ 'exercitation', 'non', 'irure', 'commodo', 'velit', 'officia',
  'consectetur', 'commodo', 'laboris', 'est', 'aliquip', 'excepteur',
  'consequat', 'consectetur', 'magna', 'id', 'eiusmod', 'veniam',
  'anim', 'consectetur', 'ullamco', 'elit', 'nulla', 'cupidatat',
  'proident', 'commodo', 'laboris', 'est', 'lorem', 'consectetur',
  'elit', 'ad', 'quis', 'dolore', 'occaecat', 'aliqua', 'cupidatat',
  'tempor', 'do', 'dolor', 'velit', 'labore', 'amet' ]

A: There may not be an requirement of using a reduce inside another reduce method.
In the object check if the key exist or not, if not then create the key in the object otherwise update it's value by 1

let input = ['exercitation', 'non', 'irure', 'commodo', 'velit', 'officia', 'consectetur', 'commodo', 'laboris', 'est', 'aliquip', 'excepteur', 'consequat', 'consectetur', 'magna', 'id', 'eiusmod', 'veniam', 'anim', 'consectetur', 'ullamco', 'elit', 'nulla', 'cupidatat', 'proident', 'commodo', 'laboris', 'est', 'lorem', 'consectetur', 'elit', 'ad', 'quis', 'dolore', 'occaecat', 'aliqua', 'cupidatat', 'tempor', 'do', 'dolor', 'velit', 'labore', 'amet']

let result = input.reduce(function(acc, curr) {
  if (!acc.hasOwnProperty(curr)) {
    acc[curr] = 1;
  } else {
    acc[curr] += 1;
  }
  return acc;
}, {})
console.log(result)

A: You should always return the object containing frequencies within the reducer. The initial object can be the second parameter of Array.reduce.
So, here's a oneliner for you:

(() => {
  const input = ['exercitation', 'non', 'irure', 'commodo', 'velit', 'officia',
    'consectetur', 'commodo', 'laboris', 'est', 'aliquip', 'excepteur', 'consequat',
    'consectetur', 'magna', 'id', 'eiusmod', 'veniam', 'anim', 'consectetur',
    'ullamco', 'elit', 'nulla', 'cupidatat', 'proident', 'commodo', 'laboris', 'est',
    'lorem', 'consectetur', 'elit', 'ad', 'quis', 'dolore', 'occaecat', 'aliqua',
    'cupidatat', 'tempor', 'do', 'dolor', 'velit', 'labore', 'amet'];
  console.log(input.reduce( (f, v) => v in f ? (f[v] += 1, f) : (f[v] = 1, f), {}));
  /* which can also be written as:
    input.reduce( (frequencies, value) => {
      if (frequencies[value]) {
        // frequencies contains the value key, so increment
        frequencies[value] += 1;
      } else {
        // add value to frequencies and initialize ([value] = 1)
        frequencies[value] = 1;
      }
      // return the now updated frequencies object for further use
      return frequencies;
    }, {});
    // ^ the initial frequencies object
  */
})();


text:
Q: How to setup IIS? i want to setup IIS(internet information service) on my laptop. what is the setup formality or setup.

A: Installing IIS
This question should be moved to Server Fault however.  Also, once posted there, you should provide a lot more information about what version of Windows, what version of IIS, and so forth.
Also, if you're just doing development, Visual Studio comes with a small development server, so IIS installations aren't usually needed for development.


text:
Q: How to enable / disable click in spinner android? Based on the condition i would like "to show the drop down view of a spinner or show a default value and do not show the drop down". I used setClickable(false) in the spinner object but it didn't work. How to implement it?

A: Try:
((Spinner) spinner).getSelectedView().setEnabled(false);
spinner.setEnabled(false);

A: Disable or enable it before setting the adapter.
spinner.setEnabled(false);
spinner.setClickable(false);
spinner.setAdapter(typeAdapter);

A: enable/disable spinner  it at the end of by writting this below line.
spinner.onSelectedItemListener
spinner.setEnabled(false);  // programmatically

A: To disable click in single item spinner without it greys out the field:
create xml layout for spinner item spinner_item.xml:
<?xml version="1.0" encoding="utf-8"?>
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="20sp"
android:textColor="#000000"
/>

In the code:
  ArrayAdapter<String> adapter = new ArrayAdapter<>(MainActivity.this, R.layout.spinner_item, SpinnerList); // replace SpinnerList with your own list you want to show
        Spinner spin = (Spinner) findViewById(R.id.android_spinner); // replace android_spinner with the id of yours
        if (SpinnerList.size() < 2) { // again change SpinnerList
            spin.setBackgroundColor(Color.TRANSPARENT); // if you don't want to show the dropdown arrow
            spin.setEnabled(false); // it will disable click in spinner
        }
        spin.setAdapter(adapter);


text:
Q: UI-GRID-info Expandable grid with button and action Can I have a button in Angular UI-GRID-info expandable sub-grid and call a function like getExternalScopes().Validate or SaveRow, or DelteRow?
{name: 'saveRow', cellTemplate: '<button id="saveBtn" type="button"  ng-click="getExternalScopes().saveRow(row.entity)" >Save</button> '}

A: I already fixed in the plunker above Must have appScopeProvider: $scope in subGridOptions http://plnkr.co/edit/VHuE151KUFx0ImVPuHy2?p=preview


text:
Q: sorl-thumbnail not linking properly I installed sorl-thumbnail and a lot seems to go right. For every {% thumbnail %} tag some folders and a thumbnail image are created in a "cache" folder.
Inside the template the image url is rendered as something like "cache/7b/74/7b74e7338fd08c52e3ac7526aa5eb7b6.jpg", which seems correct as well. However no image is displayed. When I try following the cache link, it results in a 404 error.

A: On the rendered page, does the link starts like cache/7b/74... or is it /media/cache/7b/74 ?... if it's like the first one, then c&p the link and prepend /media/ to it. If the image shows, then the problem is the generated url.
Also, if your problem is the missing /media/, take a look at this other question: Sorl-thumbnail bad url's


text:
Q: Failed to run aapt dump badging: AndroidManifest.xml:16: error: ERROR: missing 'android:name' for uses-permission <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:largeHeap="true" android:versionName="1.0" package="com.companyname.customerapp" android:installLocation="auto">
    <uses-sdk android:minSdkVersion="22" android:targetSdkVersion="27" />
    <application android:label="CustomerApp" android:theme="@style/MainTheme">

        <provider android:name="android.support.v4.content.FileProvider" android:authorities="${applicationId}.fileprovider" android:exported="false" android:grantUriPermissions="true">
        <meta-data android:name="android.support.file_provider_paths" android:resource="@xml/files_path"></meta-data>
        </provider>

    </application>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <uses-permission android:name="android.permission.READ_PRIVILEGED_PHONE_STATE" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:usesCleartextTraffic="true" />
    <uses-permission android:name="android.permission.READ_CONTACTS" />
    <uses-permission android:name="android.permission.WRITE_CONTACTS" />
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.MANAGE_DOCUMENTS"/>

</manifest>

I m Not Able To Upload aab File On Google Play Console.
Above is my manifestfile i am not getting why i am getting this issue
please guide need some help
thanks

A: The error is displayed on line 16. It's about usesCleartextTraffic.
You should remove the line: <uses-permission android:usesCleartextTraffic="true" /> and add android:usesCleartextTraffic="true" to the application label.
Change to this:
<?xml version="1.0" encoding="utf-8"?>
<manifest ...>
    <application
        android:label="CustomerApp" android:theme="@style/MainTheme"
        android:usesCleartextTraffic="true">
    ...
    </application>
    ...
</manifest>

For more details about usesCleartextTraffic, you can check this doc.


text:
Q: Pip3.5 points to old Python 3.4.2 after Python 3.5 installation I have installed Python 3.5.4 alongside python 3.4.2.
Calling pip with python 3.4 works fine, that is:
>>pip3.4
>>py -3.4 -m pip

Trying to use the python 3.5 version of pip (which I have ticked to install during the installation) with:
>>pip
>>python -m pip
>>py -3.5 -m pip

All lead to this error:
Could not import runpy module
Traceback (most recent call last):
  File "C:\Python34\Lib\runpy.py", line 14, in <module>
    import importlib.machinery # importlib first so we can test #15386 via -m
  File "C:\Python34\Lib\importlib\__init__.py", line 34, in <module>
    _w_long = _bootstrap._w_long
AttributeError: module 'importlib._bootstrap' has no attribute '_w_long'

This is on a Windows 7 64bit PC. I have no idea why specifically calling the python 3.5 version of pip makes it to access python 3.4's directory as in "C:\Python3.4". Help?

A: have you try to configure the environment variable properly?
See this link:
python and pip windows configuration


text:
Q: What is the difference between searching for a char in a char[] vs searching for a String using the String.indexOf() method? private static int getTotalWordValue(String word) {
    int totalWordValue = 0;

    // Code that produces correct results.
    for(int i=0; i < alpha.length(); i++) {
        char letter = alpha.charAt(i);
        for(char ch: word.toCharArray()) {
            if(letter == ch) {
                totalWordValue += i+1;
            }
        }
    }

    // Code that produces incorrect results.
    totalWordValue = 0;
    for(int i=0; i < alpha.length(); i++) {
        String letter = String.valueOf(alpha.charAt(i)); // <-- here?
        if(word.indexOf(letter) != -1) {
            totalWordValue += i+1;
        }
    }

    return totalWordValue;
}

Upon running the above code to solve Project Euler Problem 42, I am getting different results. The first 'for' loop shown above outputs the correct results and the second 'for' loop outputs incorrect results.
The above code takes a String and returns its word value. For example, the word SKY will return a word value of 55 as the letters in this word add as follows (starting at 1):

*

*S = 19 (19th position of the alphabet)

*K = 11 (11th position of the alphabet)

*Y = 25 (25th position of the alphabet).

19 + 11 + 25 = 55.
I have reduced the problem to the above code and do not understand why this occurs. Perhaps I have missed an important piece of information as it relates to the Java String class and its methods.
I am running Java 8 in Eclipse Neon.3 Release (4.6.3) on Windows 10.

A: The two pieces of code are entirely different.
In both cases you have an outer loop which serves up each character of the string alpha in the variable letter.
In the first case, you then have an inner loop which runs through every character of the string word and counts every matching occurrence of letter. When the inner loop has counted every occurrence of letter in word, the outer loop moves on to the next letter.
In the second case, there's no inner loop.  Each time around the outer loop you use word.indexOf(letter) to try to find the index of the first occurrence of letter in word. If there is one, you advance your count.  Either way, you're now done with that letter and the outer loop moves on to the next letter.  There might have been other occurrences of letter in word, but this case didn't try to find them and count them.

A: The word value is incorrect in the second implementation for words that contain some letters multiple times. For example for WOOD,
the first method will calculate 3 + 14 + 14 + 22, but the second will calculate 3 + 14 + 22.
Why? The first method iterates over characters of the word:

for(char ch: word.toCharArray()) {
    if(letter == ch) {
        totalWordValue += i+1;
    }
}

The second method iterates over characters of the alphabet:

for(int i=0; i < alpha.length(); i++) {
    String letter = String.valueOf(alpha.charAt(i)); // <-- here?
    if(word.indexOf(letter) != -1) {
        totalWordValue += i+1;
    }
}

So in the example of "WOOD",
"O" will be counted only once, instead of twice.

As an aside,
the conversion to String is pointless here:

String letter = String.valueOf(alpha.charAt(i));
if(word.indexOf(letter) != -1) {

A better way to write the same thing:
char letter = alpha.charAt(i);
if (word.indexOf(letter) != -1) {

(But the implementation would still be incorrect.)

Finally,
if the alphabet is English A-Z, then a faster implementation is possible:
int totalWordValue = 0;
for (char c : word.toCharArray()) {
  if ('A' <= c && c <= 'Z') {
    totalWordValue += (c - 'A') + 1;
  }
}

return totalWordValue;

A: indexOf has 4 overloaded method and one of them except character argument and return the index of the first occurrence of the character in the character sequence.
Now, coming to you question. In your scenario indexOf and charAt will behave same because you are passing ONLY character. And, since internally, But, imagine, you have a String and you wanted to check and get the index of it from another long String. Then what would you do ? There comes indexOf

A: I know this doesn't necessarily solve your question about the differences between the mentioned methods, but others have answered well enough on that.
You want the sum of the positions in the alphabet of the letters of a String? We can do that in one loop with some arithmetic, without the added overhead of the inner loops or the alpha constant.
Like so:
public static int getWordValue(String word) {
    int value = 0; //total word value
    for(char c : word.toLowerCase().toCharArray()) { //iterate over character array of lower case string
            int charAsInt = (int) c; //cast char to int, giving the ASCII value
            if(charAsInt <= 122 && charAsInt >= 97) { //122 is the ASCII value of 'z', and 97 is 'a'
                value += (charAsInt - 96); //only subtract 96 because we want 'a' to be 1, not 0
            }
     }
    return value;
}

If the reason this works is unclear to you now, it will become evident upon examining an ASCII to decimal table. Let's check one out.

Make note of the values of lowercase 'a' and lowercase 'z'. They are our lower and upper bounds, respectively. We simply loop over each lower case character, converting it to its ASCII decimal value with an int cast. Then we subtract our ASCII value by the value of 'a', minus one.


text:
Q: How to make a web based appliaction to call on cell phone I want to make a web page in PHP from there users can easily call to any mobile numbers how is this possible in PHP?

A: I think you're looking for something similar to Google Talk Developer API with the libjingle kit.
(Considering that's about as close to voice and calls you'll get to without finding a company with a phone number and SDK--Google voice I don't think has an SDK).
Additionally, you could Google "VOIP SDK" and see what you get.

A: If you don't need synchronous voice communication (i.e.: a pre-recorded message is fine) then Twilio has a wonderful HTTP API for interfacing with telephones.


text:
Q: Remove a Student ID from an ArrayList, and display all the courses added into the arrayList Below is a case that should remove the student ID, running in main testClass. However is not removing anything from the arrayList. I think 'findIdNum' should be used somehow in the 'else' statement part of the code, but i don't know how to.
Main question: How to remove the ID from arrayList so that when i go to admissions and view all students, the one that was removed should not pop up in display.
   case 1: //Drop the student (BUG101: NOTHING HAPPENS)

            String findIdNum = GetData.getString("Enter Student ID that needs to be dropped.");
            db.search(findIdNum);
            if(!db.inList())
                JOptionPane.showMessageDialog(null, "The ID: " + findIdNum + " is not in the databse.");
            else
            {
                 int index = db.getIndex();
                 db.add(db.remove(index));
                 JOptionPane.showMessageDialog(null,"Student" + findIdNum + " removed from the system.");
            }

   break;

Another bug in main testClass was that only the first name of the course that was from a userInput would come to display, rather than all of the courses.
Main question: How can i have all the courses display from the arrayList after userInput types in (i.e MAT200, then MAT3000) both MAT2000 and MAT3000 should display rather than MAT2000 alone.
case 2:

      ArrayList getList = db.getList();
      ArrayList getCourseList = db.getCourseList();

      if(getCourseList.isEmpty())
         JOptionPane.showMessageDialog(null, "No courses in the cart.");
      else
         {
         String x = "";
         int length = db.getSize();
         try
            {
            for(int i = 0; i < length; i++ )

            {
             StudentCourse    sq = (StudentCourse)getCourseList.get(i);
             StudentAccounts q = (StudentAccounts)getList.get(i);

             x += "Student ID:\t"  + q.getStudent().getId()+
                  "\nName:\t"      + q.getStudent().getName().getFirst()+ "
                                   "+q.getStudent().getName().getLast() +
                  "\nDate:\t"        + df.format(now)+
                  "\nCourses:\t"   + sq.getCourse() + "\n";

            }
            display(x, "All Students" , JOptionPane.INFORMATION_MESSAGE);
            }
        catch (IndexOutOfBoundsException e){}
       }
   break;

Below is the DataBase Class
import java.util.ArrayList;

public class DataBase
{
        ArrayList <StudentAccounts> list;
        ArrayList <StudentCourse> courseList;

        StudentAccounts sa ;
        StudentCourse sc;
        int index;
        boolean found = false;

        DataBase()
        {
                list = new ArrayList<StudentAccounts> ();                                                       //Inserts a new Student acount into the ArrayList
                courseList = new ArrayList <StudentCourse> ();
        }

        ArrayList getList()                 {return list;}
        ArrayList getCourseList()           {return courseList; }

        StudentCourse getCourses()          {return sc;}
        StudentCourse removeCourse(int d)   {return courseList.remove(d); }
        StudentAccounts getStudent()        {return sa;}
        StudentAccounts remove(int d)       {return list.remove(d); }

        boolean inList()                    {return found;}                                                                                //Looks in the ArrayList
        boolean isEmpty()                   {return list.isEmpty();}
        int getIndex()                      {return list.indexOf(sa);}
        int getSize()                       {return list.size();}                                                                             // return the amount of strings in the Array
        int getCourseSize()                 {return courseList.size(); }

        void add(StudentAccounts s)         {list.add(s);}
        void add(StudentCourse sc)          {courseList.add(sc);}

         void search(String key){
                  found = false;
                  int i = 0;
                  while (!found && i < getSize() )
                  {
                             StudentAccounts sl = list.get(i);
                             if(sl.getStudent().getId().equalsIgnoreCase(key))
                             {
                                 sa = sl;
                                 found = true;
                                 index = i;
                             }
                             else{}
                 i++;
                 }
         }
}

Below is class Student
package student;

//This class does 1 task, obtains student information.

public class Student
{
        private Name name;
        private String idNUM;
        StudentCourse course;

        public Student(Name n, String  idNum)
        {
                    this.name    = n;
                    this.idNUM = idNum;
        }

        public void changeIdNumber(String id)
        {
                    idNUM = id;
        }

        public Name getName()                     {return name; }
        public String getId()                     {return idNUM; }
}

Below is StudentAccounts class
    public class StudentAccounts
    {
        public Student stud;

        public StudentAccounts (Student s) {this.stud = s; }
        public Student getStudent()        {return stud; }
    }

Below is the class StudentCourse
public class StudentCourse
{
        public String sc;

        public StudentCourse(String s) {sc = s;}
        public String getCourse()      {return sc; }
}

A: What is this line meant to do?  db.add(db.remove(index));
You are removing it and then re-adding it, so that's why it isn't removed.
Q2:
What are you iterating through here
for(int i = 0; i < length; i++ )

Students?
But then you do
StudentCourse    sq = (StudentCourse)getCourseList.get(i);

So if i is the student index, does the line above make sense?


text:
Q: In Flash, how can you give a graphic image an instance name (to access it in AS)? New to flash.  When playing with a dummy 'tutorial' app, we saw that when we added a text box to a layer, Flash allowed us to give it an instance name, which was then available to us in ActionScript for things like setting its text, size or visibility.
However, when we added a png file, there was no place to type an instance name, so I'm not sure how we access that object from ActionScript.
Now I know I can simply assign the image to its own layer, than manipulate the layer, but in our case, we have a 6 x 6 matrix of images that we just need to show or hide individually, and creating 36 layers (as opposed to a single layer with 36 images on it) just seems crazy to me!
So how can you target specific images on a layer from ActionScript?

A: If you're planning on keeping things laid out on the stage/timeline, then:
Select the image, click Modify > Convert to Symbol. From there you'll be able to turn it into a MovieClip, and you can assign MovieClips instance names.
UPDATE:
If what you'd like to do is have 36 copies of the same bitmap that you can interact with via ActionScript, you'll be better off instantiating all of those instances programmatically:
Convert the bitmap into a MovieClip as above. That Symbol is now in your library - right click on it and click "Properties". In the "ActionScript Linkage" section, click to enable "Export for ActionScript". In the "Class" dialogue, give it a class name, like MyBitmapClass. You've now made that MovieClip available as a class.
To create 36 copies of it on the stage programmatically:
var numberOfCopies:int = 36;
var myBitmaps:Array = [];

for (var i:int = 0; i < numberOfCopies; i++)
{
    var myBitmap:MyBitmapClass = new MyBitmapClass();
    addChild(myBitmap);

    myBitmaps[i] = myBitmap;
}

Of course, all you'll see if you run this is "one" bitmap, because all 36 are laying on top of each other. To move an individual bitmap, you can access its instance through the array we made:
//move myBitmap #5 to an x position of 200 and y position of 500;
myBitmaps[4].x = 200;
myBitmaps[4].y = 500;

(Keep in mind that the array positions start at 0, so that's why bitmap #5 is actually at index 4 - 0, 1, 2, 3, 4)