text:
Q: laravel group by date in join query to find sum of values I am looking for laravel developer to solve a simple issue. I have 3 tables that I am joining to get data. Model data is like this:
date | order number | amount

I need to group by date and find the sum of amount. Like this:
date        | order number      | amount
12/06/2022  |  ask20            |   150
12/06/2022  |  ask20            |   50
13/06/2022  |  ask21            |   120
15/06/2022  |  ask20            |   110
15/06/2022  |  ask23            |   10
16/06/2022  |  ask20            |   30

Now, I need to group by date to get the value like this:
date        | order number      | amount
12/06/2022  |  ask20            |   200 (added value)
13/06/2022  |  ask21            |   120
15/06/2022  |  ask20            |   110 (not added as the order number is different)
15/06/2022  |  ask23            |   10
16/06/2022  |  ask20            |   30

Remember, I am getting this data by joining 3 tables, Can anyone help solve this?

A: This seems a simple SUM function -
SELECT date, order_number, SUM(amount)
  FROM <YOUR BIGGER QUERY..>
 GROUP BY date, order_number


text:
Q: FileNotFoundError: [Errno 2]: Reading a file via jupyter i started using Jupyter and fell into a problem. Whilst trying to read a file called 'vgsales' it gave an error:
FileNotFoundError: [Errno 2] File vgsales.csv does not exist: 'vgsales.csv'

I have put the 'vgsales' folder which has my csv file within it in my desktop with the Jupyter notebook.
Not sure where i went wrong, Please help!
Thanks
Code used:
import pandas as pd
df = pd.read_csv('vgsales.csv')
df

A: *

*Though the notebook is on your desktop, you still can find out which folder it is in by simply right click on it and choose  property. Then you can copy your csv file to the same folder

*To list which files are in local folder when you are inside a notebook, use !ls, note that you need ! for the command to work

redpajama_set_name: RedPajamaStackExchange


text:
Q: I'm trying to make an until loop stop once I get a result #!/bin/bash
cd  /root/.OceanVieW

