text:
Q: Using the pdf_data function from the pdftools package efficiently The end goal is to use the pdftools package to efficiently move through a thousand pages of pdf documents to consistently, and safely, produce a useable dataframe/tibble.  I have attempted to use the tabulizer package, and pdf_text functions, but the results were inconsistent. Therefore, started working through the pdf_data() function, which I prefer.
For those unfamiliar with the pdf_data function, it converts a pdf page into a coordinate grid, with the 0,0 coordinate being in the upper-left corner of the page.  Therefore, by arranging the x,y coordinates, then pivoting the document into a wide format, all of the information is displayed as it would on the page, only with NAs for whitespaces
Here is a simple example using the familiar mtcars dataset.
library(pdftools)
library(tidyverse)
library(janitor)

pdf_file <- "https://github.com/ropensci/tabulizer/raw/master/inst/examples/data.pdf"

mtcars_pdf_df <- pdf_data(pdf_file)[[1]]

mtcars_pdf_df%>%
  arrange(x, y)%>%
  pivot_wider(id_cols = y, names_from = x, values_from = text)%>%
  unite(col = Car_type, `154`:`215`, sep = " ", remove = TRUE,  na.rm = TRUE)%>%
  arrange(y)%>%
  rename("Page Number" = `303`)%>%
  unite(col =  mpg, `253`:`254`, sep = "", remove = TRUE, na.rm = TRUE)%>%
  unite(col = cyl, `283` : `291` , sep = "", remove = TRUE, na.rm = TRUE)%>%
  unite(col = disp, `308` : `313`, sep = "", remove = TRUE, na.rm = TRUE)

It would be nice to not use a dozen or so unite functions in order to rename the various columns.  I used the janitor package row_to_names() function at one point to convert row 1 to column names, which worked well but maybe someone has a better thought?
The central problem; removing the NAs from the dataset through uniting multiple columns, or shifting columns over so that NAs are filled by adjacent columns.
I'm trying to make this efficient.  Possible using the purrr package?  any help with making this process more efficient would be very appreciated.
The only information I had on the pdf_data() function going into this is from here...
https://ropensci.org/technotes/2018/12/14/pdftools-20/
Any additional resources would also be greatly appreciated (apart from the pdftools package help documentation/literature).
Thanks everyone! I hope this also helps others use the pdf_data() too :)

A: Here is one approach that could perhaps be generalised if you know the PDF is a reasonably neat table...
library(pdftools)
library(tidyverse)

pdf_file <- "https://github.com/ropensci/tabulizer/raw/master/inst/examples/data.pdf"

df <- pdf_data(pdf_file)[[1]]

df <- df %>% mutate(x = round(x/3),        #reduce resolution to minimise inconsistent coordinates
                    y = round(y/3)) %>%
  arrange(y, x) %>%                        #sort in reading order
  mutate(group = cumsum(!lag(space, default = 0))) %>%  #identify text with spaces and paste
  group_by(group) %>%
  summarise(x = first(x),
            y = first(y),
            text = paste(text, collapse = " ")) %>%
  group_by(y) %>%
  mutate(colno = row_number()) %>%         #add column numbers for table data
  ungroup() %>%
  select(text, colno, y) %>%
  pivot_wider(names_from = colno, values_from = text) %>% #pivot into table format
  select(-y) %>%
  set_names(c("car", .[1,-ncol(.)])) %>%   #shift names from first row
  slice(-1, -nrow(.)) %>%                  #remove names row and page number row
  mutate_at(-1, as.numeric)

df
# A tibble: 32 x 12
   car                 mpg   cyl  disp    hp  drat    wt  qsec    vs    am  gear  carb
   <chr>             <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
 1 Mazda RX4          21       6  160    110  3.9   2.62  16.5     0     1     4     4
 2 Mazda RX4 Wag      21       6  160    110  3.9   2.88  17.0     0     1     4     4
 3 Datsun 710         22.8     4  108     93  3.85  2.32  18.6     1     1     4     1
 4 Hornet 4 Drive     21.4     6  258    110  3.08  3.22  19.4     1     0     3     1
 5 Hornet Sportabout  18.7     8  360    175  3.15  3.44  17.0     0     0     3     2
 6 Valiant            18.1     6  225    105  2.76  3.46  20.2     1     0     3     1
 7 Duster 360         14.3     8  360    245  3.21  3.57  15.8     0     0     3     4
 8 Merc 240D          24.4     4  147.    62  3.69  3.19  20       1     0     4     2
 9 Merc 230           22.8     4  141.    95  3.92  3.15  22.9     1     0     4     2
10 Merc 280           19.2     6  168.   123  3.92  3.44  18.3     1     0     4     4
# ... with 22 more rows

A: I'll present a partial solution here, but please allow me to give you some background information first.
I am currently writing a pdf text / table extraction package from scratch in C++ with R bindings, which has required many months and many thousands of lines of code. I started writing it pretty much to do what you are looking to do: reliably extract tabular data from pdfs. I have got it to the point where it can quickly and reliably extract the text from a pdf document, with the associated positions and font of each text element (similar to pdftools).
I assumed that the technical part of reading the xrefs, handling encryption, writing a deflate decompressor, parsing the dictionaries, tokenizing and reading the page description programs would be the real challenges, and that figuring out a general algorithm to extract tabular data was just a detail I would figure out at the end.
Let me tell you, I'm stuck. I can assure you there is no simple, generalizable parsing function that you can write in a few lines of R to reliably extract tabular data from a pdf.
You have three options, as far as I can tell:

*

*Stick to documents where you know the exact layout

*Write a function with filter parameters that you can twiddle and check the results

*Use a very complex / AI solution to get very good (though never perfect) reliability

For the pdf example you provided, something like the following works fairly well. It falls into the "twiddling parameters" category, and works by cutting the text into columns and rows based on the density function of the x and y co-ordinates of the text elements.
It could be refined a great deal to generalize it, but that would add a lot of complexity and would have to be tested on lots of documents
tabulize <- function(pdf_df, filter = 0.01)
{
  xd <- density(pdf_df$x, filter)
  yd <- density(pdf_df$y, filter)
  pdf_df$col <- as.numeric(cut(pdf_df$x, c(xd$x[xd$y > .5] - 2, max(xd$x) + 3)))
  pdf_df$row <- as.numeric(cut(pdf_df$y, c(yd$x[yd$y > .5] - 2, max(yd$x) + 3)))
  pdf_df %<>% group_by(row, col) %>% summarise(label = paste(text, collapse = " "))
  res <- matrix(rep("", max(pdf_df$col) * max(pdf_df$row)), nrow = max(pdf_df$row))
  for(i in 1:nrow(pdf_df)) res[pdf_df$row[i], pdf_df$col[i]] <- pdf_df$label[i]
  res <- res[which(apply(r, 1, paste, collapse = "") != ""), ]
  res <- res[,which(apply(r, 2, paste, collapse = "") != "")]
  as.data.frame(res[-1,])
}

which gives the following result:
tabulize(mtcars_pdf_df)
#>                     V1   V2  V3    V4  V5   V6    V7    V8 V9 V10 V11 V12
#> 1            Mazda RX4 21.0   6 160.0 110 3.90 2.620 16.46  0   1   4   4
#> 2        Mazda RX4 Wag 21.0   6 160.0 110 3.90 2.875 17.02  0   1   4   4
#> 3           Datsun 710 22.8   4 108.0  93 3.85 2.320 18.61  1   1   4   1
#> 4       Hornet 4 Drive 21.4   6 258.0 110 3.08 3.215 19.44  1   0   3   1
#> 5    Hornet Sportabout 18.7   8 360.0 175 3.15 3.440 17.02  0   0   3   2
#> 6              Valiant 18.1   6 225.0 105 2.76 3.460 20.22  1   0   3   1
#> 7           Duster 360 14.3   8 360.0 245 3.21 3.570 15.84  0   0   3   4
#> 8            Merc 240D 24.4   4 146.7  62 3.69 3.190 20.00  1   0   4   2
#> 9             Merc 230 22.8   4 140.8  95 3.92 3.150 22.90  1   0   4   2
#> 10            Merc 280 19.2   6 167.6 123 3.92 3.440 18.30  1   0   4   4
#> 11           Merc 280C 17.8   6 167.6 123 3.92 3.440 18.90  1   0   4   4
#> 12          Merc 450SE 16.4   8 275.8 180 3.07 4.070 17.40  0   0   3   3
#> 13          Merc 450SL 17.3   8 275.8 180 3.07 3.730 17.60  0   0   3   3
#> 14         Merc 450SLC 15.2   8 275.8 180 3.07 3.780 18.00  0   0   3   3
#> 15  Cadillac Fleetwood 10.4   8 472.0 205 2.93 5.250 17.98  0   0   3   4
#> 16 Lincoln Continental 10.4   8 460.0 215 3.00 5.424 17.82  0   0   3   4
#> 17   Chrysler Imperial 14.7   8 440.0 230 3.23 5.345 17.42  0   0   3   4
#> 18            Fiat 128 32.4   4  78.7  66 4.08 2.200 19.47  1   1   4   1
#> 19         Honda Civic 30.4   4  75.7  52 4.93 1.615 18.52  1   1   4   2
#> 20      Toyota Corolla 33.9   4  71.1  65 4.22 1.835 19.90  1   1   4   1
#> 21       Toyota Corona 21.5   4 120.1  97 3.70 2.465 20.01  1   0   3   1
#> 22    Dodge Challenger 15.5   8 318.0 150 2.76 3.520 16.87  0   0   3   2
#> 23         AMC Javelin 15.2   8 304.0 150 3.15 3.435 17.30  0   0   3   2
#> 24          Camaro Z28 13.3   8 350.0 245 3.73 3.840 15.41  0   0   3   4
#> 25    Pontiac Firebird 19.2   8 400.0 175 3.08 3.845 17.05  0   0   3   2
#> 26           Fiat X1-9 27.3   4  79.0  66 4.08 1.935 18.90  1   1   4   1
#> 27       Porsche 914-2 26.0   4 120.3  91 4.43 2.140 16.70  0   1   5   2
#> 28        Lotus Europa 30.4   4  95.1 113 3.77 1.513 16.90  1   1   5   2
#> 29      Ford Pantera L 15.8   8 351.0 264 4.22 3.170 14.50  0   1   5   4
#> 30        Ferrari Dino 19.7   6 145.0 175 3.62 2.770 15.50  0   1   5   6
#> 31       Maserati Bora 15.0   8 301.0 335 3.54 3.570 14.60  0   1   5   8
#> 32          Volvo 142E 21.4 4 1 121.0 109 4.11 2.780 18.60  1   1   4   2


text:
Q: Jboss AS 7 Hibernate Configuration I'm trying to configure hibernate in JBOSS AS 7.1.1
I only put the persistence.xml in WEB-INF folder
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0">
<persistence-unit name="actionBazaar" transaction-type="JTA">
   <provider>org.hibernate.ejb.HibernatePersistence</provider>
   <jta-data-source>java:/ActionBazaarDS</jta-data-source>
   <properties>
      <property name="hibernate.show_sql" value="true" />
   </properties>
</persistence-unit>
</persistence>

Obs: JBOSS 7.1.1 have a module with a hibernate 4 and i have a DataSource named java:/ActionBazaarDS
But i get this error:
Can't find a persistence unit named actionBazaar in deployment "ActionBazaar.war"

When i try use:
@PersistenceContext(unitName="actionBazaar")
private EntityManager entityManager;

A: Setup following settings on web.xml
<persistence-unit-ref>
  <persistence-unit-ref-name>persistence/actionBaazar</persistence-unit-ref-name>
  <persistence-unit-name>actionBazaar</persistence-unit-name>
</persistence-unit-ref>

It will cause your persistence.xml to be published in JBoss under that name

A: You are trying to configure hibernate with jboss 7.1.1 and if you are using MySQL database, start by following this answer: How to configure Hibernate in JBoss
Your hibernate configuration is done with jboss 7.1.1.
After that deploy your projetc....
If No Persistence provider for EntityManager Error occurred while deploying your project then add one class in your project
That is class HibernateUtil.java and provide the persistence unit name to entityManagerFactory = Persistence.createEntityManagerFactory("abc");
public class HibernateUtil {

