text:
Q: PHP Large File Uploads (again) Firstly sorry for another of the same (countless iterations of this question I know), but I'm completely stoomped on this one and spent all day looking for answers (along with checking all the previous threads here).
So Im trying to upload large(ish) files through PHP. The script fails at files around 8-10Mb mark (works for files upto 7.5Mb, fails at 10Mb). It just returns an empty file array, ie:
print_r($_FILES)
= array( )

Im running IIS7, using Plesk 10, on a Windows 2008 R2 OS. Heres my form:
<form enctype="multipart/form-data" action="upload.php" method="POST">
  <input type="hidden" name="MAX_FILE_SIZE" value="200000000">
  <input name="Filedata" type="file" />
<input type="submit" value="Upload File" class="button" />
</form>

Some relevant php.ini variables:
max_execution_time: 240
max_input_time: 360
post_max_size: 1600M
upload_max_filesize: 800M
memory_limit 1600M

And my web.config has this in:
<security>
  <requestFiltering>
    <requestLimits maxAllowedContentLength="200000000"/>
  </requestFiltering>
</security>

I know that the php.ini's are being listened to, because php_info() reports them as that (also ini_get('...') reports them as correct as well. As an aside they are the 'local' values, the 'master' ones are lot lower (but am assuming if php_info() reports the local as that then they are the ones being used). I put in some debug code to my script:
echo ini_get('post_max_size') . "
";
echo ini_get('upload_max_filesize') . "
";
echo $_SERVER['CONTENT_LENGTH'] . "
";

That echos out:
1600M
800M
10424520

The last one is the 10Mb (ish) file size in bytes (I am assuming). So my question is, what am I missing here?

A: So I've finally found the answer here, and thought it may help some souls in the future.
It turns out that Plesk, although allowing you to overwrite the 'local' php settings, doesn't actually listen to the change, and the 'Master' values in the php.ini are being listened to, and the local ones aren't.
Theres more info here:
PHP post_max_size local value overridden by master value on Plesk / IIS?
To solve, I changed over the master values by changing the default plesk php.ini's as needed. phpinfo() reported my required post_max_size was now 800M in both local and master, and it worked as needed.


text:
Q: Hi, How to auto execute a php action page on every day at given time, i.e i want to execute a php script at 10:00 am everyday (In windows).? How to auto execute a php action page on every day at given time, i.e i want to execute a php script at 10:00 am everyday (In windows).?
I want to take the given time from the database and the n i want to execute the php script at the specified time taken from the DB

A: You will have to use cronjob if you want to execute specific php script, but if you just want to run a mysql 'job', you could use mysql event feature, which allows you to run mysql jobs at scheduled times.
Discussion which one to use: Cronjob or MySQL event?
Here's the manual: https://dev.mysql.com/doc/refman/5.7/en/events-overview.html
And here is a simple example: https://www.sitepoint.com/how-to-create-mysql-events/
On windows 7 you could setup a Task Scheduler task:

*

*Have Administrator rights

*Start->Control Panel->System and Security->Administrative Tools->Task Scheduler

*Action->Create Basic Task->Type a name and Click Next

*Finish the wizard as you like

redpajama_set_name: RedPajamaStackExchange


text:
Q: Is it possible to create a framework which contains multiple UIViewcontrollers into it? Login Module: Splash, login, registration, forgot password, Menubar
I have 5 different applications on iOS & Android platforms. I have common login and some other modules with common API calls. I have a common design for Login Modules in all 5 applications with only the background colour and application logo changed into it.
Now in android, we can export those modules in .aar files along with UI design and can use them in all 5 projects. This reduces our time and we do not have to copy and paste complete code. I can define/give different images for icons in android from outside of the module as well. In this way, we can show different logos and different applications.
Now I want to perform the same task on the iOS platform as well. So is there any way where I can create login modules once and then attach them to another project?

A: You can extract your shared code into a local Swift Package and use it in any app you want.


text:
Q: Using script to send one sheet in Google sheets not working I am using this code: https://stackoverflow.com/a/45781391/13875010
I only want to send sheet #3 to the email address located in cell A1 on sheet three.
I run the script and nothing happens.
What am I doing wrong?
function sendSheetToPdfwithA1MailAdress(){ // this is the function to call
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var sh = ss.getSheets()[3]; // it will send sheet 0 which is the first sheet in the spreadsheet.
  // if you change the number, change it also in the parameters below
  var shName = sh.getName()
  sendSpreadsheetToPdf(3, shName, sh.getRange('A1').getValue(),"test email with the address in cell A1 ", "This is it !");
}
function sendSpreadsheetToPdf(sheetNumber, pdfName, email,subject, htmlbody) {
  var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
  var spreadsheetId = spreadsheet.getId()
  var sheetId = sheetNumber ? spreadsheet.getSheets()[3].getSheetId() : null;
  var url_base = spreadsheet.getUrl().replace(/edit$/,'');

  var url_ext = 'export?exportFormat=pdf&format=pdf'   //export as pdf

      + (sheetId ? ('&gid=' + sheetId) : ('&id=' + spreadsheetId))
      // following parameters are optional...
      + '&size=A4'      // paper size
      + '&portrait=true'    // orientation, false for landscape
      + '&fitw=true'        // fit to width, false for actual size
      + '&sheetnames=true&printtitle=false&pagenumbers=true'  //hide optional headers and footers
      + '&gridlines=false'  // hide gridlines
      + '&fzr=false';       // do not repeat row headers (frozen rows) on each page

  var options = {
    headers: {
      'Authorization': 'Bearer ' +  ScriptApp.getOAuthToken(),
    }
  }

  var response = UrlFetchApp.fetch(url_base + url_ext, options);
  var blob = response.getBlob().setName(pdfName + '.pdf');
  if (email) {
    var mailOptions = {
      attachments:blob, htmlBody:htmlbody
    }
MailApp.sendEmail(
      email,
      subject+" (" + pdfName +")",
      "html content only",
      mailOptions);

MailApp.sendEmail(
      Session.getActiveUser().getEmail(),
      "FRWD "+subject+" (" + pdfName +")",
      "html content only",
      mailOptions);
  }
}

A: I was using the wrong number...Sheet 3 is number 2.


text:
Q: Biblioteca animate e wow css Pessoal tenho uma img com 2 animações, mas quero que apenas uma seja continua, que aplique a animação varias vezes, assim que iniciar a animação é aplicado o fadeIn com 1.5s de delay e de 3s em 3s aplica o pulse sem parar. Nos parametros que conheço vai aplicar nas duas animações, mas quero que apenas o pulse seja infinito e que a animação ocorra de 3 em 3 segundos.

A: Pela documentação do Animate no GitHub, você pode tentar o seguinte:

OBS: substitua "vendor" com o prefixo aplicável (webkit, moz, etc (por questões de compatibilidade, sugiro fazer com todos))
A parte do fadeIn, eu usaria o jQuery pra, após o carregamento do documento e a execução do fadeIn a classe seja removida:

Testa e vê se funciona, por favor.
============================EDIT 1==================================
Pode ser que o Animate não permita (ou falhe ao tentar) executar duas animações simultaneamente sobre o mesmo elemento (não tenho certeza, nunca testei e não tenho como testar agora rs), porém, pode ser que isso aqui resolva:


text:
Q: Error: Login sessions require session support. Did you forget to use `express-session` middleware? Passport.js is working not sure why using passport.js trying to get my log in to work. not sure why it itsnt working. I am making a chat app so im also using socket.io.
index.js
adding passport for it to work, also usinf crypto to salt passwords
const express = require("express");
const { OPEN_READWRITE } = require("sqlite3");
const router = express.Router();
// const userRouter = require("./user");
const messageRouter = require("./messages");
const cors = require("cors");
const jwt = require("jsonwebtoken");
const { application } = require("express");
const SALT_COUNT = 10;

// added for passport.js to work
const passport = require('passport');
const LocalStrategy = require('passport-local');
const crypto = require('crypto');
const {db} = require("../../db");
// end

passport.use(new LocalStrategy(function verify(username, password, cb) {
  db.get('SELECT * FROM users WHERE username = ?', [ username ], function(err, row) {
    if (err) { return cb(err); }
    if (!row) { return cb(null, false, { message: 'Incorrect username or password.' }); }

    crypto.pbkdf2(password, row.salt, 310000, 32, 'sha256', function(err, hashedPassword) {
      if (err) { return cb(err); }
      if (!crypto.timingSafeEqual(row.hashed_password, hashedPassword)) {
        return cb(null, false, { message: 'Incorrect username or password.' });
      }
      return cb(null, row);
    });
  });
}));

// added for establishing sessions
passport.serializeUser(function(user, cb) {
  process.nextTick(function() {
    cb(null, { id: user.id, username: user.username });
  });
});

passport.deserializeUser(function(user, cb) {
  process.nextTick(function() {
    return cb(null, user);
  });
});
//

login and register routes
router.get('/login', function(req, res, next) {
  res.render(__dirname + '/login.ejs')
});

router.post('/login/password', passport.authenticate('local', {
  successRedirect: '/',
  failureRedirect: '/login',
}));

router.post('/logout', function(req, res, next) {
  req.logout(function(err) {
    if (err) { return next(err); }
    res.redirect('/');
  });
});

router.get('/register', function(req, res, next) {
  res.render(__dirname + '/signup.ejs')
});

// added signup route
router.post('/register', function(req, res, next) {
    var salt = crypto.randomBytes(16);
    crypto.pbkdf2(req.body.password, salt, 310000, 32, 'sha256', function(err, hashedPassword) {
      if (err) { return next(err); }
      db.run('INSERT INTO users (username, hashed_password, salt) VALUES (?, ?, ?)', [
        req.body.username,
        hashedPassword,
        salt
      ], function(err) {
        if (err) { return next(err); }
        var user = {
          id: this.lastID,
          username: req.body.username
        };
        req.login(user, function(err) {
          if (err) { return next(err); }
          res.redirect('/messages/' + req.user.username);
        });
      });
    });
  });

module.exports = router;

app.js
logging the middleware and establishing sessions
require("dotenv").config();
const express = require("express");
const app = express();
const morgan = require("morgan");
const path = require("path");
const cors = require("cors");
const indexRouter = require('./routes/index');
const cookieParser = require("cookie-parser");

// added sessions
const logger = require('morgan');
const passport = require('passport');
const session = require('express-session');

const SQLiteStore = require('connect-sqlite3')(session);

app.use(cors());

// logging middleware
app.use(morgan("dev"));

//
app.use(session({secret : config.secretKey}));

app.use(passport.initialize());

app.use(passport.session());

// added for establishing sessions
app.use(logger('dev'));
app.use(express.json());
app.use(express.urlencoded({ extended: false }));
app.use(cookieParser());
app.use(express.static(path.join(__dirname, 'public')));

app.use(session({
  secret: 'keyboard cat',
  resave: false,
  saveUninitialized: false,
  store: new SQLiteStore({ db: 'sessions.db', dir: './var/db' })
}));
app.use(passport.authenticate('session'));
//

app.get("/", async (req, res) => {
  res.send("hello world");
});

// api router
app.use("/api", require("./routes/index"));

app.use('/', indexRouter);

//testing a get route to api to ensure get will work with middleware when loading up localhost:3000/api
app.get("/api", async (req, res) => {
  res.send("api is running");
});

// 404 handler
app.use((req, res) => {
  res.status(404).send({ error: "404 - Not Found", message: "No route found for the requested URL" });
});

// error handling middleware
app.use((error, req, res, next) => {
  console.error("SERVER ERROR: ", error);
  if (res.statusCode < 400) res.status(500);
  res.send({ error: error.message, name: error.name, message: error.message, table: error.table });
});

module.exports = app;

I want to be able to log in and to have sessions working


