text:
Q: Strange phishing attack? When I login to wachovia/wells fargo/amazon/paypal , no matter the user/pass that I insert, i get a "we need to verify your information" page where they ask me everything, from the atm pin to my ssn to my mom's maiden name (LOL)
Then, when i insert bogus data, they continue to ask more and more personal data, like frequent flyer numbers, verified by visa password, and so on, until i get to a verified by visa authorization page (with right SSL on visa.com!!!) for a sum hidden by a white div.
More data:

*

*The address is right (not www.amazon.com.frtrereeliamdumb.com, but amazon.com WITH THE RIGHT SSL)

*The hosts file is not modified

*the dns is reliable, 8.8.8.8

*amazon.com resolves right

*the ssl is valid

*sniffing traffic does not show anything suspicious

*i have wired internet

*No strange process running

*Opera is unaffected, firefox and ie are affected (so it's not a rogue ff extension)

*I care about security and i run everything in sandboxie, don't have java, have an av (so, how i could get this virus???)

*admin programs like regedit and taskmgr are working and not blocked by this virus

What can be???

A: You, sir, have malware installed on your client computer. This software likely "listens" to the common browser processes (i.e. IE and FF) and intercepts HTTP traffic, appending "frtree...com" to it.
Hard to say exactly what it is or how it got there, but one thing is clear: you need to find a virus scanner that will remove it, or roll your OS.
Edit: it's been my experience that it takes far less time (and less stress of being absolutely sure you removed it) to hose the OS than it does to track down the bugger and kill it.

A: Is it possible your router has been compromised by a virus and is redirecting traffic?

A: You may be infected
Follow the order given below to disinfect your PC
1.) On a PC that is Not infected, Make a boot AV disc then boot from the disc on the Infected PC and scan the hard drive, remove any infections it finds, I prefer the Kaspersky disc myself. The New 2010 Kaspersky disc can update the AV dat files if you are connected to the internet at the time of scan and is suggested to update before the scan.
http://www.techmixer.com/free-bootable-antivirus-rescue-cds-download-list/
2.) Then:
Install free MBAM, run the program and go to the Update tab and update it, then go to the Scanner Tab and do a quick scan, select and remove anything it finds.
http://download.cnet.com/Malwarebytes-Anti-Malware/3000-8022_4-10804572.html
3.) When MBAM is done install SAS free version, run a quick scan, remove what it automatically selects.
http://www.superantispyware.com/download.html
These last 2 are not AV softwares like Norton, they are on demand scanners that only scan for nasties when you run the program and will not interfere with your installed AV, these can be run once a day or week to ensure you are not infected. Be sure you update them before each daily-weekly scan.

A: Double check your network settings. What could have happened is that you've got some malware which is pointing you to a bad Domain Name Server. This means that it looks like you are reaching the correct web addresses even when you are clearly not.
Another way to test this is to try and access known anti malware sites like Malwarebtyes. These are often blocked.
Get the Local Area Connection Properties dialog and select the General tab. Then select the "Internet Protocol (TCP/IP)" line and select "Properties"
In the new dialog on the General tab check whether the DNS server option has been set to "User the following DNS server address". If it has take a note of the IP addresses.
Then go to your ISP and see if they recommended that you set these values. If they don't reset the switch to "Obtain DNS server address automatically". If they do, check that the IP addresses match.
You will still need to run the steps to clean your machine as there is no guarantee that there won't be a process running that keeps this setting pointing to the bad servers.


text:
Q: Unity Firebase transaction error I am using firebase database and I have a weird error with transactions. Basically I have a key called "users" with a parameter count and an userlist like this:
"users" : {
  "count" : 1,
  "userList" : {
    "LBBgLkOp3bWbZeSfnKVsqkHeW8s1" : true
  }
}

I use a transaction to increment the count and add the current user's id to the userList. The problem is that if there isn't a users key (the first time) the transaction completes succesfully but if there is already an users key the transaction fails for no reason...
My code is this
 void AddUserAndIncrementCount()
{
    FirebaseDatabase.DefaultInstance.GetReference("users")
        .RunTransaction(usersData =>
        {
            Dictionary<string, object> users = usersData.Value as Dictionary<string, object>;
            if (users == null)
            { // firstTime
                users = new Dictionary<string, object>();
                users.Add("count", 1);
                users.Add("userList", new Dictionary<string, object>() { { auth.CurrentUser.UserId, true }});
            }
            else
            {
                /* printing users returns this
                    {"count":1,"userList":{"LBBgLkOp3bWbZeSfnKVsqkHeW8s1":true}}
                */
                // INCREMENT COUNT
                users["count"] = int.Parse(users["count"].ToString()) + 1;
                // ADD USER TO LIST
                Dictionary<string, object> userList = users["userList"] as Dictionary<string, object>;
                userList.Add(auth.CurrentUser.UserId, true);
                users["userList"] = userList;
            }
            // END TRANSACTION
            /* printing users returns this now
                {"count":2,"userList":{"LBBgLkOp3bWbZeSfnKVsqkHeW8s1":true,"AM2vI8K106XghEgEgRSkCIpJn0w2":true}}
            */
            usersData.Value = users;
            return TransactionResult.Success(usersData);
        }).ContinueWith(OnAddUserIncrementCountTask);
}

void OnAddUserIncrementCountTask(Task<DataSnapshot> task)
{
    if (task.IsCompleted && !task.IsCanceled && !task.IsFaulted)
    {
       //Success
    }
    else
    {
        Debug.Log(task.IsFaulted+" - "+task.Exception.Message);
        // True - Exception of type 'System.AggregateException' was thrown.
    }
}

As you can see I printed what I was receiving and sending in the transaction and everything seems fine. I tried to set rules to public (read true and write true) and it also failed, so I don't know if I am doing something bad or if there is something wrong with transactions. The things that bothers me is that if the users key doesn't exist in the database then it doesn't fail so I think it is failing for some strange reason I can't see...
I am testing on an Android device.
Thank you.

A: I finally found what was causing the transaction to fail.
It seems there is a bug that makes transactions fail if one of the existing children of the node, or the children of the children, or the value of the node itself is a boolean (true, false).
To solve it I just replaced the true boolean for a "true" string and now all transactions work.
So in my above code I replaced (this appears twice in the code)
auth.CurrentUser.UserId, true

for:
auth.CurrentUser.UserId, "true"

Hope this post saves some time to the next one running to this bug.

redpajama_set_name: RedPajamaStackExchange


text:
Q: UIBezierPath - array of points from path? I have a UIBezierPath.
I wish to get an array of all the points in the path.
Is that possible?
Thanks
Shani

A: Neither UIBezierPath nor CGPath have a method to obtain their points. This makes sense because the paths can be created with methods that are not simple points.
As @daveMac mentions in a comment there is a work-around:
void CGPathApply (
   CGPathRef path,
   void *info,
   CGPathApplierFunction function
);

For each element in the specified path, Quartz calls the applier function, which can examine (but not modify) the element.


text:
Q: Display Power on hours of hard disk from shell Is there a program which can display the power on hours of a hard disk from a *nix shell? I'm rewriting a server benchmark program, and this would be a useful value to compare.

A: smartctl from the smartmontools package can display this information, provided the OS has "raw" access to the device. If you are using a hardware RAID, this information is typically not available without array-specific drivers and userland tools.
I'll leave it as an exercise for the reader to employ standard unix text processing tools to filter out the information you need.


text:
Q: Executing Multiple Queries in Snowsight I'm using the Snowsight query editor.
I have a worksheet as a tile on a dashboard. Is it possible to execute all queries in the worksheet without clicking into the worksheet and highlighting all of the queries?

A: Unfortunately only opening up the tile and highlighting all statements to manually run will work. At this time when you use the dashboard level run button it only runs one query per tile - whichever was the last query ran.
(Confirmed with Snowsight PM)


text:
Q: MySQL - Show Status details for specific connection IDs I would like to check character set details for each of the active connections on a Mysql server.
show full processlist

Will give me each of the connected processes.  And,
status

will give me the details for my own connection.  However, I want to get the "status" of each process, so I can see the character set details for each process.  I haven't been able to find a way to do this.  Can someone please point me in the right direction?

A: Starting with MySQL 5.7, this is instrumented in the performance_schema.
See table performance_schema.status_by_thread
http://dev.mysql.com/doc/refman/5.7/en/performance-schema-status-variable-tables.html


text:
Q: Why do INSERT and DELETE screw up QTableView (Qt, C++, sqlite)? After setting an INSERT or DELETE query on QSqlQueryModel, my QTableView becomes screwed up. For example I hid the ID column by calling view->hideColumn(ID); but after an INSERT or DELETE the ID column becomes visible.
How can I automatically reset my view to the previous settings in these cases?

A: I guess the problem is in QSqlQueryModel::setQuery you're eventually calling every time content gets reloaded and rows inserts\deletes. Looking at the setQuery implementation I would suggest: depending on the query your model can be reset including columns settings change which should trigger view columns update.
As Qt documentation suggests:

The QSqlQueryModel class provides a
  read-only data model for SQL result
  sets.

so I would use direct QSqlQuery calls for the data updates and then would reload the model with the same query. Or consider switching to QSQLTableModel, which is quite handy for single table content manipulation and supports inserts updates and deletes. See if an example below would work for you:
set up database, view and model:
QSqlTableModel *_model;
QTableView *_view;

...
QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
db.setDatabaseName(":memory:");
db.open() ;

QSqlQuery query;
query.prepare("CREATE TABLE IF NOT EXISTS person (id INTEGER UNIQUE PRIMARY KEY, name VARCHAR(30))");
query.exec();
query.prepare("INSERT INTO person (name) VALUES ('test1')");
query.exec();
query.prepare("INSERT INTO person (name) VALUES ('test2')");
query.exec();

_model = new QSqlTableModel(this, db);
_model->setTable("person");
_model->setEditStrategy(QSqlTableModel::OnManualSubmit);
_model->select();
_model->setHeaderData(1, Qt::Horizontal, tr("name"));
_model->setSort(1, Qt::AscendingOrder);

_view = new QTableView(this);
_view->setModel(_model);
_view->hideColumn(0);

add new row:
QSqlRecord record;
_model->insertRecord(-1, record);

delete selected row(s):
QModelIndexList selected = _view->selectionModel()->selectedIndexes();
for (int i = 0; i < selected.size(); ++i)
    _model->removeRows(selected.at(i).row(), 1);

submit changes:
_model->submitAll();

hope this helps, regards


text:
Q: How to query a model by a related object and get the related object in the queryset using the Django ORM I know it's possible to query a model using a reverse related field using the Django ORM. But is it possible to also get all the fields of the reverse related model for which the query matched?
For example, if we have the following models:
class Location(models.Model):
    name = models.CharField(max_length=50)

class Availability(models.Model):
    location = models.ForeignKey(Location, on_delete=models.CASCADE)

    start_datetime = models.DateTimeField()
    end_datetime = models.DateTimeField()

    price = models.PositiveIntegerField()

would it be possible to find all Locations that are available in a specific timeframe AND also get the price of the Location during that availability? We are under the assumption that Availability objects that have the same location can not have overlapping start/end datetimes.
if user_start_datetime and user_end_datetime are inputted by the user, then we could possibly do something like the following:
Location.objects.filter(
    availability__start_datetime__lte=start_datetime,
    availability__end_datetime__gte=end_datetime)

