text:
Q: Looking for lists of student difficulties with electromagnetism, circuits (DC and AC) I'm trying to help with an Instructor's Guide for an introductory calc-based physics text, and it would really help if I could locate some lists of typical student difficulties with topics like ...
flux
induced E and B fields
Faraday's law
Lenz's law
DC circuits
AC circuits
Is there a better approach than just Googling "student difficulties with XXX," as I have been trying with rather inconsistent luck?
Added--
Thanks for the reminder!  I actually found a copy of Randy Knight's book in the attic that I got from him at an AAPT meeting some years back.  I can't believe I actually located it in my chaos ... great suggestion!

A: I would recommend Randy Knight's book Five Easy Lessons (http://www.amazon.com/Five-Easy-Lessons-Strategies-Successful/dp/0805387021). It tries to outline all of the major issues students have in introductory physics, and in my opinion, does a pretty good job. Randy Knight is well known in the Physics Education Research community, and is the author of a popular introductory textbook.

A: Bill Beaty has a list of electricity misconceptions online. It is aimed at concepts that are misleadingly or completely incorrectly presented in early education, but since most people at one point or another attended school, they tend to have picked up some of these misconceptions by the time they get to higher education.
Beaty's writing is informal and accessible, and perhaps aimed more at the electrical engineer than the physicist. However, he does have a good way of explaining concepts intuitively. At least in my own experience, an solid, accurate, intuitive understanding is prerequisite to understanding any advanced concept or mathematical analysis. Subtle, fundamental misconceptions can amazingly persist for a long time, masked by rote memorization of equations describing the correct behavior.
The writing is also entertaining, posing questions like, If a cat gets trapped in a clothes dryer full of nylon pantyhose, which way do the electrons flow?
In addition to the list of misconceptions above, Beaty also has a large number of electricity articles in general, which seem to cover concepts that he either found interesting, or had difficulty learning, or teaching.


text:
Q: Android capture internal (application) audio I want to capture internal audio, programmatically. For instance, I want to play an audio file (on my device) and then capture the audio output - not using the microphone with the volume turned up.
Example use case: I want to make a library that other developers can use in their games, allowing users to record in-game audio.
Android says there is Playback Capture functionality, however, I just cannot find an example. I've googled for hours. Whenever I google 'android capture app sounds' or 'android record audio', I either get links to voice recording apps or some code recording from the microphone (usually nearly 10 years old)... e.g
Does anyone have a link to a working example?

A: You can reference MediareCorder with https://developer.android.com/guide/topics/media/mediarecorder

redpajama_set_name: RedPajamaStackExchange


text:
Q: Web UI for Nagios says "Not Running" although it is Been sorting through this on my own for a few days so looking for a pointer or two.  I was running Nagios 4.4.6 and decided to upgrade to 4.4.9.  I downloaded the source and built and installed the update.  It all went smoothly. I checked that Nagios was running and it was.  I then restarted Apache.
The UI for Nagios was up and running, but the Version it was displaying was wrong, it still showed 4.4.6. I went back and checked the running version of Nagios from the CLI and it still showed, 4.4.6.  I check the location of the executable and it showed the old date.
So, I located the newly built Nagios core executable and copied it to the /usr/sbin location.  I then restarted Nagios and it showed 4.4.9 so that was good.  I restarted Apache and it now shows the correct version of Nagios but the status is "Not Running" even though the CLI shows that it is.
This SO post is very similar but wasn't the solution for me:  Nagios is active on CLI but not running on Web Interface.
I have gone over the configuration multiple times but I am obviously missing something simple.
Can anyone see what I am missing?
I am on OpenSUSE Leap 15.3.
Nagios service status:
opensuse:/home/pete # systemctl status nagios
● nagios.service - Nagios Core 4.4.9
     Loaded: loaded (/usr/lib/systemd/system/nagios.service; enabled; vendor preset: disabled)
     Active: active (running) since Sat 2023-01-14 13:44:14 CST; 1 day 18h ago
       Docs: https://www.nagios.org/documentation
    Process: 1530 ExecStartPre=/usr/local/nagios/bin/nagios -v /etc/nagios/nagios.cfg (code=exited, status=0/SUCCESS)
    Process: 1540 ExecStart=/usr/local/nagios/bin/nagios -d /etc/nagios/nagios.cfg (code=exited, status=0/SUCCESS)
   Main PID: 1545 (nagios)
      Tasks: 16 (limit: 4915)
     CGroup: /system.slice/nagios.service
             ├─ 1545 /usr/local/nagios/bin/nagios -d /etc/nagios/nagios.cfg
             ├─ 1546 /usr/local/nagios/bin/nagios --worker /var/lib/nagios/nagios.qh
             ├─ 1547 /usr/local/nagios/bin/nagios --worker /var/lib/nagios/nagios.qh
             ├─ 1548 /usr/local/nagios/bin/nagios --worker /var/lib/nagios/nagios.qh
             ├─ 1549 /usr/local/nagios/bin/nagios --worker /var/lib/nagios/nagios.qh
             ├─ 1550 /usr/local/nagios/bin/nagios --worker /var/lib/nagios/nagios.qh
             ├─ 1551 /usr/local/nagios/bin/nagios --worker /var/lib/nagios/nagios.qh
             ├─ 1552 /usr/local/nagios/bin/nagios --worker /var/lib/nagios/nagios.qh
             ├─ 1553 /usr/local/nagios/bin/nagios --worker /var/lib/nagios/nagios.qh
             ├─ 1554 /usr/local/nagios/bin/nagios --worker /var/lib/nagios/nagios.qh
             ├─ 1555 /usr/local/nagios/bin/nagios --worker /var/lib/nagios/nagios.qh
             ├─ 1556 /usr/local/nagios/bin/nagios --worker /var/lib/nagios/nagios.qh
             ├─ 1557 /usr/local/nagios/bin/nagios --worker /var/lib/nagios/nagios.qh
             ├─ 1696 /usr/local/nagios/bin/nagios -d /etc/nagios/nagios.cfg
             ├─10894 /usr/local/nagios/lib/check_ping -H 127.0.0.1 -w 100.0,20% -c 500.0,60% -p 5
             └─10895 /usr/bin/ping -n -U -w 10 -c 5 127.0.0.1

Jan 16 00:00:00 opensuse nagios[1545]: CURRENT SERVICE STATE: localhost;Swap Usage;OK;HARD;1;SWAP OK - 100% free (2048 MB out of 2048 MB)
Jan 16 00:00:00 opensuse nagios[1545]: CURRENT SERVICE STATE: localhost;Total Processes;OK;HARD;1;PROCS OK: 80 processes with STATE = RSZDT
Jan 16 00:44:14 opensuse nagios[1545]: Auto-save of retention data completed successfully.

Nagios config test:
opensuse:/home/pete # /usr/local/nagios/bin/nagios -v /etc/nagios/nagios.cfg

Nagios Core 4.4.9
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 2022-11-16
License: GPL

Website: https://www.nagios.org
Reading configuration data...
   Read main config file okay...
   Read object config files okay...

Running pre-flight check on configuration data...

Checking objects...
        Checked 8 services.
        Checked 1 hosts.
        Checked 1 host groups.
        Checked 0 service groups.
        Checked 1 contacts.
        Checked 1 contact groups.
        Checked 24 commands.
        Checked 5 time periods.
        Checked 0 host escalations.
        Checked 0 service escalations.
Checking for circular paths...
        Checked 1 hosts
        Checked 0 service dependencies
        Checked 0 host dependencies
        Checked 5 timeperiods
Checking global event handlers...
Checking obsessive compulsive processor commands...
Checking misc settings...

Total Warnings: 0
Total Errors:   0

Things look okay - No serious problems were detected during the pre-flight check

Appache2 status:
opensuse:/home/pete # systemctl status apache2
● apache2.service - The Apache Webserver
     Loaded: loaded (/usr/lib/systemd/system/apache2.service; enabled; vendor preset: disabled)
     Active: active (running) since Sat 2023-01-14 13:44:14 CST; 1 day 18h ago
   Main PID: 1605 (httpd-prefork)
     Status: "Processing requests..."
      Tasks: 8
     CGroup: /system.slice/apache2.service
             ├─ 1605 /usr/sbin/httpd-prefork -DSYSCONFIG -C PidFile /var/run/httpd.pid -C Include /etc/apache2/sysconfig.d//loadmodule.conf -C Include /etc/apache2/sys>
             ├─ 1648 /usr/sbin/httpd-prefork -DSYSCONFIG -C PidFile /var/run/httpd.pid -C Include /etc/apache2/sysconfig.d//loadmodule.conf -C Include /etc/apache2/sys>
             ├─ 1649 /usr/sbin/httpd-prefork -DSYSCONFIG -C PidFile /var/run/httpd.pid -C Include /etc/apache2/sysconfig.d//loadmodule.conf -C Include /etc/apache2/sys>
             ├─ 1650 /usr/sbin/httpd-prefork -DSYSCONFIG -C PidFile /var/run/httpd.pid -C Include /etc/apache2/sysconfig.d//loadmodule.conf -C Include /etc/apache2/sys>
             ├─ 1651 /usr/sbin/httpd-prefork -DSYSCONFIG -C PidFile /var/run/httpd.pid -C Include /etc/apache2/sysconfig.d//loadmodule.conf -C Include /etc/apache2/sys>
             ├─ 1652 /usr/sbin/httpd-prefork -DSYSCONFIG -C PidFile /var/run/httpd.pid -C Include /etc/apache2/sysconfig.d//loadmodule.conf -C Include /etc/apache2/sys>
             ├─16196 /usr/sbin/httpd-prefork -DSYSCONFIG -C PidFile /var/run/httpd.pid -C Include /etc/apache2/sysconfig.d//loadmodule.conf -C Include /etc/apache2/sys>
             └─16216 /usr/sbin/httpd-prefork -DSYSCONFIG -C PidFile /var/run/httpd.pid -C Include /etc/apache2/sysconfig.d//loadmodule.conf -C Include /etc/apache2/sys>

Jan 14 13:44:14 opensuse systemd[1]: Starting The Apache Webserver...
Jan 14 13:44:14 opensuse systemd[1]: Started The Apache Webserver.

The installation summary for Nagios 4.4.9:
 General Options:
 -------------------------
        Nagios executable:  nagios
        Nagios user/group:  nagios,nagios
       Command user/group:  nagios,nagios
             Event Broker:  yes
        Install ${prefix}:  /usr/local/nagios
    Install ${includedir}:  /usr/local/nagios/include/nagios
                Lock file:  /run/nagios.lock
   Check result directory:  /usr/local/nagios/var/spool/checkresults
           Init directory:  /usr/lib/systemd/system
  Apache conf.d directory:  /etc/apache2/vhosts.d
             Mail program:  /usr/bin/mail
                  Host OS:  linux-gnu
          IOBroker Method:  epoll

 Web Interface Options:
 ------------------------
                 HTML URL:  http://localhost/nagios/
                  CGI URL:  http://localhost/nagios/cgi-bin/
 Traceroute (used by WAP):  /usr/sbin/traceroute