text:
Q: UIWebView Crashing on Drop Down We are loading HTML with Select control (Drop Down) in UIWebView and when we click on Drop down, the app is crashing. This is happening only when  text having lengthy text, but works fine with short Text.
When we debugged, we found its an issue with UILabel in UIPopoverController coming from UIWebView. When UILabel has text with 2 lines, this issue is happening, single line its fine. We are unable to identify the issue whether its with Storyboard or Settings...etc.
Any help will be much appreciated.
Here is the Crash
* thread #1: tid = 0x1bd3, 0x034ad930 CoreFoundation`CFArrayGetValueAtIndex + 112, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
frame #0: 0x034ad930 CoreFoundation`CFArrayGetValueAtIndex + 112
frame #1: 0x007d1b41 CoreText`TCharStream::CopyBreakIterator(__CFString const*) + 261
frame #2: 0x007d18f4 CoreText`TCharStream::FindLineBreak(CFRange, bool, __CFString const*) const + 246
frame #3: 0x00758a4a CoreText`TTypesetter::SuggestLineBreak(TLine const&, long, double, double) + 328
frame #4: 0x007586b9 CoreText`CTLineSuggestLineBreakWithOffset + 55
frame #5: 0x0839d89f UIFoundation`__NSStringDrawingEngine + 20275
frame #6: 0x08398940 UIFoundation`-[NSString(NSExtendedStringDrawing) boundingRectWithSize:options:attributes:context:] + 201
frame #7: 0x01b265c1 UIKit`-[UILabel _textRectForBounds:limitedToNumberOfLines:includingShadow:] + 1425
frame #8: 0x01b25e7e UIKit`-[UILabel textRectForBounds:limitedToNumberOfLines:] + 85
frame #9: 0x01d1d0cb UIKit`-[UITableViewCellLayoutManager intrinsicContentSizeForCell:] + 554
frame #10: 0x01c16594 UIKit`-[UITableViewCell sizeThatFits:] + 46
frame #11: 0x02092ade UIKit`-[UIView(UIConstraintBasedLayout) systemLayoutSizeFittingSize:withHorizontalFittingPriority:verticalFittingPriority:] + 130
frame #12: 0x01c01c9f UIKit`-[UITableViewCell systemLayoutSizeFittingSize:withHorizontalFittingPriority:verticalFittingPriority:] + 220
frame #13: 0x01a3f847 UIKit`-[UITableView _heightForCell:atIndexPath:] + 386
frame #14: 0x01a302fb UIKit`__53-[UITableView _configureCellForDisplay:forIndexPath:]_block_invoke + 2244
frame #15: 0x019987af UIKit`+[UIView(Animation) performWithoutAnimation:] + 82
frame #16: 0x019987f8 UIKit`+[UIView(Animation) _performWithoutAnimation:] + 40
frame #17: 0x01a2fa2f UIKit`-[UITableView _configureCellForDisplay:forIndexPath:] + 355
frame #18: 0x01a381da UIKit`-[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 503
frame #19: 0x01a3829e UIKit`-[UITableView _createPreparedCellForGlobalRow:willDisplay:] + 77
frame #20: 0x01a11a6b UIKit`-[UITableView _updateVisibleCellsNow:isRecursive:] + 3034
frame #21: 0x01a2c3d1 UIKit`-[UITableView layoutSubviews] + 222
frame #22: 0x019a1dd1 UIKit`-[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 608
frame #23: 0x02f55771 libobjc.A.dylib`-[NSObject performSelector:withObject:] + 70
frame #24: 0x0061f28f QuartzCore`-[CALayer layoutSublayers] + 152
frame #25: 0x00613115 QuartzCore`CA::Layer::layout_if_needed(CA::Transaction*) + 397
frame #26: 0x00612f70 QuartzCore`CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 26
frame #27: 0x005713c6 QuartzCore`CA::Context::commit_transaction(CA::Transaction*) + 284
frame #28: 0x0057278c QuartzCore`CA::Transaction::commit() + 392
frame #29: 0x00572e58 QuartzCore`CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 92
frame #30: 0x034fa9de CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30
frame #31: 0x034fa920 CoreFoundation`__CFRunLoopDoObservers + 400
frame #32: 0x034f035a CoreFoundation`__CFRunLoopRun + 1226
frame #33: 0x034efbcb CoreFoundation`CFRunLoopRunSpecific + 443
frame #34: 0x034ef9fb CoreFoundation`CFRunLoopRunInMode + 123
frame #35: 0x04d4224f GraphicsServices`GSEventRunModal + 192
frame #36: 0x04d4208c GraphicsServices`GSEventRun + 104
frame #37: 0x019168b6 UIKit`UIApplicationMain + 1526

* frame #38: 0x000f85bd main(argc=1, argv=0xbff5e584) + 141 at main.m:16
    frame #39: 0x04400ac9 libdyld.dylibstart + 1
Thanks,
Vijay

A: This is a duplicate, see my answer here: https://stackoverflow.com/a/26692948/4206060
In short, put this into your web view delegate:
-(void)presentViewController:(UIViewController *)viewControllerToPresent animated:(BOOL)flag completion:(void (^)(void))completion
{
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, NSEC_PER_USEC), dispatch_get_main_queue(),
               ^{
                   [super presentViewController:viewControllerToPresent animated:flag completion:completion];
               });
}

A: This is solved. The issue was because of hardcoding "AppleLanguages" NSDefaults Key to a String. When UIWebview tries to show UILabel it tries to fetch AppleLanguages as Array and crashing.


text:
Q: Resize Polygons, Polylines, Lines in FabricJS without using 'scale' How can I resize polygons or other Fabricjs entities that are "points based" without scaling them?
Scaling increases the strokeWidth of objects and I'd like to override this behavior.
I did it for rectangles this way:
/** Resize instead of scaling example */
this.on({
    'scaling': function(e) {
        var obj = this;
        obj.width = obj.scaleX * obj.width;
        obj.height = obj.scaleY * obj.height;
        obj.scaleX = 1;
        obj.scaleY = 1;
    }
});

An example for an ellipse:
    this.on({
        'scaling': function(e) {
            var obj = this;
            obj.width = obj.scaleX * obj.width;
            obj.height = obj.scaleY * obj.height;
            obj.ry = obj.ry * obj.scaleY;
            obj.rx =  obj.rx * obj.scaleX;
            obj.scaleX = 1;
            obj.scaleY = 1;
        }
    });

My question is different because users can edit manually object properties drawn on canvas.
For example if I draw a polygon and apply a scaleRatio of 2, if I set the strokewidth value at 1, fabric will render a 1*scaleRatio border on my polygon.
That's the reason I'm searching for an override to the scale behavior with a real "redraw" behavior as I did for fabric.Rect or fabric.Ellipse.

A: As of Fabric.js version 2.7.0 there is now a strokeUniform property that when enabled, prevents the stroke width from being affected by the object's scale values.
obj.set('strokeUniform', true);


text:
Q: accessing a class from another activity Have following setup:
MainActivity class - extends activity
MyLayout class - extends View
Prefs class - extends PreferenceActivity and implements OnSharedPreferenceChangeListener
MainActivity creates a MyLayout class and sets it as its contentview. Once the user presses on the menu, Prefs class starts where the user can change some settings.
What I want is that, once the user changes a setting, the overloaded OnsharedPreferenceChanged method in the Prefs class will be called and from there I would like to invoke public methods on the MyLayout class that was created in the MainActivity.
How can I do this?

A: Don't overload onSharedPreferenceChanged method in preferenceactivity. Get an instance of the shared preference in your MainActivity, and then register an onsharedpreferencechangedlistener on that inside of your mainactivity

SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(this);

pref.registerOnSharedPreferenceChangeListener(prefListener);

And then you can create a new preference listener

    OnSharedPreferenceChangeListener prefListener = new OnSharedPreferenceChangeListener() {

        @Override
        public void onSharedPreferenceChanged(
                SharedPreferences sharedPreferences, String key) {
            // Do stuff
        }

    };

You should also unregister the listener in onPause() unless you need it to persist, otherwise unregister it on onStop()

A: Try making MainActivity implement OnSharedPreferenceChangeListener and register it on the onCreate() method as Falmarri said.


text:
Q: RLC bandpass filter transfer function I've been tasked with finding the transfer function of the RLC filter shown below. I converted to the S-domain and used the voltage divider rule to find the output, and came up with:
$$H(s) = \frac{R}{Ls + \frac{1}{sC} + R}$$
I multiplied the numerator/denominator by \$sC\$ which resulted in:
$$H(s) = \frac{RsC}{CLs^2 + RsC + 1}$$
I plugged in the values of R = 220, C = 0.1 µF, and L = 100 mH, then used Octave to generate the transfer function with:
F = tf([220*.1E-6 0],[.1*.1E-6 220*.1E-6 1])

When I do the impulse or step response of the function I get a result of 0. I simulated the circuit in LTspice and approximated the impulse response with a sharp pulse and got something similar to a sinusoid. I know the simulation won't be exactly the same as the theoretical result, but it seems like my transfer function isn't correct.

A: Well, the output voltage when applying an impulse response is:
$$\text{V}_\text{o}\left(t\right)=\int_0^t\delta\left(t-\tau\right)\cdot\mathscr{L}_\text{s}^{-1}\left[\frac{\text{R}}{\text{R}+\text{sL}+\frac{1}{\text{sC}}}\right]_{\left(\tau\right)}\space\text{d}\tau\tag1$$
Using your values:
$$\text{V}_\text{o}\left(t\right)=\int_0^t\delta\left(t-\tau\right)\cdot$$
$$\frac{2200\exp\left(-1100\tau\right)\left(\sqrt{9879}\cos\left(100\sqrt{9879}\tau\right)-11\sin\left(100\sqrt{9879}\tau\right)\right)}{\sqrt{9879}}\space\text{d}\tau\tag1$$

A: Your transfer function is correct. I have not used Octave before, so I can't guess what has gone wrong, but when I use MATLAB with the following code
R = 220;
L = 100*10^(-3);
C = 0.1*10^(-6);
H = tf([R*C,0],[L*C,R*C,1])

H =

          2.2e-05 s
  -------------------------
  1e-08 s^2 + 2.2e-05 s + 1

Continuous-time transfer function.

subplot(1,2,1)
step(H)
subplot(1,2,2)
impulse(H)

I get the following responses: -

But here is a question to you: How can you see from the transfer function, that your step response will be a decaying oscillation? (Hint: Damping ratio)