But I'm not sure how to also get the price field for the specific availability that did result in a match for the query.
In raw SQL, the behavior I'm talking about might be achievable via something like this:
SELECT l.id, l.name, a.price
FROM Location l
INNER JOIN Availability a
ON a.location_id = l.id
WHERE /* availability is within user-inputted timeframe */

I've considered using something like prefetch_related('availability_set'), but that would just give me all the availabilities for the Location objects that matched the query. I just want the one availability that was within the timeframe that was queried, and more specifically, the price of that availability.

A: When you are using an ORM, in general you fetch results from one model class at a time. Since Location and Availability are separate models, you can simply do the following:
availabilities = Availability.objects.filter(
    start_datetime__lte=start_datetime,
    end_datetime__gte=end_datetime)
for availability in availabilities:
    print(availability.location.id, availability.location.name, availability.price)

Which is an easy to read implementation.
Now, accessing Location from an Availability object (in availability.location) requires a second SQL query. You can optimise this using select_related:

This is a performance booster which results in a single more complex query but means later use of foreign-key relationships won't require database queries.

Simply append it to your original query, i.e.:
availabilities = Availability.objects.select_related('location').filter(...

This will create an SQL join statement in the background and the Location objects will not require an extra query.


text:
Q: Stopping/Restarting animation inside loop with Babylon.JS I'm setting this loop up with three animations, the first one that runs on initial screen load (firstAnimation). Then the next two animations use callbacks to loop between themselves (slideAnimation -> rotateAnimation -> slideAnimation...)
How can I stop the animation whichever animation it's in using POINTERDOWN and resume it on PONTERUP..?
The way I have done it below works only during the firstAnimation, as soon as its in the loop it obviously no longer targets those two animations. So how would I target all three animations using a single .pause() .resume() command?
  var slideAnimation = function(){
      scene.beginDirectAnimation(box, [xSlide], 0, 2 * frameRate, false, 2, rotateAnimation);
  }

  var rotateAnimation = function(){
      scene.beginDirectAnimation(box, [yRot], 0, 2 * frameRate, false, 2, slideAnimation);
  }

  var firsAnimation = scene.beginDirectAnimation(box, [xSlide], 0, 2 * frameRate, false, 2, slideAnimation);

  scene.onPointerObservable.add((pointerInfo) => {
      switch (pointerInfo.type) {
          case BABYLON.PointerEventTypes.POINTERDOWN:
              light2.intensity =0.95;
              firsAnimation.pause();
              box.scaling = new BABYLON.Vector3(4, 1, -1)
              break;
          case BABYLON.PointerEventTypes.POINTERUP:
              light2.intensity =0.15;
              firsAnimation.restart();
              box.scaling = new BABYLON.Vector3(1, 1, 1)
              break;
      }
  });

Or does this need a different approach all together?

A: Babylon Group Animations could be useful for you - https://doc.babylonjs.com/how_to/group . It is a way to group animations and animatables, normalize then, and control them together.
You can see an example here - https://www.babylonjs-playground.com/#CBGEQX#5
If you want to see 2 animations running at the same time on one animatable (mesh), change line 79 from
animationGroup.addTargetedAnimation(animation2, box2);

to
animationGroup.addTargetedAnimation(animation2, box1);

And press the run button on the top.
Then pressing the pay button will run both animations on the same mesh.


text:
Q: Accidentally Interrupted cProfile After a long function call (16 hours), I ended it early with KeyboardInterrupt, but accidentally also interrupted cProfile, because it was taking so long to respond. In the Debug Stackviewer, I am faced with this:

*

*KeyboardInterrupt:

*

*idlelib.run.runcode (...)

*__ main __.< module > (...)

*cProfile.run (...)

*profile.run (...)

*profile._show (...)

*cProfile.print_stats (...)

*importlib._bootstrap._find_and_load (...)

*importlib._bootstrap._find_and_load_unlocked (...)

*importlib._bootstrap.find_spec (...)

*importlib._bootstrap._get_spec (...)

*importlib._bootstrap.find_spec (...)

*importlib._bootstrap._path_stat (...)

Is there any way to recover what cProfile would have printed, and is there a way to more smartly use cProfile for excessively long function calls.

A: No, all captured information was lost when the process exited. You might consider using the profiling package that provides profile output while your program runs. I have been intending to use it with some of my interactive programs.


text:
Q: How to let crawlers know about redirecting pages in Gatsby React I have a React component at the '/' route which checks the browser language and redirects the user to '/en' or '/es' accordingly, using Gatsby navigate method.
Now the problem is Gatsby returns a status 200 to SEO crawlers on the route '/' since it is technically not a 301 redirect, making the crawlers treat it as a separate page. Neither can I add a canonical tag to the '/' route (or meta nofollow/noindex) since it automatically picks all the metadata from the '/en' page due to the redirect.
This leads to SEO errors like duplicate meta description and title tag, missing self-reference hreflang in '/' (since it picks up the values from '/en' page).
I cannot set up a server-side 301 since I have to find the user's browser language using JavaScript code to redirect the user.
import React, { useEffect } from 'react';
import { navigate } from 'gatsby';

const LanguageSelect = () => {
  useEffect(() => {
    navigate(`/${window.navigator.language}`);
  }, []);
  return null;
}

How can I let the crawlers know that the '/' route is not a standalone page and they should not consider it separate from '/en' page?

A:
I cannot set up a server-side 301 since I have to find the user's
browser language using JavaScript code to redirect the user.

This leads to an impossible use-case. You can't use JavaScript (client-side) to make some calculations based on X logic (user language in this case) at the same time you try to avoid Google's crawlers indexing the site.
This kind of logic must be done in and by the server, by setting the / route as /en by default using a 301. Once there, the user is free to change the language.


text:
Q: Test asynchronous functionality in Jasmine 2.0.0 with done()

I am trying to implement a jasmine test on a simple promise implementation (asynchronous code) with the done() function and my test fails although the code being tested works perfectly fine.
Can anyone please help me to figure out what is missing in my test?
 var Test = (function () {
    function Test(fn) {
        this.tool = null;
        fn(this.resolve.bind(this));
    }
    Test.prototype.then = function (cb) {
        this.callback = cb;
    };
    Test.prototype.resolve = function (value) {
        var me = this;
        setTimeout(function () {
            me.callback(value);
        }, 5000);
    };
    return Test;
})();

describe("setTimeout", function () {

    var test, newValue = false,
        originalTimeout;
    beforeEach(function (done) {
        originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
        jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000;

        test = new Test(function (cb) {
            setTimeout(function () {
                cb();
            }, 5000);
        });
        test.then(function () {
            newValue = true;
            console.log(1, newValue);
            done();
        });
    });

    it("Should be true", function (done) {
        expect(1).toBe(1);

        expect(newValue).toBeTruthy();
    });

    afterEach(function () {
        jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout;
    });
});

the same test in jsfiddle: http://jsfiddle.net/ravitb/zsachqpg/

A: This code is testing a simple promise like object, so will call the Test object a promise for convenience.
There are two different async events after the promise creation:
 1. The call to the .then() method
 2. The resolving of the promise by calling the cb() function in the beforeEach() function.
In the real world these two can be called in any order and at any time.
For the test, the .then() call must be moved to the it() section's callback and all spec methods (e.g expect()) need to be called in it's callback or they'll run before it's resolved. The beforeEach() is part of the test setup while the it() function is the spec, the test itself.
The done() method needs to be called twice,

*

*When the beforeEach() async action is finished (i.e after the cb() is called), that will start running the spec. So it should look something like this:

  beforeEach(function (done) {
    test = new Test(function (cb) {
        setTimeout(function () {
            console.log("in beforeEach() | setTimeout()");
            cb(resolvedValue);
            done()
        }, 500);
    });
  });

*When the spec's (it() section's) async action is finished inside the .then() method after all calls to jasmine test methods, this will tell Jasmine the spec finished running (and so the time-out won't be reached). So:
it("Should be " + resolvedValue, function (done) {
    test.then(function (value) {
        console.log("in then()");
        expect(value).toBe(resolvedValue);
        done();
    });
});

Also, as you can see instead of testing that a variable's value has changed I'm testing that the value passed to the .then() method is the same as the one passed to the promise resolve cb() function as that is the right behaviour you are expecting.
Here's an updated version of your fiddle.
You can check in the browser's console to see that all callbacks are being called
Note: Changing Jasmine's DEFAULT_TIMEOUT_INTERVAL just makes it more convoluted for no reason, so I removed it and some extraneous code.


text:
Q: Cannot Update Windows 7 Clients to Windows 10 via WSUS (except ONE!) We are trying to upgrade our Windows 7 clients to Windows 10 via WSUS.
Only one Windows 7 client is recognizing the Windows 10 1607 upgrade as applicable. All the rest show "Not Applicable" or, less frequently "Unknown". There is no difference between the client that is recognizing the update and those which are not that I can discern.
Things I have tried/checked so far:

*

*I think I have all the requisite WSUS updates needed to service
windows 10 via WSUS.

*I have also tried adding the MIME type.

*Existing Windows 10 clients are updating fine Windows Update is configured via GPO to allow Upgrades across the board.

Is there any advice on what I can look at to get these clients to recognize the update?


text:
Q: devtools::check fails because of 64-bit Java issue I am trying to build a custom R package. It worked fine last night, but after some minor tweaks to a function today, the devtools::check fails as below (the log file referenced just gives the same information as the -- Install failure -- section of the error below):
>devtools::check(pkg_path)
Updating JTools documentation
Writing NAMESPACE
Loading JTools
Welcome to my package of custom functions. They're grRreat!
Writing NAMESPACE
-- Building ---------------------------------------------------------- JTools --
Setting env vars:
* CFLAGS    : -Wall -pedantic
* CXXFLAGS  : -Wall -pedantic
* CXX11FLAGS: -Wall -pedantic
--------------------------------------------------------------------------------
√  checking for file 'B:\shared_with_VM\programming\R\Packages\JTools/DESCRIPTION' ...
-  preparing 'JTools':
√  checking DESCRIPTION meta-information ...
-  checking for LF line-endings in source and make files and shell scripts
-  checking for empty or unneeded directories
   Removed empty directory 'JTools/test'
-  building 'JTools_0.0.0.9000.tar.gz'

-- Checking ---------------------------------------------------------- JTools --
Setting env vars:
* _R_CHECK_CRAN_INCOMING_REMOTE_: FALSE
* _R_CHECK_CRAN_INCOMING_       : FALSE
* _R_CHECK_FORCE_SUGGESTS_      : FALSE
-- R CMD check -----------------------------------------------------------------------
-  using log directory 'C:/Users/JT/AppData/Local/Temp/RtmpGKWqcq/JTools.Rcheck'
-  using R version 3.6.1 (2019-07-05)
-  using platform: x86_64-w64-mingw32 (64-bit)
-  using session charset: ISO8859-1
-  using options '--no-manual --as-cran'
√  checking for file 'JTools/DESCRIPTION' ...
-  this is package 'JTools' version '0.0.0.9000'
-  package encoding: UTF-8
√  checking package namespace information
√  checking package dependencies (1.5s)
√  checking if this is a source package ...
√  checking if there is a namespace
√  checking for .dll and .exe files
√  checking for hidden files and directories ...
√  checking for portable file names ...
E  checking whether package 'JTools' can be installed (2.9s)
   Installation failed.
   See 'C:/Users/JT/AppData/Local/Temp/RtmpGKWqcq/JTools.Rcheck/00install.out' for details.

   See
     'C:/Users/JT/AppData/Local/Temp/RtmpGKWqcq/JTools.Rcheck/00check.log'
   for details.

-- R CMD check results ---------------------------------------- JTools 0.0.0.9000 ----
Duration: 4.8s

> checking whether package 'JTools' can be installed ... ERROR
  See below...

-- Install failure -------------------------------------------------------------------

* installing *source* package 'JTools' ...
** using staged installation
** R
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded from temporary location
*** arch - i386
Error: package or namespace load failed for 'JTools':
 .onLoad failed in loadNamespace() for 'rJava', details:
  call: inDL(x, as.logical(local), as.logical(now), ...)
  error: unable to load shared object 'C:/Program Files/R/R-3.6.1/library/rJava/libs/i386/rJava.dll':
  LoadLibrary failure:  %1 is not a valid Win32 application.

Error: loading failed
Execution halted
*** arch - x64
ERROR: loading failed for 'i386'
* removing 'C:/Users/JT/AppData/Local/Temp/RtmpGKWqcq/JTools.Rcheck/JTools'

1 error x | 0 warnings √ | 0 notes √

I have verified that my computer, R, and Java are all 64-bit versions:
> system("java -version")
java version "1.8.0_221"
Java(TM) SE Runtime Environment (build 1.8.0_221-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.221-b11, mixed mode)
[1] 0

> R.Version()
$platform
[1] "x86_64-w64-mingw32"

$arch
[1] "x86_64"

$os
[1] "mingw32"

$system
[1] "x86_64, mingw32"

$status
[1] ""

$major
[1] "3"

$minor
[1] "6.1"

$year
[1] "2019"

$month
[1] "07"

$day
[1] "05"

$`svn rev`
[1] "76782"

$language
[1] "R"

$version.string
[1] "R version 3.6.1 (2019-07-05)"

$nickname
[1] "Action of the Toes"

> .Machine$sizeof.pointer
[1] 8

I tried updating Java and uninstalling/reinstalling rJava, to no avail. Based on suggestions here and here I checked the Java environmental variable:
> Sys.getenv("JAVA_HOME")
[1] ""

But I'm still getting the same error


text:
Q: Writing one client for IOS and Android based devices This question was asked an year ago and I want to ask again as earlier the answer was not straightforward :-). I am hoping we have clarity on it now.
My question relates to best way to develop a single client for IOS and Android based devices for a simple data entry type application.The app will not use any  device specific features like GPS, Camera etc  The following is my understanding , feel free to correct or add:

*

*HTML5/Javascript based client is best (ie from write once run everywhere perspective) so long as device has a connection to the central web server.

*For native IOS/Android device clients I am not clear which SDK should be used. I need to have an offline data entry capability  in the client, just in case device is disconnected for later sync-up with server. Again I am looking for write once run everywhere type of client.

*Is XML/RPC based interaction best way for device client to communicate with the central web server.

*Asusming I develop an IOS based client for smartphone, what extra work is required to run it on the IPAD . I mean whether it can be done via (xml ?) config or will it require development separately.

Thanks in advance.
Sohail

A: Go with phonegap. It's the best option for developing smartphone apps that are complaint with all sorts of mobile browsers. As far as frameworks concerned, you can choose snencha touch or jquery mobile.

A: "Write one run everywhere" lefts html5 as the only option, any other solution can't do that, even html5 wrappers like phonegap or sencha requires platform-specific tools to pack it like an native app or create native plugins for it. Html5 app can be designed to able to work offline and store data locally.
I don't prefer xml/rpc for xml is heavy to parse and too much additional characters is added for xml form to transfer load, json is more light and popular.
To support ipad, you need create a set of ipad UI(usually another set of xib or storeboard). You can use same codes if the 2 sets of UIs are identical.

A: 1 & 2, If the app is that simple, why not just write it native in both os's so it will perform well?  We've seen our costs of maintenance be tremendously higher in apps that attempt WORE mentality and use stuff like Titanium and Sencha.
If you want simplicity, just making it a customized web page.

*

*We've had great success with JSON based interaction using restful services.

*iPad and Android tablets should both have their own custom graphic layouts that take advantage of the extended real estate.


text:
Q: How to compile an image file as icon into an EXE using GTK+ as GUI? I know how to set up an image as the icon of a GtkWindow.
GtkWindow * window;
gtk_window_set_icon_from_file(window, "icon.png", NULL);

and place icon.png together with the exe.
But what if I don't want to keep that image file in my folder? I want it somehow bundled inside the exe file.
I know this can be done with qrc in Qt. Can I do this in GTK+ too?

A: I know how to do it now.
First, I have to convert that image into plain code.
Say I want to make icon.png as the icon.
Run this command to convert it as an variable named icon_1. Grab that binary if you don't have it.
gdk-pixbuf-csource --raw --name=icon_1 icon.png

It will show on the command prompt. But I suppose you want to save it to a file. So
gdk-pixbuf-csource --raw --name=icon_1 icon.png>icon.c

will do the job in Windows.
Now that variable icon_1 is ready to use.
Next step. Call gdk_pixbuf_new_from_inline() to create a new GdkPixbuf * from icon_1.
GdkPixbuf * icon_title = gdk_pixbuf_new_from_inline(-1, icon_1, false, NULL);

You can now call gtk_window_set_icon() with that newly created icon_title to set up the icon of the window.
gtk_window_set_icon(window, icon_title);

Also remember that if you keep icon_1 in a standalone C file, you have to include glib.h so that it can be compiled because it uses type guint8, and extern that variable before using so that it can be linked.
More details:
https://developer.gnome.org/gdk-pixbuf/unstable/gdk-pixbuf-Image-Data-in-Memory.html#gdk-pixbuf-new-from-inline

A: Use GResource
An example .gresource.xml might look like:
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
    <gresource prefix="/com/example/myapp">
        <file>icon.png</file>
    </gresource>
</gresources>

Then compile it to C:
glib-compile-resources.exe myapp.gresource.xml --generate-source --target=resources.c

And include resources.c in you applications sources
Then to use the embedded file as the window icon:
gtk_window_set_icon_from_file (window, "resource:///com/example/myapp/icon.png", NULL);

Also Consider setting the icon with gtk_window_set_default_icon_from_file to apply it to dialogs as well

A: This question is relatively old, but nevertheless I stumbled over it while googling for a similar problem. So, perhaps the following is helpful, which relies on the answer of @DrOli who describes a very versatile approach.
First convert PNG to XPM using ImageMagicks convert
convert about.png about.xpm

Include the new file into your code and create the pixbuf the gtkmm way
#include <gdkmm/pixbuf.h>
#include "about.xpm"

Glib::RefPtr< Gdk::Pixbuf > logo = Gdk::Pixbuf::create_from_xpm_data(about);

Voila ...

A: We are a bit new to this, and needed to accomplish essentially the same thing, but arrived at a different approach.
Notably, convert the png(s) to  xpm(s), then load/copy the "raw xpm(s)" info into your raw code as a "variable", then in GTK etc use gdk_pixbuf_new_from_xpm_data() ... etc.
This way the raw xpm is compiled as part of your code, and then it won't need to search externally for files, etc.
It means loosing some features from png that xpm can't support, but it's dead easy, and even us "non IT types" can manage it.
This also allows direct access to the "image" as it can be edited as "text" in the code, it is easy to make variations and additional icons, etc., and it is fairly easy to alter the icon/image "in real time" programmatically.
It is also very portable.  For example, we also use this in Gtk-Fortran on Windows ... works beautifully.


text:
Q: If indolent means causing little or no pain, is there a word that means causing a lot of pain or passing out/death I'm sure about the "causing a lot of pain" part but I don't know about what followed.
Is there a word that means "causing a lot of pain or passing out"  or "causing a lot of pain or death"?

His condition went from healthy to indolent and then indolent to _______?

A: Consider on the verge of death (or "at the death'door").

Definition: very near the end of one's life. (Often an exaggeration.)
Examples:

*

*I was so ill that I was at death's door for three days.

*The family dog was at death's door for three days, and then it finally died.

 Edit following @NVZ comment:

For a single word, ailing may perhaps fit.

A: terminal (if the prognosis is death)

*(of a disease) predicted to lead to death, especially slowly; incurable.
  "terminal cancer" –Google

His condition went from healthy to indolent and then indolent to terminal.

excruciating (if the problem is pain)

intensely painful. –Google

His condition went from healthy to indolent and then indolent to excruciating.

The guy who passed out, fainted.

The autonomic nervous system regulates your heart rate and blood pressure. When you experience sudden pain, your heart rate and blood pressure can rapidly decrease, which affects the amount of blood flowing to your brain. This stress on the body, primarily the sudden loss of blood, can result in fainting. –Google

Also, you cannot die from pain.

A: As hinted at by @sumelic, in a comment above, the use of indolent as you have defined it (and as it seems to be defined in a number of dictionaries) is unusual outside of the medical sense. Consider:

indolent adjective Medspeak Referring to a condition that may linger
  longer, but often slowly progresses to a more advanced stage—e.g.,
  indolent lymphoma, indolent malignancy, indolent myeloma.
Vox populi Slow growing.
Segen's Medical Dictionary. © 2012 Farlex, Inc. All rights reserved.

and