keyword=$( cat oceanview.conf |grep "seaworld" |cut -d "=" -f2);
until [ ${#keyword} -gt 1 ] ; do sleep 30
 cat oceanview.conf |grep "seaworld" |cut -d "=" -f2 ;
 done

The loop doesn't stop, it keeps going on. I want it to stop once I get a result.

A: Simplification, (as per OP comment), loop until seaworld=0 is not found:
until grep -m 1 -vq '^seaworld=0$'  oceanview.conf ; do
    sleep 30
done

If verbose output is needed, (a running list of numbers, which would all be 0 except the last one tested), try:
until grep -m 1  -v '^seaworld=0$'  oceanview.conf ; do
    sleep 30
done | cut -d "=" -f2

If that's too verbose, then right after the -f2 append | uniq -c, to show a count of 0s, and the final number, printed after the loop completes.


text:
Q: DB Date insert works sometimes I have the following line:
command.Parameters.Add("@date", SqlDbType.DateTime, 8).Value = date_of_trip;

where date_of_trip is a string containing 25-9-2013 (i.e. day-month-year)
This gives me an error message:

System.ArgumentException: Cannot convert 25-9-2013 to System.DateTime.
  Parameter name: type ---> System.FormatException: String was not
  recognized as a valid DateTime.

However, if date_of_trip is 1-1-2013, it seems to work perfectly!

A: You should parse the string to datetime before you send it to the db.
For example:
DateTime dt;
if(DateTime.TryParse(date_of_trip, out dt))
{
    command.Parameters.Add("@date", SqlDbType.DateTime, 8).Value = dt;
    // ...
}
else
{
    // you should use a CompareValidator to check if it's a valid date
}

If you want to ensure that your given format will work even if the current-culture of the server will change you can use DateTime.TryParseExact with format "dd-MM-yyyy":
if (DateTime.TryParseExact(date_of_trip, "dd-MM-yyyy", System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.None, out dt))
{
    // ...
}

A: I guess it's because the server expects the first parameter to be a month. Try to use a real DateTime or the format yyyy-mm-dd (i.e. 2013-09-25), which should always work.


text:
Q: iOS Load local image in resources, and show it in  I want to load local resources image in iOS, but failed to show in app (but when I NSLog the link is already shown).
This is my code
NSBundle* myBundle = [NSBundle mainBundle];
NSString* imgurl = [myBundle pathForResource:@"list-gotit" ofType:@"png"];

htmltext = [NSString stringWithFormat:@"",
                imgurl];

[self.postview loadHTMLString:htmltext baseURL:baseurl];

img src will load my data/ my url is already right i think ( i use NSLOG ) :

but not show as an image.
Thanks for your help.

A: This is working for me:
 NSString *filePath = [[NSBundle mainBundle] pathForResource:@"list-gotit" ofType:@"png"];
 NSURL    *imageURL = [NSURL fileURLWithPath:filePath];
 NSString *absoluteURLString = [imageURL absoluteString];
 [html appendFormat:@"", absoluteURLString];

Or as two liner:
NSString *imageURL = [[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"list-gotit" ofType:@"png"]] absoluteString];
[html appendFormat:@"", imageURL];

A: I think you missed a / in
And
NSURL *imgUrl = [NSURL fileURLWithPath:[myBundle pathForResource:@"list-gotit" ofType:@"png"]];

I did a test:
NSBundle* myBundle = [NSBundle mainBundle];
NSURL *imgUrl = [NSURL fileURLWithPath:[myBundle pathForResource:@"list-gotit" ofType:@"png"]];

NSString *htmltext = [NSString stringWithFormat:@"",
            imgUrl];

self.postview = [[UIWebView alloc] initWithFrame:CGRectMake(100, 100, 300, 300)];
[self.view addSubview:self.postview];
[self.postview loadHTMLString:htmltext baseURL:nil];

Everything is OK.

A: you just have to change below code.
htmltext = [NSString stringWithFormat:@"",
                imgurl];

That's it because of '%@' your code is not working use \"%@\" may be help you.


text:
Q: How do I create a custom calendar using the Custom Content Query Webpart? I currently have two sites right now, a Parent Team Site and a sub team Site. I am trying to use the content query webpart to pull the Calendar entries from the sub team Site into the Parent Team Site.
http://blog.greenbrain.de/2013/08/adding-calendar-icon-to-content-query.html
I am trying to use that tutorial to create a custom template for Calendar, whenever I load the template Calendar in my Content Query Webpart, it bricks and outputs:
Unable to display this Web Part. To troubleshoot the problem, open this Web page in a Microsoft SharePoint Foundation-compatible HTML editor such as Microsoft SharePoint Designer. If the problem persists, contact your Web server administrator.
Correlation ID:7d037b9c-7d4e-1045-1630-4fa42e1de82d
Any help would be very appreciated - I am trying to figure this out myself but I would appreciate any sort of pointers as to how to proceed. If there is an easier way to pull up calendar entries from the other site and display it in a "consolidated" calendar, let me know!

A: Check the XSLT file for errors. A single little mistake can take down the entire CQWP.


text:
Q: UISearchDisplayController doesn't fire didSelectRowAtIndexPath I have a UIViewController with a UISearchDisplayController in it. I have it showing the search results tableview, but clicking any cells never fires didSelectRowAtIndexPath:
#pragma mark - UITableViewDelegate
-(void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath {
    NSLog(@"did select row");
}

I've seen these relevant questions:

*

*Why won't my UISearchDisplayController fire the didSelectRowAtIndexPath method?

*didSelectRowAtIndexPath does not work when uitableview datasource is filtered
but I'm not making the same mistake. The view controller implements UITableViewDelegate and UISearchDisplayDelegate. The UISearchDisplayController delegate and searchResultDelegate are hooked up to the view controller in the storyboard. But just to be sure I did the following in viewDidLoad:
self.searchDisplayController.searchResultsDelegate = self;
self.searchDisplayController.delegate = self;

I've even tried:
self.searchDisplayController.searchResultsTableView.delegate = self;

The searchResultsTableView is the only UITableView in this view controller.

A: The code you show in your question is didDeselect, not didSelect. So, if that's what you actually have in your code, that's the problem.


text:
Q: Java 9 gives "Main Class not found" ob Ubuntu, but file works on Windows and Mac // how to find main Class in OpenJDK So I have a jar file that works perfectly fine on Windows and Mac, but not on Ubuntu (the only place where Openjdk is installed)
This question hints at OpenJDK being the problem: Java Application main class not found on Ubuntu
So: how do I show OpenJDK the correct Main Class? (Its Client.class in /chat in the jar file) I know it has something to do with the MetaINF File, but I cant guess the correct input there.
This is what's currently in the MANIFEST.MF file:

Manifest-Version: 1.0
Main-Class: Chat.Client

I cant find anything anywhere on the topic, but I also cant install the proprietary java on the Ubuntu PC, as its the one where the jar HAS to run and the one where I m not admin at.

A:
Its Client.class in /chat in the jar file

Then Main-Class: Chat.Client is incorrect, it should be Main-Class: chat.Client (lower case chat).
So probably not an OpenJDK issue, just the fact that some file systems are case-insensitive and others are case-sensitive. You're almost certainly using a case-insensitive one on Windows. I guess you must be on Mac as well, though I find that surprising. You probably aren't on Ubuntu.

A: Not really an answer but an easy workaround for people with the same Problem: Install (installing is optional, you can use it directly after the download) the proprietary JDK from Oracle, and if you dont have admin privileges (I dont): you dont need them, simply download the Java JDK from oracle and start the .Jar with /pathtothedownloadedJDK/bin/java instead of "java" and then the usual -jar yourJarFile.jar
Tl:Dr: Get the JDK from Oracle, you dont need sudo to use it.


text:
Q: How do I unlock the rest of the developer options? I got an Android phone that I wanted to use for development. I unlocked the developer options; however, the options appear to be incomplete. It only contains Stay awake, USB debugging, and Allow mock locations. The other options are missing.
It's a Lenovo A536 running Android Kitkat.
Edit: I tried enabling USB debugging mode, but nothing appeared.


text:
Q: Comparação de datas - PHP Tenho a seguinte comparação:
# Verifica se está em tempo habil para concluir a transacao
if($transacao->data_expira <= date("Y-m-d H:i:s")." 000000"){
    echo "Ainda é permitido pagar";
} else {
    echo "Esta cobrança não pode ser mais paga!";
}

Onde $transcao->data_expira é = 2017-10-05 15:42:54.000000

Data Atual: 2017-10-04 19:14:20
Data Expira: 2017-10-05 15:42:54

Neste caso, teria de ser permitido o pagamento.
Como eu posso fazer esta comparação de forma correta?

A: Levando em consideração que $transacao->data_expira é do tipo DateTime, você pode comparar usando a função ->diff(), veja:
if ($transacao->data_expira->diff(new DateTime("today")) >= 0) {
    echo "Ainda é permitido pagar";
} else {
    echo "Esta cobrança não pode ser mais paga!";
}

Caso $transacao->data_expira não seja do tipo DateTime, inicie uma nova instância para então compara-las.
$data_expira = new DateTime($transcao->data_expira); // 2017-10-05 15:42:54
$hoje = new DateTime("today"); // 2017-10-04
$intervalo = $data_expira->diff($hoje);
echo $interval->format("%a days"); // 1 days

Veja funcionando no ideone

A: Você pode comparar o timestamp das datas assim:
if (strtotime($numerical." ".$day." of ".date("F")) < time()) {
    // Mais velho
} else {
    // Mais novo
}

Antes convertendo a data para str quebrando a mesma.
Timestamp
Uma marca temporal (ou estampa de tempo) é uma cadeia de caracteres denotando a hora ou data que certo evento ocorreu. A cadeia é geralmente apresentada num formato consistente, permitindo fácil comparação entre duas marcas temporais distintas.
Elas são padronizadas pela Organização Internacional para Padronização (ISO) através da ISO 8601.
Fonte: https://pt.wikipedia.org/wiki/Marca_temporal


text:
Q: Validation failed for one or more entities when I want to save changes in SQL DataBase I get this error when I try to save changes in database using Entity Framework, this is my code :
public void AjoutDatePoint(DateTime date)
{
    int dateStamp = Convert.ToInt32((date - new DateTime(1970, 1, 1).ToLocalTime()).TotalSeconds);

    DataModel.TB_TA_RESULT result= new DataModel.TB_TA_RESULT();
    result.nDateTime = dateStamp;
    result.nUserIdn = 1;
    result.nShiftIdn = 3;

    SessionContext.DBContext.TB_TA_RESULT.Add(result);
    SessionContext.Save();
}

Thank you

A: This error occurs when EF validates the entity (before posting to the database) to ensure that it respects the configured contract (max length, required value, and so on).
Because you didn't post the entity definition + EF configuration, I can't tell you which property EF is complaining about.
But you can figure it out quite easily yourself by catching the exception, which will be of type DbEntityValidationException, and then examining the contents of the EntityValidationErrors property on the exception.  From it you will get very specific information that will tell you which property(ies) need attention and why.


text:
Q: Adding ListView items on CheckBox check with different formatting I'm using a ListActivity with a Checkbox through an ArrayAdapter.
What I'm trying to do is adding ListView items dynamically with a different layout (TextView only) when the checkBox gets checked.
Also it should disappear after getting un-checked again too.

CheckBox unchecked:

+----------------------+
|  cb -- some text --  |
+----------------------+
|   - new  Heading -   |
+----------------------+
|         etc.         |
+----------------------+

CheckBox checked:

+----------------------+
|  cb -- some text --  |
+----------------------+
|  ---  TextView  ---  |
+----------------------+
|  ---  TextView  ---  |
+----------------------+
|   - new  Heading -   |
+----------------------+
|         etc.         |
+----------------------+

What's the best way to accomplish this?

A: You can do this as follows:
final CheckBox checkbox = (CheckBox) findViewById(R.id.checkbox);
checkbox.setOnClickListener(new OnClickListener() {
    public void onClick(View v) {
        // Perform action on clicks, depending on whether it's now checked
        if (((CheckBox) v).isChecked()) {
            ListView lv=v.getParent();
            TextView tv1=new TextView(this);
            lv.addView(tv1,1);
            TextView tv2=new TextView(this);
            lv.addView(tv2,2);
        } else {
            ListView lv=v.getParent();
            TextView tv1=lv.getChildAt(1);
            TextView tv2=lv.getChildAt(2);

            if(tv1!=null && tv2!=null) lv.removeViews(1, 2);
        }
    }
});

Another simplar approach is to define the TextViews from the begining and let the checkbox set their visibility instead.


text:
Q: Converting json data to an HTML table I have an array of data in php and I need to display this data in a HTML table.  Here is what an example data set looks like.
Array(
  Array
  (
     [comparisonFeatureId] => 1182
     [comparisonFeatureType] => Category
     [comparisonValues] => Array
                 (
                 [0] => Not Available
                 [1] => Standard
                 [2] => Not Available
                 [3] => Not Available
                 )
    [featureDescription] => Rear Seat Heat Ducts
),)

The dataset is a comparison of 3 items (shown in the comparisonValues index of the array)
In the end I need the row to look similar to this

   $record['featureDescription']
   $record['comparisonValues'][0]
   $record['comparisonValues'][1]
   $record['comparisonValues'][2]
   $record['comparisonValues'][3]

The problem I am coming across is how to best do this.  Should I create the entire table HTML on the server side pass it over an ajax call and just dump pre-rendered HTML data into a div or pass the json data and render the table client side.
Any elegant suggestions?

A: That depends. There are several factors to be taken into account:

*

*How much CPU and network bandwidth do you want to waste on the webserver? Generating and sending HTML eats more than just sending a compact JSON string.

*How much CPU and memory do you want to waste on the webbrowser? Generating a table in HTML DOM tree eats more than just inserting a ready-generated string as innerHTML.

*How reuseable do you want the webservice to be? Returning "static" HTML isn't useful for everyone. A more flexible format like XML or JSON is more useful (also for yourself in the future).
As far, I'd suggest returning JSON and have JS/jQuery to populate it on the client side.

Update: assuming that the JSON data will arrive in this format
var json = {"features": [{
    "comparisonFeatureId": 1182,
    "comparisonFeatureType": "Category",
    "comparisonValues": [ "Not Available", "Standard", "Not Available", "Not Available" ],
    "featureDescription": "Rear Seat Heat Ducts"
}, {
    "comparisonFeatureId": 1183,
    "comparisonFeatureType": "Category",
    "comparisonValues": [ "Not Available", "Standard", "Not Available", "Not Available" ],
    "featureDescription": "Some Description"
}]};

and that you have an empty table like this

then you can use the following jQuery script to fill it the way you described in the question
$.each(json.features, function(i, feature) {
    var row = $('
').appendTo($('#table'));
    row.append($('').append($('').text(feature.featureDescription)));
    $.each(feature.comparisonValues, function(j, comparisonValue) {
        row.append($('').text(comparisonValue));
    });
});

A: dnaluz,
as mentioned by others, there are great libs out there to do thios client side. I'd also take the stance that you'd be best sending the json array to the client and then using the lib to present the data in tabular format.
Altho i mention the use of nice presentation libs to create the table, below is a little function that i use for lightweight quick and dirty table visualizations from a json array:
function CreateTableFromJson(objArray) {
    // has passed in array has already been deserialized
    var array = typeof  objArray != 'object' ? JSON.parse(objArray) : objArray;

    str = '
';
    str += '
';
    for (var index in array[0]) {
        str += '' + index + '	';
    }
    str += '
';
    str += '
';
    for (var i = 0; i < array.length; i++) {
        str += (i % 2 == 0) ? '
' : '
';
        for (var index in array[i]) {
            str += '' + array[i][index] + '	';
        }
        str += '
';
    }
    str += '
'
    str += '
';
    return str;
}

hope this is useful in some minor way..
jim
[edit] - here's a link to a page using a very similar technique:
http://www.zachhunter.com/2010/04/json-objects-to-html-table/

A: Nice thing about sending as JSON is you remove the presentation layer from the data layer. I'd do the table client side - there are libraries and blog tutorials to handle rendering.
If you have the funds, extJS is a rather easy way to get that going too.

A: Welcome to Stack Overflow.
I think either way is OK... I have found it easier to include plenty of markup in the response from the server side, when you're displaying a whole table (or row) at a time.  If you're dynamically poking bits of data into a table that's already on the page, you might want to render it on the client side.


text:
Q: Convert list to JSON Lines file and write to Django FileField on S3 Let's say I have the following list of dicts:
data = [
    {"a": 1},
    {"a": 1, "b": 2},
    {"a": 1, "b": {"c": 3, "d": 4}},
]

And a simple model with a file field backed by S3:
from storages.backends.s3boto3 import S3Boto3Storage

class S3Storage(S3Boto3Storage):
    bucket_name = "my-bucket"

class Output(models.Model):
    file = models.FileField(upload_to="uploads/")

I want to generate a JSON Lines file and upload that to Output.file. This is what I have so far:
from tempfile import TemporaryFile

with TemporaryFile(mode="w+") as tmp_file:
    for record in data:
        json.dump(record, tmp_file)
        tmp_file.write("\n")

    tmp_file.seek(0)
    bytes_file = tmp_file.read().encode()
    content = ContentFile(bytes_file)

    output = Output()
    output.file.save("data.jsonl", content)

This works fine but seems inefficient, specifically reading the entire temp file and encoding it. Is there a more performant way to do this, perhaps by writing bytes to the file originally so I can avoid the following lines:
tmp_file.seek(0)
bytes_file = tmp_file.read().encode()

Or are there other areas for speed / memory optimization?


text:
Q: How to log 415 errors in Spring My service is currently experiencing 415 errors, but I'm not getting any logs to find out what errors they are.
Will I be able to add logging in some kind of filter so that I can know what's going on?
@RequiresHttps
@RequestMapping(value = "/test", method = RequestMethod.POST)
public ResponseEntity<String> doAction(@NonNull @RequestBody CustomRequest[] requests) {

A: It looks like the 415 is happening inside spring mvc engine and it doesn't event reach your controller so that you can't really place the logs in our code (in doAction method for example).
Try to enable tomcat embedded access logs and you'll see the file with all the requests and return status. These are disabled by default so you should add the following into application.properties or yaml:
server.tomcat.accesslog.enabled=true

There are some configurations / customizations you can do with that, you can read about them in this tutorial  for example


text:
Q: React-scripts not recognising third party jsx in a npm package I have a react app that was created using create-react-app from facebook. I have referenced a third party private npm package from my create-react-app project. The third party package has es6 and jsx syntax components.
When I start my app react-scripts won't compile the node modules.
Is there any way to get get a create-react-app project to recognise jsx and es6 from an external module, without exporting the entire app and modifying webpack?
Failed to compile.

./node_modules/third-party-package/src/web/testComponent.js
Module parse failed: \node_modules\third-party-package\src\web\testComponent.js Unexpected token (8:6)
You may need an appropriate loader to handle this file type.
|   render() {
|     return (
|       <div>
|         Test component text
|       </div>


text:
Q: How to improve the aspect of ggplot histograms with log scales and discrete values I am trying to improve the clarity and aspect of a histogram of discrete values which I need to represent with a log scale.
Please consider the following MWE
set.seed(99)
data <- data.frame(dist = as.integer(rlnorm(1000, sdlog = 2)))
class(data$dist)
ggplot(data, aes(x=dist)) + geom_histogram()

which produces

and then
ggplot(data, aes(x=dist)) + geom_line() + scale_x_log10(breaks=c(1,2,3,4,5,10,100))

which probably is even worse

since now it gives the impression that the something is missing between "1" and "2", and also is not totally clear which bar has value "1" (bar is on the right of the tick) and which bar has value "2" (bar is on the left of the tick).
I understand that technically ggplot provides the "right" visual answer for a log scale. Yet as observer I have some problem in understanding it.
Is it possible to improve something?
EDIT:
This what happen when I applied Jaap solution to my real data

Where do the dips between x=0 and x=1 and between x=1 and x=2 come from? My value are discrete, but then why the plot is also mapping x=1.5 and x=2.5?

A: I am wondering, what if, y-axis is scaled instead of x-axis. It will results into few warnings wherever values are 0, but may serve your purpose.
set.seed(99)
data <- data.frame(dist = as.integer(rlnorm(1000, sdlog = 2)))
class(data$dist)
ggplot(data, aes(x=dist)) + geom_histogram() + scale_y_log10()

Also you may want to display frequencies as data labels, since people might ignore the y-scale and it takes some time to realize that y scale is logarithmic.
ggplot(data, aes(x=dist)) + geom_histogram(fill = 'skyblue', color = 'grey30') + scale_y_log10() +
  stat_bin(geom="text", size=3.5, aes(label=..count.., y=0.8*(..count..)))

A: A solution could be to convert your data to a factor:
library(ggplot2)
set.seed(99)
data <- data.frame(dist = as.integer(rlnorm(1000, sdlog = 2)))
ggplot(data, aes(x=factor(dist))) +
    geom_histogram(stat = "count") +
    theme(axis.text.x = element_text(angle = 90, hjust = 1))

Resulting in:

A: The first thing that comes to mind, is playing with the binwidth. But that doesn't give a great solution either:
ggplot(data, aes(x=dist)) +
  geom_histogram(binwidth=10) +
  scale_x_continuous(expand=c(0,0)) +
  scale_y_continuous(expand=c(0.015,0)) +
  theme_bw()

gives:

In this case it is probably better to use a density plot. However, when you use scale_x_log10 you will get a warning message (Removed 524 rows containing non-finite values (stat_density)). This can be resolved by using a log plus one transformation.
The following code:
library(ggplot2)
library(scales)

ggplot(data, aes(x=dist)) +
  stat_density(aes(y=..count..), color="black", fill="blue", alpha=0.3) +
  scale_x_continuous(breaks=c(0,1,2,3,4,5,10,30,100,300,1000), trans="log1p", expand=c(0,0)) +
  scale_y_continuous(breaks=c(0,125,250,375,500,625,750), expand=c(0,0)) +
  theme_bw()

will give this result:

A: I had the same issue and, inspired by @Jaap's answer, I fiddled with the histogram binwidth using the x-axis in log scale.
If you use binwidth = 0.201, the bars will be juxtaposed as expected. However, this means you can only have up to five bars between two x coordinates.
set.seed(99)
data <- data.frame(dist = as.integer(rlnorm(1000, sdlog = 2)))
class(data$dist)
ggplot(data, aes(x=dist)) +
   geom_histogram(binwidth = 0.201, color = 'red') +
   scale_x_log10()

Result:


text:
Q: Single Logout with CAS I have an environment with a cas server and any java clients. I'm facing a problem with single logout with all clients, because, the client do a redirect to path /cas/logout and only this session is logged out. The ticket inside the cookie CASTG is cleaned up, but the user yet can access other applications, but, when the client try access the application that user did redirect to /cas/logout, the cas server asks user credentials.
According I saw when you do a request to a /cas/logout this works like a chain, where CAS server do sign out one by one.
Obviously is a configuration problem, but, I'm not able to find it.
Important: When a user do a request to cas/logout two cookies are deleted, CASTGC and CASPRIVACY

A: Indeed, the CAS server should send logout requests to all applications the user has accessed when you call /cas/logout, in addition to the deletion of its own cookies (CASTGC and CASPRIVACY). The property managing that is: https://github.com/Jasig/cas/blob/master/cas-server-webapp/src/main/webapp/WEB-INF/cas.properties#L75...


text:
Q: Windows Forms Application GUI issues on Macbook M1 with Windows 11 via Parallels I build a windows forms application on my windows desktop pc a few months ago.
Recently I bought a Macbook with a M1 ARM-CPU and installed the newest version of Parallels.
Today I launched this application on Visual Studio with Parallels and everything is working except the GUI of my application.
How it looks on my mac after compiling

Everything is compressed and form fields and labels are overlapping. I have no idea what the reason is and how I can fix this. I tested it again on my Windows desktop-PC and everything is fine.
Has anyone an idea?
I tried to disable visual studio scaling and google a lot, but didnt find a solution.


text:
Q: Improving Smoothness of Simple Animations I am developing my first iPhone application, and I have made it past the "machinery" and now I am wrapping up fit & finish details.
I have a view that slides in from the bottom of the screen for my settings pane. The view itself has an opacity of 0, and has a UIImageView view inside of it with a PNG creating the actual background for the view, behind the controls. I am using the built in animation calls for UIView, as in;
[self.view addSubview:settingsViewController.view];

[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.5];
[UIView setAnimationCurve:UIViewAnimationCurveEaseOut];

frame.origin.y = 200.0;
settingsViewController.view.frame = frame;

[UIView commitAnimations];

Unfortunately, the animation on the device is choppy. The PNG I am using as my background is transparent only in the uppermost 30 pixels across it's width. If I use a PNG with no transparency, the animation is smooth.
The application itself is highly graphical, so the view is animating out over top of a screen full of other PNGs.
I would be extremely surprised if the device can't handle this type of animation smoothly, which leads me to believe I need to refine my approach. Thoughts I had so far include;
Perhaps I need to use Core Animation directly? Would caching the view behind the settings pane before animating be beneficial somehow?
This is new territory for me, and I know there must be ways to optimize that are considered good practice. Thanks for your time!

A: It won't matter if you use Core Animation "directly" or animate the center property: it is choppy because the graphics hardware has to composite the transparent image with the background on every frame of the animation.  You said yourself that using a completely opaque PNG makes the animation smooth.
Try running the app under Instruments, the Core Animation tool has some checkboxes which highlight composited areas in real time and that might give you some hints about re-doing your drawing.
If only the top 30 pixels need to be transparent, it might be worth splitting the background into two views, one 30 pixel strip at the top (transparent) and the rest (opaque).  If it is compositing the entire view every frame, that change might be enough to let it know it only has to composite only the 30 pixels at the top.

A: I've had some issues with animating the frame in the past, try animating the center property instead.
Also what do you need the transparency in the background image for? Won't it be possible for you to just use that image as the background of the containing view and eliminate the need for the UIImageView?


text:
Q: Decryption of encrypted ViewState Brief background: I have two-step login page, which after step 1 sends one-time code to user's email. I do not need this code anywhere except on step 2. I googled around and decided to store original code into Encrypted ViewState. So the question: is it security safe? is it possible to decrypt encrypted viewstate on client-side and get code from there? (of course, I mean truly encrypted viewstate, not just base64ed).

A: ViewState can be decoded:
Tool 1: View State decoder
Tool 2: Http Fox
Tool 3: Fiddler

A: Its my understanding that ViewState is serialized into a base-64 encoded string using the MachineKey in machine.config.  In order for the client (I am guessing javascript) to decode it wouldn't you have to expose the MachineKey?  This would not be good at all.

A: It's possible to decrypt anything given enough time and a sufficient sample set. ViewState is not exactly secure either. If you have information you don't want falling into a potential attacker's hands, you should absolutely leave it out of the ViewState.

A: Personally I wouldn't recommend it.
How would you cope if your user lost their internet connection after you email the onetime code but before they get to use it?

A: Encrypting and decoding are two different things.
Base64 decoding a Base64 encoded string isn't for security purposes.
Decrypting an Encrypted string requires the key.
You first encode, then encrypt.


text:
Q: Neo4j - Cypher: How to get random pairs of permotations I have nodes of type A and nodes of type B.
I want to match X nodes of A and Y nodes of B and create relationship between all those A's and all those B's
Was I tried so far was (X=2, Y=2):
MATCH (a:A) WITH a,rand() AS rand1 ORDER BY rand1 desc LIMIT 2
MATCH (b:B) WITH a,b,rand() AS rand2 ORDER BY rand2 desc LIMIT 2
CREATE (a)-[i:IN]->(b)
RETURN a,i,b

But that only create 1 connection for each selected A and B.
For example:
a1-IN->b1
a2-IN->b2

I want to get to a point where I create all permutations:
a1-IN->b1
a1-IN->b2
a2-IN->b1
a2-IN->b2

Any ideas?

A: How about this?
MATCH (a:A) WITH a, rand() AS rand ORDER BY rand LIMIT 2
WITH collect(a) AS as

MATCH (b:B) WITH b, rand() AS rand ORDER BY rand LIMIT 2
WITH as, collect(b) AS bs

UNWIND as AS a
UNWIND bs AS b

CREATE (a)-[i:IN]->(b)
RETURN a,i,b


text:
Q: Why is the sorted insert not working properly? Here is the code for a linked list. When applying the following commands, it doesn't work properly.
The output is inconsistent.
The class is defined below.
class Node:
    def __init__(self,data) -> None:
        self.data=data
        self.next=None

class linkedList:

    def __init__(self) -> None:
        self.head=None

    def insert(self,data):
        if self.head==None:
            self.head=Node(data)
        else:
            temp=self.head
            self.head=Node(data)
            self.head.next=temp

    def sortedInsert(self,data):
        if self.head==None:
            self.head=Node(data)
        else:
            if self.head.data>data:
                self.insert(data)
            else:
                cur=self.head
                while data>cur.data and cur.next!=None:
                    cur=cur.next
                temp=cur.next
                cur.next=Node(data)
                cur.next.next=temp

    def __str__(self):
        st=""
        cur=self.head
        if self.head==None:
            print("Empty")
        else:
            while cur.next!=None:
                st+=str(cur.data)+" -> "
                cur=cur.next
            st+=str(cur.data)
            return st
a=linkedList()
a.sortedInsert(10)
a.sortedInsert(20)
a.sortedInsert(5)
a.sortedInsert(30)

a.sortedInsert(5)
a.sortedInsert(1)
a.sortedInsert(18)
print(a)

The method sortedInsert works for some cases and not for others. Can someone debug it?

A: The problem is you are going to far in your while loop:
while data>cur.data and cur.next!=None:

You leave this loop when your cur is smaller, so you want to put new element between cur and the previous one. But you use his next. Change it to:
while cur.next!=None and cur.next.data < data:


text:
Q: ZK with Websphere Application Server - Timeout on any Event I have started working with ZK recently. I really like the framework but I am having a lot of problems in configuring it to work correctly with Websphere Application Server v8.0. Namely, I am developing an EJB application with accessing the database via JPA entities and using the ZK framework for GUI. I am developing the application using the Rational Software Architect 8.5.
When I start working on a fresh ZK project in a fresh workspace and server profile everything seems to be working correctly. However, after some time I start having strange problems. I think the problem occurs in the moment when ZK tries to initialize my ViewModel class. I do not get any exceptions or errors, but get the timeout message  in my browser: "The page or component you request is no longer available. This is normally caused by timeout, opening too many Web pages, or rebooting
the server."
My ViewModel initializes by resolving the EJB bean I am using for business logic. That normally works, but as I said, after working for some time on the project, or after restarting my computer the ViewModel object cannot get initialized and the timeout error appears no matter what I do (when ZK tries to bind a variable or when I fire an event needed to be handled by my ViewModel. As before, I do not get any additional errors or exceptions.
Has anybody already had this problem? Is there a solution? Can I change the configuration of my server or ZK to avoid this problem?
Thank you.

A: Seems that I have solved the problem myself. I was using internal Rational Software Architect (Eclipse) browser which apparently has problems handling ZK sessions. When I switched to Firefox, the problems I explained stopped appearing.


text:
Q: DTrace key logger I have tried to see if I could get Brendan Gregg's sshkeysnoop.d to work on Mac OS X, but am having trouble. Is it possible to get this working? If so, how?
The error I am getting is:
dtrace: failed to compile script ./sshkeysnoop.d: line 40: probe description syscall::exec:return does not match any probes

Is it possible to do any other kind of key logging on Mac OS X using DTrace?

A: OS X does not have a syscall::exec DTrace probe. It does have a syscall::execve though. Similarly it doesn't have syscall::open64, which is also used in this script. However, even with replacing exec with execve and removing open64, the script doesn't function correctly.

A: A couple things you can do to adapt scripts like this. First, you can ask dtrace what probe points it has:
$ sudo dtrace -l -f 'syscall::exec*'
   ID   PROVIDER            MODULE                          FUNCTION NAME
18442    syscall                                              execve entry
18443    syscall                                              execve return

Second, you can trace all syscalls on a single process to see what's going on.
$ sudo dtruss ssh somewhere 2>dtrussout
Password: (type something here)

If you look through dtrussout you can see
read_nocancel(0x5, "a\0", 0x1)       = 1 0
read_nocancel(0x5, "s\0", 0x1)       = 1 0
read_nocancel(0x5, "d\0", 0x1)       = 1 0
read_nocancel(0x5, "f\0", 0x1)       = 1 0
read_nocancel(0x5, "\n\0", 0x1)      = 1 0

With that knowledge, it's pretty easy to adapt the script.
$ diff sshkeysnoop.d{.orig,}
40c40
< syscall::exec:return, syscall::exece:return
---
> syscall::execve:return
51c51
< syscall::open:entry, syscall::open64:entry
---
> syscall::open:entry
58c58
< syscall::open:return, syscall::open64:return
---
> syscall::open:return
68c68
< syscall::read:entry
---
> syscall::read_nocancel:entry
75c75
< syscall::read:return
---
> syscall::read_nocancel:return

A: Also make sure you are loading with the all option
kldload dtraceall

and not just
kldload dtrace

Or the syscalls are not going to get loaded.


text:
Q: How Can I Reload the Page Onclick of Submit Button in Angularjs? Hi all I am using MEAN stack in my application with AngularJS as my front-end. How can I Reload the Page onclickof Submit button. if any one knows the solution please help to us.
I have used codes to reload the page as given below:-
In Controller i have used:-
sryarnpayment.$save(function(response) {
  $location.path('sryarnpayments/' + response._id, {}, { reload: true });

     $scope.name = '';
      }, function(errorResponse) {
        $scope.error = errorResponse.data.message;
     });
   };

In HTML :-
<div class="controls">

      <input type="submit" class="btn btn-default">

  </div>

A: Just Add it on  onClick Or Sumitform  In button
onclick="window.location.reload()"

A: To redirect page on click or on submit use
 app.controller('controller', function ($scope, $http, $window) {

$scope.method = function () {

    //Form Submission
        $http({
            method: 'POST',
            url: url,
            data: data,
        })
          .success(function (response) {
            if (response.status == true)
            {
                $window.location.href = base_url;
            }

        });
     };

    // For onClick:
      $scope.method = function() {
       $window.location.href = base_url;
     }
 });

add dependency $window in your controller.
This might help you.

A: Change $location.path('sryarnpayments/' + response._id, {}, { reload: true });
to
ui-router :
$state.go('STATE_NAME', { id: response._id});
ng-route :
$location.path('/sryarnpayments/' + response._id);
Assuming you have defined route(example below) this should work
Example - Route Definition
ui-router :
$stateProvider
.state('STATE_NAME', {
  url: "/sryarnpayments/:id",
  templateUrl: "partials/myPage.html",
  controller: newController
})

ng-route :
config(['$routeProvider', function ($routeProvider) {
    $routeProvider.when('/sryarnpayments/:id', {
        templateUrl: 'path/myPage.html',
        controller: newController
    });
}]);

The parameter can then be accessed in newController as follows:
ui-router :
var id = $stateParams.id;

ng-route :
var id = $routeParams.id;


text:
Q: Linkedin authentication using AngularJS Satellizer module I am using Satellizer module for Social Login & Signup.
I am able to authenticate Instagram but during Linkedin authentication process, I am getting following error -
{
  error_description: 'missing required parameters, includes an invalid parameter value, parameter more than once. : client_secret',
  error: 'invalid_request'
}

I have checked numerous times but could not get this resolved.
Below is the code I am using-
var accessTokenUrl = 'https://www.linkedin.com/uas/oauth2/accessToken';
var peopleApiUrl = 'https://api.linkedin.com/v1/people/~:(id,first-name,last-name,email-address,picture-url,headline,location,industry,summary,specialties,positions,picture-urls::(original))';

var params = {
    client_id: req.body.clientId,
    client_secret: CLIENT_SECRET,
    code: req.body.code,
    redirect_uri: req.body.redirectUri,
    grant_type: 'authorization_code'
};
request.post(accessTokenUrl, {form: params, json: true }, function (err, response, body) {

    if (response.statusCode !== 200) {
        return res.status(response.statusCode).send({message: body.error_description});
    }
    var params = {
        oauth2_access_token: body.access_token,
        format: 'json'
    };
  // Other relevant code
 });

A: Try using set content type header for request Content-Type: application/x-www-form-urlencoded.
From LinkedIn
POST /oauth/v2/accessToken HTTP/1.1
    Host: www.linkedin.com
    Content-Type: application/x-www-form-urlencoded

    grant_type=authorization_code&code=987654321&redirect_uri=https%3A%2F%2Fwww.myapp.com%2Fauth%2Flinkedin&client_id=123456789&client_secret=shhdonottell


text:
Q: UIScrollView stops scrolling after adding UILabel on Storyboard I encountered a strange problem while working with the UIScrollView and UILabel.
My viewDidLoad function looks like this:
- (void)viewDidLoad

    [super viewDidLoad];
// Do any additional setup after loading the view.
    scrollViewContent.contentSize = CGSizeMake(320, 960);
    scrollViewContent.scrollEnabled = YES;
}

If I add UILabel on Storyboard scroller stops scrolling.
Also i added label as subview but this does not change anything
[scrollViewContent addSubview:labelHeader];

Does anyone had a similar problem or know a solution?

A: I've encountered this problem once and solved it with this simple fix:
In storyboard mode first select your UIScrollView and then open the "Resolve Auto Layout Issues"-menu. Click the option: "Add missing constraints".


text:
Q: Notepad++: Prefix every line; start every line automatically with I want to automatically start every new line in Notepad++ with a string, for example 0. I don't want to "replace", I want to prefix. How?

A: you can use the notepad++ python script, register a callback on the notification key ( SCINTILLANOTIFICATION.MODIFIED help ), in the callback function: append the prefix text when a new line has been added
Python code:
from Npp import *

def prefixNewLine(args):
    prefix = "0: "
    if args['linesAdded'] == 1:
        editor.addText(prefix)

editor.callback(prefixNewLine, [SCINTILLANOTIFICATION.MODIFIED])


text:
Q: How to write set of classes to document directory using NSSecureCoding and NSKeyedArchiver? I'm having trouble archiving and/or unarchiving (not sure where the problem is, exactly) a set of custom classes from the iOS documents directory. The set is saved to disk (or at least it appears to be saved) because I can pull it from disk but I cannot unarchive it.
The model
final class BlockedUser: NSObject, NSSecureCoding {
    static var supportsSecureCoding = true
    let userId: String
    let name: String
    let date: Int
    var timeIntervalFormatted: String?

    init(userId: String, name: String, date: Int) {
        self.userId = userId
        self.name = name
        self.date = date
    }

    required convenience init?(coder: NSCoder) {
        guard let userId = coder.decodeObject(forKey: "userId") as? String,
            let name = coder.decodeObject(forKey: "name") as? String,
            let date = coder.decodeObject(forKey: "date") as? Int else {
                return nil
        }
        self.init(userId: userId, name: name, date: date)
    }

    func encode(with coder: NSCoder) {
        coder.encode(userId, forKey: "userId")
        coder.encode(name, forKey: "name")
        coder.encode(date, forKey: "date")
    }
}

Writing to disk
let fm = FileManager.default
let dox = fm.urls(for: .documentDirectory, in: .userDomainMask)[0]
let dir = dox.appendingPathComponent("master.properties", isDirectory: true)

do {
    let userData: [URL: Any] = [
        /* Everything else in this dictionary is a primitive type (string, bool, etc.)
           and reads and writes without problem from disk. The only thing I cannot
           get to work is the entry below (the set of custom classes). */
        dir.appendingPathComponent("blockedUsers", isDirectory: false): blockedUsers // of type Set<BlockedUser>
    ]

    for entry in userData {
        let data = try NSKeyedArchiver.archivedData(withRootObject: entry.value, requiringSecureCoding: true)
        try data.write(to: entry.key, options: [.atomic])
    }
} catch {
    print(error)
}

Reading from disk
if let onDisk = try? Data(contentsOf: dir.appendingPathComponent("blockedUsers", isDirectory: false)) {
    if let blockedUsers = try? NSKeyedUnarchiver.unarchiveTopLevelObjectWithData(onDisk) as? Set<BlockedUser> {
        print("success")
    } else {
        print("file found but cannot unarchive") // where I'm currently at
    }
} else {
    print("file not found")
}

A: The problem is that you are trying to decode an object instead of decoding an integer. Check this post. Try like this:
class BlockedUser: NSObject, NSSecureCoding {
    static var supportsSecureCoding = true
    let userId, name: String
    let date: Int
    var timeIntervalFormatted: String?
    init(userId: String, name: String, date: Int) {
        self.userId = userId
        self.name = name
        self.date = date
    }
    func encode(with coder: NSCoder) {
        coder.encode(userId, forKey: "userId")
        coder.encode(name, forKey: "name")
        coder.encode(date, forKey: "date")
        coder.encode(timeIntervalFormatted, forKey: "timeIntervalFormatted")
    }
    required init?(coder: NSCoder) {
        userId = coder.decodeObject(forKey: "userId") as? String ?? ""
        name = coder.decodeObject(forKey: "name") as? String ?? ""
        date = coder.decodeInteger(forKey: "date")
        timeIntervalFormatted = coder.decodeObject(forKey: "timeIntervalFormatted") as? String
    }
}


text:
Q: python,running command line servers - they're not listening properly Im attempting to start a server app (in erlang, opens ports and listens for http requests) via the command line using pexpect (or even directly using subprocess.Popen()).
the app starts fine, logs (via pexpect) to the screen fine, I can interact with it as well via command line...
the issue is that the servers wont listen for incoming requests. The app listens when I start it up manually, by typing commands in the command line. using subprocess/pexpect stops the app from listening somehow...
when I start it manually "netstat -tlp" displays the app as listening, when I start it via python (subprocess/pexpect) netstat does not register the app...
I have a feeling it has something to do with the environemnt, the way python forks things, etc.
Any ideas?
thank you
basic example:
note:
"-pz" - just ads ./ebin to the modules path for the erl VM, library search path
"-run" - runs moduleName, without any parameters.
command_str = "erl -pz ./ebin -run moduleName"
child = pexpect.spawn(command_str)
child.interact() # Give control of the child to the user

all of this stuff works correctly, which is strange. I have logging inside my code and all the log messages output as they should. the server wouldnt listen even if I started up its process via a bash script, so I dont think its the python code thats causing it (thats why I have a feeling that its something regarding the way the new OS process is started).

A: It could be to do with the way that command line arguments are passed to the subprocess.
Without more specific code, I can't say for sure, but I had this problem working on sshsplit ( https://launchpad.net/sshsplit )
To pass arguments correctly (in this example "ssh -ND 3000"), you should use something like this:
openargs = ["ssh", "-ND", "3000"]
print "Launching %s" %(" ".join(openargs))
p = subprocess.Popen(openargs, stdout=subprocess.PIPE, stderr=subprocess.PIPE)

This will not only allow you to see exactly what command you are launching, but should correctly pass the values to the executable. Although I can't say for sure without seeing some code, this seems the most likely cause of failure (could it also be that the program requires a specific working directory, or configuration file?).


text:
Q: Javascript Yield Calculator that emulates Excel I am building a bond calculator and I need to get the Yield outputted as a percentage I have used Excel as a guide and the =YIELD() function that is in there.
In excel for these given values I return 5.181800
=YIELD(19-02-2015, 21-02-2019, 5.75/100, 102.031, 100, 2, 1)*100
=YIELD(SettlementDate, MaturityDate, CouponsRate, BondPrice, 100, Coupons PA, Basis) * 100

In Javascript I have written
function dayDiff(date1, date2) {

    var timeDiff = Math.abs(date2.getTime() - date1.getTime());
    var diffDays = Math.ceil(timeDiff / (1000 * 3600 * 24));

    return diffDays;
}

var settlement = '2015-02-19',
maturity = '2019-02-21',

settlement = new Date(settlement);
maturity = new Date(maturity);

var timeToMaturity = dayDiff(settlement, maturity);
var coupon = 5.75 / 100;
var yield = 102.031;
var redemption = 100;
var frequency = 2;

var price = 0.0;
if(timeToMaturity > 0) {
    price += redemption;
}
var paymentTime = timeToMaturity;
while(paymentTime > 0) {
    price += coupon/frequency;

    // Discount back
    price = price / (1.0 + yield / frequency);
    paymentTime -= 1.0 / frequency;
}
var accrualPeriod = 0.0-paymentTime;
price *= Math.pow(1.0 + yield / frequency, accrualPeriod*frequency);
price -= coupon/frequency * accrualPeriod*frequency;

console.log(price * 100 * 100);

This returns 5.635542139153786 can anyone tell me where I am going wrong?


text:
Q: Jquery Problem with the add and Update Iam having a html table which has some number of rows say 17 rows .I have a small form with the fields which adds the form values to this html table . I have a unique field in the table say part number
I Have Two buttons named add and Update .When i click on "Add"  .it Should add the part number with the appropriate form value(this i have Done).But if the Part number already exists in the html table It Should Say "Part number already exists"
Update: in the Update it should select a row and show the values in the form fields   (this part I have Done ) when I click on update It should update that row and if the User changes the part number field to the existing part  number in the table  then  it should Say it part number already exists
Here is the sample code that i have written for add button and would be the same for update
$("#addbtnPO").click(function(){
    if ($("#myform").validationEngine({returnIsValid:true})) {
        var totrows= $('#mytable').attr('rows').length;
        for(var i=2;i <= totrows-1; i++){
        partvalue   = $("#mytable").find('td > #partno_'+i).text();
                if($('#partno').attr('value') == partvalue){
                    $("#error").text('# already exists');
                    return;
            }
        }
        $("#hiddenvariable").attr("value","");
        $("#hiddenvariable").attr("value","add");
        $("#myform").submit();
    }
});

//here My Problem is Iam Starting value for "partno" =>from "2" i should be able to start from Partno1 .Please Help me .
Please Suggest me appropriate soloution.

A:
My Problem is Iam Starting value for
  "partno" =>from "2" i should be able
  to start from Partno1

Do not fully understand your question but try changing below line:
for(var i=2;i <= totrows-1; i++){

To:
for(var i=1;i <= totrows-1; i++){


text:
Q: How to define Multiple occurrences in XML I am trying to integrate FedEx in my application . In one module i had to define one element as Multiple occurrences. please check below image

How i need to define EVENTS element ?
I tried below methods
1
<ON_DELIVER type="EVENTS"/>
2
<EVENTS>ON_DELIVER</EVENTS>
3
<EVENTS>[ON_DELIVER]</EVENTS>
4
<EVENTS>
  <ON_DELIVER>TRUE</ON_DELIVER>
</EVENTS>

I got below error Element 'Events' is a simple type, so it must have no element information item [children]
I want to know how can i define EVENTS element with that 5 values.

A: The below XML should help you setup multiple notifications.
One for the customer and one for your customer service team
<SpecialServicesRequested>
    <SpecialServiceTypes>EVENT_NOTIFICATION</SpecialServiceTypes>
    <EventNotificationDetail>
        <AggregationType>PER_SHIPMENT</AggregationType>
        <PersonalMessage>This is a notification sent by Fedex, for your order: XXXX-XXXX</PersonalMessage>
        <EventNotifications>
            <Role>RECIPIENT</Role>
            <Events>ON_SHIPMENT</Events>
            <Events>ON_EXCEPTION</Events>
            <Events>ON_ESTIMATED_DELIVERY</Events>
            <Events>ON_DELIVERY</Events>
            <NotificationDetail>
                <NotificationType>EMAIL</NotificationType>
                <EmailDetail>
                    <EmailAddress>XXXX@hotmail.com</EmailAddress>
                    <Name>Claire Pounder</Name>
                </EmailDetail>
                <Localization>
                    <LanguageCode>EN</LanguageCode>
                </Localization>
            </NotificationDetail>
            <FormatSpecification>
                <Type>HTML</Type>
            </FormatSpecification>
        </EventNotifications>
        <EventNotifications>
            <Role>SHIPPER</Role>
            <Events>ON_SHIPMENT</Events>
            <Events>ON_EXCEPTION</Events>
            <Events>ON_ESTIMATED_DELIVERY</Events>
            <Events>ON_DELIVERY</Events>
            <NotificationDetail>
                <NotificationType>EMAIL</NotificationType>
                <EmailDetail>
                    <EmailAddress>XXXX@YOUREMAIL.com</EmailAddress>
                    <Name>MANAGER Email</Name>
                </EmailDetail>
                <Localization>
                    <LanguageCode>EN</LanguageCode>
                </Localization>
            </NotificationDetail>
            <FormatSpecification>
                <Type>HTML</Type>
            </FormatSpecification>
        </EventNotifications>
    </EventNotificationDetail>
</SpecialServicesRequested>


text:
Q: Jquery - Dos listas y clonar los items tengo 2 listas e intento hacer que al mover un item de la derecha hacia la izquierda se "clone" (eso funciona)
Pero me gustaria que pudiera poner un item entre varios.
Es decir si tengo creado "item1" y "item2", poder poner el "item3" entre estos dos.
Para ello tengo este código

$(document).ready(function () {
            $("h1").click(function () {
                $("#emp_list").slideToggle("500");
            });

            $("#emp_list li").draggable({
                helper: "clone",
                 revert: 'invalid',
                opacity: "0.5"
            });

            $("#Potential_Assignee").droppable({
                accept: $("#emp_list li"),
                hoverClass: "dropHover",
                drop: function (ev, ui) {
                    $(this).find(".replace_me").remove();
                    var me = ui.draggable.clone()
                    me.appendTo(this)
                        .addClass("newClass");
                }
            })

        });
#employee {
        float:left;
        border: 2px solid #000;
        width: 400px;
        margin-right: 2em;
        background: linen;
    }
    #Potential_Assignee {
        float: left;
        width: 400px;
        margin-top: 1 em;
        background:BlanchedAlmond;
        border: 2px solid #000;
    }
    .result_header {
        border-style: double;
        border-radius: 1px;
        border-color: black;
    }
    #emp_list {
        position: relative;
    }
    a {
        text-decoration: none;
        color: black;
    }
    .newClass {
        border: 1px solid black;
        background-color: #9eebcf;
        padding: 0 5px 5px 5px;
        color: blue;
        list-style-position:inside;
    }
    ol {
        list-style: none;
        opacity: 0.5;
    }

Formulario

Drag the names

Acciones

Texto

Foto

Firma

A: Ya que estás usando JQuery-UI podrías hacer que el listado al que arrastras seas ordenable, de esa manera aunque no se clonen exactamente donde quieres una vez clonado podrás ordenarlos.
También he retocado el donde clonabas los
 ya que lo estaban haciendo fuera del
 que tenías preparado para ello.

$(document).ready(function () {
            $("h1").click(function () {
                $("#emp_list").slideToggle("500");
            });

            $("#emp_list li").draggable({
                helper: "clone",
                 revert: 'invalid',
                opacity: "0.5"
            });

            $("#Potential_Assignee").droppable({
                accept: $("#emp_list li"),
                hoverClass: "dropHover",
                drop: function (ev, ui) {
                    $(this).find(".replace_me").remove();
                    var me = ui.draggable.clone()
                    me.appendTo($(this).find('.content ol'))
                        .addClass("newClass");
                }
            })

            $('#Potential_Assignee .content ol').sortable();

        });
#employee {
        float:left;
        border: 2px solid #000;
        width: 400px;
        margin-right: 2em;
        background: linen;
    }
    #Potential_Assignee {
        float: left;
        width: 400px;
        margin-top: 1 em;
        background:BlanchedAlmond;
        border: 2px solid #000;
    }
    .result_header {
        border-style: double;
        border-radius: 1px;
        border-color: black;
    }
    #emp_list {
        position: relative;
    }
    a {
        text-decoration: none;
        color: black;
    }
    .newClass {
        border: 1px solid black;
        background-color: #9eebcf;
        padding: 0 5px 5px 5px;
        color: blue;
        list-style-position:inside;
    }
    ol {
        list-style: none;
        opacity: 0.5;
    }

Formulario

Drag the names

Acciones

Texto

Foto

Firma

Referencia: sortable()


text:
Q: What does bamfdaemon do? I've googled for it, and there's very little info besides "bamf matches application windows to desktop files".
Unity depends on it so it's difficut to remove, at least would be good to know what it does.

A: When you open a program, Unity will either pop up a new icon on the launcher(dock) and/or add an arrow to an existing icon. Each icon is not an executable; it is a .desktop file. bamfdaemon helps this by determining whether an arrow needs to be added to an existing icon, or a new icon be popped up, along with other behaviors dependent on application identity.

A: I think it is related to Unity Integration for websites. I hope I am right ...
edit: According to this  it is:

Window matching library - daemon  bamf matches application windows to
  desktop files
This package contains the daemon used by the library and a gio  module
  that facilitates the matching of applications started  through
  GDesktopAppInfo

A:
bamfdaemon helps this by determining whether an arrow needs to be
  added to an existing icon, or a new icon be popped up, along with
  other behaviors dependent on application identity.

in order to append the excellent answer what bamfdaemon can do for you, you can simple uninstall it as a test, without purge option.
sudo apt-get remove bamfdaemon

This way you will get the idea this daemon is behind ALT+TAB application switcher.
You install it again and everything will be in place:
sudo apt-get install bamfdaemon

If you for instance, kill that process, it will be spawn again, but you may end with icon disorder.


text:
Q: Get element with attached event binding in Angular2 I want to get the element with the (click) event binding:

  Component Name

As you can see, it is the  element. However, after clicking and logging the event object, it shows this:

I want to get the  element, but sadly I couldn't find a solution yet.

A: Use event.currentTarget
reorderComponents(event) {
  console.log(event.currentTarget);
}

It always refers to the element to which the event handler has been attached, as opposed to event.target which identifies the element on which the event occurred.
Plunker Example

A: I hope this help you.
reorderComponents(event){
   console.log(event.toElement.nodeName)
}


text:
Q: clang target is ignored Im trying to set a target when using clan compiler 5.0.0:
& "C:\Program Files\LLVM\bin\clang" -v .\src\Filter.cpp -target powerpc-unknown-linux

clang version 5.0.0 (tags/RELEASE_500/final) Target:
  powerpc-unknown-linux Thread model: posix InstalledDir: C:\Program
  Files\LLVM\bin  "C:\Program Files\LLVM\bin\clang.exe" -cc1 -triple
  powerpc-unknown-linux -emit-obj -mrelax-all -disable-free
  -disable-llvm-verifier -discard-value-names -main-file-name MessageFilter.cpp -mrelocation-model static -mthread-model posix
  -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases -target-cpu ppc -mfloat-abi hard -v -dwarf-column-info -debugger-tuning=gdb -resource-dir "C:\Program Files\LLVM\lib\clang\5.0.0" -internal-isystem /usr/local/include
  -internal-isystem "C:\Program Files\LLVM\lib\clang\5.0.0\include" -internal-externc-isystem
  /include -internal-externc-isystem /usr/include -fdeprecated-macro
  -fdebug-compilation-dir "C:\Source\Filter"
  -ferror-limit 19 -fmessage-length 120 -fno-signed-char -fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -o "C:\Users\kfir\AppData\Local\Temp\Filter-6f8e03.o" -x c++
  ".\src\Filter.cpp" clang -cc1 version 5.0.0 based upon LLVM
  5.0.0 default target x86_64-pc-windows-msvc

Even though I have set the target as -target powerpc-unknown-linux it is ignored by the clang compiler, and it sets another value:
x86_64-pc-windows-msvc

I would very appreciate some help with that.


text:
Q: ModuleNotFoundError while using geodesic in udf pyspark function We have pyspark dataframe like:
df = spark.createDataFrame([(['target'], [2], [2], [3], [3]), (['NJ'],[3],[3], [4], [4]), (['target', 'target'],[4,5], [4,5], [6,7], [6,7]), (['CA'],[5],[5], [6], [6]), ], ('group_name', 'long', 'lat','com_long','com_lat'))

Schema
We want to extract the data at the position of target and use it to perform a distance calculation with a udf function.
First we want to get the index of the target position in the group_name column.
df = df.withColumn("target-1a-idx", (F.array_position(df.group_name, "target") -1 ))
df = df.withColumn("target-1a-idx",F.when(F.col("target-1a-idx")!=-1,F.col("target-1a-idx")))

Now we create the helper columns with the target index.
columns = ['long', 'lat','com_long','com_lat']
for col in columns:
    df = df.withColumn(
        prefix + col, F.col(col)[F.col("target-1a-idx")])

DF with helper columns
Filtering the Null values is optional.
df_filtered = df.filter(F.col("target-1a-idx").isNotNull())

Finally we defined a udf function to calculate distance, and called it
import geopy
from geopy.distance import geodesic

@F.udf(returnType=T.FloatType())
def geodesic_udf(a, b):
    if (a is None) | (b is None):
        return 1.0
    else:
        return geodesic(a, b).meters

df_filtered = df_filtered.withColumn(
    "distance_to_station",
    geodesic_udf(
        F.array("target_long", "target_lat"),
        F.array(
            "target_com_long",
            "target_com_lat",
        ),
    ),
)

`
ERROR MESSAGE
While we are absolutely sure that we installed and imported geopy and geodesic correctly, we recieved ModuleNotFoundError. We guess the problem is actually not with the module.

ModuleNotFoundError: No module named 'geopy'

This is the error message:
Could you help us with the answer. Thank you!
Checked imports and installed packages (pip list). And filtered Nulls.

A: The problem is with the use of the nodes. The library is not installed in the node. Using a udf does not use sparklogik but python and would need the library on each node.
-> If possible, do not use a udf but a pyspark/spark native function.
def calc_distance(df, suffix, lat1, lat2, lon1, lon2):
#Haversine formula to calculate the distance between two gps coordinates and return the calculated result as Spark dataframe definition.

df = df.withColumn('haversine_d{sf}'.format(sf=suffix), (F.pow(F.sin(F.radians(F.col(lat2) - F.col(lat1)) / 2), 2) +
                                       F.cos(F.radians(F.col(lat1))) * F.cos(F.radians(F.col(lat2))) *
                                       F.pow(F.sin(F.radians(F.col(lon2) - F.col(lon1)) / 2), 2)))
df = df.withColumn('distance_in_m{sf}'.format(sf=suffix), F.atan2(F.sqrt(F.col('haversine_d{sf}'.format(sf=suffix))), F.sqrt(-F.col('haversine_d{sf}'.format(sf=suffix)) + 1)) * 12742000)
df = df.drop('haversine_d{sf}'.format(sf=suffix))
return df

or
-> run the environment on each node. Description here

p.s. I am part of the team asking the question.


text:
Q: ASP.NET - Control Events Not Firing Inside Repeater This is a absurdly common issue and having exhausted all of the obvious solutions, I'm hoping SO can offer me some input... I have a UserControl inside a page which contains a repeater housing several controls that cause postback. Trouble is, all of the controls inside of the repeater never hit their event handlers when they postback, but controls outside of the repeater (still in the UC) are correctly handled. I already made sure my controls weren't being regenerated due to a missing if(!IsPostBack) and I verified that Request.Form["__EVENTTARGET"] contained the correct control ID in the Page_Load event. I attempted to reproduce the symptoms in a separate project and it worked as it should.
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="NoteListControl.ascx.cs"
    Inherits="SantekGBS.Web.UserControls.NoteListControl" %>

<asp:UpdatePanel ID="upNotes" runat="server" UpdateMode="Conditional">
    <ContentTemplate>

            <asp:Repeater ID="repNotes" runat="server">
                <HeaderTemplate>

                </HeaderTemplate>
                <ItemTemplate>

                        <asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/Content/images/DeleteIcon.gif"
                            OnClick="ibRemove_Click" CommandArgument='<%# Container.ItemIndex %>' CommandName='<%# Eval("ID") %>'
                            CausesValidation="false" AlternateText="Delete" />
                        <%# Eval("Text") %>

                </ItemTemplate>
                <FooterTemplate>

                </FooterTemplate>
            </asp:Repeater>
            <asp:PlaceHolder ID="phNoNotes" runat="server" Visible="false">

                    No notes to display.

            </asp:PlaceHolder>

    </ContentTemplate>
</asp:UpdatePanel>

public partial class NoteListControl : UserControl
{
    [Ninject.Inject]
    public IUserManager UserManager { get; set; }

    protected List<Note> Notes
    {
        get
        {
            if (ViewState["NoteList"] != null)
                return (List<Note>)ViewState["NoteList"];
            return null;
        }
        set { ViewState["NoteList"] = value; }
    }

    public event EventHandler<NoteEventArgs> NoteAdded;
    public event EventHandler<NoteEventArgs> NoteDeleted;
    public event EventHandler<NoteEventArgs> NoteChanged;

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            UtilityManager.FillPriorityListControl(ddlPriority, false);
        }
    }

    protected void ibRemove_Click(object sender, ImageClickEventArgs e)
    {
        System.Diagnostics.Debug.WriteLine("ibRemove POSTBACK"); // This is NEVER hit
    }

    public void Fill(List<Note> notes)
    {
        Notes = notes;
        RefreshRepeater();
    }

    private void RefreshRepeater()
    {
        if (Notes != null && Notes.Any())
        {
            var sorted = Notes.OrderByDescending(n => n.Timestamp);
            Notes = new List<Note>();
            Notes.AddRange(sorted);
            repNotes.Visible = true;
            phNoNotes.Visible = false;
            repNotes.DataSource = Notes;
            repNotes.DataBind();
        }
        else
        {
            repNotes.Visible = false;
            phNoNotes.Visible = true;
        }
    }
}

public class NoteEventArgs : EventArgs
{
    public Note Note { get; set; }
    public NoteEventArgs()
    { }
    public NoteEventArgs(Note note)
    {
        this.Note = note;
    }
}

The code is intentionally missing functionality so just disregard that fact.

A: Your edited code has residual CommandArgument and CommandName properties; are you actually handling the Repeater.ItemCommand event?
If so, and if your page calls the control's Fill method on postbacks, that would explain it.
This classic ASP.NET hair-tearing problem is explained in these posts: A Stumper of an ASP.NET Question and A Stumper of an ASP.NET Question: SOLVED!
The explanation is a little mind-bending, but the crux of it is that Repeater.DataBind interferes with ASP.NET's ability to determine which repeater button caused a postback.

A: I found a missing td-tag in the Itemtemplate, sometimes when DOM is incorrect, the updatapanel do strange things.

A: Just about EVERY time I run into this problem it's because DataBind() is being called when it shouldn't be.  This will kill most events from controls inside a repeater.  I see you have an !IsPostBack check in your Page_Load... so that's a start.  But try putting a breakpoint on repNotes.DataBind() and see if it's getting called when you don't expect it.
Does it work OK outside of an UpdatePanel?

A: I ran into the same problem. It happened with me if I've ran the DataBind twice. In other words when I populate the repeater control twice (for any reason) the events wont fire.
I hope that helps.


text:
Q: Bound the minimum eigenvalue of a symmetric matrix via matrix norms I'm reading a paper in which the authors prove an inequality of the following form:
$$\lVert H-H'\rVert_2 \leq \lVert H-H'\rVert_F \leq \epsilon \tag 1$$
Here $H$ and $H'$ are symmetric real matrices ($H'$ has all positive eigenvalues, if that matters), and the norms are the $L_2$ matrix norm and the Frobenius norm, respectively. With no justification the authors then claim:
$$\lambda_\text{min}(H) \geq \lambda_\text{min}(H') - \epsilon \tag 2$$
where $\lambda_\text{min}$ is the minimum eigenvalue of a matrix.
I can't see how to justify this, or even if (2) is even intended to be deduced from the (1). Here is the paper - the end of the proof of Lemma 3.2, page 6.

A: This answer is based on this one. Below we will be working with some arbitrary inner product, and when we take the norm of a matrix, this means the operator norm associated with the vector norm we're using. We have:
Theorem. If $A$ and $B$ are real symmetric, then:
$$\lambda_\text{min} (A) \geq \lambda_\text{min} (B) - \lVert A-B\rVert$$
$$\lambda_\text{max} (A) \leq \lambda_\text{max} (B) + \lVert A-B\rVert$$
To prove this, the key is the expression $x^T Mx$, where $M$ is a symmetric matrix and $x$ has unit norm. We need two lemmas about this expression.

Lemma 1. For any matrix $M$ and any unit norm $x$:
$$-\lVert M\rVert \leq x^T Mx\leq \lVert M\rVert$$
Proof. Simple application of Cauchy-Schwartz and of the definition of an operator norm:
$$|x^TMx|\leq\lVert x\rVert \lVert Mx\rVert\leq \lVert x\rVert^2 \lVert M\rVert=\lVert M\rVert$$

Lemma 2. For any symmetric matrix $M$ and any unit norm $x$:
$$\lambda_\text{min}(M) \leq x^T M x \leq \lambda_\text{max}(M)$$
and the bounds are attained as $x$ varies over the unit sphere.
Proof. Let $M=P^TDP$ where $P$ is orthogonal and $D$ is diagonal. Then
$$x^TMx = (Px)^TD(Px)$$
As $x$ varies over the unit sphere, $Px$ varies also over the entire unit sphere, therefore the range of the latter expression above is simply the range of $y^TDy$ as $y$ ranges over the unit sphere. By the rearrangement inequality and some other simple arguments, the minimum is attained when $y$ is an eigenvector associated with $\lambda_\text{min}(M)$ and the maximum when $y$ is an eigenvector associated with  $\lambda_\text{max}(M)$.

Finally we can prove the theorem. For any unit norm $x$, we have
$$x^TAx = x^TBx + x^T(A-B)x$$
By applying Lemma 1 to the second term and Lemma 2 to the first term, the minimum of the left hand side is at least $\lambda_\text{min} (B)-\lVert A-B\rVert$. By Lemma 2, we know that the minimum of the left hand side is equal to $\lambda_\text{min} (A)$. A similar argument shows the other inequality in the theorem.


text:
Q: wrap each text block of certain length into its own div using javascript I'd like to wrap a block of text into divs such that each div has the same number of characters. The goal is to make divs that can be clicked between like pages of a book, i.e.,  pagination. I'm having trouble though with the each() statement to wrap each segment of the text block into its own div of equal length.
Jere's the code Hhich works for one div but doesn't yet work to make multiple divs:
HTML:

hi my name is joe. I work at a school.

<button>wrap</button>

javaScript:
$('button').on('click', function(){
  var content=$('#content').text();
  $('#count').text(content.length);
  /*   var length20; //20 character long text block
    if(content.length>=20);
      $.each(length20, function(){
    length20.wrap('
');
    }
 */
});

here's the fiddle if you'd like to edit the code directly.
If someone might be able to edit this fiddle to fix its each() statement I'd be very appreciative.

A: Try something like this:
$('button').on('click', function(){
     var content=$('#content').text();
     //'5'-length blocks
     var parts = content.match(/.{1,5}/g);
     $('#count').text(parts.length);
     $.each( parts, function( index, part ){
        $("body").append ('
'+part+'
')
     });
});


text:
Q: Print a 'plot' of empty grey squares to PDF with matplotlib I want to make a PDF of a question sheet. So I want to print a question, and then a block of empty grey boxes where the students fill in their answers.
I'm having trouble making the plot of empty grey squares. I thought one way to do it would be (1) to make a plot with some random data, (2) remove the data and the labels etc, (3) justify the plot so it stretches over the whole width of the page
This code:
import matplotlib.backends.backend_tkagg

import matplotlib
from matplotlib import pyplot as plt
import matplotlib.style
matplotlib.use("MacOSX")
time = [0,1,2,3] #dummy x axis
position = [0,100,200,300] # dummy y axis
plt.style.use('ggplot')
f = plt.figure()
plt.plot(time, position) #plot it
plt.xticks(time," ") #tried to remove the x-axis labels AND TICKS
plt.show()

The output is
So I would know how to remove the y-axis words (plt.yticks,position, " ") but not how to remove the actual plot. The answers I've seen work elsewhere e.g. here don't seem to work.
Ideally can someone show me either (1) how to print a small (e.g. 1/6th of an A4 page) of grey squares to a PDF, or if not (2) how to actually remove the line from the below graph (doing plt.plot() also removed the grey squares).
I'm not sure if this would matter to the answer (i.e. combining text and picture?) but the ultimate aim would be for 4 strings, to print string, then empty grey boxes, string, empty grey boxes ; like a standard worksheet/exam paper style.

A: Came up with this code that does what I want it to do, prints a block of empty grey squares:
time = [0,1,2,3,4,5,6,7,8,9]
position = [0,1,2,3,4,5,6,7,8,9]
plt.style.use('ggplot')
f = plt.figure(figsize=(30,10))
plt.plot(time, position,linestyle='None')
plt.xticks(time," ")
plt.yticks(position," ")
plt.tick_params(axis='both', which='both', bottom=False, top=False, labelbottom=False, right=False, left=False, labelleft=False)


text:
Q: Remove Redundance via bash I have this problem, I have the following lines:
http://grouplogic.com:80/store/index.cfm?cfid=11812682&cftoken=26157811&fa=conre
http://grouplogic.com:80/store/index.cfm?fa=PrtSlt&id=532&prTpID=5&
http://grouplogic.com:80/store/index.cfm?fa=PrtSlt&prTpID=5&
http://grouplogic.com:80/store/index.cfm?upTp=2&fa=upgrade&UpNewType=2&prTpID=5&&ptype=FS
http://grouplogic.com:80/store/index.cfm?cfid=11812682&cftoken=26157811&fa=conre&ca=2412

And I want to remove every line that has every parameter on another line, let's say, this two lines:
http://grouplogic.com:80/store/index.cfm?cfid=11812682&cftoken=26157811&fa=conre
http://grouplogic.com:80/store/index.cfm?cfid=11812682&cftoken=26157811&fa=conre&ca=2412

I want to keep this one only:
http://grouplogic.com:80/store/index.cfm?cfid=11812682&cftoken=26157811&fa=conre&ca=2412

Because is the one with more parameters and the first one would be redundant.
I would like to keep this ones:
http://grouplogic.com:80/store/index.cfm?fa=PrtSlt&id=532&prTpID=5&
http://grouplogic.com:80/store/index.cfm?upTp=2&fa=upgrade&UpNewType=2&prTpID=5&&ptype=FS
http://grouplogic.com:80/store/index.cfm?cfid=11812682&cftoken=26157811&fa=conre&ca=2412

I want to remove every line that has the same parameters on other lines, keep the ones that have more parameters, not the ones that have fewer.
Another example:
I want to convert this:
http://grouplogic.com:80/Knowledge/index.cfm?fuseaction=view&docID=111
http://grouplogic.com:80/news-events/index.cfm?fa=viewNews&ID=390
http://grouplogic.com:80/public/quickpoll/index.cfm?fuseaction=quickPollResults&QuestionID=8
http://grouplogic.com:80/store/index.cfm?cfid=11812682&cftoken=26157811&fa=conre
http://grouplogic.com:80/store/index.cfm?fa=PrtSlt&id=532&prTpID=5&
http://grouplogic.com:80/store/index.cfm?upTp=2&fa=upgrade&UpNewType=2&prTpID=5&&ptype=FS
http://grouplogic.com:80/news-events/index.cfm?fa=viewRelease&ID=21&prod=2
http://grouplogic.com:80/content/index.cfm?fuseaction=faq_list&ProdID=1&archive=1
http://grouplogic.com:80/content/index.cfm?ID=103
http://grouplogic.com:80/Knowledge/index.cfm?fuseaction=view&amp
http://grouplogic.com:80/knowledge/index.cfm?fuseaction=view&docID=10
http://grouplogic.com:80/content/index.cfm?ID=123

into this:
http://grouplogic.com:80/Knowledge/index.cfm?fuseaction=view&docID=111
http://grouplogic.com:80/news-events/index.cfm?fa=viewRelease&ID=21&prod=2
http://grouplogic.com:80/public/quickpoll/index.cfm?fuseaction=quickPollResults&QuestionID=8
http://grouplogic.com:80/store/index.cfm?cfid=11812682&cftoken=26157811&fa=conre
http://grouplogic.com:80/store/index.cfm?fa=PrtSlt&id=532&prTpID=5&
http://grouplogic.com:80/store/index.cfm?upTp=2&fa=upgrade&UpNewType=2&prTpID=5&&ptype=FS
http://grouplogic.com:80/content/index.cfm?fuseaction=faq_list&ProdID=1&archive=1
http://grouplogic.com:80/content/index.cfm?ID=103

Same parameters in different resource, must be different lines.
If I got this:
http://grouplogic.com:80/content/index.cfm?ID=123
http://grouplogic.com:80/content2/index.cfm?ID=123

I want to keep them both.
EDIT 19th August:

Another example of URLs and how I would like them to be handled:
https://es.answers.search.yahoo.com/search?p=mixmail+correo&fr2=piv-web
https://es.answers.search.yahoo.com/search?p=educastur+campus&fr2=piv-web
https://techvalidation.dell.com/Default.aspx?id=9d459f5c-8a26-4268-b37c-23980a6ba577&Key=%2fuKb2WS3da4lk%2f34VSXE4F02YqS5LfvbKFGcDXNQxgIvvbodU3o3lHoNm09M67Ut&SRC=QuoteCenter&newsession=true
https://techvalidation.dell.com/technicalvalidationlist.aspx?key=6ivAYJco9bouAJBNkQ8rgtGWPdfLVRumAScf7bIb6DMpj6SYVdWy6bd4ITEPF4tQMkNzNpGshERZndX3Ia%2bbqhJ3CnrC46qJkHJ4TdiyN78%3d&PartnerAffinityId=3341728904&SRC=QuoteCenter
https://web.xnet.ford.com/3.0/samlerror?faultreason=SSO_LOGOFF
https://web.xnet.ford.com/3.0/samlerror?faultreason=SSO_ERROR&language=fr
https://wwwmg.pandacn.ford.com/forms/frmservlet?config=pandacn3
https://www.panda.ford.com/forms/frmservlet?config=pandain4
https://www.panda.ford.com/forms/frmservlet?config=pandain3

It should output:
https://es.answers.search.yahoo.com/search?p=mixmail+correo&fr2=piv-web
https://techvalidation.dell.com/Default.aspx?id=9d459f5c-8a26-4268-b37c-23980a6ba577&Key=%2fuKb2WS3da4lk%2f34VSXE4F02YqS5LfvbKFGcDXNQxgIvvbodU3o3lHoNm09M67Ut&SRC=QuoteCenter&newsession=true
https://techvalidation.dell.com/technicalvalidationlist.aspx?key=6ivAYJco9bouAJBNkQ8rgtGWPdfLVRumAScf7bIb6DMpj6SYVdWy6bd4ITEPF4tQMkNzNpGshERZndX3Ia%2bbqhJ3CnrC46qJkHJ4TdiyN78%3d&PartnerAffinityId=3341728904&SRC=QuoteCenter
https://web.xnet.ford.com/3.0/samlerror?faultreason=SSO_ERROR&language=fr
https://wwwmg.pandacn.ford.com/forms/frmservlet?config=pandacn3
https://www.panda.ford.com/forms/frmservlet?config=pandain4

My approach just works on URLs with just one parameter:
https://www.panda.ford.com/forms/frmservlet?config=pandain4
https://www.panda.ford.com/forms/frmservlet?config=pandain3

I do: cat list.txt | sort -u -t "=" -k 1,1 and I output:
https://www.panda.ford.com/forms/frmservlet?config=pandain4

But it fails with these ones:
https://web.xnet.ford.com/3.0/samlerror?faultreason=SSO_LOGOFF
https://web.xnet.ford.com/3.0/samlerror?faultreason=SSO_ERROR&language=fr

Where I keep
https://web.xnet.ford.com/3.0/samlerror?faultreason=SSO_LOGOFF

with | cat list.txt | sort -u -t "=" -k 1,1 and I wanted exactly the other line
https://web.xnet.ford.com/3.0/samlerror?faultreason=SSO_ERROR&language=fr

Because it has the same parameters and more.
Regards!

A: Doing this properly requires a lot of internal sorting which inside a bash loop spawns a lot of processes and slows the job down too much.
Switching to perl. Note that this reorders arguments as well as lines; if you need the original lines untouched and/or in the original order, we'll have to add another step or three. You should also note that you have knowledge both capitalized and lowercase; url's are case insensitive through the port, but path after that is case sensitive, so they will not register as the same even if they get identical arguments.
#!/usr/bin/env perl

use strict;     # I ALWAYS use strict and warnings unless
use warnings;   # there is some compelling reason not to.

open my $fh, 'urls' or die "urls: $!";
my %urlsOUT;
foreach ( <$fh> ) { chomp;
    my %args;                              # clean for each record
    m!^(https?://[^/]+)(/[^?]+)[?](.*)!i;  # catch the base in separate case sensitivities
    my ($base) = lc($1).$2;                # always lowercase the case insensitive part
    @args{ split /[?&]+/, $3 } = ();       # removes duplicate args in a url
    my ( $args ) = join '&', reverse sort keys %args; # reassemle ORDERED
    $urlsOUT{"$base?$args"}='';            # now a unique key
}

my $urlsOUT='';
REC: foreach my $url (reverse sort keys %urlsOUT ) { # ORDERED
       for ( split /[?&]/, $url ) {                  # for each arg
         if ( $urlsOUT !~ /\b$_\b/ ) {               # if new
           $urlsOUT .= "$url\n";                     # keep this
           next REC;                                 # check next
         }
       }
}

print $urlsOUT;

This will consistently reorder and de-dup all arguments in a URL, de-dup all resulting records, and then check each remaining record (in descending order) to eliminate any record that doesn't have something no other record before it had.
I named the program file tst and made a tst1 and a urls.
$: cat tst1
http://test/foo?foo
http://test/foo?bar
http://test/foo?foo
http://test2/foo?foo
http://test2/foo?baz
http://test2/foo?foo&bar
http://test2/foo?baz
http://test/foo?foo&bar
http://test/foo?bar&foo
http://test2/foo?bar&foo
http://test3/foo?bar
http://test3/foo?foo&bar&baz
http://test2/foo?foo&bar&baz
http://test/foo?foo&bar&baz

$: ./tst tst1
http://test3/foo?foo&baz&bar
http://test2/foo?foo&baz&bar
http://test/foo?foo&baz&bar

$: cat urls
http://grouplogic.com:80/Knowledge/index.cfm?fuseaction=view&docID=111
http://grouplogic.com:80/news-events/index.cfm?fa=viewNews&ID=390
http://grouplogic.com:80/public/quickpoll/index.cfm?fuseaction=quickPollResults&QuestionID=8
http://grouplogic.com:80/store/index.cfm?cfid=11812682&cftoken=26157811&fa=conre
http://grouplogic.com:80/store/index.cfm?fa=PrtSlt&id=532&prTpID=5&
http://grouplogic.com:80/store/index.cfm?upTp=2&fa=upgrade&UpNewType=2&prTpID=5&&ptype=FS
http://grouplogic.com:80/news-events/index.cfm?fa=viewRelease&ID=21&prod=2
http://grouplogic.com:80/content/index.cfm?fuseaction=faq_list&ProdID=1&archive=1
http://grouplogic.com:80/content/index.cfm?ID=103
http://grouplogic.com:80/Knowledge/index.cfm?fuseaction=view&amp
http://grouplogic.com:80/knowledge/index.cfm?fuseaction=view&docID=10
http://grouplogic.com:80/content/index.cfm?ID=123
http://grouplogic.com:80/Knowledge/index.cfm?fuseaction=view&docID=111
http://grouplogic.com:80/news-events/index.cfm?fa=viewNews&ID=390
http://grouplogic.com:80/public/quickpoll/index.cfm?fuseaction=quickPollResults&QuestionID=8
http://grouplogic.com:80/content/index.cfm?ID=123&foo=bar
http://grouplogic.com:80/store/index.cfm?cfid=11812682&cftoken=26157811&fa=conre
http://grouplogic.com:80/store/index.cfm?fa=PrtSlt&id=532&prTpID=5&
http://grouplogic.com:80/store/index.cfm?    upTp=2&fa=upgrade&UpNewType=2&prTpID=5&&ptype=FS
http://grouplogic.com:80/news-events/index.cfm?fa=viewRelease&ID=21&prod=2
http://grouplogic.com:80/content/index.cfm?fuseaction=faq_list&ProdID=1&archive=1
http://grouplogic.com:80/content/index.cfm?ID=103
http://grouplogic.com:80/Knowledge/index.cfm?fuseaction=view&amp
http://grouplogic.com:80/knowledge/index.cfm?fuseaction=view&docID=10
http://grouplogic.com:80/content/index.cfm?ID=123

$: ./tst urls
http://grouplogic.com:80/store/index.cfm?upTp=2&ptype=FS&prTpID=5&fa=upgrade&UpNewType=2
http://grouplogic.com:80/store/index.cfm?prTpID=5&id=532&fa=PrtSlt
http://grouplogic.com:80/store/index.cfm?fa=conre&cftoken=26157811&cfid=11812682
http://grouplogic.com:80/public/quickpoll/index.cfm?fuseaction=quickPollResults&QuestionID=8
http://grouplogic.com:80/news-events/index.cfm?prod=2&fa=viewRelease&ID=21
http://grouplogic.com:80/news-events/index.cfm?fa=viewNews&ID=390
http://grouplogic.com:80/knowledge/index.cfm?fuseaction=view&docID=10
http://grouplogic.com:80/content/index.cfm?fuseaction=faq_list&archive=1&ProdID=1
http://grouplogic.com:80/content/index.cfm?foo=bar&ID=123
http://grouplogic.com:80/content/index.cfm?ID=103
http://grouplogic.com:80/Knowledge/index.cfm?fuseaction=view&docID=111
http://grouplogic.com:80/Knowledge/index.cfm?fuseaction=view&amp

Note the outputs are case-sensitive ASCII sorted, with trailing and duplicate/redundant ampersands cleaned.
Doing it in perl with internal reads and sorts is also a lot faster.
real    0m0.170s
user    0m0.046s
sys     0m0.092s

the old version
I see no more elegant way than a brute-force double pass, though you can at least eliminate redundant comparisons in the nested loop.
lst=( $( sort -ru x ) ) # unique reverse sort once to eliminate simple dups

for (( ndx1=0; ndx1<${#lst[@]}-1; ndx1++ ))       # walk thru once in outer loop
do [[ -n "${lst[ndx1]}" ]] || continue            # ignore removed
   for (( ndx2=ndx1+1; ndx2<${#lst[@]}; ndx2++ )) # inner skips prev, no redux
   do case "${lst[ndx1]}" in                      # case statement string match
      "${lst[ndx2]}"*) unset lst[ndx2] ;;         # remove shorter versions
                    *) continue 2      ;;         # no match, skip ahead
      esac
   done
done

printf "%s\n" "${lst[@]}"                         # print out what's left

I sort uniquely in reverse order to eliminate simple dups and set up comparisons, and store to an array for easy nested looping.
The outer loop walks the array once; it doesn't bother with the last record, because the inner loop will handle that. The inner loop starts at the record after the current one from the outer loop - no reason to check previous again since they are sorted.
Since the inner loop removed records, the outer loop skips checking entirely if the outer key record at the indicated index is empty.
The case statement checks each record after the current one from the outer loop. If the inner key is contained in the current outer loop key record, the shorter version is removed from the array with unset, and the loop proceeds to the next record to check that.
When the inner loop record is no longer a part of the outer loop key, we know we have moved past the relevant records (since they are sorted), so we skip checking the rest of the list pointlessly and move on to the next outer key record with continue 2.
This moving window of relevant records should do minimal wasted work.

A: Finally, looks like i've done it) for this test file:
$ cat file2
test?foo
test?bar
test?foo
test2?foo
test2?baz
test2?foo&bar
test2?baz
test?foo&bar
test?bar&foo
test2?bar&foo
test3?bar
test3?foo&bar&baz
test2?foo&bar&baz
test?foo&bar&baz

Script
#!/bin/bash
declare -A resorces
raw=( $(sort -u $1) )
for url in "${raw[@]}"; { resorces[${url//\?*}]+=" ${url//*\?}"; }
for res in "${!resorces[@]}"; {
    list=( ${resorces[$res]} )
    for i in "${!list[@]}"; {
        par=${list[$i]}
        unset list[$i]
        [[ ${list[@]} =~ $par ]] || result+=("$res?$par")
    }
}
printf '%s\n' "${result[@]}"

Result
$ ./test2 file2
test2?bar&foo
test2?foo&bar&baz
test3?foo&bar&baz
test?bar&foo
test?foo&bar&baz

And for this test file:
$ cat file
http://grouplogic.com:80/Knowledge/index.cfm?fuseaction=view&docID=111
http://grouplogic.com:80/news-events/index.cfm?fa=viewNews&ID=390
http://grouplogic.com:80/public/quickpoll/index.cfm?fuseaction=quickPollResults&QuestionID=8
http://grouplogic.com:80/store/index.cfm?cfid=11812682&cftoken=26157811&fa=conre
http://grouplogic.com:80/store/index.cfm?fa=PrtSlt&id=532&prTpID=5&
http://grouplogic.com:80/store/index.cfm?upTp=2&fa=upgrade&UpNewType=2&prTpID=5&&ptype=FS
http://grouplogic.com:80/news-events/index.cfm?fa=viewRelease&ID=21&prod=2
http://grouplogic.com:80/content/index.cfm?fuseaction=faq_list&ProdID=1&archive=1
http://grouplogic.com:80/content/index.cfm?ID=103
http://grouplogic.com:80/Knowledge/index.cfm?fuseaction=view&amp
http://grouplogic.com:80/knowledge/index.cfm?fuseaction=view&docID=10
http://grouplogic.com:80/content/index.cfm?ID=123
http://grouplogic.com:80/content/index.cfm?ID=123
http://grouplogic.com:80/content/index.cfm?ID=123
http://grouplogic.com:80/content/index.cfm?ID=123&foo=bar
http://grouplogic.com:80/content/index.cfm?ID=123&foo=bar

Result
$ ./test2 file
http://grouplogic.com:80/content/index.cfm?fuseaction=faq_list&ProdID=1&archive=1
http://grouplogic.com:80/content/index.cfm?ID=103
http://grouplogic.com:80/content/index.cfm?ID=123&foo=bar
http://grouplogic.com:80/public/quickpoll/index.cfm?fuseaction=quickPollResults&QuestionID=8
http://grouplogic.com:80/Knowledge/index.cfm?fuseaction=view&amp
http://grouplogic.com:80/Knowledge/index.cfm?fuseaction=view&docID=111
http://grouplogic.com:80/store/index.cfm?cfid=11812682&cftoken=26157811&fa=conre
http://grouplogic.com:80/store/index.cfm?fa=PrtSlt&id=532&prTpID=5&
http://grouplogic.com:80/store/index.cfm?upTp=2&fa=upgrade&UpNewType=2&prTpID=5&&ptype=FS
http://grouplogic.com:80/knowledge/index.cfm?fuseaction=view&docID=10
http://grouplogic.com:80/news-events/index.cfm?fa=viewNews&ID=390
http://grouplogic.com:80/news-events/index.cfm?fa=viewRelease&ID=21&prod=2

A: I see following algorithm to do this (unfortunately I don't know how to implement it):
First you sort your file, alphabetically.
Then you read your file, line by line, and if a line is a substring of the following line, it is not to be put in the resulting file.


text: Q: Do loop invariants need to hold if the loop doesn't execute? as mentioned in the title, I am not sure if loops that don't execute at all have to hold the loop invariant and hoped someone could maybe explain it better to me.


text:
Q: How can I install the phpspreadsheet in codeignter version 4 I have tried to install the package of phpspreadsheet for both way for github and through composer also but I am unable to install
In composer i am trying these command :- composer require phpoffice/phpspreadsheet but its not working
It's basically show these  type of error:-
[InvalidArgumentException]
Package phpoffice/phpspreadsheet has requirements incompatible with your PHP version, PHP extensions and Composer v
ersion:
- phpoffice/phpspreadsheet 1.19.0 requires ext-gd * but it is not present.
And when i am trying directly for github code its files is not in proper way as the requriement
git hub link:- https://github.com/PHPOffice/PhpSpreadsheet

A: phpoffice/phpspreadsheet v1.19.0 requires php: ^7.3 || ^8.0

*

*Check your installed PHP version by running this command php -v. Make sure it's greater or equal to 7.3.

*Secondly, make sure that the PHP version declaration in the composer.json file is also greater or equal to 7.3. I.e:
        "php": "^7.3 || ^8.0",

*

*If in case your application has dependencies that aren't compatible with PHP version >= 7.3, you may want to install a lower version of phpspreadsheet i.e composer require phpoffice/phpspreadsheet "^1.8.0"  (requires php: "^5.6|^7.0") instead of adjusting the PHP version in the file composer.json.

*In addition, if you're using xampp, make sure these extensions are enabled in the file C:\xampp\php\php.ini before attempting to install the library.
extension=mbstring
extension=fileinfo
extension=gd

*

*Enabling the above extensions means, they shouldn't have semicolons (;) in front of them.

Installation
composer require phpoffice/phpspreadsheet "^1.19.0"

A: What fixed it for me, was steven7mwesigwa 3rd point.
In addition, if you're using xampp, make sure these extensions are enabled in the file C:\xampp\php\php.ini before attempting to install the library.

extension=mbstring

extension=fileinfo

extension=gd

I removed the semicolon in front of the extension=gd, and it worked.


text:
Q: Java : read json file that is in "UCS-2 LE BOM" or "UTF-8 BOM" encoding format Need to read a json file that is in  "UCS-2 LE BOM" or "UTF-8 BOM" encoding format.
The below code read json from UTF-8
    JSONParser parser = new JSONParser();
    InputStream inputStream = new FileInputStream(inputJsonPath);
    Reader fileReader = new InputStreamReader(inputStream, StandardCharsets.UTF_8);
    Object obj = parser.parse(fileReader);
    org.json.simple.JSONObject inputJsonObject = (org.json.simple.JSONObject) obj;


text:
Q: Efficient way of displaying lots of data with headers? So I have about 50 individual pieces of data that I have to display all at once. There are about 4-5 different sections where I separate the type of data.
For example, one section would look like this:
Header
    Field A: Value      Field D: Value
    Field B: Value      Field E: Value
    Field C: Value      Field F: Value

The XAML for this layout is similar to this:
<Grid>
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="150" />
        <ColumnDefinition Width="150" />
        <ColumnDefinition Width="150" />
        <ColumnDefinition Width="150" />
    </Grid.ColumnDefinitions>
    <Grid.RowDefinitions>
        <RowDefinition />
        <RowDefinition />
        <RowDefinition />
        <RowDefinition />
        <RowDefinition />
        <RowDefinition />
    </Grid.RowDefinitions>
    <Label
        Content="Company"
        Foreground="#666"
        FontFamily="Helvetica, Arial"
        FontSize="13" />
    <TextBlock
        Text="VALUE"
        Grid.Column="1"
        Padding="6"
        Foreground="#333"
        FontSize="13"
        FontFamily="Helvetica, Arial" />
</Grid>

What I'm looking for is a nice and clean way to separate different sections so it's less of a chore to find what I'm looking for (in terms of the XAML and not the UI) and easier to make changes. I'm finding that the more data I add the harder it is to make smaller changes.
I've looked into the HeaderedContentControl however that appears to be a strict one header value and one content value control. All sections share styles.

A: i think you need something like this:
http://demos.telerik.com/silverlight/#GridView/GroupByFormattedValue (its silverlight version) but wpf look same. Telerik is paid controls, but with little effort you can develop own datagrid working same way.


text:
Q: DHCP lease not renewed upon expiration I'm a clueless newbie running Ubuntu 18 on top of VirtualBox on top of Windows 10 with a wireless connection to my ISP's router.  The VM's network adapter is set up in VB as bridged, and is configured in Ubuntu to use DHCP.  When I start my machine I get a 3600 second lease, but at the end the lease is not renewed unless I force it with "sudo dhclient", or if I bounce it in VB.
peter@peter-VirtualBox:~$ ip -4 address show dev enp0s3
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    inet 192.168.0.26/24 brd 192.168.0.255 scope global dynamic enp0s3
       valid_lft 1201sec preferred_lft 1201sec

I don't know if I should be looking for the problem in Ubuntu, VB, Windows, or the wireless router.  Any obvious clues?