    private static final EntityManagerFactory entityManagerFactory;
    static {
                try {
                     entityManagerFactory = Persistence.createEntityManagerFactory("abc");
                     System.out.println("Entity Menager Test.............."+ entityManagerFactory);
                } catch (Throwable ex) {

                    System.err.println("Initial SessionFactory creation failed." + ex);
                    throw new ExceptionInInitializerError(ex);

                  }
    }

public static EntityManagerFactory getEntityManagerFactory() {
         return entityManagerFactory;
    }

}

redpajama_set_name: RedPajamaStackExchange


text:
Q: WinSCP timestamp as a user input/from file I have a WinSCP command in a batch file  as described below:
get -neweronly event_%TIMESTAMP#yyyymmdd%_0000.db C:\events\test

What I want to do is set the TIMESTAMP from a user input (e.g. from a text file)
I do not want to use the current computer time - Is this possible?
If I put a date of 20180101 in a text file and import it, would this be the solution?
set /p TIMESTAMP=<Timestampdate.txt

Would I need to do anything to the TIMESTAMP in the get -neweronly event_%TIMESTAMP#yyyymmdd%_0000.db C:\events\test?

A: If you want to use an environment variable in WinSCP script, use syntax %NAME%. The #yyyymmdd part cannot be there, nor does it make any sense.
And while WinSCP will not override an existing TIMESTAMP variable with its own value, it's definitely better to use a different name, to avoid ambiguity. After all, your variable is just a generic environment variable, it has nothing to with WinSCP TIMESTAMP syntax.
In batch file:
set /p MYTIMESTAMP=<Timestampdate.txt

In WinSCP script:
get -neweronly event_%MYTIMESTAMP%_0000.db C:\events\test


text:
Q: How to Fix EXC_BAD_ACCESS on NSArray Property? This is yet another EXC_BAD_ACCESS question. Although I've done my homework and am certain that I am not over-releasing my NSArray.
So here is a snippet of my code:
tableData = [NSDictionary dictionaryWithJSONString:JSONstring error:&error];
//Collect Information from JSON String into Dictionary. Value returns a mutli
dimensional NSDictionary. Eg: { value => { value => "null"}, etc }

NSMutableArray *t_info = [[NSMutableArray alloc] init];
for(id theKey in tableData)
{
    NSDictionary *get = [tableData objectForKey:theKey];
    [t_info addObject:get];
    [get release];
} // converting into an NSArray for use in a UITableView

NSLog(@"%@", t_info);
//This returns an Array with the NSDictionary's as an Object in each row. Returns fine

if (tvc == nil)
{
    tvc = [[tableViewController alloc] init]; //Create Table Controller
    tableView.delegate = tvc;
    tableView.dataSource = tvc;
    tvc.tableView = self.tableView;
    tvc.tableData = t_info; //pass our data to the tvc class
    [tvc.tableView reloadData];
}
...

Now in my TableViewController Class:
@implementation tableViewController
@synthesize tableData, tableView;

- (NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return [tableData count]; //Returns X Amount Fine.
}

- (UITableViewCell *)tableView:(UITableView *)the_tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{

    NSString *MyIdentifier = [NSString stringWithFormat:@"MyIdentifier"];

    UITableViewCell *cell = [the_tableView dequeueReusableCellWithIdentifier:MyIdentifier];
    if (cell == nil) {
        cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:MyIdentifier] autorelease];
    }

    NSLog(@"%@", tableData); //** CRASHES!!**
    cell.textLabel.text = @"This is a test";
    return cell;
}

If I were to comment out that NSLog, it'll work fine and return "this is a test" on each table row.
This one has really got me stumped, all the articles I have around about this problem is generally related to retain/memory issues.
Also, another important point.
If I were to pass through my original (NSDictionary) tableData from my first class code and run the same script in my tableViewController - I can NSLog the object perfectly fine.

A: The only time you need to release an object is if you have explicitly allocated it by way of new, alloc, or copy.
NSMutableArray *t_info = [[NSMutableArray alloc] init];
for(id theKey in tableData)
{
    NSDictionary *get = [tableData objectForKey:theKey];
    [t_info addObject:get];
    [get release];
}

You shouldn't be releasing get here. By doing this, you're releasing the reference that the tableData dictionary is holding onto, which is bad. My guess is that this is what is causing the problem that you're encountering.
If I'm not mistaken, the reason why [tableData count] returns the expected value is because the array is still holding onto the references that have been released.


text:
Q: Crear un nuevo objeto en base al resultado de otras funciones Realizo algunas operaciones desde un array multidimensional y las funciones me retornan objetos array de objetos.
ordersDispach():
Promise {
  [
    {
      '1': null,
      '2835889': 1,
      '2846705': 1,
      '2869563': 1,
      '3006434': 1
    },
    { '1': null, '2836187': 1, '2870201': 1, '2872035': 1 }
  ]
}

Y la función timer() retorna:
Promise {
  [
    {
      '1': '0min',
      '2835889': '10min',
      '2846705': '10min',
      '2869563': '10min',
      '3006434': '10min'
    },
    {
      '1': '0min',
      '2836187': '10min',
      '2870201': '10min',
      '2872035': '10min'
    }
  ]
}

Ahora estoy intentando retornar un nuevo objeto, que contenga las propiedades de ambos mandandolos a ejecutar en una misma función, no sé si esta sea la mejor manera, pero agradecería de sus ayuda.
const ordersDispached = async disp => disp.map(e => e.stops.reduce((acc, e2) => ({ ...acc, [e2.siteId]: e2.numberOfOrders }), {}))

const timerService = async disp => disp.map(e => e.stops.reduce((acc, e2) => ({ ...acc, [e2.siteId]: `${e2.numberOfOrders * 10}min` }), {}))

    const mergeObjets = async(disp) => {
  try{
    let obj1 = await ordersDispached(disp).then(r=>r).catch(e=>e)
    let obj2 = await timerServiceByStops(disp).then(r=>r).catch(e=>e)
    var obj = Object.assign({}, obj1, obj2)
    console.log(obj)
  }
  catch(e){
    console.error(e)
  }
}

console.log(mergeObjets(disp, sites))

Pero esto me retorna el error de TypeError: Cannot read property 'reduce' of undefined y no entiendo por que arrays, que le inyecto a las funciones hijas para luego llamarlas en el mergeObjects inyectando estos mismo arrays
sites = [
    {
        "id": 1,
        "type": "distribution-center",
        "openTime": null,
        "closeTime": null
}];
disp = const disp = [
    {
        "id": 1,
        "startTime": "08:55",
        "stops": [
            {
                "siteId": 1,
                "sequence": 1,
                "numberOfOrders": null
            }]
    }];

A:
Pero esto me retorna el error de TypeError: Cannot read property 'reduce' of undefined

La función timerService está intentando acceder a la propiedad stops de cada item dentro del arreglo recibido por el parámetro:
const timerService = async disp =>
  disp.map(e => e.stops.reduce((acc, e2) => // e.stops.reduce
     ({ ...acc, [e2.siteId]: `${e2.numberOfOrders * 10}min` }), {}))

El problema está en mergeObjets:
const mergeObjets = async(disp, sites) => {
  try{
    let obj1 = await ordersDispached(disp)
    let obj2 = await timerService(sites) // Estas enviando el arreglo sites
    newObj = {...obj1, obj2}
    console.log(newObj)
  }
  catch(e){
    console.error(e)
  }
}
console.log(mergeObjets(disp, sites))

Estás enviándole a la función timerService() el arreglo sites. Y según compartiste, el arreglo sites no tiene objetos con la propiedad stops:
sites = [
    {
        "id": 1,
        "type": "distribution-center",
        "openTime": null,
        "closeTime": null
    }
];

Tienes 2 opciones para solucionar el error, que dependen de tu aplicación.

*

*Agregar la propiedad stops a los objetos del arreglo sites

*Enviar el arreglo disp a la función timerService


text:
Q: Background images rendering problems on wp7 In my WP7 app i'm having problems with background images rendering badly. It looks like the images are rendered using 8-bit colors, and in general looks ugly. They're .png. Heres a screenshot of how it looks in the app:
 screenshot
Does anyone know what causes this and how it can be fixed?

A: Have you tried to enabled 32bit colour?
To do this, open up your WMAppManifest.xml and in the App element add BitsPerPixel="32"
<Deployment xmlns="http://schemas.microsoft.com/windowsphone/2009/deployment" AppPlatformVersion="7.1">
  <App BitsPerPixel="32" xmlns="" ProductID="{25aef417-

Not sure if this will resolve the issue, but the fact your using a .png image and only having 16bit colour could be related.

A: DO NOT "enable 32 bit color". Many devices have only 16 bit LCD, so they'll still have the issues - you'll just not know about them.
If you really need smooth gradients, use predithered backgrounds, eg. http://nerdplusart.com/photoshop-action-for-windows-phone-7-dithering However it's still not flowing with the of Windows Phone.
The true solution is to change your design to solid, primary colors. This is the choice user have made buying WP device and you should respect it.


text:
Q: On home page remove link from logo I'd like to remove the link that is generated around the logo when users are on the home page. Does wordpress have a built in function so I can wrap an if condition around the logo in the template so if the current page is the home page I can have the output without the a tag, and the else would simply be the current code.

A: Its a template specific thing mate. You might have to edit the header.php and add a condition like:
<?php

//Check for homepage
if(!is_front_page())
{
    //The link around logo markup
}
else
{
    //Just the logo markup without the link
}

?>