in·do·lent (in'dō-lent), Inactive; sluggish; painless or nearly so,
  said of a morbid process. [L. in- neg. + doleo, pr. p. dolens (-ent-), to feel pain] Farlex Partner Medical Dictionary © Farlex 2012

and further

Lymphomas are commonly also categorized as indolent or aggressive.
  Indolent lymphomas are slowly progressive and responsive to therapy
  but are not curable with standard approaches. Aggressive lymphomas are
  rapidly progressive but responsive to therapy and often curable.

From a search for indolent in the Merck manual.
These are examples of the use of indolent as a fairly narrowly defined adjectival descriptor of a growth, tumour or other malignancy.
Your question might be best answered by aggressive being the opposite of indolent in a medical sense.  Whether this necessarily means painful is moot.
Physicians often use exquisite pain to describe intense pain. This may answer part of the pain question.


text:
Q: менеджер архивов не видит встроенную видеокарту linux mint поставил LinuxMint 19.3 (tricia) система предупредила что видеодрайвер не поставлен

менеджер драйверов не дает вывод моей интегрированной видюхи

в свою очередь вот что выводит команда:
user@mint-19:~$ lspci -vnnn | perl -lne 'print if /^\d+:.+([\S+:\S+])/' | grep VGA
00:02.0 VGA compatible controller [0300]: Intel Corporation Iris Plus Graphics G1 (Ice Lake) [8086:8a56] (rev 07) (prog-if 00 [VGA controller])
подробности
cpu Intel(R) Core(TM) i5-1035G1 CPU @ 1.00GHz
видеокарта Intel Iris Plus Graphics G1
ядро линукс Linux mint-19 5.0.0-32-generic #34~18.04.2-Ubuntu SMP Thu Oct 10 10:36:02 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
собственно, как сделать так чтобы видюха работала? Заранее спасибо

A: Обновил версию ядра - минт сам все подхватил, видюха работает. Правда в браузере и других приложениях (а иногда и на рабочем столе) выскакивают артефакты различной степени раздражительности, но это уже совсем другая история


text:
Q: C# Class Interface Design I'm trying to design a interface for iTextsharp (PDF creation library) that I'm using for my project. I don't want any reference to iTextsharp in my project, just the interface.
Lets say, I have
     interface IPdfTable { /* */ }
     public class PdfTable : IPdfTable  { /* */ }

     interface IPdfCell { /* */ }
     public class PdfCell : PdfCell { /* */ }

While I can easily build interfaces for each class individualy, I'm having difficulty on the implementation when these classes interact with each other. Somewhere in the code, I need tables to be able to accept an collection of cells.
The problem arrives when I have a have an collection of cells, and I need to add it to the table. Somehow I need to transform the IPdfCell into the original element that is accepted by the library (iTextSharp). I believe the quick and easy implementation was downcasting, but not a good design.
The only other solution I can think is using the interface to collection varies settings and create the orginal element (accepted by iTextsharp) on the fly when it is being passed around into other elements.
Is there a better implementation?

A: I don't understand the goal of such an interface.  No matter what, your pdf generation code is going to be tied to the library you're using, building proxy classes/interfaces that exactly mirror the library doesn't prevent that, it just adds another layer.  If you were to switch to a different PDF generation library, it is extremely unlikely that the new library would match up 1:1 with equivalents in iText, and you'd end up changing the interface and calling code anyway.
My recommendation would be to create an IPDFGenerator, and then create an iTextPDFGenerator:IPDFGenerator which IS coupled to iText, and leave it at that.  You'll have the separation you want, the ability to keep iText out of your core services, but it won't require a bunch of pointless mapping between identical classes.
I think you should reevaluate the S, I, and D in SOLID and make sure you're not over-doing it.

A: Typically, you would have a translation layer that translates your interface facade implementation into the types supported natively by iTextSharp.
AutoMapper can help for this if you require property to property mappings and can remove a lot of the translation legwork for you.


text:
Q: moq callback makes linq throw exception I am using Moq and EF6.
I need to query a table and if there are less than 5 dates in the table I need to add more.
So, I do that in my code:
    public void FillPartyList(ObservableCollection<Party> argPartyList)
    {
        argPartyList.Clear();

        using (IPartyTrackerDataAccess localDb = Locator.Resolve<IPartyTrackerDataAccess>())
        {
            InitializeDates(localDb);

            var localList = (from tempList in localDb.Parties
                             where tempList.PartyDate >= DateTime.Now.Date
                             select tempList);

            foreach (Party currentParty in localList)
            {
                argPartyList.Add(currentParty);
            }
        }

    }

Inside "InitializeDates" I query the database to see how many dates are there and then add enough to make 5. There are rules around creating the dates [e.g. only on Fri or Sat, etc] so this is not trivial. Then, when the method comes back I get the full list from the database and add it to the parameter.
My problem comes when I try to test this. Here's my test.
    public void TestInitializeDates()
    {
        //Expected data
        int callCount = 0;
        int addParty = 0;
        int saveChanges = 0;
        ObservableCollection<Party> PartyList = new ObservableCollection<Party>();

        //Mock data
        IQueryable<Party> partyData = new List<Party>().AsQueryable();
        IQueryable<SystemSetting> settingsData = new List<SystemSetting>().AsQueryable();

        //Setup mock
        Mock<PartyTrackerEntities> mockContext = SetupDbContext();

        SetupApplicationSettings(mockContext, settingsData);
        SetupPartyDbSet(mockContext, partyData);

        Locator.Register<IApplicationSettings, ApplicationSettings>();

        //If I keep the following line I get an exception when querying the "database" for parties.
        mockContext.Setup(m => m.Parties.Add(It.IsAny<Party>())).Callback(() => addParty = callCount++);
        mockContext.Setup(m => m.SaveChanges()).Callback(() => saveChanges = callCount++);

        //Run tests

        PartyTrackerModel localModel = new PartyTrackerModel();

        localModel.FillPartyList(PartyList);

        Assert.AreEqual(1, callCount);
        Assert.AreEqual(0, saveChanges);
    }

    private Mock<DbSet<Party>> SetupPartyDbSet(Mock<PartyTrackerEntities> argDbContext, IQueryable<Party> argPartyData)
    {

        //Mock objects
        Mock<DbSet<Party>> mockPartySet = new Mock<DbSet<Party>>();

        mockPartySet.As<IQueryable<Party>>().Setup(m => m.Provider).Returns(argPartyData.Provider);
        mockPartySet.As<IQueryable<Party>>().Setup(m => m.Expression).Returns(argPartyData.Expression);
        mockPartySet.As<IQueryable<Party>>().Setup(m => m.ElementType).Returns(argPartyData.ElementType);
        mockPartySet.As<IQueryable<Party>>().Setup(m => m.GetEnumerator()).Returns(argPartyData.GetEnumerator());

        argDbContext.Setup(m => m.Parties).Returns(mockPartySet.Object);

        return mockPartySet;
    }

EDIT: I got distracted and didn't finish the question.
Everything works fine until I add the setup that increments a counter, then the Linq in InitializeDates() fails.
How do I increment the counter and leave the DbSet<> mocking properly? How do I query the "database" and still count the calls to Add? If I setup the Context.Parties.Add() to count calls the linq query blows up.
What am I doing wrong?
EDIT: Adding InitializeDates(). Note: None of this has a problem until I add the Moq.Callback.
    private static void InitializeDates(IPartyTrackerDataAccess argLocalDb)
    {
        IApplicationSettings localAppSettings = Locator.Resolve<IApplicationSettings>();

        //using (PartyTrackerEntities LocalDb = new PartyTrackerEntities())
        {
            //TODO: Move this code to the PartyTrackerDb class.
            //Technically this would communicate with the database and
            //make sure there are at least 5 parties in the future.
            var SqlPartyList = from LinqList in argLocalDb.Parties
                               where LinqList.PartyDate >= DateTime.Now.Date
                               select LinqList;
            List<Party> PartyList;
            try
            {
                PartyList = SqlPartyList.OrderByDescending(argOrder => argOrder.PartyDate).Take(5).ToList();
            }
            catch (SqlException)
            {
                //MessageBox.Show("Cannot connect to database. Please ensure that SQLServer is running and accessable from this machine.");
                throw;
            }

            if (PartyList.Count < 5)
            {
                DateTime MaxPartyDate = PartyList.Count <= 0
                                            ? DateTime.Now.Date.AddDays(-1)
                                            : PartyList.Max(argMaxDate => argMaxDate.PartyDate);

                //<= 4 because  PartyList.Count is zero-based so this is 5 parties.
                for (int ShortDayCount = PartyList.Count; ShortDayCount <= 4; ShortDayCount++)
                {
                    int dateOffset;
                    decimal coupleDonation;
                    decimal singleMaleDonation;
                    decimal singleFemaleDonation;
                    decimal sponsoredMaleDonation;
                    if (MaxPartyDate.DayOfWeek == DayOfWeek.Friday) //If the last party in the list is on a Friday, then we need to add a Saturday
                    {
                        //Get the Donation amounts
                        //Get Saturday Donations
                        coupleDonation = localAppSettings.SatCoupleDonation;
                        singleMaleDonation = localAppSettings.SatSingleMaleDonation;
                        singleFemaleDonation = localAppSettings.SatSingleFemaleDonation;
                        sponsoredMaleDonation = localAppSettings.SatSponsoredMaleDonation;

                        //Add Sat
                        dateOffset = 1;
                    }
                    else //Otherwise we need to add a Friday
                    {
                        //Get the Donation amounts
                        //Get Friday Donations
                        coupleDonation = localAppSettings.FriCoupleDonation;
                        singleMaleDonation = localAppSettings.FriSingleMaleDonation;
                        singleFemaleDonation = localAppSettings.FriSingleFemaleDonation;
                        sponsoredMaleDonation = localAppSettings.FriSponsoredMaleDonation;

                        if (MaxPartyDate.DayOfWeek == DayOfWeek.Saturday)
                        {
                            dateOffset = 6;
                        }
                        else
                        {
                            dateOffset = 5 - (int)MaxPartyDate.DayOfWeek;
                        }
                    }
                    Party NewParty = new Party
                    {
                        PartyDate = MaxPartyDate.AddDays(dateOffset),
                        CoupleDonation = coupleDonation,
                        SingleMaleDonation = singleMaleDonation,
                        SingleFemaleDonation = singleFemaleDonation,
                        SponsoredMaleDonation = sponsoredMaleDonation
                    };

                    argLocalDb.Parties.Add(NewParty);

                    MaxPartyDate = NewParty.PartyDate;
                }

                argLocalDb.SaveChanges();

            }
        }
    }


text:
Q: Javascript phone and number field wont validate correctly submits form anyway Update:
the script below will throw an error if I enter in a 9 digit phone number, and accept a 10 digital one ......  but it will also accept just a single digit - how can I stop this from happening.
and for the collector field I need it to accept only 11 numbers.
I'm trying to amend my validation code to validate for phone numbers, it seems like an easy enough task but I can't get it to work correctly.
The script should check to see if it is 9 digits long, spaces, dashes or no spaces are okay.  If no phone is entered it should give the required error.  If the field has only 8 digits for example entered it should give the invalid phone error.
Please see the code at this jsfiddle - http://jsfiddle.net/5zFqS/7/
function validate_required(field,alerttxt) {
  with (field) {
    if (value==null||value=="") {
      alert(alerttxt);return false;
    } else {return true;}
  }
}

function validate_email(field,alerttxt) {
  with (field) {
    apos=value.indexOf("@");
    dotpos=value.lastIndexOf(".");
    if (apos<1||dotpos-apos<2)
      {alert(alerttxt);return false;}
    else {return true;}
  }
}

function validate_Phone(field,alerttxt) {
    var phoneno = /^\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$/;
    if(field.value.match(phoneno))  {
      alert(alerttxt);return false;
    } else {return true;}
  }

function validate_collector(field,alerttxt) {
  var collect = /^\d{12}$/;
    if(field.value.match(collect))  {
      alert(alerttxt);return false;
    } else {return true;}

}
function validate_form(thisform) {
  with (thisform) {
    if (validate_required(firstName,"Please enter your First Name")==false)
    {firstName.focus();return false;}

    if (validate_required(lastName,"Please enter your Last Name")==false)
    {lastName.focus();return false;}

    if (validate_required(email,"Please enter your Email Address")==false)
    {email.focus();return false;}

    if (validate_email(email,"Please enter a valid Email Address")==false)
      {email.focus();return false;}

    if (validate_required(phone,"Please enter your Phone")==false)
    {phone.focus();return false;}

    if (validate_Phone(phone,"Please enter a valid Phone Number")==false)
    {phone.focus();return false;}

    if (validate_required(province,"Please select your Province")==false)
    {province.focus();return false;}

    if (validate_required(collector,"Please enter Collector Number")==false)
    {collector.focus();return false;}

    if (validate_collector(collector,"Please enter a valid Collector Number")==false)
    {collector.focus();return false;}

    }
  }

I think I have a syntax error but I can't see it.

A: You need to remove the semi-colon at the end of this line:
if (field.match(/^\d{9}/));

You said that spaces etc., should be okay. In which case, you'll need to remove (or ignore) them:
var reg = /\D/g;    // \D identifies non-digit characters, g means 'global'
var stripped = "888-777 66st".replace(reg,"");
// returns: 88877766

Also, use of with is not recommended

as it may be the source of confusing bugs and compatibility issues

MDN reference

A: Instead of
if (field.match(/^\d{9}/))

use this
if (!field.match(/\d{9}/))


text:
Q: How I can @CachePut for collection in Spring? For caching I am using Ehcache3 as provider. Let's say I have this methods:
@Transactional
@Cacheable(cacheNames = "findAllPosts")
public Page<Post> getAllPosts(Pageable pageable) {
    return postRepository.findAll(pageable);
}

@Transactional
@Cacheable(cacheNames = "findPostById")
public Post findById(Long id) {
    return postRepository.findById(id).orElseThrow(exceptionHelper.getEntityNotFoundException(id, Post.class));
}

@Transactional
@CachePut(cacheNames = "findPostById", key = "#result.id")
public Post update(Long postId, Post postToUpdate) {
    Post post = postRepository.getOne(postId);
    post.setTitle(postToUpdate.getTitle());
    post.setContent(postToUpdate.getContent());
    post.setUpdated(LocalDateTime.now());
    return post;
}

I want to of course cache this methods. It works, but @CachePut affect only findPostById and does not affect findAllPosts even if I add findAllPosts to cacheNames. When I am updating Post, it is visible for single post (by id) and not for getAllPosts (cache is not updated for this method). What can I do to update not only single entity but whole collection? Is there something like @CollectionCache?

A: One solution for this would be to evict the cache for the list whenever a single element gets updated.
You would have to autowire the cacheManager, access the cache from there and evict what youn need manually in the update method.
Sample code:
@Autowired
private CacheManager cacheManager;

@Transactional
@CachePut(cacheNames = "findPostById", key = "#result.id")
public Post update(Long postId, Post postToUpdate) {

    Cache allPostsCache = cacheManager.getCache("cacheName").evict("cacheKey");

    Post post = postRepository.getOne(postId);
    post.setTitle(postToUpdate.getTitle());
    post.setContent(postToUpdate.getContent());
    post.setUpdated(LocalDateTime.now());
    return post;
}

Ofcourse you need to replace "cacheName" and "cacheKey" with your values.


text:
Q: PowerBI - Visual API - changing Visual properties | usage: translations Context : we're having our powerbi dashboards embedded either as a whole report or only standalone visuals.
We want to translate the content of our reports in several languages. some of it can  be done via  metadata translations ( DAx Editor -> cultures).
What we want to achieve is to have the visuals titles etc translated. we are looking for a way which is easy to maintain.
According to MS this could be achieved using the Visuals API but the documentation is new and we cannot interpret if we can use it for this.
https://learn.microsoft.com/en-us/power-bi/developer/visuals/visual-api
Would there be someone who did this before and give some directions?

A: Visual API is used to create custom visuals for Power BI. Currently, Power BI translates report content such as automatically generated titles, filters, and tooltips using locale settings. but it doesn't translate your data.
You can update your embed configuration like this:
let embedConfig = {
    ...
    settings: {
        localeSettings: {
            language: "en",
            formatLocale: "es"
        }
    }
};

(Note: After the report has been loaded, the locale settings cannot be
changed. To change the report locale settings, reset the iframe by
calling powerbi.reset(element), and then embed the report again)

The alternative approach could be to create multiple reports/visuals for each language and embed them separately.
For Instance, if I need to a visual in English and Spanish language. I'll make two visuals, one in Spanish and another in English, as well as a dropdown/input field. I'll update the configuration file and re-render the component based on the user's selection/input.
References:
Configure embedded Power BI report settings in a Power BI embedded analytics application | Microsoft Docs
Supported languages and countries/regions for Power BI - Power BI | Microsoft Docs


text:
Q: What does SSB and SSW of ANOVA tell you about your data? This might be a stupid question. I know how to calculate them but mine not sure what they are telling me about my data set. What does it mean if $\sum  $$(SSB)^2$ $\ge \sum  (SSW)^2$, or vise versa, or does $SSB$ and $SSW$ only have meaning when you sum them to find Total $\sum  $$(SST)^2$.

A: I assume you are talking about a one-way (or one-factor) ANOVA. Below is an example with fake data in which there are 30 observations: r = 10 replications within each of g = 3 treatment groups.
 A:   9.0   4.4   1.6   4.4   0.4  23.8   1.5  22.6   6.0  18.3
 B:  24.5  26.9  21.4  17.5  28.6  24.8  21.9  23.7   4.2   8.4
 C:  19.0  33.4  23.9  21.2  24.7  23.6  30.0  21.2  25.2  26.2

The null hypothesis in such an ANOVA is that the population means
of all three treatment groups are equal, that is $H_0: \mu_A = \mu_B = \mu_C$, and the alternative is that there are some differences among these three population means.
Just looking at the data we see that the observations in Group A
are generally smaller than the others. So we suspect that the null
hypothesis is not true. The sample means and standard deviations of the
three groups are as follows:
 Group   N    Mean  StDev
 A      10   9.200  8.984
 B      10  20.190  7.988
 C      10  24.840  4.281

We see that the sample mean for Group A is indeed much smaller
than the other two sample means. Also, the mean for Group C is
a little bigger than the mean for Group B. The question is whether
these differences in sample means based on just 10 observations in each group are large enough that they are unlikely to have occurred
by chance alone.
The standard deviations are a key to judging this. In this ANOVA
we assume that the three populations have the same variance.
The sample variances (squares of sample standard deviations) are
somewhat different, but no by enough to contradict our assumption.
Averaging the three sample variances we have 54.3, one good estimate of the
common variance of the three populations. This number is shown
in the ANOVA table below as SS(Within), which is your SSW.
[The square root of 54.3 is the 'pooled' SD 7.37, which lies
among the three group SDs, but is not their average.]
 Source   DF      SS     MS      F      P
 Between   2  1290.0  645.0  11.88  0.000
 Within   27  1465.5   54.3
 Total    29  2755.6

Provided that the null hypothesis is true, there is another good estimate
of the common population variance, which is based on the three
sample means. If $H_0$ is not true this second estimate tends
to be too big. For our data that estimate is shown
in the table above as SS(Between) = 645.0. This is your SSB.
This estimate is enormously larger than SSW. Because these
two estimates of the common population variance agree so
poorly, we conclude that the null hypothesis is not true.
The ratio SSB/SSW = F = 11.88 is used as the criterion whether
to reject. If $H_0$ is true the F-statistic should be around 1
(the ratio of two good estimates of the same thing). For the
dimensions of this problem (10 observations on each of 3 groups),
we would reject the null hypothesis if F > 3.36. And 11.88 is
certainly greater than 3.36. (The DF column of the ANOVA table
tells you how to look up the 'critical value', here 3.36, that
separates low non-rejection values of F from high rejection values.)
Thus to answer your question, here is the intuitive interpretation
of SSB and SSW:  No matter whether $H_0$ is true, SSW is a
good estimate of the common population variance $\sigma^2$. This
estimate is based on the sample variances (or SDs shown above).
A second estimate of $\sigma^2$ is SSB is based on the sample means. It is a good estimate
if $H_0$ is true and too high if not.
The Analysis of Variance
(ANOVA) procedure compares these two variance estimates.
If they agree pretty well, we do not reject $H_0$. If they don't
agree, so that F = SSB/SSW is too large, then we do reject $H_0$.
Notes: (1) SSB is based on the degree to which the g group
means differ. (2) It is conceivable, but rare, to have SSB much
smaller than SSW. In this case statisticians begin to worry
whether there is something wrong with the way the data were
collected, or whether the assumptions of the ANOVA model are
correct: normally distributed populations with the same variance
$\sigma^2.$ (A bit smaller is OK, they are only estimates
after all.) (3) If you reject $H_0$, then you have to try to
figure out what pattern of differences there is among the
population means. For our data, it is pretty clear that $\mu_A$ is smaller than the other two population means. There is no strong
evidence that $\mu_B$ differs from $\mu_C.$ Procedures to check
for such patterns, after rejecting $H_0$, are called multiple comparison procedures. (4) The one-factor ANOVA is a direct generalization of the pooled 2-sample T test. In that test the difference between two means in the numerator is compared with
the pooled sample variance in the denominator; the square of the T-statistic is an F-statistic with numerator DF = 1. (5) For normal data sample means and
variances are independent random variables. That turns out to be
important in doing the computations of critical values given in F tables. B.T.


text:
Q: Restrict CQL filter to a specific BBOX I need to filter an OpenLayers layer using a CQL filter to an specific Bounding Box. Is it possible?
Something like this isn't working:
igh > 5000 AND bbox(igh,20786691,22051867,-305577260,-306370356)

A: Which mapserver are you running/requesting maps from?
According to Geoserver CQL Tutorial:

CQL provides a full set of geometric filter capabilities. Say, for example, you want to display only the states that do cross the (-90,40,-60,45) bounding box. The filter will be BBOX(the_geom, -90, 40, -60, 45)

A: For anyone else figuring out how to use BBOX AND CQL filter with ~version 2.10+. You want to do something like:
/geoserver/eis/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=[layer name]&outputFormat=application%2Fjson&srsName=EPSG:4283&maxFeatures=100&cql_filter=BBOX([GEOM_FIELD]],151.09596,-33.609279,151.336939,-33.479914)%20AND%20status=%27active%27
replace [GEOM_FIELD]
So this was restricting with:

BBOX(the_geom,151.09596,-33.609279,151.336939,-33.479914)
AND
status='active'

Hope that helps, the documentation on this is quite terse


text:
Q: How can I store a file in the database in the same way WordPress and ACF do? I'm taking input from a Caldera Forms form which includes a user upload.  This is returned as an array containing the file name:
["company_logo"]=>
array(1) {
  [0]=>
  string(73) "https://example.com/wp-content/uploads/2018/02/logo-1.png"
}

I'm using ACF to manage the data elsewhere, which effectively just provides a nice way to get and update the data.
How can I store this in the same way WordPress does?  I believe WordPress handles it in a very different way than just storing a URL, as resizing takes places and ACF returns various different sizes of the images to me.
Do I need to create an attachment?
Currently I'm adding it in the following way, which does save it as expected, but just as a text string.  I need it to save in the same way that WordPress/ACF saves uploaded files when uploaded via admin area.
update_user_meta( $organisation_id, 'company_logo', $data['company_logo'][0] );

A: ACF doesn't store any file in Database, it simply provides meta fields with user friendly interface.
You can however, store them yourself. To store a field, you need to be familiar with PHP a bit. Here's how saving a meta field happens, by using the add_post_meta() function:
add_post_meta ( $post_id, 'meta_key', 'meta_value', $is_unique );

There are other functions such as update_post_meta() for various usage. If your forms contains a file, you can handle the upload by using the media_handle_sideload().
Let's say you have a form like this:
<form method="POST" enctype="multipart/form-data">

    <input type="file" name="some-name"/>

</form>