text:
Q: Electric field inside a dielectric sphere placed in a uniform electric field I am working through Griffith's chapter 4. Example 4.7 describes a situation in which you place a sphere of homogenous linear dielectric material inside a uniform field. You are looking for the field inside the dielectric sphere. The example provides its own solution (using boundary values).
However, I approached the problem in a different way. First, I observed that the free charge density is zero. Thus, the bound charge density is also zero (free charge density is proportional to bound charge density in a homogenous linear dielectric). Thus, all excess charge must be found in the surface charge density.
I then computed the electric field inside the dielectric sphere due to the surface charge density, Pcos(\theta) (where P is polarization). This field has been computed in an earlier exercise in Griffith's and turns out to be -P/(3\epsilon_0) (in the -z direction).
Finally, I thought that the ultimate electric field produced within the dielectric material would simply be the superposition of the uniform field and the field produced by the surface charge density. Thus, I added the fields together. I then substituted P via the constitutive relationship between polarization and total electric field, collected like terms (total electric field) and came to the correct answer.
However, I am thinking that this is a much simpler solution to exercise 4.7. I am thus skeptical of it being a proper analysis (for it it were, wouldn't it be the solution itself?). I was wondering if any of the observations I made in the course of this analysis were improper.

A: The solution presented in Griffiths follows a fully systematic method. At the very end, Griffiths makes the comment that "the field inside the sphere is (surprisingly) uniform".
Now, the sphere is made of a linear dielectric, so the polarization is proportional to the field inside the sphere. In your solution, you seem to have assumed that the sphere has a uniform polarization (allowing you to use the result from Exercise 4.2; btw, I use the 4th edition, and I'm not sure which edition you use since you didn't specify), which is equivalent to assuming that the field inside the sphere is uniform. The problem is that, like Griffiths says, this isn't actually obvious from the start. Sure, the applied field is uniform, but at the beginning, you don't have a way to immediately rule out that the polarization, and the field due to the polarization (or equivalently, due to the bound surface charge) could be non-uniform.
In effect, you made an ansatz: you assumed the form that the solution would take, and then you solved for the constants and showed that your solution is self-consistent. This is a valid solution method, but it's not the kind of fully systematic solution that the text is trying to illustrate.
To make this more precise, observe that inside the sphere, we have:
\begin{align}
E &= E_a + E_i \\
P &= \epsilon_0 \chi_e E \\
  &= \epsilon_0 \chi_e (E_a + E_i)
\end{align}
where $E_a$ is the (linear) applied field, $E_i$ is the part of the field due to the polarization (equivalently, due to the bound surface charge), and $P$ is the polarization.
If you make the assumption that $P$ sources a field inside the sphere that is proportional to itself: that is, $E_i = kP$, then we obtain $P = \epsilon_0 \chi_e (E_a + kP)$, and, by isolating $P$ on one side, we see that it is proportional to $E_a$ (and thus uniform). Finally, we need to check that a uniform $P$ actually does give rise to a uniform $E_i$ according to the laws of electrostatics, validating our initial assumption.
It's just that it wasn't obvious that the assumption was going to lead to the right answer; in general, if you start with some arbitrary polarization $P(x)$ with support in a region $R$ and calculate the field it produces in that region using the bound charge and Coulomb's law, you won't get something that's identically a scalar multiple of $P(x)$ inside $R$.


text:
Q: Plsql Procedure in invalid state I have created following procedure:
 create or replace function getDepartmentById(name varchar2)
  return number
  is v_dep number(10)
  begin
  --the sql statement is totally fine
 select deptno into v_dep from dept where dname = name;
  end;
/

but when I call
 select getDepartmentById('SALES') into dep from dual;

I get this error message
Error report -
ORA-06550: line 20, column 14:
PL/SQL: ORA-06575: Package or function GETDEPARTMENTBYID is in an invalid state
ORA-06550: line 20, column 7:
PL/SQL: SQL Statement ignored

A: You need to add a return value for the function. It goes like this :
CREATE OR replace FUNCTION Getdepartmentbyid(name VARCHAR2)
RETURN NUMBER
IS
  v_dep NUMBER(10);
BEGIN
    --the sql statement is totally fine
    SELECT deptno
    INTO   v_dep
    FROM   dept
    WHERE  dname = name;

    RETURN v_dep;
END;

You can not use a INTO in your select statement. You should call the function like this.
select getDepartmentById('SALES') from dual;


text:
Q: Error in Android Studio - Non-static method cannot be referended from static context I create a simple application on android which is a search engine movies. It uses GSON + Retrofit.
In class FilmApiRequester have error.

Api.getFilmInfo (apikey, filmTitle, pageLimit, callback);
Non-static method 'getFilmInfo (java.lang.String, java.lang.String,
  java.lang.String, retrofit.Callback )' can not
  be referenced from a static context.

I do not know how to solve the problem.
FilmApiRequester.class
public class FilmApiRequeter {

private static String ROOT ="http://example.com";

RestAdapter restAdapter = new RestAdapter.Builder()
        .setEndpoint(ROOT)
        .build();
Api filmRequester = restAdapter.create(Api.class);

private String apikey="ApiKeyExample";

public void getFilms(String filmTitle,String pageLimit, Callback<Film> callback)
{
    Api.getFilmInfo(apikey,filmTitle,pageLimit,callback);
} }

Api.class
public interface Api{

@GET("/movies.json")
public void getFilmInfo(@Query("apikey") String apikey, @Query("q") String filmTitle, @Query("page_limit") String pageLimit, Callback<Film> callback); }

A: Your problem is here :
public void getFilms(String filmTitle,String pageLimit, Callback<Film> callback)
{
    Api.getFilmInfo(apikey,filmTitle,pageLimit,callback);  /// this line
}

You have created your method as :
public interface Api{

@GET("/movies.json")
public void getFilmInfo

Since your method getFilmInfo is a non-static, you cannot call it without an instance. So either make it static or create an instance of a class that implements your interface Api.


text:
Q: Form doesn't get submitted I have started to study Symfony2 since I will probably need in my work.
routing.yml:
account_register:
    path: /register
    defaults: {_controller: AppBundle:Register:index}

RegisterController:
<?php

namespace AppBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use AppBundle\Entity\User;

class RegisterController extends Controller
{
    /**
     * @Route("/register")
     */
    public function indexAction(Request $request)
    {
        $register = new User();

        $form = $this->createFormBuilder($register)
            ->add('email', 'email', array('required' => false))
            ->add('password', 'password', array('required' => false))
            ->add('alias', 'text', array('required' => false))
            ->add('register', 'submit', array('label' => 'Register'))
            ->getForm();

        $form->handleRequest($request);

        if ($form->isValid()) {
            // perform some action, such as saving the task to the database

            $em = $this->getDoctrine()->getManager();
            $em->persist($register);
            $em->flush();

            exit("Error");
            //return $this->redirectToRoute('task_success');
        }

        return $this->render('pages/register.html.twig', array(
            'form' => $form->createView(),
        ));
    }
}

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

{% block body %}

<form>

            {{ form_start(form) }}

            {{ form_errors(form) }}

Email

    {{ form_widget(form.email, {'attr': {'class': 'textfield', 'size': '22', 'maxlength': '100'}}) }}

Password

    {{ form_widget(form.password, {'attr': {'class': 'textfield', 'size': '22', 'maxlength': '100'}}) }}

Alias

   {{ form_widget(form.alias, {'attr': {'class': 'textfield', 'size': '22', 'maxlength': '100'}}) }}

                {{ form_widget(form.register, {'attr': {'class': 'button'}}) }}

            {{ form_end(form) }}
</form>
{% endblock %}

When i press the submit button only the url changes from http://localhost/website/web/app_dev.php/register
to
http://localhost/website/web/app_dev.php/register?form%5Bemail%5D=&form%5Bpassword%5D=&form%5Balias%5D=&form%5Bregister%5D=&form%5B_token%5D=hd70y_KjUEY8v51dQjnjU0ZMTJ0BYOihurV6IcIvghY

A: What is happening is the expected form's flow. The form that you are submitting is redirecting to the same page.

*

*If you don't want your form to be in GET, you can change it for POST :
$form = $this->createFormBuilder($register)
     ->setMethod('POST')
     ->...

When you are redirected after submitting the form, $form->handleRequest($request) binds the request (your data submitted) with the form that is just created. $form->isValid() then checks if your data is valid according to your form.

*

*If you don't see any change after being redirected, you should check if $form->isValid() returns true.

*If you want to redirect your form to another controller method, you should create another resource and then set the action attribute of your form thanks to the setAction() method.
To sum up, everything that I just told you is written and explained on this page, and you definitely should read it ! :-).

A: Silly me, the html was my test code and then i added the symfony {{ blocks }} and forgot to remove the old  tags


text:
Q: Detect change for cells with a specific value Whenever a specific type of cell has it's value changed, I would like to clear the cell below it. Since this value can be any string, I'm searching for it by its label one column to the left and finding all instances through that label using this
Function FindAll(rng As Range, What As Variant, Optional LookIn As XlFindLookIn = xlValues, Optional LookAt As XlLookAt = xlWhole, Optional SearchOrder As XlSearchOrder = xlByColumns, Optional SearchDirection As XlSearchDirection = xlNext, Optional MatchCase As Boolean = False, Optional MatchByte As Boolean = False, Optional SearchFormat As Boolean = False) As Range
    Dim SearchResult As Range
    Dim firstMatch As String
    With rng
        Set SearchResult = .Find(What, , LookIn, LookAt, SearchOrder, SearchDirection, MatchCase, MatchByte, SearchFormat)
        If Not SearchResult Is Nothing Then
            firstMatch = SearchResult.Address
            Do
                If FindAll Is Nothing Then
                    Set FindAll = SearchResult
                Else
                    Set FindAll = Union(FindAll, SearchResult)
                End If
                Set SearchResult = .FindNext(SearchResult)
            Loop While Not SearchResult Is Nothing And SearchResult.Address <> firstMatch
        End If
    End With
End Function

Then I try to add a worksheet_change to all instances like this

Private Sub Worksheet_Change(ByVal Target As Range)

 Dim SearchRange     As Range, SearchResults As Range, rng As Range

    Dim ws              As Worksheet: Set ws = Sheets("SHEET 1")

    Set SearchRange = ws.UsedRange

    Set SearchResults = FindAll(SearchRange, "TESTVALUE")

   If SearchResults Is Nothing Then
        'No match found
    Else
        For Each rng.Offset(1, 0) In SearchResults
             If Not Application.Intersect(rng.Offset(1, 0), Range(Target.Address)) Is Nothing Then

             ' Display a message when one of the designated cells has been
    ' changed.
    ' Place your code here.
            rng.Offset(1, 1).ClearContents
            MsgBox ("A")

            End If
        Next
    End If

End Sub

Nothing happens when I change the cell though including MsgBox
EDIT: Added image for clarification

When the user changes the dropdown for category, the dropdown for subcategory should be cleared.

A: This is an easier way to do it I think:
Private Sub Worksheet_Change(ByVal Target As Range)
    Dim c As Range

    'set some limit for the size of change you want to handle
    If Target.Cells.CountLarge > 100 Then Exit Sub

    On Error GoTo haveError           'to make sure events turned back on
    Application.EnableEvents = False  'don't re-trigger the handler

    For Each c In Target.Cells        'check each cell in the changed range
        If c.Column > 1 Then
            Select Case c.Offset(0, -1).Value
                Case "Select Category:"
                    c.Offset(1, 0).ClearContents
                Case "Select Subcategory:"
                    'something else here...
            End Select
        End If
    Next c

haveError:
    Application.EnableEvents = True
End Sub


text:
Q: harmonic conjugate of a natural log Find the harmonic conjugate of $\ln \sqrt{x^2+y^2}$ on some open nonempty subset of the plane.
Ok I got stuck. So I set the function as $u(x,y)=\ln \sqrt{x^2+y^2}$. So to show that $u_x(x,y)= v_y(x,u)$ I found the derivative of $u_x= \frac{x}{x^2+y^2}$, so that I can write $v_y= \frac{x}{x^2+y^2}$.
Ok so now I'm trying to find $v(x,y)$ but I seem to be getting stuck on the math part here. I know I have to get the integral to get it in terms of y but it doesn't seem to be coming out for me. Integration by parts didn't pan out for me. Please help I would really appreciate it.

A: We can use the identity
$$
\tan(\theta/2)=\frac{\sin(\theta)}{1+\cos(\theta)}
$$
to extend the arctan into quadrants II and III:
$$
\log(x+iy)=\log\left(\sqrt{x^2+y^2}\right)+2i\arctan\left(\frac{y}{x+\sqrt{x^2+y^2}}\right)
$$
This only fails when $x+\sqrt{x^2+y^2}=0$, which is only when $y=0$ and $x\le0$. This corresponds to a branch cut for $\log(z)$.


text:
Q: Outer sum of coordinates I have two arrays:
# A
[[0 3]
 [2 3]
 [3 1]]

# B
[[2  0]
 [0 -1]
 [0  1]
 [1  0]]

The result should be the outer sum coordinate-wise:
[[2 3],[0 2],[0 4],[1 3]], # [0 3] + each element of B
[[4 3],[2 2],[2 4],[3 3]],
[[5 1],[3 0],[3 2],[4 1]]

I managed to solve it with loops, however, the vectorized implementation is needed to work with large matrices. I have approached this with outer sum, but without any success.
for i in A:
    for j in B:
        print(i+j)