A: So, lots of trial and error but I sorted it out.  I think the primary issue was that the original 4.4.6 install must have had a different configuration than the 4.4.9 that I installed as an upgrade.  There were subtle differences in the paths in the config files but once I got everything properly sorted out, Nagios was displaying as running in the web UI.
I wish I could detail for you exactly the steps I took, but I tried so many things and changed so many things that I lost track of exactly what the solution was.  I can give you the final step.  After making changes to the location of the nagios.cfg file in /usr/lib/systemd/system/nagios.service I then saw errors in the log about missing objects in /usr/local/nagios/libexec/ which led me to discover that the 4.4.6 version had those objects in the /usr/local/nagios/lib folder. I copied the file into the libexec folder and it started working.
I have a recollection that my last upgrade was problematic and hacky and I am probably living with the results of that.  I don't remember how Nagios was originally installed so it may go back to an earlier installation.
I am still suspicious of the current situation and I plan to go back through the details of where everything should be.  But for now it is working.


text:
Q: Trying to add a line break to function, but can't get it to work correctly I'm brand new to R so bear with me! Trying to do a project for a college class.
Here is my function:
function(x) {
    y = seq(from = 1, to = x, by = 1)
    f = cat(paste("This is Banana", y, sep="\n"))
    return(f)
}

From some searching on here I learned to add cat and sep="\n" to insert line breaks. However it is inserting them in the wrong place:
When I run the function (ex. x=3) it does this and skips the number to the next line
This is Banana
1 This is Banana
2 This is Banana
3 NULL

I want it to look like this:
This is Banana 1
This is Banana 2
This is Banana 3

Any advice is appreciated, thanks a ton.

A: Get rid of f and move the closing paren for paste (you can also simplify seq):
myfun <- function(x) {
    y <- seq(x)
    cat(paste("This is Banana", y), sep="\n")
}

myfun(3)
This is banana 1
This is banana 2
This is banana 3

A: Dan Y already answered your question, I just want to mention why your code is giving a different output - it's because the paste function uses the sep argument to decide the character string used to separate each given argument, not just add it once at the end of all the arguments given.
So paste("This is Banana", y, sep="\n") is actually inserting the line break between This is Banana and y, which is why the numbers appear on the next line instead of the current one.


text:
Q: When Worksharing Constructs Inside a critical Construct is useful in OpenMP? Among OpenMP examples the following code can be found 6.2 Worksharing Constructs Inside a critical Construct:
void critical_work()
{
  int i = 1;
  #pragma omp parallel sections
  {
    #pragma omp section
    {
      #pragma omp critical (name)
      {
        #pragma omp parallel
        {
          #pragma omp single
          {
            i++;
          }
        }
      }
    }
  }
}

Have you ever used this structure? Under what circumstances is it the best option in real life? My only guess is that it can be useful in error handling, what else?

A: I think this particular example just demonstrates that this kind of code is still conforming with the standard.
If the question is just about having a worksharing construct inside a critical construct (inside a worksharing construct), I could roughly imagine hierarchical applications where you generally have two layers of nested OpenMP parallelism, but most work is done outside of the critical region, e.g.:
void mostly_uncritical_work()
{
  #pragma omp parallel
  {
    #pragma omp parallel
    {
      /* main workload */
    }
    #pragma omp critical (name)
    {
      #pragma omp parallel
      {
        /* smaller amount of work but still big enough */
        /* to profit from parallelization */
      }
    }
  }
}

So in the end the question boils down to "Are there applications for nested OpenMP parallelism?" and there my answer would certainly be yes. I use it for example to have a team of 2 threads in the outer team, one of them simulating things on a GPU and the other one analyzing the output of the GPU using an inner team of threads.


text:
Q: How a singleton hides its dependencies? Recently I read the blog post about downsides of singletons where author states:

Why is Singleton evil?

*

*Hides dependencies – A component that uses one or more singletons is hiding crucial information about your dependencies. It doesn't take
  long for calls to a singleton to creep through your code base like
  kudzu, slowly attaching itself to every class in the system. Exposing
  that dependency forces you to think about it as you use a component.
  It also makes it more reusable as the caller can understand its
  requirements and how they might be satisfied.

How exactly a singleton hides its dependencies and what does it mean? Firstly I thought about inability to inject dependencies but we still have setter injection, so it makes no sense.
Please, provide code example if possible.

A: 1 Singleton can have a setter, but it has a global state of itself. So in one place of your application you can set one object and it will affect behaviour in another place of your application.
2 When you create an object you have no idea about its dependencies, because constructor does not have them, you just write new MyObject();
But inside there is a dependency for another object. And you have no idea about dependency objects state.
public class MyObject {

     private AnotherObject anotherObject = Singleton.getInstance();

     public MyObject() {
         //nothing here
     }
}

Instead, it's more useful to write:
public class MyObject {

    private AnotherObject anotherObject;

    public MyObject(AnotherObject comesFromOutside) {
        this.anotherObject = comesFromOutside;
    }
}

Then the user of your code will instantly see all your dependencies without watching your source code just writing new MyObject(new AnotherObject())
there is more information here:
http://www.yegor256.com/2016/06/27/singletons-must-die.html

A: I think what is meant in the cite above, is that by using a singleton this code has a dependency (or maybe better an interconnection) to every other piece of code that is using the same singleton. If the state of the singleton is changed in one place, all other places where the singleton is used may be affected without even knowing.
The below example is somewhat constructed but it should make my point clear:
class ExistingClass {
   public String getData() {
       return Singleton.getInstance().getData();
   }
}

class NewClass {
   public void setData(final String aSomeData) {
       Singleton.getInstance().setData(aSomeData);
   }
}

ExistingClass is using the singleton and assumes it's state is fixed. But someone adds NewClass with an option to alter the singleton's state. So NewClass and ExistingClass have an interconnection that is not clearly visible at the first glance.
Additionally by using the Singleton.getInstance() method directly inside arbitrary methods, the usage of the singleton is not directly visible when taking a short look at the classes.
However this is only problematic if you're using stateful singletons. If a singleton has no state or the state can't be changed, using singletons is nothing you should be worried about. Especially in combination with dependency injection frameworks like Spring.


text:
Q: trying to format x and y coordinates using .format() function So I have an assignment where I have the user input a few numbers and it draws a shape based on the number and length input.  As the turtle draws the picture it is supposed to report the X and Y coordinates and heading after each turn; however the X and Y coordinates need to be formatted as integers so that they display a whole number instead of a decimal.  I'm supposed to use the .format() function to do so but I have no idea where and how to use it.
Here is my code so far:
import turtle
lawrence = tur  tle.Turtle()
lawrence.goto(-150,0)
lawrence.pencolor('white')
lawrence.speed(2)

#setup of window that final image will be displayed on
window = turtle.Screen()
window.setup(1000,1000)
window.title("Homework 3")
window.bgcolor('black')

user_shape = int(input('What do you want me to draw? (1 = square, 2 = triangle): '))
if user_shape == 1:
print('I will draw a square')
else:
print('I will draw an equilateral triangle')

user_length = int(input('How long do you want the sides of your square to be? Please enter the number of pixels (e.g. 100): '))

for num in range(user_shape):
    lawrence.forward(user_length)
    lawrence.left(90)
    print('My 1st corner is at: ',lawrence.xcor().format(),',',lawrence.ycor(), 'and my heading is',lawrence.heading())
    lawrence.forward(user_length)
    lawrence.left(90)
    print('My 2nd corner is at: ',lawrence.xcor(),',',lawrence.ycor(), 'and my heading is',lawrence.heading())
    lawrence.forward(user_length)
    lawrence.left(90)
    print('My 3rd corner is at: ',lawrence.xcor(),',',lawrence.ycor(), 'and my heading is',lawrence.heading())
    lawrence.forward(user_length)
    lawrence.left(90)
    print('My 4th corner is at: ',lawrence.xcor(),',',lawrence.ycor(), 'and my heading is',lawrence.heading())

window.exitonclick()

I'm only in a basic python programming class and just need to know how to use the .format() function and where so any help would be great
EDIT---------------------------------------------------------------------------
that first part of my code works great but I have another problem now.. I have to ask the user for a second input on a second shape ( so after the first shape is drawn and recorded the prompt asks for a second shape to draw and record)
import turtle
lawrence = turtle.Turtle()
lawrence.goto(-150,0)
lawrence.pencolor('white')
lawrence.speed(2)

#setup of window that final image will be displayed on
window = turtle.Screen()
window.setup(1000,1000)
window.title("Homework 3")
window.bgcolor('black')

user_shape = int(input('What do you want me to draw? (1 = square, 2 = triangle): '))
if user_shape == 1:
    print('I will draw a square')
    user_length = int(input('How long do you want the sides of your square to be? Please enter the number of pixels (e.g. 100): '))
    for num in range(user_shape):
        lawrence.forward(user_length)
        lawrence.left(90)
        print('My 1st corner is at: ','{0:.0f}'.format(lawrence.xcor()),',','{0:.0f}'.format(lawrence.ycor()),'and my heading is',lawrence.heading())
    lawrence.forward(user_length)
    lawrence.left(90)
    print('My 2nd corner is at: ','{0:.0f}'.format(lawrence.xcor()),',','{0:.0f}'.format(lawrence.ycor()),'and my heading is',lawrence.heading())
    lawrence.forward(user_length)
    lawrence.left(90)
    print('My 3rd corner is at: ','{0:.0f}'.format(lawrence.xcor()),',','{0:.0f}'.format(lawrence.ycor()),'and my heading is',lawrence.heading())
    lawrence.forward(user_length)
    lawrence.left(90)
    print('My 4th corner is at: ','{0:.0f}'.format(lawrence.xcor()),',','{0:.0f}'.format(lawrence.ycor()),'and my heading is',lawrence.heading())
if user_shape == 2:
    print('I will draw an equilateral triangle')
    user_length = int(input('How long do you want the sides of your triangle to be? Please enter the number of pixels (e.g. 100): '))
    for num in range(user_shape):
        lawrence.forward(user_length)
        lawrence.left(135)
        print('My 1st corner is at: ','{0:.0f}'.format(lawrence.xcor()),',','{0:.0f}'.format(lawrence.ycor()),'and my heading is',lawrence.heading())

window.exitonclick()