and you want to save the uploaded file as an attachment. I'm ignoring security and checkup ( they can be found in the codex ) and directly going on how to do it.
You can use the mentioned function to handle the uploaded image, and store the uploaded attachment's ID:
$image_id = media_handle_upload( 'some-name', $post_id );

update_user_meta( $organisation_id, 'company_logo', $image_id  );

Now, you have access to attachment's ID, which you can use to retrieve any size of the attachment.


text:
Q: I want to create a generic selector for 2D array in C In case if 2d array is of float type I want to call the first function and otherwise the second, how can I accomplish this?
 void printff(int n,float m[n][n])
    {
        for(int i=0;i<n;i++){
        for(int j=0;j<n;j++)
        printf("\t%f",m[i][j]);
        printf("\n");
        }
    }

void printfi(int n,int m[n][n])
{
    for(int i=0;i<n;i++){
    for(int j=0;j<n;j++)
    printf("\t%d",m[i][j]);
    printf("\n");
    }
}

#define print(a,b) _Generic(b,int*[sizeof(a)]:printfi,float*[sizeof(a)]:printff)(a,b)

A: The macro should be:
#define print(a,b) _Generic((b), int(*)[]: printfi, float(*)[]: printff)((a), (b))

the type of b is either int(*)[a] or float(*)[a], e.g. a pointer to an array of a int or float.
This code works for me:
#include <stdio.h>

void printff(int n,float m[n][n])
{
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++)
            printf("\t%f",m[i][j]);
        printf("\n");
    }
}

void printfi(int n,int m[n][n])
{
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++)
            printf("\t%d",m[i][j]);
        printf("\n");
    }
}

#define print(a,b) _Generic((b), int(*)[]: printfi, float(*)[]: printff)((a), (b))

int main()
{
    float a[5][5];
    for(int i=0;i<5;i++)
        for(int j=0;j<5;j++)
            a[i][j] = i * 5 + j;
    print(5, a);
    int b[2][2];
    for(int i=0;i<2;i++)
        for(int j=0;j<2;j++)
            b[i][j] = i * 2 + j;
    print(2, b);
}

https://godbolt.org/z/zrP9TnEcP
If you only use square 2D arrays, you can use this macro:
#define print(a) _Generic((a), int(*)[]: printfi, float(*)[]: printff)(sizeof *(a) / sizeof **(a), a)

It will calculate the length itself. Call it with print(a); or print(b);.
https://godbolt.org/z/xP918sn1s
It can be even easier when you use **(a) for the first parameter of _Generic:
#define print(a) _Generic(**(a), int: printfi, float: printff)(sizeof *(a) / sizeof **(a), (a))

https://godbolt.org/z/TzrY1G4ev


text:
Q: Question about environment variable in toolchain I am trying to develop a toolchain for wllvm (whole program LLVM) on bazel 3.7 following the tutorial (link to the tutorial). A problem I have is I have to pass an environment variable (LLVM_COMPILER) to wllvm. Can you possibly provide more details here or a concrete example? Is it possible to directly configure the environment variable in .bazelrc?
Thanks a lot!

A: If it is ok to set an environment variable for each Bazel action, then use --action-env flag
# .bazelrc
build --action_env=LLVM_COMPILER=wllvm


text:
Q: How to narrow down the list of CSS properties in autocomplete of Firefox Developer Tools or Firebug? We write CSS properties a lot. That's why autocomplete comes in handy. But it's a little frustrating when I press v hoping for vertical-align and it comes out vector-effect or d hoping for display and it comes out direction etc.
I would like to limit this list of properties in Firefox (also Firefox Developer Edition) or Firebug to only those I really use. Is there such possiblity? Or maybe you could propose another tool which includes this functionality?
Thanks!

A: Firebug already tries to be smart and does complete d to display. In case you type v it completes to visibility. The code for this can be found here:
https://github.com/firebug/firebug/blob/77b0d5620227852757b8a9c1d6167a44f7210172/extension/content/firebug/css/autoCompleter.js#L32
So if you want to change these defaults, you need to change them within Firebug's source code and build it by your own.
The built-in DevTools currently (Firefox 33.1.1) don't have such logic and simply display the first option in alphabetical order. To get that logic improved you should file an enhancement request for them.


text:
Q: How to load PDFs from Documents Directory? I can load list of pdf files(all pdf files) from Resources folder, using this code.
 NSArray *pdfs = [[NSBundle mainBundle] pathsForResourcesOfType:@"pdf" inDirectory:nil];

But I couldn't find a method to load list of pdf files from Documents Directory. The following line of code can only load one pdf at a time.
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *file = [documentsDirectory stringByAppendingPathComponent:@"test.pdf"];
NSURL *urlPdf = [NSURL fileURLWithPath: file];

How could I load all pdf files from Documents Directory
Can you please give me a code example.

A: I was able to solve my issue using this line of code :)
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSArray *pdfs = [[NSBundle bundleWithPath:[paths objectAtIndex:0]] pathsForResourcesOfType:@"pdf" inDirectory:nil];

A: Go with NSFileManager's contentsOfDirectoryAtPath and filter the result by hand for pdf files.
This answer maybe helpful.

A: You could do this
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];

NSFileManager *fileManager = [NSFileManager defaultManager];
NSError *error = nil;
NSArray *filesAtPath = [fileManager contentsOfDirectoryAtPath:documentsDirectory error:error];

for (NSString *path in filesAtPath)
{
    if ([path rangeOfString:@".pdf"].length > 0)
    {
        //Do whatever you want with the pdf file
    }
}

I hope it helps, cheers


text:
Q: angularJS - evaluation happens too early? In my page I have a table created using ng-repeat directive and the table cells have this code

The getImageData has the following code:

$scope.getImageData = function (rowData, fileName) {
            var ext = fileName.split('.').pop();
            if (ext.toLowerCase() == "ico")
                ext = "x-icon";

            return "data:image/" + ext + ";base64," + rowData;
        };

The page looks OK in the browser, e.g. I do see the images in my rows just fine. However, in the Console (in Google Chrome) I see the following error messages:
%7B%7BgetImageData(row.dailyPict,%20row.p1Caption)%7D%7D:1 GET http://localhost:9753/AppName/%7B%7BgetImageData(row.dailyPict,%20row.p1Caption)%7D%7D 404 (Not Found)
I also see this error appear before I finish with my API Controller's code returning the data for the grid.
So, what can I do to avoid these errors in Console, e.g. only evaluate the image source once I get my data?

A: The reason that the evaluation is happening too early may be because the page is loading before it receives the data, but is re-evaluated when the data exists from data binding.
The error that is being posted is saying that it can't find the file where the src is because the path is actually the failed evaluation text.
I believe if you change the ng-if to check if it's truthy (bonus: '' is not truthy). That should make it so the evaluation doesn't occur when row.p3Caption is null / undefined.
if ng-if="row.p3Caption" doesn't work try ng-if="!!row.p3Caption"

A: I solved the problem by looking into our solution and searching for src= in chtml files. I have to use ng-src instead of the src. Using ng-src helped to get rid of the error.


text:
Q: How i can count count of doc_id, which has every word in dataframe? I have pandas dataframe whith 2 columns.
This dataframe shows, in which document (doc_id) occurs word. One word may occurs in several documents.

doc_id  word
1       One
1       Two
1       Three
1       John
2       One
2       John
2       Eva
3       One
3       Eva

I want to get dataframe, which shows the count of documents, in which every word occurs, and the share of this indicator (100*count of documents/total_count_of_documetns), sorted by count.
So, the result must be as following dataframe:

word  doc_count   share
One       3       100%
John      2       66.67%
Eva       2       66.67%
Two       1       33.33%
Three     1       33.33%

How I can make it whith pandas in Python?


text: Q: package.json isn't updated after installing or uninstalling package on my react project On my react project, I make use of http-proxy-middleware to set up the proxy for communication between my frontend and backend. However, at some point in the development of my project, the packages installed and uninstalled no longer triggers the update on package.json. Not only that, I always see a line of code "rollbackFailedOptional: verb npm-session xxxxxxxxxxx" in my command terminal after typing either npm install or npm uninstall. However, I still can use those packages in my app without running into any problem. It's just that they aren't shown on package.json. What's the possible cause for this problem?


text:
Q: Having id-field on a value object in DDD I'm working on a project where I had a value object (called SkillProfile) within an aggregate. Aggregate root is the User entity and the User has a unidirectional one-to-one association to it's SkillProfile. There is use case in the business where a SkillProfile can be shared with another User, but always as a copy (so modifying one of the profile won't change any of the other users profile). So far so good.
Now the business has the new requirement that it should be possible to see in reports which users share the same skill profile. This requirement cannot be fulfilled by the equals method on the skill profile, since there are skill profiles which coincidentally have the same values but weren't "shared" in terms of explicitly doing it. Of course the old requirement that skill profiles have to be immutable is still valid.
So here my question: Is it a good idea to invent a new field "Id" or "SharingCode" on the SkillProfile class and therefore give it some sort of identity although it's still a value object and not an entity since it has no state or lifecycle?

A: First,

so modifying one of the profile won't change any of the other users profile

If SkillProfile is indeed a value object, there should be no possibility to modify one! Replacing it within the User is fine of course. (just to have this clear before discussing your question)

With the new requirements, SkillProfile needs an identity - whether explicit or implicit - because it can no longer be compared by just looking at its value. Thus, it is now an entity.
Note that you don't need to treat it much differently than you were the value object before - it's a good idea to keep the entity immutable, for example, because this is still in the nature of the concept. So it shouldn't be a big step to make it an entity.


text:
Q: Get Full size profile picture from linkedin api I have a login with linkedin Script, i want to fetch the original size of the linkedin user profile picture when i write picture-url it provide me with 24*24 px image that is unsuitable for my website. According to linkedin docs and other stack overflow i found i need to pass picture-urls::(original) below
  $success = $client->CallAPI(
                'http://api.linkedin.com/v1/people/~:(id,email-address,first-name,last-name,location,picture-url,public-profile-url,formatted-name)',
                'GET', array(
                    'format'=>'json'
                ), array('FailOnAccessError'=>true), $user);
}
}
  $success = $client->Finalize($success);
 }
 if ($client->exit) exit;
 if ($success) {
$user_id = $db->checkUser($user);
$_SESSION['loggedin_user_id'] = $user_id;
$_SESSION['user'] = $user;
}

After adding picture-urls::(original) it looked like this->
$success = $client->CallAPI(
            'http://api.linkedin.com/v1/people/~:(id,email-address,first-name,last-name,location,picture-urls::(original),public-profile-url,formatted-name)',
            'GET', array(
                'format'=>'json'
            ), array('FailOnAccessError'=>true), $user);
}

But no Picture was resulted after this


text:
Q: System.CodeDom.Compiler as nuget-package The whole day I've been seaching for the System.CodeDom.Compiler - namespace in nuget-packages. I only found the Microsoft.CodeDom.Providers.DotNetCompilerPlatform (Roslyn ?) but it seems as the namespace I'm searching for is not included. Does anyone know if there's a package containing that namespace?
Edit:
This is the code I got for now. But Visual Studio 2015 cannot find the CodeDom in namespace System
using System;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;

namespace ICA.CubeSeven.Dynamic
{

    public class Class1
    {
    }

}

A: It's not in a package, it's in System.dll and is part of the framework.
Just make sure you have using System.CodeDom.Compiler; in your file.