A: Simply extend a to 3D keeping the last axis aligned with the last one from b and add them up. This would leverage broadcasting for a vectorized solution. To do the extension to higher dimensions, we can use np.newaxis/None.
Hence, simply do -
a[:,None,:] + b[:, :]

Skipping the redundant last axes specified with :'s, we would be left with -
a[:,None] + b

Schematically put -
a[:,None,:] :   m x 1 x n
b[:,:]      :       k x n
output      :   m x k x n

For large arrays, we can also leverage numexpr that makes uses of multi-cores. To do so, we need to port the earlier listed broadcasting method with few modifications, like so -
import numexpr as ne

ne.evaluate('a3D+b',{'a3D':a[:,None]})

Timings -
In [17]: np.random.seed(0)
    ...: a = np.random.rand(1000,3)
    ...: b = np.random.rand(1000,3)

In [18]: %timeit a[:,None] + b
11 ms ± 92.7 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)

In [19]: %timeit ne.evaluate('a3D+b',{'a3D':a[:,None]})
4.1 ms ± 95.1 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)


text:
Q: Asus P10S-C/4L won't get past Q Code 62 with Intel E3-1220 v6 and 8GB of DDR4 2400 ecc Upon power up, the Asus logo appears on screen and the Q Codes change as it moves through the boot procedure until 62 is reached where it gets stuck and stays until I reset or power off. I have sent an email to Asus but they have not replied and I was wondering if anyone could point me in the right direction? I have looked up the Q Code in the manual and it means SB run time init which I have no clue to what it is about.
Any help would be greatly appreciated

A: Оn the motherboard (Asus P10S-C/4L) there is a sticker with the BIOS version
For example, I have 0506 BIOS version. But Intel Xeon E3-1220 V6 compatible with 3104 BIOS version. I have same problem - q code 62.

*

*Use CPU support table
https://www.asus.com/Commercial-Servers-Workstations/P10S-C-4L/HelpDesk_CPU/

*Install the processor that is compatible for your BIOS version.
For example, I use Celeron G3900

*Then Download Latest BIOS and update CPU MicroCode with ezFlash tool.
Good luck.

A: Q Code 62 usually has to do with GPU issues.  Please ensure the following:

*

*GPU is seated correctly (you may want to pull the card and re-seat it)

*Power cables for the GPU from the power supply are plugged in fully

*If you can get to your BIOS, look in there and make sure the 3.3, 5, and 12v readouts are correct (you want all of the values to be fairly close to the stated numbers).


text:
Q: wrap apart of image by touch in android I want to wrap image by hand like this app
https://play.google.com/store/apps/details?id=hu.tonuzaba.android
but I don't know how to start it. what I need to learn.

A: for you have to learn ANIMATIONs in android.so go through tutorials which you are flexible for you..for your prasent requirement not exatly go throw this link and you can get suitable example with button onely not touch..if you wana tuch effect you have to implement them through clicklineseners..good luck..
http://www.tutorialspoint.com/android/android_animations.htm


text:
Q: Property 'over' does not exist on type 'typeof @stomp/stompjs/index' I am trying to create a chat app using spring websocket and using angular as the frontend. I am importing Stomp and SockJS:
import SockJS from "sockjs-client"
import * as Stomp from "@stomp/stompjs"

And then using it as:
let socket = new SockJS('/ws');
this.stompClient = Stomp.over(socket);

But I'm getting this error at Stomp.over() and I'm not sure why. Has it been deprecated or do I need to install a module?

A: Faced the same issue solved by this.
Instead of importing
import * as Stomp from "@stomp/stompjs"
import {Stomp} alone
import * as SockJS from 'sockjs-client';
import {Stomp} from '@stomp/stompjs';

A: npm install stompjs
import Stomp from "stompjs"
This solved it for me

A: Dharun's  answer work's great for me
check this.
change importing style to
import * as SockJS from 'sockjs-client';
import {Stomp} from '@stomp/stompjs';

A: @stomp/stompjsis a new version, you should do this:
const client = new Client({
          brokerURL: '',//can blank,because use SockJS
          connectHeaders: {"Authorization":xxx},
          debug: function (str) {
            console.log(str)
          },
          reconnectDelay: 5000,
          heartbeatIncoming: 4000,
          heartbeatOutgoing: 4000,
        });
        client.webSocketFactory = function () {
          return new SockJS('/ws');
        };

the doc : Using STOMP with SockJS


text:
Q: Facebook returning cover id as int, turns into float on my machine http://screencast.com/t/XFRuJtLg
Why would they not send this through as a string? My system converts this to a float and then I lose the accuracy of the id because it is rounding poorly.  Am I missing something?

A: If you're having this problem while using json_decode(?) – then just set the option JSON_BIGINT_AS_STRING as 4th parameter in the function call.
http://www.php.net/manual/en/function.json-decode.php

A: It is appearing as a float because you are suffering from integer overflow.
You will need to look into how your development environment handles 64 bit integers.
You might need to specially add a bigint library, if there is not native support.
BCMath is one such library
"If PHP encounters a number beyond the bounds of the integer type, it will be interpreted as a float instead."
http://php.net/manual/en/language.types.integer.php


text:
Q: Is it possible to import jobs in .jar from Talend to Apache Nifi? I'm charged to transfer jobs (extracted in .jar) from Talend to Apache Nifi, but since I have never used any of these tools i'm a bit lost. Found no ressource for this online, but thought someone maybe had this usecase before.
Thanks !
Tried to import .jar by drag n drop, to use Nifi's processor (but didn't find any that match), searched for documentation online with no success


text:
Q: Why is powershell telling me I need .\ before pip I just installed pip, distribute, nose and virtualenv in windows using powershell. For some reason powershell makes me add .\ before pip and nosetests? Does anyone know why?
I read the help in powershell and it talks about the correct path which I think I have. All are installed in Python27/Scripts... same path I'm using in Powershell.
Powershell gives me the "doesnt recognize as cmlet" etc then suggests I should use the .\ before... When I use this it works.
Looked on here and couldn't find the answer so forgive me if this has been asked previously.

A: Unlike the old command shell, PowerShell will not run programs or scripts in the current directory by default.
You should modify your path to include the specific directory or directories that you need to include.
I would advise against adding . to your path (which would make PowerShell behave more similarly to DOS) as this introduces a possible attack vector.


text:
Q: Плавное уменьшение при скролле Задался вопросом: как осуществить данный эффект, который на промежутке 0:0 - 0:6?
https://www.dropbox.com/sh/b2qlzo60aoc97zj/AAAzxfk11cf8IYgTGM8QGnM5a/videos?dl=0&preview=motion.mp4
Буду благодарен за помощь!

A: Обычно в шапку засовывают такой код, как вам понравился. Это анимация при скроле

$(window).scroll(function () {
     var sc = $(window).scrollTop()
    if (sc > 0) {
        $(".box").addClass("small")
    } else {
        $(".box").removeClass("small")
    }
});
    .box {
    height:300px;
    width:300px;
    background-color:red;
    transition: all 1s;
}
.small {

width:150px;
height:150px;
}


