Receiving SSL error when trying to connect swift client to socket.io server

Question: I am setting up a Socket.io server in Node.js and client in Swift to implement a real-time chat app.
On the server side, here is the code:
const express = require('express');
const app = express();
const port = process.env.PORT || 8080;
const server = app.listen(port, () => {
    console.log(`A Node Js API is listening on port: ${port}`);
});
const io = require("socket.io")(server, {
    rejectUnauthorized: false
});

//set socket.io listeners
io.on('connection', (socket) => {
  console.log('a user connected');

  socket.on('disconnect', () => {
    console.log('user disconnected');
  });

  socket.on("connect_error", (err) => {
    console.log(`connect_error due to ${err.message}`);
    });
});

On the client side, here is the code:
import SocketIO

class SocketIOManager: NSObject {
    static let sharedInstance = SocketIOManager()
    static let manager = SocketManager(socketURL: URL(string: "https://localhost:8080")!, config: [.log(true), .compress])
    let socket = manager.defaultSocket

    func establishConnection() {
        socket.on("test") { dataArray, ack in
            print(dataArray)
        }
        socket.connect()
    }

    func closeConnection() {
        socket.disconnect()
    }
}

I call establishConnection() in AppDelegate in the applicationDidBecomeActive() method. When establishConnection() is getting called, I receive the following SSL Error:
LOG SocketManager: Trying to reconnect
LOG SocketIOClient{/}: Handling event: reconnectAttempt with data: [-2]
LOG SocketManager: Scheduling reconnect in 25.7991450561197s
LOG SocketEngine: Starting engine. Server: https://localhost:8080
LOG SocketEngine: Handshaking
LOG SocketEnginePolling: Doing polling GET https://localhost:8080/socket.io/?transport=polling&b64=1
...
finished with error [-1200] Error Domain=NSURLErrorDomain Code=-1200 "An SSL error has occurred and a secure connection to the server cannot be made."
UserInfo={NSErrorFailingURLStringKey=https://localhost:8080/socket.io/?transport=polling&b64=1, NSLocalizedRecoverySuggestion=Would you like to connect to the server anyway?, _kCFStreamErrorDomainKey=3,
_NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <A81C6803-9CF8-4930-A6C8-0C633C165D25>.<1>, _NSURLErrorRelatedURLSessionTaskErrorKey

I've tried editing Info.plist to change the App Transport Security Settings, but I'm still receiving the error. What could be going wrong?
Answer: For anyone struggle that issue, here's a working solution. you should use the .secure(true), .selfSigned(true) options and the URLAuthenticationChallenge.
class ServerLiveDataSocket : NSObject
{

    static let shared = ServerLiveDataSocket()

    var manager : SocketManager!
    var socket : SocketIOClient!

    func initSocketService(symbols : [String], dataPovider : DataProvider)
    {
        manager = SocketManager(socketURL: URL(string: "YOUR_HTTPS_URL_ADDRESS")!, config: [.log(true),
        .compress, .secure(true), .selfSigned(true), .sessionDelegate(self)])
        socket = manager.defaultSocket
        socket.on("users", callback: { data,ack in
            print(data)
        })
        socket.on(clientEvent: .connect) { data, ack in
            self.socket.emit("userNew", userData)
        }
        socket.connect()
    }

}
extension ServerLiveDataSocket : URLSessionDelegate
{
    func urlSession(_ session: URLSession, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) {
        completionHandler(.useCredential, URLCredential(trust: challenge.protectionSpace.serverTrust!))
    }
}


Apply function to return data based on next rows

Question: Hello guys I have a dataframe ready_df that looks like this:

timestamp
Latitude_1
Longtitude_1
Name
Latitude_2
Longtitude_2

2021-03-03 08:00:00.100
NaN
NaN
NaN
12.3456
12.3456

2021-03-03 08:00:00.300
NaN
NaN
NaN
12.3456
12.3456

2021-03-03 08:00:00.500
12.3456
12.3456
Billy
NaN
NaN

I have to fill column Name with values for which Latitude_2    Longtitude_2 == Latitude_1    Longtitude_1
I created a function which i called filler(), here is the code of the function:
def filler(Nan_lon, Full_lon, Nan_lat, Full_lat, Designated_col):
    if ready_df[Nan_lon] == ready_df[Full_lon].iloc[1] and ready_df[Nan_lan] == ready_df[Full_lan].iloc[1]:
        return ready_df[Designated_col].iloc[1]
    elif ready_df[Nan_lon] == ready_df[Full_lon].iloc[2] and ready_df[Nan_lan] == ready_df[Full_lan].iloc[2]:
        return ready_df[Designated_col].iloc[2]
    elif ready_df[Nan_lon] == ready_df[Full_lon].iloc[3] and ready_df[Nan_lan] == ready_df[Full_lan].iloc[3]:
        return ready_df[Designated_col].iloc[3]
    else:
        return np.NaN

I want to check maximum 3 rows ahead of current row if 2 rows before are nan else i want to return nan. However when i use it to fill the column like this:
ready_df['NAME'] = ready_df.apply(lambda x: filler(Nan_lon=x.Longtitude_2, Full_lon=x.Longtitude_1,
                                                           Nan_lat=x.Latitude_2, Full_lat=x.Latitude_1,
                                                           Designated_col=ready_df['NAME']))

I get an error: AttributeError: 'Series' object has no attribute 'Longitude'
Whole idea is to fill column Name - then i planned to change the function for each column so I have each NaN filled with correct values. Dataframe has 130k rows. Could you please explain why is my function not working and suggest any improvements, thanks :)
EDIT:
| timestamp | Latitude_1 | Longtitude_1 | Name | Latitude_2 | Longtitude_2 |
| --------- | ---------- | ------------ | ---- | ---------- | ------------ |
| 2021-03-03 08:00:00.100 | NaN | NaN | NaN | 12.3456 | 12.3456 |
| 2021-03-03 08:00:00.300 | NaN | NaN | NaN | 12.3456 | 12.3456 |
| 2021-03-03 08:00:00.500 | 12.3456 | 12.3456 | Billy | NaN | NaN |
| 2021-03-03 08:00:00.700 | 21.345| 21.345| John| NaN | NaN |
| 2021-03-03 08:00:00.900 | 21.345| 21.345| John| NaN | NaN |
| 2021-03-03 08:00:01.100 | 12.3456 | 12.3456 | Billy | NaN | NaN |
| 2021-03-03 08:00:01.300 | NaN | NaN | NaN | 21.345| 21.345|
| 2021-03-03 08:00:01.500 | NaN | NaN | NaN | 21.345| 21.345|
| 2021-03-03 08:00:01.700 | 12.3456 | 12.3456 | Billy | NaN | NaN |

Expected output:

timestamp
Latitude_1
Longtitude_1
Name
Latitude_2
Longtitude_2

2021-03-03 08:00:00.100
12.3456
12.3456
Billy
12.3456
12.3456

2021-03-03 08:00:00.300
12.3456
12.3456
Billy
12.3456
12.3456

2021-03-03 08:00:00.500
12.3456
12.3456
Billy
12.3456
12.3456

2021-03-03 08:00:00.700
21.345
21.345
John
21.345
21.345

2021-03-03 08:00:00.900
21.345
21.345
John
21.345
21.345

2021-03-03 08:00:01.100
12.3456
12.3456
Billy
12.3456
12.3456

2021-03-03 08:00:01.300
21.345
21.345
John
21.345
21.345

2021-03-03 08:00:01.500
21.345
21.345
John
21.345
21.345

2021-03-03 08:00:01.700
12.3456
12.3456
Billy
12.3456
12.3456
Answer: Take this with a grain of salt but you might have to fundamentally reconsider how you are you implementing apply() here. And because I don't ultimately know what your result should be, some of this can be out of context.

using apply like this only sends one row of data, but you want to test against three; then repeat each row for the length of the dataframe. You may want to consider using some sort of slice instead where you can iterate through the dataframe taking three rows at a time
However, your error on x.Longtitude_2 is because that syntax thinks there an attribute of x, so using x['Longitutde_2'] clears that error, but then you get a keyword error, which is cleared by using argument axis=1, which leads to another error 'NAME' not being defined. This argument Designated_col=ready_df['NAME'] shouldn't be in in the lambda or the functions argument list as you are trying to create it by ready_df['NAME'] = ready_df....
Beyond that you are passing Nan_lon=x.Longtitude_2 which is a value to your function and ready_df[Nan_lon] which throws key error because it's looking for ready_df['12.3456'] where I think you want ready_df['Longtitude_2']
Didn't get past this point....

If you can post a few more lines of ready_df AND your expected output dataframe, you may get better advice.
Comment: Hi Jonathan I just edited the question with all the details like you asked, now I know that apply() is definetly not the way for this sort of stuff, thank you for that. Do you have any suggestions after seeing edited question?


UITextField textColor updates in iOS10, not in iOS 11

Question: My code fragment is very small:
self.textField.textColor = color

This is called in response to user interaction. It has been working for years. On my iOS 10 device it still works. On my iOS 11 device, the color does not change until I tap in the text field.
Bug? Feature? Workaround? Suggestions welcome.
Comment: Provide more context. Show the whole method this line is in.
Comment: Did you set a break point at this line with iOS 11? Make sure this called.
Comment: I did show the whole method. The method is being called. At the risk of repeating myself, the exact same code works on iOS 10 (and has worked on 9, 8, & 7) but fails on iOS 11.
Comment: Looping back in here, looks like this works as intended in iOS 12 (similarly to 10 and older). This seems like a bug in iOS 11.
Answer: You might need to update/reset your UITextField text right after the color change:
self.textField.textColor = color
self.textField.text = "Hi! I've changed of color!!"

Andrew update, more practical stuff:
 self.textField.textColor = color
 self.textField.text =  self.textField.text

Comment: In fact, adding the line self.textField.text = self.textField.text does fix the problem. Why didn't I think of that? The mystery remains, and from the symptoms I really do suspect it's a new bug/feature in the OS.
Answer: I can trigger the text color change to take effect by adding this line below the single line cited above:
self.textField.text = self.textField.text

However, given the facts above, it still looks to me like a bug outside of my code. Or, at least, a change of the implicit class contract.


Updating notification text in Android after expanding the notification

Question: I'm trying to create a notification which changes its text completely after being expanded.
For example, the normal non-expanded notification would say something like "Tap to do X" which would have a pending intent.
If the user expands the notification, the text would then change to say "Here are some actions you can do" with a few actions added to the notification.
Answer: Set up the notification builder like this:
<code>NotificationCompat.Builder builder=new NotificationCompat.Builder(mContext);

builder.setContentTitle("Title!");
builder.setContentText("Tap to do x");
builder.setTicker("Ticker");
builder.setSmallIcon(drawable);
builder.setAutoCancel(true);
builder.addAction(icon, "Open App", resultPendingIntent)
builder.setContentIntent(resultPendingIntent)
builder.setPriority(Notification.PRIORITY_MAX);