so the issue that i'm having is that the program reports 2 coordinates even with only one output and I've discovered that when you press 2 to indicate you want a triangle to be drawn and then indicate the length of the sides the program is taking the '2' input from the user and multiplying it by the number of coordinates it needs to report.  so instead of drawing out a line and reporting x,y coordinates and heading it reports x,y coordinated and heading and then a second set of x,y coordinates and heading even though only one line of outputs is coded.
so ya need help there too

A: If you are allowed to convert your coordinates to integer numbers then correct formatting would be (I am showing only the first print statement):
print('My 1st corner is at: {:d},{:d} and my heading is {}'.format(int(lawrence.xcor()), int(lawrence.ycor()), lawrence.heading())

or if you need to round floating point numbers, replace int(lawrence.xcor()) with int(round(lawrence.xcor())).
If you are not allowed to convert coordinates to integers, then use the following formatting:
print('My 1st corner is at: {:.0f},{:.0f} and my heading is {}'.format(lawrence.xcor(), lawrence.ycor(), lawrence.heading())

A: Replace lawrence.xcor().format() with '{0:.0f}'.format(lawrence.xcor()).

A: String format is a very powerful tool to output text in various forms. If you are aiming to write simple and readable code I recommend reading through this chapter (I always go back to it myself): https://docs.python.org/3.6/library/string.html#format-specification-mini-language
Now to your question: if you are going to use the same pattern repeatedly you can first define the string (outside the loop), e.g.:
p_string = 'My {} corner is at: {:.0f},{:.0f} and my heading is {}'

You simply put the unkown {} where you want to insert a string. Now you can go ahead and print:
print(p_string.format("1st",*lawrence.pos(), lawrence.heading()))

...
print(p_string.format("2nd",*lawrence.pos(), lawrence.heading()))

The * before lawrence.pos()unpacks the tuple/list (meaning it is equivalent to: lawrence.xcor(), lawrence.ycor())

A: from
print('My 1st corner is at: ',lawrence.xcor().format(),',',lawrence.ycor(), 'and my heading is',lawrence.heading())

to
print_str = 'My 1st corner is at: ({}, {}), and my heading is {}'.format(lawrence.xcor(), lawrence.ycor(), lawrence.heading())
print(print_str)


text:
Q: Styles in .scss file not applied I have a react app and use .scss files for styling.
My index.js looks like this:
import './App.scss';

import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';

ReactDOM.render(
    <React.StrictMode>
        <App/>
    </React.StrictMode>,
    document.getElementById('root')
);

My App.scss looks like this:
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    height: 100%;
}

body,
:global(#root) {
    min-height: 100%;
    color: var(--primary-font-color);
    font-family: "Open Sans", sans-serif;
    font-weight: 400;
    font-size: 18px;
    line-height: 22px;
}

h1 {
    color: var(--primary-font-color);
    font-size: 32px;
    font-weight: 600;
    line-height: 36px;
}

:root {

    /*Colors */
    --primary-color: #f6f5f2;
}

Now my problem is that all the styles apart from *,*::before,*::after and :root are not applied.
In the browser console I can see that the App.scss is used and the *,*::before,*::after styles are applied. Also all vars from :root can be found there.
I want to use the App.scss file for global styles, but the only way I found to apply them is with an @import("App.scss") in a component.module.scss. Importing the App.scss to every module results in as many duplicates as imports. Is this the intended way to handle scss styles?

A: Sass is not recommended to use today for global styles, because as they wrote -> it can generate more files than you want -> effect is that you have worse performance
This information we can read on their main page
I recommend you use once simple CSS file for variables, global styles then easily you can reuse them and if you wanna use Sass as a developer then go-ahead for the rest of styling
Best!

A: For example what you can do
App.css:
body {
  margin: 0;
  font-family: Lato, Helvetica, Arial, sans-serif;
  transition: all 0.3s linear;
}

:root {
  --facebook-color: #507dc0;
}

And then:
Login.scss
body {
  .login {
    background-color: var(--facebook-color);
  }
}

Of course this is only example.

A: I found the a solution:
Looks like it was the :global(#root) which caused the problem. Removing it makes the other styles applied no matter if they are in a .scss or .css file.


text:
Q: Map RSS entries to HTML body w. non-exact search How would you solve this problem?
You're scraping HTML of blogs. Some of the HTML of a blog is blog posts, some of it is formatting, sidebars, etc. You want to be able to tell what text in the HTML belongs to which post (i.e. a permalink) if any.
I know what you're thinking: You could just look at the RSS and ignore the HTML altogether! However, RSS very often contains only very short excerpts or strips away links that you might be interested in. You want to essentially defeat the excerptedness of the RSS by using the HTML and RSS of the same page together.
An RSS entry looks like:

title
excerpt of post body
permalink

A blog post in HTML looks like:

title (surrounded by permalink, maybe)
...
permalink, maybe
...
post body
...
permalink, maybe
So the HTML page contains the same fields but the placement of the permalink is not known in advance, and the fields will be separated by some noise text that is mostly HTML and white space but also could contain some additional metadata such as "posted by Johnny" or the date or something like that. The text may also be represented slightly different in HTML vs. RSS, as described below.
Additional rules/caveats:

*

*Titles may not be unique. This happens more often than you might think. Examples I've seen: "Monday roundup", "TGIF", etc..

*Titles may even be left blank.

*Excerpts in RSS are also optional, but assume there must be at least either a non-blank excerpt or a non-blank title

*The RSS excerpt may contain the full post content but more likely contains a short excerpt of the start of the post body

*Assume that permalinks must be unique and must be the same in both HTML and RSS.

*The title and the excerpt and post body may be formatted slightly differently in RSS and in HTML. For example:

*

*RSS may have HTML inside of title or body stripped, or on the HTML page more HTML could be added (such as surrounding the first letter of the post body with something) or could be formatted slightly differently

*Text may be encoded slightly differently, such as being utf8 in RSS while non-ascii characters in HTML are always encoded using ampersand encoding. However, assume that this is English text where non-ascii characters are rare.

*There could be badly encoded Windows-1252 horribleness. This happens a lot for symbol characters like curly quotes. However, it is safe to assume that most of the text is ascii.

*There could be case-folding in either direction, especially in the title. So, they could all-uppercase the title in the HTML page but not in RSS.

*The number of entries in the RSS feed and the HTML page is not assumed to be the same. Either could have more or fewer older entries. We can only expect to get only those posts that appear in both.

*RSS could be lagged. There may be a new entry in the HTML page that does not appear in the RSS feed yet. This can happen if the RSS is syndicated through Feedburner. Again, we can only expect to resolve those posts that appear in both RSS and HTML.

*The body of a post can be very short or very long.

100% accuracy is not a constraint. However, the more accurate the better.
Well, what would you do?

A: I would create a scraper for each of the major blogging engines. Start with the main text for a single post per page.
If you're lucky then the engine will provide reasonable XHTML, so you can come up with a number of useful XPath expressions to get the node which corresponds to the article. If not, then I'm afraid it's TagSoup or Tidy to coerce it into well formed XML.
From there, you can look for the metadata and the full text. This should safely remove the headers/footers/sidebars/widgets/ads, though may leave embedded objects etc.
It should also be fairly easy (TM) to segment the page into article metadata, text, comments, etc etc and put it into fairly sensible RSS/Atom item.
This would be the basis of taking an RSS feed (non-full text) and turning it into a full text one (by following the permalinks given in the official RSS).
Once you have a scraper for a blog engine, you can start looking at writing a detector - something that will be the basis of the "given a page, what blog engine was it published with".
With enough scrapers and detectors, it should be possible to point a given RSS/Atom feed out and convert it into a full text feed.
However, this approach has a number of issues:

*

*while you may be able to target the big 5 blog engines, there may be some blogs which you just have to have that aren't covered by them: e.g. there are 61 engines listed on Wikipedia; people who write their own blogging engines each need their own scraper.

*each time a blog engine changes versions, you need to change your detectors and scrapers. More accurately, you need to add a new scraper and detector. The detectors have to become increasing more fussy to distinguish between one version of the same engine and the next (e.g. everytime slashcode changes, it usually changes the HTML, but different sites use different versions of slash).

I'm trying to think of a decent fallback, but I'll edit once I have.

A: RSS is actually quite simple to parse using XPath  any XML parser (or regexes, but that's not recpmmended), you're going through the <item> tags, looking for <title>, <link>, <description> .
You can then post them as different fields in a database, or direcrtly merge them into HTML. In case the <description> is missing, you could scrape the link (one way would be to compare multiple pages to weed-out the layout parts of the HTML).


text:
Q: How to 'safely' back up SQLite3 in Rails? I'm currently developing a small-scale web app using Rails, and have been looking into the best way to go about keeping backups of the database. I've decided to use SQLite3 for the database as it's small-scale enough that it makes sense (there will ideally be barely any traffic to the website), but as the application needs to be accessible on-demand 24/7, I want to make sure that any backup method doesn't interrupt things too much.
I've found a fair few old resources online that suggest just copying the database file, but this has obvious locking problems if the file is written to whilst the copy happens. The SQLite built-in .backup command seems to be what I'm after to avoid this, but I can't seem to find a way to trigger that properly from within Rails. Using the ActiveRecord connection.execute('.backup') doesn't work because it's not valid SQL syntax, and whilst there are appropriate methods to call the backup from inside the SQLite3 gem, I'm not sure if it's possible to get down to that object level from within ActiveRecord?
I could just set up a cron job/script that runs the sqlite command-line tool and executes the backup command, but I'm worried that running that concurrently with the Rails server could still potentially present concurrency issues?


text:
Q: How to send several arguments with ipcRenderer I'd like to know how to send several arguments via ipcRenderer on an Electron app.
Should I send an array of arguments or just all the arguments separated by comma?
Thanks,

A: I would recommend an object for parameter transfer. In consequence, you can also think about implementing a consistent API for your application:
var _myreq = {
  state: 0, //0 is no error, 4 is error with message, etc.
  message: "", //can include error message (if any)
  data: [0,4,6] //application data for request (String, Array, Object)
};
ipc.send('mychannel-functiona', _myreq);

A: Docs clearly shows that you can pass any number of argument to send.

Send a message to the main process asynchronously via channel, you can
  also send arbitrary arguments. Arguments will be serialized in JSON
  internally and hence no functions or prototype chain will be included.

From that point on you have no restrictions on how to use those arbitrary arguments. It depends on your needs, your codebase style etc.

A: We can pass many arguments for the ipcRenderer, you can refer this page: https://electronjs.org/docs/api/ipc-renderer.


text:
Q: Bluetooth Low Energy on Ubuntu virtualized through VMWare Fusion Pro on Mac I'm trying to do a BLE scan and ultimately use gatttool to debug a BLE device on Ubuntu 16.04 LTS.
I'm virtualizing the Ubuntu image using VMware Pro 8.1.1 on a 2014 retina MacBook Pro. I can confirm that the Bluetooth driver works and supports BLE on the Mac, but I'm having trouble getting a BLE scan to work on Ubuntu.
Output from sudo hcitool lescan:
Set scan parameters failed: Input/output error
I logged more info from sudo hcidump -X while trying the BLE scan:
< HCI Command: LE Set Scan Parameters (0x08|0x000b) plen 7
    type 0x01 (active)
    interval 10.000ms window 10.000ms
    own address: 0x00 (Public) policy: All
> HCI Event: Command Complete (0x0e) plen 4
    LE Set Scan Parameters (0x08|0x000b) ncmd 255
    status 0x01
    Error: Unknown HCI Command

This leads me to believe that the driver does not support BLE. I've tried both Ubuntu 16.04 LTS and 15.10. I've installed the VMware drivers in both cases.
Has anyone gotten BLE working on Ubuntu in VMware before?

A: In case anyone else is facing this, VMWare contacted me and said that they don't support BLE in Linux guests with a Mac host. If you have a Mac host, you can install the Bootcamp drivers and run Windows, but Linux users are out of luck.


text:
Q: iOS application Appstore submission issue which has having custom framework I am facing iOS application submission issue.
In my application using bunch of nested custom frameworks which developed by me.

A: I faced similar kind of problem. In short, I set the "Always Embed Swift Standard Libraries" setting to "No" in my targets. That worked for me.
You can try this
Always Embed Swift Standard Libraries: NO


text:
Q: C# class type as method parameter public class SampleCass{
  public void DoSomething(SampleCass sample){

       //Do method implementation
 }
}

In the above code sample, the method parameter type passed is same as the class to which the method belongs to.
I wanted to know why it is done this way and also some details on it
Thanks in advance

A: This can have may uses. Consider for instance a Number class (dumb):
public class Number {
    private readonly int _n = 0;

    public Number(int n) { _n = n; }

    public Number Add(Number other) {
         return new Number(this._n + other._n);
    }
}

A: That's because that method uses an instance of that class other than its own to do something.
Imagine you have a Contact type and a method that compares it to another contact. You can make this:
public class Contact
{
   public string name;

    public bool Compare(Contact c)
    {
       return this.name.Equals(c.name);
    }
}

A: If I had to guess, I would say it is done this way, because logic inside method uses two instances of the object - one upon which method is called (this), and one passed trough the parameter (sample).
If logic inside method does not use both instances of the object, something might be done wrong.
Hope this helps, for more details we need to see more code.

A: Well, there can be many uses depending upon your problem domain. I can give you another example where you can write fields of same type as of the class.
eg:
public class Node
{
  public Node _next;
}

I know your question is very particular but I thought this example can add value to the current question.

A: (I am giving a constructor example, which will help you in understanding non-constructor methods.)
This can be used to create copy constructor like
public class SampleCass
{
    public int MyInteger { get; set;}

    //Similarly other properties

    public SampleClass(SampleClass tocopyfrom)
    {
            MyInteger = tocopyfropm.MyInteger;
           //Similarly populate other properties
    }
}

can can be called like this
SampleClass copyofsc = new SampleClass(originalsc);


text:
Q: Drupal 7 - Vote up/down module configuration I'm trying to solve a problem with my Drupal website. I installed and configured Vote Up/Down module and now I see, that only me as registred user can vote. Is there any way to let also  anonymous user vote?
Thanks for replies!
FM

A: Did you allowed the usage of the Vote Up/Down widget for Anonymous users under People/Permissions?
The module(s) makes use of the *hook_perm* hook ...
function vud_node_perm() {
    return array('view vote up/down count on nodes', 'use vote up/down on nodes', 'administer vote up/down on nodes', 'see vote up/down node stats');
}


text:
Q: Big war file with Spring starter multi module project I have a big project, consist of several small modules:

*

*core.jar: contains the entities & data jpa repositories, use spring-boot-starter-data-jpa

*api.jar: contains all the rest controller, depends on core.jar and use spring-boot-starter-web

*web.war: the entry point, contains the configuration and convert from executable jar to war by follow the guide: http://spring.io/guides/gs/convert-jar-to-war/
Everything works well, the only issue is the war file very big, about > 300MB at current code base (which is very small, just some controller, few entities). I do some investigation and found out that the core.jar & api.jar contains the dependencies, the web.war also again contains those dependencies includes his own dependencies.
Do we have anyway to build the jar, war without dependencies and let them download the dependencies on first boot on the production machine? or the dependencies package separately, so in the incremental deployment, we do not need to re-upload the whole thing?
Regards,
Update 1:
Q: Do I need core.jar & api.jar to be executable.
A: No, I don't need it, but I also don't want to list down all the difference dependencies which is I can have by include spring-boot-starter-data-jpa or spring-boot-starter-web
All my pom.xml
My core.jar pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.example.project</groupId>
    <artifactId>module-core</artifactId>
    <version>0.0.1-SNAPSHOT</version>

    <name>module-core</name>
    <description>Demo project</description>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>0.5.0.M6</version>
    </parent>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <properties>
        <start-class>com.example.project.tuts.core.Application</start-class>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

    <repositories>
        <repository>
            <id>spring-snapshots</id>
            <name>Spring Snapshots</name>
            <url>http://repo.springsource.org/snapshot</url>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
        <repository>
            <id>spring-milestones</id>
            <name>Spring Milestones</name>
            <url>http://repo.springsource.org/milestone</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
    </repositories>
    <pluginRepositories>
        <pluginRepository>
            <id>spring-snapshots</id>
            <name>Spring Snapshots</name>
            <url>http://repo.springsource.org/snapshot</url>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </pluginRepository>
        <pluginRepository>
            <id>spring-milestones</id>
            <name>Spring Milestones</name>
            <url>http://repo.springsource.org/milestone</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </pluginRepository>
    </pluginRepositories>

</project>

My api.jar pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.example.project</groupId>
    <artifactId>module-api</artifactId>
    <version>0.0.1-SNAPSHOT</version>

    <name>module-api</name>
    <description></description>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>0.5.0.M6</version>
    </parent>

    <dependencies>
        <dependency>
            <groupId>com.example.project</groupId>
            <artifactId>module-core</artifactId>
            <version>0.0.1-SNAPSHOT</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>

    </dependencies>

    <properties>
        <start-class>com.example.project.module.web.Application</start-class>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

    <repositories>
        <repository>
            <id>spring-snapshots</id>
            <name>Spring Snapshots</name>
            <url>http://repo.springsource.org/snapshot</url>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
        <repository>
            <id>spring-milestones</id>
            <name>Spring Milestones</name>
            <url>http://repo.springsource.org/milestone</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
    </repositories>
    <pluginRepositories>
        <pluginRepository>
            <id>spring-snapshots</id>
            <name>Spring Snapshots</name>
            <url>http://repo.springsource.org/snapshot</url>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </pluginRepository>
        <pluginRepository>
            <id>spring-milestones</id>
            <name>Spring Milestones</name>
            <url>http://repo.springsource.org/milestone</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </pluginRepository>
    </pluginRepositories>

</project>

My web.war pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.example.project</groupId>
    <artifactId>project-web</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>war</packaging>

    <name>project-web</name>
    <description>Demo project</description>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>0.5.0.M6</version>
    </parent>

    <dependencies>
         <dependency>
            <groupId>com.example.project</groupId>
            <artifactId>module-api</artifactId>
            <version>0.0.1-SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-orm</artifactId>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-entitymanager</artifactId>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
        </dependency>
        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.tiles</groupId>
            <artifactId>tiles-extras</artifactId>
            <version>2.2.2</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.tomcat.embed</groupId>
            <artifactId>tomcat-embed-jasper</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
        </dependency>

    </dependencies>

    <properties>
        <start-class>com.example.project.Application</start-class>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
                <plugin>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <configuration>
                        <source>1.7</source>
                        <target>1.7</target>
                    </configuration>
                </plugin>
        </plugins>

    </build>

    <repositories>
        <repository>
            <id>spring-snapshots</id>
            <name>Spring Snapshots</name>
            <url>http://repo.springsource.org/snapshot</url>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
        <repository>
            <id>spring-milestones</id>
            <name>Spring Milestones</name>
            <url>http://repo.springsource.org/milestone</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
    </repositories>
    <pluginRepositories>
        <pluginRepository>
            <id>spring-snapshots</id>
            <name>Spring Snapshots</name>
            <url>http://repo.springsource.org/snapshot</url>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </pluginRepository>
        <pluginRepository>
            <id>spring-milestones</id>
            <name>Spring Milestones</name>
            <url>http://repo.springsource.org/milestone</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </pluginRepository>
    </pluginRepositories>

</project>

A: If you build project with Maven you can use dependency scopes
http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_Scope
<dependency>
  <groupId>group-c</groupId>
  <artifactId>artifact-b</artifactId>
  <version>1.0</version>
  <type>war</type>
  <scope>runtime</scope>
</dependency>

and exclusions
<dependency>
  <groupId>group-a</groupId>
  <artifactId>artifact-a</artifactId>
  <version>1.0</version>
  <exclusions>
    <exclusion>
      <groupId>group-c</groupId>
      <artifactId>excluded-artifact</artifactId>
    </exclusion>
  </exclusions>
</dependency>

Thus the war project could exclude dependencies and jar projects could use compile time dependecies.

A: If you don't need the core and api JARs to be executable just remove the spring-boot-maven-plugin from those poms. In an auto-generated pom.xml from the STS IDE you can just remove the whole <build/> section, i.e.
<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>


text:
Q: Expressing hourly temporal recurrence What is the most idiomatic way to put into words a situation where a recurring event happens every hour at a certain minute. For example, consider that some event takes place at the tenth minute of each hour: 0:10AM, 1:10AM, 2:10AM, ...
My first ideas were "every hour at the tenth minute" or "every hour at minute 10". Are these options idiomatic and if not, what would be an idiomatic way of expressing this matter?

A: There are three special cases:

*

*"Every hour [on the hour]" — 12:00, 1:00, etc.

*"Every hour on the half-hour" — 12:30, 1:30, etc.

*"Every hour on the quarter-hour" — 12:15, 1:15, etc.

Any other offset, as @verbose succinctly pointed out, is "Every hour at x [minutes] past the hour."
(Sometimes "at" is substituted for "on", as is "after" for "past".  Anything is square brackets is optional.)

"Nietzsche, with his theory of eternal recurrence. He said that the life we lived we're gonna live over again the exact same way for eternity. Great. That means I'll have to sit through the Ice Capades again."
  ― Woody Allen

A: The standard form is Every hour at x [minutes] past the hour.  Merriam-Webster's example is this:

Trains leave every hour at ten minutes past the hour.

The minutes is optional, and my personal preference is to leave it out.
Since AmE tends to use after rather than past to express time, the following might be preferable depending on your audience:

Trains leave every hour at ten after the hour.

In conversation, one could be quite succinct: Every hour at ten past/after, leaving out the subsequent "the hour", would be transparent to most native speakers.

A: It occurs at 12.10 p.m.and repeats hourly.
Your could add forever, five times or until 4.10 pm, etc..
Reusing wording from a slightly related question.


text:
Q: Ruby Thor based executable with namespaces Is it possible to create a Thor based Ruby executable that accepts namespaces? To allow, for example, the following from the commandline: ./thorfile greet:formal
Given I have the following thorfile:
#!/usr/bin/env ruby

require 'rubygems'
require 'thor'

class TalkTasks < Thor
  namespace       "talk"

  desc      "greet", "says hello"
  def greet
    puts "Hello!"
  end

  class Formal < Thor
    namespace "talk:formal"

    desc    "greet", "says a formal hello"
    def greet
      puts "Good evening!"
    end
  end

end

TalkTasks.start

This thorfile provides the following tasks (thor -T):
thor talk:formal:greet  # says a formal hello
thor talk:greet         # says hello

I can also use thorfile directly as an executable:
./thorfile greet

Which displays:

Hello!

How can I get ./thorfile formal:greet (or something similar) to execute the greet method in the Formal class, in order to display:

Good evening!

A: Change the namespace for Formal class
class Formal < Thor
    namespace "formal"
    ...
end

You have nested the classes so the namespaces nest. If you separate them than you can do talk:formal hehe no time to test it. Should work.


text:
Q: Unable to download PDF created by barryvdh/laravel-snappy The issue I'm having may be implementation but I can't find any consistency between PDFs which download correctly and those which return no response data.
I'm using Laravel v5.4.36 and v0.4.0 of Snappy.
I'm using Angular 5 on the front-end. Any requests for PDFs are setting responseType:3 (Blob). The issue isn't how Angular interprets the data, it's that no data is returned when generating some PDFs.
Here are things I've tried to get something to return when using $pdf->download or $pdf->stream:

*

*The complexity of the PDF HTML doesn't have any bearing. I can try outputting a simple
Hello World
 and I get the same result (nothing) that I would from outputting my multi-page HTML

*If I look at the HTML being generated it all looks fine

*If I try to save() the PDF it is generated correctly and I can view it without issue

*I've tried using both PDF::loadView('pdfs.reminder', compact('transactions', 'globalData')) and \View::make('pdfs.reminder', compact('transactions', 'globalData')) to generate the HTML. That doesn't have any effect.

Here is the code I'm currently using:
private function generatePDF($transactions, $globalData)
{
        $html = \View::make('pdfs.reminder', compact('transactions', 'globalData'))->render();
        $pdf = \PDF::loadHTML($html);

        return $pdf->download('reminder.pdf');
}

It's also worth noting that some PDFs I've tried to generate have worked. But that is a 1/3 success ratio so far. I'm using the same request format and same methods for all 3. No errors are being thrown.
My suspicion was that perhaps it's the size of the generated PDF which is causing the download to fail. However, I don't imagine that being an issue in a PDF that only contains
Hello World
. Are there any limitations in terms of filesize which could cause this behaviour?
Any help with this is appreciated.
Update
The issue wasn't with Snappy it was that the method which called generatePDF didn't return generatePDF's result. Hence why nothing was returned. As that bit of code wasn't in my question it was near impossible for anyone else to help. Thanks to all who tried though.

A: E.g
$date = Carbon::now()->format('j F, Y');
$application = Application::find($id);
$data = ['date'=>$date,'application'=>$application]; // data to be passes to view file
$pdf =  PDF::loadView('pdfs.reminder', $data)->setPaper('a4');
return $pdf->download('reminder.pdf');

Note: Make sure you have use the PDF Class (use PDF;) before the class begins.

A: Do you have <!DOCTYPE html> at the first line?
private function generatePDF($transactions, $globalData){
    $html = \View::make('pdfs.reminder')->render();
    $pdf = \PDF::loadHTML($html);

    return $pdf->stream();
}

pdfs.reminder.blade.php
<!DOCTYPE html>

Hello World


text:
Q: CSS hover chrome does not work correctly I am trying to have the Pinterest style in my page with the use of CSS. It works perfectly in IE10, FF21, Safari5.1.7 and also with the android version of chrome. But it does not work with Chrome28.0.1500.72.
My HTML is the following:

Lorem ipsum dolor sit ame

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut e

    ...

An the CSS the following:
#columns {
-webkit-column-count: 3;
-webkit-column-gap: 10px;
-webkit-column-fill: auto;
-moz-column-count: 3;
-moz-column-gap: 10px;
-moz-column-fill: auto;
column-count: 3;
column-gap: 15px;
column-fill: auto;
}

.pin {
display: inline-block;
background: #FEFEFE;
border: 2px solid #FAFAFA;
box-shadow: 0 1px 2px rgba(34, 25, 25, 0.4);
margin: 0 2px 15px;
-webkit-column-break-inside:avoid;
-moz-column-break-inside:avoid;
-o-column-break-inside:avoid;
-ms-column-break-inside:avoid;
column-break-inside:avoid;
padding: 15px;
padding-bottom: 5px;
background: -webkit-linear-gradient(45deg, #FFF, #F9F9F9);
opacity: 1;
-webkit-transition:all .2s ease;
-o-transition:all .2s ease;
-moz-transition:all .2s ease;
-ms-transition:all .2s ease;
transition:all .2s ease;
}

.pin img {
width: 100%;
border-bottom: 1px solid #ccc;
padding-bottom: 15px;
margin-bottom: 5px;
}

.pin p {
font: 12px/18px Arial, sans-serif;
color: #333;
margin: 0;
}

@media (min-width: 1100px) {
#columns {
    -webkit-column-count: 5;
    -moz-column-count: 5;
    column-count: 5;
}
}

#columns:hover .pin:not(:hover) {
opacity: 0.4;
}