text:
Q: Why would Google be throwing away emails from virtual domains to virtual domains? postfix I'm seeing some odd behavior and am hoping someone has seen this as well.
I have a CentOS server running Postfix for virtual domains for my businesses.
It was working well for years and then suddenly recently -- apparently around February 17th 2021 -- it became obvious that I was missing certain emails that people were sending me.
After digging into it a bit, it seems to only happen when someone is sending from their virtual domain to my virtual domain.
I'm at a loss and any suggestions would be great.
Here's a bit more about my configuration and what I'm seeing.
The virtual user table is set up to accept various domains and various users at those domains.  These are all forwarded to Gmail accounts i.e.
user@mycompany.com
goes to
googleusername+user@gmail.com
My friend who is helping me has three different accounts with three different ISPs.  Two of them feature his own business domain, and one is just the basic ISP account. i.e.
friend@ISP.net
friend@hiscompany.com
friend@hisothercompany.com
If he sends email to my business address user@mycompany.com from each of these three accounts, in the mail logs on my server, I see the same three things.  I see my Postfix accept his email, I see the email get requeued for delivery to Google, and I see the delivery to Google.  I see that for each of the three messages.
Here's the strange part.  ONLY the friend@ISP.net message actually shows up in my Gmail inbox.
FWIW I've seen similar behavior from many of my customers i.e. they have trouble emailing my business address and when they either use my "naked" Gmail address or use their personal email, I get it just fine.
Any thoughts, suggestions, ideas most welcome.  I am really at a loss.  The configuration worked perfectly for years.  My best guess is that Google is checking for something now that they weren't doing before and I need to update something in my mail configuration...  this sort of relaying for virtual domains is super common and so I must just be missing something, or there's a new compliance thing that is required now.
Thanks in advance for any help!
EDIT: The emails are not in Spam or in any of the random other tabs, like Promotions. I have looked in those places and also done searches to see if they might have been stashed somewhere other than the inbox, to no avail.
EDIT2: Obfuscated snippet from mail log showing three tests to my virtual address, all three being delivered to Google, only one actually showed up in my folders.
Feb 26 14:54:01 syd-barrett postfix/smtpd[7732]: connect from mail-mw2nam10on2139.outbound.protection.outlook.com[40.107.94.139]
Feb 26 14:54:01 syd-barrett postfix/smtpd[7732]: setting up TLS connection from mail-mw2nam10on2139.outbound.protection.outlook.com[40.107.94.139]
Feb 26 14:54:01 syd-barrett postfix/smtpd[7732]: Anonymous TLS connection established from mail-mw2nam10on2139.outbound.protection.outlook.com[40.107.94.139]: TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)
Feb 26 14:54:01 syd-barrett postfix/smtpd[7732]: 9AA2A203F8: client=mail-mw2nam10on2139.outbound.protection.outlook.com[40.107.94.139]
Feb 26 14:54:01 syd-barrett postfix/cleanup[7735]: 9AA2A203F8: message-id=<34C9069F-6D71-429D-A536-B5D762233AC2@friendcompanyA.com>
Feb 26 14:54:01 syd-barrett postfix/qmgr[7647]: 9AA2A203F8: from=<Friend@friendcompanyA.com>, size=10572, nrcpt=1 (queue active)
Feb 26 14:54:01 syd-barrett postfix/smtpd[7732]: warning: network_biopair_interop: error writing 44 bytes to the network: Connection reset by peer
Feb 26 14:54:01 syd-barrett postfix/smtpd[7732]: warning: network_biopair_interop: error writing 31 bytes to the network: Broken pipe
Feb 26 14:54:01 syd-barrett postfix/smtpd[7732]: disconnect from mail-mw2nam10on2139.outbound.protection.outlook.com[40.107.94.139]
Feb 26 14:54:02 syd-barrett postfix/smtpd[7738]: connect from localhost.localdomain[127.0.0.1]
Feb 26 14:54:02 syd-barrett postfix/smtpd[7738]: E544422465: client=localhost.localdomain[127.0.0.1]
Feb 26 14:54:02 syd-barrett postfix/cleanup[7735]: E544422465: message-id=<34C9069F-6D71-429D-A536-B5D762233AC2@friendcompanyA.com>
Feb 26 14:54:02 syd-barrett postfix/qmgr[7647]: E544422465: from=<Friend@friendcompanyA.com>, size=11025, nrcpt=1 (queue active)
Feb 26 14:54:02 syd-barrett postfix/smtpd[7738]: disconnect from localhost.localdomain[127.0.0.1]
Feb 26 14:54:02 syd-barrett amavis[6636]: (06636-07) Passed CLEAN {RelayedOpenRelay}, [40.107.94.139]:51936 [40.107.94.139] <Friend@friendcompanyA.com> -> <mygmail@gmail.com>, Message-ID: <34C9069F-6D71-429D-A536-B5D762233AC2@friendcompanyA.com>, mail_id: WWCNTFsH0GOS, Hits: -1.801, size: 10565, queued_as: E544422465, dkim_sd=selector2-friendcompanyA-onmicrosoft-com:friendcompanyA.onmicrosoft.com, 1272 ms
Feb 26 14:54:02 syd-barrett postfix/smtp[7736]: 9AA2A203F8: to=<mygmail@gmail.com>, orig_to=<me@mycompany.com>, relay=127.0.0.1[127.0.0.1]:10024, delay=1.4, delays=0.07/0.02/0/1.3, dsn=2.0.0, status=sent (250 2.0.0 from MTA(smtp:[127.0.0.1]:10025): 250 2.0.0 Ok: queued as E544422465)
Feb 26 14:54:02 syd-barrett postfix/qmgr[7647]: 9AA2A203F8: removed
Feb 26 14:54:02 syd-barrett postfix/smtp[7739]: connect to gmail-smtp-in.l.google.com[2607:f8b0:400e:c09::1a]:25: Network is unreachable
Feb 26 14:54:03 syd-barrett postfix/smtp[7739]: setting up TLS connection to gmail-smtp-in.l.google.com[74.125.195.26]:25
Feb 26 14:54:03 syd-barrett postfix/smtp[7739]: Trusted TLS connection established to gmail-smtp-in.l.google.com[74.125.195.26]:25: TLSv1.2 with cipher ECDHE-ECDSA-AES128-GCM-SHA256 (128/128 bits)
Feb 26 14:54:03 syd-barrett postfix/smtp[7739]: E544422465: to=<mygmail@gmail.com>, relay=gmail-smtp-in.l.google.com[74.125.195.26]:25, delay=0.93, delays=0.01/0.04/0.13/0.75, dsn=2.0.0, status=sent (250 2.0.0 OK  1614351180 y17si9268983plh.394 - gsmtp)
Feb 26 14:54:03 syd-barrett postfix/qmgr[7647]: E544422465: removed
Feb 26 14:54:53 syd-barrett postfix/smtpd[7732]: connect from mail-bn7nam10on2131.outbound.protection.outlook.com[40.107.92.131]
Feb 26 14:54:53 syd-barrett postfix/smtpd[7732]: setting up TLS connection from mail-bn7nam10on2131.outbound.protection.outlook.com[40.107.92.131]
Feb 26 14:54:54 syd-barrett postfix/smtpd[7732]: Anonymous TLS connection established from mail-bn7nam10on2131.outbound.protection.outlook.com[40.107.92.131]: TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)
Feb 26 14:54:54 syd-barrett postfix/smtpd[7732]: 43D46203F8: client=mail-bn7nam10on2131.outbound.protection.outlook.com[40.107.92.131]
Feb 26 14:54:54 syd-barrett postfix/cleanup[7735]: 43D46203F8: message-id=<C9DE7C1F-AF5C-42A4-9216-31A151418DFF@friendcompanyB.com>
Feb 26 14:54:54 syd-barrett postfix/qmgr[7647]: 43D46203F8: from=<Friend@friendcompanyB.com>, size=10836, nrcpt=1 (queue active)
Feb 26 14:54:54 syd-barrett postfix/smtpd[7732]: warning: network_biopair_interop: error writing 44 bytes to the network: Connection reset by peer
Feb 26 14:54:54 syd-barrett postfix/smtpd[7732]: warning: network_biopair_interop: error writing 31 bytes to the network: Broken pipe
Feb 26 14:54:54 syd-barrett postfix/smtpd[7732]: disconnect from mail-bn7nam10on2131.outbound.protection.outlook.com[40.107.92.131]
Feb 26 14:54:55 syd-barrett postfix/smtpd[7738]: connect from localhost.localdomain[127.0.0.1]
Feb 26 14:54:55 syd-barrett postfix/smtpd[7738]: E1D8722465: client=localhost.localdomain[127.0.0.1]
Feb 26 14:54:55 syd-barrett postfix/cleanup[7735]: E1D8722465: message-id=<C9DE7C1F-AF5C-42A4-9216-31A151418DFF@friendcompanyB.com>
Feb 26 14:54:55 syd-barrett postfix/qmgr[7647]: E1D8722465: from=<Friend@friendcompanyB.com>, size=11289, nrcpt=1 (queue active)
Feb 26 14:54:55 syd-barrett postfix/smtpd[7738]: disconnect from localhost.localdomain[127.0.0.1]
Feb 26 14:54:55 syd-barrett postfix/smtp[7739]: connect to gmail-smtp-in.l.google.com[2607:f8b0:400e:c09::1a]:25: Network is unreachable
Feb 26 14:54:55 syd-barrett amavis[5574]: (05574-12) Passed CLEAN {RelayedOpenRelay}, [40.107.92.131]:15723 [40.107.92.131] <Friend@friendcompanyB.com> -> <mygmail@gmail.com>, Message-ID: <C9DE7C1F-AF5C-42A4-9216-31A151418DFF@friendcompanyB.com>, mail_id: WHaVv9MpPDf0, Hits: -1.901, size: 10829, queued_as: E1D8722465, dkim_sd=selector2-friendcompanyBcom-onmicrosoft-com:friendcompanyBcom.onmicrosoft.com, 1370 ms
Feb 26 14:54:55 syd-barrett postfix/smtp[7736]: 43D46203F8: to=<mygmail@gmail.com>, orig_to=<me@mycompany.com>, relay=127.0.0.1[127.0.0.1]:10024, delay=1.7, delays=0.32/0/0/1.4, dsn=2.0.0, status=sent (250 2.0.0 from MTA(smtp:[127.0.0.1]:10025): 250 2.0.0 Ok: queued as E1D8722465)
Feb 26 14:54:55 syd-barrett postfix/qmgr[7647]: 43D46203F8: removed
Feb 26 14:54:56 syd-barrett postfix/smtp[7739]: setting up TLS connection to gmail-smtp-in.l.google.com[74.125.195.26]:25
Feb 26 14:54:56 syd-barrett postfix/smtp[7739]: Trusted TLS connection established to gmail-smtp-in.l.google.com[74.125.195.26]:25: TLSv1.2 with cipher ECDHE-ECDSA-AES128-GCM-SHA256 (128/128 bits)
Feb 26 14:54:56 syd-barrett postfix/smtp[7739]: E1D8722465: to=<mygmail@gmail.com>, relay=gmail-smtp-in.l.google.com[74.125.195.26]:25, delay=0.54, delays=0.01/0/0.13/0.4, dsn=2.0.0, status=sent (250 2.0.0 OK  1614351232 u11si8933302pgj.302 - gsmtp)
Feb 26 14:54:56 syd-barrett postfix/qmgr[7647]: E1D8722465: removed
Feb 26 15:00:59 syd-barrett postfix/anvil[7728]: statistics: max cache size 2 at Feb 26 14:54:01
Feb 26 14:55:27 syd-barrett postfix/smtpd[7732]: connect from resqmta-po-02v.sys.comcast.net[96.114.154.161]
Feb 26 14:55:27 syd-barrett postfix/smtpd[7732]: setting up TLS connection from resqmta-po-02v.sys.comcast.net[96.114.154.161]
Feb 26 14:55:27 syd-barrett postfix/smtpd[7732]: Anonymous TLS connection established from resqmta-po-02v.sys.comcast.net[96.114.154.161]: TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)
Feb 26 14:55:27 syd-barrett postfix/smtpd[7732]: 9985D203F8: client=resqmta-po-02v.sys.comcast.net[96.114.154.161]
Feb 26 14:55:27 syd-barrett postfix/cleanup[7735]: 9985D203F8: message-id=<C1EEC46C-4850-420D-A278-64EBE1EE6D29@comcast.net>
Feb 26 14:55:27 syd-barrett postfix/qmgr[7647]: 9985D203F8: from=<friend@comcast.net>, size=4953, nrcpt=1 (queue active)
Feb 26 14:55:28 syd-barrett postfix/smtpd[7738]: connect from localhost.localdomain[127.0.0.1]
Feb 26 14:55:28 syd-barrett postfix/smtpd[7738]: DF9A122479: client=localhost.localdomain[127.0.0.1]
Feb 26 14:55:28 syd-barrett postfix/cleanup[7735]: DF9A122479: message-id=<C1EEC46C-4850-420D-A278-64EBE1EE6D29@comcast.net>
Feb 26 14:55:28 syd-barrett postfix/qmgr[7647]: DF9A122479: from=<friend@comcast.net>, size=5406, nrcpt=1 (queue active)
Feb 26 14:55:28 syd-barrett postfix/smtpd[7738]: disconnect from localhost.localdomain[127.0.0.1]
Feb 26 14:55:28 syd-barrett postfix/smtp[7739]: connect to gmail-smtp-in.l.google.com[2607:f8b0:400e:c09::1a]:25: Network is unreachable
Feb 26 14:55:28 syd-barrett amavis[6636]: (06636-08) Passed CLEAN {RelayedOpenRelay}, [96.114.154.161]:32912 [67.170.123.168] <friend@comcast.net> -> <mygmail@gmail.com>, Message-ID: <C1EEC46C-4850-420D-A278-64EBE1EE6D29@comcast.net>, mail_id: PzSxJQ1_ttxt, Hits: -3.781, size: 4952, queued_as: DF9A122479, dkim_sd=20190202a:comcast.net, 1240 ms
Feb 26 14:55:28 syd-barrett postfix/smtp[7736]: 9985D203F8: to=<mygmail@gmail.com>, orig_to=<me@mycompany.com>, relay=127.0.0.1[127.0.0.1]:10024, delay=1.3, delays=0.09/0/0/1.2, dsn=2.0.0, status=sent (250 2.0.0 from MTA(smtp:[127.0.0.1]:10025): 250 2.0.0 Ok: queued as DF9A122479)
Feb 26 14:55:28 syd-barrett postfix/qmgr[7647]: 9985D203F8: removed
Feb 26 14:55:28 syd-barrett postfix/smtp[7739]: setting up TLS connection to gmail-smtp-in.l.google.com[74.125.195.26]:25
Feb 26 14:55:28 syd-barrett postfix/smtp[7739]: Trusted TLS connection established to gmail-smtp-in.l.google.com[74.125.195.26]:25: TLSv1.2 with cipher ECDHE-ECDSA-AES128-GCM-SHA256 (128/128 bits)
Feb 26 14:55:29 syd-barrett postfix/smtp[7739]: DF9A122479: to=<mygmail@gmail.com>, relay=gmail-smtp-in.l.google.com[74.125.195.26]:25, delay=0.38, delays=0.01/0/0.1/0.28, dsn=2.0.0, status=sent (250 2.0.0 OK  1614351265 o15si7640511pgu.280 - gsmtp)
Feb 26 14:55:29 syd-barrett postfix/qmgr[7647]: DF9A122479: removed