//Content hen expanded
NotificationCompat.BigTextStyle bigText=new NotificationCompat.BigTextStyle();
bigText.bigText("Here are some actions you can do");
bigText.setSummaryText("Summary line");
bigText.setBigContentTitle("expanded title");

builder.setStyle(bigText);

Intent intent=new Intent(mContext, YourActivity.class);
TaskStackBuilder stackBuilder = TaskStackBuilder.create(mContext);
stackBuilder.addParentStack(ParentActivity.class);

stackBuilder.addNextIntent(intent);
PendingIntent pendingIntent=stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT);

builder.setContentIntent(pendingIntent);

NotificationManager manager=(NotificationManager)
        mContext.getSystemService(Context.NOTIFICATION_SERVICE);

manager.notify(0, builder.build());
</code>


How to downgrade grub from 2.04 to 2.02 on ubuntu 19.04?

Question: There seems to be problems loop mounting ISO files with grub 2.04, how to downgrade to grub 2.02?
Grub 2.02 works for loop mounting ISO files on a Bootable pendrive.
I think the main problem comes when booting in UEFI mode.
Reference: Grub command loopback loop… does not work on Ubuntu 19.10 Grub command `loopback loop...` does not work on Ubuntu 19.10
Further Reference: LaunchPad https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/1851311
Comment: Please describe the real problem. The question looks like an [XY problem](https://meta.stackexchange.com/q/66377/295481)
Comment: @sudodus: Ah Ha! So for an ISO booter, I use mkusb to make the foundation using say 18.04 and then it should have no problem booting 19.10 and newer ISOs. Very clever. Please drop this solution into an official answer.
Comment: All my flash drives have grub and most are still grub 2.02.  Some have full installs and only one or two may be 2.04, and some just have grub for loopmounting a variety of repair ISOs. I only use 25GB for / (root), so still have 14.04,16. 04 & 18.04 on my boot SSD. I am planning on overwriting 14.04 with 20.04, but already have 20.04 on HDD to test. Microcenter store is just a couple of miles away. (not a plug for Microcenter, but flash drives are inexpensive & for me have worked well). The real problem is price is lower or capacity higher so I keep buying more. I try not to go too often. :)
Comment: One simple way is to install an older version of Ubuntu  for example 18.04.1 LTS alongside the other operating system(s). Then run `sudo update-grub` to get access to the other operating system(s). It costs a few GB, so there might be better methods.
Comment: @oldfred: Yes they are not only getting cheaper and larger, they are not lasting near as long. Some of these super multi-layer drives are only good for a few hundred writes and not 10000+ writes like the old flash drives.
Answer: I started by suggesting:

One simple way to get grub 2.02 is to install an older version of
  Ubuntu for example 18.04.1 LTS alongside the other operating
  system(s). Then run sudo update-grub to get access to the other
  operating system(s). It costs a few GB, so there might be better
  methods.

You brought this idea one step further:

Ah Ha! So for an ISO booter, I use mkusb to make the foundation using
  say 18.04 and then it should have no problem booting 19.10 and newer
  ISOs. Very clever. Please drop this solution into an official answer.

And you have a solution :-) or should we say a workaround until the bug in grub 2.04 is squashed :-/
Answer: Workaround for Booting ISO's with GRUB 2.04
I put rmmod tpm on it's own line in grub.cfg, up top, just above the fi line allows booting ISO's in UEFI mode
Booting the USB in BIOS mode, grub 2.04, works okay.
Booting the USB in UEFI mode, grub 2.04, also works okay. Both modes boot with no no such module error messages.
Both modes proceed to Disk Check unless fsck.mode=skip is added to the GRUB menu entry.
Neither mode goes to the Try/Install screen when booting, nor ask to remove drive and press enter when quitting.


Why is my FileReader/BufferReader returning both the sentence and null?

Question: The main thing I am trying to do is input a .txt file into a 2d char array. The problem is that no data is being saved into the array, so I'm thinking my problem lies with the fact that there is no in-between string from the .txt file to the array. I tried using file and buffered readers so I would have a string, and it works, but it adds null many many times. Can someone point out what I am doing wrong here? (I am very new to java, sorry for any errors in question format and such)
See code below, where I'm encountering the problem.
    Scanner scanner = new Scanner(new File("Code.txt"));

    try {
        //had a problem trying to just get the chars out from a file just as a string
        // so to a filereader we go!
            FileReader Enigma = new FileReader("Code.txt");
            // when looking at filereaders, i found bufferedreaders
            // they seem to help with reading chars better than the filereader alone
            BufferedReader CryptoMachine = new BufferedReader(Enigma);

            for (i = 0; i <= rows-1; i++)
            {

                for (j = 0; j <= columns-1; j++)
                {
                    sentence = CryptoMachine.readLine();
                    System.out.print(sentence);
                }
            }
            CryptoMachine.close();
        }
        catch (FileNotFoundException e) {
            System.out.println("No file found");
        }

Return I get:
This is ridiculously hardnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull

Whole code:
    import java.io.BufferedReader;
    import java.io.File;
    import java.io.FileNotFoundException;
    import java.io.FileReader;
    import java.io.IOException;
    import java.util.Scanner;

    // TODO block code
    public class Enigma {
    // TODO block code
    public static void main(String[] args) throws IOException {

        // double array set up here
        String sentence = "";
        int rows = 6;
        int columns = 7;
        char[][] RotaryMachine = new char[rows][columns];
        boolean flag = false;

        // told this lets me declare variables on the same line
        int i = 0,j = 0;
        // scanner to scan a file here
        Scanner scanner = new Scanner(new File("Code.txt"));

    try {
        //had a problem trying to just get the chars out from a file just as a string
        // so to a filereader we go!
            FileReader Enigma = new FileReader("Code.txt");
            // when looking at filereaders, i found bufferedreaders
            // they seem to help with reading chars better than the filereader alone
            BufferedReader CryptoMachine = new BufferedReader(Enigma);

            for (i = 0; i <= rows-1; i++)
            {

                for (j = 0; j <= columns-1; j++)
                {
                    sentence = CryptoMachine.readLine();
                    System.out.print(sentence);
                }
            }
            CryptoMachine.close();
        }
        catch (FileNotFoundException e) {
            System.out.println("No file found");
        }

            for(i = 0; j > columns && !flag;++i)
            {
                if(i < rows && !scanner.hasNext())
                {
                    System.out.println("The English have our codes");
                    flag = true;
                }
                RotaryMachine[i][j] = scanner.next().charAt(0);
                if(i > 6)
                {
                    j++;
                }
                RotaryMachine[i][j] = '*';
            }

    //  RotaryMachine[0][0] = 'a';

            //now, to hopefully code the scrambler section properly, for Enigma to work!
            // V2 seems to keep letters really close together
            for(i=0;i < columns;++i)
            {
            for(j = 0;j < rows;++j)
                {
                    System.out.printf("%c", RotaryMachine[j][i]);
                }
            }

            // V1 of the code   seems to space out the letters
        //      for(j=0;j < rows;++j)
            //  {
        //          for(i = 0;i < columns;++i)
            //      {
        //              System.out.printf("%c", RotaryMachine[j][i]);
            //      }
        //      }

            }
    }