JSFiddle: http://jsfiddle.net/TRYSR/
The problem is that in Chrome when I am hovering a element it works, but when I change to other element this new one starts to blink while I am moving the mouse over it, and if I stop moving the mouse it remains with the 0.4 opacity. But suddenly sometimes in 2 and others in 6 seconds if I stop moving the mouse it works and the element has the 1 opacity.

A: I was able to see a small movement when you would hover over the larger pic box. I changed the animation from all to background and it looked like it was removed for me:
-webkit-transition:background .2s ease;
-o-transition:background .2s ease;
-moz-transition:background .2s ease;
-ms-transition:background .2s ease;
transition:background .2s ease;

http://jsfiddle.net/pertrai1/zKjZw/1/


text:
Q: How do I convert SRID 3857 to decimal degrees? How do I convert SRID 3857 formatted geometery coordinates into to decimal degrees?
My current stack is SQL Server 2014 and C#.

A: You cannot convert them directly in SQL Server.  Quite simply it wasn't built to reinvent the Reprojection of spatial data in one datum to another.  When using SqlGeography, you can of course swap between SRIDs when both sets of coordinates use the same coordinate-type (decimal-degrees or grid-based), however when using SqlGeometry, they are simply planar coordinates based on the scale set by the bounds of the data you have and setting the SRID merely "groups" like-SRID spatial objects.
You'll need a Third-Party library or tool to do this for you.  Geographika notes some options at the following SO Link:
Know of any C# spatial data libraries?