A: I believe I fixed this, apparently it's a somewhat known issue with virtual alias forwarding to Google that Google may see the forward, look at the original sender, see the forwarded email is from a server not on the SPF list for the original sending domain, and silently dispose of the email, never to be seen.
The apparent solution is to use SRS so that Google sees the email as being sent from the forwarding server, and checks the SPF for the forwarding domain.
I say apparent because A) the solution has only been in place for a short time and B) because I couldn't enable SRS on that system, I ended up building a new mail server, and while I was at it, making sure SPF, DKIM, DMARC are all configured, and then also adding code for SRS.


text:
Q: How to calculate optimal gas limit and gas price? Im training to write on Solidity and when I try download ERC20 example in blockchain I need choose gas limit and gas price. How to calculate optimal?
https://www.ethgasstation.info says that with 5 gwei gas price confirmation time will be 0.46 mins, is it true? I read forums and I think this is too few
How much gas limit I need for ERC20 transfer?

A: you can calculate like this
const gasPrice = await web3.eth.getGasPrice();
const gasPriceLimit = await web3.eth.estimateGas({
     "from"      : walletbase,
     "nonce"     : value,
     "to"        : contractAddr,
     "data"      : data
})


text:
Q: Low Pass RC Filter for Load Cell I have a load-cell setup with some noise that I would like to filter out. I have a vague understanding of low-pass RC filters.
I have a strain gauge with 350 ohms of resistance (no load). How can I create an RC circuit to attempt to filter out some higher frequency signals? Is it as simple as using capacitor to match the resistance of the load cell for a given cut off frequency? Or will I need external resistors?
If external resistors are required, will this not change the output voltage (and thus the signal I'm intent on measuring?)

A: This is a broad question. The short answer is, it depends on what range of frequencies you want to filter out, and you will need external resistors. The long answer is, it depends on the sensitivity of your strain gage, how precise and fast you need your output to be, and how much time you want to devote to understanding the answer to this question.
As for changing the output voltage, yes and no; yes, you would likely change your output voltage if you were to modify the circuit below, but no, because it's not applicable here. (TL;DR- if you don't want a more step-by-step answer, just click the link to the UC Santa Barbara laboratory exercise at the bottom.)
I've inserted a schematic below of the simplest possible low-pass filter with what you have described.

simulate this circuit – Schematic created using CircuitLab
This circuit is relatively stupid, and will probably not do what you need, but it's a good starting point. The cutoff frequency for a low-pass filter, as described by $$ f_c = \frac{1}{2 \pi R C}$$
can be easily calculated as 455 Hz, or roughly 2 ms. Another (more simplistic) way to think about it is that anything faster than 2 ms will not be detectable.
Ah, if only electrical engineering were so simple as just a resistor and capacitor in parallel.
One popular (i.e., precise) implementation of a strain gage is using a Wheatstone bridge, which I've found via an online PDF of a laboratory exercise: Strain Gage Sensors Laboratory Exercise - UC Santa Barbara
This lab was written by people far more experienced than I, so I'll let them take over from me here.
I hope I've given you some of the tools necessary for acquiring more of your own answers. Please let me know if this has helped, or if you have other questions!

A:
Is it as simple as using capacitor to match the resistance of the load
  cell for a given cut off frequency? Or will I need external resistors?

It can certainly be as simple as this; when |Xc| = R (350 ohms) you have the cut-off frequency: -
$$F_C = \dfrac{1}{2\pi RC}$$
If you have a bridge of strain gauges then you might need three capacitors to optimally filter your bridge output; one from each output line to 0 volts and 1 between the two outputs: -


text:
Q: passport-jwt returns unauthorized when I go to /admin page on my web app I am trying to get the user logged in using passport and jwt token. I manage to generate jwt token successfully but when I go to /admin page by typing in the browser I am getting the unauthorized message. I have read all the answer here but they aren't helping me out.
My passport.js file
try {
    passport.use('signin', new LocalStrategy(
        function(username, password, done) {
            Users.findOne({username: username}, (err, user) => {
                if (err) { return(err)}
                if(!user) { return done(null, false, { message: 'Incorrect username.' })}
                if (!checkUser(password, user.password)) { return done(null, false, { message: 'Incorrect username.' }); }
                return done(null, user);
            });
        }
    ))
} catch (error) {
    return done(error);
}

passport.use(new JWTstrategy({
    secretOrKey: config.get('jwt.tokenKey'),
    jwtFromRequest: ExtractJWT.fromAuthHeaderAsBearerToken()
}, async(token, done) => {
    try {
        return done(null, token.user);
    } catch (err){
        done(err);
    }
}))

My login-controller file: -
router.post('/', (req, res) => {

    passport.authenticate('signin', {session:false}, async(err,user,info) => {
        try {
            if (err || !user) {
                console.log(err);
            }

            req.login(user, {session:false}, err => {
                if (err) res.send(err);

                const body = { username: user.username};

                const token = jwt.sign( {user:body}, config.get('jwt.tokenKey'));
                res.json({ success: true,
                    token: 'Bearer ' + token });
            });
        } catch (error) {
            return next(error);
        }
    })(req, res);
})

My admin page file: -
router.get('/',  passport.authenticate('jwt', { session: false }), function (req,res) {
    res.render('./../views/admin/admin.pug');
})


text:
Q: Conditional cron job using SLURM scheduler I'm currently running jobs on a computing cluster that uses the slurm workload manager. I can view all of the jobs I currently have running with:
$ squeue -u <username>
             JOBID PARTITION  NAME       USER ST     TIME  NODES NODELIST(REASON)
           3379570   sixhour job01 <username> PD     0:00      1 (Priority)
           3409269   sixhour job02 <username>  R 03:06:13      1 n387

So in this example, I have two jobs that have been submitted. job01 is pending, and job02 has been running for around 3 hours.
I want to set up a cron job that will only submit the job if it's not listed in the above view. Take the following cron file as an example:
MAILTO=""
* */1 * * * sbatch job01.sh
* */1 * * * sbatch job02.sh
* */1 * * * sbatch job03.sh

Using this cron file, each job would get submitted every hour. But because job01 and job02 are already listed under squeue -u <username>, I only want job03 to actually get submitted.
Is there a way I can add some conditional logic to the cron file?

A: You can try a script like this:
#!/bin/bash

jobnames=$(squeue -h --user <username> --format %j)

for jobname in job{01..03} ; do
grep "$jobname" <<< "$jobnames" >/dev/null || sbatch "$jobname.sh"
done

This script will collect all job names related to jobs submitted by <username> in $jobnames and then iterate over the ones it should expect. If one is not found, grep will return non-zero exit code and the || sbatch will be executed.
Replace the three lines in your cron file with a single one running the above script.


text:
Q: How do I retrieve the names of all checked checkboxes using jQuery? I want to get the names of all checked checkboxes.  I tried this:
$("#movebutton").click(function()   {
    var selectedids = "";
    alert($('.checkbos_gruppe[checked=checked]').attr("name"));
});

Does anyone have a better idea?

A: You need to loop through them, in this case .map() is a great choice to get an array of names, for example:
$("#movebutton").click(function()   {
  var selectednames = $('.checkbos_gruppe:checked').map(function() {
                      return this.name;
                    }).get();
  alert(selectednames.join(", "));
});

This will get you an array of the name attributes in selectednames, then use it however you want.  Make sure to use .get() on the end so you get just an array of the names.

A: use:
var names = $('.checkbos_gruppe:checked').map(function(index, elem) {
    return this.name;
}).get();


text:
Q: Apache prepend URL before requested URL How can I retrieve a URL like this:
http://xxx.example.com/resource/blahblah

and rewrite this address
http://example.com/yyy/zzz/vvv.html?subject=http://xxx.example.com/resource/blahblah

by Apache server and using mod-rewrite.

A: save the contents of url. Then upload the index.html page on apache server and start the apache server .

A: I don't know why the question has a negative point!! And I don't know why the answers are such irrelevant. Anyway, I have found the true answer by myself.
Create a file in this path or edit that file:
sudo nano /var/www/html/.htaccess

Fill the file:
RewriteEngine On

# avoids recursive rewrite of scripts
RewriteCond %{HTTP_REFERER}  ^http://xxx\.example\.com/.*$
RewriteRule ^yyy/.* - [L]

# rewrites scripts and css files
RewriteCond %{HTTP_REFERER}  ^http://xxx\.example\.com/.*$
RewriteRule ^(.*)$ yyy/$1 [QSA]

RewriteRule ^resource/([^\/]*)$ yyy/zzz/vvv.html?subject=http://xxx.example.com/resource/$1 [QSA]

and restart apache service:
sudo service apache2 restart


text:
Q: how can I install venv in windows 10 my goal is to install python 3.9 on venv
the process that I did :
mkdir nice
cd nice
python3 -m venv
pip install --upgrade virtualenv

when i tried to run :
python3.9 -m venv env

i got the error:
'python3.9' is not recognized as an internal or external command,
operable program or batch file.


text:
Q: Is it possible to migrate an HydratedBloc database in Flutter? I'm using hydrated_bloc to locally persist data in a Flutter app. However, whenever I update the class definition used by fromJson and toJson
HydratedBloc methods, all previous data stored in the Hive DB get lost. This is natural since fromJson tries to parse a Json file that's formatted in a different way than the previous one.
I'm wondering if there is a way to migrate the stored data (or DB) to the new instance with HydratedBloc.

I know there are ways to migrate DBs on other platforms, such as Room DB migration on Android, or plain SQL if I were to use a SQLite DB on Flutter, but since I'm already using HydratedBloc I'd like to take advantage of this package rather than replacing it with another one.


text:
Q: Toggle value of a variable with javascript I am just beginning learning HTML/CSS/JS. My experience with programming is only with FileMaker Pro and Databases. I am trying a button that toggles a variable through values ON and OFF.
What am I doing wrong?

var content = "ON";

function Change() {

  if (content == 'ON') {
    var content = "OFF";
  } else {
    var content = "ON";
  }
  console.log(content);

}
<!DOCTYPE html>
<html>

<head>
</head>

<body>
  <button onclick="Change();">Change </button>
</body>

</html>


text:
Q: jQuery get values of checked checkboxes into array I am trying to get values of all checkboxes that are currently checked and store them into an array. Here is my code so far:
 $("#merge_button").click(function(event){
    event.preventDefault();
    var searchIDs = $("#find-table input:checkbox:checked").map(function(){
      return $(this).val();
    });
    console.log(searchIDs);
  });

However this outputs more than I need. I not only get the values, but some other stuff I don't want.

["51729b62c9f2673e4c000004", "517299e7c9f26782a7000003",
  "51729975c9f267f3b5000002", prevObject: jQuery.fn.jQuery.init[3],
  context: document, jquery: "1.9.1", constructor: function, init:
  function…]

I would like just ID's (first 3 items in this case).
By using $.each and pushing values to an array I get desired output:
$("#find-table input:checkbox:checked").each(function(){ myArray.push($(this).val()); })