Comment: it is the indication of end of file. [Documentation](https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/io/BufferedReader.html#readLine()) of `readLine`: *"**Returns:**...or null if the end of the stream has been reached..."*
Comment: one line, then do not repeat `readLine`, just call it once
Comment: If there is only 1 line then why do you call `readLine()` 42 times? There's your problem. Call it once and spit the string into characters.
Comment: Are you sure there are 6*7 lines in the file?
Comment: There is only one line, I want to take a sentence and seperate them into characters, including spaces, and input them into the array
Comment: I'm just not sure how to properly do that
Comment: to get the `char`s from a String use `sentence.toCharArray()` (or `sentence.charAt(index)` for a single one) - to split into Strings `sentence.split("")` (mostly not recommended, unless you really need one char Strings)
Comment: ok this is awesome, I appreciate the help
Comment: how can I mark this question as answered? I'm a bit new to Stack Overflow
Comment: you can also read just one `char` from file `(char) CryptoMachine.read()`, but then you must manage end of line or end of file and such
Comment: @Aether Since there are no answers, only comments, an answer cannot be marked as the solution. You can create an answer of your own if you so wish and then mark that as the solution or allow others to consolidate these comments into an answer and mark that.
Comment: Aha, okay, might do just that once I'm done programming, thanks for the input
Comment: I'm feeling a bit bored today, went ahead and made an answer :)
Answer: Since the file being read only has one line, readLine will return null for every call past the first since there are no more lines to read.
You can String.split the initial string after reading it if you so desire.


Proguard Issue - Classes.jar error

Question: I have seen all of SO also followed few steps given but I couldn't fix the issue. Strangely I am still getting this issue:
1 error and 176 warning when I try to build my project.
<code>Note: there were 251 duplicate class definitions.
      (http://proguard.sourceforge.net/manual/troubleshooting.html#duplicateclass)
Warning:com.loopj.android.http.HttpDelete: can't find superclass or interface org.apache.http.client.methods.HttpEntityEnclosingRequestBase
Warning:com.loopj.android.http.HttpGet: can't find superclass or interface org.apache.http.client.methods.HttpEntityEnclosingRequestBase
Warning:com.loopj.android.http.HttpPatch: can't find superclass or interface org.apache.http.client.methods.HttpEntityEnclosingRequestBase
Warning:com.loopj.android.http.MyRedirectHandler: can't find superclass or interface org.apache.http.impl.client.DefaultRedirectHandler
Warning:com.loopj.android.http.PersistentCookieStore: can't find superclass or interface org.apache.http.client.CookieStore
Warning:com.loopj.android.http.RetryHandler: can't find superclass or interface org.apache.http.client.HttpRequestRetryHandler
Warning:com.loopj.android.http.AsyncHttpClient: can't find referenced class org.apache.http.conn.scheme.SchemeRegistry
Warning:com.loopj.android.http.AsyncHttpClient: can't find referenced class org.apache.http.conn.scheme.Scheme
Warning:com.loopj.android.http.AsyncHttpClient: can't find referenced class org.apache.http.conn.scheme.PlainSocketFactory
Warning:com.loopj.android.http.AsyncHttpClient: can't find referenced class org.apache.http.conn.scheme.Scheme
Warning:com.loopj.android.http.AsyncHttpClient: can't find referenced class org.apache.http.conn.scheme.SchemeRegistry
Warning:com.loopj.android.http.AsyncHttpClient: can't find referenced class org.apache.http.conn.params.ConnManagerParams
Warning:com.loopj.android.http.AsyncHttpClient: can't find referenced class org.apache.http.conn.params.ConnPerRouteBean
Warning:com.loopj.android.http.AsyncHttpClient: can't find referenced class org.apache.http.conn.params.ConnManagerParams
Warning:com.loopj.android.http.AsyncHttpClient: can't find referenced class org.apache.http.impl.client.DefaultHttpClient
Warning:com.loopj.android.http.AsyncHttpClient: can't find referenced class org.apache.http.client.protocol.ClientContext
Warning:com.loopj.android.http.AsyncHttpClient: can't find referenced class org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager
Warning:com.loopj.android.http.AsyncHttpClient: can't find referenced class org.apache.http.impl.client.DefaultHttpClient
Warning:com.loopj.android.http.AsyncHttpClient: can't find referenced class org.apache.http.client.params.ClientPNames
Warning:com.loopj.android.http.AsyncHttpClient: can't find referenced class org.apache.http.impl.client.DefaultHttpClient
Warning:com.loopj.android.http.AsyncHttpClient: can't find referenced class org.apache.http.conn.params.ConnRoutePNames
Warning:com.loopj.android.http.AsyncHttpClient: can't find referenced class org.apache.http.impl.client.DefaultHttpClient
Warning:com.loopj.android.http.AsyncHttpClient: can't find referenced class org.apache.http.auth.AuthScope
Warning:com.loopj.android.http.AsyncHttpClient: can't find referenced class org.apache.http.auth.UsernamePasswordCredentials
Warning:com.loopj.android.http.AsyncHttpClient: can't find referenced class org.apache.http.client.CredentialsProvider
Warning:com.loopj.android.http.AsyncHttpClient: can't find referenced class org.apache.http.impl.client.DefaultHttpClient
Warning:com.loopj.android.http.AsyncHttpClient: can't find referenced class org.apache.http.conn.ClientConnectionManager
Warning:com.loopj.android.http.AsyncHttpClient: can't find referenced class org.apache.http.auth.AuthScope
Warning:com.loopj.android.http.AsyncHttpClient: can't find referenced class org.apache.http.impl.client.DefaultHttpClient
Warning:com.loopj.android.http.AsyncHttpClient: can't find referenced class org.apache.http.client.CredentialsProvider
Warning:com.loopj.android.http.AsyncHttpClient: can't find referenced class org.apache.http.client.methods.HttpHead
Warning:com.loopj.android.http.AsyncHttpClient: can't find referenced class org.apache.http.client.methods.HttpUriRequest
Warning:com.loopj.android.http.AsyncHttpClient: can't find referenced class org.apache.http.client.methods.HttpPost
Warning:com.loopj.android.http.AsyncHttpClient: can't find referenced class org.apache.http.client.methods.HttpEntityEnclosingRequestBase
Warning:com.loopj.android.http.AsyncHttpClient: can't find referenced class org.apache.http.client.methods.HttpPut
Warning:com.loopj.android.http.AsyncHttpClient: can't find referenced method 'void setHeaders(org.apache.http.Header[])' in program class com.loopj.android.http.HttpDelete
Warning:com.loopj.android.http.AsyncHttpClient: can't find referenced class org.apache.http.client.methods.HttpEntityEnclosingRequestBase
Warning:com.loopj.android.http.AsyncHttpClient: can't find referenced class org.apache.http.client.methods.HttpUriRequest
Warning:com.loopj.android.http.AsyncHttpClient: can't find referenced class org.apache.http.conn.scheme.SchemeRegistry
Warning:com.loopj.android.http.AsyncHttpClient: can't find referenced class org.apache.http.conn.ClientConnectionManager
Warning:com.loopj.android.http.AsyncHttpClient: can't find referenced class org.apache.http.client.CredentialsProvider
Warning:com.loopj.android.http.AsyncHttpClient: can't find referenced class org.apache.http.auth.AuthScope
Warning:com.loopj.android.http.AsyncHttpClient: can't find referenced class org.apache.http.auth.Credentials
Warning:com.loopj.android.http.AsyncHttpClient: can't find referenced class org.apache.http.client.methods.HttpUriRequest
Warning:com.loopj.android.http.AsyncHttpClient: can't find referenced class org.apache.http.client.methods.HttpEntityEnclosingRequestBase
Warning:com.loopj.android.http.AsyncHttpClient: can't find referenced class org.apache.http.impl.client.DefaultHttpClient
Warning:com.loopj.android.http.AsyncHttpClient: can't find referenced class org.apache.http.conn.scheme.PlainSocketFactory
Warning:com.loopj.android.http.AsyncHttpClient: can't find referenced class org.apache.http.conn.params.ConnManagerParams
Warning:com.loopj.android.http.AsyncHttpClient: can't find referenced class org.apache.http.client.CredentialsProvider
Warning:com.loopj.android.http.AsyncHttpClient: can't find referenced class org.apache.http.conn.ClientConnectionManager
Warning:com.loopj.android.http.AsyncHttpClient: can't find referenced class org.apache.http.client.methods.HttpUriRequest
Warning:com.loopj.android.http.AsyncHttpClient: can't find referenced class org.apache.http.impl.client.DefaultHttpClient
Warning:com.loopj.android.http.AsyncHttpClient: can't find referenced class org.apache.http.conn.scheme.SchemeRegistry
Warning:com.loopj.android.http.AsyncHttpClient: can't find referenced class org.apache.http.conn.ClientConnectionManager
Warning:com.loopj.android.http.AsyncHttpClient: can't find referenced class org.apache.http.client.HttpClient
Warning:com.loopj.android.http.AsyncHttpClient: can't find referenced class org.apache.http.client.CookieStore
Warning:com.loopj.android.http.AsyncHttpClient: can't find referenced class org.apache.http.conn.scheme.SchemeRegistry
Warning:com.loopj.android.http.AsyncHttpClient: can't find referenced class org.apache.http.conn.ClientConnectionManager
Warning:com.loopj.android.http.AsyncHttpClient: can't find referenced class org.apache.http.conn.scheme.SchemeRegistry
Warning:com.loopj.android.http.AsyncHttpClient: can't find referenced class org.apache.http.client.RedirectHandler
Warning:com.loopj.android.http.AsyncHttpClient: can't find referenced class org.apache.http.auth.AuthScope
Warning:com.loopj.android.http.AsyncHttpClient: can't find referenced class org.apache.http.auth.UsernamePasswordCredentials
Warning:com.loopj.android.http.AsyncHttpClient: can't find referenced class org.apache.http.auth.AuthScope
Warning:com.loopj.android.http.AsyncHttpClient: can't find referenced class org.apache.http.auth.Credentials
Warning:com.loopj.android.http.AsyncHttpClient: can't find referenced class org.apache.http.auth.AuthScope
Warning:com.loopj.android.http.AsyncHttpClient: can't find referenced class org.apache.http.auth.Credentials
Warning:com.loopj.android.http.AsyncHttpClient: can't find referenced class org.apache.http.client.methods.HttpUriRequest
Warning:com.loopj.android.http.AsyncHttpClient: can't find referenced class org.apache.http.client.methods.HttpEntityEnclosingRequestBase
Warning:com.loopj.android.http.AsyncHttpClient: can't find referenced class org.apache.http.impl.client.DefaultHttpClient
Warning:com.loopj.android.http.AsyncHttpClient: can't find referenced class org.apache.http.client.methods.HttpUriRequest
Warning:com.loopj.android.http.AsyncHttpClient: can't find referenced class org.apache.http.impl.client.DefaultHttpClient
Warning:com.loopj.android.http.AsyncHttpClient: can't find referenced class org.apache.http.client.methods.HttpUriRequest
Warning:com.loopj.android.http.AsyncHttpClient: can't find referenced class org.apache.http.impl.client.DefaultHttpClient
Warning:com.loopj.android.http.AsyncHttpClient: can't find referenced class org.apache.http.client.methods.HttpUriRequest
Warning:com.loopj.android.http.AsyncHttpClient: can't find referenced class org.apache.http.impl.client.DefaultHttpClient
Warning:com.loopj.android.http.AsyncHttpClient: can't find referenced class org.apache.http.client.methods.HttpUriRequest
Warning:com.loopj.android.http.AsyncHttpClient: can't find referenced class org.apache.http.client.methods.HttpEntityEnclosingRequestBase
Warning:com.loopj.android.http.AsyncHttpClient$3: can't find referenced class org.apache.http.client.protocol.ClientContext
Warning:com.loopj.android.http.AsyncHttpClient$3: can't find referenced class org.apache.http.auth.AuthState
Warning:com.loopj.android.http.AsyncHttpClient$3: can't find referenced class org.apache.http.client.CredentialsProvider
Warning:com.loopj.android.http.AsyncHttpClient$3: can't find referenced class org.apache.http.auth.AuthState
Warning:com.loopj.android.http.AsyncHttpClient$3: can't find referenced class org.apache.http.auth.AuthScope
Warning:com.loopj.android.http.AsyncHttpClient$3: can't find referenced class org.apache.http.client.CredentialsProvider
Warning:com.loopj.android.http.AsyncHttpClient$3: can't find referenced class org.apache.http.impl.auth.BasicScheme
Warning:com.loopj.android.http.AsyncHttpClient$3: can't find referenced class org.apache.http.auth.AuthState
Warning:com.loopj.android.http.AsyncHttpClient$3: can't find referenced class org.apache.http.client.CredentialsProvider
Warning:com.loopj.android.http.AsyncHttpClient$3: can't find referenced class org.apache.http.auth.AuthScope
Warning:com.loopj.android.http.AsyncHttpClient$3: can't find referenced class org.apache.http.auth.Credentials
Warning:com.loopj.android.http.AsyncHttpClient$3: can't find referenced class org.apache.http.auth.AuthState
Warning:com.loopj.android.http.AsyncHttpClient$3: can't find referenced class org.apache.http.client.CredentialsProvider
Warning:com.loopj.android.http.AsyncHttpRequest: can't find referenced class org.apache.http.impl.client.AbstractHttpClient
Warning:com.loopj.android.http.AsyncHttpRequest: can't find referenced class org.apache.http.client.methods.HttpUriRequest
Warning:com.loopj.android.http.AsyncHttpRequest: can't find referenced class org.apache.http.impl.client.AbstractHttpClient
Warning:com.loopj.android.http.AsyncHttpRequest: can't find referenced class org.apache.http.client.HttpRequestRetryHandler
Warning:com.loopj.android.http.AsyncHttpRequest: can't find referenced class org.apache.http.client.methods.HttpUriRequest
Warning:com.loopj.android.http.AsyncHttpRequest: can't find referenced class org.apache.http.client.HttpRequestRetryHandler
Warning:com.loopj.android.http.AsyncHttpRequest: can't find referenced class org.apache.http.impl.client.AbstractHttpClient
Warning:com.loopj.android.http.AsyncHttpRequest: can't find referenced class org.apache.http.client.methods.HttpUriRequest
Warning:com.loopj.android.http.AsyncHttpRequest: can't find referenced class org.apache.http.impl.client.AbstractHttpClient
Warning:com.loopj.android.http.AsyncHttpRequest: can't find referenced class org.apache.http.client.methods.HttpUriRequest
Warning:com.loopj.android.http.AsyncHttpRequest: can't find referenced class org.apache.http.impl.client.AbstractHttpClient
Warning:com.loopj.android.http.AsyncHttpRequest: can't find referenced class org.apache.http.client.methods.HttpUriRequest
Warning:com.loopj.android.http.AsyncHttpRequest: can't find referenced class org.apache.http.client.HttpRequestRetryHandler
Warning:com.loopj.android.http.AsyncHttpResponseHandler: can't find referenced class org.apache.http.client.HttpResponseException
Warning:com.loopj.android.http.BinaryHttpResponseHandler: can't find referenced class org.apache.http.client.HttpResponseException
Warning:com.loopj.android.http.HttpDelete: can't find referenced class org.apache.http.client.methods.HttpEntityEnclosingRequestBase
Warning:com.loopj.android.http.HttpDelete: can't find referenced method 'void setURI(java.net.URI)' in program class com.loopj.android.http.HttpDelete
Warning:com.loopj.android.http.HttpDelete: can't find referenced class org.apache.http.client.methods.HttpEntityEnclosingRequestBase
Warning:com.loopj.android.http.HttpGet: can't find referenced class org.apache.http.client.methods.HttpEntityEnclosingRequestBase
Warning:com.loopj.android.http.HttpGet: can't find referenced method 'void setURI(java.net.URI)' in program class com.loopj.android.http.HttpGet
Warning:com.loopj.android.http.HttpGet: can't find referenced class org.apache.http.client.methods.HttpEntityEnclosingRequestBase
Warning:com.loopj.android.http.HttpPatch: can't find referenced class org.apache.http.client.methods.HttpEntityEnclosingRequestBase
Warning:com.loopj.android.http.HttpPatch: can't find referenced method 'void setURI(java.net.URI)' in program class com.loopj.android.http.HttpPatch
Warning:com.loopj.android.http.HttpPatch: can't find referenced class org.apache.http.client.methods.HttpEntityEnclosingRequestBase
Warning:com.loopj.android.http.MyRedirectHandler: can't find referenced class org.apache.http.impl.client.DefaultRedirectHandler
Warning:com.loopj.android.http.MyRedirectHandler: can't find referenced class org.apache.http.client.params.ClientPNames
Warning:com.loopj.android.http.MyRedirectHandler: can't find referenced class org.apache.http.client.utils.URIUtils
Warning:com.loopj.android.http.MyRedirectHandler: can't find referenced class org.apache.http.impl.client.RedirectLocations
Warning:com.loopj.android.http.MyRedirectHandler: can't find referenced class org.apache.http.client.CircularRedirectException
Warning:com.loopj.android.http.MyRedirectHandler: can't find referenced class org.apache.http.impl.client.RedirectLocations
Warning:com.loopj.android.http.MyRedirectHandler: can't find referenced class org.apache.http.impl.client.DefaultRedirectHandler
Warning:com.loopj.android.http.MyRedirectHandler: can't find referenced class org.apache.http.impl.client.RedirectLocations
Warning:com.loopj.android.http.MyRedirectHandler: can't find referenced class org.apache.http.client.utils.URIUtils
Warning:com.loopj.android.http.MyRedirectHandler: can't find referenced class org.apache.http.impl.client.RedirectLocations
Warning:com.loopj.android.http.MySSLSocketFactory: can't find referenced class org.apache.http.conn.scheme.SchemeRegistry
Warning:com.loopj.android.http.MySSLSocketFactory: can't find referenced class org.apache.http.conn.scheme.Scheme
Warning:com.loopj.android.http.MySSLSocketFactory: can't find referenced class org.apache.http.conn.scheme.PlainSocketFactory
Warning:com.loopj.android.http.MySSLSocketFactory: can't find referenced class org.apache.http.conn.scheme.Scheme
Warning:com.loopj.android.http.MySSLSocketFactory: can't find referenced class org.apache.http.conn.scheme.SchemeRegistry
Warning:com.loopj.android.http.MySSLSocketFactory: can't find referenced class org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager
Warning:com.loopj.android.http.MySSLSocketFactory: can't find referenced class org.apache.http.impl.client.DefaultHttpClient
Warning:com.loopj.android.http.MySSLSocketFactory: can't find referenced class org.apache.http.conn.scheme.PlainSocketFactory
Warning:com.loopj.android.http.MySSLSocketFactory: can't find referenced class org.apache.http.impl.client.DefaultHttpClient
Warning:com.loopj.android.http.MySSLSocketFactory: can't find referenced class org.apache.http.conn.scheme.SchemeRegistry
Warning:com.loopj.android.http.MySSLSocketFactory: can't find referenced class org.apache.http.conn.ClientConnectionManager
Warning:com.loopj.android.http.PersistentCookieStore: can't find referenced class org.apache.http.cookie.Cookie
Warning:com.loopj.android.http.PersistentCookieStore: can't find referenced class org.apache.http.client.CookieStore
Warning:com.loopj.android.http.PersistentCookieStore: can't find referenced class org.apache.http.cookie.Cookie
Warning:com.loopj.android.http.PreemptiveAuthorizationHttpRequestInterceptor: can't find referenced class org.apache.http.client.protocol.ClientContext
Warning:com.loopj.android.http.PreemptiveAuthorizationHttpRequestInterceptor: can't find referenced class org.apache.http.auth.AuthState
Warning:com.loopj.android.http.PreemptiveAuthorizationHttpRequestInterceptor: can't find referenced class org.apache.http.client.CredentialsProvider
Warning:com.loopj.android.http.PreemptiveAuthorizationHttpRequestInterceptor: can't find referenced class org.apache.http.auth.AuthState
Warning:com.loopj.android.http.PreemptiveAuthorizationHttpRequestInterceptor: can't find referenced class org.apache.http.auth.AuthScope
Warning:com.loopj.android.http.PreemptiveAuthorizationHttpRequestInterceptor: can't find referenced class org.apache.http.client.CredentialsProvider
Warning:com.loopj.android.http.PreemptiveAuthorizationHttpRequestInterceptor: can't find referenced class org.apache.http.impl.auth.BasicScheme
Warning:com.loopj.android.http.PreemptiveAuthorizationHttpRequestInterceptor: can't find referenced class org.apache.http.auth.AuthState
Warning:com.loopj.android.http.PreemptiveAuthorizationHttpRequestInterceptor: can't find referenced class org.apache.http.client.CredentialsProvider
Warning:com.loopj.android.http.PreemptiveAuthorizationHttpRequestInterceptor: can't find referenced class org.apache.http.auth.AuthScope
Warning:com.loopj.android.http.PreemptiveAuthorizationHttpRequestInterceptor: can't find referenced class org.apache.http.auth.Credentials
Warning:com.loopj.android.http.PreemptiveAuthorizationHttpRequestInterceptor: can't find referenced class org.apache.http.auth.AuthState
Warning:com.loopj.android.http.PreemptiveAuthorizationHttpRequestInterceptor: can't find referenced class org.apache.http.client.CredentialsProvider
Warning:com.loopj.android.http.RangeFileAsyncHttpResponseHandler: can't find referenced class org.apache.http.client.HttpResponseException
Warning:com.loopj.android.http.RangeFileAsyncHttpResponseHandler: can't find referenced class org.apache.http.client.methods.HttpUriRequest
Warning:com.loopj.android.http.RequestParams: can't find referenced class org.apache.http.client.entity.UrlEncodedFormEntity
Warning:com.loopj.android.http.RequestParams: can't find referenced class org.apache.http.client.utils.URLEncodedUtils
Warning:com.loopj.android.http.RetryHandler: can't find referenced class org.apache.http.client.methods.HttpUriRequest
Warning:com.loopj.android.http.RetryHandler: can't find referenced class org.apache.http.client.HttpRequestRetryHandler
Warning:com.loopj.android.http.RetryHandler: can't find referenced class org.apache.http.client.methods.HttpUriRequest
Warning:com.loopj.android.http.SerializableCookie: can't find referenced class org.apache.http.cookie.Cookie
Warning:com.loopj.android.http.SerializableCookie: can't find referenced class org.apache.http.impl.cookie.BasicClientCookie
Warning:com.loopj.android.http.SerializableCookie: can't find referenced class org.apache.http.cookie.Cookie
Warning:com.loopj.android.http.SerializableCookie: can't find referenced class org.apache.http.impl.cookie.BasicClientCookie
Warning:com.loopj.android.http.SerializableCookie: can't find referenced class org.apache.http.cookie.Cookie
Warning:com.loopj.android.http.SyncHttpClient: can't find referenced class org.apache.http.client.methods.HttpUriRequest
Warning:com.loopj.android.http.SyncHttpClient: can't find referenced class org.apache.http.conn.scheme.SchemeRegistry
Warning:com.loopj.android.http.SyncHttpClient: can't find referenced class org.apache.http.impl.client.DefaultHttpClient
Warning:com.loopj.android.http.SyncHttpClient: can't find referenced class org.apache.http.client.methods.HttpUriRequest
Warning:com.loopj.android.http.SyncHttpClient: can't find referenced class org.apache.http.impl.client.DefaultHttpClient
Warning:com.loopj.android.http.SyncHttpClient: can't find referenced class org.apache.http.client.methods.HttpUriRequest
Warning:com.viewpagerindicator.LinePageIndicator: can't find referenced method 'float ceil(float)' in library class android.util.FloatMath
Warning:library class org.apache.http.conn.scheme.SocketFactory depends on program class org.apache.http.params.HttpParams
Warning:library class org.apache.http.conn.ssl.SSLSocketFactory depends on program class org.apache.http.params.HttpParams
Warning:there were 261 unresolved references to classes or interfaces.
         You may need to add missing library jars or update their versions.
         If your code works fine without the missing classes, you can suppress
         the warnings with '-dontwarn' options.
         (http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedclass)
Warning:there were 2 instances of library classes depending on program classes.
         You must avoid such dependencies, since the program classes will
         be processed, while the library classes will remain unchanged.
         (http://proguard.sourceforge.net/manual/troubleshooting.html#dependency)
Warning:there were 4 unresolved references to program class members.
         Your input classes appear to be inconsistent.
         You may need to recompile the code.
         (http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedprogramclassmember)
Warning:there were 1 unresolved references to library class members.
         You probably need to update the library versions.
         (http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedlibraryclassmember)
Exception while processing task
java.io.IOException: Please correct the above warnings first.
    at proguard.Initializer.execute(Initializer.java:473)
    at proguard.ProGuard.initialize(ProGuard.java:233)
    at proguard.ProGuard.execute(ProGuard.java:98)
    at proguard.gradle.ProGuardTask.proguard(ProGuardTask.java:1074)
    at com.android.build.gradle.tasks.AndroidProGuardTask.doMinification(AndroidProGuardTask.java:139)
    at com.android.build.gradle.tasks.AndroidProGuardTask$1.run(AndroidProGuardTask.java:115)
    at com.android.builder.tasks.Job.runTask(Job.java:48)
    at com.android.build.gradle.tasks.SimpleWorkQueue$EmptyThreadContext.runTask(SimpleWorkQueue.java:41)
    at com.android.builder.tasks.WorkQueue.run(WorkQueue.java:227)
    at java.lang.Thread.run(Thread.java:745)
:app:dexRelease UP-TO-DATE
:app:validateExternalOverrideSigning
:app:packageRelease FAILED
Error:Execution failed for task ':app:packageRelease'.
> Unable to compute hash of D:\Development\Android\AndroidStudioProject\MyProject\app\build\intermediates\classes-proguard\release\classes.jar
</code>
Here is my proguard file:
<code>-optimizationpasses 25
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify
-dontwarn com.squareup.okhttp.**
-verbose
-printmapping out.map
-renamesourcefileattribute SourceFile
-keepattributes SourceFile,LineNumberTable
-keep class com.splunk.** { *; }
-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider
-keep public class * extends android.app.backup.BackupAgentHelper
-keep public class * extends android.preference.Preference
-keep public class com.android.vending.licensing.ILicensingService
-keepclasseswithmembernames class * {
    native <methods>;
}
-keepclasseswithmembers class * {
    public <init>(android.content.Context, android.util.AttributeSet);
}
-keepclasseswithmembers class * {
    public <init>(android.content.Context, android.util.AttributeSet, int);
}
-keepclassmembers class * extends android.app.Activity {
   public void *(android.view.View);
}
-keepclassmembers enum * {
    public static **[] values();
    public static ** valueOf(java.lang.String);
}
-keep class * implements android.os.Parcelable {
  public static final android.os.Parcelable$Creator *;
}

-keepattributes Signature
-keepattributes *Annotation*
-keep class com.squareup.okhttp.** { *; }
-keep interface com.squareup.okhttp.** { *; }
-dontwarn com.squareup.okhttp.**

-dontwarn rx.**
-dontwarn retrofit.**
-keep class retrofit.** { *; }
-keepclasseswithmembers class * {
    @retrofit.http.* <methods>;
}

-keep class sun.misc.Unsafe { *; }

-dontwarn java.nio.file.Files
-dontwarn java.nio.file.Path
-dontwarn java.nio.file.OpenOption
-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement

 -keep class com.google.android.gms.** { *; }
 -dontwarn com.google.android.gms.**

 -keep class com.loopj.android.** { *; }
 -keep interface com.loopj.android.** { *; }
 -keep class cz.msebera.android.httpclient.HttpResponse { *; }
 -keep class com.loopj.android.http.HttpGet { *; }
 -keep class com.loopj.android.http.HttpDelete { *; }

 -dontwarn android.support.v7.**
 -keep class android.support.v7.** { *; }
 -keep interface android.support.v7.** { *; }
</code>
My build.gradle file:
<code>apply plugin: 'com.android.application'
apply plugin: 'android'

android {
compileSdkVersion 23
buildToolsVersion "23.0.1"

defaultConfig {
applicationId "com.nsw.sampletestAPP"
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
maven {
url "https://mint.splunk.com/gradle/"
}
}

dependencies {
// compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.rengwuxian.materialedittext:library:2.1.4'
compile 'com.squareup.picasso:picasso:2.5.2'
compile files('libs/pixlui-1-0-5.jar')
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.4'
compile 'org.apache.httpcomponents:httpcore:4.4.1'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.loopj.android:android-async-http:1.4.8'
compile 'com.android.support:cardview-v7:23.1.1'
compile 'com.android.support:recyclerview-v7:23.1.1'
compile project(':librarygridview')
compile project(':pageIndicator')
compile "com.splunk.mint:mint:4.4.0"

}
</code>
How do I solve this issue?
Comment: Hi.. can somebody help me with this? Thanks!
Comment: Post your app's build.gradle
Comment: @ZaidDaghestani : Sorry for the delay! I was travelling and could update you with the code. Build Gradle available here: http://justpaste.it/oxzu
Comment: dont see the following in your proguard .... -keep public interface org.apache.http.** { *; }
Comment: @RobertRowntree - I added the same.. but still have the issue.
Answer: not a proguard issue. Rather its an sdk 23 issue with deprecated package org.apache.http which you can resolve with the workaround
android.useLibrary 'org.apache.http.legacy'
in proper gradle format needs to be in build.gradle
Comment: Hi.. I tried it the workaround I still the get the same issue.
Comment: Try sdk 22 and seeif u dont get clean proguard? At R 23 org.apache.http deprecates. Look at the proguard log u have. Its all relate to org.apache.http
Comment: Changed to 22 and built the APK again. I still see the same problem.

Proguard Issue - Classes.jar error


How to add specific vite config file in cypress config file

Question: I want to start cypress with a specific file ( vite.config.test.js)
My stack

vue: 3.2.47
Cypress: 13.2.0
vite-cypress: 1.4.2

structure of the project
/src => containt vue file
/cypress => containt  cypress file for testing
package.json
vite.config.js
vite.config.test.js
cypress.config.js
File cypress.config.js
const { defineConfig } = require('cypress')
module.exports = defineConfig({
    component: {
        devServer: {
            framework: "vue",
            bundler: "vite",
        },
        indexHtmlFile: 'cypress/support/component-index.html',
        fixturesFolder: "cypress/fixtures",
        specPattern: "cypress/integration",
        supportFile: "cypress/support/index.js",
        slowTestThreshold: 10000,
        folders: {
            downloadsFolder: 'cypress/downloads',
            fixturesFolder: 'cypress/fixtures',
            screenshotsFolder: 'cypress/screenshots',
            videosFolder: 'cypress/videos',
            pageLoadTimeout: 100000,
        }
    },
})

file vite.config.test.js  => file for testing only
export default defineConfig((params) => {
    const {mode} = params
    console.log('defineConfig TEST')
})

File vite.config.js => file for dev only
export default defineConfig((params) => {
    const {mode} = params
    console.log('defineConfig DEV', params)

})

My command
./node_modules/.bin/cypress open --component --config-file cypress.config.js
My command start only the fie vite.config.js
I try many solutions but it's not work
Solution 1:
File cypress.config.js
const { defineConfig } = require('cypress')
module.exports = defineConfig({
    component: {
       setupNodeEvents(on) {
            on(
                'file:preprocessor',
                vitePreprocessor({
                    configFile: path.resolve(__dirname, 'vite.config.test.js'),
                    mode: 'development',
                }),
            )
        },
       devServer: {...}
        ...

})

Not work ... it launch vite.config.js
Solution 2
File cypress.config.js
devServer: {
            framework: "vue",
            bundler: "vite",
            // optionally pass in vite config
            viteConfig: require('./vite.config.test.js')

        },

Error :  Your configFile is invalid: project/cypress.config.js
This error concerns the line viteConfig

I just want to read the config test file
Comment: Are you was able to figure out? I think have similar issue cypress doesn't want to parse vue file. I assume it's just not applying vite configs.
Answer: If you want to read the vite config parameters and use them in a test, you can add it via env tag
const { defineConfig } = require('cypress')
const viteConfig = require('./vite.config.test.js')

module.exports = defineConfig({
  env: {
    viteConfig,
  },
  component: {
    ...

In the test
const viteConfig = Cypress.env('viteConfig')

Generally, env: {...} settings can take any keys but other config keys are pre-defined.


Determining if user login already exists in database?

Question: I am building a web application in asp.net using C#. I have the Form where the user should register and then can login. I am having a problem in making the web app know that the name which the user picks is either "already exists" or not. If it already exists it should not insert the same name and display a message saying "user name already exists". I have tried the SqlDataReader but no luck.
protected void Register_Button_Click(object sender, EventArgs e)
    {
        SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["BJ_Player_String"].ToString());
        SqlCommand cmd = new SqlCommand();
        SqlCommand cmd2 = new SqlCommand();
        SqlDataReader data_reader;
        String name = TextBox2.Text;
        String date = TextBox3.Text;

        try
        {
            conn.Open();
            cmd = new SqlCommand("Insert into BJ_Player (Player_Name, D_O_B) Values (@Player_name, @D_O_B)", conn);
            cmd = new SqlCommand("Select Player_Name from BJ_Player WHERE Player_Name = @Player_name", conn);
            cmd.Parameters.Add("@Player_name", SqlDbType.NVarChar).Value = name;
            cmd.Parameters.Add("@D_O_B", SqlDbType.Date).Value = date;
            cmd.Connection = conn;
            data_reader = cmd.ExecuteReader();
            cmd.ExecuteNonQuery();

            if (data_reader.HasRows)
            {
                lblPlayerNameExists.Visible = true;
            }
            else
            {
                // do nothing
            }
        }

Comment: Use the [SqlMembershipProvider](http://msdn.microsoft.com/en-us/library/system.web.security.sqlmembershipprovider.aspx) which has this functionality built-in.
Answer: Make Player_Name unique in database then it will give you exception when you try to insert. You have to use unique constraint.
You have to give command type also and check you assigned both queries to same cmd object
Answer: in your code you're inserting data in your DB and then you are examining that the name is the same or not.
first you should search the name in your DB and then if there isn't any record with that name ,you should add your record.
Answer: If you would like to write a model function to do that then

Leave it for ajax check which is pretty similar to the second
method
Issue "Select username from DB-table" to retrieve
usernames then check the username input against them before
displaying a view to report a problem if any or showing a message to
tell the user that "this name is valid", for example.
Answer: I usually do it in one of two ways:

Create stored procedure that will check for name uniqueness and insert new record if everything is ok. It should return status as numeric code that you will check.
Check for name uniqueness before saving it using as a part of validation process.
Answer: Using the merge statement may help with this.  Merge performs insert, update, or delete operations on a target table based on the results of a join with a source table.
Basically it inserts when needed, and updates when needed.  Often times referred to as an upsert.  but it gets the job done.
Here is a link to a site explaining how to use merge.  Looks like a good article.
http://www.kodyaz.com/articles/sql-server-2008-t-sql-merge-statement-example.aspx


Passport.js and MongoStore error "Connection strategy not found at MongoStore"

Question: I am getting this strange error on my Node.js server:

 Error: Connection strategy not found
        at MongoStore (/Users/amills001c/WebstormProjects/lectal_all/manager/node_modules/connect-mongo/src/index.js:100:23)
        at Object.<anonymous> (/Users/amills001c/WebstormProjects/lectal_all/manager/app.js:42:12)
        at Module._compile (module.js:425:26)

We are using Passport with Express.
The error is happening at the line mongoose_connection: mongoose.connection in the following snippet:
app.use(expressSession({
    secret: 'foobar',
    cookie: {
        secure: false,
        maxage: 1160000000,
        resave: true,
        saveUninitialized: true
    },
    store: new MongoStore({
        mongoose_connection: mongoose.connection   /*<== error happens here*/
    })
}));

What is this error and how can I fix it?
Answer: According to docs, I believe that line should be:
store: new MongoStore({
    mongooseConnection: mongoose.connection
});

Use mongooseConnection instead of mongoose_connection.
Comment: @AlexMills That might be the problem as the error is coming from the library. If there is anything, I'd be glad to help.
Comment: thanks, that might have done the trick, weird, this used to work, but maybe I bumped to a new version of passport/mongoose/etc


How to convert pandas column to date when column is something like "Jan-18"?

Question: what is the efficient way to convert the column values into dates "DD-MM-YYYY" when the values given like "Feb-15" which needs to be "01-02-2015". if it's "Dec-46" it must return "01-12-1946".
Answer: You can pass the format '%b-%y' to to_datetime:
In[42]:
df = pd.DataFrame({'date':["Feb-15","Dec-46"]})
df['new_date'] = pd.to_datetime(df['date'], format='%b-%y')
df

Out[42]:
     date   new_date
0  Feb-15 2015-02-01
1  Dec-46 2046-12-01

Note that the new dtype is datetime64, you cannot control the display output, if you insist on DD-MM-YYYY then you would have to convert to a string using dt.strftime:
In[43]:
df['str_date'] = df['new_date'].dt.strftime('%d-%m-%Y')
df

Out[43]:
     date   new_date    str_date
0  Feb-15 2015-02-01  01-02-2015
1  Dec-46 2046-12-01  01-12-2046

but then you have strings which is not that useful if you need to perform arithmetic operations or filtering
EDIT
You cannot store dates earlier than 1970 so '01-01-1946' is not a valid datetime that can be represented by datetime64
Comment: Dec-46 should be 1946 since it's historical data. That's the issue otherwise it's very straight fwd.
Comment: You'd have to subtract 100 years from that entry I will update


Need help understanding deployment package for nodejs on AWS lambda

Question: I have a codebase in typescript which runs fine and creates the required js files. Next, my task is to create a deployment package out of it and deploy to AWS lambda. When i see the number of packages under node_modules folder, it shows me 450+ packages. Whereas an already deployed lambda function for the same code base has just around 50 packages under the node_modules.
Can someone help me with how to create the deployment package, with just the required packages under the node_modules folder.
Answer: Please follow below steps to deploy lambda function with node_modules files

List below files in under folder any specific name let say "app"

Zip "app" folder with all files

Login into aws account and create new lambda function and upload using below settings.
Make sure Handler name must be like this app/index.handler, where "app" is zip folder name if you used different name then use that name.

Upload file and click on save button
Done Enjoy :)
Comment: Thanks for answering in detail. I have been following the same process for deployments. This one is however a tricky situation, where-in i have a lambda function deployed already and also do have the code base for the functions. Here is my question. "The deployed lambda function has around 50 packages/folders when i export it, however when i build the codebase i get 400 plus folders inside the node_modules folder. The deployed function has size of 6MB, my deployment package post build and zipping is about 16MB.
Comment: See let say you install one package for eg. "request" right ?, request package have its own package.json which means that it has some dependencies on other packages, so when you install "request" then it will automatically install its dependency, you install one package but you can see in your node_modules there are many folder due to dependecies of modules
Comment: that makes sense. but the codebase is same. let's think it as two different individuals building the same code. the deployment package created by the other person has just around 50 or so folders in the node_module folder, whereas the one created by me has 400+ folders. I will check if there is a way to get the steps followed by the other person. I understand that without the full context it would be difficult to answer this question. However, ur answer definitely helped.  appreciate it!!


How can I get windshield wiper fluid stains out of my garage floor?

Question: My car's windshield wiper fluid reservoir had a leak and quite a bit of it soaked into my garage floor (which is a light concrete).  It happened over night, so it soaked quite a bit. Now the floor is stained blue!
I've tried using this concrete cleaner from Home Depot combined with veracious scrubbing with a hard bristle brush but to no avail:

Link to cleaner
I also tried bleach and pressure washing.  Still blue.
Anyone know how to get windshield wiper fluid stains off a garage floor?
Comment: You need some windshield wiper wiper fluid.
Comment: I take it the concrete hadn't been sealed?
Comment: I don't believe the concrete has been sealed.  I didn't seal it, the previous owner might have.
Answer: I know this post is super old but my boyfriend and I had this issue recently. We used a little laundry detergent and comet at first. That helped a little but what really worked was kaboom, the one that's for the rest rooms. This really penetrated the concrete. We let it sit about 15 minutes and pressure washed it. We did that about 3 times and it did the trick.
Comment: Have you tried Simple Green?
Answer: If you have access to a steam cleaner you can try using the steam cleaner over the stained area for a few minutes to see if it will push the stain. If the stain is stubborn, you can try using your pressure washer after steam cleaning it and/or scrub the concrete. Let it dry and rinse and repeat, if it's still there.
Like The Evil Greebo asked, if the concrete isn't sealed, then the stain could be a bit difficult to remove or even permanent.
Best of luck!
Answer: If that spot of floor is exposed to the sunlight when the door is open the sun will bleach it out over time. You could also try putting something on it to soak the color up like comet clensing powder,rice hull ash, or cement. Let it set for a week or two.  If it never comes out you could paint your garage floor with epoxy paint and never have to worry about stains again. I did mine in grey with flakes about 7 years ago and it still looks great.
Answer: You could try an oxygen bleach like Stain Solver.


Accessing Djnago generic DetialView directly from CreateView

Question: I'm trying to acomplish the following functionality: the user enters required information in the form created using generic CreateView, in this case it is length and width. After the form is submitted the app performs simple calculations and returns the result along with submitted data.
I tried to follow this example: [https://developer.mozilla.org/en-US/docs/Learn/Server-side/Django/Generic_views
My models:
from django.db import models

class Building(models.Model):

length = models.IntegerField(default=1)
width = models.IntegerField(default=1)
area = models.IntegerField(default=1)

def __str__(self):
    return self.name

def save(self, *args, **kwargs):
   self.area = self.length * self.width
   super().save(*args, **kwargs)re

views:
class BuildingDetailView(DetailView):
model = Building
context_object_name = 'building'

class BuildingCreateView(CreateView):
model = Building
form_class = BuildingForm
success_url = reverse_lazy('building-detail')

class BuildingListView(ListView):
model = Building

class BuildingUpdateView(UpdateView):
model = Building
form_class = BuildingForm
success_url = reverse_lazy('building_detail')

urls:
path('', views.indexView, name='index'),
path('add_temp/', views.BuildingCreateView.as_view(), name='building_add'),
path('buildings/', views.BuildingListView.as_view(), name='building_changelist'),
path('building/<int:pk>/', views.BuildingDetailView.as_view(), name='building-detail'),

html:
{% extends 'base.html' %}

{% block content %}

Title:

{% for object in object_list %}

Length: {{ object.length }}

Width: {{ object.width }}

Area: {{ object.area }}

{% endfor %}
{% endblock %}

This setup is giving me the following error. I assume the problem is in my template:

File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\handlers\exception.py" in inner
  34.             response = get_response(request)

File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\handlers\base.py" in _get_response
  115.                 response = self.process_exception_by_middleware(e, request)

File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\handlers\base.py" in _get_response
  113.                 response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\django\views\generic\base.py" in view
  71.             return self.dispatch(request, *args, **kwargs)

File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\django\views\generic\base.py" in dispatch
  97.         return handler(request, *args, **kwargs)

File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\django\views\generic\edit.py" in post
  172.         return super().post(request, *args, **kwargs)

File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\django\views\generic\edit.py" in post
  142.             return self.form_valid(form)

File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\django\views\generic\edit.py" in form_valid
  126.         return super().form_valid(form)

File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\django\views\generic\edit.py" in form_valid
  57.         return HttpResponseRedirect(self.get_success_url())

File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\django\views\generic\edit.py" in get_success_url
  112.         if self.success_url:

File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\django\utils\functional.py" in __wrapper__
  151.                 res = func(*self.__args, **self.__kw)

File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\django\urls\base.py" in reverse
  90.     return iri_to_uri(resolver._reverse_with_prefix(view, prefix, *args, **kwargs))

File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\django\urls\resolvers.py" in _reverse_with_prefix
  673.         raise NoReverseMatch(msg)

Exception Type: NoReverseMatch at /hr/add_temp/
Exception Value: Reverse for 'building-detail' with no arguments not found. 1 pattern(s) tried: ['hr\\/building\\/(?P<pk>[0-9]+)\\/$']

Answer: Override the get_success_url(...) method,
class BuildingCreateView(CreateView):
    model = Building
    form_class = BuildingForm

    def get_success_url(self):
        return reverse_lazy('building-detail', kwargs={'pk': self.object.pk})

class BuildingUpdateView(UpdateView):
    model = Building
    form_class = BuildingForm

    def get_success_url(self):
        return reverse_lazy('building-detail', kwargs={'pk': self.object.pk})
Answer: reverse_lazy('building-detail') will not work because "building-detail" requires a parameter "pk". You have 2 options:
Override the get_success_url method in your views
def get_success_url(self):
    return reverse('building-detail', kwargs={'pk': self.object.pk})

Or add a get_absolute_url method to your Building model, this will be used by all the update/create views by default and doesn't require adding success_url or get_success_url to your views
def get_absolute_url(self):
    return reverse('building-detail', kwargs={'pk': self.pk})


How to get the source file name and the line number of a type member?

Question: Considering that the debug data file is available (PDB) and by using either System.Reflection or another similar framework such as Mono.Cecil, how to retrieve programmatically the source file name and the line number where a type or a member of a type is declared.
For example, let's say you have compiled this file into an assembly:
C:\MyProject\Foo.cs
1:    public class Foo
2:    {
3:       public string SayHello()
4:       {
5:           return "Hello";
6:       }
7:    }

How to do something like:
MethodInfo methodInfo = typeof(Foo).GetMethod("SayHello");
string sourceFileName = methodInfo.GetSourceFile(); // ?? Does not exist!
int sourceLineNumber = methodInfo.GetLineNumber(); // ?? Does not exist!

sourceFileName would contain "C:\MyProject\Foo.cs" and sourceLineNumber be equal to 3.
Update: System.Diagnostics.StackFrame is indeed able to get that information, but only in the scope of current executing call stack. It means that the method must be invoked first. I would like to get the same info, but without invoking the type member.
Comment: Ever get this figured out? The answers completely miss the point of your question, which is getting the file name and line number for an ARBITRARY member. Not for the current one... Harold's is the closest, but requires every potential member to be decorated with that attribute...
Comment: there is new API for that, no need to use PDB reader any more, see my answer
Answer: Up to date method:
private static void Log(string text,
                        [CallerFilePath] string file = "",
                        [CallerMemberName] string member = "",
                        [CallerLineNumber] int line = 0)
{
    Console.WriteLine("{0}_{1}({2}): {3}", Path.GetFileName(file), member, line, text);
}

New Framework API which populates arguments (marked with special attributes) at runtime,
see more in my answer to this SO question
Comment: I think you fundamentally misunderstood the question.  You showed how to get information about the caller, but the question asks how to query this for any symbol.  See Yann Trevin's comment to Richard's answer.
Comment: Only available for .Net 4.5 Huge disadvantage for corporate projects.
Answer: Using one of the methods explained above, inside the constructor of an attribute, you can provide the source location of everything, that may have an attribute - for instance a class. See the following attribute class:
sealed class ProvideSourceLocation : Attribute
    {
        public readonly string File;
        public readonly string Member;
        public readonly int Line;
        public ProvideSourceLocation
            (
            [CallerFilePath] string file = "",
            [CallerMemberName] string member = "",
            [CallerLineNumber] int line = 0)
        {
            File = file;
            Member = member;
            Line = line;
        }

        public override string ToString() { return File + "(" + Line + "):" + Member; }
    }

[ProvideSourceLocation]
class Test
{
   ...
}

The you can write for instance:
Console.WriteLine(typeof(Test).GetCustomAttribute<ProvideSourceLocation>(true));

Output will be:
a:\develop\HWClassLibrary.cs\src\Tester\Program.cs(65):

Answer: you might find some help with these links:
Getting file and line numbers without deploying the PDB files
 also found this following post
"Hi Mark,
The following will give you the line number of your code (in the
source file):
Dim CurrentStack As System.Diagnostics.StackTrace
MsgBox (CurrentStack.GetFrame(0).GetFileLineNumber)

In case you're interested, you can find out about the routine that you're
in, as well as all its callers.
Public Function MeAndMyCaller As String
    Dim CurrentStack As New System.Diagnostics.StackTrace
    Dim Myself As String = CurrentStack.GetFrame(0).GetMethod.Name
    Dim MyCaller As String = CurrentStack.GetFrame(1).GetMethod.Name
    Return "In " & Myself & vbCrLf & "Called by " & MyCaller
End Function

This can be very handy if you want a generalised error routine because it
can get the name of the caller (which would be where the error occurred).
Regards,
Fergus
MVP [Windows Start button, Shutdown dialogue]
"
Comment: Unfortunately, StackTrace provides information about the current calling stack; and not about an arbitrary outside member. I would like to get the information without actually running the method.
Comment: Richard, the busycode link is broken. Is there an updated link anywhere?


Can I increase the power of my Garland of Greatness after the G-Lover seasion has ended?

Question: I managed to finish one G-Lover run in-season, and received the Garland.
Can I still do G-Lover run to increase the power of the Garland, or is it forever stuck at the current power?
Answer: I just ascended in G-Lover out of season, and the Garland that I already had has now indeed increased in power.


Arrays inside Arrays in java

Question: I want to make multiple arrays by accessing the parent array.  for eg.
how do make this array?
Here, in this code, the following data is inputted by the user and the code will simply print the arrays i.e.
2->total size of the parent array (it will tell the compiler that user will enter two arrays as input)
6->size of the first child array and so on.

2
6
5 1 3 4 18 56
8
8 7 3 1 34 72 89 11

and all of them are user-input even the size of the array.
 public static void main(String[] args) {
  Scanner sc = new Scanner(System.in);
   int sarr[] = new int[30];
   int arr[] =  new int[30];
   int n =sc.nextInt();
   for (int i=0;i<n;i++)
   { sarr[i] = sc.nextInt();
     for (int j=0;j<=sarr[i];j++)
     {
      arr[j]=sc.nextInt();
     }
   }
   for (int i=0;i<n;i++)
   {
     for (int j=0;j<=sarr[i];j++)
     {
        System.out.println(arr[i]);
     }
     System.out.println();
   }

Comment: Please provide code (mimimum working and runnable snippet) as well as desired output
Comment: Hey, please check it.. I changed it.
Comment: Also, can anyone tell me how to access a particular element of the array? Like applying a sort operation on each of the array?
Answer: If you want to make a multidimensional array in java, you should use this syntax:
int n = ...;
int array[][] = new int[n][n];

For example:
try (Scanner sc = new Scanner(System.in)) {
        int n = sc.nextInt();
        int arr[][] = new int[n][n];
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                arr[i][j] = sc.nextInt();
            }
        }
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                System.out.println(arr[i][j]);
            }
            System.out.println();
        }
    }

Some final notes:

You should close the stream when you are done with it
You don't "tell the compiler" since the compiler is not executed at runtime. You mean the JVM, in any case.
Comment: I don't suppose this is this solution...please try to at least read the problem..it's not about 2D array but 2D array inside an array..
Answer: Here is a solution for how you can build a 2D array with rows of different sizes. Each array is created after we have asked for its size
Scanner sc = new Scanner(System.in);
System.out.println("Number of arrays");
String str1 = sc.nextLine();
int numberOfArrays = Integer.valueOf(str1);

int[][] array = new int[numberOfArrays][];

    for (int i = 0; i < numberOfArrays; i++) {
        System.out.println("Size of array");
        String str2 = sc.nextLine();
        int size = Integer.valueOf(str2);
        int[] row = new int[size];
        for (int j = 0; j < size; j++) {
            System.out.println("Value:");
            String str3 = sc.nextLine();
            int value = Integer.valueOf(str3);
            row[j] = value;
        }
        array[i] = row;
    }
}

Update
Here is a version that allows all numbers in the array to be entered on a single line. Note that there is no error handling here checking the number of values given vs expected etc.
for (int i = 0; i < numberOfArrays; i++) {
    System.out.println("Size of array");
    String str2 = sc.nextLine();
    int size = Integer.valueOf(str2);
    int[] row = new int[size];
    System.out.println("Values:");
    String str3 = sc.nextLine();
    String[] numbers = str3.split("\\s");
    for (int j = 0; j < size; j++) {
        row[j] = Integer.valueOf(numbers[j]);
    }
    array[i] = row;
}

Comment: Can you tell me why you used string to take input instead of taking directly integer value?
Comment: To avoid the the issue where only the int value is read but not the end-of-line (enter/return) character is read which might cause an issue the next time the scanner is read.
Comment: Sorry man, your code isn't working. I don't understand why! it showing this error Exception in thread "main" java.lang.NumberFormatException: For input string: "0 2 1 2 0" at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
Comment: It was some time since I wrote this but it looks like I expect one number at a time to be entered. If you want to read a line of multiple numbers change the last scanner read to `nextInt` instead
Comment: @Shinichi I do not get an exception when I run my code and enter one value per line
Comment: @Shinichi I added an alternative solution for the loop part

Arrays inside Arrays in java


How to attach a corner shelf to the shower tile

Question: The (ceramic) corner shelf in my shower is starting to detach from the porcelain tile. What kind of adhesive should I use to reattach it? I don't want to make any holes in the wall. The shelf is fairly light - approximately 8" radius.
Answer: Assuming to can arrange to hold it in place for a while (test your method before applying adhesive) clear silicone caulking would to the trick. It holds glass fish tanks together all by itself.
Get everything very clean first, and leave it held in place and undisturbed for at least 24 hours, preferably avoiding putting weight on it for a couple of days.
Comment: I've used blocks of wood held with duct tape as a support. Be careful you don't get any silicone on the wood or you'll end up gluing the wood to the soap dish.
Comment: For the OP: "very clean" means removing all signs of the old, failing adhesive. Putting new adhesive on old stuff that's falling off means that the new stuff will be well attached to the old stuff when it falls off.


How do you unmute someone in chat?

Question: Sometimes in global chat, I accidentally click the "Mute" button when trying to visit them, but then I never see their name ever again. I still want to talk to them and want to unmute but there seems to be no option to do so since the name is gone.
So is there any way at all to unmute a player in global chat?
Answer:
"As of the July 29, 2013 update, there is now an option to mute a
  selected player from the global chat window. This will remove their
  messages from your chat window but will not affect those of other
  players. As of yet, there is no way to unmute a player that you have
  previously muted. When you leave the chatroom, any players you muted
  will be unmuted."

I have not found any indication of this changing in any of the more recent patch notes.
source
Comment: The only problem with this... Is getting back into the same chatroom.
Comment: @aytimothy yea, basically if you muted someone and you dont know which clan they are from, or have contact outside of the game, you most likely wont ever find them again

How do you unmute someone in chat?


Delay hiding and showing ActionBar?

Question: I want to hide the action bar when an activity is started and when the user touches the screen show it for a few seconds, then hide it again.
What I have come up with is just below, but I want to know if there is anything better I could have done (ignoring some style issues: magic numbers, duplication of logic,etc).
And I am using actionbarsherlock.
Thanks

Runnable hideActionbarRunnable = new Runnable() {
        @Override
        public void run() {
            ActionBar bar = getSupportActionBar();
            bar.hide();
        }
    };

    Runnable showActionbarRunnable = new Runnable() {
        @Override
        public void run() {
            ActionBar bar = getSupportActionBar();
            bar.show();
        }
    };

    Runnable animateActionBarHide = new Runnable() {
        @Override
        public void run() {
            handler.postDelayed(hideActionbarRunnable,3000);
        }
    };

    Runnable animateActionBarShow = new Runnable() {
        @Override
        public void run() {
            handler.post(showActionbarRunnable);
            handler.postDelayed(hideActionbarRunnable,3000);
        }
    };

    @Override
    protected void onResume() {
        super.onResume();
        Log.i(MainActivity.TAG,"CameraActivity:  onResume called");

        Thread t = new Thread(animateActionBarHide);
        t.start();
    }
 @Override
    public boolean onTouchEvent(MotionEvent event) {

        ActionBar bar = getSupportActionBar();
        if(event.getAction() == MotionEvent.ACTION_DOWN)
        {
            Thread t = new Thread(animateActionBarShow);
            t.start();
        }
        else
        {
            Thread t = new Thread(animateActionBarHide);
            t.start();
        }
        return super.onTouchEvent(event);
    }
Answer: The Handler class has a method postDelayed(Runnable r, long delayMillis). That would make it much shorter and much more elegant.

Delay hiding and showing ActionBar?


Mouse get stuck some times

Question: When I Installed upuntu for the first time I log in and was going to update it like there were packages and I was trying to do other thing's like go on the web when the packages were going to be installed but the toachpad got stuck. I was wondering about this but I just don't know if it will do it again:( ???
Comment: Have you been able to solve this issue?
Comment: This happens to my USB mouse on my desktop all the time since the last few versions or Ubuntu, sometimes it takes out just the mouse, sometimes it takes the keyboard with it... The only fix I have been able to come up with is to use a PS2 mouse... which works fine.. but it isn't my favorite mouse...
Answer: Try running sudo rmmod psmouse && sudo modprobe psmouse.
This unloads and reloads the touchpad driver. Doing this might alleviate the problem, at least temporarily.
Comment: @tijybba This seems to me quite clearly to be an answer, and in no way to be an attempt to get information from the OP. Assuming you do think this is not an answer, can you explain why? (I've edited this to add more information about what this does, which might help clarify things.) What's valuable about this command is not what information it reveals, but what it actually does, which might fix the problem, at least temporarily.
Comment: Hmm, yes i am deleting my comment.

Mouse get stuck some times


How do I force a chart to auto adjust Y Axis Maximum?

Question: I have a .NET chart which I am populating at runtime
The chart appears within a report.  For each band in my report, I clear all the series and add them back in using code
            Series s = new Series();
            s.Font = new Font("Verdana", 8f);

            int i = 0;
            foreach (var month in line.Months)
            {
                DataPoint p = new DataPoint();

                p.XValue = i;
                p.YValues = new Double[] { month.LineValue ?? 0 };
                s.Points.Add(p);

                i++;
            }

When I populate the chart the second time, the Y Axis maximum stays on 2000, i.e. is not being recalculated
How do I force recalculation?
I have ScaleBreakStyle enabled on the Y Axis
If I try to set IsLogarithmic to true on the Y Axis I get a X instead of a chart
I am using Visual Studio 2010 with the System.Windows.forms.DataVisualization.Charting.Chart
Paul
Comment: Looks like Anton Kedrov's answer should be the accepted solution
Answer: chart.ChartAreas[0].RecalculateAxesScale();
Comment: I also was trying to set `AxisY.Maximum = Double.NaN` (and same for AxisY2), but it's not working for me.
Comment: This answer worked for me. I was enabling/disabling different Series (all series are initially disabled and controlled from a list) and noticed that only the first Series enabled would set the maximum for the y-axis.
Answer: The docs say the default for the Axis.Maximum property is NaN (not a number), so you should be able to re-enable the automatic scaling functionality by setting it back to that value.
Something like this...
chart.ChartAreas[0].AxisY.Maximum = Double.NaN;

UPDATE / CORRECTION
Anton's answer is correct; you should be using:
ChartArea.RecalculateAxesScale();

According to the RecalculateAxesScale() docs:

... it is sometimes
  necessary to recalculate chart area properties so that the chart is
  rendered correctly. For example, if an axis range is changed, the
  labels for that axis must be recalculated.

Apparently, it's has been available since .NET 4.0.
Comment: I thought and tried the same thing but it didn't work. Anton Kedrov's answer works
Comment: @yclkvnc, can you post some version info? I think this solution once worked but it sounds like most people are having better luck with Anton's answer these days.
Comment: sorry, I don't even remember using .NET chart 5 years ago :)
Answer: First, initialize this:
chart.ChartAreas[0].AxisY.IsStartedFromZero = false;

Whenever data point is added, do this please.
pinChart.ChartAreas[0].RecalculateAxesScale();

Comment: RecalculateAxesScale() is critical. IntervalOffset has no function on the axis.
Answer: you need to run this sequence:
AxisY.Maximum = Double.NaN; // sets the Maximum to NaN
AxisY.Minimum = Double.NaN; // sets the Minimum to NaN
enter code herechart.ChartAreas[0].RecalculateAxesScale(); // recalculates the Maximum and Minimum values, since they are set to NaN


changing loudness with amixer

Question: I want to set the loudness with amixer on my Ubuntu 20.04 system, Kernel 5.15. amixer prints the the "Simple mixer control 'PCM', 0" and "Simple mixer control 'IEC958', 0". But no master. When I set the loudness for PCM it does not change the actual loudness at all.
Answer: Here is what I use. I use Ubuntu Mate 18.04.
<code>amixer -D pulse sset Master 20%
</code>
Comment: thanks @fixit7 works fine

changing loudness with amixer


How do I complete the "Outmatched: 4 Very Hard AI" achievement?

Question: I am trying to complete the "Outmatched: 4 Very Hard AI" achievement:
Win a 1 vs 4 Multiplayer Custom Game with no Allies against 4 Very Hard A.I. opponents.
Any tips are welcome.
Thanks.
P.S. I would probably better to start from easier achievements, but it should be feasible to complete the hardest one too.
Comment: See some answers in this similar question: http://gaming.stackexchange.com/questions/5927/tactics-for-getting-the-outmatched-achievements-in-starcraft-2. Full answers here are probably better though given you're specifically interested in the 4 Very Hard AI achievement.
Answer: When you try to do a straight forward cannon rush where you build a Pylon and a few cannons inside the opponents base, the very hard AI will scout it and attack with workers before any cannons are ready. (This was added with a patch a while ago, previously the AI wasn't that aggressive.)
You can get around this by being a bit more sneaky about it and building your cannons in a place where the AI doesn't realize the danger:

Once you established that position, you can start pushing in with cannons.

Try to shut down mining for at least two opponents as fast as possible:

The other opponents will not counterattack, but try to get rid of the cannons next to their allies first. So build a lot of them, making sure your position can't be taken down.
From here on you could probably just push forward further with cannons to kill the remaining bases. Alternatively, carriers are a great unit to protect your cannons and destroy everything:
Answer: One approach - which could probably be deemed cheating - is to play on the map Burning Tide. The goal of this map is to be the first team to collect 15,000 minerals.
You can get all the Outmatched achievements this way, because the AI players spend minerals on units and buildings, yet they do not attack. The AI players also do not collect the minerals deposited by the lava - this becomes important when going against 3 or 4 AI opponents.
Comment: Actually, I planned to beat them in fair play... but this easy way is so attractive that I've decided to get achievements scores without significant efforts... would better do this easy and play multiplayer :)


Automated Unit Testing on Time based calculations

Question: I have a small project which does some statistical calculations on the trades with inputs like Symbol, Price, time etc., I am using Visual Studio unit testing tools which is sufficient in case I do a normal testing of a class/function which does not go back/front in time.
I have certain statistical formulas to be calculated like for example a Moving Average. This may have to be calculated for 5 intervals based on a "1 minute" period. So I have to keep the last value of every minute (which I have put in logic) and do the averaging of the last value during the 5th minute.
The problem is now I lose 5 minutes for a single test to run (by putting Thread.Sleep). Is there an efficient approach to testing such Time based functions/algos?
Comment: Use an internal time; refactor to pass in a service that returns the current time...
Comment: roll forward time....
Comment: @MitchWheat, Doesn't it affect the system time if I roll forward?
Answer: Why are you not just mocking/creating your test data with the appropriate Timestamp values e.g. DateTime.Now.AddMinutes(1) 2 , 3 ,4......
Or does your business logic really have to wait one minute for each "iteration"?
I mean, usually you just pass data to your calculation methods, regardless of the time the data has been created right?
If this is not the case, maybe refactor your code to be more testable ;)
Comment: This seems to be a neat idea. The code has to be refactored to be made more testable.
Answer: You should use shims to specify the values you want returned for your timestamp values. Since you are using Visual Studio, check out this link to explain how to use them: http://msdn.microsoft.com/en-us/library/hh549175.aspx. Objects such as DateTime can be difficult to mock, because DateTime is a class and not an interface. The shim will redirect a call to an object, such as DateTime.Now to a custom function that you write.


What is the difference between echo and Write-Host in PowerShell?

Question: I'm confused about the difference between echo and Write-Host in PowerShell. I have two files, POC.ps1 & validatePath.ps1. These files are on my local machine, and I'm running them on a remote machine using Invoke-Command. I am using PowerShell v3.0.
To execute both of these scripts I use the command:
.\POC.ps1 -filename C:\Users  -user Blaine

Here are the two files:
POC.ps1:
param($filename, $user)

echo $filename
echo "This"
echo $user

$responseObject = Invoke-Command testcomputer -FilePath .\validatePath.ps1  -ArgumentList($filename, $user) -AsJob

while($responseObject.State -ne "Completed")
{

}

$result = Receive-Job -Id $responseObject.Id -Keep
echo $result

Here is where things get weird...
validatePath.ps1:
Param([string] $filename,
      [string] $user)

function ValidatePath( $filename, $user, $fileType = "container" )
{
    Write-Host "This is the file name: $filename"
    Write-Host "This is user: $user"  <--- Notice I'm using Write-Host here
    $fileExist = $null
    if( -not (test-path $filename -PathType $fileType) )
    {
        throw "$user, the path $filename does not exist!"

    }
    else
    {
         Write-Host "This is the second part"
         echo $filename found!
    }
    Write-Host "This is the third part"
    return $fileExist
}

try
{

    ValidatePath($filename, $user)
}
catch
{
    $e = $_.Exception
    echo $e
}

When I run the above script, this is the output:
C:\Users
This
Blaine
This is the file name: C:\Users Blaine
This is user:  <--- Notice where this line is?
This is the second part
This is the third part
C:\Users
Blaine
found!

But if I change the validatePath.ps1 to this:
Param([string] $filename,
      [string] $user)

function ValidatePath( $filename, $user, $fileType = "container" )
{
    Write-Host "This is the file name: $filename"
    echo "This is user: $user" <---notice I'm using Echo here
    $fileExist = $null
    if( -not (test-path $filename -PathType $fileType) )
    {
        throw "$user, the path $filename does not exist!"

    }
    else
    {
         Write-Host "This is the second part"
         echo $filename found!
    }
     Write-Host "This is the third part"
    return $fileExist
}

try
{

    ValidatePath($filename, $user)
}
catch
{
    $e = $_.Exception
    echo $e
}

This is the output:
C:\Users
This
Blaine
This is the file name: C:\Users Blaine
This is the second part
This is the third part
This is user: <---- Notice where this line is now?
C:\Users
Blaine
found!

You will notice that the line "This is the user:" is in different spots. Why is this? Why does echo work differently than Write-Host?
UPDATE:
What is even more strange is that if I rerun the script twice like this:
POC.ps1:
param($filename, $user)

echo $filename
echo "This"
echo $user

$responseObject = Invoke-Command CAPTESTPK01 -FilePath .\validatePath.ps1  -ArgumentList $filename, $user -AsJob

while($responseObject.State -ne "Completed")
{

}

$result = Receive-Job -Id $responseObject.Id -Keep
echo $result

$filename = "C:\saddfasdfj"

#Here I run the command again, using a different file name
$responseObject = Invoke-Command CAPTESTPK01 -FilePath .\validatePath.ps1  -ArgumentList $filename, $user -AsJob

while($responseObject.State -ne "Completed")
{
   if($responseObject.State -eq "Failed")
   {
        echo "Failed"
        $result = Receive-Job -Id $responseObject.Id -Keep
        echo $result
        break
   }
}

$result = Receive-Job -Id $responseObject.Id -Keep
echo $resul

It gives me this output when using echo in validatePath.ps1:
C:\Users
This
Blaine
This is the file name: C:\Users
This is the second part
This is the third part
This is user: Blaine <---- This line is here
C:\Users
found!
This is the file name: C:\saddfasdfj
This is user: Blaine <---- But now it's here, where it should be? Wth?
Blaine, the path C:\saddfasdfj does not exist!

Comment: Not an answer to your question, but arguments to PowerShell functions should not be put in parenthesis when called. It should be `ValidatePath $filename $user`
Comment: That probably answers my question here: http://stackoverflow.com/questions/17623712/multiple-parameters-put-into-one-variable-in-powershell  Thanks.
Answer: echo is an alias for Write-Output, which writes to the Success output stream. This allows output to be processed through pipelines or redirected into files. Write-Host writes directly to the console, so the output can't be redirected/processed any further.
Answer: echo is an alias for Write-Output. Where Write-Host directly writes to the 'screen', Write-Output writes to the pipeline. If the pipeline is not feed into some other command it ends on the 'screen' in the end as well. The difference you see is Write-Host getting written to the screen directly where Write-Output first goes through the pipeline and ends up on the screen after Write-Host.
Using Write-Output allows you to pipe/redirect the output to a file or to another command, where Write-Host does not. They should be used depending on what you want.
See here for more.