A: See Convert coordinate systems using SQLGeometery
SRID 4326 seems to work well enough.
http://spatialreference.org/ref/epsg/4326/


text:
Q: Moq setup for generic method - cannot be used as type parameter T I'm trying to mock this method.

Task<Response> SendTemplatedEmail<T>(TemplatedEmail<T> templatedEmail, EmailRecipient<T> recipient)
            where T : TemplateData;

This is the closest I've got that makes logical sense to me.
this.mockSender.Setup(x => x.SendTemplatedEmail<It.IsSubtype<TemplateData>>(It.IsAny<It.IsSubtype<TemplateData>>, It.IsAny<It.IsSubtype<TemplateData>>));

But I get the following error:
CS0311: The type TemplatedEmail<Moq.It.Is.IsSubtype<TemplateData>> cannot be used as type parameter 'T' in the generic type or method IEmailSender.SendTemplatedEmail<T> ( TemplatedEmail<T>, EmailRecipient<T>>)' There is no implicit reference conversion from 'TemplateEmail<Moq.It.IsSubtype<TemplateData>> to TemplateData)
Here are the relevant class.
  public class TemplatedEmail<T>
        where T : TemplateData
    { ... }

In plain English, the method takes a templatedEmail parameter of type TemplatedEmail<T> where T is a subclass of TemplateData. It also takes second generic parameter EmailRecipient of the same type T.

A: this.mockSender.Setup(
                x => x.SendTemplatedEmail<IsTemplateData<TemplateData>>(
                    It.IsAny<TemplatedEmail<IsTemplateData<TemplateData>>>(),
                    It.IsAny<EmailRecipient<IsTemplateData<TemplateData>>>()));

From: https://www.damirscorner.com/blog/posts/20200605-MatchingGenericTypeArgumentsWithMoq.html


text:
Q: Why cp and mv behave differently in bash script than command prompt? I have cp and mv commands withaliases preset in my system.
[root@IMSSA ~]# which cp mv
alias cp='cp -i'
        /bin/cp
alias mv='mv -i'
        /bin/mv
[root@IMSSA ~]#

If I try to replace a file, it will ask for prompt when try in command line.
But when I use a same within a script, they won't ask for prompt and just replaces the file.
[root@IMSSA ~]# echo "t giv" > /tmp/givin.txt; echo "r giv" > /root/givin.txt
[root@IMSSA ~]# cat /tmp/givin.txt /root/givin.txt
t giv
r giv
[root@IMSSA ~]# cat /tmp/givi.sh
mv /root/givin.txt /tmp/givin.txt
[root@IMSSA ~]#

[root@IMSSA ~]# mv /root/givin.txt /tmp/givin.txt
mv: overwrite '/tmp/givin.txt'? ^C               ### Used ^C to cancel the Operation.
[root@IMSSA ~]#

[root@IMSSA ~]# sh -x /tmp/givi.sh
+ mv /root/givin.txt /tmp/givin.txt
[root@IMSSA ~]# cat /tmp/givin.txt /root/givin.txt
r giv
cat: /root/givin.txt: No such file or directory
[root@IMSSA ~]#