["51729b62c9f2673e4c000004", "517299e7c9f26782a7000003",
  "51729975c9f267f3b5000002"]

However I'd like to use $.map, since it saves me a line of code and is prettier.
Thanks

A:      var ids = [];

$('input[id="find-table"]:checked').each(function() {
   ids.push(this.value);
});

This one worked for me!

A: var idsArr = [];

$('#tableID').find('input[type=checkbox]:checked').each(function() {
    idsArr .push(this.value);
});

console.log(idsArr);

A: Call .get() at the very end to turn the resulting jQuery object into a true array.
$("#merge_button").click(function(event){
    event.preventDefault();
    var searchIDs = $("#find-table input:checkbox:checked").map(function(){
      return $(this).val();
    }).get(); // <----
    console.log(searchIDs);
});

Per the documentation:

As the return value is a jQuery object, which contains an array, it's very common to call .get() on the result to work with a basic array.

A: DEMO: http://jsfiddle.net/PBhHK/
$(document).ready(function(){

    var searchIDs = $('input:checked').map(function(){

      return $(this).val();

    });
    console.log(searchIDs.get());

});

Just call get() and you'll have your array as it is written in the specs: http://api.jquery.com/map/
$(':checkbox').map(function() {
      return this.id;
    }).get().join();

A: You need to add .toArray() to the end of your .map() function
$("#merge_button").click(function(event){
    event.preventDefault();
    var searchIDs = $("#find-table input:checkbox:checked").map(function(){
        return $(this).val();
    }).toArray();
    console.log(searchIDs);
});

Demo: http://jsfiddle.net/sZQtL/

A: I refactored your code a bit and believe I came with the solution for which you were looking.  Basically instead of setting searchIDs to be the result of the .map() I just pushed the values into an array.
$("#merge_button").click(function(event){
  event.preventDefault();

  var searchIDs = [];

  $("#find-table input:checkbox:checked").map(function(){
    searchIDs.push($(this).val());
  });

  console.log(searchIDs);
});

I created a fiddle with the code running.

A: Needed the form elements named in the HTML as an array to be an array in the javascript object, as if the form was actually submitted.
If there is a form with multiple checkboxes such as:
<input name='breath[0]' type='checkbox' value='presence0'/>
<input name='breath[1]' type='checkbox' value='presence1'/>
<input name='breath[2]' type='checkbox' value='presence2'/>
<input name='serenity'  type='text' value='Is within the breath.'/>
...

The result is an object with:
data = {
   'breath':['presence0','presence1','presence2'],
   'serenity':'Is within the breath.'
}

var $form = $(this),
    data  = {};

$form.find("input").map(function()
{
    var $el  = $(this),
        name = $el.attr("name");

    if (/radio|checkbox/i.test($el.attr('type')) && !$el.prop('checked'))return;

    if(name.indexOf('[') > -1)
    {
        var name_ar = name.split(']').join('').split('['),
            name    = name_ar[0],
            index   = name_ar[1];

        data[name]  = data[name] || [];
        data[name][index] = $el.val();
    }
    else data[name] = $el.val();
});

And there are tons of answers here which helped improve my code, but they were either too complex or didn't do exactly want I wanted: Convert form data to JavaScript object with jQuery
Works but can be improved: only works on one-dimensional arrays and the resulting indexes may not be sequential. The length property of an array returns the next index number as the length of the array, not the actually length.
Hope this helped. Namaste!

A: Do not use "each". It is used for operations and changes in the same element. Use "map" to extract data from the element body and using it somewhere else.

A:
here allows is class of checkboxes on pages and var allows collects them in an array and you can check for checked true in for loop then perform the desired operation individually. Here I have set custom validity. I think it will solve your problem.

  $(".allows").click(function(){
   var allows = document.getElementsByClassName('allows');
   var chkd   = 0;
   for(var i=0;i<allows.length;i++)
   {
       if(allows[i].checked===true)
       {
           chkd = 1;
       }else
       {

       }
   }

   if(chkd===0)
   {
       $(".allows").prop("required",true);
       for(var i=0;i<allows.length;i++)
        {
        allows[i].setCustomValidity("Please select atleast one option");
        }

   }else
   {
       $(".allows").prop("required",false);
       for(var i=0;i<allows.length;i++)
        {
        allows[i].setCustomValidity("");
        }
   }

});


text:
Q: Oracle: Run an Update Trigger Without Changing Data Is there a way in Oracle to fire an update trigger without actually changing any data?

A: UPDATE table SET column = column WHERE rownum = 1; should fire the trigger [once] I think.


text:
Q: ISNA: Return "YES", "NO" in nested formula I'm trying to get it to return YES/NO instead of the the lookup value/#N/A by using ISNA, but I'm not sure where to place it.
Here is my formula:
=IF(AND([@Center]="London",[@Reportable]="YES"),VLOOKUP([@ID],Client!C:C,1,FALSE),"IGNORE")

A: Try using MATCH as you only want to know if it's in the list.  This will return its location in the list or #N/A (VLOOKUP may return something that's not a number).
You can then check if it's numeric and return Yes / No as required:
=IF(AND([@Center]="London",[@Reportable]="YES"),IF(ISNUMBER(MATCH([@ID],Client!C:C,0)),"Yes","No"),"IGNORE")

A: try the following:
=IF(AND([@Center]="London",[@Reportable]="YES"),ISNA(VLOOKUP([@ID],Client!C:C,1,FALSE)),"IGNORE")

You have to wrap with ISNA the desired part of the formula to be affected.
I believe this is what you are looking for.
Nevetheless, this will output TRUE/FALSE, not YES/NO.
Hope it helps.


text:
Q: Vue JS: search filter on numbers my below code working good when i search for letters, but when it come for numbers like flat_number only it gives me error flat.flat_number.toLowerCase is not a function
filteredList() {
  return this.Flats.filter((flat) => {
    return (
      //i tried commented code but it didn;t work
      //  this.Flats.filter(flat_number => String(flat_number).includes(this.search)) ||

      flat.buyer
      .toLowerCase()
      .includes(this.search.toLowerCase()) ||
      flat.flat_number //flat_number not working
      .toLowerCase()
      .includes(this.search.toLowerCase()) ||
      flat.city
      .toLowerCase()
      .includes(this.search.toLowerCase())
    );
  });
},

any help please?

A: There is no toLowerCase function for Number.
If you want to treat flat as a String type, then do that conversion before comparing to search string.
filteredList() {
    return this.Flats.filter((flat) => {
        return (
            flat.buyer.toString()
                .toLowerCase()
                .includes(this.search.toLowerCase()) ||
            flat.flat_number.toString()
                .toLowerCase()
                .includes(this.search.toLowerCase()) ||
            flat.city.toString()
                .toLowerCase()
                .includes(this.search.toLowerCase())
        );
    });
},


text:
Q: Problem when flat catalog product option 'yes/no' on getting brand attributes I am getting all brands in my magento.When Flat catalog product is set to No, it fine. When it is no i got different result than i expected.
My Code
$attribute_code = array('apparelbrand','bagbrand','beltbrand','jewelrybrand','shoebrand','watchbrand');
foreach($attribute_code as $attribute_code)
    {
        $options= Mage::getSingleton("eav/config")->getAttribute("catalog_product", $attribute_code)->getSource()->getAllOptions(false);
        foreach($options as $option)
        {
            $collection = Mage::getModel('catalog/product')->getCollection();
            $collection->addAttributeToFilter($attribute_code, $option["value"])->addAttributeToFilter('status', array('eq'=>1));
            if(count($collection->getAllIds())>0)//Checks whether the product exist for particular brand
            {
                Mage::log($option["label"].":".count($collection->getAllIds()));
                $cat[strtoupper(substr($option["label"],0,1))][]=$option["label"];//creates the multi-dimensional array of brand value with the starting character as key
            }
        }
    }

The above code results as
Flat Catalog Product = No
brand1 : 2
brand2 : 5
brand6 : 5
.
.
etc..

Flat Catalog Product = Yes
brand1 : 2
brand2 : 5
brand3 : 128
brand4 : 128
brand5 : 128
brand6 : 5
.
.
etc..

Why the count() returns 128 instead count even the brand does not have that much products.What could be the reason for this problem?

A: There is core Magento "feature" which makes non-flat attributes not working in addAttributeToFilter() filtering when you use simple form:
addAttributeToFilter($attribute, $value)

Try to change this to following form:
addAttributeToFilter(array(array('attribute' => $attribute_code, 'eq' => $option["value"])))

Another thing which is not exactly related with your question, is that you could try to optimize your code - eg. change count($collection->getAllIds()) calls to $collection->getSize().

A: The value 128 is printer for a particular attribute, so that attribute option is Used in Product Listing = No, By changing this option makes my problem solved.


text:
Q: How can you tell if a user choose not to install a plug in? I am not sure the user is going to install the plug in.  They can choose not to install.  I need to know information like, install complete, or the user choose not to install.  Any ideas?
Thanks,
Grae

A: More context would be helpful in answering your question.
That said, if there's a particular plugin that you have in mind, you can do a post-install check* of simply trying to instantiate the object. This article has a pretty good description of what to do, but if you only care about IE and ActiveX plugins, then something like this should work well enough (untested):
function testPlugin(name)
{
    if (ActiveXObject)
    {
        try
        {
            return !!(new ActiveXObject(name));
        }
        catch (err) {}
    }
    return false;
}

and you could use that function to test whether or not, say, QuickTime is installed:
testPlugin('QuickTime.QuickTime');

*This will actually work at any time, not just after a possible plugin install


text:
Q: Generate QR codes with a logo or having background colors in Ruby I'm using rQrCode for generating QR Codes in Ruby. But I want to change the background colors or add an image in the middle of that generated QR Codes. I did some research but found nothing.
Have anyone implemented it in Ruby yet? Or do you have any idea about it?
Thanks a lot.

A:
I'm using rQrCode for generating QR Codes in Ruby. But I want to change the background colors [...]

Reviewing the rQrCode documentation you change the fill colour of QR codes using the following :color options when creating the QR code as either an image, ANSI, SVG or HTML table, as follows:
require "rqrcode"

qrcode = RQRCode::QRCode.new("http://stackoverflow.com/questions/42691235/generate-qr-codes-with-a-logo-or-having-background-colors-in-ruby")
image = qrcode.as_png(color: "000")
svg = qrcode.as_svg(color: "000")
html = qrcode.as_html # `td.black { border-color: #000; }` in stylesheet
string = qrcode.as_ansi(dark: "\033[40m")

You can also change the background colour, use the fill option instead
qrcode = RQRCode::QRCode.new("http://stackoverflow.com/questions/42691235/generate-qr-codes-with-a-logo-or-having-background-colors-in-ruby")
image = qrcode.as_png(fill: "000")
svg = qrcode.as_svg(fill: "000")
html = qrcode.as_html # `table { background-color: #000; }` in stylesheet
string = qrcode.as_ansi(light: "\033[40m")

These can either be used together or alone, its up to you.
However, I will warn you that depending on the contrast of the colours used, it may not be able readable by your, or someone else's, QR scanner. Also, change the QR code black squares to a different colour can break the QR code or not be register by the scanner.
As for appending or merging an image

[...] or add an image in the middle of that generated QR Codes.

Generate your QR code as before and give it a Transparent background colour
# require "chunky_png" # this already required by `rqrcode`
require "rqrcode"

qrcode = RQRCode::QRCode.new("http://stackoverflow.com/questions/42691235/generate-qr-codes-with-a-logo-or-having-background-colors-in-ruby")

TRANSPARENT = ::ChunkyPNG::Color::TRANSPARENT
qr_image = qrcode.as_png(fill: TRANSPARENT, module_px_size: 4)

_ You can ignore the module_px_size: 4 option, it was useful in my following example._
Then load your logo as a separate image and compose a new image with a reasonable width & height offset; I center the known smaller image within the larger image
logo = ChunkyPNG::Image.from_file("logo.png")

height = (logo.dimension.height / 2).floor - (qr_image.dimension.height / 2).floor
width  = (logo.dimension.width  / 2).floor - (qr_image.dimension.width  / 2).floor