text:
Q: T-SQL Select a bunch of data from another DB and Copy to DB2 H all,
Fist of all, thanks for reading this.
My Question is, how can I select a bunch of data from ANOTHER database and insert to my own database with same coloum name and field?
I just can think of is using select from DB1 and then insert into DB2.
I plan to written this process inside a stored procedures.
Is there a better way to do so?
Development enviroment :Sql server 2008 and VS2010(using .net C# to excecute Stored prod)
Thank you, Appreciate its lot.
And Please don't hesitate to voice out my error or mistake.I wish to learn from mistake
LiangCk

A: You can do the following if its the same database server
INSERT INTO [DB].[UserName].[TableName]
Select * from [DB2].[UserName].[TableName]

*

*[DB] is the name of database 1

*[DB2] is the name of database 2

*[UserName] is your sql server username (dbo,....)

*[TableName] is, off course, your table

If you have different sql servers you can connect both servers
using linked server.
http://msdn.microsoft.com/en-us/library/ff772782.aspx


text:
Q: Showing UI Element with Animation on iPhone Is there a way to do the following without an instant hide/unhide? Or do I have to make everything a separate view or something complicated? A simple fade in fade out like the modal transition style is all I'm looking for.
-(IBAction)someMethod
{
    UIButton.hidden = NO;
    tableView.hidden = NO;
}

-(void)viewDidLoad
{
    UIbutton.hidden = YES;
    tableView.hidden = YES;
}

A:    [UIView animateWithDuration:2.0f
                     animations:^ {
UIButton.alpha = 1;
 UIButton.hidden = NO;
tableView.alpha = 1
    tableView.hidden = NO;
                     }];

Do the opposite for hide and change the duration to your need.

A: You could animate the alpha value:
[UIView animateWithDuration:0.5f animations:^{
    button.alpha = 0.0f;
    tableView.alpha = 0.0f;
}];

and it's counterpart
[UIView animateWithDuration:0.5f animations:^{
    button.alpha = 1.0f;
    tableView.alpha = 1.0f;
}];


text:
Q: Is this a way to go to the past? I know that one can time travel to the past through wormholes. But what if I use special relativity for that. I mean, If one has to go to the future, he has to increse his velocity, but what about going to the past. I propose that if we increase the velocity of the surroundings of a system while keeping its velocity constant, should'nt we be able to travel to the past?

A: The proper time, $ \tau $, perceived by an object moving at velocity $ v $ relative to some original system is $ \sqrt{1 - \frac{v^2}{c^2}} t $, where $ c $ is the speed of light and $ t $ is time as measured by the original system (assuming $ t = 0 $ implies $ \tau = 0 $ - in other words, our two objects define the same time to be $ 0 $ - if this weren't the case, we would be off by a constant additive term). Since $ v^2 $ is even under switches of sign in $ v $, changing direction (moving the universe relative to the object as opposed to the object relative to the universe is in effect moving the object in the opposite direction of the universe) will keep the time dilation the same (not negate it).
It's also worth pointing out that classical mechanics is the limiting case of special relativity for slow speeds. Since this obviously isn't true for classical mechanics, it can't be true in relativity for any speeds (including human-scale ones).


text: Q: Jenkins Xcode builds use old changes I'm using Jenkins to pull from a mercurial repository and then build with Xcode. The problem is the ipa file being generated does not include the latest changes from the repro. It looks like it's missing recently added assets from the repo. The most perplexing part is if I actually run the project in the simulator using the local repro everything is fine. If it helps I have the "Clean" option enabled in Jenkins for both mercurial and Xcode.


text:
Q: Rename Pandas column headers using dictionary keys? I want to change the headers of my dataframe based on a dictionary, but I need to reference the columns as lower case.
dict = {'january': 'Jan', 'february': 'Feb', etc.}
df.columns = ['JANUARY','FEBRUARY', etc.]

I know I can do something like this:
df = df.rename(columns=dict)

But this wouldn't work because the columns don't equal the keys. Is there a way to map the dict values to the headers without making a new dict or lower casing all the column headers? Can I map by df.columns.str.lower() somehow?

A: You could use str.lower + map on df.columns to modify it:
dct = {'january':'Jan','february':'Feb', 'march':'Mar', 'april':'Apr'}
df.columns = df.columns.str.lower().map(dct)

For the following DataFrame:
    JANUARY  FEBRUARY  MARCH  APRIL
0         0         0      1      0
1         0         1      1      1

the above code produces:
    Jan  Feb  Mar  Apr
0     0    0    1    0
1     0    1    1    1

A: If I am not wrong, you need to change your header to something like:
jan  feb  mar  apr  may  jun  jul  aug  sep  oct  nov  dec

I mean, not only the value of the dictionary but also all in lowercase.
So, the following approach will help you to get your answer:
import pandas as pd

dic = {'january': 'Jan', 'february': 'Feb', 'march': 'Mar', 'april': 'Apr', 'may': 'May', 'june': 'Jun', 'july': 'Jul',
       'august': 'Aug', 'september': 'Sep', 'october': 'Oct', 'november': 'Nov', 'december': 'Dec'}

data = {'JANUARY': [2, 16, 19, 15],
        'FEBRUARY': [20, 8, 4, 5],
        'MARCH': [1, 2, 4, 11],
        'APRIL': [14, 4, 20, 13],
        'MAY': [6, 4, 13, 1],
        'JUNE': [6, 2, 19, 14],
        'JULY': [17, 8, 13, 19],
        'AUGUST': [0, 8, 9, 15],
        'SEPTEMBER': [6, 3, 3, 18],
        'OCTOBER': [1, 8, 6, 15],
        'NOVEMBER': [18, 20, 8, 3],
        'DECEMBER': [18, 17, 7, 16]}

df = pd.DataFrame.from_dict(data)
print(df)

Result:
   JANUARY  FEBRUARY  MARCH  APRIL  ...  SEPTEMBER  OCTOBER  NOVEMBER  DECEMBER
0        2        20      1     14  ...          6        1        18        18
1       16         8      2      4  ...          3        8        20        17
2       19         4      4     20  ...          3        6         8         7
3       15         5     11     13  ...         18       15         3        16

df.columns = df.columns.str.lower().map(dict((k, v.lower()) for k, v in dic.items()))

print(df)

result:
   jan  feb  mar  apr  may  jun  jul  aug  sep  oct  nov  dec
0    2   20    1   14    6    6   17    0    6    1   18   18
1   16    8    2    4    4    2    8    8    3    8   20   17
2   19    4    4   20   13   19   13    9    3    6    8    7
3   15    5   11   13    1   14   19   15   18   15    3   16


text:
Q: "sallow complexion" In Isaac Asimov's Foundation series, in several places he describes people having a "sallow complexion".
According to Collins dictionary:

Sallow
(esp of human skin) of an unhealthy pale or yellowish colour

Unfortunately I'm not a native English speaker, and from the context I can't decide whether he means a very pale Caucasian or rather an Asian.
Not that it really matters for the comprehension of the story, but at first sight I thought it was a misspelling of shallow and this aroused my curiosity, now I have to find out.

A: Given the author and the era in which he wrote, you should interpret this as meaning "pale Caucasian".

A: A sallow complexion means a yellowish complexion. It also applies to dark complexions like those of a mulatto, a gypsy, and other so designated olive and Mediterranean complexions. I suspect it also applies to the brownish-greenish complexioned Europeans who are usually depicted in Russian and Orthodox paintings of kings, biblical personalities and saints.
The fact that Europeans of the past were not as light-skinned as many of them are today is something that Europe's political and academic establishment choose to gloss over if not deny outright, but then again you see a film in which a mixed race person plays the role of a royal, such as Angel Coulby playing the role Queen Guenevere in King Arthur, or Sophie Okonedo playing the role of Margaret of Anjou in the Hollow Crown. Some of those thespians know better.
Because yellow skin is one of the features of jaundice the word became associated with illness and unhealthy looking skin even if the person was not ill or had jaundice.
Here are some quotes from the online Merriam Webster dictionary on the etymology of the word sallow - Merriam Webster Online Dictionary - Origin and Etymology of sallow

Did You Know?
There is no hint of sickliness in the etymology of sallow. The word
  appears in Old English as salu or salo, and could mean "dusky" or
  "dark" or "grayish greenish yellow." Salu (or salo) is akin to Old
  English sōl ("dark, dirty"), Old High German salo ("murky, dirty
  gray"), Old Norse sölr ("dirty"), and even Sanskrit sāra or
  sāla, which carries the basic meaning of "dirty gray." Sallow, however, has for much of its history been used specifically to
  describe the skin or complexion of one who is unwell.

--

Origin and Etymology of sallow
Middle English salowe, from Old English salu; akin to Old High
  German salo murky, Russian solovyĭ yellowish gray

My own suspicion is that sallow complexions in the yellowish-greenish sense were the mulatto offspring of the people of the paintings described above with "white" people, which is probably why many European royals were described as sallow.
Henry VII, Queen Elizabeth I and her mother Anne Boleyn were described as having sallow complexions.

The effigies of Eleanor of Aquitaine and Henry II at Fontevraud Abbey, France.
Henry's complexion is what would be described as sallow. Eleanor's complexion would be ruddy. Sophie Okonedo playing Margaret of Anjou is not that far of the mark.
The word sallow probably referred to people who in current times would be classified as black and the term carried over the their light-skinned descendants just as today the word black is used to label people showing visible signs of black African ancestry even when they are quite light-skinned, such as Meghan Markle.
Paintings of sallow-complexioned people are usually assumed to be those of pink-skinned white people in which have darkened or deteriorated over time and need to be restored.
A good example of people in the public eye who can be described as sallow or display a sallow cast to the complexions every now and then are Viktor Orban, Maria Vladimirovna and Maria Sharapova.


text:
Q: Why is there no SortedList in .NET? Why is there only a SortedList<TKey, TValue> which looks more like a dictionary, but no SortedList<T> that is actually just a list that is always sorted?
According to the MSDN documentation on SortedList, it is actually internally implemented as a dynamically-sized array of KeyValuePair<TKey, TValue> that is always sorted by the key. Wouldn't the same class be more useful as a list of any type T? Wouldn't that fit the name better, too?

A: There is now :)
public class SortedList<T> : ICollection<T>
{
    private List<T> m_innerList;
    private Comparer<T> m_comparer;

    public SortedList() : this(Comparer<T>.Default)
    {
    }

    public SortedList(Comparer<T> comparer)
    {
        m_innerList = new List<T>();
        m_comparer = comparer;
    }

    public void Add(T item)
    {
        int insertIndex = FindIndexForSortedInsert(m_innerList, m_comparer, item);
        m_innerList.Insert(insertIndex, item);
    }

    public bool Contains(T item)
    {
        return IndexOf(item) != -1;
    }

    /// <summary>
    /// Searches for the specified object and returns the zero-based index of the first occurrence within the entire SortedList<T>
    /// </summary>
    public int IndexOf(T item)
    {
        int insertIndex = FindIndexForSortedInsert(m_innerList, m_comparer, item);
        if (insertIndex == m_innerList.Count)
        {
            return -1;
        }
        if (m_comparer.Compare(item, m_innerList[insertIndex]) == 0)
        {
            int index = insertIndex;
            while (index > 0 && m_comparer.Compare(item, m_innerList[index - 1]) == 0)
            {
                index--;
            }
            return index;
        }
        return -1;
    }

    public bool Remove(T item)
    {
        int index = IndexOf(item);
        if (index >= 0)
        {
            m_innerList.RemoveAt(index);
            return true;
        }
        return false;
    }

    public void RemoveAt(int index)
    {
        m_innerList.RemoveAt(index);
    }

    public void CopyTo(T[] array)
    {
        m_innerList.CopyTo(array);
    }

    public void CopyTo(T[] array, int arrayIndex)
    {
        m_innerList.CopyTo(array, arrayIndex);
    }

    public void Clear()
    {
        m_innerList.Clear();
    }

    public T this[int index]
    {
        get
        {
            return m_innerList[index];
        }
    }

    public IEnumerator<T> GetEnumerator()
    {
        return m_innerList.GetEnumerator();
    }

    IEnumerator IEnumerable.GetEnumerator()
    {
        return m_innerList.GetEnumerator();
    }

    public int Count
    {
        get
        {
            return m_innerList.Count;
        }
    }

    public bool IsReadOnly
    {
        get
        {
            return false;
        }
    }

    public static int FindIndexForSortedInsert(List<T> list, Comparer<T> comparer, T item)
    {
        if (list.Count == 0)
        {
            return 0;
        }

        int lowerIndex = 0;
        int upperIndex = list.Count - 1;
        int comparisonResult;
        while (lowerIndex < upperIndex)
        {
            int middleIndex = (lowerIndex + upperIndex) / 2;
            T middle = list[middleIndex];
            comparisonResult = comparer.Compare(middle, item);
            if (comparisonResult == 0)
            {
                return middleIndex;
            }
            else if (comparisonResult > 0) // middle > item
            {
                upperIndex = middleIndex - 1;
            }
            else // middle < item
            {
                lowerIndex = middleIndex + 1;
            }
        }

        // At this point any entry following 'middle' is greater than 'item',
        // and any entry preceding 'middle' is lesser than 'item'.
        // So we either put 'item' before or after 'middle'.
        comparisonResult = comparer.Compare(list[lowerIndex], item);
        if (comparisonResult < 0) // middle < item
        {
            return lowerIndex + 1;
        }
        else
        {
            return lowerIndex;
        }
    }
}

A: I think the way to go with this problem is to implement an extension method that adds to List<T> in a sorted manner (just 2 lines of code ;), and then List<T> can be used as a sorted list (assuming you avoid using List.Add(...)):
    public static void AddSorted<T>(this List<T> list, T value)
    {
        int x = list.BinarySearch(value);
        list.Insert((x >= 0) ? x : ~x, value);
    }

A: I think the reason is probably just that List<T> already has BinarySearch and Insert, which means implementing your own always-sorted list is trivial.
Not that this means a SortedList<T> class doesn't belong in the framework -- just that it probably wasn't a very high priority since it could easily be written quickly by any developer who needed it.
I think the same was true for HashSet<T>, which didn't originally exist because you could easily use a Dictionary<T, byte> (for example) to simulate one before .NET 3.5.
I know that's what I did in both cases: I had a UniqueSet<T> class and an AlwaysSortedList<T> class, which just wrapped a Dictionary<T, byte> and a List<T> (and used BinarySearch and Insert), respectively.

A: Although nobody can really tell you why there is no SortedList<T>, it is possible to discuss why SortedList takes a key and a value. A dictionary maps keys to values. The typical ways to do this are with a binary tree, a hash table, and a list (array), though hash tables are most common because they are O(1) for most operations.
The primary operation that it doesn't support in O(1) is getting the next key in order. If you want to be able to do that, you typically use a binary tree, giving you a sorted dictionary.
If you decide to implement the map as a list, you would keep the elements sorted by key so that lookup is O(lg n), giving you another sorted dictionary -- in the form of a sorted list. Of course the name SortedDictionary was already taken, but SortedList wasn't. I might have called it SortedListDictionary or SortedDictionaryList, but I didn't get to name it.

A: It is a list with the sorting being done by the key.   I'm just speculating but by providing the ability to specify the key separate from the element, your element doesn't have to be comparable -- only the key need be.  I would imagine that in the general case this saves a fair amount of code being developed to implement IComparable since the key is likely a type that is already comparable.

A: RPM comments is quite valid. Also, with the Linq extensions, you can do sort by any property of T using the Sort extension method. I think that might be the main reasoning behind it.


text:
Q: Duplicate symbols from libm and libstdc++ I am having issues with using Rust and Bindgen with C++ to compile a Rust program that uses C++ libraries.
Compiling for target armv7r-none-eabi using Cargo, on 64 bit Ubuntu 18.04. I've tried using newlib instead of gcc-arm-embedded, but that didn't help, so I switched back.
Here is my build script:
#[allow(non_snake_case)]

extern crate bindgen;

use std::env;
use std::path::PathBuf;

fn main() {
    // Tell cargo to tell rustc to link the v5rt library
    // shared library
    println!("cargo:rustc-link-search=libraries/");
    //println!("cargo:rustc-link-search=/usr/lib/gcc/arm-none-eabi/7.3.1/");
    println!("cargo:rustc-link-search=/usr/arm-none-eabi/lib");
    //println!("cargo:rustc-link-search=/usr/lib/arm-none-eabi/newlib/");

    println!("cargo:rustc-link-lib=static=v5rt");
    println!("cargo:rustc-link-lib=static=stdc++");
    println!("cargo:rustc-link-lib=static=c");
    println!("cargo:rustc-link-lib=static=m");
    //println!("cargo:rustc-link-lib=static=gcc");
    println!("cargo:rustc-link-lib=static=supc++");

    // The bindgen::Builder is the main entry point
    // to bindgen, and lets you build up options for
    // the resulting bindings.
    let bindings = bindgen::Builder::default()

        // The input header we would like to generate
        // bindings for.
        .header("vex/include/v5.h")

        .clang_arg("-I'$(TOOLCHAIN)/$(PLATFORM)/include'")

        .use_core()

        .ctypes_prefix("cty")
        // Finish the builder and generate the bindings.
        .generate()
        // Unwrap the Result and panic on failure.
        .expect("Unable to generate bindings");

    // Write the bindings to the $OUT_DIR/bindings.rs file.
    let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
    bindings
        .write_to_file(out_path.join("bindings.rs"))
        .expect("Couldn't write bindings!");
}

I can't share the contents of v5.h, but it includes some std headers. This should be fine, since the errors make no mention of libv5rt.
The expected result of this is that I end up with a statically linked binary that calls C++ functions from within Rust, but instead, I get the following errors:
warning: unused manifest key: build
   Compiling Monolith v0.1.0 (/home/nottherootaccount/pRust/project)
error: linking with `rust-lld` failed: exit code: 1
  |
  = note: "rust-lld" "-flavor" "gnu" "-L" "/home/nottherootaccount/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/armv7r-none-eabi/lib" "/home/nottherootaccount/pRust/project/target/armv7r-none-eabi/debug/deps/Monolith-1f0e2a190ceafaf5.2g6qot1433lhmu8x.rcgu.o" "-o" "/home/nottherootaccount/pRust/project/target/armv7r-none-eabi/debug/deps/Monolith-1f0e2a190ceafaf5" "--gc-sections" "-L" "/home/nottherootaccount/pRust/project/target/armv7r-none-eabi/debug/deps" "-L" "/home/nottherootaccount/pRust/project/target/debug/deps" "-L" "libraries/" "-L" "/usr/arm-none-eabi/lib" "-L" "/home/nottherootaccount/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/armv7r-none-eabi/lib" "-Bstatic" "--whole-archive" "-lv5rt" "--no-whole-archive" "--whole-archive" "-lstdc++" "--no-whole-archive" "--whole-archive" "-lc" "--no-whole-archive" "--whole-archive" "-lm" "--no-whole-archive" "--whole-archive" "-lsupc++" "--no-whole-archive" "/home/nottherootaccount/pRust/project/target/armv7r-none-eabi/debug/deps/libcty-d94d348a8ecb57da.rlib" "/home/nottherootaccount/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/armv7r-none-eabi/lib/librustc_std_workspace_core-02da144480cd28a7.rlib" "/home/nottherootaccount/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/armv7r-none-eabi/lib/libcore-562f601a6298b539.rlib" "/home/nottherootaccount/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/armv7r-none-eabi/lib/libcompiler_builtins-2aa2db429e3347eb.rlib" "-Bdynamic"
  = note: rust-lld: error: duplicate symbol: __aeabi_atexit
          >>> defined at atexit_arm.cc
          >>>            atexit_arm.o:(__aeabi_atexit) in archive /usr/arm-none-eabi/lib/libstdc++.a
          >>> defined at aeabi_atexit.c
          >>>            lib_a-aeabi_atexit.o:(.text.__aeabi_atexit+0x0) in archive /usr/arm-none-eabi/lib/libc.a

          rust-lld: error: duplicate symbol: acosl
          >>> defined at math_stubs_long_double.cc
          >>>            math_stubs_long_double.o:(acosl) in archive /usr/arm-none-eabi/lib/libstdc++.a
          >>> defined at acosl.c
          >>>            lib_a-acosl.o:(.text.acosl+0x0) in archive /usr/arm-none-eabi/lib/libm.a

          rust-lld: error: duplicate symbol: asinl
          >>> defined at math_stubs_long_double.cc
          >>>            math_stubs_long_double.o:(asinl) in archive /usr/arm-none-eabi/lib/libstdc++.a
          >>> defined at asinl.c
          >>>            lib_a-asinl.o:(.text.asinl+0x0) in archive /usr/arm-none-eabi/lib/libm.a

          rust-lld: error: duplicate symbol: atan2l
          >>> defined at math_stubs_long_double.cc
          >>>            math_stubs_long_double.o:(atan2l) in archive /usr/arm-none-eabi/lib/libstdc++.a
          >>> defined at atan2l.c
          >>>            lib_a-atan2l.o:(.text.atan2l+0x0) in archive /usr/arm-none-eabi/lib/libm.a

          rust-lld: error: duplicate symbol: atanl
          >>> defined at math_stubs_long_double.cc
          >>>            math_stubs_long_double.o:(atanl) in archive /usr/arm-none-eabi/lib/libstdc++.a
          >>> defined at atanl.c
          >>>            lib_a-atanl.o:(.text.atanl+0x0) in archive /usr/arm-none-eabi/lib/libm.a

          rust-lld: error: duplicate symbol: ceill
          >>> defined at math_stubs_long_double.cc
          >>>            math_stubs_long_double.o:(ceill) in archive /usr/arm-none-eabi/lib/libstdc++.a
          >>> defined at ceill.c
          >>>            lib_a-ceill.o:(.text.ceill+0x0) in archive /usr/arm-none-eabi/lib/libm.a

          rust-lld: error: duplicate symbol: coshl
          >>> defined at math_stubs_long_double.cc
          >>>            math_stubs_long_double.o:(coshl) in archive /usr/arm-none-eabi/lib/libstdc++.a
          >>> defined at coshl.c
          >>>            lib_a-coshl.o:(.text.coshl+0x0) in archive /usr/arm-none-eabi/lib/libm.a

          rust-lld: error: duplicate symbol: cosl
          >>> defined at math_stubs_long_double.cc
          >>>            math_stubs_long_double.o:(cosl) in archive /usr/arm-none-eabi/lib/libstdc++.a
          >>> defined at cosl.c
          >>>            lib_a-cosl.o:(.text.cosl+0x0) in archive /usr/arm-none-eabi/lib/libm.a

          rust-lld: error: duplicate symbol: expl
          >>> defined at math_stubs_long_double.cc
          >>>            math_stubs_long_double.o:(expl) in archive /usr/arm-none-eabi/lib/libstdc++.a
          >>> defined at expl.c
          >>>            lib_a-expl.o:(.text.expl+0x0) in archive /usr/arm-none-eabi/lib/libm.a

          rust-lld: error: duplicate symbol: fabsl
          >>> defined at math_stubs_long_double.cc
          >>>            math_stubs_long_double.o:(fabsl) in archive /usr/arm-none-eabi/lib/libstdc++.a
          >>> defined at fabsl.c
          >>>            lib_a-fabsl.o:(.text.fabsl+0x0) in archive /usr/arm-none-eabi/lib/libm.a

          rust-lld: error: duplicate symbol: floorl
          >>> defined at math_stubs_long_double.cc
          >>>            math_stubs_long_double.o:(floorl) in archive /usr/arm-none-eabi/lib/libstdc++.a
          >>> defined at floorl.c
          >>>            lib_a-floorl.o:(.text.floorl+0x0) in archive /usr/arm-none-eabi/lib/libm.a

          rust-lld: error: duplicate symbol: fmodl
          >>> defined at math_stubs_long_double.cc
          >>>            math_stubs_long_double.o:(fmodl) in archive /usr/arm-none-eabi/lib/libstdc++.a
          >>> defined at fmodl.c
          >>>            lib_a-fmodl.o:(.text.fmodl+0x0) in archive /usr/arm-none-eabi/lib/libm.a

          rust-lld: error: duplicate symbol: frexpl
          >>> defined at math_stubs_long_double.cc
          >>>            math_stubs_long_double.o:(frexpl) in archive /usr/arm-none-eabi/lib/libstdc++.a
          >>> defined at frexpl.c
          >>>            lib_a-frexpl.o:(.text.frexpl+0x0) in archive /usr/arm-none-eabi/lib/libm.a

          rust-lld: error: duplicate symbol: hypotl
          >>> defined at math_stubs_long_double.cc
          >>>            math_stubs_long_double.o:(hypotl) in archive /usr/arm-none-eabi/lib/libstdc++.a
          >>> defined at hypotl.c
          >>>            lib_a-hypotl.o:(.text.hypotl+0x0) in archive /usr/arm-none-eabi/lib/libm.a

          rust-lld: error: duplicate symbol: ldexpl
          >>> defined at math_stubs_long_double.cc
          >>>            math_stubs_long_double.o:(ldexpl) in archive /usr/arm-none-eabi/lib/libstdc++.a
          >>> defined at ldexpl.c
          >>>            lib_a-ldexpl.o:(.text.ldexpl+0x0) in archive /usr/arm-none-eabi/lib/libm.a

          rust-lld: error: duplicate symbol: log10l
          >>> defined at math_stubs_long_double.cc
          >>>            math_stubs_long_double.o:(log10l) in archive /usr/arm-none-eabi/lib/libstdc++.a
          >>> defined at log10l.c
          >>>            lib_a-log10l.o:(.text.log10l+0x0) in archive /usr/arm-none-eabi/lib/libm.a

          rust-lld: error: duplicate symbol: logl
          >>> defined at math_stubs_long_double.cc
          >>>            math_stubs_long_double.o:(logl) in archive /usr/arm-none-eabi/lib/libstdc++.a
          >>> defined at logl.c
          >>>            lib_a-logl.o:(.text.logl+0x0) in archive /usr/arm-none-eabi/lib/libm.a

          rust-lld: error: duplicate symbol: modfl
          >>> defined at math_stubs_long_double.cc
          >>>            math_stubs_long_double.o:(modfl) in archive /usr/arm-none-eabi/lib/libstdc++.a
          >>> defined at modfl.c
          >>>            lib_a-modfl.o:(.text.modfl+0x0) in archive /usr/arm-none-eabi/lib/libm.a

          rust-lld: error: duplicate symbol: powl
          >>> defined at math_stubs_long_double.cc
          >>>            math_stubs_long_double.o:(powl) in archive /usr/arm-none-eabi/lib/libstdc++.a
          >>> defined at powl.c
          >>>            lib_a-powl.o:(.text.powl+0x0) in archive /usr/arm-none-eabi/lib/libm.a

          rust-lld: error: duplicate symbol: copysign
          >>> defined at s_copysign.c
          >>>            lib_a-s_copysign.o:(copysign) in archive /usr/arm-none-eabi/lib/libc.a
          >>> defined at s_copysign.c
          >>>            lib_a-s_copysign.o:(.text.copysign+0x0) in archive /usr/arm-none-eabi/lib/libm.a

          rust-lld: error: too many errors emitted, stopping now (use -error-limit=0 to see all errors)

error: aborting due to previous error

error: Could not compile `Monolith`.

To learn more, run the command again with --verbose.


text:
Q: Displaying div based on dropdown value I have 3 divs each with a distinct id. Based off the value of a dropdown I have, I want to show one of the divs. I created my function and call it, but for some reason no change occurs. The new value of the dropdown is never recorded, when I use console.log. I am unsure what is causing the problem and would appreciate any help.
HTML

$15

$30

$45

CSS
#fifteen {
    display: none;
}

#thirty {
    display: none;
}