So the aliases are not used inside the script, but why bash script and command prompt have different env? How does alias work here?
EDIT: This answers the question.
Why doesn't my Bash script recognize aliases?


text:
Q: OpenCart 3 common/header variable in extension I would like to add a variable/display in common/header twig file, which can be managed from an new extension. The new extension is created. starter_module
I added in:
admin/view/template/extension/module/starter_module.twig

        New

        <select name="new" id="input-new" class="form-control">
            {% if new %}
            <option value="1" selected="selected">Enabled</option>
            <option value="0">Disabled</option>
            {% else %}
            <option value="1">Enabled</option>
            <option value="0" selected="selected">Disabled</option>
            {% endif %}
        </select>

in admin/controller/extension/module/starter_module.php
if (isset($this->request->post['new'])) {
  $data['new'] = $this->request->post['new'];
} elseif (!empty($module_info)) {
  $data['new'] = $module_info['new'];
} else {
  $data['new'] = '';
}

in catalog/controller/extension/module/starter_module.php
            $data['new'] = $this->config->get('new');

            $data['new'] = (int) $setting['new'];

in catalog/view/theme/default/template/common/header.twig
{% if new %}Enabled {% else %} disabled{% endif %}

But always I got the result only disabled, what is missing? cannot be sent variable from extension to common header?
Please, help me if you know the issue, the non working files are here https://github.com/bblori/Opencart3
You can see here one of my working variable which was set in setting/setting files and is working.
https://github.com/bblori/Enable-Style-OC3
XML code
<modification>
<name>Starter Module</name>
starter-module
<version>1.0.0</version>
<author>Author</author>
<link>http://domain/</link>
    <file path="catalog/controller/common/header.php">
        <operation>
            <search><![CDATA[return $this->load->view('common/header', $data);]]></search>
            <add position="before"><![CDATA[
                    $data['config_new'] = $this->config->get('config_new');
           ]]></add>
        </operation>
    </file>

Many thanks

A: move your code from your starter module to header.php
$data['new'] = $this->config->get('new');
$data['new'] = (int) $setting['new'];

A: Neither editing core files or using vqmod is acceptable. Core files should not be modified, because later updates would make your modifications obsolete. Vqmod on the other hand adds an unnecessary complexity to a system well designed.
Since version 3 Opencart team have introduced events. Events are a new way of executing custom functionality when it's needed. Next time your have a similar problem add event (either manually or during installation of your module as shown below).
public function install() {
    $this->load->model('setting/event');
    $this->model_setting_event->addEvent('my_data_manager', 'catalog/view/*/before', 'extension/module/my_data_manager/beforeAll');
}

Later during execution cycle your function will be called automatically every time common/header is being rendered.
class ControllerExtensionModuleMyDataManager extends Controller {

    public function beforeAll(&$route, &$data, &$output){
        if ($route == 'common/header') {
            $data['my_custom_data'] = 'Mickey Mouse is not a bird!';
        }
    }
}

Finally, add {{ my_custom_data }} to template/common/header.twig


text:
Q: Access a code behind property in xaml this is my first ever post, so it moght not look all that good, but I'll try my best...
I've been searching the net for this one for some hours now, it might sound silly but I haven't been able to find the answer.
I have Window class, and in the .cs file I have some properties, for example
public ImageSource Obal { get; set; }

Then in the designer I added some Images, buttons, etc. Also set the Window's Name: Name="Somename"
I would like to know how to access that property, so I can, for example, set some image's source property to it, like this:
Image Name="Blah" Source="Obal"
Now I know i can set the Source value through binding:
Source="{Binding ElementName=karta, Path=Obal}"
But do I have to so it like this everytime? All those properties are from the Window class anyway...And Im also asking because I want to change image.Source in Storyboard in Image.Style...and I cant use bindings there...
I hope that I was clear and I thank you all in advance.

A: To access code behind property in XAML file, you need to follow 3 steps:

*

*Refer the namespace in xaml file like:
xmlns:local="clr-namespace:AccessACodeBehindPropertyinXaml"

*Provide a key to the namespace you have referred in Windows.Resources markup. This key will allow to access any class, Property of the referred namespace in your XAML file e.g.
<Window.Resources>
        <local:ImageClass x:Key="imageClass"/>
</Window.Resources>

*Now you just need to bind your control's property in XAML, by using Source & Path properties of Binding class as below:
<Label Content="{Binding Source={StaticResource imageClass}, Path=ImageName}" Name="label1" />

I have written a sample application that binds a class property to a label control. Have a look
MainWindow.xaml.cs file:
namespace AccessACodeBehindPropertyinXaml
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }
    }

    public class ImageClass
    {
        string m_ImageName;

        public ImageClass()
        {
            m_ImageName = "My Image Name";
        }
        public string ImageName
        {
            get
            {
                return m_ImageName;
            }
            set
            {
                m_ImageName = value;
            }
        }
    }
}

MainWindow.xaml
<Window x:Class="AccessACodeBehindPropertyinXaml.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="clr-namespace:AccessACodeBehindPropertyinXaml"
        Title="MainWindow" Height="350" Width="525" Name="ImageWindow">
    <Window.Resources>
        <local:ImageClass x:Key="imageClass"/>
    </Window.Resources>
    <Grid>
        <Label Content="{Binding Source={StaticResource imageClass}, Path=ImageName}" Height="28" HorizontalAlignment="Left" Margin="159,126,0,0" Name="label1" VerticalAlignment="Top" Width="109" />
    </Grid>
</Window>

Please let me know, if you need any more clarification.


text:
Q: How to make sleep a file and use its function from another file in python I have have python file a.py which has a function fun(). fun() uses some libraries and global variables from a.py. The execution of a.py takes a lot of time but the execution of fun() is very fast once the libraries and global variables are ready. So I want to run a.py only once and use this variables and libraries every time I call the function fun() from another file. For example I want to call fun() for every 2 seconds from another file. But I can't do this because a.fun() is taking more time to execute. I want to setup 'a.py' in such way that after importing libraries and executing __main__ it sleeps or stops. After that whenever I am calling a.fun() from outside it should use the libraries already imported and the global variables calculated by __main__.  How to do this in python?

A: You can use the threading module to run the function all 2 seconds regarless of how long the function takes
import a
import threading

while True:
    threading.Thread(target=a.fun).start()
    time.sleep(2)

Keep in mind that this program will only terminate if all Threads are dead.


text:
Q: How to infer this equivalence from the given set of axioms in propositional calculus: Θ→¬Ψ ∨ Φ ⊢ (¬Ψ ∨ Θ →¬Φ ∧ Ψ) → ¬Θ I have an assignment to derive the propositional formula $\Theta\to \neg \Psi \vee \Phi \vdash (\neg \Psi \vee\Theta \to \neg \Phi \wedge \Psi) \to\neg \Theta$ from the system of
axioms and lemmas (previously derived rules from axioms), but I am deadly stuck not knowing what to begin with. I have looked up all the relevant notions to the assignment, but still don't know how to move ahead what steps are due to be done first. Please, enlighten me giving me a push! These are the axioms and rules:
Axiom A1. $\Phi\to\left(\Psi\to\Phi\right)$
Axiom A2. $\left(\Phi\to\Psi\right)\to\left(\left(\Phi\to\left(\Psi\to\Theta\right)\right)\to\left(\Phi\to\Theta\right)\right)$
Axiom A3 $\Phi \wedge \Psi \to \Phi$
Axiom A4. $\Phi \wedge \Psi \to \Psi$
Axiom A5. $\left(\Phi\to\Psi\right)\to\left(\left(\Phi\to\Theta\right)\to\left(\Phi\to\Psi \wedge \Theta\right)\right)$
Axiom A6. $\Phi\to\Phi \vee \Psi$
Axiom A7. $\Psi\to\Phi \vee \Psi$
Axiom A8. $\left(\Phi\to\Theta\right)\to\left(\left(\Psi\to\Theta\right)\to\left(\Phi \vee \Psi\to\Theta\right)\right)$
Axiom A9. $\left.\left(\Phi\to\Psi\right)\to\left(\left(\Phi\to\neg \Psi\right)\to\neg \Phi\right)\right)$
Axiom A10. $\neg\neg \Phi\to\Phi$

Lemma 1. $\vdash \Phi \to \Phi$
Lemma 2 . $\Phi, \Psi \vdash \Phi \wedge \Psi$
Lemma 3. $\Phi\to\Psi \vdash \neg \Psi\to\neg\Phi$
Lemma 4 $\Phi\to\Psi, \Psi\to\Theta \vdash \Phi\to\Theta$
Lemma 5. $\Phi\vdash \neg\neg\Phi$
Lemma 6 . $\Phi \wedge \neg \Phi \vdash \Psi$  ... where $\Psi$ is any formula
The Deduction Theorem may be used!


text:
Q: How can I check if a certain column (using WHERE) exists in MySQL using Python's mysql-connector? So I'd create multiple columns with ids that are not in order and I'd want to check if one of the ids is already in use, for example before doing UPDATE .. SET .. WHERE id = 123; I'd like to be able to check if the column with id=123 already exists or if I'd have to create a new one. I'm using mysql-connector with python 3.8 for this.

A: You are probably looking for the INSERT ... ON DUPLICATE KEY UPDATE statement. Regardless of the programming language or the mysql connector, INSERT ... ON DUPLICATE KEY UPDATE query will try to insert the provided data and if the data exists (based on unique indexes) will update them.


text:
Q: c# mysql , организовать поиск по таблицам базы данных приложение winforms. через textbox нужно организовать поиск по 10 таблицам, поиск одной таблицы возвращает результат, но как сделать поиск через information_schema.tables по всем 10 таблицам, все 10 таблицы имеют одинаковые типы данных, называние полей так же одинаковые, только название таблицы разные. ниже выложил код
private void SearchTextbox_TextChanged(object sender, EventArgs e)
{

    string searchData = SearchTextbox.Text;
    con.Open();
    adapter = new MySqlDataAdapter("SELECT * FROM sta WHERE name LIKE '" + searchData + "%' OR surname LIKE '" + searchData + "%' OR phone LIKE '" + searchData + "%' OR login LIKE '" + searchData + "%' OR dslam LIKE '" + searchData + "%' OR ip LIKE '" + searchData + "%' OR port LIKE'" + searchData + "%'", con);
    dt = new DataTable();
    adapter.Fill(dt);
    dataGridView1.DataSource = dt;
    con.Close();
}

тип данных выглядит следующим образом

A: Есть два варианта решения:

*

*Правильный. Привести в чувство структуру базы, эти 10 таблиц слить в одну и делать запрос к одной таблице

*Как у вас. Занести названия всех таблиц в массив, а потом в цикле сделать запросы к каждой таблице