qr_composed = logo.compose(qr_image, width, height)
qr_composed.save("qr_composed.png")

I have omitted logic to determine which is the large image before composing them, otherwise you will likely in encounter an out of bounds error, like so
~/gems/2.3.0/gems/chunky_png-1.3.8/lib/chunky_png/canvas/operations.rb:393:in `check_size_constraints!': Background image width is too small! (ChunkyPNG::OutOfBounds)

However, you can create a new blank image and merge the logo & QR code images either horizontally; e.g.
new_width  = logo.dimension.width + qr_image.dimension.width
qr_merged_horizontally = ChunkyPNG::Image.new(new_width, logo.dimension.height, ::ChunkyPNG::Color::WHITE)
qr_merged_horizontally.compose!(logo, 0, 0)
qr_merged_horizontally.compose!(qr_image, logo.dimension.width)
qr_merged_horizontally.save("qr_merged_horizontally.png")

Or vertically; e.g.
new_height = logo.dimension.height + qr_image.dimension.height
qr_merged_vertically   = ChunkyPNG::Image.new(logo.dimension.width, new_height, ::ChunkyPNG::Color::WHITE)
qr_merged_vertically.compose!(logo, 0, 0)
qr_merged_vertically.compose!(qr_image, 0, logo.dimension.height)
qr_merged_vertically.save("qr_merged_vertically.png")

By combining their widths or heights respectively.
Otherwise, it will require more external information or manual manipulation to position the images amongst one another.
References:

*

*File: README — Documentation for rqrcode (0.10.1)

*Module: ChunkyPNG::Color — Documentation for chunky_png (1.2.0)

A: You can overlay any image in the middle as long as it covers less area than the QR code error correction level. It's pretty simple to do with the current version of RQRCode (2.0.0):
qr_code = RQRCode::QRCode.new("some data", level: :h)

qr_code_png = qr_code.as_png(size: 600)
logo = ChunkyPNG::Image.from_file('some/path/logo.png')

qr_code_png.compose!(logo, 200, 200) # adjust the coordinates according to the logo size
qr_code_png.to_blob # binary file result


text:
Q: Angularjs ng-model nested inside ng-repeat updates all This should be simple. For some reason, when using ng-model inside of ng-repeat it updates all ng-models inside that repeat loop.
Here's the code. Any ideas?
http://plnkr.co/edit/iAgrPwwBMilCyeReeLt9?p=info
Thanks.

A: Interesting!!!
Problem is that you are resetting row.field with an object from "$scope.columns"
in

  <select ng-model="row.field" ng-options="column.title for column in columns"></select>

Here, row.field is reset with an object from $scope.columns and if you change this object in one row, as the other rows also use the same object, they repeat the same value.
You can change this model to row.field.type as

    <select ng-model="row.field.type" ng-options="column.type as column.title for column in columns" ng-change="resetRow(row.field)"></select>

and define $scope.resetRow in your controller to reset other properties based on the field type.
Here is the updated plunker.

I would love to have a feature in ng-options to return a copy of
  the object selected instead of the object reference to solve your problem though.


text:
Q: What is simpliest way to dispatch fault event in GraniteDS service I am trying to dispatch fault event in GraniteDS service
method call (Flex):
userService.addUser(user, null, function addUserFault(e:TideFaultEvent):void {
                Alert.show(e.fault.faultString);
            });

server method (Spring):
@Override
    public User addUser(User user) throws Exception{
        if(findUserByName(user.getUsername()) != null)
            throw new Exception("Username Already Exist");
        entityManager.persist(user);
        return user;
    }

But what i get is silence on client side and java.lang.NoSuchMethodException in server console.
How can i use default graniteds exception converter to deliver fault event to client (Flex)?

A: Solved. I dont know if it's a bug or not, but you cannot set result function to null and specify fault function only - this wont work. My call method should look like:
userService.addUser(user, function addUserResult(e:TideResultEvent){
                // do nothing
            }, function addUserFault(e:TideFaultEvent):void {
                Alert.show(e.fault.faultString);
            });

in this case java Exception in remote method will be send back to flex as TideFaultEvent.


text:
Q: How to create a new unique identifier for father and children registers where i just have the reading order? How to create a new unique identifier for father and children registers considering a table structure where I have the first row identified by C100 and the next rows identified by C170?
Table structure:
|C100|0|1|2001118|...
|C170|1|7385|...
|C170|2|15904|...
|C170|3|15975|...
|C170|4|15840|...
|C100|0|1|2015356|...
|C170|1|23194|...
|C100|0|1|2015356|...
|C170|1|20833|...
|C170|2|20836|...
|C170|3|20837|...
|C170|4|20838|...
|C170|5|20839|...
|C170|6|20840|...
|C170|7|20841|...
|C170|8|20842|...
|C170|9|20843|...
|C170|10|20845|...
|C170|11|20846|...

Note: This is an external table created over a formatted file where each row is in sequence by reading.
For register C170 the second column is ordering by number (1:N), but not the same when register is C100, because when register equal to C100 the next column would be 0 or 1.
To be more elusive, C100 is the father and each row named C170 under this C100 row are the children.
I would like to do something like this:
|1|C100|0|1|2001118|...
|1|C170|1|7385|...
|1|C170|2|15904|...
|1|C170|3|15975|...
|1|C170|4|15840|...
|2|C100|0|1|2015356|...
|2|C170|1|23194|...
|3|C100|0|1|2015356|...
|3|C170|1|20833|...
|3|C170|2|20836|...
|3|C170|3|20837|...
|3|C170|4|20838|...
|3|C170|5|20839|...
|3|C170|6|20840|...
|3|C170|7|20841|...
|3|C170|8|20842|...
|3|C170|9|20843|...
|3|C170|10|20845|...
|3|C170|11|20846|...

Thank you!

A: You could try something like this:
select sum(case register when 'C100' then 1 else 0 end) over (order by rownum) ind
     , t1.*
  from Your_Table t1;


text:
Q: Running systemd in a Docker managed plugin How do you run systemd in a Docker managed plugin?  With a normal container I can run centos/systemd and run an Apache server using their example Dockerfile
FROM centos/systemd
RUN yum -y install httpd; yum clean all; systemctl enable httpd.service
EXPOSE 80
CMD ["/usr/sbin/init"]

And running it as follows
docker build --rm --no-cache -t httpd .
docker run --privileged --name httpd -v /sys/fs/cgroup:/sys/fs/cgroup:ro -p 80:80 -d  httpd

However, when I try to make a managed plugin, there are some issues with the cgroups
I've tried putting in the config.json
    {
        "destination": "/sys/fs/cgroup",
        "source": "/sys/fs/cgroup",
        "type": "bind",
        "options": [
            "bind",
            "ro",
            "private"
        ]
    }

    {
        "destination": "/sys/fs/cgroup",
        "source": "/sys/fs/cgroup",
        "type": "bind",
        "options": [
            "bind",
            "ro",
            "rprivate"
        ]
    }

    {
        "destination": "/sys/fs/cgroup",
        "source": "/sys/fs/cgroup",
        "type": "bind",
        "options": [
            "rbind",
            "ro",
            "rprivate"
        ]
    }

I also tried the following which damages the host's cgroup which may require a hard reboot to recover.
    {
        "destination": "/sys/fs/cgroup/systemd",
        "source": "/sys/fs/cgroup/systemd",
        "type": "bind",
        "options": [
            "bind",
            "ro",
            "private"
        ]
    }

    {
        "destination": "/sys/fs/cgroup",
        "source": "/sys/fs/cgroup",
        "type": "bind",
        "options": [
            "bind",
            "ro",
            "private"
        ]
    }

It looks to be something to do with how opencontainer and moby interact https://github.com/moby/moby/issues/36861

A: This is how I did it on my https://github.com/trajano/docker-volume-plugins/tree/master/centos-mounted-volume-plugin
The key thing to do is preserve the /run/docker/plugins before systemd gets started and wipes the /run folder. Then make sure you create the socket in the new folder.
mkdir -p /dockerplugins
if [ -e /run/docker/plugins ]
then
  mount --bind /run/docker/plugins /dockerplugins
fi

The other thing is that Docker managed plugins add an implicit /sys/fs/cgroup AFTER the defined mounts in config so creating a readonly mount will not work unless it was rebound before starting up systemd.
mount --rbind /hostcgroup /sys/fs/cgroup

With the mount defined in config.json as
{
        "destination": "/hostcgroup",
        "source": "/sys/fs/cgroup",
        "type": "bind",
        "options": [
            "bind",
            "ro",
            "private"
        ]
}

Creating the socket needs to be customized since the plugin helpers write to /run/docker/plugins
l, err := sockets.NewUnixSocket("/dockerplugins/osmounted.sock", 0)
if err != nil {
    log.Fatal(err)
}
h.Serve(l)

The following shows the process above on how I achieved it on my plugin

*

*https://github.com/trajano/docker-volume-plugins/blob/v1.2.0/centos-mounted-volume-plugin/init.sh

*https://github.com/trajano/docker-volume-plugins/blob/v1.2.0/centos-mounted-volume-plugin/config.json

*https://github.com/trajano/docker-volume-plugins/blob/v1.2.0/centos-mounted-volume-plugin/main.go#L113

A: You can run httpd in a centos container without systemd - atleast to the tests with the docker-systemctl-replacement script.


text:
Q: References/Links to reset sections I have the following MWE:
\documentclass{article}
\usepackage{listings}
\usepackage{hyperref}

\begin{document}

\tableofcontents

\section{test}
\clearpage

\section{test}
\clearpage

\renewcommand\thesection{\Alph{section}}
\setcounter{section}{0}

\section{test}
\clearpage

\section{test}
\clearpage

\end{document}

Please notice that when in TOC one clicks on the A chapter, the link takes it to the 1st chapter, same for B->2 and would be so on. How to tell the hyperlinks to go to the reset chapter instead of the first one in the document?
I would appreciate all help.
Edit: appendix doesnt seem to be shown in TOC:
\documentclass{article}
\usepackage{listings}
\usepackage{hyperref}

\begin{document}

\tableofcontents

\section{test}
\clearpage

\section{test}
\clearpage

\appendix{test}
\clearpage

\appendix{test}
\clearpage

\end{document}

A: The reason why the OP example fails is the reset of the section counter without taking into account that \theHsection should be changed too -- doing so will lead to correct hyper anchors.
The appendix package takes care of this and \begin{appendices}...\end{appendices} should be used in order to get everything setup, as well as the toc option, if needed (omitted here)
\documentclass{article}
\usepackage{listings}
\usepackage{appendix}
\usepackage{hyperref}

\begin{document}

\tableofcontents

\section{A nice title}
\clearpage

\section{Another nice title}
\clearpage

\begin{appendices}

\section{A very nice title}
\clearpage

\section{A sophisticated title}
\clearpage
\end{appendices}

\end{document}


text:
Q: How Python does destroying the garbage? I have a question about the behaviour of this simple function.
Here a code:
def foo():
    pi = 3.14
    def f():
        return pi
    return f
F = foo()
F() # this is returning the 3.14

Why does the function f returning the 3.14? I thought, after function execution the entire local namespace should be destroing is'nt? So, the function foo at the end return the pointer to the declared function f (the function will be allocated into heap), but variable pi must be destroiyng as stack variable?

A:
Why does the function f return [...] 3.14? I thought, after function execution the entire local namespace should be destroing is'nt?

Yes and no.
In this case, the needed variables from the local namespace are retained as a so-called "closure" for the locally defined function. In this case, the pi variable remains available for this function until it is needed.
Let's elaborate a bit:
def foo():
    pi = 3.14
    def f():
        return pi
    return f

This is the outer function.
In the CLI, we can play around a bit.
>>> foo
<function foo at 0x000001B4E5282E18>
>>> dir(foo)
['__annotations__', '__call__', '__class__', '__closure__', '__code__', '__defaults__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__get__', '__getattribute__', '__globals__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__kwdefaults__', '__le__', '__lt__', '__module__', '__name__', '__ne__', '__new__', '__qualname__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__']

Ah, there is something like __closure__, the word I just used before. What is it?
>>> foo.__closure__
>>>

Huh?
>>> foo.__closure__ is None
True

Ah.
>>> f = foo() # get the inner function
>>> f
<function foo.<locals>.f at 0x000001B4E5C6C158>
>>> f()
3.14

Ok. Let's see what it has inside:
>>> f.__closure__
(<cell at 0x000001B4E5C34A08: float object at 0x000001B4E5231648>,)

Now what's that?
>>> c = f.__closure__[0]
>>> c
<cell at 0x000001B4E5C34A08: float object at 0x000001B4E5231648>

A cell?
>>> dir(c)
['__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'cell_contents']
>>> c.cell_contents
3.14

Ah. So f.__closure__[0] is a cell, something like a container, for the value taken from the local namespace above.
As a bonus, we could look into the disassembly of the functions:
>>> import dis
>>> dis.dis(foo)
  2           0 LOAD_CONST               1 (3.14)
              2 STORE_DEREF              0 (pi)

  3           4 LOAD_CLOSURE             0 (pi)
              6 BUILD_TUPLE              1
              8 LOAD_CONST               2 (<code object f at 0x000001B4E5C418A0, file "<stdin>", line 3>)
             10 LOAD_CONST               3 ('foo.<locals>.f')
             12 MAKE_FUNCTION            8
             14 STORE_FAST               0 (f)

  5          16 LOAD_FAST                0 (f)
             18 RETURN_VALUE
>>> dis.dis(f)
  4           0 LOAD_DEREF               0 (pi)
              2 RETURN_VALUE

Here we see how f is constructed:
      3           4 LOAD_CLOSURE             0 (pi)

Load the variable pi as a closure (a cell)
                  6 BUILD_TUPLE              1

Build a tuple with only this cell
                  8 LOAD_CONST               2 (<code object f at 0x000001B4E5C418A0, file "<stdin>", line 3>)
                 10 LOAD_CONST               3 ('foo.<locals>.f')
                 12 MAKE_FUNCTION            8

Make a function with the given name, code and closure
                 14 STORE_FAST               0 (f)

Store it.
In the function, the closure elements are accessed with LOAD_DEREF.

If we extend the function a bit, such as
def foo():
    pi = 3.14
    two = 2
    three = 3
    def f():
        return pi - three
    return f

we see how these variables are treated and handled:
>>> dis.dis(foo)
  2           0 LOAD_CONST               1 (3.14)
              2 STORE_DEREF              0 (pi)

  3           4 LOAD_CONST               2 (2)
              6 STORE_FAST               0 (two)

  4           8 LOAD_CONST               3 (3)
             10 STORE_DEREF              1 (three)

  5          12 LOAD_CLOSURE             0 (pi)
             14 LOAD_CLOSURE             1 (three)
             16 BUILD_TUPLE              2
             18 LOAD_CONST               4 (<code object f at 0x000001B4E5CA36F0, file "<stdin>", line 5>)
             20 LOAD_CONST               5 ('foo.<locals>.f')
             22 MAKE_FUNCTION            8
             24 STORE_FAST               1 (f)

  7          26 LOAD_FAST                1 (f)
             28 RETURN_VALUE

See how the variables pi and three differ from two: two is stored with STORE_FAST, the others use STORE_DEREF so that they can be passed to the function.
>>> foo().__closure__
(<cell at 0x000001B4E5BC41F8: float object at 0x000001B4E5231528>, <cell at 0x000001B4E5C348B8: int object at 0x0000000050816120>)

This now has two elements:
>>> foo().__closure__[0].cell_contents
3.14
>>> foo().__closure__[1].cell_contents
3

And this is how it is used:
>>> dis.dis(f)
  6           0 LOAD_DEREF               0 (pi)
              2 LOAD_DEREF               1 (three)
              4 BINARY_SUBTRACT
              6 RETURN_VALUE

The subtraction indeed happens inside the inner function, as the variables even could change:
import time
import threading

def foo():
    c = 0
    def run():
        nonlocal c
        while c < 50:
            c += 1
            time.sleep(1.0)
    t = threading.Thread(target=run)
    t.start()
    def f(): return c
    return f

Here, a thread increments the variable every second. If we now do f = foo(), we get this one inner function, which returns different values if called several times with some time between the calls.

A: this code returns a number, namely 3.14:
def foo():
    pi = 3.14
    def f():
        return pi
    return f()


text: Q: Exclude files from an Uber Jar built with IntelliJ? I have a Maven project in IntelliJ. And I am building an Uber JAR directly from the IDE. I would like to exclude certain files (*.rsa) from the Uber Jar but I am not able to find how to configure this. If the Uber Jar was packaged using maven and the maven-shade-plugin then it is possible to filter out files. But IntelliJ seems to be using something different behind the scenes to build the Uber Jar. This can be configured via the Artifact Configuration editor. But this editor does not provide any means to exclude files. And the schema of the _jar.xml file which this editor produces is kept secret somewhere. So how can I exclude files from an Uber Jar in IntelliJ?


text:
Q: Turing degrees of nonstandard models of PA Since the theorems of (PA + "there is a nonstandard number") are recursively enumerable, by the

Low Basis Theorem, WKL0's proof of the completeness theorem gives a nonstandard model of PA of [low degree](http://en.wikipedia.org/wiki/Low_(computability).  After seeing Adam Day's answer to

this question, I wonder "how easy" such a model could be to compute.

Can a low nonstandard model of PA be:

a) minimal

b) computably dominated

c) K-trivial

?
If it can be more than one of those, which can it be simultaneously?

A: b) is impossible, because the only low computably dominated degree is $\mathbf 0$ (see Soare's book Recursively Enumerable Sets and Degrees) and there are no computable nonstandard models of PA.
a) (minimal) and c) (K-trivial) are also impossible. See Theorem 4.2 of Csima/Harizanov/Hirschfeldt/Shore, Bounding homogeneous models. They give literature references for the fact that computing the atomic diagram of a nonstandard model of PA is equivalent to computing a PA degree, i.e., a complete extension of PA. Such a Turing degree cannot be minimal, because a PA degree bounds a 1-random degree, and the even and odd halves of a 1-random set are of incomparable degree. A PA degree cannot be K-trivial because each K-trivial degree is c.e. traceable, which implies it is not a DNR degree, which implies it is not a PA degree. See Nies, Computability and Randomness, Oxford Logic Guides, 2009.


text:
Q: Connect to Milvus standalone server (in docker container) from another docker container on the same host When I run Milvus in standalone mode on docker (by executing docker-compose on the default Milvus docker-compose.yml file, resulting in the three containers being created), I cannot connect to the Milvus server from a task running in another docker container on the same host. I have configured this container to be on the same network as the Milvus server, and I can ping the Milvus server from this container via the Milvus server's IP.
In the task container I run:
connections.connect(
    alias="default",
    host='192.168.192.4',
    port='19530',
    secure=False
    )

The error log shows:
Traceback (most recent call last):
File "task.py", line 45, in
secure=True
File "/usr/local/lib/python3.7/site-packages/pymilvus/orm/connections.py", line 262, in connect
connect_milvus(**kwargs, password=password)
File "/usr/local/lib/python3.7/site-packages/pymilvus/orm/connections.py", line 233, in connect_milvus
gh._wait_for_channel_ready()
File "/usr/local/lib/python3.7/site-packages/pymilvus/client/grpc_handler.py", line 118, in _wait_for_channel_ready
raise MilvusException(Status.CONNECT_FAILED, f'Fail connecting to server on {self._address}. Timeout')
pymilvus.exceptions.MilvusException: <MilvusException: (code=2, message=Fail connecting to server on 192.168.192.4:19530. Timeout)>

192.168.192.4 is the ip address of the milvus-standalone container.

A: Turns out this is not a Milvus issue. The problem was caused by our corporate network, and the proxy requirement. In the dockerfile, I need to set the proxy settings to be able to pull images. However, this sets the proxy settings during builld and for the container. These proxy settings prevented communication between the containers. The proxy setting needs to be reset in the dockerfile. The fix looked like this:
FROM python:3.9.12

ENV https_proxy <proxy settings>

COPY requirements.txt /

RUN pip3 install --proxy <proxy settings> -r requirements.txt

COPY task.py /

ENV https_proxy ""

CMD ["python3", "-u", "task.py"]


text:
Q: How to make HttpResponse print the new line? def index(request):
    review = Review.objects.all()
    output = "\n".join([each_review.review_text for each_review in review])

    return HttpResponse(output)

The output which I get is
"This book 1 is very great This book 2 is very great This book 3 is very great This book 4 is very great This book 5 is very great This something is very great"
But it doesn't print the new line between them. How to make that happen just with HttpResponse?

A: you get a html so you should to use

 output = "
".join([each_review.review_text for each_review in review])

or

 output = "\n".join([each_review.review_text for each_review in review])
 output = "
{}
".format(output)

A: By default HttpResponse has "text/html" as content-type, and html ignores newlines chars (or more exactly treats them as whitespaces).
If you want a text/html response content, you'll have to replace newlines by the appropriate html markup (either using
 instead of newlines or wrapping each line in a
 or
 etc). You'll also need to wrap the whole thing into a proper html document, IOW adding the parent  and  tags around your content etc.
Else if a plain text content type is ok, just set the content-type header on your response:
return HttpResponse(output, content_type="text/plain")

so the browser knows to interpret and render it correctly.
As a side note: the way you're using both the orm and str.join() is vastly inefficient.
First, str.join() takes any iterable (as long as all the items are strings) so you don't need to build a list - you could just use a generator expression ie (notice the lack of brackets around the expression):
output = "\n".join(each_review.review_text for each_review in review)

But if you're only interested in a single field from the model, loading the whole fields and building a model instance is a complete waste of resources both at the database and python code levels. The solution here is to use a QuerySet.value_list() instead (here with the flat flag set to True since we only want a single field):
output = "\n".join(Review.objects.values_list("review_text", flat=True))


text:
Q: POST Data to PHP Page Using C# in Place of Form URL I have an C# cart application that needs to POST some data to a PHP page and redirect the user to that page to view the data.  Everything is working fine!  So, what is the problem??
Since we are using a Javascript function to POST the form to the PHP page through setting its action to the PHP URL, it is not allowing us to clear our Session variable with our cart contents.
Once the user clicks checkout and is sent to the third party site, we want our session variable that stores their cart contents to go away.  To my knowledge I cannot clear this via the Javascript, so my idea was to send the POST data and the user to the PHP page through the C# code.
When the user clicks checkout, the Javascript reloads the page, sets the cart data to a string variable, clears the session, then POSTs the data and sends the user to the PHP page.
All of this is working, except for the POST of data and redirecting the user.  Unfortunately, the third party page cannot accept a URL.PHP?=var type parameter for security reasons, so we have to POST it.
Using WebRequest I believe I can get the data posted, but I cannot get the user redirected to that page to finish out their order.  Any ideas?

A: I recommend you implement an intermediary page to prepare the data and cleanup the Session for you. The 'checkout' link would simply navigate the user to this intermediary page, which would do the following:

*

*Collect the user's cart data out of the session

*Clear the session

*POST to the PHP page using WebRequest

From the MSDN on WebRequest:
using System;
using System.IO;
using System.Net;
using System.Text;

namespace Examples.System.Net
{
    public class WebRequestPostExample
    {
        public static void Main ()
        {
            // Create a request using a URL that can receive a post.
            WebRequest request = WebRequest.Create ("http://www.contoso.com/PostAccepter.aspx ");
            // Set the Method property of the request to POST.
            request.Method = "POST";
            // Create POST data and convert it to a byte array.
            string postData = "This is a test that posts this string to a Web server.";
            byte[] byteArray = Encoding.UTF8.GetBytes (postData);
            // Set the ContentType property of the WebRequest.
            request.ContentType = "application/x-www-form-urlencoded";
            // Set the ContentLength property of the WebRequest.
            request.ContentLength = byteArray.Length;
            // Get the request stream.
            Stream dataStream = request.GetRequestStream ();
            // Write the data to the request stream.
            dataStream.Write (byteArray, 0, byteArray.Length);
            // Close the Stream object.
            dataStream.Close ();
            // Get the response.
            WebResponse response = request.GetResponse ();
            // Display the status.
            Console.WriteLine (((HttpWebResponse)response).StatusDescription);
            // Get the stream containing content returned by the server.
            dataStream = response.GetResponseStream ();
            // Open the stream using a StreamReader for easy access.
            StreamReader reader = new StreamReader (dataStream);
            // Read the content.
            string responseFromServer = reader.ReadToEnd ();
            // Display the content.
            Console.WriteLine (responseFromServer);
            // Clean up the streams.
            reader.Close ();
            dataStream.Close ();
            response.Close ();
        }
    }
}

A: You can keep on using the Javascript solution and just add a Ajax call that will abandon the session

A: I am only speculating here but you should be able to transmit the data in a WebBrowser control item, that way it would send the post data and redirect.


text:
Q: android https CertPathValidatorException: TrustAnchor found but certificate validation failed Does anyone meet the below exception.
It occurs random. After it happened, then https connection cannot be used anymore. The whole application needs to restart.
The scenario :
After detailed trace of the code, i updated the scenario:
1. The application has 3 process in the same application.
2. The main ui process invoke https request in another thread.
3. The another 2 processes hold the 2 servcies. one service will also invoke https request in another thread.
4. When user logout, it will stop the 2 services.
3. When user login again, the main ui process invoke https request and then fail.

The code is like below:
URL url = new URL(mUri);
urlConnection = (HttpsURLConnection) url.openConnection();
urlConnection.setRequestMethod(mMethod);
if (mMethod.equals(HttpPost.METHOD_NAME)) {
    urlConnection.setDoOutput(true);
}
else {
    urlConnection.setDoOutput(false);
}
urlConnection.setDoInput(true);
urlConnection.setUseCaches(false);
urlConnection.setChunkedStreamingMode(0);
...
if (!TextUtils.isEmpty(mJsonContent)) {
    OutputStreamWriter wr = new OutputStreamWriter(urlConnection.getOutputStream());
    wr.write(mJsonContent);
    wr.close();
}
//Get Response
InputStream inputStream;
int statusCode;
statusCode = urlConnection.getResponseCode();
...
inputStream = urlConnection.getInputStream();
String bodyContent = convertStreamToString(inputStream);
inputStream.close();

if (urlConnection != null) {
    urlConnection.disconnect();
}

I would like to know what can be the root cause. Currenlty i have no clue to solve this error. The https connection is run in another thread. After getting response, it will post back to main thread.
W/System.err( 7158): javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: TrustAnchor found but certificate validation failed.

W/System.err( 7158):    at com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:409)

W/System.err( 7158):    at com.android.okhttp.Connection.upgradeToTls(Connection.java:146)

W/System.err( 7158):    at com.android.okhttp.Connection.connect(Connection.java:107)

W/System.err( 7158):    at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:294)

W/System.err( 7158):    at com.android.okhttp.internal.http.HttpEngine.sendSocketRequest(HttpEngine.java:255)

W/System.err( 7158):    at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:206)

W/System.err( 7158):    at com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:345)

W/System.err( 7158):    at com.android.okhttp.internal.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:89)

W/System.err( 7158):    at com.android.okhttp.internal.http.HttpURLConnectionImpl.getOutputStream(HttpURLConnectionImpl.java:197)

W/System.err( 7158):    at com.android.okhttp.internal.http.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:254)

W/System.err( 7158):    at com.xxxx.xxx.util.http.AsyncHttpsClient$AsyncRequest.run(AsyncHttpsClient.java:304)

W/System.err( 7158):    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)

W/System.err( 7158):    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)

W/System.err( 7158):    at java.lang.Thread.run(Thread.java:841)

W/System.err( 7158): Caused by: java.security.cert.CertificateException: java.security.cert.CertPathValidatorException: TrustAnchor found but certificate validation failed.

W/System.err( 7158):    at com.android.org.conscrypt.TrustManagerImpl.checkTrusted(TrustManagerImpl.java:308)

W/System.err( 7158):    at com.android.org.conscrypt.TrustManagerImpl.checkServerTrusted(TrustManagerImpl.java:202)

W/System.err( 7158):    at com.android.org.conscrypt.OpenSSLSocketImpl.verifyCertificateChain(OpenSSLSocketImpl.java:611)

W/System.err( 7158):    at com.android.org.conscrypt.NativeCrypto.SSL_do_handshake(Native Method)

W/System.err( 7158):    at com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:405)

W/System.err( 7158):    ... 13 more

W/System.err( 7158): Caused by: java.security.cert.CertPathValidatorException: TrustAnchor found but certificate validation failed.

W/System.err( 7158):    at com.android.org.bouncycastle.jce.provider.PKIXCertPathValidatorSpi.engineValidate(PKIXCertPathValidatorSpi.java:122)

W/System.err( 7158):    at java.security.cert.CertPathValidator.validate(CertPathValidator.java:190)

W/System.err( 7158):    at com.android.org.conscrypt.TrustManagerImpl.checkTrusted(TrustManagerImpl.java:295)

W/System.err( 7158):    ... 17 more

W/System.err( 7158): Caused by: com.android.org.bouncycastle.jce.provider.AnnotatedException: TrustAnchor found but certificate validation failed.

W/System.err( 7158):    at com.android.org.bouncycastle.jce.provider.CertPathValidatorUtilities.findTrustAnchor(CertPathValidatorUtilities.java:235)

W/System.err( 7158):    at com.android.org.bouncycastle.jce.provider.PKIXCertPathValidatorSpi.engineValidate(PKIXCertPathValidatorSpi.java:117)

W/System.err( 7158):    ... 19 more

W/System.err( 7158): Caused by: java.security.NoSuchAlgorithmException: error:0D0C50A1:asn1 encoding routines:ASN1_item_verify:unknown message digest algorithm

W/System.err( 7158):    at com.android.org.conscrypt.NativeCrypto.X509_verify(Native Method)

W/System.err( 7158):    at com.android.org.conscrypt.OpenSSLX509Certificate.verifyOpenSSL(OpenSSLX509Certificate.java:334)

W/System.err( 7158):    at com.android.org.conscrypt.OpenSSLX509Certificate.verify(OpenSSLX509Certificate.java:367)

W/System.err( 7158):    at com.android.org.bouncycastle.jce.provider.CertPathValidatorUtilities.verifyX509Certificate(CertPathValidatorUtilities.java:1427)

W/System.err( 7158):    at com.android.org.bouncycastle.jce.provider.CertPathValidatorUtilities.findTrustAnchor(CertPathValidatorUtilities.java:222)

W/System.err( 7158):    ... 20 more

A: According to other sources like [1,2] you have probably outdated OpenSSL version. Try updating your openSSL version. Minimal version: OpenSSL 0.9.8o
Your BouncyCastle uses OpenSSL com.android.org.conscrypt.OpenSSLX509Certificate.verify to verify the certificate.
The exception java.security.NoSuchAlgorithmException: error:0D0C50A1:asn1 encoding routines:ASN1_item_verify:unknown message digest algorithm means the certificate uses digest that is not handled in the OpenSSL, most probably SHA256.
UPDATE 01:
As noted in comments, in Android you cannot update system OpenSSL.
Lets experiment:

*

*Try visit domain with your code (if possible) which uses SHA-256 certificate (works in 100% cases or not):
https://www.fi.muni.cz/

*Then you can try to discover more details about your client support here:
https://www.ssllabs.com/ssltest/viewMyClient.html

*Then more info about your server (ciphersuites, notice digests):
https://www.ssllabs.com/ssltest/index.html
What are your Android and OKHttp versions? Your system uses https://conscrypt.org/ as a crypto provider. You can try to avoid using system bundled OpenSSL & BouncyCastle versions by using a new version of BouncyCastle - SpongyCastle.
Follow instructions here https://rtyley.github.io/spongycastle/ to install SpongyCastle as a new and preferred crypto provider (core, prov, pkix). If SpongyCastle is in effect your stacktrace will contain spongycastle packages.


text:
Q: What do we call a wife who "cheats" on her husband (without having sex with the other person)? Is "cheater" the suitable word for calling a wife who cheats on her husband in a secret romantic relationship with another man (no sex included)?
I found that "cheater" is a slang word, and I don't want it to be slang.
I know the word "traitor", but it doesn't explain the situation, even if its definition is "being disloyal".
Note: I have this scenario that I need the word to fit in:

*

*I bet that you wouldn't miss this part where a video shows the true face of Jasmine. The face of her being a ______.

A: There is emotional affair (Wikipedia):

The term often describes a bond between two people that mimics the closeness and emotional intimacy of a romantic relationship while never being physically consummated. An emotional affair is sometimes referred to as an affair of the heart. An emotional affair may emerge from a friendship, and progress toward greater levels of personal intimacy and attachment. What distinguishes an emotional affair from a friendship is the assumption of emotional roles between the two participants that mimic of those of an actual relationship - with regards to confiding personal information and turning to the other person during moments of vulnerability or need.

Then your example becomes "The face of her being in an emotional affair".
You could call the person an "emotional cheater", but that doesn't seem to be well-established. There are a few examples of that usage out there though, and I think it would be understood from context.

A: By common use of the words, "cheater" does include sexual relations.
However, a significant majority including experts in the field, disagrees with that and finds that cheating involves intimacy and trust and most importantly, the forming of a conspiracy against your regular partner (network of lies, etc.) as the primary element that defines cheating.
So it depends on which meaning you want to convey. From the wider context of your question, you already say you look for a term of someone who "cheats on her husband". That, of course, would be "cheater".
To illustrate the point: If said husband came home early one day, and found his wife in the arms of another man, sharing a snack and enjoying a movie together, I don't think his emotional reaction would depend on the question of penetration.

A: "more than a flirt"
There's no word that says someone has crossed the line beyond harmless flirting, but has not progressed to physical adultery. Of course, in these situations, it's often hard to know exactly what has gone on in secret.
"More than a flirt" conveys the notion that a wrong has been done in a relationship, though not necessarily physical adultery.

A: If you're willing to tweak your sentence ever so slightly, you can refer to the person as unfaithful:

: not faithful:
  a : not adhering to vows, allegiance, or duty : disloyal • an unfaithful friend
  b : not faithful to marriage vows • suspected her husband of being unfaithful
definitions from m-w.com

There is a strong connotation of physical intimacy (i.e. sex) as part of being unfaithful, but it's not required.

A: You can use adulterer which means:

a married person who has sex with someone who is not their wife or
  husband.

It's gender neutral. Adulteress can be used for a female.


text:
Q: Enviar anexo vindo do formulario usando phpmailer com formData tenho um formulario que recebe dados normais e anexo.
quando incluo o attachment o email nao passa, porem da mensagem de sucesso.
quando tiro a linha do attachment o email passa.
deixo o meu codigo.

Os campos assinalados com  sao de preenchimento obrigatorio

Nome

                 Anexar Documentos*
                 <input type="file" class="form-control" id="anexo" required ng-model="atendimento.anexo">

                     <button type="submit" class="btn btn-sm btn-danger pl-2 pr-2" ng-click="agendar()" >Enviar</button>

            </form>

    $mail = new PHPMailer(true);

        //Server settings
        //$mail->SMTPDebug = 2;            // Enable verbose debug output SMTP::DEBUG_SERVER;
        $mail->isSMTP();                                  // Send using SMTP
        $mail->Host       = '';            // Set the SMTP server to send through
        $mail->SMTPAuth   = true;                         // Enable SMTP authentication
        $mail->Username   = '';     // SMTP username
        $mail->Password   = '';                 // SMTP password
        $mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS; // Enable TLS encryption;
        $mail->Port       = 587;

          //Recipients
        $mail->setFrom('', '');
        $mail->addReplyTo('', '');
        $mail->addAddress($formData->email);     // Add a recipient
        $mail->AddAttachment($_FILES['anexo']['tmp_name'],$_FILES['anexo']['name']);   ```