A: Soo I found the problem myself...
In the project.json we need to add a targetframework. For me it was adding the framework-section in project.json (for default the template doesnot add a framework):
{
      "frameworks": {
        "dnx451": { }
      }
}


text:
Q: How to stop animating back in swift? When I start typing in uitextfield i want some animation to happen and it should not reverse back until i finish typing. I am using this code to animate:
func textFieldDidBeginEditing(textField: UITextField) {
    println("begin")
    UIView.animateWithDuration(1.0, animations:{
        self.secondTextfield.frame = CGRectMake(self.secondTextfield.frame.origin.x + 500, self.secondTextfield.frame.origin.y, self.secondTextfield.frame.size.width, self.venueTextField.frame.size.height)
    })
}

What I want to do is: when i start typing in first textfield, i want the second text field to hide out from view and when i finish typing, i want it to animate back in.
What my issue is: When I start typing the animation happens and it comes back to the original position.It doesn't wait for me to finish typing.

A: *

*Why not change alpha to 0, intead change its frame?

*You need to identify witch textfield is editing.

*You need to deal with textFieldDidEndEditing to get second textField back.

Example:
func textFieldDidBeginEditing(textField: UITextField) {
    if textField == firstTextField {
        UIView.animateWithDuration(1.0, animations:{
            self.secondTextfield.alpha = 0
        })
    }
}

func textFieldDidEndEditing(textField: UITextField) {
    if textField == firstTextField {
        UIView.animateWithDuration(1.0, animations:{
            self.secondTextfield.alpha = 1
        })
    }
}

A: While not knowing exactly what the problem is, I've found a reasonable alternative to solving your problem:
Instead of animating your frame, animate the auto-layout constraint that defines your textField's x coordinate. For instance, the image below consists of two textFields. I want to animate the bottom one when I begin typing in the top one:

The vertical constraint is a centre x alignment that I want to animate. To achieve the effect, I connected an @IBOutlet to my NSLayoutConstraint:

I had my view controller adopt UITextFieldDelegate and implemented three methods:
extension ViewController: UITextFieldDelegate {
  func textFieldDidBeginEditing(textField: UITextField) {
    self.c.constant += 100 //c is my constraint
    UIView.animateWithDuration(1.0) {
      self.view.layoutIfNeeded()
    }
  }

  func textFieldDidEndEditing(textField: UITextField) {
    println("textFieldDidEndEditing")
    self.c.constant -= 100
    UIView.animateWithDuration(1.0) {
      self.view.layoutIfNeeded()
    }
  }

  func textFieldShouldReturn(textField: UITextField) -> Bool {
    a.resignFirstResponder()
    return true
  }
}

This method needs a bit of auto-layout know how, but I was able to achieve the effect you desired.


text:
Q: ¿Como transformar una imagen que obtuve de un input a base 64 con php? Me gustaría transformar una imagen a base64 obtenida de un input. Pero al hacerlo me imprime "ZGVzY2FyZ2ExLmpwZw==" o algo parecido con cada imagen que pruebo. ¿Como le hago para que realmente me salga la imagen en base 64?
HTML:
<!DOCTYPE html>
<html>
<head>
    <title></title>
</head>
<body>

    <form role="form" action="imagen.php" method="post" name="productoform">
        <input type="file" name="imagen" required class="form-control">
        <input type="submit" name="sub" value="Base64">
    </form>

</body>
</html>

PHP:
<?php
$imagen = utf8_decode($_POST['imagen']);
$imdata = base64_encode($imagen);

echo $imdata;
?>


text:
Q: "Kolmogorov complexity" of models of computation This question was partly inspired by my learning about John Tromp's binary lambda calculus and similar minimal languages such as Jot. A more detailed discussion of some of these ideas is in Michael Stay's paper Very Simple Chaitin Machines for Concrete AIT [algorithmic information theory].