A: Если нужно вернуть список всех названий таблиц, а затем прогнать их через цикл, то можно сделать это так:

*

*Организуем запрос вида SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES — он вытащит названия всех таблиц;

*Пишем такой код:
List<String> tablesData = new List<String>();
string query = "SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES";
using(SqlCommand command = new SqlCommand(query, con))
{
    using (SqlDataReader reader = command.ExecuteReader())
    {
        while (reader.Read())
        {
            // берём поля из таблицы-кандидата
            string[] fieldNames = Enumerable.Range(0, reader.FieldCount)
                                  .Select(reader.GetName)
                                  .ToArray();
            // требуемые поля в виде строк
            string[] neededfieldNames = { ... };
            if (neededfieldNames.SequenceEqual(fieldNames)) {
                /*
                 если все поля совпадают, то эта одна из 10 таблиц,
                 и мы берём её в список для прогонки скрипта
                */
                tablesData.Add(reader.GetString(0));
            }
        }
    }
}

Он выполнит данный запрос по всей БД, достанет названия таблиц из БД и сложит их в список tablesData.

*Через foreach стучимся к каждой таблице и выполняем необходимые действия:
foreach (var table in tablesData) {
    adapter = new MySqlDataAdapter("SELECT * FROM " + table + " WHERE name LIKE '" + ...);
    // ненужная часть после вызова таблицы убрана, чтобы было удобнее
    // потом идут все дальнейшие действия
}

UPD: Anton Schyrov указал, что могут быть и таблицы, имеющие другую структуру => код может сломаться. Добавил проверку на то, что таблица имеет такие же имена атрибутов, как и одна из 10 требуемых (через SequenceEqual).


text:
Q: Python module needs to write files to a directory but permission is blocked This is my first time writing a python module so I don't know some customs. My module needs to write data and store it somewhere. I decided to do so in some nested folder underneath the location of my modules egg within site-packages.
However, when running the script on a computer after installing it via setup.py,
I'm getting errors when trying to create a directory. I managed to get around creating/reading from files by making all my
open('file.txt', 'r+') # into
open('file.txt', 'r')
# and same respectively for writes.

# os.mkdir() is causing an IOError permissions denied.

But it still won't let me create directories! Via an IOError permissions denied.
NOTE: I'm aware that you can write/read anything from some special dirs, like /tmp, but I'd prefer to do it in the egg.
I feel that this task is a must do also, does anyone have any ideas?

A: Application data should be stored under either %APPDATA%, $XDG_CONFIG_HOME, or ~/.config, depending on the platform. Create a directory for the module within one of those locations. Or better yet, have the application tell you where your data should be located.


text:
Q: Как указать бота в discord-py? Я сделал команду user. Мне нужно сделать так, чтобы когда кто-то писал !user @Мой_Бот, то он выдавал какое-либо сообщение. Как это сделать?

A: Из контекста (ctx) команды получаем объект сообщения - ctx.message. Затем получаем список всех упоминаний из сообщения - ctx.message.mentions.
Проверяем, чтобы атрибут user объекта бота (bot.user) находился в этом списке и выводим соответствующее сообщение:
from discord.ext import commands
import discord

bot = commands.Bot(command_prefix='!', intents=discord.Intents.all())

@bot.command()
async def user(ctx):
    if bot.user in ctx.message.mentions:
        await ctx.send(f'{ctx.author.mention}, вы упомянули меня!')
    else:
        await ctx.send(f'В этом сообщении меня никто не упомянул')

bot.run('TOKEN')


text:
Q: reading date feature in csv file with python I'm quite new in the data analysis area. I'm trying to plot some features based on the date feature. the problem is the date column is not consistent, some are as yyyy, some as dd.mm.yyyy and some mm.yyyy.
something like this:
2.5.2020
2006
3.2012

so as I run my code :
dataframe = dataframe[dataframe['date'].notna()].sort_values('date')
dataframe.set_index('date', inplace=True)
df.groupby('Student_ID')['Freq'].plot(legend=True)

I face:
TypeError: unsupported operand type(s) for /: 'str' and 'int'.

Would you please tell me how I can deal with this inconsistent date feature?


text:
Q: How to log the value of a variable? I am debugging a set of macros. The error seems to come from \vspace*{\dimexpr0.000000cm-\topskip plus 1fill}.
How can I log the value of the length?
I have tried \typeout{\dimexpr0.000000cm-\topskip plus 1fill} but it does not work.

A: \dimexpr accepts only rigid lengths; if you pass it a rubber length parameter, it is coerced to a rigid length by suppressing the stretch and shrink components; so you can say
\dimexpr 0pt - \topskip\relax

which is a complicated way to say -1\topskip. However, plus is illegal in \dimexpr. You want
\vspace*{\glueexpr 0pt plus 1fill - \topskip\relax}

Here is an interactive session, notice the error at plus:
> pdflatex
This is pdfTeX, Version 3.14159265-2.6-1.40.15 (TeX Live 2014) (preloaded format=pdflatex)
 restricted \write18 enabled.
**\relax
entering extended mode
LaTeX2e <2014/05/01>
Babel <3.9l> and hyphenation patterns for 79 languages loaded.

*\showthe\topskip
> 10.0pt.
<*> \showthe\topskip

?

*\showthe\dimexpr0.000000cm-\topskip plus 1fill\relax
> -10.0pt.
<to be read again>
                   p
<*> \showthe\dimexpr0.000000cm-\topskip p
                                         lus 1fill\relax
? 11
<*> ...dimexpr0.000000cm-\topskip plus 1fill\relax

?

*\showthe\glueexpr0pt plus 1fill - \topskip\relax
> -10.0pt plus 1.0fill.
<*> ...the\glueexpr0pt plus 1fill - \topskip\relax

?

*\stop
No pages of output.
Transcript written on texput.log.

If you want to debug such a \vspace non interactively, use something like
\typeout{***This vertical space will be \the\glueexpr0pt plus 1fill - \topskip\relax}

This will write the glue in the .log file.


text:
Q: jQuery: Calculate column totals for sections in table I have the following table:

            MEALS

            02/6

            02/7

            02/8

            02/9

            02/10

            02/11

            02/12

            Total

            CONGREGATE - HEALTHY BALANCE

            <input type="text" style="text-align: center;" size="3" class="sum" id="116|2/6/2011"
            name="116|2/6/2011" value="0" />

            <input type="text" style="text-align: center;" size="3" class="sum" id="116|2/7/2011"
            name="116|2/7/2011" value="18" />

            <input type="text" style="text-align: center;" size="3" class="sum" id="116|2/8/2011"
            name="116|2/8/2011" value="33" />

            <input type="text" style="text-align: center;" size="3" class="sum" id="116|2/9/2011"
            name="116|2/9/2011" value="20" />

            <input type="text" style="text-align: center;" size="3" class="sum" id="116|2/10/2011"
            name="116|2/10/2011" value="0" />

            <input type="text" style="text-align: center;" size="3" class="sum" id="116|2/11/2011"
            name="116|2/11/2011" value="0" />

            <input type="text" style="text-align: center;" size="3" class="sum" id="116|2/12/2011"
            name="116|2/12/2011" value="0" />

            <input type="text" style="text-align: center;" readonly="readonly" size="3" class="total"
            id="116|Total" name="116|Total" value="71" />

            Totals

            <input type="text" style="text-align: center;" size="3" class="totalCategory" id="MEALS|2/6/2011"
            name="MEALS|2/6/2011" value="0" />

            <input type="text" style="text-align: center;" size="3" class="totalCategory" id="MEALS|2/7/2011"
            name="MEALS|2/7/2011" value="18" />

            <input type="text" style="text-align: center;" size="3" class="totalCategory" id="MEALS|2/8/2011"
            name="MEALS|2/8/2011" value="33" />

            <input type="text" style="text-align: center;" size="3" class="totalCategory" id="MEALS|2/9/2011"
            name="MEALS|2/9/2011" value="20" />

            <input type="text" style="text-align: center;" size="3" class="totalCategory" id="MEALS|2/10/2011"
            name="MEALS|2/10/2011" value="0" />

            <input type="text" style="text-align: center;" size="3" class="totalCategory" id="MEALS|2/11/2011"
            name="MEALS|2/11/2011" value="0" />

            <input type="text" style="text-align: center;" size="3" class="totalCategory" id="MEALS|2/12/2011"
            name="MEALS|2/12/2011" value="0" />

            <input type="text" style="text-align: center;" readonly="readonly" size="3" class="total"
            id="MEALS|Total" name="MEALS|Total" value="71" />

            BEVERAGES

            02/6

            02/7

            02/8

            02/9

            02/10

            02/11

            02/12

            Total

            SKIM MILK

            <input type="text" style="text-align: center;" size="3" class="sum" id="67|2/6/2011"
            name="67|2/6/2011" value="0" />

            <input type="text" style="text-align: center;" size="3" class="sum" id="67|2/7/2011"
            name="67|2/7/2011" value="4" />

            <input type="text" style="text-align: center;" size="3" class="sum" id="67|2/8/2011"
            name="67|2/8/2011" value="10" />

            <input type="text" style="text-align: center;" size="3" class="sum" id="67|2/9/2011"
            name="67|2/9/2011" value="5" />

            <input type="text" style="text-align: center;" size="3" class="sum" id="67|2/10/2011"
            name="67|2/10/2011" value="10" />

            <input type="text" style="text-align: center;" size="3" class="sum" id="67|2/11/2011"
            name="67|2/11/2011" value="4" />

            <input type="text" style="text-align: center;" size="3" class="sum" id="67|2/12/2011"
            name="67|2/12/2011" value="0" />

            <input type="text" style="text-align: center;" readonly="readonly" size="3" class="total"
            id="67|Total" name="67|Total" value="33" />

            Totals

            <input type="text" style="text-align: center;" size="3" class="totalCategory" id="BEVERAGES|2/6/2011"
            name="BEVERAGES|2/6/2011" value="0" />

            <input type="text" style="text-align: center;" size="3" class="totalCategory" id="BEVERAGES|2/7/2011"
            name="BEVERAGES|2/7/2011" value="4" />

            <input type="text" style="text-align: center;" size="3" class="totalCategory" id="BEVERAGES|2/8/2011"
            name="BEVERAGES|2/8/2011" value="10" />

            <input type="text" style="text-align: center;" size="3" class="totalCategory" id="BEVERAGES|2/9/2011"
            name="BEVERAGES|2/9/2011" value="5" />

            <input type="text" style="text-align: center;" size="3" class="totalCategory" id="BEVERAGES|2/10/2011"
            name="BEVERAGES|2/10/2011" value="10" />

            <input type="text" style="text-align: center;" size="3" class="totalCategory" id="BEVERAGES|2/11/2011"
            name="BEVERAGES|2/11/2011" value="4" />

            <input type="text" style="text-align: center;" size="3" class="totalCategory" id="BEVERAGES|2/12/2011"
            name="BEVERAGES|2/12/2011" value="0" />

            <input type="text" style="text-align: center;" readonly="readonly" size="3" class="total"
            id="BEVERAGES|Total" name="BEVERAGES|Total" value="33" />