#fourtyfive {
    display: none;
}

JS
var length = document.getElementById('length');
var chosenLength = length.options[length.selectedIndex].value;

var start = document.getElementById('start').innerHTML.split('.').join('').toLocaleLowerCase();
var end = document.getElementById('end').innerHTML.split('.').join('').toLocaleLowerCase();
var time = document.getElementById('time');

time.disabled = true;

function disabled() {
    if (chosenLength.value != "") {
        time.disabled = false;
    }
}

var slotTimes = [];
document.getElementById("length").onchange = function (evt) {
    var timeDistance = evt.target.value;
    var startMoment = moment(start, "h:mm a");
    var endMoment = moment(end, "h:mm a");
    slotTimes = [];

    while (startMoment.isSameOrBefore(endMoment)) {
        slotTimes.push(startMoment.format("h:mm a"));
        startMoment = startMoment.add(timeDistance, 'minutes');
    }

    addDropdown();
    price();
};

function price(){

    if (chosenLength.value === "") {
        document.getElementById('fifteen').style.display = "none";
        document.getElementById('thirty').style.display = "none";
        document.getElementById('fourtyfive').style.display = "none";
    }
    if (chosenLength.value === "30") {
        document.getElementById('fifteen').style.display = "block";
        document.getElementById('thirty').style.display = "none";
        document.getElementById('fourtyfive').style.display = "none";
    }
    if (chosenLength.value === "60") {
        document.getElementById('fifteen').style.display = "none";
        document.getElementById('thirty').style.display = "block";
        document.getElementById('fourtyfive').style.display = "none";
    }
    if (chosenLength.value === "90") {
        document.getElementById('fifteen').style.display = "none";
        document.getElementById('thirty').style.display = "none";
        document.getElementById('fourtyfive').style.display = "block";
    }
}