A Chaitin machine is a partial recursive function whose inputs and outputs (when defined) are finite binary strings, such that the viable input strings - which can be thought of as "programs", and need not give an output - form a prefix-free code. In other words, if $s$ and $st$ are viable programs, where $st$ denotes the concatenation of $s$ and $t$, then $t$ is the null string. For more detailed discussion see Stay's paper linked above. The set of Chaitin machines is obviously countable; let $m_i$ denote the $i$th machine according to some indexing (the details should be unimportant), and $m_i(s)$ the result of running program $s$ on machine $m_i$.
A Chaitin machine $m_i$ is said to be universal if for every Chaitin machine $m_j$ there is a program $int_{i,j}$ such that $m_i(int_{i,j}s) = m_j(s)$ for every program $s$. $int_{i,j}$ is called an interpreter for $m_j$ in $m_i$. Universal Chaitin machines are known to exist, but note that being universal as a Chaitin machine is stronger than being a Chaitin machine which is Turing-complete: $m_i$ must be able to interpret every $m_j$ with constant overhead.
Let $C_i(s)$ denote the Kolmogorov complexity of the string $s$ in the machine $m_i$: that is, the length in bits of the shortest program in $m_i$ which outputs $s$. If $m_i$ is universal then the dependence of $C_i(s)$ on $m_i$ is effectively an additive constant independent of $s$: that is, if $I_{i,j}$ is the length of a shortest interpreter for $m_j$ in $m_i$ then $C_i(s) \le I_{i,j} + C_j(s)$.
I am interested in the behaviour of $I_{i,j}$ as a function of (especially) $j$. My intuition is this: in any given $m_i$ which is universal, it is certainly possible to devise an artificially long program which behaves as an interpreter for some $m_j$; and it's conceivable to me that there could be a "pseudo-uniform" way to come up with some particular $m_j$ (dependent on $m_i$) such that all interpreters for $m_j$ in $m_i$ must be long, i.e. $I_{i,j}$ must be large. Is it then true that some $m_j$ will "usually" need a longer interpreter in the various $m_i$ than will another $m_{j_0}$? In other words, are some universal Chaitin machines inherently "more complex" than others? Or if not, is there at least a way to describe some of the local and global properties of the "asymmetric distance" function $I$?
My feeling is that there should be some meaningful "absolute" sense in which machines such as those in Stay's paper can be considered simple, but this might be hard to pin down...
(Wasn't quite sure how to tag this one; feel free to change some of the tags.)

There was originally an extra question, which I'd still be interested in addressing if it can be made precise:

Consider the class of Turing-equivalent models of computation whose
  programs and data are encoded as finite binary strings. Any such model
  lives in a countable equivalence class of models which have (finite)
  interpreters for each other; we can restrict ourselves to considering
  the countable class containing some familiar model.
(As an aside, I'm not sure how or if one could explicitly describe a
  model not belonging to this familiar class. Could there be some sort
  of diagonalization argument which allows one to ensure
  Turing-equivalence of the result? Or are there really only countably
  many such models in the first place...? Maybe this deserves its own
  question, but I suspect the answer's completely trivial once the right
  concepts are formulated.)


text:
Q: Why should base64_encode fail?
Description
Encodes the given data with base64.
This encoding is designed to make binary data survive transport through transport layers that are not 8-bit clean, such as mail bodies.
Base64-encoded data takes about 33% more space than the original data.
Return Values
The encoded data, as a string or FALSE on failure.

The above quote taken from PHP.net claims that the function may fail. But for what reason(s)?

A: It says it may return false on failure. An example would be if you try to encode an array like this:
if(base64_encode([])){
  echo "Encoded";
} else {
  echo "Not encoded"; //It will execute this
}

A: Simple,
If the argument you try to encode cannot be encoded due to not being the valid data type, base64_encode() will fail. I guess it will return false if it does.
For example:
$array = array('bla');
var_dump($array);

Would fail and return false. It will also throw an E_WARNING for passing an invalid argument.


text:
Q: How to align text and images with on click of an image in javascript/jquery? I have a fiddle which I have replicated by seeing the screenshot below:

The screenshot and the fiddle is working in a way that if I hit on any of the items above the following changes happen:

*

*Background-color changes into green.

*Icons and Text turn into white.

The sample JQuery code which I have used in order to make that happen are:
$("#franchisehub").click(function() {
  if ($('.franchisehubtv').css('display') == "flex") {
    $('.arrow-down').css('display', 'none');
    $('.franchisehubtv').css('display', 'none');
    $('#franchisehub img.black').css('display', 'none');

  } else {
    resetAll();
    $('#franchisehub').css('background-color', 'green');
    $('#franchisehub p').css('color', 'white');
    $('.franchisehubtv').css('display', 'flex');
    $('#franchisehub img.black').css('display', 'none');
    $('#franchisehub img.white').css('display', 'inline-block');

  }

});

Problem Statement:
In the fiddle, when I hit on any of the items, the text (present in the square box) comes towards the center of the box and whereas when its not being clicked it comes outside of the square box (which I don't want to happen).
I am wondering what changes I need to make in the fiddle so that when the items are being clicked and when the items are not being clicked, it should remain at the same position.

A: This is a long answer, so I put it here.
In the original CSS, you should hide the second image in the first place
.white{
 display: none;
}

Then, in the script, you can hide the .black when you click:
 $("#franchisehub").click(function() {
      if ($('.franchisehubtv').css('display') == "flex") {
        $('.arrow-down').css('display', 'none');
        $('.franchisehubtv').css('display', 'none');
        $('#franchisehub img.white').css('display', 'inline-block');
        $('#franchisehub img.black').css('display', 'none');

      } else {
        resetAll();
        $('#franchisehub').css('background-color', 'green');
        $('#franchisehub p').css('color', 'white');
        $('.franchisehubtv').css('display', 'flex');
        $('#franchisehub img.black').css('display', 'none');
        $('#franchisehub img.white').css('display', 'inline-block');

      }

Inside your resetAll(), you should have this too:
  $('#franchisehub img.black').css('display', 'inline-block');
  $('#franchisehub img.white').css('display', 'none');

But your code has so many repetitions, you should find a way to reduce the amount of code. This function should be shortened by a lot! https://jsfiddle.net/866bh6du/1/

A: Both images are showing when a box is not selected, which pushes the text down.
Also, I recommend not using inline CSS styles and using more general selectors to keep it DRY.
Here's an example:

jQuery('.product').on('click', function() {
  jQuery(this).toggleClass('selected');
});
.product-all-contents {
  background-color: #f0f0f0;
}

.product-contents {
  margin-left: 15%;
  margin-right: 15%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
}

.product-contents .product {
  width: 10%;
  text-align: center;
  height: 150px;
  padding-top: 1%;
  padding-left: 1%;
  padding-right: 1%;
  border-style: solid;
  border-width: 3px;
  border-color: rgb(145, 147, 150);
  background-color: white;
  border-radius: 10px;
  font-size: 15px;
  font-family: 'Roboto';
  line-height: 1.2;
  color: rgb(58, 59, 60);
}

.product.selected {
  background-color: green;
  color: white;
}

.product img.white {
  display: none;
}
.product img.black {
  display: block;
}

.product.selected img.white {
  display: block;
}
.product.selected img.black {
  display: none;
}

Franchise Hub

Cloud Based & Mobile

Business Analytics

Tech Support

Order Management

Employee Management

White Label

Brand Control

Lead Tracking & CRM

Custom Invoicing

Goal Setting

Customization Tools

Royalty Calculator

Email Marketing

Just for fun, here's an example with pure CSS and no jQuery:

.product-all-contents {
  background-color: #f0f0f0;
}

.product-contents {
  display: flex;
  justify-content: center;
  align-items: stretch;
  flex-wrap: wrap;
}

.product-contents label {
  position: relative;
  flex: 0 0 20%;
}

.product {
  height: 100%;
  width: 100%;
  text-align: center;
  font-size: 15px;
  font-family: 'Roboto';
  line-height: 1.2;
  color: rgb(58, 59, 60);
  padding: 1%;
  background-color: white;
  border: 3px solid rgb(145, 147, 150);
  border-radius: 10px;
  box-sizing: border-box;
}

.product img.white {
  display: none;
}
.product img.black {
  display: inline-block;
}

.toggler {
  display: none;
}

.toggler:checked+.product {
  background-color: green;
  color: white;
}
.toggler:checked+.product img.white {
  display: inline-block;
  ;
}
.toggler:checked+.product img.black {
  display: none;
}

      <input type="checkbox" class="toggler">

Franchise Hub

      <input type="checkbox" class="toggler">

Cloud Based & Mobile

      <input type="checkbox" class="toggler">

Business Analytics

      <input type="checkbox" class="toggler">

Tech Support

      <input type="checkbox" class="toggler">

Order Management

      <input type="checkbox" class="toggler">

Employee Management

      <input type="checkbox" class="toggler">

White Label

      <input type="checkbox" class="toggler">

Brand Control

      <input type="checkbox" class="toggler">

Lead Tracking & CRM

      <input type="checkbox" class="toggler">

Custom Invoicing

      <input type="checkbox" class="toggler">

Goal Setting

      <input type="checkbox" class="toggler">

Customization Tools

      <input type="checkbox" class="toggler">

Royalty Calculator

      <input type="checkbox" class="toggler">

Email Marketing

A: If you can share the HTML code then it would be great, anyways here is how you can achieve this in a simple way...

$(".main-div").on('click', function() {
  $(this).css('background-color', 'green');
  $(this).css('color', 'white');
});

  Some text

  Some text

  Some text


text:
Q: Bind html select to router param I have a dashboard which shows some stats for a cause/charity that can be chosen from a dropdown. When the user changes a new cause/charity from the dropdown I want to transition the router so that the name of the cause/charity is included in the url e.g. /#dashboard/British Heart Foundation.
Here's my attempt, the controller observes the currently selected cause/charity and transitions if it changes. The problem is the transition is triggered when the current cause/charity is set after loading the route which causes an infinite loop. Now I know I could check the previous value of the cause and make sure it's not null before triggering a transition but my approach feels a little bit off. What would be the idiomatic way of binding controls to router params?
App.Router.map(function(){
  this.resource('dashboard', { path: '/dashboard/:cause' });
});

App.DashboardRoute = Ember.Route.extend({
  model: function(params){
    return {
      cause: params.cause,
      causes: ['British Heart Foundation', 'Great Ormand Street Hospital']
    }
  }
});

App.DashboardController = Ember.ObjectController.extend({
  changeCause : function(obj, keyName, value){
    this.get("target").transitionTo("dashboard", {cause: this.get("cause")});
  }.observes("cause")
});

<script type="text/x-handlebars" data-template-name="dashboard">
  {{ view Ember.Select contentBinding="controller.causes"  valueBinding="controller.cause" }}
  <h1>{{ controller.cause }}</h1>
</script>


text:
Q: How to select the first li How do you select the first li, if it does not have an unique identifier?
In the below list, (output via a cms) the only identifier is not unique and applies to all li elements. I would like to select an li, based on the content of the li. If the content of the li matches the string then I want to add a new li to the top.
String is "Audi", if the li contains "Audi" then add a new li to before the first instance.
Updated
JSFiddle http://jsfiddle.net/xbmz1umk/5/

Audi Red

Audi Blue

Audi Black

BMW Red

BMW Blue

BMW Black

Fiat Red

Fiat Blue

Fiat Black

A: You can select the first
 containing Audi using :contains() and :first selector.
 $("li:contains('Audi'):first")

You can insert a new list item before this using
$("li:contains('Audi'):first").before("

");


text:
Q: Time-efficient manipulation (zeroing) of expression I have huge matrices in the form of
mtx1 = {{24+24 FF[6,9] GG[5,10]+24 FF[7,8] GG[5,10]+24 FF[5,10] GG[6,9]+24 FF[6,9] GG[6,9]+24 FF[7,8] GG[6,9]+24 FF[5,10] GG[7,8]+24 FF[6,9] GG[7,8]+24 FF[7,8] GG[7,8],24+24 FF[5,10] GG[5,10]+24 FF[6,9] GG[5,10]+24 FF[7,8] GG[5,10]+24 FF[6,9] GG[6,9]+24 FF[7,8] GG[6,9]+24 FF[5,10] GG[7,8]+24 FF[6,9] GG[7,8]+24 FF[7,8] GG[7,8],24+24 FF[5,10] GG[5,10]+24 FF[6,9] GG[5,10]+24 FF[7,8] GG[5,10]+24 FF[5,10] GG[6,9]+24 FF[6,9] GG[6,9]+24 FF[7,8] GG[6,9]+24 FF[6,9] GG[7,8]+24 FF[7,8] GG[7,8]},{24+24 FF[5,10] GG[5,10]+24 FF[7,8] GG[5,10]+24 FF[5,10] GG[6,9]+24 FF[6,9] GG[6,9]+24 FF[7,8] GG[6,9]+24 FF[5,10] GG[7,8]+24 FF[6,9] GG[7,8]+24 FF[7,8] GG[7,8],24+24 FF[5,10] GG[5,10]+24 FF[6,9] GG[5,10]+24 FF[7,8] GG[5,10]+24 FF[5,10] GG[6,9]+24 FF[7,8] GG[6,9]+24 FF[5,10] GG[7,8]+24 FF[6,9] GG[7,8]+24 FF[7,8] GG[7,8],24+24 FF[5,10] GG[5,10]+24 FF[6,9] GG[5,10]+24 FF[7,8] GG[5,10]+24 FF[5,10] GG[6,9]+24 FF[6,9] GG[6,9]+24 FF[7,8] GG[6,9]+24 FF[5,10] GG[7,8]+24 FF[7,8] GG[7,8]},{24+24 FF[5,10] GG[5,10]+24 FF[6,9] GG[5,10]+24 FF[5,10] GG[6,9]+24 FF[6,9] GG[6,9]+24 FF[7,8] GG[6,9]+24 FF[5,10] GG[7,8]+24 FF[6,9] GG[7,8]+24 FF[7,8] GG[7,8],24+24 FF[5,10] GG[5,10]+24 FF[6,9] GG[5,10]+24 FF[7,8] GG[5,10]+24 FF[5,10] GG[6,9]+24 FF[6,9] GG[6,9]+24 FF[5,10] GG[7,8]+24 FF[6,9] GG[7,8]+24 FF[7,8] GG[7,8],24+24 FF[5,10] GG[5,10]+24 FF[6,9] GG[5,10]+24 FF[7,8] GG[5,10]+24 FF[5,10] GG[6,9]+24 FF[6,9] GG[6,9]+24 FF[7,8] GG[6,9]+24 FF[5,10] GG[7,8]+24 FF[6,9] GG[7,8]}};

but the matrices I use are much bigger. Now I want to get rid of each term that contains FF[___] or GG[___]. Both always come together, therefore I used
mtx2 = mtx1 /. FF[___] -> 0;
(* mtx2={{24, 24, 24}, {24, 24, 24}, {24, 24, 24}} *)

and got the desired result in mtx2. Unfortunatly it turns out that this zeroing is extremly time-consuming. For my huge matrices, it takes on the order of 100 seconds.
Question:
Is there a more time-efficient way to zero all FF[___]-terms in mtx1?
Comparison:
I compare several approaches, for a big 3 big test-matrix. The approaches also include the construction of the matrix.
my original approach

*

*{174.8417751, 65.4913582, 25.3878123} seconds

Coefficient-Creation of Matrix

*

*{134.4920621, 51.4260521sec, 19.6079772} seconds

belisarius' Block-evaluation methode

*

*{82.3675688, 31.5639078, 12.3822025} seconds

eldo's Join/Partition

*

*{77.8615328, 29.0973367, 11.2742769} seconds

kguler's Block-evaluation

*

*{75.8906436, 29.1315892, 11.6544345} seconds

Mr.Wizard's mtx1[[All, All, 1]]

*

*{75.5589726, 29.0378220, 11.9491954} seconds

Edit
The full problem, including the matrix-creation is posted here:
Time-efficient creation of matrix

A: For the example you gave FF[___] and GG[___] are the only non-number terms, therefore by polynomial sort order you could use simply:
mtx1[[All, All, 1]]

{{24, 24, 24}, {24, 24, 24}, {24, 24, 24}}

I shall now look at your newer question where I anticipate a more representative example.

A: Given the structure of your SQUARE example matrix this should be fast:
dim = First @ Dimensions @ mtx1

3

tup = Join [#, {1}] & /@ Tuples[Range@dim, 2]

{{1, 1, 1}, {1, 2, 1}, {1, 3, 1}, {2, 1, 1}, {2, 2, 1}, {2, 3, 1},
  {3,1, 1}, {3, 2, 1}, {3, 3, 1}}

Partition[mtx1[[#1, #2, #3]] & @@@ tup, dim]

{{24, 24, 24}, {24, 24, 24}, {24, 24, 24}}

Oneliner:
With[{dim = First@Dimensions@mtx1},
 Partition[mtx1[[#1, #2, #3]] & @@@ #, dim] &[
  Join [#, {1}] & /@ Tuples[Range@dim, 2]]]


text:
Q: Grails 3.0 / IntelliJ 14.1.4 creating controllers, services, domain classes not working When I try to create a Grails domain class, controller (anything, really) using IntelliJ 14.1.4 results in failures from the Gradle commands that IntelliJ is calling, for instance:
9:29:45 AM: Executing external task 'grails-create-domain-class -PgrailsArgs="Koos --non-interactive -plain-output"'...

FAILURE: Build failed with an exception.

* What went wrong:
Task 'grails-create-domain-class' not found in root project 'Koos'.

* Try:
Run gradle tasks to get a list of available tasks. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 1.326 secs
Task 'grails-create-domain-class' not found in root project 'Koos'.
9:29:47 AM: External task execution finished 'grails-create-domain-class -PgrailsArgs="Koos --non-interactive -plain-output"'.

The Gradle project is pulled in, the Grails view is active on this project.
Is this an IntelliJ bug? Am I doing something wrong? If I call this directly on the CLI it also fails.

These are the steps to reproduce the error:
Install Grails 3.0 using gvm tool:
gvm install grails

Check version:
grails --version

Result:
Grails Version: 3.0.4
Groovy Version: 2.4.4
JVM Version: 1.8.0_45

Create an app:
grails create-app Koos

After pulling the needed jars from the intertubes, it says Application created
Create the Idea projects:
gradle idea

Then open the project with IntelliJ. After configuring the gradle import, right-clicking on domains and selecting "Create Domain Class" results in the error.

A: Actually IntelliJ 14.1.4 still not support the command line command of Grails 3.0.x I think build system gradle is the fact. Intellij idea can not apply this build system for Grails yet.