I'd like to be able to sum each column and insert the value into a texbox. I have it working for totals on a row level using the following jQuery:
$('input.sum').change(function () {
            var sum = 0;
            $(this).closest('tr').find('input.sum').each(function (i) {
                var val = parseInt($(this).val(), 10);
                if (isNaN(val) || val === undefined) {
                    return;
                }
                sum += val;
            });
            $(this).closest('tr').find('input.total').val(sum);
        });

Each class for the column textbox totals has a name of totalCategory.
Any help with this on how to calculate the column totals would be greatly appreciated.
=========Edit============================
Ok. I'm working through this from the help below. I've changed my javascript to the following:
$('input.sum').change(function () {
            var sum = 0;
            $(this).closest('tr').find('input.sum').each(function (i) {
                var val = parseInt($(this).val(), 10);
                if (isNaN(val) || val === undefined) {
                    return;
                }
                sum += val;
            });
            $(this).closest('tr').find('input.total').val(sum);

            var tableID = $(this).closest('tr').parents('table').attr('id');
            var columnIndex = $(this).closest('td').attr("cellIndex");
            sumOfColumns(tableID, columnIndex, true);

        });

I've also added a new function:
 function sumOfColumns(tableID, columnIndex, hasHeader) {
        var tot = 0;
        $("#" + tableID + " tr" + (hasHeader ? ":gt(0)" : ""))
          .children("td:nth-child(" + columnIndex + ") input.sum")
          .each(function () {
              tot += parseInt($(this).val());
          });
          alert(tot);
    }

The problem now is that I don't get the correct value from the function sumOfColumns. Am I missing something with the code?
Thanks for the help thus far.
======Solution=========
Here is the solution I came up with:
 function sumOfColumns(tableID, columnIndex, hasHeader) {
        var tot = 0;
        $("#" + tableID + " tr" + (hasHeader ? ":gt(0)" : ""))
          .children("td:nth-child(" + (columnIndex + 1) + ")").find('input.sum')
          .each(function () {
              var val = parseInt($(this).val(), 10);
              if (isNaN(val) || val === undefined) {
                  val = 0;
                  $(this).val(0);
              }
              tot += parseInt(val);
          });

          $("#" + tableID + " tr" + (hasHeader ? ":gt(0)" : "")).children("td:nth-child(" + (columnIndex + 1) + ")").find('input.totalCategory').val(tot);
    }

    $(document).ready(function () {
        $('input.sum').change(function () {
            //Initialize variable to hold the totals
            var sum = 0;
            var grandTotal = 0;

            //Sum the row numbers
            $(this).closest('tr').find('input.sum').each(function (i) {
                var val = parseInt($(this).val(), 10);
                if (isNaN(val) || val === undefined) {
                    return;
                }
                sum += val;
            });

            //Assign the row total to the textbox
            $(this).closest('tr').find('input.total').val(sum);

            //Calculate column totals
            var tableID = $(this).closest('tr').parents('table').attr('id');
            var columnIndex = $(this).closest('td').attr("cellIndex");
            sumOfColumns(tableID, columnIndex, true);

            //Calculate grand totals for the last row
            $("#" + tableID + " tr:last").find('input.totalCategory').each(function (i) {
                var val = parseInt($(this).val(), 10);
                if (isNaN(val) || val === undefined) {
                    return;
                }
                grandTotal += val;
            });

            $("#" + tableID + " tr:last").find('input.grandTotal').val(grandTotal);

        });
    });

Thanks for all the help!

A: Here's my solution. It's not pretty but it works.
 function sumOfColumns(tableID, columnIndex, hasHeader) {
        var tot = 0;
        $("#" + tableID + " tr" + (hasHeader ? ":gt(0)" : ""))
          .children("td:nth-child(" + (columnIndex + 1) + ")").find('input.sum')
          .each(function () {
              var val = parseInt($(this).val(), 10);
              if (isNaN(val) || val === undefined) {
                  val = 0;
                  $(this).val(0);
              }
              tot += parseInt(val);
          });

          $("#" + tableID + " tr" + (hasHeader ? ":gt(0)" : "")).children("td:nth-child(" + (columnIndex + 1) + ")").find('input.totalCategory').val(tot);
    }

    $(document).ready(function () {
        $('input.sum').change(function () {
            //Initialize variable to hold the totals
            var sum = 0;
            var grandTotal = 0;

            //Sum the row numbers
            $(this).closest('tr').find('input.sum').each(function (i) {
                var val = parseInt($(this).val(), 10);
                if (isNaN(val) || val === undefined) {
                    return;
                }
                sum += val;
            });

            //Assign the row total to the textbox
            $(this).closest('tr').find('input.total').val(sum);

            //Calculate column totals
            var tableID = $(this).closest('tr').parents('table').attr('id');
            var columnIndex = $(this).closest('td').attr("cellIndex");
            sumOfColumns(tableID, columnIndex, true);

            //Calculate grand totals for the last row
            $("#" + tableID + " tr:last").find('input.totalCategory').each(function (i) {
                var val = parseInt($(this).val(), 10);
                if (isNaN(val) || val === undefined) {
                    return;
                }
                grandTotal += val;
            });

            $("#" + tableID + " tr:last").find('input.grandTotal').val(grandTotal);

        });
    });

A:  $('input.sum').change(function () {
        var sum = 0;

        var tr = $(this).closest('tr');
        $('td', tr).not('.totalCategory').each(function(){
        var temp = $(this).find('input.sum').val();
            var val = parseInt(temp, 10);
            if (isNaN(val) || val === undefined) {
                return;
            }
            sum += val;
       });
       $(this).closest('tr').find('input.total').val(sum);
    });

A: You can try something like this (based on your exact HTML with an extra row added for the totals):
$('tr:last').find('input').each(function() { // get "total row" inputs
    var pos = $(this).closest('td').prevAll().length; // get current column
    var tot = 0;
    var that = this; // reference to last row total field
    var temp = $(this).closest('tr').prevAll() // In all rows above,
      .find('td:eq(' + pos + ')') // find the same-indexed cell
      .find('input').each(function() { // and the input within
        tot += +$(this).val(); // add to total, ensuring number with unary operator
        $(that).val(tot); // final answer
    });
});

You could have these totals update dynamically by placing something like the above into a function, and attaching that function to the change event of the fields you'd be editing.
Here's a working example: http://jsfiddle.net/redler/J2e7v/1/

A: Another option would be to traverse the table and build the column collections first, then just reference those collections on edit (this is just meant to be a rough idea):
var temp = $('.stripeMe').find('td:first-child').next(); // get the first column
var tempInputs = temp.find('input.sum'); // get the inputs in the first column

while (temp.length > 0 && tempInputs.length > 0) {
    // save the column inputs as "data" attached to each input.
    tempInputs.each(function () { $(this).data("column", tempInputs); });

    temp = temp.next(); // move to next column
    tempInputs = temp.find('input.sum'); // get the inputs for the next column
}

$('input.sum').change(function () {
    var sum = 0;

    // now just add up the values in the column inputs.
    $(this).data("column").each(function () {
        sum += parseInt($(this).val());
    });
    alert(sum);
});


text:
Q: Audio files working in iOS simulator, but can't be found on actual device When I run my app which plays sound in the iOS simulator, it works perfectly. However when I run it on my actual device, the following error appears:

2015-04-20 21:44:00.173 Practical11-1[230:7753] PAEAudioFilePlayer path:/private/var/mobile/Containers/Bundle/Application/D9E12F4A-88F6-41FC-9A0D-A195A56285DF/Practical11-1.app/sounds/rain.aif not found

The code I am using is to get the files is:
// An array of all available sounds
self.filenames = @[@"rain.aif",
                   @"storm.aif",
                   @"seaside.aif",
                   @"fire.aif",
                   @"nighttime.aif",
                   @"whitenoise.aif"];

and then:
 if (index < 0 || index >= self.activeFilenames.count)
    return;

// use the file name at the index to create the path
NSString* bundlePath = [@"sounds"stringByAppendingPathComponent:self.activeFilenames[index]];

Does anybody have any ideas?

A: I've had this issue before when the sound files where saved with a capital letter in my project and referenced in lowercase on my project. i.e:
The file in the project = Rain.aif
The file in the project = rain.aif
The simulator would be able to interpret the resource and find the right one but the device would fail due to case sensitivity.


text:
Q: Users that View pages 5 times I have a number of different product pages and i'm interested in seeing how many users view each product more than 5 times.  I understand I can do this for one of them with a segment and sequence, but I have too many pages that i'm interested in tracking.  Could I do this with a custom metric?  Maybe a calculated metric in analytics or data studio?

A: there's no reasonable way to do that because Google Analytics metrics are reported in an aggregated way and there's no way to introduce some custom conditions like 'if metric X is greater than N for specific user' other than segments.
the only way is to implement custom tracking that would watch for the number of page views for a particular page/product and then send data to analytics when a specific number of page views is reached.


text:
Q: Set with Optional I have this code:
if (myClass != null){
    myClass2.setId(myClass.getId());
    myClass2.setName(myClass.getName());
    myClass2.setPosition(myClass.getPosition());
}

I want to replace this code to this:
Optional.ofNullable(myClass)

and map this field from myClass to myClass2
How i can do it?

A: Did you mean to use:
Optional.ofNullable(myClass)
        .ifPresent(m -> {
            myClass2.setId(m.getId());
            myClass2.setName(m.getName());
            myClass2.setPosition(m.getPosition());
        });

For mapping I would suggest to read about MapStruct, it is a good tool.

A: If you are simply cloning myClass object then you can use map method on optional like this:
public class Test {
    public static void main(String[] args) {
        MyClass mc = new MyClass(1,"abc");

        System.out.println(myClone(Optional.ofNullable(mc)));

        mc = null;
        System.out.println(myClone(Optional.ofNullable(mc)));

    }

    public static Optional<MyClass> myClone(Optional<MyClass> mc) {
        return mc.map(o->new MyClass(o.id(), o.name()));   //<-- do your mapping here
    }
}

record MyClass(int id, String name) {};

Output:
Optional[MyClass[id=1, name=abc]]
Optional.empty

I am using record MyClass for simplicity.
ifPresent method takes Consumer function and map method takes Function funtion.