function addDropdown() {
    var doc = '',
        times = slotTimes,
        i;
    for (i = 0; i < times.length; i++) {
        doc += "<option value='" + times[i] + "'>" + times[i] + "</option>";
    }

    document.getElementById('time').innerHTML = doc;
    disabled();
}

A: I made a simple working example for you here, so you can adjust your code based on this:
https://codepen.io/brunomont/pen/WmExvV
I had to remove a couple of broken references since your HTML didn't include everything (like the time elements). Also, make sure you have all the dependencies loading (I noticed you are using moment.js).
The changes I made were:

*

*Adding a document.addEventListener("DOMContentLoaded", function() to make sure your HTML was loaded, before you tyr to run the JavaScript.

*Change the way you bind your onChange function to be document.getElementById('length').addEventListener('change', function (evt)
Basically, the addEventListener is more flexible than onChange. You can read more about this change here:
addEventListener vs onclick
Hope it helps :)


text:
Q: Finding out the constant in p.d.f. with given mean? Probability density function
$$f(x)=\alpha\ e^{-x^2-\beta\ x},\ -\infty<x<\infty$$
Also $E(X)=-\frac{1}{2}$
I tried solving it using respective formulas of total probability equal 1 and the formula of expected value of $X$ $i.e.$
$$E(X)=\int_{-\infty}^{\infty}\ xf(x)dx$$
Edit: I am unable to do the integration is there any other way to do that.

A: This is the work I have.
\begin{align*}
E[X]&=\int_{-\infty}^\infty x\cdot \alpha\exp\{-x^2-\beta\ x\}\\
&=\int_{-\infty}^\infty x\cdot \alpha\exp\left\{-\left(x^2+\beta\ x+\frac{\beta^2}{4}-\frac{\beta^2}{4}\right)\right\}\\
&=\int_{-\infty}^\infty x\cdot \alpha\exp\left\{-\left[\left(x+\frac{\beta}{2}\right)^2-\frac{\beta^2}{4}\right]\right\}\\
&=\alpha e^{\beta^2/4}\sqrt{2\pi}(1/\sqrt 2)\int_{-\infty}^\infty x\cdot \frac{1}{\sqrt{2\pi}(1/\sqrt 2)}\exp\left\{-\frac{1}{2}\left(\frac{x+\beta/2}{1/\sqrt 2}\right)^2\right\}\tag 1\\
&=\alpha e^{\beta^2/4}\sqrt{2\pi}(1/\sqrt 2)\left(-\frac{\beta}{2}\right)\\
&=-\frac{1}{2}\alpha\beta\sqrt\pi e^{\beta^2/4}\\
&=-\frac{1}{2}
\end{align*}
where in $(1)$ I recognize that this is the expectation of a random variable with density of a $N(-\beta/2,1/2)$
and
\begin{align*}
\int_{-\infty}^\infty\alpha\ e^{-x^2-\beta\ x}\,dx&=\int_{-\infty}^\infty \alpha\exp\{-x^2-\beta\ x\}\\
&=\int_{-\infty}^\infty \alpha\exp\left\{-\left(x^2+\beta\ x+\frac{\beta^2}{4}-\frac{\beta^2}{4}\right)\right\}\\
&=\int_{-\infty}^\infty \alpha\exp\left\{-\left[\left(x+\frac{\beta}{2}\right)^2-\frac{\beta^2}{4}\right]\right\}\\
&=\alpha e^{\beta^2/4}\sqrt{2\pi}(1/\sqrt 2)\int_{-\infty}^\infty \frac{1}{\sqrt{2\pi}(1/\sqrt 2)}\exp\left\{-\frac{1}{2}\left(\frac{x+\beta/2}{1/\sqrt 2}\right)^2\right\}\tag 2\\
&=\alpha e^{\beta^2/4}\sqrt{2\pi}(1/\sqrt 2)\\
&=\alpha\sqrt{\pi} e^{\beta^2/4}\\
&=1
\end{align*}
where I recognize $(2)$ as the same density above.
It looks like this gives
$$\beta = 1$$
and
$$\alpha = \frac{1}{\sqrt \pi}e^{-1/4}.$$

A: Hint
Consider $$I=\int \alpha\ e^{-x^2-\beta\ x}\,dx$$ First, complete the square $$x^2+\beta x=(x+\frac \beta 2)^2-\frac{\beta^2}4$$ which makes $$I=\alpha \,e^{-\frac{\beta^2}4}\int e^{-(x+\frac \beta 2)^2}\,dx$$ Now, change variable $x+\frac \beta 2=y$ to get $$I=\alpha \,e^{-\frac{\beta^2}4}\int e^{-y^2}\,dy$$ The last integral is quite classical; express it as a function of $y$, go back to $x$ from the definition  and use bounds.
I am sure that you can take it from here.


text:
Q: Separate a paragraph list and give each word individual CSS I have a paragraph with user generated content. The paragraph is a list with words that are separated by comma. So for example "dog, cat, hamster, turtle". I would like this list to be separated so that each word can be assigned its own attributes.
Image example
As i the example above, instead of the list having a shared border and color. I want them to have their own "non-connected" border with spacing between them. Is this possible?

A: Here's one way to do it (though next time try to make some progress on your own) :
DEMO
if this is your html:

dog, cat, hamster, turtle

your js:
function seperateList() {
    var el =  document.getElementById("example");
    var array = el.innerHTML.split(",");

    el.innerHTML = "";
    for (var i =0; i<array.length;i++) {
        var _newa = document.createElement("span");
        var _a = array[i].trim();
            _newa.innerHTML= _a;
            el.appendChild(_newa);
    }
}

seperateList();

css:
#example span { padding:2px 5px; background:#e3e3e3; margin:0 5px; border-radius:6px;}

*

*Note that you could of course pass the element into the function as a parameter..
if you have any questions feel free.. good luck!

A: Yeah Henrik you can add special css to an specific word, use the span tag like:
Color Red

then on you css
.red{color: red;}

and if you want the border just add another class like
.border-red{border: 1px red solid;}
if the content is dinamically created it would be more complex but actually possible,
i hope this works!

A: yes seperate all the word using Indexof and provide individual css


text:
Q: How to make valgrind ignore certain line? for example
==26460== 2 bytes in 1 blocks are still reachable in loss record 2 of 105
==26460==    at 0x4C28BE3: malloc (vg_replace_malloc.c:299)
==26460==    by 0x580D889: strdup (in /usr/lib64/libc-2.17.so)
==26460==    by 0x4F50AF: init (init.c:468)
==26460==    by 0x406D75: main (main.c:825)

I want to not check init.c:468: mode = strdup, i'm sure this only malloc once, and will last whole process life.
Is it possible to make valgrind not check this line?

A: As I said in my comment: I recommend not to.
But Valgrind does have a feature to suppress warnings.
The most convenient way of suppressing a specific message is supported by the feature dedicated to exactly that purpose:
--gen-suppressions=yes

Which apparently will ouptput the precise suppression syntax for each/any generated message.
See 5.1 in the FAQ:
http://valgrind.org/docs/manual/faq.html#faq.writesupp
(I love their style:
"F:Can you write ... for me?" and I expected a totally adequate
"A:No." But they actually answer
"A: Yes ...". Beyond cool.)

A: You should fix the leaks; it is far better to do so.
You can't stop Valgrind checking for the leaks, but you can stop it reporting them by suppressing the leaks.
Use:
valgrind --gen-suppressions=yes --leak-check=all -- tested-program …

You can then save the suppressions in a file, say tp.suppressions, and subsequently you use:
valgrind --suppressions=tp.suppressions -- tested-program …

If you work on a Mac like I do, and work with bleeding edge systems, you'll often find it necessary to suppress leaks from the system startup code — memory that's allocated before main() is called and which you cannot therefore control.
OTOH, it is routine that after the new release of macOS, it takes a while to get Valgrind running again.  I upgraded to macOS High Sierra 10.13; Valgrind has stopped working again because the kernel isn't recognized.


text:
Q: Limit using l'Hopital's rule with logaritmus
What is $\lim_{x\rightarrow0}(1+2\sin x)^\frac{1}{\tan x}$?

Computing $\lim_{x\rightarrow0}\log(1+2\sin x)^\frac{1}{\tan x}=\lim_{x\rightarrow0}\frac{\log(1+2\sin x)}{\tan x}$
Here, where I can use l'Hopital's rule I get:
$\lim_{x\rightarrow0}\frac{\log(1+2\sin x)}{\tan x}=2$
But now my question is:
$\lim_{x\rightarrow0}(1+2\sin x)^\frac{1}{\tan x}$ = $\lim_{x\rightarrow0}\frac{\log(1+2\sin x)}{\tan x}=2$?
I don't think they are the same, but can I remove the log? Maybe it's easier than I think, but now I don't know how to go on.

A: You mean $$\lim_{x\to 0}(1+2\sin x)^{\tfrac{1}{\tan x}}=\exp\lim_{x\to 0}\frac{\ln (1+2\sin x)}{\tan x}=e^2.$$

A: The first equality you write is incorrect. You can evaluate
$$
\lim_{x\to0}\frac{\log(1+2\sin x)}{\tan x}
$$
in order to compute the given limit, but they are not equal; if $l$ is the latter limit, then the one you're looking for is $e^l$.
Now, with l'Hôpital,
$$
\lim_{x\to0}\frac{\log(1+2\sin x)}{\tan x}=
\lim_{x\to0}\frac{\dfrac{2\cos x}{1+2\sin x}}{1+\tan^2x}=2
$$
and therefore
$$
\lim_{x\to0}(1+2\sin x)^{1/\tan x}=e^2
$$

A: As an alternative
$$\large (1+2 \sin x)^\frac{1}{\tan x}=\left[(1+2 \sin x)^{\frac1{2\sin x}}\right]^\frac{2\sin x}{\tan x} \to e^2$$


text:
Q: How to set environmental variables using Ansible I need to set the variables like JAVA_HOME and update PATH.  There are a number of ways of doing this. One way is to update the /etc/environment variable and include a line for JAVA_HOME using the lineinfile module and then run the command source /etc/environment directly on the guest OS (CentOS in my case).
Another way is to execute the export command e.g.
export JAVA_HOME=/usr/java/jre1.8.0_51
export PATH=$PATH:$JAVA_HOME

Is there a cleaner way to do this as all these require manipulating files and running commands directly on the OS to update the environment variables?

A: Yes, there is a cleaner way. You can set environment variables per task:
  tasks:
  - shell: echo JAVA_HOME is $JAVA_HOME
    environment:
      JAVA_HOME: /usr/java/jre1.8.0_51
    register: shellout
  - debug: var=shellout

Output:
TASK: [shell echo JAVA_HOME is $JAVA_HOME] **********************************
changed: [localhost]

TASK: [debug var=shellout] ****************************************************
ok: [localhost] => {
    "var": {
        "shellout": {
            "changed": true,
            "cmd": "echo JAVA_HOME is \"$JAVA_HOME\"",
            "delta": "0:00:00.005797",
            "end": "2015-08-07 06:32:47.295061",
            "invocation": {
                "module_args": "echo JAVA_HOME is \"$JAVA_HOME\"",
                "module_name": "shell"
            },
            "rc": 0,
            "start": "2015-08-07 06:32:47.289264",
            "stderr": "",
            "stdout": "JAVA_HOME is /usr/java/jre1.8.0_51",
            "stdout_lines": [
                "JAVA_HOME is /usr/java/jre1.8.0_51"
            ],
            "warnings": []
        }
    }
}

If you set the environment variable like above in a task, it is only available for this specific task. In subsequent tasks it does not exist unless you define it again.
Though you can define env vars per play as well:
- hosts:
  - localhost
  gather_facts: no
  environment:
    JAVA_HOME: /usr/java/jre1.8.0_51
  tasks:
     ...

Now it's gonna be available for all tasks of this play.
See Setting the Environment and FAQ: How can I set the PATH or any other environment variable for a task or entire playbook? in the docs.

Another example with a script task:
  tasks:
  - script: /tmp/script.sh
    environment:
      JAVA_HOME: /usr/java/jre1.8.0_51
    register: shellout
  - debug: var=shellout

Where the script simply has this content:
#!/bin/sh

echo JAVA_HOME is $JAVA_HOME

A: I found that a workaround to do this was to use the lineinfile command in Ansible:
- name: Set JAVA_HOME
  lineinfile: dest=/etc/environment state=present regexp='^JAVA_HOME' >
     line='JAVA_HOME=/opt/jre1.8.0_51/bin'

While this is not ideal, it allows you to create new environmental variables.  Of course, you should use variables to construct your directory path.  I have included the explicit path to simplify my example.

A: Update to the lineinfile approach.  The JAVA_HOME value should not include the bin directory.  The following worked for centos:
- name: Set JAVA_HOME
  lineinfile:
    dest: /etc/environment
    state: present
    regexp: '^JAVA_HOME'
    line: 'JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk'


text:
Q: What Windows Cache File Stores Taskbar Thumbnail Previews (Image when Hovering Mouse over Taskbar)? I am interested in determining where Windows saves the taskbar previews that it displays when you hover your mouse over an application on the taskbar; for example:

or

I tried using Thumbcache Viewer to view all of the .db files located at this directory: %localappdata%\Microsoft\Windows\Explorer,
but those files only seemed to contain caches for image files (pngs and jpgs), folder previews, or application icons. I was not able to find any of the taskbar previews in any of the files in the following list:

Are they stored in a different location? Or did I just miss them?

A: Since an application can change the taskbar icon. and caption, while running, I don't think Windows caches them. For example, below, note that the icon for MPC-HC changes according to the application state: paused or running.

Because the application continually updates the icon and text, there would not be much point to long-term caching.


text:
Q: What affects the current ratings on constant torque pole changing motors? Two different motors, one is rated 1.49A on slow speed configuration and 1.43A on high speed. The other motor is rated 6.09A on slow speed and 6.99A on high speed.
These are constant torque pole changing motors. I don't understand why one motor has an inverse speed - current relationship and the other one has a proportional current - speed relationship.
What I know is that if you keep a relatively constant voltage/speed ratio your air gap Flux will be constant, meaning your torque will be constant. I just don't understand why the current ratings aren't inverse on both motors

A: With constant torque, the output power will be directly proportional to speed. Therefore you would expect the input power to be proportional to speed. Since the input voltage is constant, you might expect the current to be less with reduced power, but actually the current is relatively constant and the power factor is lower. That is essentially due to the need for the magnetizing flux to remain constant.
There are a lot of variables in motor designs. Two induction motors can have the same voltage, frequency, speed and torque specifications but have significantly different rated current and power factor. There are a number of performance goals in addition to the basic requirement to design a motor with a specific speed and torque rating. Typical goals would include high efficiency, high power factor, low locked-rotor current and high safety margins for operating temperature.
For for economic reasons, manufacturers try to use the same laminations for several motor configurations. To allow interchangeability of motor brands, a limited number of standard motor diameters have been established.
The above factors lead to a lot of anomalies in the detailed performance parameters of motors.


text:
Q: comparing value in array with string I have an array that looks like this:
char test[100]
then I want to compare whether or not this array has this specific sentence
if (test == "yup this is the sentence") {
     // do stuff
}

Is this correct? Is there a better approach to this? Thank you.

A: You cannot do that in C. What you're doing here is checking identity equality (id est if your two pointers point the same memory zone).
What you can do is use libc strstr that does what you want :
#include <string.h>

if (strstr(test, "yup this is the sentence") != NULL)
{
    // do stuff if test contains the sentence
}

Type man 3 strstr in a terminal to get more info about the function, and all its behaviours.
If you want to understand the behaviour of the function, here it is recoded in pure C, with one loop only :
char        *strstr(const char *s1, const char *s2)
{
    int     begin;
    int     current;

    begin = 0;
    current = 0;

    if (!*s2)
        return ((char *)s1);

    while (s1[begin])
    {
        if (s1[begin + current] == s2[current])
            current++;
        else
        {
            current = 0;
            begin++;
        }
        if (!s2[current])
            return ((char *)s1 + begin);
    }
    return (0);
}

It is part from a school project. The full project contains all the C library basic functions.
You can check out some other string manipulation functions here :
https://github.com/kube/libft/tree/master/src/strings

A: You could use strstr:
#include <stdio.h>
#include <stdlib.h>
#include<string.h>

int main(void) {
    char test[256] = "This is a looooooonnnnggggg string which contains ('yup this is the sentence') my needed string inside";

    if (strstr(test, "yup this is the sentence") != NULL){
        printf("True\n");
    }else{
        printf("False\n");
    }
    return 0;
}

or you could use some pointer arithmetic:
#include<stdio.h>
#include<string.h>
#include<stdlib.h>

void checkString(char *string1, char *string2);

int main(void){
    char test[256] = "This is a looooooonnnnggggg string which contains ('yup this is the sentence') my needed string inside";
    char string2[] = "yup this is the sentence";

    checkString(test, string2);
    return 0;
}

void checkString(char *string1, char *string2){
    char *s1, *s2, *s3;

    size_t lenstring1 = strlen(string1);
    size_t lenstring2 = strlen(string2);

    if (lenstring2 < 1){
        printf("There is no substring found");
        exit(1);
    }

    size_t i=0,j=0;
    int found=0;

    s1 = string1;
    s2 = string2;

    for(i = 0; i < lenstring1; i++){
        if(*s1 == *s2){
            s3 = s1;
            for(j = 0;j < lenstring2;j++){
                if(*s3 == *s2){
                  s3++;s2++;
                }else{
                    break;
                }
            }

            s2 = string2;
            if(j == strlen(string2)){
                found = 1;
                printf("%s\nwas found at index : %zu\n",string2,i+1);
              }
          }
        s1++;
    }

    if(found == 0){
        printf("No match Found");
    }
}

Output:
yup this is the sentence
was found at index : 53


text:
Q: Xamarin: avoid lighter effect on iOS navigationBar In my custom NavigationRender, I need an image as background of navigation bar.
I use this line to do that:
    this.NavigationBar.BarTintColor = UIColor.FromPatternImage(UIImage.FromFile("myImmage"));
    this.NavigationBar.Translucent = false;

It works, but image appear lighter than the original one due to a blur efefct added on navigation.
Is there a way to avoid it?


text:
Q: Eclipse plugin detected but not loaded I am writing a plugin that uses the compilationParticipant extension point of the JDT. The plugin isn't working right now and I try to figure out why.
I have one CompilationParticipant:
public class CompParticipant extends CompilationParticipant {

    private static CompParticipant instance = null;
    private CompParticipant() {
        super();
        Activator.log("CompilationParticipant initialized");
    }

   public CompParticipant getSingleton() {
        if (instance == null)
            instance = new CompParticipant();
        return instance;
    }

    @Override
    public void buildStarting(BuildContext[] files, boolean isBatch) {
        Activator.log("Build Starting");
    }
}

And one (not lazy) Activator:
public class Activator extends Plugin implements BundleActivator {

    private static Activator instance;
    public static String PLUGINID = "myplugin";

    public Activator() {
        super();
        log("Activator");
    }

    public static void log(String msg) {
        if (instance == null)
            instance = new Activator();
        instance.getLog().log(new Status(Status.WARNING, PLUGINID, 1, msg, null));
    }

    @Override
    public void start(BundleContext context) throws Exception { log("Start"); }

    @Override
    public void stop(BundleContext context) throws Exception {}

}

In my manifest I specify:
Bundle-Activator: myplugin.Activator

And in my plugin.xml I specify:
<extension point="org.eclipse.jdt.core.compilationParticipant">
  <compilationParticipant class="myplugin.CompParticipant" id="myplugin" createsProblems="true">
  </compilationParticipant>
</extension>

I exported the plugin to an archive and put the contents in the dropins folder. When I start Eclipse I see in the Installation Details > Configuration section *** Plug-in Registry:
myplugin (1.0.0) "My Plugin" [Installed]
However no log messages are printed to the error log (or in the console). Is my logging incorrect or why does my plugin not get run?

A: Re-reading the question, the following looks inconsistent to me:

*

*An activator should not be manually instantiated, but the framework should do that for you.

*For instantiation by the framework, the activator needs a public no-arg constructor.

*

*To support singleton access, an activator typically saves this from within the constructor or start() method.

*To let class loading trigger bundle activation, the bundle should declare Bundle-ActivationPolicy: lazy
When all this is corrected, the builder should be able to instantiate your CompilationParticipant (as read from the extension declaration). This instantiation should then activate your bundle and start the activator.


text:
Q: Undo a git push on github I made a mistake .... and I don't know how to fix it.
I explain the issue.
I was working on my project, and I did a first commit.
In this commit 2 big useless files had been added...
I didn't wanted these files so I did a
git rm file

Then commited again.
And I'm stupid, because I pushed to github hehehe :).
I think you've found out the problem...
How can I remove definitively these files from my local and github repositories (especially github...)
I found some help on the internet, but I don't want to break all my repository.
Thanks

A: If no one else has pulled, you should just get your local branch back to how you want it (probably by either resetting to a previous position, or by doing an interactive rebase to remove the unwanted commit), then push again to github with the -f (force) option:
git push -f <remote-name> <branch-name>

If other people have pulled, the usual advice applies: read the recovering from upstream rebase section of the git-rebase man page to see what you're doing to the others before you do your forced update.

A: If you wanted remove (not revert, remove) last commit with new files, I think you should do:
git reset --soft "HEAD^"

Anyway since you already pushed it to github, you can't remove it without re-creating git repo. This is how it work, you can revert each commit, for example commit where you deleted those 2 big files. Since it's new repo and you are talking about initial commit, re-creating repo looks for me as best idea.


text:
Q: Spark HBase/BigTable - Wide/sparse dataframe persistence I want to persist to BigTable a very wide Spark Dataframe (>100,000 columns) that is sparsely populated (>99% of values are null) while keeping only non-null values (to avoid storage cost).
Is there a way to specify in Spark to ignore nulls when writing?
Thanks !

A: Probably (didn't test it), before writing a Spark DataFrame to HBase/BigTable you can transform it by filtering out columns with null values in each row using custom function, as suggested here for an example using pandas : https://stackoverflow.com/a/59641595/3227693. However there is no built-in connector supporting this feature to my best knowledge.
Alternatively, you can try store data in columnar file formats like Parquet instead, because they are efficiently handle persistence of sparse columnar data (at least in terms of output size in bytes). But to avoid writing many small files (due to sparse nature of the data) which can decrease write throughput, you probably will need to decrease number of output partitions before performing a write (i.e. write more rows per each parquet file: Spark parquet partitioning : Large number of files)